Commit a8a3f0c8 by linboxuan

ali wangwen 2.3 produceNoticeAliEsp

parent d21b90dd
......@@ -32,11 +32,14 @@ class edi extends APIBase {
opResult = await this.utilsNeedSve.needCloseAliEsp(pobj,pobj.actionBody);
break;
case "produceNoticeAliEsp":
result = await this.utilsNeedSve.ediNotify(pobj, pobj.actionBody);
if (result.status == 0) {
opResult = await this.utilsNeedSve.ediNotify(pobj, pobj.actionBody);
if (opResult.status == 0) {
opResult = await this.utilsNeedSve.produceNoticeAliEsp(pobj,pobj.actionBody);
}
break;
break;
case "soulutionFeebackAliEsp":
opResult = await this.utilsNeedSve.soulutionFeebackAliEsp(pobj,pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -926,7 +926,6 @@ class UtilsNeedService extends AppServiceBase {
switch (actionBody.operationType) {
case "USER_PAY_PRODUCE":
// 修改需求,方案 订单状态
// 走addOrder流程
// 第一步查处需求单 原因 询价/创建 需要商品数据 用户数据
pobj.actionBody.needNo = pobj.actionBody.intentionBizId
pobj.actionType = "getItemByChannelNeedNo";
......@@ -954,53 +953,96 @@ class UtilsNeedService extends AppServiceBase {
var tmpOpResult = await this.utilsAuthSve.getLoginByUserName(pobj, pobj.actionBody);
pobj.userInfo = tmpOpResult.data
// 第三步 走addOrder流程
var pobjStr = JSON.stringify(pobj);
var qobj = JSON.parse(pobjStr);
qobj.actionBody = {
"bizId": actionBody.bizId,
"userName": needInfoResult.data.publishName,
"mobile": needInfoResult.data.publishMobile,
"price": qobj.Price,
"channelItemCode":needInfoResult.data.channelTypeCode,
"payCode": productPriceResult.data.payCode,
"quantity":1,
"totalSum": productPriceResult.data.price,
"payTotalSum": productPriceResult.data.Price,
"channelOrder":{
"channelServiceNo": actionBody.bizId,
"channelOrderNo": actionBody.bizId
}
// var pobjStr = JSON.stringify(pobj);
// var qobj = JSON.parse(pobjStr);
// qobj.actionBody = {
// "bizId": actionBody.bizId,
// "userName": needInfoResult.data.publishName,
// "mobile": needInfoResult.data.publishMobile,
// "price": qobj.Price,
// "channelItemCode":needInfoResult.data.channelTypeCode,
// "payCode": productPriceResult.data.payCode,
// "quantity":1,
// "totalSum": productPriceResult.data.price,
// "payTotalSum": productPriceResult.data.Price,
// "channelOrder":{
// "channelServiceNo": actionBody.bizId,
// "channelOrderNo": actionBody.bizId
// }
// }
// qobj.actionType = "getProductDetail";
// var url = settings.centerAppUrl() + "action/opProduct/springBoard";
// var productItemResult = await this.restPostUrl(qobj, url);
// if (productItemResult.status != 0) {
// return productItemResult;
// }
// qobj.actionBody.product_info = productItemResult.data;
// var verifyResult = await this.utilsOrderSve.isOrderVerify(qobj, qobj.actionBody);
// if (verifyResult.status != 0) {
// return verifyResult;
// }
// qobj.actionType = "getProductInterface";
// qobj.actionBody.product_id = qobj.actionBody.product_info.id;
// var productItemInterfaceResult = await this.restPostUrl(qobj, url);
// qobj.actionBody.product_info.interface_info = productItemInterfaceResult.data;
// qobj.actionType = "addOrder";
// var reqUrl = this.centerOrderUrl + "action/order/springBoard";
// qobj.actionBody.channelOrder.orderStatus = 2;// 2作为orderinfo的orderStatus的值。含义为已付款
// var result = await this.restPostUrl(qobj, reqUrl);
pobj.actionBody.bizId = actionBody.bizId,
pobj.actionBody.userName = needInfoResult.data.publishName,
pobj.actionBody.mobile = needInfoResult.data.publishMobile,
pobj.actionBody.orderNo = actionBody.bizId;
pobj.actionBody.totalSum = productPriceResult.data.price;
pobj.actionBody.orderPrice = productPriceResult.data.price;
pobj.actionBody.payTotalSum = productPriceResult.data.price;
pobj.actionBody.price = productPriceResult.data.price;
pobj.actionBody.payCode = productPriceResult.data.payCode;
pobj.actionBody.channelItemCode = needInfoResult.data.channelTypeCode;
pobj.actionBody.channelNeedNo = needInfoResult.data.channelNeedNo;
pobj.actionBody.needNo = needInfoResult.data.needNo;
pobj.actionBody.quantity = 1;
pobj.actionBody.channelOrder = {
channelServiceNo: actionBody.bizId,
channelOrderNo: actionBody.bizId,
orderStatus: 2
}
qobj.actionType = "getProductDetail";
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
var productItemResult = await this.restPostUrl(qobj, url);
if (productItemResult.status != 0) {
return productItemResult;
var orderrtn = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody);
if (orderrtn.status != 0 && orderrtn.status != -1) {
return system.getResultFail(-5012, "订单创建失败");
}
qobj.actionBody.product_info = productItemResult.data;
var verifyResult = await this.utilsOrderSve.isOrderVerify(qobj, qobj.actionBody);
if (verifyResult.status != 0) {
return verifyResult;
if (orderrtn.data) {
pobj.actionBody.orderNo = orderrtn.data.orderNo;
}
pobj.actionBody.channelSolutionNo = pobj.actionBody.bizId;
pobj.actionType = "receiveSolutionPayInfo";
var url = settings.centerOrderUrl() + "action/icapi/springBoard";
var solutionrtn = await this.execClient.execPost(pobj, url);
if (!solutionrtn || !solutionrtn.stdout) {
return system.getResultFail(-5011, "方案查询失败");
}
var solutiondata = JSON.parse(solutionrtn.stdout);
if (solutiondata.status != 0) {
return system.getResultFail(-5011, "方案查询失败");
}
if (!solutiondata.data) {
return system.getResultFail(-5012, "方案查询数据为空");
}
if (solutiondata.data && solutiondata.data.channelNeedNo) {
pobj.actionBody.needId = solutiondata.data.channelNeedNo;
}
qobj.actionType = "getProductInterface";
qobj.actionBody.product_id = qobj.actionBody.product_info.id;
var productItemInterfaceResult = await this.restPostUrl(qobj, url);
qobj.actionBody.product_info.interface_info = productItemInterfaceResult.data;
qobj.actionType = "addOrder";
var reqUrl = this.centerOrderUrl + "action/order/springBoard";
qobj.actionBody.channelOrder.orderStatus = 2;// 2作为orderinfo的orderStatus的值。含义为已付款
var result = await this.restPostUrl(qobj, reqUrl);
// 第四步 整合推送参数 并推送
var fqobj = {
actionBody: {
area: pobj.actionBody.province,
city: pobj.actionBody.province,
regType: pobj.actionBody.regType,//1
orderNo: pobj.actionBody.channelOrder.channelOrderNo,
area: needInfoResult.data.city,
city: needInfoResult.data.city,
// regType: pobj.actionBody.regType,//1
orderNo: actionBody.bizId,
orderPrice: Number(pobj.actionBody.orderPrice / 100),
phone: pobj.actionBody.publishMobile,
phone: needInfoResult.data.publishMobile,
needId: solutiondata.data.channelNeedNo,
companyName:solutiondata.data.solutionContent.solution.CompanyName || ''//1
},
......@@ -1012,7 +1054,7 @@ class UtilsNeedService extends AppServiceBase {
needsolution: solutiondata.data.solutionContent,
channelNeedNo: solutiondata.data.channelNeedNo,
channelSolutionNo: solutiondata.data.channelSolutionNo,
skuCode: data.data.payCode,
skuCode: productPriceResult.data.payCode,
servicer: {
code: 'gsb',
name: '公司宝'
......@@ -1022,7 +1064,6 @@ class UtilsNeedService extends AppServiceBase {
}
this.utilsPushSve.aliBusiness2Fq(fqobj, "pushOrderICPBusiness");
this.utilsPushSve.aliBusiness2Delivery(deliveryObj, "pushDeliveryOrder");
console.log(result);
break;
case "USER_CONFIRM_PRODUCE":
break;
......@@ -1035,7 +1076,7 @@ class UtilsNeedService extends AppServiceBase {
default:
return system.getResult(null, "operationType参数错误");
}
return getResultSuccess(result);
return getResultSuccess(orderrtn);
}
// 2020 0927 lin 新增 edi状态更新
......@@ -1069,6 +1110,9 @@ class UtilsNeedService extends AppServiceBase {
pobj.actionType = "receiveEdiStatusNotify";
var url = settings.centerOrderUrl() + "action/ediApi/springBoard";
var rtn = await this.restPostUrl(pobj, url);
if(rtn.status) {
return rtn;
}
var deliveryObj = {
actionBody: {
orderNo: rtn.data.orderNo,//pobj.actionBody.channelOrder.channelOrderNo,
......@@ -1106,6 +1150,16 @@ class UtilsNeedService extends AppServiceBase {
return rtn;
}
/**
* 2020 0928 lin 新增 阿里文网文 服务商侧提供接口2.2 关闭需求通知服务商
* @param {*} pobj
* @param {*} actionBody
*/
async soulutionFeebackAliEsp(pobj, actionBody) {
// 待定
return system.getResultSuccess();
}
}
module.exports = UtilsNeedService;
......
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