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
49d313aa
Commit
49d313aa
authored
Jul 22, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
f9fe13bf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
215 additions
and
154 deletions
+215
-154
brg-user-center/app/base/api/impl/receive/entService.js
+1
-1
brg-user-center/app/base/service/impl/common/txPushLogSve.js
+4
-1
brg-user-center/app/base/service/impl/order/orderDeliverySve.js
+199
-145
brg-user-center/app/base/service/impl/order/orderInfoSve.js
+10
-6
brg-user-center/app/config/platform.js
+1
-1
No files found.
brg-user-center/app/base/api/impl/receive/entService.js
View file @
49d313aa
...
...
@@ -38,7 +38,7 @@ class EntService extends APIBase {
opResult
=
await
this
.
orderDeliverySve
.
submitDeliveryInfo
(
pobj
);
break
;
case
"updateOrderStatus"
:
//服务商修改订单交付状态
opResult
=
await
this
.
orderDeliverySve
.
updateOrderStatus
(
pobj
);
opResult
=
await
this
.
orderDeliverySve
.
updateOrderStatus
(
pobj
,
req
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
...
...
brg-user-center/app/base/service/impl/common/txPushLogSve.js
View file @
49d313aa
...
...
@@ -82,10 +82,13 @@ class TxPushLogService extends ServiceBase {
if
(
!
orderInfo
)
{
return
self
.
returnTX
(
-
1
,
"cgateway"
,
"资源不存在"
,
null
)
}
var
status
=
0
;
var
status
=
2
;
if
(
orderInfo
.
status
==
320
)
{
status
=
3
;
}
if
(
orderInfo
.
status
==
300
)
{
status
=
0
;
}
return
self
.
returnTX
(
0
,
"cgateway"
,
"ok"
,
{
"status"
:
status
})
}
...
...
brg-user-center/app/base/service/impl/order/orderDeliverySve.js
View file @
49d313aa
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
{
PDICT
,
MsgTemplate
}
=
require
(
"../../../../config/platform"
);
const
{
PDICT
,
MsgTemplate
}
=
require
(
"../../../../config/platform"
);
var
moment
=
require
(
'moment'
);
class
OrderDeliveryService
extends
ServiceBase
{
constructor
()
{
...
...
@@ -14,51 +14,51 @@ class OrderDeliveryService extends ServiceBase {
this
.
utilsMsgSendSve
=
system
.
getObject
(
"service.utilsSve.utilsMsgSendSve"
);
}
//服务商提交交付信息
async
submitDeliveryInfo
(
pobj
){
if
(
!
pobj
||
!
pobj
.
actionBody
)
{
return
system
.
getResultFail
(
-
100
,
"参数错误"
);
async
submitDeliveryInfo
(
pobj
)
{
if
(
!
pobj
||
!
pobj
.
actionBody
)
{
return
system
.
getResultFail
(
-
100
,
"参数错误"
);
}
var
ab
=
pobj
.
actionBody
;
if
(
!
ab
.
orderNum
)
{
return
system
.
getResultFail
(
-
101
,
"订单号不能为空"
);
if
(
!
ab
.
orderNum
)
{
return
system
.
getResultFail
(
-
101
,
"订单号不能为空"
);
}
if
(
!
ab
.
deliveryContent
)
{
return
system
.
getResultFail
(
-
102
,
"交付内容不能为空"
);
if
(
!
ab
.
deliveryContent
)
{
return
system
.
getResultFail
(
-
102
,
"交付内容不能为空"
);
}
var
orderinfo
=
await
this
.
orderInfoDao
.
model
.
findOne
({
where
:
{
order_num
:
ab
.
orderNum
},
attributes
:[
`id`
,
`order_num`
,
`tx_orders_num`
,
`need_num`
,
`user_id`
,
`user_name`
,
`quantity`
,
`total_sum`
,
`discount_amount`
,
`pay_total_sum`
,
`refund_sum`
,
`order_status`
],
raw
:
true
where
:
{
order_num
:
ab
.
orderNum
},
attributes
:
[
`id`
,
`order_num`
,
`tx_orders_num`
,
`need_num`
,
`user_id`
,
`user_name`
,
`quantity`
,
`total_sum`
,
`discount_amount`
,
`pay_total_sum`
,
`refund_sum`
,
`order_status`
],
raw
:
true
});
if
(
!
orderinfo
||
!
orderinfo
.
id
)
{
return
system
.
getResultFail
(
-
300
,
"未知订单信息"
);
if
(
!
orderinfo
||
!
orderinfo
.
id
)
{
return
system
.
getResultFail
(
-
300
,
"未知订单信息"
);
}
//订单状态1: 已接单, 310: 部分已退款, 320: 已退款,330: 已作废
if
(
orderinfo
.
order_status
!=
1
)
{
return
system
.
getResultFail
(
-
301
,
"操作失败,订单状态有误"
);
if
(
orderinfo
.
order_status
!=
1
)
{
return
system
.
getResultFail
(
-
301
,
"操作失败,订单状态有误"
);
}
var
orderdelivery
=
await
this
.
dao
.
model
.
findOne
({
where
:
{
order_num
:
orderinfo
.
order_num
},
raw
:
true
where
:
{
order_num
:
orderinfo
.
order_num
},
raw
:
true
});
if
(
orderdelivery
&&
orderdelivery
.
id
)
{
if
(
orderdelivery
.
delivery_status
!=
1
)
{
return
system
.
getResultFail
(
-
302
,
"交付状态错误,只能提交待接单状态交付信息"
);
if
(
orderdelivery
&&
orderdelivery
.
id
)
{
if
(
orderdelivery
.
delivery_status
!=
1
)
{
return
system
.
getResultFail
(
-
302
,
"交付状态错误,只能提交待接单状态交付信息"
);
}
var
updateObj
=
{
id
:
orderdelivery
.
id
,
delivery_status
:
"2"
,
deliver_content
:
ab
.
deliveryContent
id
:
orderdelivery
.
id
,
delivery_status
:
"2"
,
deliver_content
:
ab
.
deliveryContent
};
await
this
.
dao
.
update
(
updateObj
);
return
system
.
getResultSuccess
();
}
else
{
var
createObj
=
{
delivery_status
:
"2"
,
order_num
:
orderinfo
.
order_num
,
tx_orders_num
:
orderinfo
.
tx_orders_num
,
user_id
:
orderinfo
.
user_id
,
user_name
:
orderinfo
.
user_name
,
deliver_content
:
ab
.
deliveryContent
}
else
{
var
createObj
=
{
delivery_status
:
"2"
,
order_num
:
orderinfo
.
order_num
,
tx_orders_num
:
orderinfo
.
tx_orders_num
,
user_id
:
orderinfo
.
user_id
,
user_name
:
orderinfo
.
user_name
,
deliver_content
:
ab
.
deliveryContent
};
await
this
.
dao
.
create
(
createObj
);
return
system
.
getResultSuccess
();
...
...
@@ -66,23 +66,23 @@ class OrderDeliveryService extends ServiceBase {
}
//根据交付状态获取订单列表(概览数据待收文件->待收文件订单列表)
async
getOrderListByStatus
(
pobj
){
if
(
!
pobj
||
!
pobj
.
actionBody
)
{
return
system
.
getResultFail
(
-
100
,
"参数错误"
);
async
getOrderListByStatus
(
pobj
)
{
if
(
!
pobj
||
!
pobj
.
actionBody
)
{
return
system
.
getResultFail
(
-
100
,
"参数错误"
);
}
var
ab
=
pobj
.
actionBody
;
if
(
!
ab
.
UserId
)
{
return
system
.
getResultFail
(
-
101
,
"用户id不能为空"
);
if
(
!
ab
.
UserId
)
{
return
system
.
getResultFail
(
-
101
,
"用户id不能为空"
);
}
if
(
!
ab
.
Status
)
{
return
system
.
getResultFail
(
-
102
,
"订单状态不能为空"
);
if
(
!
ab
.
Status
)
{
return
system
.
getResultFail
(
-
102
,
"订单状态不能为空"
);
}
var
list
=
await
this
.
dao
.
getOrderListByStatus
(
ab
.
UserId
,
ab
.
Status
);
var
list
=
await
this
.
dao
.
getOrderListByStatus
(
ab
.
UserId
,
ab
.
Status
);
return
system
.
getResultSuccess
(
list
);
}
//修改订单交付状态
async
updateOrderStatus
(
pobj
)
{
async
updateOrderStatus
(
pobj
,
req
)
{
if
(
!
pobj
||
!
pobj
.
actionBody
)
{
return
system
.
getResultFail
(
-
100
,
"参数错误"
);
}
...
...
@@ -124,7 +124,7 @@ class OrderDeliveryService extends ServiceBase {
return
system
.
getResultFail
(
-
301
,
"订单状态错误"
);
}
var
orderproduct
=
await
this
.
orderProductDao
.
model
.
findOne
({
where
:
{
order_num
:
ab
.
orderNum
},
raw
:
true
where
:
{
order_num
:
ab
.
orderNum
},
raw
:
true
});
//获取交付信息
var
orderdeliveryinfo
=
await
this
.
dao
.
model
.
findOne
({
...
...
@@ -133,7 +133,7 @@ class OrderDeliveryService extends ServiceBase {
if
(
!
orderdeliveryinfo
||
!
orderdeliveryinfo
.
id
)
{
return
system
.
getResultFail
(
-
302
,
"未知订单交付信息"
);
}
if
(
orderdeliveryinfo
.
delivery_status
>
ab
.
status
&&
orderproduct
&&
orderproduct
.
product_type
!=
"/qcfw/ediannals/"
&&
orderproduct
.
product_type
!=
"/qcfw/icpannals/"
)
{
if
(
orderdeliveryinfo
.
delivery_status
>
ab
.
status
&&
orderproduct
&&
orderproduct
.
product_type
!=
"/qcfw/ediannals/"
&&
orderproduct
.
product_type
!=
"/qcfw/icpannals/"
)
{
return
system
.
getResultFail
(
-
303
,
"订单交付状态不能退回"
);
}
var
deliver_content
=
orderdeliveryinfo
.
deliver_content
||
{};
...
...
@@ -145,13 +145,28 @@ class OrderDeliveryService extends ServiceBase {
Object
.
assign
(
deliver_content
,
ab
.
deliverContent
);
updateObj
[
"deliver_content"
]
=
deliver_content
;
}
await
this
.
dao
.
update
(
updateObj
);
var
self
=
this
;
await
self
.
db
.
transaction
(
async
function
(
t
)
{
await
self
.
dao
.
update
(
updateObj
,
t
);
if
(
orderinfo
.
order_status
!=
300
){
if
(
ab
.
status
==
80
){
await
self
.
orderInfoDao
.
update
({
id
:
orderinfo
.
id
,
order_status
:
300
},
t
);
}
else
if
(
deliver_content
&&
deliver_content
.
baseInfo
&&
deliver_content
.
baseInfo
.
payStatus
&&
deliver_content
.
baseInfo
.
payStatus
==
"已交付"
){
await
self
.
orderInfoDao
.
update
({
id
:
orderinfo
.
id
,
order_status
:
300
},
t
);
}
}
});
if
(
ab
.
status
==
170
||
ab
.
status
==
30
||
ab
.
status
==
160
||
ab
.
status
==
150
){
//交付状态:已完成,已交付,已签收
this
.
createQualificationCertificateInfo
(
ab
.
orderNum
);
//创建资质证照信息
this
.
createApplyInfo
(
ab
.
orderNum
);
//创建申请主体信息
}
if
(
ab
.
status
==
80
){
await
this
.
submitDeliveryInfotoTX
(
ab
.
orderNum
,
req
);
}
else
if
(
deliver_content
&&
deliver_content
.
baseInfo
&&
deliver_content
.
baseInfo
.
payStatus
&&
deliver_content
.
baseInfo
.
payStatus
==
"已交付"
){
await
this
.
submitDeliveryInfotoTX
(
ab
.
orderNum
,
req
);
}
//发送消息通知
this
.
sendNotification
(
ab
.
orderNum
,
ab
.
status
);
this
.
sendNotification
(
ab
.
orderNum
,
ab
.
status
);
return
system
.
getResultSuccess
();
}
/**
...
...
@@ -161,69 +176,69 @@ class OrderDeliveryService extends ServiceBase {
* @param {*} productType 产品类型
* @param {*} msgTemplate 消息模板
*/
async
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
msgTemplate
)
{
async
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
msgTemplate
)
{
//productName orderNum expirationDate timeRemaining userId userName area parkName logisticsCompany waybillNo
if
(
orderdetail
.
order_num
)
{
//订单号
msgTemplate
=
msgTemplate
.
replace
(
/{orderNum}/g
,
orderdetail
.
order_num
);
if
(
orderdetail
.
order_num
)
{
//订单号
msgTemplate
=
msgTemplate
.
replace
(
/{orderNum}/g
,
orderdetail
.
order_num
);
}
if
(
orderdetail
.
total_sum
)
{
//订单金额
var
totalSum
=
orderdetail
.
total_sum
/
100
;
totalSum
=
totalSum
.
toFixed
(
2
);
msgTemplate
=
msgTemplate
.
replace
(
/{totalSum}/g
,
totalSum
);
if
(
orderdetail
.
total_sum
)
{
//订单金额
var
totalSum
=
orderdetail
.
total_sum
/
100
;
totalSum
=
totalSum
.
toFixed
(
2
);
msgTemplate
=
msgTemplate
.
replace
(
/{totalSum}/g
,
totalSum
);
}
if
(
orderdetail
.
end_time
)
{
//过期时间
msgTemplate
=
msgTemplate
.
replace
(
/{expirationDate}/g
,
orderdetail
.
end_time
);
if
(
orderdetail
.
end_time
)
{
//过期时间
msgTemplate
=
msgTemplate
.
replace
(
/{expirationDate}/g
,
orderdetail
.
end_time
);
var
m1
=
moment
(
new
Date
());
var
m2
=
moment
(
new
Date
(
orderdetail
.
end_time
));
var
days
=
m2
.
diff
(
m1
,
'day'
);
if
(
days
&&
days
>=
0
)
{
//剩余天数
msgTemplate
=
msgTemplate
.
replace
(
/{timeRemaining}/g
,
days
);
var
days
=
m2
.
diff
(
m1
,
'day'
);
if
(
days
&&
days
>=
0
)
{
//剩余天数
msgTemplate
=
msgTemplate
.
replace
(
/{timeRemaining}/g
,
days
);
}
}
var
deliverContent
=
orderdetail
.
deliver_content
;
if
(
deliverContent
)
{
if
(
deliverContent
)
{
//注册园区
if
(
orderdetail
.
product_type
==
"/ic/cpreg/"
&&
deliverContent
.
companyInfo
&&
deliverContent
.
companyInfo
.
registeredPark
)
{
msgTemplate
=
msgTemplate
.
replace
(
/{parkName}/g
,
deliverContent
.
companyInfo
.
registeredPark
);
if
(
orderdetail
.
product_type
==
"/ic/cpreg/"
&&
deliverContent
.
companyInfo
&&
deliverContent
.
companyInfo
.
registeredPark
)
{
msgTemplate
=
msgTemplate
.
replace
(
/{parkName}/g
,
deliverContent
.
companyInfo
.
registeredPark
);
}
//邮寄信息
if
(
deliverContent
.
expressInfo
&&
deliverContent
.
expressInfo
.
logisticsCompany
&&
deliverContent
.
expressInfo
.
trackingNumber
)
{
msgTemplate
=
msgTemplate
.
replace
(
/{logisticsCompany}/g
,
deliverContent
.
expressInfo
.
logisticsCompany
)
.
replace
(
/{waybillNo}/g
,
deliverContent
.
expressInfo
.
trackingNumber
);
if
(
deliverContent
.
expressInfo
&&
deliverContent
.
expressInfo
.
logisticsCompany
&&
deliverContent
.
expressInfo
.
trackingNumber
)
{
msgTemplate
=
msgTemplate
.
replace
(
/{logisticsCompany}/g
,
deliverContent
.
expressInfo
.
logisticsCompany
)
.
replace
(
/{waybillNo}/g
,
deliverContent
.
expressInfo
.
trackingNumber
);
}
//资质证号
if
(
deliverContent
.
qualification
&&
deliverContent
.
qualification
.
certificateNumber
)
{
msgTemplate
=
msgTemplate
.
replace
(
/{qcNo}/g
,
deliverContent
.
qualification
.
certificateNumber
);
}
else
if
(
orderdetail
.
certificateNumber
)
{
msgTemplate
=
msgTemplate
.
replace
(
/{qcNo}/g
,
orderdetail
.
certificateNumber
);
if
(
deliverContent
.
qualification
&&
deliverContent
.
qualification
.
certificateNumber
)
{
msgTemplate
=
msgTemplate
.
replace
(
/{qcNo}/g
,
deliverContent
.
qualification
.
certificateNumber
);
}
else
if
(
orderdetail
.
certificateNumber
)
{
msgTemplate
=
msgTemplate
.
replace
(
/{qcNo}/g
,
orderdetail
.
certificateNumber
);
}
if
(
deliverContent
.
annualReport
)
{
//年报列表
if
(
deliverContent
.
annualReport
)
{
//年报列表
var
year
=
null
;
for
(
var
i
=
0
;
i
<
deliverContent
.
annualReport
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
deliverContent
.
annualReport
.
length
;
i
++
)
{
var
annualReport
=
deliverContent
.
annualReport
[
i
];
if
(
annualReport
&&
annualReport
.
year
&&
annualReport
.
status
&&
annualReport
.
status
==
'declaresuccess'
)
{
if
(
!
year
||
year
<
annualReport
.
year
)
year
=
annualReport
.
year
;
if
(
annualReport
&&
annualReport
.
year
&&
annualReport
.
status
&&
annualReport
.
status
==
'declaresuccess'
)
{
if
(
!
year
||
year
<
annualReport
.
year
)
year
=
annualReport
.
year
;
}
}
if
(
year
)
{
msgTemplate
=
msgTemplate
.
replace
(
/{year}/g
,
year
);
if
(
year
)
{
msgTemplate
=
msgTemplate
.
replace
(
/{year}/g
,
year
);
}
}
}
if
(
productName
)
{
//产品名称
if
(
productName
)
{
//产品名称
msgTemplate
=
msgTemplate
.
replace
(
/{productName}/g
,
productName
);
}
if
(
productType
)
{
//产品类型名称
if
(
productType
)
{
//产品类型名称
msgTemplate
=
msgTemplate
.
replace
(
/{productType}/g
,
productType
);
}
if
(
orderdetail
.
region_name
)
{
//地区
if
(
orderdetail
.
region_name
)
{
//地区
msgTemplate
=
msgTemplate
.
replace
(
/{area}/g
,
orderdetail
.
region_name
);
}
if
(
orderdetail
.
user_id
)
{
//用户id
if
(
orderdetail
.
user_id
)
{
//用户id
msgTemplate
=
msgTemplate
.
replace
(
/{userId}/g
,
orderdetail
.
user_id
);
}
if
(
orderdetail
.
user_name
)
{
//用户昵称
if
(
orderdetail
.
user_name
)
{
//用户昵称
msgTemplate
=
msgTemplate
.
replace
(
/{userName}/g
,
orderdetail
.
user_name
);
}
return
msgTemplate
;
...
...
@@ -240,10 +255,10 @@ class OrderDeliveryService extends ServiceBase {
var
orderdetail
=
null
;
//获取订单详情
var
orderDetailRes
=
await
this
.
dao
.
getOrderDetailByOrderNum
(
orderNum
);
if
(
orderDetailRes
&&
orderDetailRes
.
length
>
0
)
{
if
(
orderDetailRes
&&
orderDetailRes
.
length
>
0
)
{
orderdetail
=
orderDetailRes
[
0
];
}
if
(
!
orderdetail
||
!
status
||
!
orderdetail
.
product_type
)
{
if
(
!
orderdetail
||
!
status
||
!
orderdetail
.
product_type
)
{
return
system
.
getResultFail
();
}
var
nameArr
=
orderdetail
.
product_type_name
?
orderdetail
.
product_type_name
.
split
(
"/"
)
:
[];
...
...
@@ -253,76 +268,76 @@ class OrderDeliveryService extends ServiceBase {
productName
=
nameArr
[
2
];
productType
=
nameArr
[
1
];
}
var
typeOne
=
null
;
//产品大类编码,用于获取消息模板
var
typeOne
=
null
;
//产品大类编码,用于获取消息模板
if
(
orderdetail
.
product_type
.
indexOf
(
"/ic/"
)
>=
0
)
{
//工商产品
typeOne
=
"ic"
;
}
if
(
orderdetail
.
product_type
.
indexOf
(
"/qcfw/"
)
>=
0
)
{
//资质证照产品
typeOne
=
"qcfw"
;
typeOne
=
"qcfw"
;
}
if
(
!
typeOne
||
!
productName
)
{
if
(
!
typeOne
||
!
productName
)
{
return
system
.
getResultFail
();
}
var
params
=
{};
if
(
status
==
170
&&
(
orderdetail
.
product_type
==
"/qcfw/icpannals/"
||
orderdetail
.
product_type
==
"/qcfw/ediannals/"
))
{
//年报已完成
functionModule
=
"others"
;
if
(
orderdetail
.
tx_orders_num
)
{
if
(
status
==
170
&&
(
orderdetail
.
product_type
==
"/qcfw/icpannals/"
||
orderdetail
.
product_type
==
"/qcfw/ediannals/"
))
{
//年报已完成
functionModule
=
"others"
;
if
(
orderdetail
.
tx_orders_num
)
{
//获取资质信息
var
qcInfoRes
=
await
this
.
dao
.
getQcInfoByMainOrderNum
(
orderdetail
.
tx_orders_num
);
if
(
qcInfoRes
&&
qcInfoRes
.
length
>
0
)
{
if
(
qcInfoRes
[
0
]
&&
qcInfoRes
[
0
].
deliver_content
&&
qcInfoRes
[
0
].
deliver_content
.
qualification
&&
qcInfoRes
[
0
].
deliver_content
.
qualification
.
certificateNumber
)
{
if
(
qcInfoRes
&&
qcInfoRes
.
length
>
0
)
{
if
(
qcInfoRes
[
0
]
&&
qcInfoRes
[
0
].
deliver_content
&&
qcInfoRes
[
0
].
deliver_content
.
qualification
&&
qcInfoRes
[
0
].
deliver_content
.
qualification
.
certificateNumber
)
{
orderdetail
.
certificateNumber
=
qcInfoRes
[
0
].
deliver_content
.
qualification
.
certificateNumber
;
}
}
}
}
if
(
orderdetail
.
order_snapshot
&&
orderdetail
.
order_snapshot
.
contactsPhone
)
{
//短信
if
(
orderdetail
.
order_snapshot
&&
orderdetail
.
order_snapshot
.
contactsPhone
)
{
//短信
var
sms
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
sms
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
sms
:
""
;
if
(
sms
)
{
sms
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
sms
);
if
(
sms
.
indexOf
(
"{"
)
<
0
&&
sms
.
indexOf
(
"}"
)
<
0
)
{
params
[
"phoneList"
]
=
[{
phoneNumber
:
orderdetail
.
order_snapshot
.
contactsPhone
,
messageBody
:
sms
}];
if
(
sms
)
{
sms
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
sms
);
if
(
sms
.
indexOf
(
"{"
)
<
0
&&
sms
.
indexOf
(
"}"
)
<
0
)
{
params
[
"phoneList"
]
=
[{
phoneNumber
:
orderdetail
.
order_snapshot
.
contactsPhone
,
messageBody
:
sms
}];
}
}
}
if
(
orderdetail
.
user_id
)
{
//站内信
if
(
orderdetail
.
user_id
)
{
//站内信
var
webinfo
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfo
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfo
:
""
;
var
webinfotitle
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfotitle
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfotitle
:
""
;
if
(
webinfo
&&
webinfotitle
)
{
webinfo
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
webinfo
);
if
(
webinfo
.
indexOf
(
"{"
)
<
0
&&
webinfo
.
indexOf
(
"}"
)
<
0
)
{
params
[
"subAccountList"
]
=
[{
title
:
webinfotitle
,
subAccount
:
orderdetail
.
user_id
,
messageBody
:
webinfo
}];
if
(
webinfo
&&
webinfotitle
)
{
webinfo
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
webinfo
);
if
(
webinfo
.
indexOf
(
"{"
)
<
0
&&
webinfo
.
indexOf
(
"}"
)
<
0
)
{
params
[
"subAccountList"
]
=
[{
title
:
webinfotitle
,
subAccount
:
orderdetail
.
user_id
,
messageBody
:
webinfo
}];
}
}
}
if
(
orderdetail
.
wechat_no
)
{
//微信
if
(
orderdetail
.
wechat_no
)
{
//微信
var
wechatMsg
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
wx
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
wx
:
""
;
var
wechattitle
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfotitle
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
webinfotitle
:
""
;
if
(
wechatMsg
&&
wechattitle
)
{
wechatMsg
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
wechatMsg
);
if
(
wechatMsg
.
indexOf
(
"{"
)
<
0
&&
wechatMsg
.
indexOf
(
"}"
)
<
0
)
{
params
[
"wechatList"
]
=
[{
title
:
wechattitle
,
wechatNumber
:
orderdetail
.
wechat_no
,
messageBody
:
wechatMsg
}];
if
(
wechatMsg
&&
wechattitle
)
{
wechatMsg
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
wechatMsg
);
if
(
wechatMsg
.
indexOf
(
"{"
)
<
0
&&
wechatMsg
.
indexOf
(
"}"
)
<
0
)
{
params
[
"wechatList"
]
=
[{
title
:
wechattitle
,
wechatNumber
:
orderdetail
.
wechat_no
,
messageBody
:
wechatMsg
}];
}
}
}
if
(
orderdetail
.
email
)
{
//邮箱
if
(
orderdetail
.
email
)
{
//邮箱
var
emailMsg
=
MsgTemplate
[
typeOne
][
functionModule
][
status
]
&&
MsgTemplate
[
typeOne
][
functionModule
][
status
].
email
?
MsgTemplate
[
typeOne
][
functionModule
][
status
].
email
:
""
;
if
(
emailMsg
)
{
emailMsg
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
emailMsg
);
if
(
emailMsg
.
indexOf
(
"{"
)
<
0
&&
emailMsg
.
indexOf
(
"}"
)
<
0
)
{
params
[
"emailList"
]
=
[{
email
:
orderdetail
.
email
,
messageBody
:
emailMsg
}];
if
(
emailMsg
)
{
emailMsg
=
await
this
.
packageTemplatesParams
(
orderdetail
,
productName
,
productType
,
emailMsg
);
if
(
emailMsg
.
indexOf
(
"{"
)
<
0
&&
emailMsg
.
indexOf
(
"}"
)
<
0
)
{
params
[
"emailList"
]
=
[{
email
:
orderdetail
.
email
,
messageBody
:
emailMsg
}];
}
}
}
await
this
.
utilsMsgSendSve
.
sendMessageVerify
(
params
);
console
.
log
(
JSON
.
stringify
(
params
),
"params++++++++++++++++++++++++++++++++++++++++"
);
console
.
log
(
JSON
.
stringify
(
params
),
"params++++++++++++++++++++++++++++++++++++++++"
);
return
system
.
getResultSuccess
(
params
);
}
catch
(
e
)
{
this
.
execClient
.
execLogs
(
"orderDeliverySve.js/sendNotification(发送消息通知)方法出现异常"
,
{
orderNum
:
orderNum
,
status
:
status
},
"orderDeliverySve_sendNotification_error"
,
null
,
e
.
stack
);
this
.
execClient
.
execLogs
(
"orderDeliverySve.js/sendNotification(发送消息通知)方法出现异常"
,
{
orderNum
:
orderNum
,
status
:
status
},
"orderDeliverySve_sendNotification_error"
,
null
,
e
.
stack
);
return
system
.
getResultFail
();
}
}
...
...
@@ -330,74 +345,74 @@ class OrderDeliveryService extends ServiceBase {
* 创建资质信息
* @param {*} orderNum 订单号
*/
async
createQualificationCertificateInfo
(
orderNum
){
async
createQualificationCertificateInfo
(
orderNum
)
{
try
{
var
qcInfoRes
=
await
this
.
dao
.
getQcInfoByOrderNum
(
orderNum
);
if
(
qcInfoRes
&&
qcInfoRes
.
length
>
0
)
{
if
(
qcInfoRes
&&
qcInfoRes
.
length
>
0
)
{
var
data
=
qcInfoRes
[
0
];
var
deliveryContent
=
data
.
deliver_content
||
null
;
//订单交付信息
var
productType
=
data
.
product_type
||
null
;
//产品类型
var
userId
=
data
.
user_id
||
null
;
//用户id
var
qualification
=
deliveryContent
.
qualification
||
null
;
//资质信息
if
(
deliveryContent
&&
qualification
&&
qualification
.
certificateNumber
&&
productType
&&
userId
)
{
if
(
deliveryContent
&&
qualification
&&
qualification
.
certificateNumber
&&
productType
&&
userId
)
{
//营业执照信息
var
businessLicense
=
deliveryContent
.
proposerInfo
&&
deliveryContent
.
proposerInfo
.
businessLicense
?
deliveryContent
.
proposerInfo
.
businessLicense
:
{};
var
businessLicense
=
deliveryContent
.
proposerInfo
&&
deliveryContent
.
proposerInfo
.
businessLicense
?
deliveryContent
.
proposerInfo
.
businessLicense
:
{};
var
createObj
=
{
user_id
:
userId
,
//用户id
user_name
:
data
.
user_name
||
""
,
//用户名称
servicer_code
:
data
.
servicer_code
,
//服务商code utf8mb4 utf8mb4_german2_ci 0 0 0 0 0 0 0
servicer_name
:
data
.
servicer_name
,
//服务商名称 utf8mb4 utf8mb4_german2_ci 0 0 0 0 0 0 0
certificate_no
:
qualification
.
certificateNumber
,
//证书编号 utf8mb4 utf8mb4_german2_ci 0 0 0 0 0 0 0
company_name
:
businessLicense
.
name
,
//公司名称 utf8mb4 utf8mb4_german2_ci 0 0 0 0 0 0 0
company_name
:
businessLicense
.
name
,
//公司名称 utf8mb4 utf8mb4_german2_ci 0 0 0 0 0 0 0
business_coverage
:
qualification
.
businessScope
,
//业务覆盖范围 utf8mb4 utf8mb4_german2_ci 0 0 0 0 0 0 0
issue_date
:
qualification
.
startAt
,
//发证日期 0 0 0 0 0 0 0
issue_date
:
qualification
.
startAt
,
//发证日期 0 0 0 0 0 0 0
expiration_date
:
qualification
.
endAt
,
//截止期至 0 0 0 0 0 0 0
business_type
:
qualification
.
businessTypes
,
//业务种类 utf8mb4 utf8mb4_german2_ci 0 0 0 0 0 0 0
service_item
:
qualification
.
serviceProject
,
//服务项目 utf8mb4 utf8mb4_german2_ci 0 0 0 0 0 0 0
certificate_file
:
qualification
.
file
&&
qualification
.
file
.
url
?
qualification
.
file
.
url
:
""
,
//证书文件 utf8mb4 utf8mb4_german2_ci 0 0 0 0 0 0 0
certificate_file
:
qualification
.
file
&&
qualification
.
file
.
url
?
qualification
.
file
.
url
:
""
,
//证书文件 utf8mb4 utf8mb4_german2_ci 0 0 0 0 0 0 0
license_type
:
1
};
if
(
productType
==
"/qcfw/icp/"
)
{
createObj
.
license_type
=
1
;
if
(
productType
==
"/qcfw/icp/"
)
{
createObj
.
license_type
=
1
;
}
if
(
productType
==
"/qcfw/edi/"
)
{
createObj
.
license_type
=
2
;
if
(
productType
==
"/qcfw/edi/"
)
{
createObj
.
license_type
=
2
;
}
var
beforeData
=
await
this
.
qualificationCertificateDao
.
model
.
findOne
({
where
:
{
user_id
:
data
.
user_id
,
certificate_no
:
qualification
.
certificateNumber
},
raw
:
true
where
:
{
user_id
:
data
.
user_id
,
certificate_no
:
qualification
.
certificateNumber
},
raw
:
true
});
if
(
beforeData
&&
beforeData
.
id
)
{
//更新数据
createObj
[
"id"
]
=
beforeData
.
id
;
if
(
beforeData
&&
beforeData
.
id
)
{
//更新数据
createObj
[
"id"
]
=
beforeData
.
id
;
await
this
.
qualificationCertificateDao
.
update
(
createObj
);
}
else
{
//新增数据
}
else
{
//新增数据
await
this
.
qualificationCertificateDao
.
create
(
createObj
);
}
}
}
}
catch
(
e
)
{
console
.
log
(
e
);
this
.
execClient
.
execLogs
(
"orderDeliverySve.js/createQualificationCertificateInfo方法出现异常"
,
{
params
:
orderNum
},
"orderDeliverySve_createQualificationCertificateInfo_error"
,
null
,
e
.
stack
);
this
.
execClient
.
execLogs
(
"orderDeliverySve.js/createQualificationCertificateInfo方法出现异常"
,
{
params
:
orderNum
},
"orderDeliverySve_createQualificationCertificateInfo_error"
,
null
,
e
.
stack
);
}
}
//创建申请实体
//创建申请实体
async
createApplyInfo
(
orderNum
)
{
try
{
var
orderdelivery
=
null
;
var
orderdelivery
=
null
;
var
orderlist
=
await
this
.
dao
.
getOrderInfoByOrderNum
(
orderNum
);
if
(
orderlist
&&
orderlist
.
length
>
0
)
{
if
(
orderlist
&&
orderlist
.
length
>
0
)
{
orderdelivery
=
orderlist
[
0
];
}
if
(
orderdelivery
&&
orderdelivery
.
deliver_content
&&
orderdelivery
.
user_id
)
{
var
deliver_content
=
orderdelivery
.
deliver_content
;
if
(
orderdelivery
.
product_type
.
indexOf
(
"/ic/"
)
>=
0
)
{
if
(
orderdelivery
.
product_type
.
indexOf
(
"/ic/"
)
>=
0
)
{
if
(
deliver_content
&&
deliver_content
.
companyInfo
&&
deliver_content
.
companyInfo
.
creditCode
)
{
var
companyInfo
=
deliver_content
.
companyInfo
;
var
applyinfo
=
await
this
.
applyInfoDao
.
model
.
findOne
({
where
:
{
credit_code
:
deliver_content
.
companyInfo
.
creditCode
,
user_id
:
orderdelivery
.
user_id
},
where
:
{
credit_code
:
deliver_content
.
companyInfo
.
creditCode
,
user_id
:
orderdelivery
.
user_id
},
raw
:
true
});
if
(
!
applyinfo
||
!
applyinfo
.
id
)
{
//创建申请实体
...
...
@@ -408,8 +423,8 @@ class OrderDeliveryService extends ServiceBase {
user_name
:
orderdelivery
.
user_name
,
apply_name
:
companyInfo
.
companyName
,
credit_code
:
companyInfo
.
creditCode
,
apply_type
:
companyInfo
.
companyType
==
"个体工商户"
?
2
:
1
,
operator
:
companyInfo
.
shareholderName
||
""
,
apply_type
:
companyInfo
.
companyType
==
"个体工商户"
?
2
:
1
,
operator
:
companyInfo
.
shareholderName
||
""
,
regist_capital
:
companyInfo
.
registeredCapital
,
business_term
:
companyInfo
.
businessTerm
,
establish_time
:
companyInfo
.
establishedTime
,
...
...
@@ -422,8 +437,8 @@ class OrderDeliveryService extends ServiceBase {
var
updateObj
=
{
apply_name
:
companyInfo
.
companyName
,
credit_code
:
companyInfo
.
creditCode
,
apply_type
:
companyInfo
.
companyType
==
"个体工商户"
?
2
:
1
,
operator
:
companyInfo
.
shareholderName
||
""
,
apply_type
:
companyInfo
.
companyType
==
"个体工商户"
?
2
:
1
,
operator
:
companyInfo
.
shareholderName
||
""
,
regist_capital
:
companyInfo
.
registeredCapital
,
business_term
:
companyInfo
.
businessTerm
,
establish_time
:
companyInfo
.
establishedTime
,
...
...
@@ -435,16 +450,55 @@ class OrderDeliveryService extends ServiceBase {
}
}
}
}
return
system
.
getResultSuccess
();
}
catch
(
e
)
{
console
.
log
(
e
,
"创建申请实体异常"
);
this
.
execClient
.
execLogs
(
"orderDeliverySve.js/createApplyInfo方法出现异常"
,
{
params
:
orderNum
},
"orderDeliverySve_createApplyInfo_error"
,
null
,
e
.
stack
);
console
.
log
(
e
,
"创建申请实体异常"
);
this
.
execClient
.
execLogs
(
"orderDeliverySve.js/createApplyInfo方法出现异常"
,
{
params
:
orderNum
},
"orderDeliverySve_createApplyInfo_error"
,
null
,
e
.
stack
);
return
system
.
getResultSuccess
();
}
}
//发货成功回调腾讯云
async
submitDeliveryInfotoTX
(
orderNum
,
req
)
{
var
orderinfo
=
await
this
.
orderInfoDao
.
findOne
({
order_num
:
orderNum
});
if
(
!
orderinfo
)
{
return
system
.
getResultFail
(
-
101
,
"orderinfo is empty"
);
}
var
orderProduct
=
await
this
.
orderProductDao
.
findOne
({
order_num
:
orderNum
});
if
(
!
orderProduct
)
{
return
system
.
getResultFail
(
-
101
,
"orderProduct is empty"
);
}
if
(
orderProduct
.
status
==
300
)
{
return
system
.
getResultSuccess
();
}
if
(
orderProduct
.
status
==
320
)
{
return
system
.
getResultFail
(
-
301
,
"订单状态错误"
);
}
var
o
=
{
"version"
:
"1.0"
,
"caller"
:
"trade"
,
"componentName"
:
"trade"
,
"eventId"
:
"5b2b14b118121"
,
"timestamp"
:
Date
.
now
(),
"interface"
:
{
"interfaceName"
:
"save"
,
"para"
:
{
"msgType"
:
"dealDeliveryCallback"
,
"msgContent"
:
{
"type"
:
orderProduct
.
tx_order_snapshot
.
goodsDetail
.
goodsSubType
,
"dealName"
:
orderNum
,
"deliveryResult"
:
0
,
"resourceIds"
:
[
orderNum
]
}
}
}
}
var
r
=
await
this
.
execPostByTimeOut
(
req
,
o
,
"http://msgqueue.sandbox.com"
);
return
system
.
getResultSuccess
();
}
}
module
.
exports
=
OrderDeliveryService
;
...
...
brg-user-center/app/base/service/impl/order/orderInfoSve.js
View file @
49d313aa
...
...
@@ -267,9 +267,9 @@ class OrderInfoService extends ServiceBase {
if
(
!
ispush
)
{
return
system
.
getResultSuccess
();
}
txorderdetail
.
goodsDetail
.
formInfo
.
buyTime
=
new
Date
(
txorderdetail
.
payEndTime
);
txorderdetail
.
goodsDetail
.
formInfo
.
timeSpan
=
1
;
txorderdetail
.
goodsDetail
.
formInfo
.
timeUnit
=
"y"
;
txorderdetail
.
goodsDetail
.
formInfo
.
buyTime
=
new
Date
(
txorderdetail
.
payEndTime
);
txorderdetail
.
goodsDetail
.
formInfo
.
timeSpan
=
1
;
txorderdetail
.
goodsDetail
.
formInfo
.
timeUnit
=
"y"
;
//生产者------订单推送
var
pushobj
=
{
"actionType"
:
"produceData"
,
// Y 功能名称
...
...
@@ -847,9 +847,12 @@ class OrderInfoService extends ServiceBase {
if
(
!
orderProduct
)
{
return
system
.
getResultFail
(
-
101
,
"orderProduct is empty"
);
}
if
(
orderProduct
.
status
==
320
)
{
if
(
orderProduct
.
status
==
320
)
{
return
system
.
getResultSuccess
();
}
if
(
orderProduct
.
status
==
300
)
{
return
system
.
getResultFail
(
-
301
,
"订单状态错误"
);
}
var
productType
=
"p_business_registration"
;
if
(
orderProduct
.
dataValues
.
product_type
.
indexOf
(
"/qcfw/"
)
>
-
1
)
{
productType
=
"p_vat"
;
...
...
@@ -868,12 +871,13 @@ class OrderInfoService extends ServiceBase {
"msgContent"
:
{
"type"
:
orderProduct
.
tx_order_snapshot
.
goodsDetail
.
goodsSubType
,
"dealName"
:
pobj
.
orderNum
,
"deliveryResult"
:
3
"deliveryResult"
:
3
,
"resourceIds"
:
[
pobj
.
orderNum
]
}
}
}
}
var
r
=
await
this
.
execPostByTimeOut
(
req
,
o
,
"http://msgqueue.sandbox.com"
);
var
r
=
await
this
.
execPostByTimeOut
(
req
,
o
,
"http://msgqueue.sandbox.com"
);
if
(
r
.
status
<
1
)
{
return
system
.
getResultFail
(
-
102
,
"Post error"
);
}
...
...
brg-user-center/app/config/platform.js
View file @
49d313aa
...
...
@@ -4,7 +4,7 @@ module.exports = {
push_return_type
:
{
"0"
:
"推送失败"
,
"1"
:
"推送成功"
},
pay_type
:{
"1"
:
"微信"
,
"2"
:
"qq钱包"
,
"3"
:
"网银支付"
,
"4"
:
"余额支付"
},
order_op_type
:{
"1"
:
"收"
,
"2"
:
"支"
},
order_status
:{
"0"
:
"待付款"
,
"1"
:
"已付款"
,
"310"
:
"部分已退款"
,
"320"
:
"已退款"
,
"330"
:
"已作废"
},
order_status
:{
"0"
:
"待付款"
,
"1"
:
"已付款"
,
"310"
:
"部分已退款"
,
"320"
:
"已退款"
,
"330"
:
"已作废"
,
"300"
:
"已完成"
},
order_delivery_status
:{
"1"
:
"待接单"
,
"20"
:
"已接单"
,
...
...
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