Commit 8c4e28a6 by 庄冰

orderclose

parent 3375ccf7
......@@ -112,6 +112,12 @@ class QcAPI extends APIBase {
case "receiveOrderStatusNotify"://接收订单状态推送 百度icp 2.3
opResult = await this.baiduqcSve.receiveOrderStatusNotify(pobj);
break;
case "icpOrderClose"://关闭ICP订单 百度icp 2.4
opResult = await this.baiduqcSve.icpOrderClose(pobj);
break;
case "addIcpSalesmanInfo"://添加业务员信息,用于直接下单的icp订单
opResult = await this.baiduqcSve.addIcpSalesmanInfo(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -649,7 +649,7 @@ class BaiduQcService {
if (!ab.status) {
return system.getResultFail(-102, "方案状态不能为空");
}
if(ab.isDirectBuy && ab.isDirectBuy==1){//直接下单,无方案 直接返回
if(ab.isDirectBuy && ab.isDirectBuy==1 && ab.status==1){//直接下单,无方案 直接返回
return system.getResultSuccess();
}
//获取方案信息
......@@ -771,6 +771,83 @@ class BaiduQcService {
});
return system.getResultSuccess(ns);
}
//关闭ICP订单 百度icp 2.4
async icpOrderClose(pobj) {
var ab = pobj;
if (!ab.channelOrderNo) {
return system.getResultFail(-101, "渠道订单号不能为空");
}
var orderInfo = await this.orderinfoDao.model.findOne({
where:{channelOrderNo:ab.channelOrderNo},raw:true
});
if (!orderInfo || !orderInfo.id) {
return system.getResultFail(-103, "未知订单");
}
//获取方案信息
var ns = await this.needsolutionDao.model.findOne({
where: { orderNo: orderInfo.orderNo, isInvalid: 0 }, raw: true
});
if (!ns || !ns.id) {
return system.getResultFail(-102, "未知方案");
}
var needinfo = await this.needinfoDao.model.findOne({
where: { needNo: ns.needNo }, raw: true
});
var solutionContent = ns.solutionContent;
var checkStatus = {
MATERIAL_UNCONFIRM:"服务商递交文件",
ACCOUNT_REGISTERED: "完成账户注册", MATERIAL_SUBMITTED: "完成资料递交",
GXB_ACCEPT: "⼯信部已受理", GXB_REFUSE: "⼯信部不予受理", GXB_FAIL: "⼯信部未通过", GXB_SUCCESS: "工信部通过"
};
if (solutionContent.status && checkStatus[solutionContent.status]) {
return system.getResultFail(-111, "方案已进入" + solutionContent.statusName + "流程,不能执行此操作");
}
//方案流程列表
var solutionFlowList = solutionContent.solutionFlowList || [];
solutionFlowList.push({
status: "CLOSE", statusName: this.icpSolutionStatusReference.CLOSE, updated_at: new Date()
});
solutionContent.status = "CLOSE";
solutionContent.statusName = this.icpSolutionStatusReference.CLOSE;
solutionContent.solutionFlowList = solutionFlowList;
if (ab.remark) {
solutionContent.customerRemark = ab.remark;
}
solutionContent = JSON.stringify(solutionContent);
var updateObj = {
id: ns.id, solutionContent: solutionContent,status:"yzf",isInvalid:1
};
var self = this;
return await this.needsolutionDao.db.transaction(async function (t) {
await self.needsolutionDao.update(updateObj);//方案状态修改
// await this.orderinfoDao.update({id:orderInfo.id,orderStatus:16});//订单状态修改
var new_ns = await self.needsolutionDao.model.findOne({
where: { id: ns.id }, raw: true
});
return system.getResultSuccess(new_ns);
})
}
//添加业务员信息,用于直接下单的icp订单
async addIcpSalesmanInfo(pobj) {
var ab = pobj.actionBody;
if (!ab.orderNo) {
return system.getResultFail(-101, "订单号不能为空");
}
var salesmanObj = ab.salesmanInfo;
//获取方案信息
var ns = await this.needsolutionDao.model.findOne({
where: { orderNo: ab.orderNo, isInvalid: 0 }, raw: true
});
if (!ns || !ns.id) {
return system.getResultFail(-102, "未知方案");
}
var solutionContent = ns.solutionContent;
solutionContent.salesmanInfo=salesmanObj;
var updateObj = {id:ns.id,solutionContent:JSON.stringify(solutionContent)}
await this.needsolutionDao.update(updateObj);//方案状态修改
return system.getResultSuccess(solutionContent);
}
//接收icp用户方案反馈
async receiveIcpFeedback(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