Commit 5b89f153 by 王勇飞

add PAID status for deliver

parent 9a789435
...@@ -213,63 +213,63 @@ class AliHandler { ...@@ -213,63 +213,63 @@ class AliHandler {
// } // }
let rc = system.getObject("util.execClient"); let rc = system.getObject("util.execClient");
let obj = await this.actionBodyHandler(datajson.actionBody); let obj = await this.actionBodyHandler(datajson.actionBody);
let requrl = this.icUrl + "/deliverybillCtl/dealAliDeliveryInfo";
// var bizurl = this.icUrl + "/bizoptCtl/updateStatusByDemandCode";
//渠道名称和渠道编码 //渠道名称和渠道编码
obj.channelSource = channelobj.name; obj.channelSource = channelobj.name;
obj.channelNumber = channelobj.code; obj.channelNumber = channelobj.code;
//分配业务员
if (datajson.actionBody.needsolution.salesmanInfo.salesmanChannelId) { //如果订单状态为已支付
//去数据库查询该业务员信息 if (datajson.actionBody.needsolution.status && datajson.actionBody.needsolution.status == "PAID") {
//查询业务员信息并填充到obj
if (datajson.actionBody.needsolution.salesmanInfo.salesmanChannelId) {
//去数据库查询该业务员信息
try {
let resInfo = await this.userService.getSalesmanInfo(datajson.actionBody.needsolution.salesmanInfo.salesmanChannelId);
obj.salesmanOpcode = resInfo.opath;
obj.salesmanName = resInfo.nickName;
obj.servicerCode = resInfo.company_id;
} catch (error) {
console.log("salesmanChannelId: " + datajson.actionBody.needsolution.salesmanInfo.salesmanChannelId + "获取业务员opcode失败:" + error)
}
}
//分配交付员
var ConsultTypeName = "";
if (obj.businessName && obj.businessName != 'undefined') {
console.log("productTypeName-----------------------------" + obj.businessName);
ConsultTypeName = obj.businessName;
}
try { try {
let resInfo = await this.userService.getSalesmanInfo(datajson.actionBody.needsolution.salesmanInfo.salesmanChannelId); var deliveryInfo = await this.userService.getBizUserForAliDelivery(obj.baseInfo.contactsName, obj.servicerName, ConsultTypeName, obj.skuCode, obj.serviceName);
obj.salesmanOpcode = resInfo.opath;
obj.salesmanName = resInfo.nickName;
obj.servicerCode = resInfo.company_id;
} catch (error) { } catch (error) {
console.log("salesmanChannelId: " + datajson.actionBody.needsolution.salesmanInfo.salesmanChannelId + "获取业务员opcode失败:" + error) console.log("分配交付员失败.");
} }
}
//分配交付员
var ConsultTypeName = "";
if (obj.businessName && obj.businessName != 'undefined') {
console.log("productTypeName-----------------------------" + obj.businessName);
ConsultTypeName = obj.businessName;
}
try {
var deliveryInfo = await this.userService.getBizUserForAliDelivery(obj.baseInfo.contactsName, obj.servicerName, ConsultTypeName, obj.skuCode, obj.serviceName);
} catch (error) {
console.log("分配交付员失败.");
}
let requrl = this.icUrl + "/deliverybillCtl/dealAliDeliveryInfo"; if (deliveryInfo && deliveryInfo != 'undefined') {
// var bizurl = this.icUrl + "/bizoptCtl/updateStatusByDemandCode"; obj.clerkOpcode = deliveryInfo.opath;//交付员opcode
obj.clerkId = deliveryInfo.userId;//交付员id
obj.costPrice = deliveryInfo.cost;//成本
obj.clerkName = deliveryInfo.userName;//交付员名称
// obj.clerkPhone = deliveryInfo.mobile;//交付人员电话
// obj.servicerCode = deliveryInfo.compId;
}
if (deliveryInfo && deliveryInfo != 'undefined') { //异步更新需求状态 channelNeedNo
obj.clerkOpcode = deliveryInfo.opath;//交付员opcode if (datajson.actionBody && datajson.actionBody.channelNeedNo) {
obj.clerkId = deliveryInfo.userId;//交付员id var stau = {
obj.costPrice = deliveryInfo.cost;//成本 "businessMode": datajson.actionBody.channelNeedNo,
obj.clerkName = deliveryInfo.userName;//交付员名称 "currentStatus": "isFinished"
// obj.clerkPhone = deliveryInfo.mobile;//交付人员电话 }
// obj.servicerCode = deliveryInfo.compId; rc.execPost3({ "d": stau }, this.icUrl + "/bizoptCtl/updateStatusByDemandCode");//更新商机状态为已完成
}
} }
console.log("推送数据oj: " + JSON.stringify(obj)); console.log("推送数据obj: " + JSON.stringify(obj));
var rtn = await rc.execPost3({ "d": obj }, requrl); var rtn = await rc.execPost3({ "d": obj }, requrl);
console.log("pushOrderDelivery插入数据成功---------------------------------" + rtn.stdout); console.log("pushOrderDelivery插入数据成功---------------------------------" + rtn.stdout);
let cacheDeliveryInfo = await this.cacheManager["AliCache"].cache(cachestr, JSON.stringify({ cachestr: cachestr }), 180); let cacheDeliveryInfo = await this.cacheManager["AliCache"].cache(cachestr, JSON.stringify({ cachestr: cachestr }), 180);
console.log("交付单缓存信息: " + JSON.stringify(cacheDeliveryInfo)); console.log("交付单缓存信息: " + JSON.stringify(cacheDeliveryInfo));
// 更新需求状态 channelNeedNo
if (datajson.actionBody && datajson.actionBody.channelNeedNo) {
var stau = {
"businessMode": datajson.actionBody.channelNeedNo,
"currentStatus": "isFinished"
}
rc.execPost3({ "d": stau }, this.icUrl + "/bizoptCtl/updateStatusByDemandCode");//更新商机状态为已完成
}
return { return {
"status": 1, //1代表成功,否则失败 "status": 1, //1代表成功,否则失败
"msg": "", "msg": "",
...@@ -422,9 +422,12 @@ class AliHandler { ...@@ -422,9 +422,12 @@ class AliHandler {
obj.skuCode = data.skuCode; obj.skuCode = data.skuCode;
} }
if (data.needsolution.status) { //交付单状态码 if (data.needsolution.status) { //交付单状态码
if (data.needsolution.status = "USER_UPLOADED") { if (data.needsolution.status = "PAID") {//已支付
obj.deliverStatus = "received"; obj.deliverStatus = "received";
} }
if (data.needsolution.status = "USER_UPLOADED") {//已上传
obj.deliverStatus = "collecting";
}
} }
if (data.needsolution.customerRemark) { //状态原因 if (data.needsolution.customerRemark) { //状态原因
obj.statusReason = data.needsolution.customerRemark; obj.statusReason = data.needsolution.customerRemark;
......
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