Commit e3f57094 by 王勇飞

pp

parent 29aa74a5
......@@ -122,30 +122,64 @@ class BizOptCtl extends CtlBase {
async closeBizopt(mobj, qobj, req) {
let pobj = mobj.d;
pobj.business_status = "isClosed";
if (!qobj.demand_code || !qobj.close_reason) {
return system.getResultError("缺少必要参数.");
}
//根据需求编号去更新该条需求的状态为已关闭
try {
let res = await this.service.updateStatusByDemandCode(pobj);
//添加到记录表
pobj.operator = {
id: mobj.userid ? mobj.userid : "",
name: mobj.username ? mobj.username : ""
}
pobj.operation_type = "close";
pobj.operation_details = {
close_reason: pobj.close_reason,
remarks: pobj.remarks
}
let recordRes = await this.operationrecordSve.insertInfo(pobj);
//异步将该需求关闭信息同步到其他系统(走队列,融易算接口文档2.3)
//构造参数
let pushUrl = this.rysUrl + "leads/proposal/close";
let pushObj = {
pushUrl: pushUrl,
actionType: "close",
messageBody: pobj
//构造参数,添加判断(有方案信息的才走队列同步到融易算,没有的直接关闭)
let schemeRes = await this.schemeSve.findInfo(pobj);
if (schemeRes && schemeRes.solution_bizid) {
let pushObj = this.buildObj(pobj, schemeRes);
system.queueOper(pushObj);
} else {
console.log(pobj.demand_code + "该需求没有方案信息,不需要同步");
}
system.queueOper(pushObj);
return system.getResult("关闭需求成功!");
} catch (error) {
return system.getResultError("bizoptCtl/closeBizopt 关闭需求出错!");
}
}
buildObj(pobj, schemeRes) {
let pushUrl = this.rysUrl + "leads/proposal/close";
let solutionBizId;
if (schemeRes.solution_bizid) {
solutionBizId = schemeRes.solution_bizid;
}
let pushObj = {
pushUrl: pushUrl,
actionType: "close",
messageBody: {
IntentionBizId: pobj.demand_code,
BizType: "bookkeeping",
Solution: {
SolutionBizId: solutionBizId,//方案编号
Note: pobj.close_reason //备注
}
},
headData: {
'Source': 'GSB'
}
}
return pushObj;
}
/**
* 获取跟进详情页所有信息
* @param {*} mobj
......
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