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
7880bb54
Commit
7880bb54
authored
Jun 30, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
ebe3ecd8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
30 deletions
+38
-30
esign-sve-order/app/base/db/impl/eorder/eorderproductDao.js
+3
-2
esign-sve-order/app/base/db/models/eorder/eorder.js
+1
-1
esign-sve-order/app/base/service/impl/eorder/eorderSve.js
+22
-15
esign-sve-order/app/base/service/impl/eorder/eorderauthlogSve.js
+4
-4
esign-sve-order/app/base/service/impl/eorder/eorderproductSve.js
+4
-4
esign-sve-order/app/base/service/impl/eorder/eordersignlogSve.js
+4
-4
esign-sve-order/package-lock.json
+0
-0
No files found.
esign-sve-order/app/base/db/impl/eorder/eorderproductDao.js
View file @
7880bb54
...
@@ -23,7 +23,7 @@ class EorderproductDao extends Dao{
...
@@ -23,7 +23,7 @@ class EorderproductDao extends Dao{
if
(
params
.
order_id
){
if
(
params
.
order_id
){
sql
.
push
(
'and order_id = :order_id'
);
sql
.
push
(
'and order_id = :order_id'
);
}
}
if
(
params
.
order_ids
||
params
.
order_ids
.
length
!=
0
){
if
(
params
.
order_ids
&&
params
.
order_ids
.
length
!=
0
){
sql
.
push
(
'and order_id in (:order_ids)'
);
sql
.
push
(
'and order_id in (:order_ids)'
);
}
}
}
}
...
@@ -40,7 +40,8 @@ class EorderproductDao extends Dao{
...
@@ -40,7 +40,8 @@ class EorderproductDao extends Dao{
let
sql
=
[];
let
sql
=
[];
sql
.
push
(
'DELETE FROM e_order_product WHERE 1 = 1 '
);
sql
.
push
(
'DELETE FROM e_order_product WHERE 1 = 1 '
);
this
.
setEorderParams
(
sql
,
params
);
this
.
setEorderParams
(
sql
,
params
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
let
res
=
await
this
.
customUpdate
(
sql
.
join
(
" "
),
params
);
return
res
;
}
}
/**
/**
...
...
esign-sve-order/app/base/db/models/eorder/eorder.js
View file @
7880bb54
...
@@ -13,7 +13,7 @@ module.exports = function (db, DataTypes) {
...
@@ -13,7 +13,7 @@ module.exports = function (db, DataTypes) {
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
:
'订单价格'
},
price
:
{
type
:
DataTypes
.
BIGINT
,
field
:
'price'
,
allowNull
:
true
,
defaultValue
:
0
,
comment
:
'订单价格'
},
product_specifications
:
{
type
:
DataTypes
.
INTEGER
,
field
:
'pr
ice
'
,
allowNull
:
true
,
defaultValue
:
0
,
comment
:
'产品规格数量'
},
product_specifications
:
{
type
:
DataTypes
.
INTEGER
,
field
:
'pr
oduct_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
:
'生效时间'
},
live_end
:
{
type
:
DataTypes
.
DATE
,
field
:
'live_end'
,
allowNull
:
true
,
defaultValue
:
null
,
comment
:
'结束时间'
},
live_end
:
{
type
:
DataTypes
.
DATE
,
field
:
'live_end'
,
allowNull
:
true
,
defaultValue
:
null
,
comment
:
'结束时间'
},
...
...
esign-sve-order/app/base/service/impl/eorder/eorderSve.js
View file @
7880bb54
const
system
=
require
(
"../../../system"
);
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
)
const
ServiceBase
=
require
(
"../../sve.base"
)
class
EorderS
v
e
extends
ServiceBase
{
class
EorderS
ervic
e
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"eorder"
,
ServiceBase
.
getDaoName
(
EorderS
v
e
));
super
(
"eorder"
,
ServiceBase
.
getDaoName
(
EorderS
ervic
e
));
this
.
eorderproductDao
=
system
.
getObject
(
"db.eorder.eorderproductDao"
);
this
.
eorderproductDao
=
system
.
getObject
(
"db.eorder.eorderproductDao"
);
this
.
GROUP_PRODUCT_TYPE
=
"2"
;
this
.
GROUP_PRODUCT_TYPE
=
"2"
;
this
.
SIGNLE_PRODUCT_TYPE
=
"1"
;
this
.
SIGNLE_PRODUCT_TYPE
=
"1"
;
...
@@ -21,8 +21,8 @@ class EorderSve extends ServiceBase {
...
@@ -21,8 +21,8 @@ class EorderSve extends ServiceBase {
if
(
!
params
.
merchant_id
){
if
(
!
params
.
merchant_id
){
return
system
.
getResult
(
null
,
`参数错误 商户ID不能为空`
);
return
system
.
getResult
(
null
,
`参数错误 商户ID不能为空`
);
}
}
if
(
!
params
.
sign_id
){
if
(
!
params
.
merchant_name
){
return
system
.
getResult
(
null
,
`参数错误
签署ID
不能为空`
);
return
system
.
getResult
(
null
,
`参数错误
商户名称
不能为空`
);
}
}
if
((
!
params
.
product_ids
||
params
.
product_ids
.
length
==
0
)
&&
!
params
.
product_id
){
if
((
!
params
.
product_ids
||
params
.
product_ids
.
length
==
0
)
&&
!
params
.
product_id
){
return
system
.
getResult
(
null
,
`参数错误 产品ID列表不能为空`
);
return
system
.
getResult
(
null
,
`参数错误 产品ID列表不能为空`
);
...
@@ -56,12 +56,17 @@ class EorderSve extends ServiceBase {
...
@@ -56,12 +56,17 @@ class EorderSve extends ServiceBase {
console
.
log
(
`eorderSve->saveEorder->params`
+
JSON
.
stringify
(
params
));
console
.
log
(
`eorderSve->saveEorder->params`
+
JSON
.
stringify
(
params
));
try
{
try
{
if
(
params
.
id
){
//更新新操作
if
(
params
.
id
){
//更新新操作
let
_orderBean
=
await
this
.
dao
.
model
.
findOne
(
this
.
trim
(
params
.
id
));
let
_orderBean
=
await
this
.
dao
.
model
.
findOne
({
where
:{
id
:
this
.
trim
(
params
.
id
)
}
});
if
(
!
_orderBean
){
if
(
!
_orderBean
){
return
system
.
getResult
(
null
,
`订单【
${
params
.
id
}
】不存在`
);
return
system
.
getResult
(
null
,
`订单【
${
params
.
id
}
】不存在`
);
}
}
let
_orderBeanProperties
=
{
id
:
_orderBean
.
id
};
let
_orderBeanProperties
=
{
id
:
_orderBean
.
id
};
_orderBeanProperties
.
merchant_id
=
params
.
merchant_id
?
params
.
merchant_id
:
_orderBean
.
merchant_id
;
_orderBeanProperties
.
merchant_id
=
params
.
merchant_id
?
params
.
merchant_id
:
_orderBean
.
merchant_id
;
_orderBeanProperties
.
merchant_name
=
params
.
merchant_name
?
params
.
merchant_name
:
_orderBean
.
merchant_name
;
_orderBeanProperties
.
sign_id
=
params
.
sign_id
?
params
.
sign_id
:
_orderBean
.
sign_id
;
_orderBeanProperties
.
sign_id
=
params
.
sign_id
?
params
.
sign_id
:
_orderBean
.
sign_id
;
_orderBeanProperties
.
sign_name
=
params
.
sign_name
?
params
.
sign_name
:
_orderBean
.
sign_name
;
_orderBeanProperties
.
sign_name
=
params
.
sign_name
?
params
.
sign_name
:
_orderBean
.
sign_name
;
_orderBeanProperties
.
product_id
=
params
.
product_id
?
params
.
product_id
:
_orderBean
.
product_id
;
_orderBeanProperties
.
product_id
=
params
.
product_id
?
params
.
product_id
:
_orderBean
.
product_id
;
...
@@ -69,10 +74,10 @@ class EorderSve extends ServiceBase {
...
@@ -69,10 +74,10 @@ class EorderSve extends ServiceBase {
_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
||
0
);
_orderBeanProperties
.
price
=
Number
(
params
.
price
||
_orderBean
.
price
);
}
}
if
(
params
.
hasOwnProperty
(
'product_specifications'
)){
if
(
params
.
hasOwnProperty
(
'product_specifications'
)){
_orderBeanProperties
.
product_specifications
=
Number
(
params
.
product_specifications
||
0
);
_orderBeanProperties
.
product_specifications
=
Number
(
params
.
product_specifications
||
_orderBean
.
product_specifications
);
}
}
_orderBeanProperties
.
contract_url
=
params
.
contract_url
?
params
.
contract_url
:
_orderBean
.
contract_url
;
_orderBeanProperties
.
contract_url
=
params
.
contract_url
?
params
.
contract_url
:
_orderBean
.
contract_url
;
...
@@ -92,22 +97,23 @@ class EorderSve extends ServiceBase {
...
@@ -92,22 +97,23 @@ class EorderSve extends ServiceBase {
await
this
.
dao
.
update
(
_orderBeanProperties
,
t
);
await
this
.
dao
.
update
(
_orderBeanProperties
,
t
);
//首先删除 eorderproduct 表中所用指定order_id的所有记录
//首先删除 eorderproduct 表中所用指定order_id的所有记录
let
deleteRows
=
await
this
.
eorderproductDao
.
delete
({
order_id
:
_orderBean
.
id
});
let
deleteRows
=
await
this
.
eorderproductDao
.
delete
({
order_id
:
_orderBean
.
id
});
if
(
deleteRows
==
0
){
if
(
deleteRows
.
length
==
0
){
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_ids
&&
params
.
product_ids
.
length
>
0
){
let
ids
=
Array
.
from
(
new
Set
(
params
.
product_ids
));
let
ids
=
Array
.
from
(
new
Set
(
params
.
product_ids
));
let
eorderProductProperties
=
[];
let
eorderProductProperties
=
[];
for
(
let
item
of
ids
){
for
(
let
item
of
ids
){
eorderProductProperties
.
push
({
order_id
:
orderBean
.
id
,
product_id
:
item
});
eorderProductProperties
.
push
({
order_id
:
_
orderBean
.
id
,
product_id
:
item
});
}
}
await
this
.
eorderproductDao
.
model
.
bulkCreate
(
eorderProductProperties
,
t
);
_orderBeanProperties
.
eorderProducts
=
eorderProductProperties
;
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
)},
t
);
}
}
});
});
return
system
.
getResult
(
orderBean
);
return
system
.
getResult
(
_orderBeanProperties
);
}
else
{
//新增操作
}
else
{
//新增操作
let
orderBean
=
null
;
let
orderBean
=
null
;
await
this
.
db
.
transaction
(
async
t
=>
{
await
this
.
db
.
transaction
(
async
t
=>
{
...
@@ -118,11 +124,12 @@ class EorderSve extends ServiceBase {
...
@@ -118,11 +124,12 @@ class EorderSve extends ServiceBase {
for
(
let
item
of
ids
){
for
(
let
item
of
ids
){
eorderProductProperties
.
push
({
order_id
:
orderBean
.
id
,
product_id
:
item
});
eorderProductProperties
.
push
({
order_id
:
orderBean
.
id
,
product_id
:
item
});
}
}
await
this
.
eorderproductDao
.
model
.
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
)},
t
);
}
}
});
});
this
.
handleDate
(
orderBean
.
dataValues
,
[
'live_start'
,
'live_end'
,
'created_at'
],
null
,
null
);
return
system
.
getResult
(
orderBean
);
return
system
.
getResult
(
orderBean
);
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
...
@@ -280,4 +287,4 @@ class EorderSve extends ServiceBase {
...
@@ -280,4 +287,4 @@ class EorderSve extends ServiceBase {
}
}
}
}
module
.
exports
=
EorderSve
;
module
.
exports
=
EorderService
;
\ No newline at end of file
\ No newline at end of file
esign-sve-order/app/base/service/impl/eorder/eorderauthlogSve.js
View file @
7880bb54
const
system
=
require
(
"../../../system"
);
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
)
const
ServiceBase
=
require
(
"../../sve.base"
)
class
EorderauthlogS
v
e
extends
ServiceBase
{
class
EorderauthlogS
ervic
e
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"eorder
authlogSve"
,
ServiceBase
.
getDaoName
(
EorderauthlogSv
e
));
super
(
"eorder
"
,
ServiceBase
.
getDaoName
(
EorderauthlogServic
e
));
this
.
eorderDao
=
system
.
getObject
(
"db.eorder.eorderDao"
);
this
.
eorderDao
=
system
.
getObject
(
"db.eorder.eorderDao"
);
}
}
...
@@ -78,4 +78,4 @@ class EorderauthlogSve extends ServiceBase {
...
@@ -78,4 +78,4 @@ class EorderauthlogSve extends ServiceBase {
}
}
}
}
module
.
exports
=
EorderauthlogSve
;
module
.
exports
=
EorderauthlogService
;
\ No newline at end of file
\ No newline at end of file
esign-sve-order/app/base/service/impl/eorder/eorderproductSve.js
View file @
7880bb54
const
system
=
require
(
"../../../system"
);
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
)
const
ServiceBase
=
require
(
"../../sve.base"
)
class
EorderproductS
v
e
extends
ServiceBase
{
class
EorderproductS
ervic
e
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"eorder
product"
,
ServiceBase
.
getDaoName
(
EorderproductSv
e
));
super
(
"eorder
"
,
ServiceBase
.
getDaoName
(
EorderproductServic
e
));
// this.accounttradeDao = system.getObject("db.account.accounttradeDao");
// this.accounttradeDao = system.getObject("db.account.accounttradeDao");
}
}
...
@@ -44,4 +44,4 @@ class EorderproductSve extends ServiceBase {
...
@@ -44,4 +44,4 @@ class EorderproductSve extends ServiceBase {
}
}
}
}
module
.
exports
=
EorderproductSve
;
module
.
exports
=
EorderproductService
;
\ No newline at end of file
\ No newline at end of file
esign-sve-order/app/base/service/impl/eorder/eordersignlogSve.js
View file @
7880bb54
const
system
=
require
(
"../../../system"
);
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
)
const
ServiceBase
=
require
(
"../../sve.base"
)
class
EordersignlogS
v
e
extends
ServiceBase
{
class
EordersignlogS
ervic
e
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"eorder
signlog"
,
ServiceBase
.
getDaoName
(
EordersignlogSv
e
));
super
(
"eorder
"
,
ServiceBase
.
getDaoName
(
EordersignlogServic
e
));
this
.
eorderDao
=
system
.
getObject
(
"db.eorder.eorderDao"
);
this
.
eorderDao
=
system
.
getObject
(
"db.eorder.eorderDao"
);
}
}
...
@@ -81,4 +81,4 @@ class EordersignlogSve extends ServiceBase {
...
@@ -81,4 +81,4 @@ class EordersignlogSve extends ServiceBase {
}
}
module
.
exports
=
EordersignlogSve
;
module
.
exports
=
EordersignlogService
;
\ No newline at end of file
\ No newline at end of file
esign-sve-order/package-lock.json
View file @
7880bb54
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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