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
56e72547
Commit
56e72547
authored
Mar 21, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dd
parent
6f5182bb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
2 deletions
+92
-2
xggsve-order/app/base/db/impl/order/oorderprocessDao.js
+5
-0
xggsve-order/app/base/db/impl/product/oprocessDao.js
+6
-0
xggsve-order/app/base/db/models/product/oprocess.js
+2
-1
xggsve-order/app/base/service/impl/order/oorderSve.js
+78
-0
xggsve-order/app/base/service/impl/order/oorderstatusSve.js
+1
-1
No files found.
xggsve-order/app/base/db/impl/order/oorderprocessDao.js
View file @
56e72547
...
...
@@ -60,6 +60,11 @@ class OorderprocessDao extends Dao {
}
return
result
;
}
async
findAllByOrderId
(
order_id
){
let
sql
=
`select * from o_order_process where order_id = :order_id`
;
return
await
this
.
customQuery
(
sql
,{
order_id
:
order_id
});
}
}
module
.
exports
=
OorderprocessDao
;
xggsve-order/app/base/db/impl/product/oprocessDao.js
View file @
56e72547
...
...
@@ -44,5 +44,10 @@ class OprocessDao extends Dao {
}
return
result
;
}
async
findAllByPorductId
(
productIds
){
let
sql
=
`select id,product_id,status from o_process where product_id in (:productIds)`
;
return
await
this
.
customQuery
(
sql
,{
productIds
:
productIds
});
}
}
module
.
exports
=
OprocessDao
;
\ No newline at end of file
xggsve-order/app/base/db/models/product/oprocess.js
View file @
56e72547
...
...
@@ -5,7 +5,8 @@
module
.
exports
=
function
(
db
,
DataTypes
)
{
return
db
.
define
(
'oprocess'
,
{
name
:
{
type
:
DataTypes
.
STRING
,
field
:
'name'
,
allowNull
:
false
,
defaultValue
:
''
,
comment
:
'流程名称'
},
status
:
{
type
:
DataTypes
.
STRING
,
field
:
'status'
,
allowNull
:
false
,
defaultValue
:
''
,
comment
:
'流程状态'
},
status
:
{
type
:
DataTypes
.
STRING
,
field
:
'status'
,
allowNull
:
false
,
defaultValue
:
''
,
comment
:
'流程状态'
},
product_id
:
{
type
:
DataTypes
.
STRING
,
field
:
'product_id'
,
allowNull
:
false
,
defaultValue
:
''
,
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
}
...
...
xggsve-order/app/base/service/impl/order/oorderSve.js
View file @
56e72547
...
...
@@ -220,6 +220,84 @@ class OorderService extends ServiceBase {
return
orderProcessList
;
}
/**
* 构建产品流程对象
* @param productPid
* @param chooseProductIds
* @returns {Promise<void>}
*/
async
buildOrderProcess1
(
_order
,
productPid
,
chooseProductIds
)
{
try
{
// 查询所有产品子项
let
productList
=
await
this
.
oproductDao
.
findListByPid
(
productPid
);
// 根据所选产品id, 查询产品流程
let
productIds
=
[];
//结果 10010100 10010200 10010500 10010600
for
(
let
product
of
productList
)
{
// 过滤未选择产品
if
(
product
.
is_choose
&&
chooseProductIds
&&
chooseProductIds
.
indexOf
(
product
.
id
)
==
-
1
)
{
continue
;
}
productIds
.
push
(
product
.
id
);
}
if
(
productIds
.
length
==
0
)
{
return
null
;
}
//查出订单的所有流程
let
oorderProcessInfo
=
await
this
.
oorderprocessDao
.
findAllByOrderId
(
_order
.
id
);
//筛选出每个状态对应的 产品ID 格式 1010 -> 10100100
let
filterMap
=
{};
//查询每个状态对应的产品id
let
oproductInfo
=
await
this
.
oprocessDao
.
findAllByPorductId
(
productIds
);
for
(
let
item
of
oproductInfo
){
filterMap
[
item
.
status
]
=
item
.
product_id
;
}
//遍历 oorderProcessInfo 数组 为每一个值都添加 delete_mark product_id change_func三个属性
for
(
let
item
of
oorderProcessInfo
){
item
.
productId
=
filterMap
[
item
.
status
];
item
.
delete_mark
=
false
;
item
.
change_func_flag
=
false
;
item
.
change_func
=
''
;
}
for
(
let
i
=
0
;
i
<
oorderProcessInfo
.
length
;
i
++
){
if
(
oorderProcessInfo
[
i
+
1
]){
oorderProcessInfo
[
i
+
1
].
change_func
=
oorderProcessInfo
[
i
].
func
;
}
if
(
!
productIds
.
includes
(
oorderProcessInfo
[
i
].
productId
)){
oorderProcessInfo
[
i
].
delete_mark
=
true
;
if
(
oorderProcessInfo
[
i
+
1
]){
oorderProcessInfo
[
i
+
1
].
change_func_flag
=
true
;
}
}
}
let
new_oorderProcessInfo
=
oorderProcessInfo
.
filter
(
element
=>
{
if
(
!
element
.
delete_mark
){
return
element
;
}
});
for
(
let
j
=
0
;
j
<
new_oorderProcessInfo
.
length
;
j
++
){
if
(
new_oorderProcessInfo
[
j
].
change_func_flag
){
let
current
=
new_oorderProcessInfo
[
j
];
let
pre
=
new_oorderProcessInfo
[
j
-
1
];
pre
.
func
=
current
.
change_func
;
let
preNextStatus
=
JSON
.
parse
(
pre
.
next_status
)[
0
];
preNextStatus
.
next_status
=
current
.
status
;
preNextStatus
.
next_name
=
current
.
name
;
pre
.
next_status
=
JSON
.
stringify
(
preNextStatus
);
}
}
return
new_oorderProcessInfo
;
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
/**
* 订单管理列表
* @param {*} params
...
...
xggsve-order/app/base/service/impl/order/oorderstatusSve.js
View file @
56e72547
...
...
@@ -52,7 +52,7 @@ class OorderstatusService extends ServiceBase {
chooseItems
.
push
(
productId
);
}
}
let
orderProcessList
=
await
this
.
oorderSve
.
buildOrderProcess
(
_order
.
product_id
,
chooseItems
);
let
orderProcessList
=
await
this
.
oorderSve
.
buildOrderProcess
1
(
_order
,
_order
.
product_id
,
chooseItems
);
if
(
!
orderProcessList
||
orderProcessList
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"产品流程未配置"
);
}
...
...
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