Commit e2ff7626 by 王栋源

wdy

parent 870c3be7
......@@ -49,37 +49,17 @@ class NeedinfoService extends ServiceBase {
async submitNeed(pobj, actionBody, req) {
var needNo = await this.getBusUid("n");
if (!actionBody.intentionBizId) {
return {
"requestId": req.requestId,
"success": false,
"errorMsg": "intentionBizId不能为空",
"errorCode": "ok"
};
return system.getResultFail(-5001,"intentionBizId不能为空");
}
if (!actionBody.mobile) {
return {
"requestId": req.requestId,
"success": false,
"errorMsg": "mobile不能为空",
"errorCode": "ok"
};
return system.getResultFail(-5002,"mobile不能为空");
}
if (!actionBody.type) {
return {
"requestId": req.requestId,
"success": false,
"errorMsg": "type不能为空",
"errorCode": "ok"
};
return system.getResultFail(-5003,"type不能为空");
}
var ninfo = await this.findOne({ channelNeedNo: actionBody.intentionBizId });
if (ninfo) {
return {
"requestId": req.requestId,
"success": true,
"errorMsg": "已存在",
"errorCode": "ok"
};
return system.getResultSuccess();
}
var nobj = {
uapp_id: pobj.appInfo.uapp_id,
......@@ -95,45 +75,25 @@ class NeedinfoService extends ServiceBase {
status: "wts"
}
await this.dao.create(nobj);
return {
"requestId": req.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
return system.getResultSuccess();
}
async needClose(pobj, actionBody, req) {
if (!actionBody.intentionBizId) {
return system.getResult(null, "intentionBizId不能为空");
return system.getResultFail(-5005, "intentionBizId不能为空");
}
var needinfo = await this.findOne({ channelNeedNo: actionBody.intentionBizId });
if (!needinfo) {
return {
"requestId": req.requestId,
"success": false,
"errorMsg": "需求不存在",
"errorCode": "ok"
};
return system.getResultFail(-5004,"需求不存在");
}
if (needinfo.status == "ygb" || needinfo.status == "ycd") {
return {
"requestId": req.requestId,
"success": true,
"errorMsg": "需求已关闭",
"errorCode": "ok"
};
return system.getResultSuccess();
} else {
needinfo.status = "ygb";
var self = this;
await self.update(needinfo.dataValues);
await self.needsolutionSve.abolishProgrammeByNeed(pobj);
return {
"requestId": req.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
return system.getResultSuccess();
}
}
......
......@@ -84,7 +84,6 @@ class NeedsolutionService extends ServiceBase {
var solutionNo = await this.getBusUid("ns");
ab["solutionNo"] = solutionNo;
ab["status"] = "dqr";
ab.solutionContent.notes="";
ab.solutionContent = JSON.stringify(ab.solutionContent);
var self = this;
return await this.db.transaction(async function (t) {
......@@ -150,9 +149,17 @@ class NeedsolutionService extends ServiceBase {
return system.getResultFail(-100,"未知用户");
}
ab["createUserId"]=user.id;
// followManMobile: DataTypes.STRING,//跟进人手机号(合伙人)
// followManOnlyCode: DataTypes.STRING(50),//跟进者唯一码
if(!ab.needNo){
return system.getResultFail(-101,"需求号不能为空");
}
// if(!ab.followManMobile){
// return system.getResultFail(-102,"跟进人手机号不能为空");
// }
// if(!ab.followManOnlyCode){
// return system.getResultFail(-103,"跟进人唯一码不能为空");
// }
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
where:{needNo:ab.needNo},raw:true
......@@ -260,34 +267,19 @@ class NeedsolutionService extends ServiceBase {
}
//接收方案反馈信息(即方案作废)
async receiveFeedback(pobj,req){
async receiveFeedback(pobj){
var ab = pobj.actionBody;
if(!ab.solutionBizId){
return {
"requestId": req.requestId,
"success": false,
"errorMsg": "-101,方案业务编号不能为空",
"errorCode": "ok"
};
return system.getResultFail(-101,"方案业务编号不能为空");
}
if(!ab.operateType){
return {
"requestId": req.requestId,
"success": false,
"errorMsg": "-102,操作类型不能为空",
"errorCode": "ok"
};
return system.getResultFail(-102,"操作类型不能为空");
}
var ns = await this.dao.model.findOne({
where:{channelSolutionNo:ab.solutionBizId},raw:true
});
if(!ns || !ns.id){
return {
"requestId": req.requestId,
"success": false,
"errorMsg": "-103,未知方案",
"errorCode": "ok"
};
return system.getResultFail(-103,"未知方案");
}
var solutionContent = ns.solutionContent?JSON.parse(ns.solutionContent):"";
var status = "";
......@@ -298,31 +290,21 @@ class NeedsolutionService extends ServiceBase {
}else if(ab.operateType=="PAID"){// PAID:支付
status="ywc";
}else{
return {
"requestId": req.requestId,
"success": false,
"errorMsg": "-104,操作类型有误",
"errorCode": "ok"
};
return system.getResultFail(-104,"操作类型有误");
}
var solution_status={"dqr":"待确认","ywc":"已完成","yzf":"已作废"};
solutionContent["deliveryStatus"] = status;
solutionContent["deliveryStatusName"] = solution_status[status];
solutionContent["updated"] = new Date();
if(ab.note){
solutionContent["notes"] = ab.note;//用户反馈信息
solutionContent["notes"] = ab.note;
}
solutionContent = JSON.stringify(solutionContent);
var reqObj={
status:status,solutionContent:solutionContent
};
await this.dao.model.update(reqObj, { where: { id: ns.id }});//修改方案信息
return {
"requestId": req.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};;
return system.getResultSuccess();
}
//服务商方案作废
async abolishProgramme(pobj){
......@@ -345,7 +327,7 @@ class NeedsolutionService extends ServiceBase {
return system.getResultFail(-103,"方案状态错误,只能废弃待确认方案");
}
await this.dao.update({id:ns.id,status:"yzf"});//方案废弃
return system.getResultSuccess({channelSolutionNo:ns.channelSolutionNo});
return system.getResultSuccess();
}
//根据需求关闭方案(关闭需求后调用)
async abolishProgrammeByNeed(pobj){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment