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
86bd6971
Commit
86bd6971
authored
Jan 09, 2020
by
王昆
Browse files
Options
Browse Files
Download
Plain Diff
gsb
parents
695851d7
b43ca2aa
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
139 additions
and
13 deletions
+139
-13
xggsve-order/app/base/api/impl/op/action.js
+3
-0
xggsve-order/app/base/db/impl/order/oorderDao.js
+3
-0
xggsve-order/app/base/db/impl/order/oorderdeliverDao.js
+1
-1
xggsve-order/app/base/db/models/order/oorderdeliver.js
+4
-1
xggsve-order/app/base/service/impl/order/oorderSve.js
+72
-11
xggsve-order/app/base/service/impl/order/oorderdeliverSve.js
+56
-0
No files found.
xggsve-order/app/base/api/impl/op/action.js
View file @
86bd6971
...
...
@@ -55,6 +55,9 @@ class ActionAPI extends APIBase {
case
"assignDeliver"
:
//分配交付商
opResult
=
await
this
.
oorderSve
.
assignDeliver
(
action_body
);
break
;
case
"orderDelivers"
:
//分配交付商
opResult
=
await
this
.
oorderdeliverSve
.
orderDelivers
(
action_body
);
break
;
case
"addSourceOrder"
:
// 创建来源订单
opResult
=
await
this
.
oorderSve
.
addSourceOrder
(
action_body
);
...
...
xggsve-order/app/base/db/impl/order/oorderDao.js
View file @
86bd6971
...
...
@@ -49,6 +49,9 @@ class OorderDao extends Dao {
if
(
params
.
end
)
{
sql
.
push
(
`AND created_at <= :end`
);
}
if
(
params
.
deliver_id
)
{
sql
.
push
(
`AND deliver_id = :deliver_id`
);
}
}
}
...
...
xggsve-order/app/base/db/impl/order/oorderdeliverDao.js
View file @
86bd6971
...
...
@@ -5,7 +5,7 @@ class OorderdeliverDao extends Dao {
super
(
Dao
.
getModelName
(
OorderdeliverDao
));
}
/**
/**
* 条件查询所有符合条件的产品
* @param {*} params
*/
...
...
xggsve-order/app/base/db/models/order/oorderdeliver.js
View file @
86bd6971
...
...
@@ -16,12 +16,15 @@ module.exports = function (db, DataTypes) {
deliver_content
:
{
type
:
DataTypes
.
STRING
,
field
:
'deliver_content'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'交付内容'
},
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'
},
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
},
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/oorderSve.js
View file @
86bd6971
...
...
@@ -57,7 +57,7 @@ class OorderService extends ServiceBase {
}
// 构建订单流程列表
let
orderProcessList
=
await
this
.
buildOrderProcess
(
order
.
product_id
,
[
10010200
,
10010500
]
);
let
orderProcessList
=
await
this
.
buildOrderProcess
(
order
.
product_id
);
if
(
!
orderProcessList
||
orderProcessList
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"产品流程未配置"
);
}
...
...
@@ -77,7 +77,8 @@ class OorderService extends ServiceBase {
return
order
;
});
return
order
;
return
this
.
getOrderProcessStatus
(
order
.
id
,
order
.
status
);
// return order;
}
/**
...
...
@@ -182,8 +183,8 @@ class OorderService extends ServiceBase {
if
(
params
.
id
)
{
where
.
id
=
this
.
trim
(
params
.
id
);
}
if
(
params
.
progress
)
{
where
.
progress
=
this
.
trim
(
params
.
progres
s
);
if
(
params
.
status
)
{
where
.
status
=
this
.
trim
(
params
.
statu
s
);
}
if
(
params
.
beginDate
&&
params
.
endDate
)
{
where
.
beginDate
=
this
.
trim
(
params
.
beginDate
);
...
...
@@ -309,20 +310,29 @@ class OorderService extends ServiceBase {
return
map
[
order_id
+
"_"
+
status
]
||
{};
}
/**
* 分配业务员
* @param {*} params
* @id String 订单ID
* @bd_id String 业务员ID
* @status String 下一个状态码
* @bd_path String 业务员权限
*/
async
assignSalesman
(
params
)
{
if
(
!
params
.
bd_id
)
{
return
system
.
getResult
(
null
,
`参数错误 业务员ID不能为空`
);
}
try
{
let
_order
=
await
this
.
findById
(
params
.
id
);
//更新订单业务员
let
_order
=
await
this
.
findById
(
params
.
id
);
if
(
!
_order
){
return
system
.
getResult
(
null
,
`订单不存在`
);
}
//to do ... 验证下一个状态
_order
.
bd_id
=
this
.
trim
(
params
.
bd_id
);
_order
.
status
=
this
.
trim
(
params
.
status
);
_order
.
bd_path
=
this
.
trim
(
params
.
bd_path
);
let
res
=
await
_order
.
save
();
return
system
.
getResult
(
res
);
}
catch
(
error
)
{
...
...
@@ -331,14 +341,33 @@ class OorderService extends ServiceBase {
}
}
/**
*
* @param params
* @returns {Promise<{msg: string, data: (*|null), bizmsg: string, status: number}>}
*/
async
statusAction
(
params
)
{
let
_order
=
await
this
.
findById
(
params
.
id
);
if
(
!
_order
){
return
system
.
getResult
(
null
,
`订单不存在`
);
}
//todo ... 验证状态
let
_orderStatus
=
await
this
.
getOrderProcessStatus
(
_order
.
id
,
_order
.
status
);
let
nextStatus
=
JSON
.
parse
(
_orderStatus
.
next_status
);
if
(
params
.
status
!=
nextStatus
.
next_status
)
{
return
system
.
getResult
(
null
,
`订单状态错误,下一订单状态应该是
${
nextStatus
.
next_name
}
`
);
}
}
/**
* 分配交付商
* @param {*} params
* @id String 订单ID
*
*
*
* @deliver_id String 交付商ID
* @deliver_name String 交付商名称
* @deliver_deliver String 交付商分成
* @status String 下一个状态码
*/
async
assignDeliver
(
params
)
{
//参数验证
...
...
@@ -351,10 +380,42 @@ class OorderService extends ServiceBase {
if
(
!
params
.
hasOwnProperty
(
`deliver_divide`
))
{
return
system
.
getResult
(
null
,
`参数错误 交付商分成不能为空`
);
}
//创建orderdeliver记录
//更新oorder订单记录
try
{
let
_order
=
await
this
.
findById
(
params
.
id
);
if
(
!
_order
){
return
system
.
getResult
(
null
,
`订单不存在`
);
}
//todo ... 验证状态
let
_orderStatus
=
await
this
.
getOrderProcessStatus
(
_order
.
id
,
_order
.
status
);
let
nextStatus
=
JSON
.
parse
(
_orderStatus
.
next_status
);
if
(
params
.
status
!=
nextStatus
.
next_status
)
{
return
system
.
getResult
(
null
,
`订单状态错误,下一订单状态应该是
${
nextStatus
.
next_name
}
`
);
}
let
self
=
this
;
let
res
=
await
this
.
db
.
transaction
(
async
t
=>
{
//创建orderdeliver记录
await
this
.
oorderdeliverDao
.
create
({
order_id
:
self
.
trim
(
params
.
id
),
deliver_id
:
self
.
trim
(
self
.
deliver_id
),
deliver_name
:
self
.
trim
(
self
.
deliver_name
),
deliver_divide
:
self
.
trim
(
self
.
deliver_divide
),
},
t
);
//更新oorder订单记录
await
self
.
dao
.
update
({
deliver_id
:
self
.
trim
(
self
.
deliver_id
),
id
:
self
.
trim
(
params
.
id
),
status
:
self
.
trim
(
params
.
status
)
},
t
);
});
return
system
.
getResult
(
res
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
...
...
xggsve-order/app/base/service/impl/order/oorderdeliverSve.js
View file @
86bd6971
...
...
@@ -6,8 +6,64 @@ const ServiceBase = require("../../sve.base")
class
OorderdeliverService
extends
ServiceBase
{
constructor
()
{
super
(
"order"
,
ServiceBase
.
getDaoName
(
OorderdeliverService
));
this
.
oorderinforegDao
=
system
.
getObject
(
"db.order.oorderinforegDao"
);
this
.
oorderDao
=
system
.
getObject
(
"db.order.oorderDao"
);
this
.
oorderprocessDao
=
system
.
getObject
(
"db.order.oorderprocessDao"
);
this
.
osourceDao
=
system
.
getObject
(
"db.common.osourceDao"
);
this
.
oproductDao
=
system
.
getObject
(
"db.product.oproductDao"
);
this
.
oprocessDao
=
system
.
getObject
(
"db.product.oprocessDao"
);
this
.
oproductprocessDao
=
system
.
getObject
(
"db.product.oproductprocessDao"
);
}
/**
* 交付商订单管理列表
* @param {*} params
*/
// async orderDelivers(params){
// let where = {};
// if(params.deliver_id){
// where.deliver_id = this.trim(params.deliver_id);
// }else{
// return system.getResult(null,`参数错误 交付商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);
// where.startRow = (where.currentPage-1)*where.pageSize;
// try {
// let ordersCountRes = await this.oorderDao.ordersCount(where);
// let count = ordersCountRes[0]['orderCount'];
// let rows = await this.dao.findAll(where);
// //格式化交付商
// this.formateDeliver(rows);
// let res = {
// count,rows
// };
// return system.getResult(res);
// } catch (error) {
// console.log(error);
// return system.getResult(null,`系统错误 错误信息 ${error}`);
// }
// }
}
...
...
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