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
46fd01aa
Commit
46fd01aa
authored
Jul 01, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
bfab015a
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
217 additions
and
37 deletions
+217
-37
esign-sve-order/app/base/db/impl/eorder/eorderDao.js
+3
-0
esign-sve-order/app/base/db/impl/eorder/eorderauthlogDao.js
+32
-1
esign-sve-order/app/base/db/impl/eorder/eorderproductDao.js
+1
-1
esign-sve-order/app/base/db/impl/eorder/eordersignlogDao.js
+32
-1
esign-sve-order/app/base/service/impl/eorder/eorderSve.js
+106
-19
esign-sve-order/app/base/service/impl/eorder/eorderauthlogSve.js
+6
-4
esign-sve-order/app/base/service/impl/eorder/eorderproductSve.js
+28
-7
esign-sve-order/app/base/service/impl/eorder/eordersignlogSve.js
+6
-4
package-lock.json
+3
-0
No files found.
esign-sve-order/app/base/db/impl/eorder/eorderDao.js
View file @
46fd01aa
...
...
@@ -28,6 +28,9 @@ class EorderDao extends Dao{
if
(
params
.
merchant_id
){
sql
.
push
(
'and merchant_id=:merchant_id'
);
}
if
(
params
.
merchant_name
){
sql
.
push
(
'and merchant_name=:merchant_name'
);
}
if
(
params
.
sign_id
){
sql
.
push
(
'and sign_id=:sign_id'
);
}
...
...
esign-sve-order/app/base/db/impl/eorder/eorderauthlogDao.js
View file @
46fd01aa
...
...
@@ -47,12 +47,43 @@ class EorderauthlogDao extends Dao{
async
pageEorderAuthLog
(
params
){
let
sql
=
[];
sql
.
push
(
'SELECT * FROM e_order_auth_log WHERE 1 = 1 '
);
this
.
setEorderParams
(
sql
,
params
);
this
.
setEorder
AuthLog
Params
(
sql
,
params
);
sql
.
push
(
"ORDER BY spended_at DESC"
);
sql
.
push
(
"LIMIT :startRow, :pageSize"
);
let
list
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
return
list
||
[];
}
/**
* fn:创建对象
* ps:为了防止 签约日志和身份日志 id 出现重复
* @param u
* @returns {Promise<*>}
*/
async
preCreate
(
u
)
{
if
(
!
u
.
id
&&
!
u
.
autoIncrement
)
{
u
.
id
=
await
this
.
redisClient
.
genrateId
(
`EorderLog`
);
}
return
u
;
}
async
create
(
u
,
t
)
{
var
u2
=
await
this
.
preCreate
(
u
);
if
(
t
)
{
return
this
.
model
.
create
(
u2
,
{
transaction
:
t
}).
then
(
u
=>
{
return
u
;
});
}
else
{
return
this
.
model
.
create
(
u2
,
{
transaction
:
t
}).
then
(
u
=>
{
return
u
;
});
}
}
}
module
.
exports
=
EorderauthlogDao
;
esign-sve-order/app/base/db/impl/eorder/eorderproductDao.js
View file @
46fd01aa
...
...
@@ -52,7 +52,7 @@ class EorderproductDao extends Dao{
async
findAllByOrderIdCreatedAsc
(
params
){
let
sql
=
[];
sql
.
push
(
`SELECT t1.order_id,t1.product_id FROM e_order_product t1 INNER JOIN e_order t2 ON t1.order_id = t2.id where 1=1 and t2.live_status ='20'`
);
sql
.
push
(
`
t1.product_id =:produc
t_id`
);
sql
.
push
(
`
and t1.product_id =:product_id and t2.merchant_id=:merchan
t_id`
);
sql
.
push
(
`ORDER BY t2.created_at ASC`
);
let
list
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
return
list
;
...
...
esign-sve-order/app/base/db/impl/eorder/eordersignlogDao.js
View file @
46fd01aa
...
...
@@ -3,6 +3,7 @@ const Dao=require("../../dao.base");
class
EordersignlogDao
extends
Dao
{
constructor
(){
super
(
Dao
.
getModelName
(
EordersignlogDao
));
}
/**
...
...
@@ -44,12 +45,42 @@ class EordersignlogDao extends Dao{
async
pageEorderSignLog
(
params
){
let
sql
=
[];
sql
.
push
(
'SELECT * FROM e_order_sign_log WHERE 1 = 1 '
);
this
.
setEorderParams
(
sql
,
params
);
this
.
setEorder
SignLog
Params
(
sql
,
params
);
sql
.
push
(
"ORDER BY spended_at DESC"
);
sql
.
push
(
"LIMIT :startRow, :pageSize"
);
let
list
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
return
list
||
[];
}
/**
* fn:创建对象
* ps:为了防止 签约日志和身份日志 id 出现重复
* @param u
* @returns {Promise<*>}
*/
async
preCreate
(
u
)
{
if
(
!
u
.
id
&&
!
u
.
autoIncrement
)
{
u
.
id
=
await
this
.
redisClient
.
genrateId
(
`EorderLog`
);
}
return
u
;
}
async
create
(
u
,
t
)
{
var
u2
=
await
this
.
preCreate
(
u
);
if
(
t
)
{
return
this
.
model
.
create
(
u2
,
{
transaction
:
t
}).
then
(
u
=>
{
return
u
;
});
}
else
{
return
this
.
model
.
create
(
u2
,
{
transaction
:
t
}).
then
(
u
=>
{
return
u
;
});
}
}
}
module
.
exports
=
EordersignlogDao
;
esign-sve-order/app/base/service/impl/eorder/eorderSve.js
View file @
46fd01aa
...
...
@@ -5,6 +5,8 @@ class EorderService extends ServiceBase {
constructor
()
{
super
(
"eorder"
,
ServiceBase
.
getDaoName
(
EorderService
));
this
.
eorderproductDao
=
system
.
getObject
(
"db.eorder.eorderproductDao"
);
this
.
eordersignlogDao
=
system
.
getObject
(
"db.eorder.eordersignlogDao"
);
this
.
eorderauthlogDao
=
system
.
getObject
(
"db.eorder.eorderauthlogDao"
);
this
.
GROUP_PRODUCT_TYPE
=
"2"
;
this
.
SIGNLE_PRODUCT_TYPE
=
"1"
;
this
.
AUDIT_STATUS
=
[
'10'
,
'20'
,
'30'
];
...
...
@@ -52,7 +54,8 @@ class EorderService extends ServiceBase {
params
.
product_specifications
=
Number
(
params
.
product_specifications
||
0
);
params
.
audit_status
=
"10"
;
params
.
live_status
=
"10"
;
params
.
pay_status
=
"10"
;
params
.
pay_status
=
"20"
;
params
.
pay_date
=
new
Date
();
console
.
log
(
`eorderSve->saveEorder->params`
+
JSON
.
stringify
(
params
));
try
{
if
(
params
.
id
){
//更新新操作
...
...
@@ -118,7 +121,7 @@ class EorderService extends ServiceBase {
let
orderBean
=
null
;
await
this
.
db
.
transaction
(
async
t
=>
{
orderBean
=
await
this
.
dao
.
create
(
params
,
t
);
if
(
params
.
product_ids
||
params
.
product_ids
.
length
>
0
){
if
(
params
.
product_ids
&&
params
.
product_ids
.
length
>
0
){
let
ids
=
Array
.
from
(
new
Set
(
params
.
product_ids
));
let
eorderProductProperties
=
[];
for
(
let
item
of
ids
){
...
...
@@ -157,8 +160,11 @@ class EorderService extends ServiceBase {
if
(
!
orderBean
){
return
system
.
getResult
(
null
,
`订单【
${
params
.
id
}
】不存在`
);
}
if
(
params
.
merchant_id
&&
this
.
trim
(
params
.
merchant_id
)
!=
orderBean
.
merchant_id
){
return
system
.
getResult
(
null
,
`参数错误 订单【
${
params
.
id
}
】不存在`
);
// if(params.merchant_id && this.trim(params.merchant_id)!=orderBean.merchant_id){
// return system.getResult(null, `参数错误 订单【${params.id}】不存在`);
// }
if
(
orderBean
.
pay_status
!=
'20'
){
return
system
.
getResult
(
null
,
`订单【
${
params
.
id
}
】未支付`
);
}
try
{
...
...
@@ -182,13 +188,13 @@ class EorderService extends ServiceBase {
return
system
.
getResult
(
null
,
`参数错误 订单ID 不能为空`
);
}
try
{
let
orderBean
=
await
this
.
dao
.
model
.
findOne
(
this
.
trim
(
params
.
id
)
);
let
orderBean
=
await
this
.
dao
.
model
.
findOne
(
{
id
:
this
.
trim
(
params
.
id
)}
);
if
(
!
orderBean
){
return
system
.
getResult
(
null
,
`订单【
${
params
.
id
}
】不存在`
);
}
if
(
params
.
merchant_id
&&
this
.
trim
(
params
.
merchant_id
)
!=
orderBean
.
merchant_id
){
return
system
.
getResult
(
null
,
`参数错误 订单【
${
params
.
id
}
】不存在`
);
}
//
if(params.merchant_id && this.trim(params.merchant_id)!=orderBean.merchant_id){
//
return system.getResult(null, `参数错误 订单【${params.id}】不存在`);
//
}
//如果支付状态
if
(
params
.
pay_status
&&
orderBean
.
pay_status
==
'10'
&&
this
.
PAY_STATUS
.
includes
(
this
.
trim
(
params
.
pay_status
)))
{
orderBean
.
pay_status
=
this
.
trim
(
params
.
pay_status
);
...
...
@@ -208,7 +214,7 @@ class EorderService extends ServiceBase {
await
orderBean
.
save
();
return
system
.
getResult
(
orderBean
);
}
return
system
.
getResult
(
null
,
`更新
状态异常
`
);
return
system
.
getResult
(
null
,
`更新
失败
`
);
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
`系统错误`
);
...
...
@@ -231,16 +237,46 @@ class EorderService extends ServiceBase {
if
(
params
.
merchant_id
&&
this
.
trim
(
params
.
merchant_id
)
!=
orderBean
.
merchant_id
){
return
system
.
getResult
(
null
,
`参数错误 订单【
${
params
.
id
}
】不存在`
);
}
try
{
let
productIds
=
await
this
.
eorderproductDao
.
model
.
findAll
({
where
:{
order_id
:
orderBean
.
id
},
attributes
:[
'product_id'
]
});
orderBean
.
productIds
=
productIds
;
this
.
handleDate
(
orderBean
,
[
'created_at'
,
'pay_date'
,
'audit_date'
,
'live_start'
,
'live_end'
],
null
,
null
);
orderBean
.
product_type_name
=
orderBean
.
product_type
==
'1'
?
'单产品'
:
'组合产品'
;
orderBean
.
product_specifications_unit
=
orderBean
.
product_type
==
'1'
?
'份'
:
'元'
;
this
.
formatStatus
(
orderBean
);
//格式化认证日志
let
listEorderAuthLog
=
await
this
.
eorderauthlogDao
.
model
.
findAll
({
where
:{
order_id
:
orderBean
.
id
},
order
:[[
'spended_at'
,
'DESC'
]]
});
for
(
let
itemOfauth
of
listEorderAuthLog
)
{
this
.
handleDate
(
itemOfauth
.
dataValues
,
[
'spended_at'
,
'created_at'
],
null
,
null
,);
}
orderBean
.
eorderauthlog
=
listEorderAuthLog
;
let
productIds
=
await
this
.
eorderproductDao
.
model
.
findAll
({
where
:{
order_id
:
orderBean
.
id
},
attributes
:[
'product_id'
]
});
orderBean
.
productIds
=
productIds
;
this
.
handleDate
(
orderBean
,
[
'created_at'
,
'pay_date'
,
'audit_date'
],
null
,
null
);
return
system
.
getResult
(
orderBean
);
//格式化签约日志
let
listEorderSignLog
=
await
this
.
eordersignlogDao
.
model
.
findAll
({
where
:{
order_id
:
orderBean
.
id
},
order
:[[
'spended_at'
,
'DESC'
]]
});
for
(
let
itemOfsign
of
listEorderSignLog
)
{
this
.
handleDate
(
itemOfsign
.
dataValues
,
[
'spended_at'
,
'created_at'
],
null
,
null
,);
}
orderBean
.
eordersignlog
=
listEorderSignLog
;
return
system
.
getResult
(
orderBean
);
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
/**
...
...
@@ -259,7 +295,10 @@ class EorderService extends ServiceBase {
}
let
list
=
await
this
.
dao
.
pageEorder
(
params
);
for
(
let
item
of
list
)
{
this
.
handleDate
(
item
,
[
'created_at'
,
'pay_date'
,
'audit_date'
],
null
,
null
);
this
.
handleDate
(
item
,
[
'created_at'
,
'pay_date'
,
'audit_date'
,
'live_start'
,
'live_end'
],
null
,
null
);
item
.
product_type_name
=
item
.
product_type
==
'1'
?
'单产品'
:
'组合产品'
;
item
.
product_specifications_unit
=
item
.
product_type
==
'1'
?
`
${
item
.
product_unit_price
}
元/份`
:
'分开计价'
;
this
.
formatStatus
(
item
);
}
let
orderIds
=
[];
for
(
let
ele
of
list
){
...
...
@@ -285,6 +324,53 @@ class EorderService extends ServiceBase {
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
/**
* fn:格式化订单状态
* @param params
*/
formatStatus
(
params
){
if
(
!
params
){
return
;}
if
(
params
.
pay_status
){
if
(
params
.
pay_status
==
'10'
){
params
.
pay_status_name
=
'待付款'
;
}
else
if
(
params
.
pay_status
==
'20'
){
params
.
pay_status_name
=
'已付款'
;
}
else
if
(
params
.
pay_status
==
'30'
){
params
.
pay_status_name
=
'付款失败'
;
}
else
{
params
.
pay_status_name
=
''
;
}
}
if
(
params
.
audit_status
){
if
(
params
.
audit_status
==
'10'
){
params
.
audit_status_name
=
'待审核'
;
}
else
if
(
params
.
audit_status
==
'20'
){
params
.
audit_status_name
=
'审核成功'
;
}
else
if
(
params
.
audit_status
==
'30'
){
params
.
audit_status_name
=
'审核失败'
;
}
else
{
params
.
audit_status_name
=
''
;
}
}
if
(
params
.
live_status
){
if
(
params
.
live_status
==
'10'
){
params
.
live_status_name
=
'待生效'
;
}
else
if
(
params
.
live_status
==
'20'
){
params
.
live_status_name
=
'已生效'
;
}
else
if
(
params
.
live_status
==
'30'
){
params
.
live_status_name
=
'已终止'
;
}
else
{
params
.
live_status_name
=
''
;
}
}
}
}
module
.
exports
=
EorderService
;
\ No newline at end of file
esign-sve-order/app/base/service/impl/eorder/eorderauthlogSve.js
View file @
46fd01aa
...
...
@@ -32,9 +32,9 @@ class EorderauthlogService extends ServiceBase {
params
.
spended_num
=
Number
(
params
.
spended_num
||
0
);
params
.
spended_at
=
params
.
spended_at
?
params
.
spended_at
:
new
Date
();
try
{
let
orderBean
=
await
this
.
eorderDao
.
dao
.
model
.
findOne
({
let
orderBean
=
await
this
.
eorderDao
.
model
.
findOne
({
where
:{
order_
id
:
this
.
trim
(
params
.
order_id
)
id
:
this
.
trim
(
params
.
order_id
)
}
});
if
(
!
orderBean
){
...
...
@@ -42,6 +42,7 @@ class EorderauthlogService extends ServiceBase {
}
params
.
merchant_id
=
orderBean
.
merchant_id
;
await
this
.
dao
.
create
(
params
);
return
system
.
getResultSuccess
();
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
`系统错误`
);
...
...
@@ -61,14 +62,15 @@ class EorderauthlogService extends ServiceBase {
try
{
let
countRes
=
await
this
.
dao
.
countEorderAuthLog
(
params
);
if
(
countRes
.
eorderauthlogCount
==
0
){
return
system
.
getResult
({
count
:
0
,
row
:
[]});
return
system
.
getResult
({
count
:
0
,
row
s
:
[]});
}
let
list
=
await
this
.
dao
.
pageEorderAuthLog
(
params
);
if
(
!
list
||
list
.
length
==
0
){
return
system
.
getResult
({
count
:
0
,
row
:
[]});
return
system
.
getResult
({
count
:
0
,
row
s
:
[]});
}
for
(
let
item
of
list
)
{
this
.
handleDate
(
item
,[
'spended_at'
,
'created_at'
],
null
,
null
)
item
.
pass_name
=
item
.
pass
==
0
?
'未通过'
:
'已通过'
;
}
return
system
.
getResult
({
count
:
countRes
.
eorderauthlogCount
,
rows
:
list
});
}
catch
(
e
)
{
...
...
esign-sve-order/app/base/service/impl/eorder/eorderproductSve.js
View file @
46fd01aa
...
...
@@ -4,7 +4,7 @@ const ServiceBase = require("../../sve.base")
class
EorderproductService
extends
ServiceBase
{
constructor
()
{
super
(
"eorder"
,
ServiceBase
.
getDaoName
(
EorderproductService
));
// this.accounttradeDao = system.getObject("db.account.accounttrade
Dao");
this
.
eorderDao
=
system
.
getObject
(
"db.eorder.eorder
Dao"
);
}
/**
...
...
@@ -17,7 +17,7 @@ class EorderproductService extends ServiceBase {
if
(
!
params
.
product_id
){
return
system
.
getResult
(
null
,
`参数错误 产品ID不能为空`
);
}
let
list
=
await
this
.
dao
.
model
.
findAllByOrderIdCreatedAsc
({
product_id
:
this
.
trim
(
params
.
produc
t_id
)});
let
list
=
await
this
.
dao
.
findAllByOrderIdCreatedAsc
({
product_id
:
this
.
trim
(
params
.
product_id
),
merchant_id
:
this
.
trim
(
params
.
merchan
t_id
)});
return
system
.
getResult
(
list
||
[]);
}
catch
(
e
)
{
console
.
log
(
e
);
...
...
@@ -31,16 +31,37 @@ class EorderproductService extends ServiceBase {
* @returns {Promise<void>}
*/
async
listEorderProductByMerchantId
(
params
){
// if(!params.merchant_id){
// return system.getResult(null, `参数错误 商户ID 不能为空`);
// }
if
(
!
params
.
merchant_id
){
return
system
.
getResult
(
null
,
`参数错误 商户ID 不能为空`
);
}
let
p_list
=
await
this
.
eorderDao
.
model
.
findAll
({
where
:{
merchant_id
:
this
.
trim
(
params
.
merchant_id
)
},
attributes
:[
'id'
]
});
let
ids
=
[];
if
(
!
p_list
||
p_list
.
length
==
0
){
return
system
.
getResult
([]);
}
else
{
for
(
let
item
of
p_list
)
{
ids
.
push
(
item
.
id
);
}
}
let
list
=
await
this
.
dao
.
model
.
findAll
({
where
:{
merchant_id
:
this
.
trim
(
params
.
merchant
)
order_id
:{
[
this
.
db
.
Op
.
in
]:
ids
}
},
attributes
:[
'product_id'
]
});
return
system
.
getResult
(
list
);
let
productIds
=
[];
for
(
let
ele
of
list
)
{
productIds
.
push
(
ele
.
product_id
);
}
return
system
.
getResult
(
Array
.
from
(
new
Set
(
productIds
)));
}
}
...
...
esign-sve-order/app/base/service/impl/eorder/eordersignlogSve.js
View file @
46fd01aa
...
...
@@ -35,15 +35,17 @@ class EordersignlogService extends ServiceBase {
return
system
.
getResult
(
null
,
`参数错误 平台名称不能为空`
);
}
try
{
let
orderBean
=
await
this
.
eorderDao
.
dao
.
model
.
findOne
({
let
orderBean
=
await
this
.
eorderDao
.
model
.
findOne
({
where
:{
order_
id
:
this
.
trim
(
params
.
order_id
)
id
:
this
.
trim
(
params
.
order_id
)
}
});
if
(
!
orderBean
){
return
system
.
getResult
(
null
,
`订单【
${
params
.
order_id
}
】不存在`
);
}
params
.
merchant_id
=
orderBean
.
merchant_id
;
await
this
.
dao
.
create
(
params
);
return
system
.
getResultSuccess
();
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
`系统错误`
);
...
...
@@ -63,11 +65,11 @@ class EordersignlogService extends ServiceBase {
try
{
let
countRes
=
await
this
.
dao
.
countEorderSignLog
(
params
);
if
(
countRes
.
eordersignlogCount
==
0
){
return
system
.
getResult
({
count
:
0
,
row
:
[]});
return
system
.
getResult
({
count
:
0
,
row
s
:
[]});
}
let
list
=
await
this
.
dao
.
pageEorderSignLog
(
params
);
if
(
!
list
||
list
.
length
==
0
){
return
system
.
getResult
({
count
:
0
,
row
:
[]});
return
system
.
getResult
({
count
:
0
,
row
s
:
[]});
}
for
(
let
item
of
list
)
{
this
.
handleDate
(
item
,[
'spended_at'
,
'created_at'
],
null
,
null
)
...
...
package-lock.json
0 → 100644
View file @
46fd01aa
{
"lockfileVersion"
:
1
}
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