Commit e2ff7626 by 王栋源

wdy

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