Commit aa2e4462 by 宋毅

修改结果

parent cae4c9f1
const system = require("../../../system");
const moment = require('moment')
/**
* 百度增值电信相关接口(ICP、EDI)
* created by zhuangbing
......@@ -80,18 +81,18 @@ class BaiduQcService {
if (!ab.status) {
return system.getResultFail(-102, "方案状态不能为空");
}
if(ab.isDirectBuy && ab.isDirectBuy==1 && ab.status==1){//直接下单,无方案 直接返回
if (ab.isDirectBuy && ab.isDirectBuy == 1 && ab.status == 1) {//直接下单,无方案 直接返回
return system.getResultSuccess();
}
//获取方案信息
var ns = await this.needsolutionDao.model.findOne({
where: { channelSolutionNo: ab.BizId, isInvalid: 0 }, raw: true
where: {channelSolutionNo: ab.BizId, 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
where: {needNo: ns.needNo}, raw: true
});
if (!needinfo) {
return system.getResultFail(-104, "未知方案需求");
......@@ -111,11 +112,11 @@ class BaiduQcService {
//方案流程列表
var solutionFlowList = solutionContent.solutionFlowList || [];
if (ab.status == "1") {//⽤户已支付
var afterStatusList=[//用户支付后的流程状态
var afterStatusList = [//用户支付后的流程状态
"USER_UPLOADED", "MATERIAL_UNCONFIRM", "USER_CONFIRMED", "ACCOUNT_REGISTERED",
"MATERIAL_SUBMITTED","GXB_ACCEPT","GXB_REFUSE","GXB_FAIL","GXB_SUCCESS","CLOSE"
"MATERIAL_SUBMITTED", "GXB_ACCEPT", "GXB_REFUSE", "GXB_FAIL", "GXB_SUCCESS", "CLOSE"
];
if(!solutionContent.status || afterStatusList.indexOf(solutionContent.status)<0){
if (!solutionContent.status || afterStatusList.indexOf(solutionContent.status) < 0) {
solutionFlowList.push({
status: "PAID", statusName: this.icpSolutionStatusReference.PAID, updated_at: new Date()
});
......@@ -132,7 +133,9 @@ class BaiduQcService {
return system.getResultFail(-112, "操作失败,⽤户已确认递交⽂件");
}
solutionFlowList.push({
status: "USER_UPLOADED", statusName: this.icpSolutionStatusReference.USER_UPLOADED, updated_at: new Date()
status: "USER_UPLOADED",
statusName: this.icpSolutionStatusReference.USER_UPLOADED,
updated_at: new Date()
});
solutionContent.status = "USER_UPLOADED";
solutionContent.statusName = this.icpSolutionStatusReference.USER_UPLOADED;
......@@ -141,7 +144,9 @@ class BaiduQcService {
return system.getResultFail(-113, "操作失败,服务商递交⽂件后才能执行此操作");
}
solutionFlowList.push({
status: "USER_CONFIRMED", statusName: this.icpSolutionStatusReference.USER_CONFIRMED, updated_at: new Date()
status: "USER_CONFIRMED",
statusName: this.icpSolutionStatusReference.USER_CONFIRMED,
updated_at: new Date()
});
solutionContent.status = "USER_CONFIRMED";
solutionContent.statusName = this.icpSolutionStatusReference.USER_CONFIRMED;
......@@ -195,10 +200,11 @@ class BaiduQcService {
}
await this.needsolutionDao.update(updateObj);//方案状态修改
var new_ns = await this.needsolutionDao.model.findOne({
where: { id: ns.id }, raw: true
where: {id: ns.id}, raw: true
});
return system.getResultSuccess(ns);
}
//关闭ICP订单 百度icp 2.4
async icpOrderClose(pobj) {
var ab = pobj.actionBody;
......@@ -206,24 +212,24 @@ class BaiduQcService {
return system.getResultFail(-101, "渠道订单号不能为空");
}
var orderInfo = await this.orderinfoDao.model.findOne({
where:{channelOrderNo:ab.orderNo},raw:true
where: {channelOrderNo: ab.orderNo}, 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
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
where: {needNo: ns.needNo}, raw: true
});
var solutionContent = ns.solutionContent;
var checkStatus = {
MATERIAL_UNCONFIRM:"服务商递交文件",
MATERIAL_UNCONFIRM: "服务商递交文件",
ACCOUNT_REGISTERED: "完成账户注册", MATERIAL_SUBMITTED: "完成资料递交",
GXB_ACCEPT: "⼯信部已受理", GXB_REFUSE: "⼯信部不予受理", GXB_FAIL: "⼯信部未通过", GXB_SUCCESS: "工信部通过"
};
......@@ -243,19 +249,22 @@ class BaiduQcService {
}
solutionContent = JSON.stringify(solutionContent);
var updateObj = {
id: ns.id, solutionContent: solutionContent,status:"yzf",isInvalid:1
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
if (ab.isNewMethod && ab.isNewMethod == 1) {
await this.orderinfoDao.update({id: orderInfo.id, orderStatus: 16});//订单状态修改
}
let 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;
......@@ -265,14 +274,14 @@ class BaiduQcService {
var salesmanObj = ab.salesmanInfo;
//获取方案信息
var ns = await this.needsolutionDao.model.findOne({
where: { orderNo: ab.orderNo, isInvalid: 0 }, raw: true
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)}
solutionContent.salesmanInfo = salesmanObj;
var updateObj = {id: ns.id, solutionContent: JSON.stringify(solutionContent)}
await this.needsolutionDao.update(updateObj);//方案状态修改
return system.getResultSuccess(solutionContent);
}
......@@ -302,4 +311,5 @@ class BaiduQcService {
// let res = await this.orderinfoDao.update(UpdateObj);//更新订单
// }
}
module.exports = BaiduQcService;
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