Commit 4d0493ec by 庄冰

baiduIcp

parent 3848464f
......@@ -75,6 +75,11 @@ class IcAPI extends APIBase {
case "getProgrammeInfoByChannelSolutionNo"://修改退款方案状态
opResult = await this.needsolutionSve.getProgrammeInfoByChannelSolutionNo(pobj);
break;
// --------------庄冰2020.10.21-------百度Icp接入使用--------start------------------
case "receiveSolutionPayInfoNew"://接收方案状态及支付信息(方案支付后创建订单时调用)
opResult = await this.needsolutionSve.receiveSolutionPayInfoNew(pobj);
break;
// --------------庄冰2020.10.21-------百度Icp接入使用--------end------------------
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -5,6 +5,7 @@ class QcAPI extends APIBase {
constructor() {
super();
this.aliyunqcSve = system.getObject("service.qcutils.aliyunqcSve");
this.baiduqcSve = system.getObject("service.qcutils.baiduqcSve");
}
/**
* 接口跳转-POST请求
......@@ -108,6 +109,9 @@ class QcAPI extends APIBase {
opResult = await this.aliyunqcSve.foodRecordLog(pobj);
break;
case "receiveOrderStatusNotify"://接收订单状态推送 百度icp 2.3
opResult = await this.baiduqcSve.receiveOrderStatusNotify(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -1145,8 +1145,97 @@ class NeedsolutionService extends ServiceBase {
return system.getResultSuccess(ns);
}
//---------------------icp注册-end-----------------------------------------------------------------
// --------------庄冰2020.10.23-------百度Icp接入使用--------start------------------
//接收方案状态及支付信息
async receiveSolutionPayInfoNew(pobj) {
var ab = pobj.actionBody;
var app = pobj.appInfo;
if (!app || !app.uapp_id) {
return system.getResultFail(-100, "未知渠道");
}
if (!ab.channelSolutionNo) {
return system.getResultFail(-101, "渠道方案编号不能为空");
}
if(ab.isDirectBuy && ab.isDirectBuy==1){//直接下单
var oldNs = await this.dao.model.findOne({
where: { orderNo: ab.orderNo }, raw: true
});
var newNsObj={
orderNo:ab.orderNo,channelSolutionNo:ab.channelSolutionNo,solutionNo:ab.channelSolutionNo,
needNo:ab.bizId,channelNeedNo:ab.bizId,status:"ywc"
};
var newSolutionCount = {
"status": "PAID",
"bizType": ab.product_info && ab.product_info.item_code?ab.product_info.item_code:"",
"solution": {
"Area": ab.area || "",
"IcpType": ab.consultType,
"CompanyName": ab.companyName || "",
"CompanyAddress": ab.area || ""
},
"totalSum": ab.totalSum || "",
"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()
}
]
};
newNsObj.solutionContent = JSON.stringify(newSolutionCount);
var ns = null;
if(oldNs && oldNs.id){
ns = oldNs;
}else{
ns = await this.dao.create(newNsObj);
}
var ns2 = await this.dao.model.findOne({
where: { id: ns.id }, raw: true
});
return system.getResultSuccess(ns2);
}else{
var needsolutioninfo = await this.dao.model.findOne({
attributes:["id","solutionContent","status","orderNo"],
where: { channelSolutionNo: ab.channelSolutionNo,isInvalid:0 }, raw: true
});
if (!needsolutioninfo || !needsolutioninfo.id) {
return system.getResultFail(-400, "未知方案");
}
var solutionContent = needsolutioninfo.solutionContent;
if (ab.orderPrice) {
// solutionContent = JSON.parse(solutionContent);
solutionContent["totalSum"] = Number(ab.orderPrice || "0");
}
// 2020 1017 lin 新增去掉status的判断,生成订单这个方案才算完成,所以没必要再判断,另一个原因网文2.3每个状态都有不同status,所以不能以来有没有status来决定方案完成情况。
// if (ab.status) {
// needsolutioninfo.status = "ywc";
// }
if (ab.orderNo) {
needsolutioninfo.orderNo = ab.orderNo;
needsolutioninfo.status = "ywc";
}
needsolutioninfo.solutionContent = JSON.stringify(solutionContent);
await this.dao.update(needsolutioninfo);
var ns = await this.dao.model.findOne({
where: { id: needsolutioninfo.id }, raw: true
});
return system.getResultSuccess(ns);
}
}
// --------------庄冰2020.10.23-------百度Icp接入使用--------end------------------
}
module.exports = NeedsolutionService;
// var task = new NeedsolutionService();
......
......@@ -251,9 +251,6 @@ class AliyunQcService {
if (!solution.Area) {
return system.getResultFail(-107, "区域不能为空");
}
/* if (!solution.ActionType) {
return system.getResultFail(-108, "办理类型不能为空");
}*/
var solutionFlowList = ab.solutionContent.solutionFlowList || [];
solutionFlowList.push({
status: "SOLUTION_SUBMIT", statusName: this.icpSolutionStatusReference.SOLUTION_SUBMIT, updated_at: new Date()
......
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