Commit 5f561eb5 by 兰国旗

Merge branch 'center-order' of gitlab.gongsibao.com:jiangyong/zhichan into center-order

parents 45f2656f 37c25121
...@@ -50,6 +50,9 @@ class IcAPI extends APIBase { ...@@ -50,6 +50,9 @@ class IcAPI extends APIBase {
case "getItemByChannelSolutionNo"://渠道方案号获取需求详情 case "getItemByChannelSolutionNo"://渠道方案号获取需求详情
opResult = await this.needinfoSve.getItemByChannelSolutionNo(pobj, pobj.actionBody, req); opResult = await this.needinfoSve.getItemByChannelSolutionNo(pobj, pobj.actionBody, req);
break; break;
case "getSolutionByChannelOrderNo"://渠道订单号获取方案详情
opResult = await this.needinfoSve.getSolutionByChannelOrderNo(pobj, pobj.actionBody, req);
break;
case "writeCommunicationLog"://渠道方案号获取需求详情 case "writeCommunicationLog"://渠道方案号获取需求详情
opResult = await this.needinfoSve2.writeCommunicationLog(pobj, pobj.actionBody, req); opResult = await this.needinfoSve2.writeCommunicationLog(pobj, pobj.actionBody, req);
break; break;
......
...@@ -10,6 +10,7 @@ class NeedinfoService extends ServiceBase { ...@@ -10,6 +10,7 @@ class NeedinfoService extends ServiceBase {
this.needsolutionSve = system.getObject("service.dbneed.needsolutionSve"); this.needsolutionSve = system.getObject("service.dbneed.needsolutionSve");
this.needsolutionDao = system.getObject("db.dbneed.needsolutionDao"); this.needsolutionDao = system.getObject("db.dbneed.needsolutionDao");
this.needinfoDao = system.getObject("db.dbneed.needinfoDao"); this.needinfoDao = system.getObject("db.dbneed.needinfoDao");
this.orderinfoDao = system.getObject("db.dbcorder.orderinfoDao");
} }
async getItemByNeedNo(pobj) { async getItemByNeedNo(pobj) {
var item = await this.dao.getItemByNeedNo(pobj.actionBody.needNo); var item = await this.dao.getItemByNeedNo(pobj.actionBody.needNo);
...@@ -171,16 +172,30 @@ class NeedinfoService extends ServiceBase { ...@@ -171,16 +172,30 @@ class NeedinfoService extends ServiceBase {
async getItemByChannelSolutionNo(pobj) { async getItemByChannelSolutionNo(pobj) {
var solutionitem = await this.needsolutionDao.findOne({ channelSolutionNo: pobj.actionBody.bizId }); var solutionitem = await this.needsolutionDao.findOne({ channelSolutionNo: pobj.actionBody.bizId });
if (!solutionitem) { if (!solutionitem) {
return system.getResult(null, "需求数据为空,30210"); return system.getResult(null, "方案数据为空,30210");
} }
var item = await this.dao.getItemByNeedNo(solutionitem.needNo); var item = await this.dao.getItemByNeedNo(solutionitem.needNo);
if (!item) {
return system.getResult(null, "需求数据为空,30210");
}
// fixme 阿里直购需要更改 // fixme 阿里直购需要更改
item.solutionProvince = solutionitem.solutionContent.solution.Area item.solutionProvince = solutionitem.solutionContent.solution.Area
//item.solutionProvince = solutionitem.solutionContent.solution.Area + `(${solutionitem.solutionContent.solution.actionType})`//北京(新办); //item.solutionProvince = solutionitem.solutionContent.solution.Area + `(${solutionitem.solutionContent.solution.actionType})`//北京(新办);
item.solutionContent = solutionitem.solutionContent item.solutionContent = solutionitem.solutionContent
item.channelSolutionNo = solutionitem.channelSolutionNo item.channelSolutionNo = solutionitem.channelSolutionNo
return system.getResultSuccess(item);
}
async getSolutionByChannelOrderNo(pobj){
var orderinfo = await this.orderinfoDao.findOne({ channelOrderNo: pobj.actionBody.orderNo });
if (!orderinfo || !orderinfo.orderNo) {
return system.getResult(null, "订单数据为空,30210");
}
var item = await this.needsolutionDao.model.findOne({
where:{orderNo:orderinfo.orderNo}
});
if (!item) { if (!item) {
return system.getResult(null, "需求数据为空,30210"); return system.getResult(null, "方案数据为空,30210");
} }
return system.getResultSuccess(item); return system.getResultSuccess(item);
} }
......
...@@ -489,16 +489,51 @@ class NeedsolutionService extends ServiceBase { ...@@ -489,16 +489,51 @@ class NeedsolutionService extends ServiceBase {
// 2020 1021 lin 修改 if (ab.isDirectBuy 为 ==true 原因 实际传的是字符串不是布尔 // 2020 1021 lin 修改 if (ab.isDirectBuy 为 ==true 原因 实际传的是字符串不是布尔
if (ab.isDirectBuy === "true"){//直购先创建空方案 if (ab.isDirectBuy === "true"){//直购先创建空方案
var solutionNo = await this.getBusUid("ns"); var solutionNo = await this.getBusUid("ns");
var oldNs = await this.dao.model.findOne({
where: { orderNo: ab.orderNo }
});
var solutionContent = {
"status": "PAID",
"bizType": ab.product_info && ab.product_info.item_code?ab.product_info.item_code:"",
"solution": {
"Area": ab.area || "",
"IcpType": ab.bizId.startsWith("EDI")?7:5,
"CompanyName": ab.companyName || "",
"CompanyAddress": ab.area || "",
actionType:ab.actionType,
Source:ab.source
},
"totalSum": ab.totalSum || Number(ab.orderPrice || "0"),
"typeCode": ab.product_info && ab.product_info.item_code?ab.product_info.item_code:"",
"typeName": ab.product_info && ab.product_info.item_name?ab.product_info.item_name:"",
"needStatus": "3",
"statusName": "用户支付",
"customerInfo": {
"publishName": pobj.userInfo.channel_nickname || "",
"publishMobile": pobj.userInfo.mobile || ""
},
"customerRemark": "",
"needStatusName": "处理中",
"customerMaterial": {},
"solutionFlowList": [
{
"status": "PAID",
"statusName": "用户支付",
"updated_at": new Date()
}
]
};
if (oldNs && oldNs.id ){
oldNs.solutionContent = JSON.stringify(solutionContent)
ns = await oldNs.save();
}else {
ns = await this.create({ ns = await this.create({
solutionNo, solutionNo,
...ab, ...ab,
status:"ywc", status: "ywc",
solutionContent:JSON.stringify({ solutionContent: JSON.stringify(solutionContent)
totalSum: Number(ab.orderPrice || "0"),
actionType:ab.actionType,
Source:ab.source
})
}) })
}
}else { }else {
if (!ab.channelSolutionNo) { if (!ab.channelSolutionNo) {
return system.getResultFail(-101, "渠道方案编号不能为空"); return system.getResultFail(-101, "渠道方案编号不能为空");
......
...@@ -201,12 +201,12 @@ class BaiduQcService { ...@@ -201,12 +201,12 @@ class BaiduQcService {
} }
//关闭ICP订单 百度icp 2.4 //关闭ICP订单 百度icp 2.4
async icpOrderClose(pobj) { async icpOrderClose(pobj) {
var ab = pobj; var ab = pobj.actionBody;
if (!ab.channelOrderNo) { if (!ab.orderNo) {
return system.getResultFail(-101, "渠道订单号不能为空"); return system.getResultFail(-101, "渠道订单号不能为空");
} }
var orderInfo = await this.orderinfoDao.model.findOne({ var orderInfo = await this.orderinfoDao.model.findOne({
where:{channelOrderNo:ab.channelOrderNo},raw:true where:{channelOrderNo:ab.orderNo},raw:true
}); });
if (!orderInfo || !orderInfo.id) { if (!orderInfo || !orderInfo.id) {
return system.getResultFail(-103, "未知订单"); return system.getResultFail(-103, "未知订单");
......
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