Commit f373b023 by 蒋勇

d

parent 47c4680b
...@@ -390,7 +390,7 @@ class UserService extends ServiceBase { ...@@ -390,7 +390,7 @@ class UserService extends ServiceBase {
* @param {*} productCatName 产品类型名称 * @param {*} productCatName 产品类型名称
* @param {*} regionName 区域 * @param {*} regionName 区域
*/ */
async getBizUserForBizChance (clientMobile, spName, productCatName, regionName) { async getBizUserForBizChance (clientMobile, spName, productCatName, regionName, companyFind) {
var self = this var self = this
clientMobile = clientMobile + "_" + spName + "_" + regionName + "_" + productCatName clientMobile = clientMobile + "_" + spName + "_" + regionName + "_" + productCatName
//按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称 //按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称
...@@ -409,14 +409,14 @@ class UserService extends ServiceBase { ...@@ -409,14 +409,14 @@ class UserService extends ServiceBase {
} }
} }
if (isGoExec) { if (isGoExec) {
let companyFind = await self.companyDao.model.findOne({ // let companyFind = await self.companyDao.model.findOne({
where: { name: spName }, include: [ // where: { name: spName }, include: [
{ // {
model: self.db.models.user, as: "us", attributes: ['id', 'userName', 'mobile', 'isAllocated', 'opath', 'skilltags', 'regiontags', 'isAllArea', 'isSalesman', 'isDelivery'], raw: true // model: self.db.models.user, as: "us", attributes: ['id', 'userName', 'mobile', 'isAllocated', 'opath', 'skilltags', 'regiontags', 'isAllArea', 'isSalesman', 'isDelivery'], raw: true
} // }
], excludes: ['orgJson'], transaction: t // ], excludes: ['orgJson'], transaction: t
}); // });
console.log(companyFind) // console.log(companyFind)
let users = companyFind.us let users = companyFind.us
let cansels = users.filter(u => { let cansels = users.filter(u => {
if (regionName && regionName != "" && u.regiontags) { if (regionName && regionName != "" && u.regiontags) {
...@@ -470,7 +470,7 @@ class UserService extends ServiceBase { ...@@ -470,7 +470,7 @@ class UserService extends ServiceBase {
* @param {*} skucode 最小销售货品编码,来自渠道上架的码 * @param {*} skucode 最小销售货品编码,来自渠道上架的码
* @param {*} regionName 区域 * @param {*} regionName 区域
*/ */
async getBizUserForDelivery (xclientMobile, spName, productCatName, skucode, regionName) { async getBizUserForDelivery (xclientMobile, spName, productCatName, skucode, regionName, companyFind) {
let clientMobile = 'fordeliver' + xclientMobile + "_" + spName + "_" + regionName + "_" + productCatName let clientMobile = 'fordeliver' + xclientMobile + "_" + spName + "_" + regionName + "_" + productCatName
var self = this var self = this
//按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称 //按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称
...@@ -507,13 +507,13 @@ class UserService extends ServiceBase { ...@@ -507,13 +507,13 @@ class UserService extends ServiceBase {
} }
} }
if (isGoExec) { if (isGoExec) {
let companyFind = await self.companyDao.model.findOne({ // let companyFind = await self.companyDao.model.findOne({
where: { name: spName }, include: [ // where: { name: spName }, include: [
{ // {
model: self.db.models.user, as: "us", attributes: ['id', 'userName', 'mobile', 'isAllocated', 'opath', 'skilltags', 'regiontags', 'isAllArea', 'isSalesman', 'isDelivery'], raw: true // model: self.db.models.user, as: "us", attributes: ['id', 'userName', 'mobile', 'isAllocated', 'opath', 'skilltags', 'regiontags', 'isAllArea', 'isSalesman', 'isDelivery'], raw: true
} // }
], excludes: ['orgJson'], transaction: t // ], excludes: ['orgJson'], transaction: t
}); // });
let users = companyFind.us let users = companyFind.us
let cansels = users.filter(u => { let cansels = users.filter(u => {
if (regionName && regionName != "" && u.regiontags) { if (regionName && regionName != "" && u.regiontags) {
...@@ -587,7 +587,7 @@ class UserService extends ServiceBase { ...@@ -587,7 +587,7 @@ class UserService extends ServiceBase {
* @param {*} skucode 最小销售货品编码,来自渠道上架的码 * @param {*} skucode 最小销售货品编码,来自渠道上架的码
* @param {*} regionName 区域 * @param {*} regionName 区域
*/ */
async getBizUserForAliDelivery (xclientMobile, spName, productCatName, skucode, regionName) { async getBizUserForAliDelivery (xclientMobile, spName, productCatName, skucode, regionName, companyFind) {
// let clientMobile = 'fordeliver' + xclientMobile + "_" + spName + "_" + regionName // let clientMobile = 'fordeliver' + xclientMobile + "_" + spName + "_" + regionName
let self = this let self = this
//按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称 //按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称
...@@ -631,13 +631,13 @@ class UserService extends ServiceBase { ...@@ -631,13 +631,13 @@ class UserService extends ServiceBase {
//查询数据库user表来获取交付员信息 需要根据是否是"交付员"字段筛选(派单规则是将交付单派给交付员) //查询数据库user表来获取交付员信息 需要根据是否是"交付员"字段筛选(派单规则是将交付单派给交付员)
if (isGoExec) { if (isGoExec) {
let companyFind = await self.companyDao.model.findOne({ // let companyFind = await self.companyDao.model.findOne({
where: { name: spName }, include: [ // where: { name: spName }, include: [
{ // {
model: self.db.models.user, as: "us", attributes: ['id', 'userName', 'mobile', 'isAllocated', 'opath', 'skilltags', 'regiontags', 'isAllArea', 'isSalesman', 'isDelivery'], raw: true // model: self.db.models.user, as: "us", attributes: ['id', 'userName', 'mobile', 'isAllocated', 'opath', 'skilltags', 'regiontags', 'isAllArea', 'isSalesman', 'isDelivery'], raw: true
} // }
], excludes: ['orgJson'], transaction: t // ], excludes: ['orgJson'], transaction: t
}); // });
let users = companyFind.us; let users = companyFind.us;
//按名单筛选 //按名单筛选
// let deliveryList = ["", "", "", "", ""]; // let deliveryList = ["", "", "", "", ""];
......
...@@ -5,6 +5,7 @@ class AliHandler { ...@@ -5,6 +5,7 @@ class AliHandler {
constructor() { constructor() {
this.icUrl = settings.icUrl() + "/web/bizchance"; this.icUrl = settings.icUrl() + "/web/bizchance";
this.userService = system.getObject("service.auth.userSve"); this.userService = system.getObject("service.auth.userSve");
this.cmpService = system.getObject("service.common.companySve");
this.msgService = system.getObject("service.msg.msgSve") this.msgService = system.getObject("service.msg.msgSve")
this.cacheManager = system.getObject("db.common.cacheManager"); this.cacheManager = system.getObject("db.common.cacheManager");
} }
...@@ -15,7 +16,7 @@ class AliHandler { ...@@ -15,7 +16,7 @@ class AliHandler {
* @param {*} datajson * @param {*} datajson
*/ */
//新商机处理 //新商机处理
async addChance(datajson) { async addChance (datajson) {
console.log("put in queue [addChance]", datajson); console.log("put in queue [addChance]", datajson);
try { try {
var cachestr = sha235(JSON.stringify(datajson)); var cachestr = sha235(JSON.stringify(datajson));
...@@ -70,7 +71,7 @@ class AliHandler { ...@@ -70,7 +71,7 @@ class AliHandler {
} }
} }
async updateChanceStatus(datajson) { async updateChanceStatus (datajson) {
console.log("put in queue [updateChanceStatus]" + JSON.stringify(datajson) + "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"); console.log("put in queue [updateChanceStatus]" + JSON.stringify(datajson) + "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
try { try {
var cachestr = sha235(JSON.stringify(datajson)); var cachestr = sha235(JSON.stringify(datajson));
...@@ -120,7 +121,7 @@ class AliHandler { ...@@ -120,7 +121,7 @@ class AliHandler {
//退回商机处理 //退回商机处理
async needClose(datajson) { async needClose (datajson) {
console.log("put in queue" + JSON.stringify(datajson) + "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"); console.log("put in queue" + JSON.stringify(datajson) + "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD");
try { try {
var cachestr = sha235(JSON.stringify(datajson)); var cachestr = sha235(JSON.stringify(datajson));
...@@ -199,7 +200,7 @@ class AliHandler { ...@@ -199,7 +200,7 @@ class AliHandler {
} }
//交付单处理 //交付单处理
async pushOrderDelivery(datajson, channelobj) { async pushOrderDelivery (datajson, channelobj) {
console.log("put in queue-----------------------------------------------------------------------------------------------------", datajson); console.log("put in queue-----------------------------------------------------------------------------------------------------", datajson);
try { try {
console.log("交付单数据:" + JSON.stringify(datajson)); console.log("交付单数据:" + JSON.stringify(datajson));
...@@ -260,7 +261,17 @@ class AliHandler { ...@@ -260,7 +261,17 @@ class AliHandler {
ConsultTypeName = obj.businessName; ConsultTypeName = obj.businessName;
} }
try { try {
var deliveryInfo = await this.userService.getBizUserForAliDelivery(obj.baseInfo.contactsName, obj.servicerName, ConsultTypeName, obj.skuCode, obj.serviceName); let companyFind = await this.cmpService.dao.model.findOne({
where: { name: obj.serviceName }, include: [
{
model: this.cmpService.db.models.user, as: "us", attributes: ['id', 'userName', 'mobile', 'isAllocated', 'opath', 'skilltags', 'regiontags', 'isAllArea', 'isSalesman', 'isDelivery'], raw: true
}
], excludes: ['orgJson']
});
if (companyFind) {
obj.servicerCode = companyFind.id;
}
var deliveryInfo = await this.userService.getBizUserForAliDelivery(obj.baseInfo.contactsName, obj.servicerName, ConsultTypeName, obj.skuCode, obj.serviceName, companyFind);
} catch (error) { } catch (error) {
console.log("分配交付员失败.", error); console.log("分配交付员失败.", error);
} }
...@@ -304,7 +315,7 @@ class AliHandler { ...@@ -304,7 +315,7 @@ class AliHandler {
} }
//客户状态处理 //客户状态处理
async deliveryNotify(datajson) { async deliveryNotify (datajson) {
try { try {
var cachestr = sha235(JSON.stringify(datajson)); var cachestr = sha235(JSON.stringify(datajson));
var cacheInfo = await this.cacheManager["AliCache"].getCache(cachestr); var cacheInfo = await this.cacheManager["AliCache"].getCache(cachestr);
...@@ -390,7 +401,7 @@ class AliHandler { ...@@ -390,7 +401,7 @@ class AliHandler {
} }
} }
async actionBodyHandler(actionBody) { async actionBodyHandler (actionBody) {
let data = actionBody; let data = actionBody;
let obj = {}; let obj = {};
obj.baseInfo = {}; obj.baseInfo = {};
......
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