Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
c240baf7
Commit
c240baf7
authored
Jul 31, 2020
by
王勇飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pp
parent
a0283552
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
132 additions
and
298 deletions
+132
-298
center-manage/app/base/service/impl/common/channelhandlers/ali.js
+132
-298
No files found.
center-manage/app/base/service/impl/common/channelhandlers/ali.js
View file @
c240baf7
...
@@ -175,9 +175,17 @@ class AliHandler {
...
@@ -175,9 +175,17 @@ class AliHandler {
}
}
//交付单处理
//交付单处理
async
orderSubmit
(
datajson
)
{
async
pushOrderDelivery
(
datajson
)
{
console
.
log
(
"put in queue-----------------------------------------------------------------------------------------------------"
,
datajson
);
console
.
log
(
"put in queue-----------------------------------------------------------------------------------------------------"
,
datajson
);
try
{
try
{
console
.
log
(
"交付单数据:"
+
JSON
.
stringify
(
datajson
));
// return {
// "status": 1, //1代表成功,否则失败
// "msg": "已处理成功!",
// "data": "",
// "requestId": ""
// }
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
);
if
(
cacheInfo
&&
cacheInfo
!=
'undefined'
)
{
if
(
cacheInfo
&&
cacheInfo
!=
'undefined'
)
{
...
@@ -191,9 +199,7 @@ class AliHandler {
...
@@ -191,9 +199,7 @@ class AliHandler {
else
{
else
{
var
rc
=
system
.
getObject
(
"util.execClient"
);
var
rc
=
system
.
getObject
(
"util.execClient"
);
var
requrl
=
this
.
icUrl
+
"/deliverybillCtl/findInfoByDeliverCode"
;
var
requrl
=
this
.
icUrl
+
"/deliverybillCtl/findInfoByDeliverCode"
;
//TODO 将下面的actionBody中的所有字段都检查一遍
var
delInfo
=
await
rc
.
execPost3
({
"d"
:
{
"deliverNumber"
:
datajson
.
actionBody
.
orderNo
}
},
requrl
);
//TODO 确定订单编号的key, 将datajson.actionBody.orderNum替换
var
delInfo
=
await
rc
.
execPost3
({
"d"
:
{
"deliverNumber"
:
datajson
.
actionBody
.
orderNum
}
},
requrl
);
console
.
log
(
"jdelInfo---------------------------------------------"
+
delInfo
.
stdout
);
console
.
log
(
"jdelInfo---------------------------------------------"
+
delInfo
.
stdout
);
var
jdelInfo
=
JSON
.
parse
(
delInfo
.
stdout
);
var
jdelInfo
=
JSON
.
parse
(
delInfo
.
stdout
);
if
(
jdelInfo
.
status
==
0
)
{
if
(
jdelInfo
.
status
==
0
)
{
...
@@ -205,300 +211,31 @@ class AliHandler {
...
@@ -205,300 +211,31 @@ class AliHandler {
}
}
}
}
else
{
else
{
let
obj
=
await
this
.
actionBodyHandler
(
datajson
.
actionBody
);
//获取分配的业务员信息
//获取分配的业务员信息
var
ConsultTypeName
=
""
;
var
ConsultTypeName
=
""
;
console
.
log
(
"productTypeName-----------------------------"
+
datajson
.
actionBody
.
productTypeName
);
if
(
obj
.
businessName
&&
obj
.
businessName
!=
'undefined'
)
{
if
(
datajson
.
actionBody
.
productTypeName
&&
datajson
.
actionBody
.
productTypeName
!=
'undefined'
)
{
console
.
log
(
"productTypeName-----------------------------"
+
obj
.
businessName
);
ConsultTypeName
=
datajson
.
actionBody
.
productTypeName
.
split
(
"/"
)[
2
];
ConsultTypeName
=
obj
.
businessName
;
}
console
.
log
(
"ConsultTypeName-----------------------------"
+
ConsultTypeName
);
var
salesmanInfo
=
await
this
.
userService
.
getBizUserForAliDelivery
(
datajson
.
actionBody
.
orderSnapshot
.
contactsPhone
,
datajson
.
actionBody
.
servicerName
,
ConsultTypeName
,
datajson
.
actionBody
.
aliPriceCode
,
datajson
.
actionBody
.
regionName
);
requrl
=
this
.
icUrl
+
"/deliverybillCtl/insertInfo"
;
var
bizurl
=
this
.
icUrl
+
"/bizoptCtl/updateStatusByDemandCode"
;
var
params
=
{
"deliverNumber"
:
datajson
.
actionBody
.
orderNum
,
"servicerName"
:
datajson
.
actionBody
.
servicerName
,
"serviceCode"
:
datajson
.
actionBody
.
regionId
,
"serviceName"
:
datajson
.
actionBody
.
regionName
,
"businessType"
:
datajson
.
actionBody
.
productType
,
"businessName"
:
ConsultTypeName
,
"skuCode"
:
datajson
.
actionBody
.
aliPriceCode
,
"aliOrderNum"
:
datajson
.
actionBody
.
aliOrderNum
,
"baseInfo"
:
{
"aliOrderNum"
:
datajson
.
actionBody
.
aliOrderNum
,
"isAdviser"
:
"已分配"
,
//是否分配顾问
"contactsName"
:
datajson
.
actionBody
.
orderSnapshot
.
contactsName
,
"contactsPhone"
:
datajson
.
actionBody
.
orderSnapshot
.
contactsPhone
,
"payStatus"
:
"待交付"
},
"companyInfo"
:
{},
"registeredInfo"
:
{},
"positionInfo"
:
{},
"regInfo"
:
{},
"express_info"
:
{}
}
if
(
salesmanInfo
&&
salesmanInfo
!=
'undefined'
)
{
params
.
clerkOpcode
=
salesmanInfo
.
opath
;
params
.
clerkId
=
salesmanInfo
.
userId
;
params
.
clerkName
=
salesmanInfo
.
userName
;
params
.
clerkPhone
=
salesmanInfo
.
mobile
;
params
.
costPrice
=
salesmanInfo
.
cost
;
params
.
servicerCode
=
salesmanInfo
.
compId
;
params
.
baseInfo
.
clerkName
=
salesmanInfo
.
userName
;
params
.
baseInfo
.
clerkPhone
=
salesmanInfo
.
mobile
}
if
(
!
params
.
serviceCode
||
params
.
serviceCode
==
'undefined'
)
{
if
(
datajson
.
actionBody
.
orderSnapshot
.
servicerCode
&&
datajson
.
actionBody
.
orderSnapshot
.
servicerCode
!=
'undefined'
)
{
params
.
serviceCode
=
datajson
.
actionBody
.
orderSnapshot
.
servicerCode
;
//fuwushang id
}
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
needNum
&&
datajson
.
actionBody
.
orderSnapshot
.
needNum
!=
'undefined'
)
{
params
.
businessMode
=
datajson
.
actionBody
.
orderSnapshot
.
needNum
;
//商机编号
}
if
(
datajson
.
actionBody
.
realTotalCost
&&
datajson
.
actionBody
.
realTotalCost
!=
'undefined'
)
{
params
.
sellingPrice
=
datajson
.
actionBody
.
realTotalCost
;
//价格
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
channelSource
&&
datajson
.
actionBody
.
orderSnapshot
.
channelSource
!=
'undefined'
)
{
params
.
channelSource
=
datajson
.
actionBody
.
orderSnapshot
.
channelSource
;
//渠道名称
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
channelNumber
&&
datajson
.
actionBody
.
orderSnapshot
.
channelNumber
!=
'undefined'
)
{
params
.
channelNumber
=
datajson
.
actionBody
.
orderSnapshot
.
channelNumber
;
//渠道编码
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
hasOwnProperty
(
"isWhether"
))
{
if
(
datajson
.
actionBody
.
orderSnapshot
.
isWhether
===
true
||
datajson
.
actionBody
.
orderSnapshot
.
isWhether
===
"yes"
)
{
params
.
baseInfo
.
isWhether
=
"yes"
;
//是否刻章
}
else
{
params
.
baseInfo
.
isWhether
=
"no"
;
//是否刻章
}
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
hasOwnProperty
(
"financial"
))
{
if
(
datajson
.
actionBody
.
orderSnapshot
.
financial
===
true
||
datajson
.
actionBody
.
orderSnapshot
.
financial
===
"yes"
)
{
params
.
baseInfo
.
financial
=
"yes"
;
}
else
{
params
.
baseInfo
.
financial
=
"no"
;
}
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
officialSeal
&&
datajson
.
actionBody
.
orderSnapshot
.
officialSeal
!=
'undefined'
)
{
params
.
baseInfo
.
officialSeal
=
datajson
.
actionBody
.
orderSnapshot
.
officialSeal
;
//公章扫描件
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
businessLicense
&&
datajson
.
actionBody
.
orderSnapshot
.
businessLicense
!=
'undefined'
)
{
params
.
baseInfo
.
businessLicense
=
datajson
.
actionBody
.
orderSnapshot
.
businessLicense
;
//营业执照扫描件
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
taxpayerName
&&
datajson
.
actionBody
.
orderSnapshot
.
taxpayerName
!=
'undefined'
)
{
params
.
baseInfo
.
taxpayerName
=
datajson
.
actionBody
.
orderSnapshot
.
taxpayerName
;
//纳税人类型名称
}
else
if
(
datajson
.
actionBody
.
orderSnapshot
.
taxpayerType
&&
datajson
.
actionBody
.
orderSnapshot
.
taxpayerType
!=
'undefined'
)
{
params
.
baseInfo
.
taxpayerName
=
datajson
.
actionBody
.
orderSnapshot
.
taxpayerType
;
//纳税人类型名称
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
buyDuration
&&
datajson
.
actionBody
.
orderSnapshot
.
buyDuration
!=
'undefined'
)
{
params
.
baseInfo
.
buyDuration
=
datajson
.
actionBody
.
orderSnapshot
.
buyDuration
;
//购买时长
}
else
if
(
datajson
.
actionBody
.
orderSnapshot
.
timeSpan
&&
datajson
.
actionBody
.
orderSnapshot
.
timeSpan
!=
'undefined'
)
{
params
.
baseInfo
.
buyDuration
=
datajson
.
actionBody
.
orderSnapshot
.
timeSpan
+
"年"
;
//购买时长
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
buyTime
&&
datajson
.
actionBody
.
orderSnapshot
.
buyTime
!=
'undefined'
)
{
params
.
baseInfo
.
buyTime
=
datajson
.
actionBody
.
orderSnapshot
.
buyTime
;
//购买时间
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
isRenew
&&
datajson
.
actionBody
.
orderSnapshot
.
isRenew
!=
'undefined'
)
{
params
.
baseInfo
.
isRenew
=
datajson
.
actionBody
.
orderSnapshot
.
isRenew
;
//是否自动续费
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
memoInfo
&&
datajson
.
actionBody
.
orderSnapshot
.
memoInfo
!=
'undefined'
)
{
params
.
baseInfo
.
memoInfo
=
datajson
.
actionBody
.
orderSnapshot
.
memoInfo
;
}
else
if
(
datajson
.
actionBody
.
orderSnapshot
.
businessContent
&&
datajson
.
actionBody
.
orderSnapshot
.
businessContent
!=
'undefined'
)
{
params
.
baseInfo
.
memoInfo
=
datajson
.
actionBody
.
orderSnapshot
.
businessContent
;
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
whetherType
&&
datajson
.
actionBody
.
orderSnapshot
.
whetherType
!=
'undefined'
)
{
params
.
baseInfo
.
whetherType
=
datajson
.
actionBody
.
orderSnapshot
.
whetherType
;
//刻章类型
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
hasOwnProperty
(
"annualReport"
))
{
//年报信息
params
.
baseInfo
.
annualReport
=
datajson
.
actionBody
.
orderSnapshot
.
annualReport
;
}
else
{
if
(
datajson
.
actionBody
.
orderSnapshot
.
annual_report
&&
datajson
.
actionBody
.
orderSnapshot
.
annual_report
!=
'undefined'
)
{
params
.
baseInfo
.
annualReport
=
true
;
//shifouxuyaonianbao
}
else
{
params
.
baseInfo
.
annualReport
=
false
;
}
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
hasOwnProperty
(
"addressType"
))
{
//注册地址类型
if
(
datajson
.
actionBody
.
orderSnapshot
.
addressType
===
true
||
datajson
.
actionBody
.
orderSnapshot
.
addressType
===
"practical"
)
{
params
.
baseInfo
.
addressType
=
"practical"
;
}
else
{
params
.
baseInfo
.
addressType
=
"virtual"
;
}
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
subjectType
&&
datajson
.
actionBody
.
orderSnapshot
.
subjectType
!=
'undefined'
)
{
params
.
baseInfo
.
subjectType
=
datajson
.
actionBody
.
orderSnapshot
.
subjectType
;
//代理记账主体类型
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
companyName
&&
datajson
.
actionBody
.
orderSnapshot
.
companyName
!=
'undefined'
)
{
params
.
baseInfo
.
companyName
=
datajson
.
actionBody
.
orderSnapshot
.
companyName
;
//公司名称
params
.
companyInfo
.
companyName
=
datajson
.
actionBody
.
orderSnapshot
.
companyName
;
}
else
if
(
datajson
.
actionBody
.
orderSnapshot
.
company
&&
datajson
.
actionBody
.
orderSnapshot
.
company
!=
'undefined'
)
{
params
.
baseInfo
.
companyName
=
datajson
.
actionBody
.
orderSnapshot
.
company
;
//公司名称
params
.
companyInfo
.
companyName
=
datajson
.
actionBody
.
orderSnapshot
.
company
;
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
companyProperties
&&
datajson
.
actionBody
.
orderSnapshot
.
companyProperties
!=
'undefined'
)
{
params
.
companyInfo
.
companyPropertiesName
=
datajson
.
actionBody
.
orderSnapshot
.
companyProperties
;
//公司性质名称
}
else
if
(
datajson
.
actionBody
.
orderSnapshot
.
companyType
&&
datajson
.
actionBody
.
orderSnapshot
.
companyType
!=
'undefined'
)
{
params
.
companyInfo
.
companyPropertiesName
=
datajson
.
actionBody
.
orderSnapshot
.
companyType
;
//公司性质名称
}
else
if
(
datajson
.
actionBody
.
orderSnapshot
.
registeredName
&&
datajson
.
actionBody
.
orderSnapshot
.
registeredName
!=
'undefined'
)
{
params
.
companyInfo
.
companyPropertiesName
=
datajson
.
actionBody
.
orderSnapshot
.
registeredName
;
//公司性质名称
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
fullAddress
&&
datajson
.
actionBody
.
orderSnapshot
.
fullAddress
!=
'undefined'
)
{
params
.
companyInfo
.
fullAddress
=
datajson
.
actionBody
.
orderSnapshot
.
fullAddress
;
//详细地址
}
else
if
(
datajson
.
actionBody
.
orderSnapshot
.
residenceAddress
&&
datajson
.
actionBody
.
orderSnapshot
.
residenceAddress
!=
'undefined'
)
{
params
.
companyInfo
.
fullAddress
=
datajson
.
actionBody
.
orderSnapshot
.
residenceAddress
;
//详细地址
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
virtualPrice
&&
datajson
.
actionBody
.
orderSnapshot
.
virtualPrice
!=
'undefined'
)
{
params
.
companyInfo
.
virtualPrice
=
datajson
.
actionBody
.
orderSnapshot
.
virtualPrice
;
//虚拟地址价格
params
.
baseInfo
.
virtualPrice
=
datajson
.
actionBody
.
orderSnapshot
.
virtualPrice
;
//虚拟地址价格
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
residenceAddress
&&
datajson
.
actionBody
.
orderSnapshot
.
residenceAddress
!=
'undefined'
)
{
params
.
companyInfo
.
residenceAddress
=
datajson
.
actionBody
.
orderSnapshot
.
residenceAddress
;
//zhusuo
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
engagedIndustry
&&
datajson
.
actionBody
.
orderSnapshot
.
engagedIndustry
!=
'undefined'
)
{
params
.
companyInfo
.
engagedIndName
=
datajson
.
actionBody
.
orderSnapshot
.
engagedIndustry
;
//从事行业名称
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
businessScope
&&
datajson
.
actionBody
.
orderSnapshot
.
businessScope
!=
'undefined'
)
{
params
.
companyInfo
.
businessScope
=
datajson
.
actionBody
.
orderSnapshot
.
businessScope
;
//经营范围
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
operatingPeriod
&&
datajson
.
actionBody
.
orderSnapshot
.
operatingPeriod
!=
'undefined'
)
{
params
.
companyInfo
.
operatingPeriod
=
datajson
.
actionBody
.
orderSnapshot
.
operatingPeriod
;
//经营期限
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
businessTerm
&&
datajson
.
actionBody
.
orderSnapshot
.
businessTerm
!=
'undefined'
)
{
params
.
companyInfo
.
businessTerm
=
datajson
.
actionBody
.
orderSnapshot
.
businessTerm
;
//经营期限
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
registeredCapital
&&
datajson
.
actionBody
.
orderSnapshot
.
registeredCapital
!=
'undefined'
)
{
params
.
companyInfo
.
registeredCapital
=
datajson
.
actionBody
.
orderSnapshot
.
registeredCapital
;
//注册资本
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
creditCode
&&
datajson
.
actionBody
.
orderSnapshot
.
creditCode
!=
'undefined'
)
{
params
.
companyInfo
.
creditCode
=
datajson
.
actionBody
.
orderSnapshot
.
creditCode
;
//统一社会信用代码
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
establishedTime
&&
datajson
.
actionBody
.
orderSnapshot
.
establishedTime
!=
'undefined'
)
{
params
.
companyInfo
.
establishedTime
=
datajson
.
actionBody
.
orderSnapshot
.
establishedTime
;
//成立时间
}
if
(
datajson
.
actionBody
.
orderSnapshot
.
shareholderName
&&
datajson
.
actionBody
.
orderSnapshot
.
shareholderName
!=
'undefined'
)
{
params
.
companyInfo
.
shareholderName
=
datajson
.
actionBody
.
orderSnapshot
.
shareholderName
;
//法人代表
}
}
var
deliveryInfo
=
await
this
.
userService
.
getBizUserForAliDelivery
(
obj
.
baseInfo
.
contactsName
,
obj
.
servicerName
,
ConsultTypeName
,
obj
.
skuCode
,
obj
.
serviceName
);
requrl
=
this
.
icUrl
+
"/deliverybillCtl/dealAliDeliveryInfo"
;
// var bizurl = this.icUrl + "/bizoptCtl/updateStatusByDemandCode";
var
rtn
=
await
rc
.
execPost3
({
"d"
:
params
},
requrl
);
if
(
deliveryInfo
&&
deliveryInfo
!=
'undefined'
)
{
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
obj
.
clerkOpcode
=
deliveryInfo
.
opath
;
//交付员opcode
console
.
log
(
"j---------------------------------"
+
rtn
.
stdout
);
obj
.
clerkId
=
deliveryInfo
.
userId
;
//交付员id
var
stau
=
{
obj
.
costPrice
=
deliveryInfo
.
cost
;
//成本
"businessMode"
:
params
.
businessMode
,
obj
.
clerkName
=
deliveryInfo
.
userName
;
//交付员名称
"currentStatus"
:
"isFinished"
,
// obj.clerkPhone = deliveryInfo.mobile;//交付人员电话
"statusReason"
:
""
// obj.servicerCode = deliveryInfo.compId;
}
rtn
=
await
rc
.
execPost3
({
"d"
:
stau
},
bizurl
);
//更新商机状态为已完成
var
j1
=
JSON
.
parse
(
rtn
.
stdout
);
console
.
log
(
"j1---------------------------------"
+
rtn
.
stdout
);
if
(
j
.
status
==
0
&&
j1
.
status
==
0
)
{
await
this
.
cacheManager
[
"AliCache"
].
cache
(
cachestr
,
null
,
600000
);
//给业务员发信息
var
msg
=
{
"title"
:
"你有新的交付单,请尽快处理"
,
"content"
:
"交付单编号"
+
params
.
deliverNumber
+
",产品类型是"
+
params
.
businessName
+
",服务地区是"
+
params
.
serviceName
,
"sender"
:
"管理员"
,
"sender_id"
:
0
,
"msgType"
:
"single"
,
"target"
:
{
"id"
:
params
.
clerkId
,
"name"
:
params
.
clerkName
},
}
if
(
params
.
businessType
==
"/qcfw/icp/"
||
params
.
businessType
==
"/qcfw/edi/"
||
params
.
businessType
==
"/qcfw/icpannals/"
||
params
.
businessType
==
"/qcfw/ediannals/"
)
{
msg
.
app_key
=
"5ae2da88-0ced-4b7a-98ea-60d5e1ff7e2e"
;
msg
.
jump_address
=
"deliveryAll"
}
else
{
msg
.
app_key
=
"42d814c1-4daa-4643-88b2-f5dd3ec853f3"
;
msg
.
jump_address
=
"myDeliver"
}
await
this
.
msgService
.
create
(
msg
);
return
{
"status"
:
1
,
//1代表成功,否则失败
"msg"
:
""
,
"data"
:
""
,
"requestId"
:
""
}
}
else
{
return
j
;
}
}
}
}
catch
(
error
)
{
console
.
log
(
"error-------------------------------------"
+
error
);
return
system
.
getResultError
(
error
);
}
}
//关闭交付单处理
async
orderClose
(
datajson
)
{
console
.
log
(
"put in queue"
,
datajson
);
try
{
var
cachestr
=
sha235
(
JSON
.
stringify
(
datajson
));
var
cacheInfo
=
await
this
.
cacheManager
[
"AliCache"
].
getCache
(
cachestr
);
if
(
cacheInfo
&&
cacheInfo
!=
'undefined'
)
{
return
{
"status"
:
1
,
//1代表成功,否则失败
"msg"
:
"已处理成功!"
,
"data"
:
""
,
"requestId"
:
""
}
}
else
{
var
rc
=
system
.
getObject
(
"util.execClient"
);
var
requrl
=
this
.
icUrl
+
"/deliverybillCtl/updateStatusByDeliverCode"
;
var
params
=
{
"d"
:
{
"deliverNumber"
:
datajson
.
actionBody
.
orderNum
,
"deliverStatus"
:
"closed"
,
"statusReason"
:
datajson
.
actionBody
.
refusalContent
}
}
var
rtn
=
await
rc
.
execPost3
(
params
,
requrl
);
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
j
.
status
==
0
)
{
await
this
.
cacheManager
[
"AliCache"
].
cache
(
cachestr
,
null
,
600000
);
//插入缓存
//给业务员发信息
var
selUrl
=
this
.
icUrl
+
"/deliverybillCtl/findInfoByDeliverCode"
;
var
selpar
=
{
"d"
:
{
"deliverNumber"
:
datajson
.
actionBody
.
orderNum
}
}
rtn
=
await
rc
.
execPost3
(
selpar
,
selUrl
);
var
jj
=
JSON
.
parse
(
rtn
.
stdout
);
console
.
log
(
"jj-------------------------"
+
rtn
.
stdout
);
if
(
jj
.
status
==
0
&&
jj
.
data
)
{
var
msg
=
{
"title"
:
"你有关闭的交付单,请尽快处理"
,
"content"
:
"交付单编号"
+
jj
.
data
.
delivery_code
+
",产品类型是"
+
jj
.
data
.
product_name
,
"sender"
:
"管理员"
,
"sender_id"
:
0
,
"msgType"
:
"single"
,
"target"
:
{
"id"
:
jj
.
data
.
salesman_id
,
"name"
:
jj
.
data
.
salesman_name
},
}
if
(
jj
.
data
.
product_code
==
"ICP"
||
jj
.
data
.
product_code
==
"EDI"
||
jj
.
data
.
product_code
==
"ICPANNUALREPORT"
||
jj
.
data
.
product_code
==
"EDIANNUALREPORT"
)
{
msg
.
app_key
=
"5ae2da88-0ced-4b7a-98ea-60d5e1ff7e2e"
;
msg
.
jump_address
=
"deliveryAll"
}
else
{
msg
.
app_key
=
"42d814c1-4daa-4643-88b2-f5dd3ec853f3"
;
msg
.
jump_address
=
"myDeliver"
}
await
this
.
msgService
.
create
(
msg
);
}
}
console
.
log
(
"推送数据oj: "
+
JSON
.
stringify
(
obj
));
var
rtn
=
await
rc
.
execPost3
({
"d"
:
obj
},
requrl
);
console
.
log
(
"pushOrderDelivery插入数据成功---------------------------------"
+
rtn
.
stdout
);
let
cacheDeliveryInfo
=
await
this
.
cacheManager
[
"AliCache"
].
cache
(
cachestr
,
null
,
1200000
);
console
.
log
(
"交付单缓存信息: "
+
JSON
.
stringify
(
cacheDeliveryInfo
));
return
{
return
{
"status"
:
1
,
//1代表成功,否则失败
"status"
:
1
,
//1代表成功,否则失败
"msg"
:
""
,
"msg"
:
""
,
...
@@ -506,19 +243,16 @@ class AliHandler {
...
@@ -506,19 +243,16 @@ class AliHandler {
"requestId"
:
""
"requestId"
:
""
}
}
}
}
else
{
return
j
;
}
}
}
}
}
catch
(
error
)
{
catch
(
error
)
{
console
.
log
(
"error-------------------------------------"
+
error
);
return
system
.
getResultError
(
error
);
return
system
.
getResultError
(
error
);
}
}
}
}
//客户状态处理
//客户状态处理
async
deliveryNotify
(
dtajson
)
{
async
deliveryNotify
(
d
a
tajson
)
{
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
);
...
@@ -567,7 +301,7 @@ class AliHandler {
...
@@ -567,7 +301,7 @@ class AliHandler {
console
.
log
(
"jj-------------------------"
+
rtn
.
stdout
);
console
.
log
(
"jj-------------------------"
+
rtn
.
stdout
);
if
(
jj
.
status
==
0
&&
jj
.
data
)
{
if
(
jj
.
status
==
0
&&
jj
.
data
)
{
var
msg
=
{
var
msg
=
{
"title"
:
"你有"
+
title
+
"的交付单,请尽快处理"
,
"title"
:
"你有"
+
title
+
"的交付单,请尽快处理"
,
"content"
:
"交付单编号"
+
jj
.
data
.
delivery_code
+
",产品类型是"
+
jj
.
data
.
product_name
,
"content"
:
"交付单编号"
+
jj
.
data
.
delivery_code
+
",产品类型是"
+
jj
.
data
.
product_name
,
"sender"
:
"管理员"
,
"sender"
:
"管理员"
,
"sender_id"
:
0
,
"sender_id"
:
0
,
...
@@ -603,6 +337,99 @@ class AliHandler {
...
@@ -603,6 +337,99 @@ class AliHandler {
return
system
.
getResultError
(
error
);
return
system
.
getResultError
(
error
);
}
}
}
}
async
actionBodyHandler
(
actionBody
)
{
let
data
=
actionBody
;
let
obj
=
{};
obj
.
baseInfo
=
{};
obj
.
companyInfo
=
{};
obj
.
registeredInfo
=
{};
obj
.
positionInfo
=
{};
obj
.
regInfo
=
{};
obj
.
express_info
=
{};
if
(
data
.
orderNo
)
{
//交付单编号
obj
.
deliverNumber
=
data
.
orderNo
;
}
if
(
data
.
servicer
)
{
//服务商信息
if
(
data
.
servicer
.
code
)
{
//服务商编码
obj
.
servicerCode
=
data
.
servicer
.
code
;
}
if
(
data
.
servicer
.
name
)
{
//服务商名称
obj
.
servicerName
=
data
.
servicer
.
name
;
}
}
if
(
data
.
needsolution
.
solution
.
Area
)
{
//服务地区编码和服务地区
obj
.
serviceCode
=
data
.
needsolution
.
solution
.
Area
;
obj
.
serviceName
=
data
.
needsolution
.
solution
.
Area
;
}
if
(
data
.
needsolution
.
bizType
)
{
//产品编码
if
(
data
.
needsolution
.
bizType
==
"icpsq"
)
{
obj
.
businessType
=
"ICP"
;
}
if
(
data
.
needsolution
.
bizType
==
"edisq"
)
{
obj
.
businessType
=
"EDI"
;
}
}
if
(
data
.
needsolution
.
typeName
)
{
//产品名称
if
(
data
.
needsolution
.
typeName
==
"icp申请"
)
{
obj
.
businessName
=
"icp"
;
}
if
(
data
.
needsolution
.
typeName
==
"edi申请"
)
{
obj
.
businessName
=
"edi"
;
}
}
if
(
data
.
skuCode
)
{
//产品的sku
obj
.
skuCode
=
data
.
skuCode
;
}
if
(
data
.
needsolution
.
status
)
{
//交付单状态码
if
(
data
.
needsolution
.
status
=
"USER_UPLOADED"
)
{
obj
.
deliverStatus
=
"received"
;
}
}
if
(
data
.
needsolution
.
customerRemark
)
{
//状态原因
obj
.
statusReason
=
data
.
needsolution
.
customerRemark
;
}
if
(
data
.
needsolution
.
status
)
{
//TODO成本
obj
.
costPrice
=
data
.
needsolution
.
status
;
}
if
(
data
.
needsolution
.
totalSum
)
{
//价格
obj
.
sellingPrice
=
data
.
needsolution
.
totalSum
;
}
//渠道名称和渠道编码
obj
.
channelSource
=
"aliCloud"
;
obj
.
channelNumber
=
"阿里云"
;
if
(
data
.
needsolution
.
salesmanInfo
)
{
if
(
data
.
needsolution
.
salesmanInfo
.
salesmanName
)
{
obj
.
salesmanName
=
data
.
needsolution
.
salesmanInfo
.
salesmanName
;
}
if
(
data
.
needsolution
.
salesmanInfo
.
salesmanMobile
)
{
obj
.
salesmanPhone
=
data
.
needsolution
.
salesmanInfo
.
salesmanMobile
;
}
}
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
;
}
if
(
data
.
needsolution
.
customerRemark
)
{
//备注信息
obj
.
baseInfo
.
memoinfo
=
data
.
needsolution
.
customerRemark
;
}
}
if
(
data
.
needsolution
.
customerMaterial
)
{
//客户上传所有材料
obj
.
baseInfo
.
customerMaterial
=
data
.
needsolution
.
customerMaterial
;
}
if
(
data
.
needsolution
.
solutionFlowList
)
{
//流程记录
obj
.
baseInfo
.
solutionFlowList
=
data
.
needsolution
.
solutionFlowList
;
}
return
obj
;
}
}
}
...
@@ -627,4 +454,10 @@ module.exports = new AliHandler();
...
@@ -627,4 +454,10 @@ module.exports = new AliHandler();
// } catch (error) {
// } catch (error) {
// console.log("getBizUserForAliDelivery err: "+ error);
// console.log("getBizUserForAliDelivery err: "+ error);
// }
// }
// }
// let rc = system.getObject("util.execClient");
// let requrl = settings.icUrl() + "/web/bizchance" + ;
// start();
// async function start() {
// let res = await rc.execPost3({ "d": obj }, requrl);
// }
// }
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment