Commit f373b023 by 蒋勇

d

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