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
30d4375a
Commit
30d4375a
authored
Jan 09, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dd
parent
f3237448
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
214 additions
and
29 deletions
+214
-29
xggsve-order/app/base/db/impl/order/oorderDao.js
+1
-0
xggsve-order/app/base/db/impl/order/oorderdeliverDao.js
+55
-0
xggsve-order/app/base/db/models/order/oorderdeliver.js
+1
-1
xggsve-order/app/base/db/models/order/oorderinforeg.js
+2
-2
xggsve-order/app/base/service/impl/order/oorderdeliverSve.js
+20
-8
xggsve-order/app/base/service/impl/order/oorderstatusSve.js
+135
-18
No files found.
xggsve-order/app/base/db/impl/order/oorderDao.js
View file @
30d4375a
...
...
@@ -49,6 +49,7 @@ class OorderDao extends Dao {
if
(
params
.
end
)
{
sql
.
push
(
`AND created_at <= :end`
);
}
}
}
...
...
xggsve-order/app/base/db/impl/order/oorderdeliverDao.js
View file @
30d4375a
...
...
@@ -27,5 +27,59 @@ class OorderdeliverDao extends Dao {
}
return
result
;
}
/**
* 订单管理列表 分页总数查询
* @param {*} params
*/
async
ordersdeliverCount
(
params
){
let
sql
=
[];
sql
.
push
(
`SELECT COUNT(1) AS orderCount FROM o_order_deliver b INNER JOIN o_order a on
b.order_id=a.id WHERE b.deliver_id = '
${
params
.
deliver_id
}
' `
);
this
.
setOrderCount
(
sql
,
params
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
/**
* 订单列表 分页
* @param {*} params
*/
async
findOrders
(
params
){
let
sql
=
[];
sql
.
push
(
`SELECT a.id,b.created_at,a.service_items,a.status,b.deliver_divide,b.operator_id,b.completed_at,
b.deliver_name FROM o_order_deliver b INNER JOIN o_order a on
b.order_id=a.id WHERE b.deliver_id = '
${
params
.
deliver_id
}
' `
);
this
.
setOrderCount
(
sql
,
params
);
sql
.
push
(
` order by id desc `
);
sql
.
push
(
`limit
${
params
.
startRow
}
,
${
params
.
pageSize
}
`
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
/**
* 订单管理列表查询条件参数设置
* @param {*} params
*/
async
setOrderCount
(
sql
,
params
){
if
(
params
.
id
){
sql
.
push
(
`AND b.id = :id `
);
}
if
(
params
.
operator_id
){
sql
.
push
(
`AND b.operator_id = :operator_id `
);
}
if
(
params
.
status
){
sql
.
push
(
`AND a.status = :status `
);
}
if
(
params
.
createdBegin
)
{
sql
.
push
(
`AND created_at >= :createdBegin `
);
}
if
(
params
.
createdEnd
)
{
sql
.
push
(
`AND created_at <= :createdEnd`
);
}
}
}
module
.
exports
=
OorderdeliverDao
;
\ No newline at end of file
xggsve-order/app/base/db/models/order/oorderdeliver.js
View file @
30d4375a
...
...
@@ -17,7 +17,7 @@ module.exports = function (db, DataTypes) {
deliver_mail_no
:
{
type
:
DataTypes
.
STRING
,
field
:
'deliver_mail_no'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'交付商交付快递单号'
},
deliver_mail_img
:
{
type
:
DataTypes
.
STRING
,
field
:
'deliver_mail_img'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'交付商交付快递单号图片'
},
completed_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'completed_at'
,
allowNull
:
true
,
comment
:
'订单的完成时间'
},
operator_id
:
{
type
:
DataTypes
.
DATE
,
field
:
'operator_id'
,
allowNull
:
true
,
comment
:
'业务员id'
},
operator_id
:
{
type
:
DataTypes
.
STRING
,
field
:
'operator_id'
,
allowNull
:
true
,
comment
:
'业务员id'
},
created_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'created_at'
,
allowNull
:
false
,
defaultValue
:
DataTypes
.
NOW
},
updated_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'updated_at'
,
allowNull
:
false
,
defaultValue
:
DataTypes
.
NOW
},
...
...
xggsve-order/app/base/db/models/order/oorderinforeg.js
View file @
30d4375a
...
...
@@ -6,7 +6,7 @@ module.exports = function (db, DataTypes) {
return
db
.
define
(
'oorderinforeg'
,
{
legal_name
:
{
type
:
DataTypes
.
STRING
,
field
:
'legal_name'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'法人姓名'
},
id_card
:
{
type
:
DataTypes
.
STRING
,
field
:
'id_card'
,
allowNull
:
true
,
comment
:
'法人身份证'
},
legal_mobile
:
{
type
:
DataTypes
.
INTEGER
,
field
:
'legal_mobile'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'法人电话'
},
legal_mobile
:
{
type
:
DataTypes
.
STRING
,
field
:
'legal_mobile'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'法人电话'
},
names
:
{
type
:
DataTypes
.
STRING
,
field
:
'names'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'个体户名称'
},
capital
:
{
type
:
DataTypes
.
STRING
,
field
:
'capital'
,
allowNull
:
false
,
defaultValue
:
''
,
comment
:
'注册资本'
},
domicile_id
:
{
type
:
DataTypes
.
STRING
,
field
:
'domicile_id'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'注册地id'
},
...
...
@@ -29,7 +29,7 @@ module.exports = function (db, DataTypes) {
deleted_at
:
{
type
:
DataTypes
.
DATE
,
field
:
'deleted_at'
,
allowNull
:
true
}
},
{
timestamps
:
tru
e
,
timestamps
:
fals
e
,
underscore
:
true
,
paranoid
:
true
,
version
:
true
,
...
...
xggsve-order/app/base/service/impl/order/oorderdeliverSve.js
View file @
30d4375a
...
...
@@ -20,6 +20,10 @@ class OorderdeliverService extends ServiceBase {
/**
* 交付商订单管理列表
* @param {*} params
* @operator_id 业务员ID
* @id String 订单号
* @status String 订单状态
* @operator_id String 交付商业务员
*/
async
orderDelivers
(
params
){
let
where
=
{};
...
...
@@ -28,16 +32,22 @@ class OorderdeliverService extends ServiceBase {
}
else
{
return
system
.
getResult
(
null
,
`参数错误 交付商ID不能为空`
);
}
//交付商订单表条件
if
(
params
.
createdBegin
&&
params
.
createdEnd
){
where
.
createdBegin
=
this
.
trim
(
params
.
createdBegin
);
where
.
createdEnd
=
this
.
trim
(
params
.
createdEnd
);
}
if
(
params
.
operator_id
){
where
.
operator_id
=
this
.
trim
(
params
.
operator_id
);
}
//下面是订单条件
if
(
params
.
id
){
where
.
id
=
this
.
trim
(
params
.
id
);
}
if
(
params
.
status
){
where
.
status
=
this
.
trim
(
params
.
status
);
}
if
(
params
.
beginDate
&&
params
.
endDate
){
where
.
beginDate
=
this
.
trim
(
params
.
beginDate
);
where
.
endDate
=
this
.
trim
(
params
.
endDate
);
}
where
.
currentPage
=
Number
(
params
.
currentPage
||
1
);
where
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
...
...
@@ -45,14 +55,12 @@ class OorderdeliverService extends ServiceBase {
where
.
startRow
=
(
where
.
currentPage
-
1
)
*
where
.
pageSize
;
try
{
let
ordersCountRes
=
await
this
.
oorderDao
.
orders
Count
(
where
);
let
ordersCountRes
=
await
this
.
dao
.
ordersdeliver
Count
(
where
);
let
count
=
ordersCountRes
[
0
][
'orderCount'
];
if
(
count
==
0
){
return
system
.
getResult
({
count
:
0
,
rows
:[]});
}
let
rows
=
await
this
.
oorderDao
.
findAll
(
where
);
//格式化交付商
await
this
.
formateDeliver
(
rows
);
let
rows
=
await
this
.
dao
.
findOrders
(
where
);
//格式化订单状态
await
this
.
formateStatus
(
rows
);
let
res
=
{
...
...
@@ -106,6 +114,9 @@ class OorderdeliverService extends ServiceBase {
}
console
.
log
(
orderList
);
}
}
module
.
exports
=
OorderdeliverService
;
\ No newline at end of file
xggsve-order/app/base/service/impl/order/oorderstatusSve.js
View file @
30d4375a
...
...
@@ -51,14 +51,11 @@ class OorderstatusService extends ServiceBase {
return
system
.
getResult
(
null
,
`订单状态错误,下一订单状态应该是
${
nextNames
}
`
);
}
let
nextStatus
=
await
this
.
oorderprocessDao
.
findByOrderIdAndStatus
(
_order
.
id
,
params
.
status
);
params
.
_order
=
_order
;
//调用对应的方法 TODO SOMETHING .....
// 调用func
// await this[nextStatus.func](params);
return
await
this
[
_orderStatus
.
func
](
params
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
...
...
@@ -88,6 +85,7 @@ class OorderstatusService extends ServiceBase {
* @bd_id String 业务员ID
* @status String 下一个状态码
* @bd_path String 业务员权限
* @assign_user_id String 分配人ID
*/
async
platformAassignSalesman
(
params
)
{
if
(
!
params
.
bd_id
)
{
...
...
@@ -99,7 +97,7 @@ class OorderstatusService extends ServiceBase {
_order
.
bd_id
=
this
.
trim
(
params
.
bd_id
);
_order
.
status
=
this
.
trim
(
params
.
status
);
_order
.
bd_path
=
this
.
trim
(
params
.
bd_path
);
_order
.
assign_user_id
=
this
.
trim
(
params
.
assign_user_id
);
let
res
=
await
_order
.
save
();
return
system
.
getResult
(
res
);
}
catch
(
error
)
{
...
...
@@ -108,6 +106,123 @@ class OorderstatusService extends ServiceBase {
}
}
/**
* 业务员完善订单信息
* @param {*} params
* @id String 订单ID
* @status String 下一个状态
* @other Object 其他参数
*/
async
perfectInformation
(
params
){
//验证参数
this
.
verificationPerfectInformation
(
params
);
let
_oorderinforeg
=
await
this
.
oorderinforegDao
.
findById
(
params
.
_order
.
id
);
if
(
!
_oorderinforeg
){
return
system
.
getResult
(
null
,
`订单异常 订单明细不存在,请联系管理员`
);
}
//更新订单子表
_oorderinforeg
.
legal_name
=
this
.
trim
(
params
.
legal_name
);
_oorderinforeg
.
id_card
=
this
.
trim
(
params
.
id_card
);
_oorderinforeg
.
legal_mobile
=
this
.
trim
(
params
.
legal_mobile
);
_oorderinforeg
.
names
=
this
.
trim
(
params
.
names
);
_oorderinforeg
.
capital
=
this
.
trim
(
params
.
capital
);
_oorderinforeg
.
domicile_id
=
this
.
trim
(
params
.
domicile_id
);
_oorderinforeg
.
domicile_name
=
this
.
trim
(
params
.
domicile_name
);
_oorderinforeg
.
business_scope_id
=
this
.
trim
(
params
.
business_scope_id
);
_oorderinforeg
.
business_type
=
this
.
trim
(
params
.
business_type
);
_oorderinforeg
.
business_scope
=
this
.
trim
(
params
.
business_scope
);
_oorderinforeg
.
idcard_front
=
this
.
trim
(
params
.
idcard_front
);
_oorderinforeg
.
idcard_back
=
this
.
trim
(
params
.
idcard_back
);
_oorderinforeg
.
other_file
=
this
.
trim
(
params
.
other_file
);
_oorderinforeg
.
guest_mail_addr
=
this
.
trim
(
params
.
guest_mail_addr
);
_oorderinforeg
.
guest_mail_to
=
this
.
trim
(
params
.
guest_mail_to
);
_oorderinforeg
.
guest_mail_mobile
=
this
.
trim
(
params
.
guest_mail_mobile
);
//更新主表
params
.
_order
.
service_items
=
this
.
trim
(
params
.
service_items
);
params
.
_order
.
service_remark
=
this
.
trim
(
params
.
service_remark
);
params
.
_order
.
status
=
this
.
trim
(
params
.
status
);
try
{
//开启事务
await
this
.
db
.
transaction
(
async
t
=>
{
await
_oorderinforeg
.
save
();
await
params
.
_order
.
save
();
});
return
system
.
getResultSuccess
();
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
verificationPerfectInformation
(
params
){
if
(
!
params
.
legal_name
){
return
system
.
getResult
(
null
,
`参数错误 法人姓名不能为空`
);
}
if
(
!
params
.
id_card
){
return
system
.
getResult
(
null
,
`参数错误 法人身份证不能为空`
);
}
if
(
!
params
.
legal_mobile
){
return
system
.
getResult
(
null
,
`参数错误 法人电话不能为空`
);
}
if
(
!
params
.
names
){
return
system
.
getResult
(
null
,
`参数错误 个体户名称不能为空`
);
}
if
(
!
params
.
capital
){
return
system
.
getResult
(
null
,
`参数错误 注册资本不能为空`
);
}
if
(
!
params
.
domicile_id
){
return
system
.
getResult
(
null
,
`参数错误 注册地id不能为空`
);
}
if
(
!
params
.
domicile_name
){
return
system
.
getResult
(
null
,
`参数错误 注册地名称不能为空`
);
}
if
(
!
params
.
business_scope_id
){
return
system
.
getResult
(
null
,
`参数错误 经营范围id不能为空`
);
}
if
(
!
params
.
business_type
){
return
system
.
getResult
(
null
,
`参数错误 经营范围不能为空`
);
}
if
(
!
params
.
business_scope
){
return
system
.
getResult
(
null
,
`参数错误 经营范围详情不能为空`
);
}
if
(
!
params
.
idcard_front
){
return
system
.
getResult
(
null
,
`参数错误 身份证正面照片不能为空`
);
}
if
(
!
params
.
idcard_back
){
return
system
.
getResult
(
null
,
`参数错误 身份证反面照片不能为空`
);
}
if
(
!
params
.
other_file
){
return
system
.
getResult
(
null
,
`参数错误 其他文件不能为空`
);
}
if
(
!
params
.
guest_mail_addr
){
return
system
.
getResult
(
null
,
`参数错误 邮寄客户地址不能为空`
);
}
if
(
!
params
.
guest_mail_to
){
return
system
.
getResult
(
null
,
`参数错误 客户收件人不能为空`
);
}
if
(
!
params
.
guest_mail_mobile
){
return
system
.
getResult
(
null
,
`参数错误 客户收件人电话不能为空`
);
}
// if(!params.guest_mail_no){
// return system.getResult(null,`参数错误 客户快递单号不能为空`);
// }
// if(!params.guest_mail_img){
// return system.getResult(null,`参数错误 交付商交付快递单号图片不能为空`);
// }
// if(!params.guest_accpet_file){
// return system.getResult(null,`参数错误 客户验收文件不能为空`);
// }
if
(
!
params
.
service_items
){
return
system
.
getResult
(
null
,
`参数错误 服务项不能为空`
);
}
}
/**
* 分配交付商
* @param {*} params
...
...
@@ -131,7 +246,7 @@ class OorderstatusService extends ServiceBase {
try
{
let
self
=
this
;
let
res
=
await
this
.
db
.
transaction
(
async
t
=>
{
await
this
.
db
.
transaction
(
async
t
=>
{
//创建orderdeliver记录
await
self
.
oorderdeliverDao
.
create
({
order_id
:
self
.
trim
(
params
.
id
),
...
...
@@ -146,9 +261,8 @@ class OorderstatusService extends ServiceBase {
id
:
self
.
trim
(
params
.
id
),
status
:
self
.
trim
(
params
.
status
)
},
t
);
});
return
system
.
getResult
(
res
);
return
system
.
getResult
Success
(
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
...
...
@@ -164,29 +278,30 @@ class OorderstatusService extends ServiceBase {
* @id String 订单ID
* @operator_id String 业务员ID
* @status String 下一个状态码
* @deliver_id String 交付商ID
*/
async
deliverAssignSalesman
(
params
)
{
if
(
!
params
.
operator_id
)
{
return
system
.
getResult
(
null
,
`参数错误 业务员ID不能为空`
);
}
if
(
!
params
.
deliver_id
)
{
return
system
.
getResult
(
null
,
`参数错误 交付商ID不能为空`
);
}
try
{
let
self
=
this
;
//更新订单交付表业务员ID
let
_oorderdeliver
=
await
this
.
oorderdeliverDao
.
findById
(
this
.
trim
(
params
.
deliver_id
)
);
let
_oorderdeliver
=
await
this
.
oorderdeliverDao
.
model
.
findOne
({
where
:{
order_id
:
this
.
trim
(
params
.
_order
.
id
)
}}
);
if
(
!
_oorderdeliver
){
return
system
.
getResult
(
null
,
`参数错误 订单交付信息不存在`
);
}
await
this
.
db
.
transaction
(
async
t
=>
{
//更新订单交付表业务员ID
_oorderdeliver
.
operator_id
=
this
.
trim
(
params
.
operator_id
);
//更新订单状态
let
_order
=
params
.
_order
;
_order
.
status
=
this
.
trim
(
params
.
status
);
await
_oorderdeliver
.
save
();
await
_order
.
save
();
let
res
=
await
_order
.
save
(
);
return
system
.
getResult
(
res
);
}
);
return
system
.
getResult
Success
(
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
...
...
@@ -197,6 +312,7 @@ class OorderstatusService extends ServiceBase {
}
module
.
exports
=
OorderstatusService
;
\ 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