Commit bfea29bf by 庄冰

abolishIcpProgrammeByNeed

parent 7d17f035
...@@ -416,7 +416,52 @@ class NeedsolutionService extends ServiceBase { ...@@ -416,7 +416,52 @@ class NeedsolutionService extends ServiceBase {
await this.dao.model.update({ status: "yzf",isInvalid:1 }, { where: { needNo: needinfo.needNo } });//方案废弃 await this.dao.model.update({ status: "yzf",isInvalid:1 }, { where: { needNo: needinfo.needNo } });//方案废弃
return system.getResultSuccess(); return system.getResultSuccess();
} }
//根据需求关闭ICP方案(关闭需求后调用)
async abolishIcpProgrammeByNeed(pobj) {
var ab = pobj.actionBody;
var app = pobj.appInfo;
if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道");
}
if (!ab.intentionBizId) {
return system.getResultFail(-101, "需求编号不能为空");
}
//获取需求信息
var needinfo = await this.needinfoDao.model.findOne({
attributes:["id","status","statusName","needNo"],
where: { channelNeedNo: ab.intentionBizId }, raw: true
});
if (!needinfo || !needinfo.id) {
return system.getResultFail(-201, "未知需求信息");
}
if (needinfo.status == "ygb") {
return system.getResultFail(-202, "该方案需求状态为" + needinfo.statusName + ",不能执行此操作");
}
//获取方案信息
var ns = await this.dao.model.findAll({
where: { needNo: needinfo.needNo,isInvalid:0 }, raw: true
});
for (var i = 0; i < ns.length; i++) {
var fa = ns[i];
if (fa.status == "ywc") {
return system.getResultFail(-103, "方案状态错误,不能废弃已完成方案");
}
var flowStatus = fa.solutionContent && fa.solutionContent.status?fa.solutionContent.status:"";
if(flowStatus && [ "GXB_REFUSE","CLOSE"].indexOf(flowStatus)<0){
return system.getResultFail(-104, "⽅案状态为关闭或不予受理才可关闭需求");
}
}
var self = this;
return await this.db.transaction(async function (t) {
var needObj = {
id:needinfo.id,status:"ygb",notes:ab.note
};
await self.needinfoDao.update(needObj,t);//关闭需求
await self.dao.model.update({ status: "yzf",isInvalid:1 }, { where: { needNo: needinfo.needNo,isInvalid:0 }, transaction: t });//方案废弃
return system.getResultSuccess();
})
}
//立即支付下单保存方案 //立即支付下单保存方案
async createSolutionByOrder(pobj) { async createSolutionByOrder(pobj) {
var ab = pobj.actionBody; var ab = pobj.actionBody;
......
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