Commit 616a5d38 by v_vjyjiang

d

parent 70e24bf9
......@@ -559,6 +559,23 @@ class UserService extends ServiceBase {
}
})
}
async findCostBySkuCode (skucode) {
let productpricetmp = await this.db.models.productprice.findOne({
where: { skucode: skucode },
include: [
{ model: this.db.models.productcost, where: { expensetype: 'service' }, as: "costs", attributes: ['id', 'expensetype', 'costamount'] }
],
raw: true,
}
)
let costAmount = 0
//获取服务费成本
if (productpricetmp['costs.costamount']) {
costAmount = Number(productpricetmp['costs.costamount'])
}
return costAmount
}
/**
* 阿里交付单分配规则-轮循分配(交付单处理业务员和交付员不是一个同一人)
......@@ -573,25 +590,7 @@ class UserService extends ServiceBase {
let self = this
//按照服务商名字查询到公司,按照公司查询出users,条件是可以接受派单任务,并且技能标签含有,产品类别名称
return this.db.transaction(async function (t) {
//按照产品简码,查询服务成本
let productpricetmp = await self.db.models.productprice.findOne({
where: { skucode: skucode },
include: [
{ model: self.db.models.productcost, where: { expensetype: 'service' }, as: "costs", attributes: ['id', 'expensetype', 'costamount'] }
],
raw: true,
transaction: t
}
)
let costAmount = 0
//获取服务费成本
if (productpricetmp['costs.costamount']) {
costAmount = Number(productpricetmp['costs.costamount'])
}
console.log("skucode==================", costAmount, productpricetmp)
// console.log('------------1:', JSON.stringify(productpricetmp.costs));
//检查缓存是否存在bizuser
let resultcache = await self.cacheManager["LoopDistributionUserCache"].getCache("LoopDistributionUserCache");
let isGoExec = false;
......
......@@ -15,7 +15,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 +70,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));
......@@ -114,7 +114,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));
......@@ -193,7 +193,7 @@ class AliHandler {
}
//交付单处理
async pushOrderDelivery(datajson, channelobj) {
async pushOrderDelivery (datajson, channelobj) {
console.log("put in queue-----------------------------------------------------------------------------------------------------", datajson);
try {
console.log("交付单数据:" + JSON.stringify(datajson));
......@@ -256,18 +256,19 @@ class AliHandler {
try {
var deliveryInfo = await this.userService.getBizUserForAliDelivery(obj.baseInfo.contactsName, obj.servicerName, ConsultTypeName, obj.skuCode, obj.serviceName);
} catch (error) {
console.log("分配交付员失败.");
console.log("分配交付员失败.", error);
}
if (deliveryInfo && deliveryInfo != 'undefined') {
obj.clerkOpcode = deliveryInfo.opath;//交付员opcode
obj.clerkId = deliveryInfo.userId;//交付员id
obj.costPrice = deliveryInfo.cost;//成本
// obj.costPrice = deliveryInfo.cost;//成本
obj.clerkName = deliveryInfo.userName;//交付员名称
// obj.clerkPhone = deliveryInfo.mobile;//交付人员电话
// obj.servicerCode = deliveryInfo.compId;
}
//设置成本
obj.costPrice = await this.userService.findCostBySkuCode(obj.skuCode)
//异步更新需求状态 channelNeedNo
if (datajson.actionBody && datajson.actionBody.channelNeedNo) {
var stau = {
......@@ -297,7 +298,7 @@ class AliHandler {
}
//客户状态处理
async deliveryNotify(datajson) {
async deliveryNotify (datajson) {
try {
var cachestr = sha235(JSON.stringify(datajson));
var cacheInfo = await this.cacheManager["AliCache"].getCache(cachestr);
......@@ -383,7 +384,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