Commit 9f7ae466 by 王勇飞

pp

parent eb1b4ecd
......@@ -650,7 +650,7 @@ class UserService extends ServiceBase {
// return false;
// }
// });
//按条件筛选
let cansels = users.filter(u => {
if (regionName && regionName != "" && u.regiontags) {
......@@ -668,7 +668,7 @@ class UserService extends ServiceBase {
}
})
console.log('------------1', JSON.stringify(cansels) );
console.log('------------1', JSON.stringify(cansels));
let lngth = cansels.length
if (lngth > 0) {
let obj = {};
......@@ -688,7 +688,7 @@ class UserService extends ServiceBase {
}
}
console.log('------------2', JSON.stringify(obj) );
console.log('------------2', JSON.stringify(obj));
let resultUserKey = Object.keys(obj)[0];
let resultUser = obj[resultUserKey].userInfo;
......@@ -701,6 +701,17 @@ class UserService extends ServiceBase {
}
})
}
/**
*根据业务员openid查找该用户信息
*@param {*} openid 业务员唯一标识
*/
async getSalesmanInfo(openid) {
let userfind = await this.dao.model.findOne({
where: { openid: openid }
});
return userfind;
}
}
module.exports = UserService;
......@@ -717,7 +728,7 @@ module.exports = UserService;
// let result = await cacheManager["LoopDistributionUserCache"].getCache("LoopDistributionUserCache");
// // let result = await cacheManager["LoopDistributionUserCache"].invalidate("LoopDistributionUserCache");
// console.log('----=-=-=-:' + JSON.stringify(result));
// } catch (error) {
// console.log("err:" + error);
// }
......
......@@ -212,13 +212,29 @@ class AliHandler {
}
else {
let obj = await this.actionBodyHandler(datajson.actionBody);
//获取分配的业务员信息
//分配业务员
if (datajson.actionBody.needsolution.salesmanInfo.salesmanChannelId) {
//去数据库查询该业务员信息
try {
let resInfo = await this.userService.getSalesmanInfo(datajson.actionBody.needsolution.salesmanInfo.salesmanChannelId);
obj.salesmanOpcode = resInfo.opath;
} 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;
}
var deliveryInfo = await this.userService.getBizUserForAliDelivery(obj.baseInfo.contactsName, obj.servicerName, ConsultTypeName, obj.skuCode, obj.serviceName);
try {
var deliveryInfo = await this.userService.getBizUserForAliDelivery(obj.baseInfo.contactsName, obj.servicerName, ConsultTypeName, obj.skuCode, obj.serviceName);
} catch (error) {
console.log("分配交付元失败.");
}
requrl = this.icUrl + "/deliverybillCtl/dealAliDeliveryInfo";
// var bizurl = this.icUrl + "/bizoptCtl/updateStatusByDemandCode";
......@@ -359,15 +375,15 @@ class AliHandler {
obj.servicerName = data.servicer.name;
}
}
if(data.needsolution.solution.Area) {//服务地区编码和服务地区
if (data.needsolution.solution.Area) {//服务地区编码和服务地区
obj.serviceCode = data.needsolution.solution.Area;
obj.serviceName = data.needsolution.solution.Area;
obj.baseInfo.serviceName = data.needsolution.solution.Area;
}
if(data.needsolution.solution.CompanyName) {//公司名称
if (data.needsolution.solution.CompanyName) {//公司名称
obj.baseInfo.companyName = data.needsolution.solution.CompanyName;
}
if(data.needsolution.solution.CompanyAddress) {//公司地址
if (data.needsolution.solution.CompanyAddress) {//公司地址
obj.baseInfo.companyAddress = data.needsolution.solution.CompanyAddress;
}
if (data.needsolution.bizType) { //产品编码
......@@ -390,14 +406,14 @@ class AliHandler {
obj.skuCode = data.skuCode;
}
if (data.needsolution.status) { //交付单状态码
if(data.needsolution.status = "USER_UPLOADED") {
if (data.needsolution.status = "USER_UPLOADED") {
obj.deliverStatus = "received";
}
}
if (data.needsolution.customerRemark) { //状态原因
obj.statusReason = data.needsolution.customerRemark;
}
if (data.needsolution.status) { //TODO成本
if (data.needsolution.status) { //成本
obj.costPrice = data.needsolution.status;
}
if (data.needsolution.totalSum) { //价格
......@@ -409,6 +425,9 @@ class AliHandler {
obj.channelNumber = "阿里云";
if(data.needsolution.salesmanInfo) {
if(data.needsolution.salesmanInfo.salesmanId) {
obj.salesmanId = data.needsolution.salesmanInfo.salesmanId;
}
if(data.needsolution.salesmanInfo.salesmanName) {
obj.salesmanName = data.needsolution.salesmanInfo.salesmanName;
}
......@@ -417,12 +436,13 @@ class AliHandler {
}
}
if (data.needsolution.customerInfo) {//联系人
if (data.needsolution.customerInfo.publishName) {
obj.baseInfo.contactsName = data.needsolution.customerInfo.publishName;
}
if (data.needsolution.customerInfo.publishMobile) {//联系电话
obj.baseInfo.publishMobile = data.needsolution.customerInfo.publishMobile;
obj.baseInfo.contactsPhone = data.needsolution.customerInfo.publishMobile;
}
if (data.needsolution.customerRemark) {//备注信息
obj.baseInfo.memoinfo = data.needsolution.customerRemark;
......@@ -462,9 +482,9 @@ module.exports = new AliHandler();
// console.log("getBizUserForAliDelivery err: "+ error);
// }
// }
// let rc = system.getObject("util.execClient");
// let requrl = settings.icUrl() + "/web/bizchance" + ;
// let userService = system.getObject("service.auth.userSve");
// start();
// async function start() {
// let res = await rc.execPost3({ "d": obj }, requrl);
// let resInfo = await userService.getSalesmanInfo("5ddf5f5d8b13b0000a3f2b18");
// console.log("ceshi:" + JSON.stringify(resInfo));
// }
\ No newline at end of file
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