Commit 9632428e by 庄冰

icp

parent bfea29bf
......@@ -73,7 +73,9 @@ class QcAPI extends APIBase {
case "closeOrderDelivery"://交付商关闭交付单
opResult = await this.aliyunqcSve.closeOrderDelivery(pobj);
break;
case "abolishIcpProgrammeByNeed"://前端关闭ICP需求
opResult = await this.aliyunqcSve.abolishIcpProgrammeByNeed(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -416,52 +416,7 @@ class NeedsolutionService extends ServiceBase {
await this.dao.model.update({ status: "yzf",isInvalid:1 }, { where: { needNo: needinfo.needNo } });//方案废弃
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) {
var ab = pobj.actionBody;
......
......@@ -26,6 +26,52 @@ class AliyunQcService{
512:"⼯商部未通过"
};
}
//根据需求关闭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.needsolutionDao.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.needsolutionDao.db.transaction(async function (t) {
var needObj = {
id:needinfo.id,status:"ygb",notes:ab.note
};
await self.needinfoDao.update(needObj,t);//关闭需求
await self.needsolutionDao.model.update({ status: "yzf",isInvalid:1 }, { where: { needNo: needinfo.needNo,isInvalid:0 }, transaction: t });//方案废弃
return system.getResultSuccess();
})
}
//根据需求查看方案列表
async getProgrammeInfoByChannelNeedNo(pobj) {
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