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
a2290504
Commit
a2290504
authored
Jul 03, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
03bd68df
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
26 deletions
+41
-26
esign-sve-order/app/base/db/impl/eorder/eordersignlogDao.js
+1
-1
esign-sve-order/app/base/db/models/eorder/eorder.js
+0
-1
esign-sve-order/app/base/db/models/eorder/eorderproduct.js
+2
-0
esign-sve-order/app/base/service/impl/eorder/eorderSve.js
+38
-24
No files found.
esign-sve-order/app/base/db/impl/eorder/eordersignlogDao.js
View file @
a2290504
...
@@ -110,7 +110,7 @@ class EordersignlogDao extends Dao{
...
@@ -110,7 +110,7 @@ class EordersignlogDao extends Dao{
async
PageeordersignlogContract
(
params
){
async
PageeordersignlogContract
(
params
){
let
sql
=
[];
let
sql
=
[];
sql
.
push
(
`SELECT t1.engine_contract_id,t1.engine_contract_name,t1.created_at,t2.live_start,t2.live_end,t2.merchant_name,t1.order_id `
);
sql
.
push
(
`SELECT t1.engine_contract_id,t1.engine_contract_name,t1.created_at,t2.live_start,t2.live_end,t2.merchant_name,t1.order_id
,t2.contract_url
`
);
sql
.
push
(
`FROM e_order_sign_log t1 inner join e_order t2 on t2.id =t1.order_id WHERE 1 = 1 `
)
sql
.
push
(
`FROM e_order_sign_log t1 inner join e_order t2 on t2.id =t1.order_id WHERE 1 = 1 `
)
this
.
setpageEorderContractParams
(
sql
,
params
);
this
.
setpageEorderContractParams
(
sql
,
params
);
sql
.
push
(
"ORDER BY t1.created_at DESC"
);
sql
.
push
(
"ORDER BY t1.created_at DESC"
);
...
...
esign-sve-order/app/base/db/models/eorder/eorder.js
View file @
a2290504
...
@@ -12,7 +12,6 @@ module.exports = function (db, DataTypes) {
...
@@ -12,7 +12,6 @@ module.exports = function (db, DataTypes) {
product_type
:
{
type
:
DataTypes
.
STRING
,
field
:
'product_type'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'产品类型'
},
product_type
:
{
type
:
DataTypes
.
STRING
,
field
:
'product_type'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'产品类型'
},
product_unit_price
:{
type
:
DataTypes
.
STRING
,
field
:
'product_unit_price'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'产品单价'
},
product_unit_price
:{
type
:
DataTypes
.
STRING
,
field
:
'product_unit_price'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'产品单价'
},
product_desc
:{
type
:
DataTypes
.
STRING
,
field
:
'product_desc'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'产品描述'
},
product_desc
:{
type
:
DataTypes
.
STRING
,
field
:
'product_desc'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'产品描述'
},
price
:
{
type
:
DataTypes
.
BIGINT
,
field
:
'price'
,
allowNull
:
true
,
defaultValue
:
0
,
comment
:
'订单价格'
},
product_specifications
:
{
type
:
DataTypes
.
INTEGER
,
field
:
'product_specifications'
,
allowNull
:
true
,
defaultValue
:
0
,
comment
:
'产品规格数量'
},
product_specifications
:
{
type
:
DataTypes
.
INTEGER
,
field
:
'product_specifications'
,
allowNull
:
true
,
defaultValue
:
0
,
comment
:
'产品规格数量'
},
contract_url
:
{
type
:
DataTypes
.
STRING
,
field
:
'contract_url'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'合同Url'
},
contract_url
:
{
type
:
DataTypes
.
STRING
,
field
:
'contract_url'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'合同Url'
},
live_start
:
{
type
:
DataTypes
.
DATE
,
field
:
'live_start'
,
allowNull
:
true
,
defaultValue
:
null
,
comment
:
'生效时间'
},
live_start
:
{
type
:
DataTypes
.
DATE
,
field
:
'live_start'
,
allowNull
:
true
,
defaultValue
:
null
,
comment
:
'生效时间'
},
...
...
esign-sve-order/app/base/db/models/eorder/eorderproduct.js
View file @
a2290504
...
@@ -6,6 +6,8 @@ module.exports = function (db, DataTypes) {
...
@@ -6,6 +6,8 @@ module.exports = function (db, DataTypes) {
return
db
.
define
(
'eorderproduct'
,
{
return
db
.
define
(
'eorderproduct'
,
{
order_id
:
{
type
:
DataTypes
.
STRING
,
field
:
'order_id'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'订单号'
},
order_id
:
{
type
:
DataTypes
.
STRING
,
field
:
'order_id'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'订单号'
},
product_id
:
{
type
:
DataTypes
.
STRING
,
field
:
'product_id'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'产品id'
},
product_id
:
{
type
:
DataTypes
.
STRING
,
field
:
'product_id'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'产品id'
},
price
:
{
type
:
DataTypes
.
BIGINT
,
field
:
'price'
,
allowNull
:
true
,
defaultValue
:
0
,
comment
:
'订单价格'
},
product_name
:
{
type
:
DataTypes
.
STRING
,
field
:
'product_name'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'产品名称'
},
created_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'created_at'
,
allowNull
:
false
},
created_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'created_at'
,
allowNull
:
false
},
updated_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'updated_at'
,
allowNull
:
false
},
updated_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'updated_at'
,
allowNull
:
false
},
deleted_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'deleted_at'
,
allowNull
:
true
},
deleted_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'deleted_at'
,
allowNull
:
true
},
...
...
esign-sve-order/app/base/service/impl/eorder/eorderSve.js
View file @
a2290504
...
@@ -76,9 +76,9 @@ class EorderService extends ServiceBase {
...
@@ -76,9 +76,9 @@ class EorderService extends ServiceBase {
_orderBeanProperties
.
product_type
=
params
.
product_type
?
params
.
product_type
:
_orderBean
.
product_type
;
_orderBeanProperties
.
product_type
=
params
.
product_type
?
params
.
product_type
:
_orderBean
.
product_type
;
_orderBeanProperties
.
product_unit_price
=
params
.
product_unit_price
?
params
.
product_unit_price
:
_orderBean
.
product_unit_price
;
_orderBeanProperties
.
product_unit_price
=
params
.
product_unit_price
?
params
.
product_unit_price
:
_orderBean
.
product_unit_price
;
_orderBeanProperties
.
product_desc
=
params
.
product_desc
?
params
.
product_desc
:
_orderBean
.
product_desc
;
_orderBeanProperties
.
product_desc
=
params
.
product_desc
?
params
.
product_desc
:
_orderBean
.
product_desc
;
if
(
params
.
hasOwnProperty
(
'price'
)){
//
if(params.hasOwnProperty('price')){
_orderBeanProperties
.
price
=
Number
(
params
.
price
||
_orderBean
.
price
);
//
_orderBeanProperties.price = Number(params.price || _orderBean.price);
}
//
}
if
(
params
.
hasOwnProperty
(
'product_specifications'
)){
if
(
params
.
hasOwnProperty
(
'product_specifications'
)){
_orderBeanProperties
.
product_specifications
=
Number
(
params
.
product_specifications
||
_orderBean
.
product_specifications
);
_orderBeanProperties
.
product_specifications
=
Number
(
params
.
product_specifications
||
_orderBean
.
product_specifications
);
}
}
...
@@ -104,16 +104,26 @@ class EorderService extends ServiceBase {
...
@@ -104,16 +104,26 @@ class EorderService extends ServiceBase {
throw
new
Error
(
"更新订单失败"
);
throw
new
Error
(
"更新订单失败"
);
return
system
.
getResult
(
null
,
`系统错误 更新订单商品失败`
);
return
system
.
getResult
(
null
,
`系统错误 更新订单商品失败`
);
}
}
if
(
params
.
product_ids
&&
params
.
product_ids
.
length
>
0
){
if
(
params
.
product_arr
&&
params
.
product_arr
.
length
>
0
){
let
ids
=
Array
.
from
(
new
Set
(
params
.
product_ids
));
// 去重开始
let
productItemMap
=
{};
for
(
let
item
of
params
.
product_arr
)
{
productItemMap
[
item
.
id
]
=
item
}
//去重结束
let
eorderProductProperties
=
[];
let
eorderProductProperties
=
[];
for
(
let
item
of
ids
){
for
(
let
key
in
productItemMap
){
eorderProductProperties
.
push
({
order_id
:
_orderBean
.
id
,
product_id
:
item
});
eorderProductProperties
.
push
({
order_id
:
_orderBean
.
id
,
product_id
:
productItemMap
[
key
].
id
,
product_name
:
productItemMap
[
key
].
product_name
,
price
:
productItemMap
[
key
].
price
});
}
}
_orderBeanProperties
.
eorderProducts
=
eorderProductProperties
;
_orderBeanProperties
.
eorderProducts
=
eorderProductProperties
;
await
this
.
eorderproductDao
.
bulkCreate
(
eorderProductProperties
,
t
);
await
this
.
eorderproductDao
.
bulkCreate
(
eorderProductProperties
,
t
);
}
else
{
}
else
{
await
this
.
eorderproductDao
.
create
({
order_id
:
_orderBean
.
id
,
product_id
:
this
.
trim
(
params
.
product_id
)},
t
);
await
this
.
eorderproductDao
.
create
({
order_id
:
_orderBean
.
id
,
product_id
:
this
.
trim
(
params
.
product_id
)
,
price
:
this
.
trim
(
params
.
product_unit_price
)
},
t
);
}
}
});
});
return
system
.
getResult
(
_orderBeanProperties
);
return
system
.
getResult
(
_orderBeanProperties
);
...
@@ -121,15 +131,25 @@ class EorderService extends ServiceBase {
...
@@ -121,15 +131,25 @@ class EorderService extends ServiceBase {
let
orderBean
=
null
;
let
orderBean
=
null
;
await
this
.
db
.
transaction
(
async
t
=>
{
await
this
.
db
.
transaction
(
async
t
=>
{
orderBean
=
await
this
.
dao
.
create
(
params
,
t
);
orderBean
=
await
this
.
dao
.
create
(
params
,
t
);
if
(
params
.
product_ids
&&
params
.
product_ids
.
length
>
0
){
if
(
params
.
product_arr
&&
params
.
product_arr
.
length
>
0
){
let
ids
=
Array
.
from
(
new
Set
(
params
.
product_ids
));
// 去重开始
let
productItemMap
=
{};
for
(
let
item
of
params
.
product_arr
)
{
productItemMap
[
item
.
id
]
=
item
;
}
//去重结束
let
eorderProductProperties
=
[];
let
eorderProductProperties
=
[];
for
(
let
item
of
ids
){
for
(
let
key
in
productItemMap
){
eorderProductProperties
.
push
({
order_id
:
orderBean
.
id
,
product_id
:
item
});
eorderProductProperties
.
push
({
order_id
:
orderBean
.
id
,
product_id
:
productItemMap
[
key
].
id
,
product_name
:
productItemMap
[
key
].
product_name
,
price
:
productItemMap
[
key
].
price
});
}
}
await
this
.
eorderproductDao
.
bulkCreate
(
eorderProductProperties
,
t
);
await
this
.
eorderproductDao
.
bulkCreate
(
eorderProductProperties
,
t
);
}
else
{
}
else
{
await
this
.
eorderproductDao
.
create
({
order_id
:
orderBean
.
id
,
product_id
:
this
.
trim
(
params
.
product_id
)},
t
);
await
this
.
eorderproductDao
.
create
({
order_id
:
orderBean
.
id
,
product_id
:
this
.
trim
(
params
.
product_id
)
,
price
:
this
.
trim
(
params
.
product_unit_price
)
},
t
);
}
}
});
});
this
.
handleDate
(
orderBean
.
dataValues
,
[
'live_start'
,
'live_end'
,
'created_at'
],
null
,
null
);
this
.
handleDate
(
orderBean
.
dataValues
,
[
'live_start'
,
'live_end'
,
'created_at'
],
null
,
null
);
...
@@ -238,13 +258,14 @@ class EorderService extends ServiceBase {
...
@@ -238,13 +258,14 @@ class EorderService extends ServiceBase {
return
system
.
getResult
(
null
,
`参数错误 订单【
${
params
.
id
}
】不存在`
);
return
system
.
getResult
(
null
,
`参数错误 订单【
${
params
.
id
}
】不存在`
);
}
}
try
{
try
{
let
product
Ids
=
await
this
.
eorderproductDao
.
model
.
findAll
({
let
product
Children
=
await
this
.
eorderproductDao
.
model
.
findAll
({
where
:{
where
:{
order_id
:
orderBean
.
id
order_id
:
orderBean
.
id
},
},
attributes
:[
'product_id'
]
attributes
:[
'product_id'
,
'product_name'
,
'price'
,
'order_id'
]
});
});
orderBean
.
productIds
=
productIds
;
orderBean
.
productChildren
=
productChildren
;
this
.
handleDate
(
orderBean
,
[
'created_at'
,
'pay_date'
,
'audit_date'
,
'live_start'
,
'live_end'
],
null
,
null
);
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_type_name
=
orderBean
.
product_type
==
'1'
?
'单产品'
:
'组合产品'
;
orderBean
.
product_specifications_unit
=
orderBean
.
product_type
==
'1'
?
'份'
:
'元'
;
orderBean
.
product_specifications_unit
=
orderBean
.
product_type
==
'1'
?
'份'
:
'元'
;
...
@@ -279,6 +300,7 @@ class EorderService extends ServiceBase {
...
@@ -279,6 +300,7 @@ class EorderService extends ServiceBase {
}
}
}
}
/**
/**
* fn:订单查询(分页)
* fn:订单查询(分页)
* @param params
* @param params
...
@@ -398,12 +420,5 @@ class EorderService extends ServiceBase {
...
@@ -398,12 +420,5 @@ class EorderService extends ServiceBase {
return
system
.
getResult
(
null
,
`系统错误`
);
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
}
}
}
}
module
.
exports
=
EorderService
;
module
.
exports
=
EorderService
;
\ 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