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
8e83344a
Commit
8e83344a
authored
Jan 09, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
8fc483a8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
28 deletions
+97
-28
xggsve-order/app/base/db/impl/product/oproductDao.js
+19
-0
xggsve-order/app/base/db/impl/product/oproductprocessDao.js
+40
-5
xggsve-order/app/base/service/impl/order/oorderSve.js
+32
-22
xggsve-order/app/base/service/impl/product/oproductSve.js
+6
-1
No files found.
xggsve-order/app/base/db/impl/product/oproductDao.js
View file @
8e83344a
...
@@ -5,5 +5,23 @@ class OproductDao extends Dao {
...
@@ -5,5 +5,23 @@ class OproductDao extends Dao {
super
(
Dao
.
getModelName
(
OproductDao
));
super
(
Dao
.
getModelName
(
OproductDao
));
}
}
async
findListByPid
(
pid
)
{
let
sql
=
"SELECT * FROM o_product WHERE pid = :pid ORDER BY sort ASC"
;
return
await
this
.
customQuery
(
sql
,
{
pid
:
pid
});
}
async
findMapByPid
(
pid
)
{
let
result
=
{};
let
list
=
await
this
.
findListByPid
(
pid
);
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
item
.
id
;
}
}
}
module
.
exports
=
OproductDao
;
module
.
exports
=
OproductDao
;
\ No newline at end of file
xggsve-order/app/base/db/impl/product/oproductprocessDao.js
View file @
8e83344a
const
system
=
require
(
"../../../system"
);
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
const
Dao
=
require
(
"../../dao.base"
);
class
OproductprocessDao
extends
Dao
{
class
OproductprocessDao
extends
Dao
{
constructor
()
{
constructor
()
{
super
(
Dao
.
getModelName
(
OproductprocessDao
));
super
(
Dao
.
getModelName
(
OproductprocessDao
));
...
@@ -10,12 +11,14 @@ class OproductprocessDao extends Dao {
...
@@ -10,12 +11,14 @@ class OproductprocessDao extends Dao {
* @param {*} productId
* @param {*} productId
* @param {*} status
* @param {*} status
*/
*/
async
findByProductIdAndStatus
(
productId
,
status
)
{
async
findByProductIdAndStatus
(
productId
,
status
)
{
try
{
try
{
let
_productProcess
=
await
this
.
model
.
findOne
({
where
:{
let
_productProcess
=
await
this
.
model
.
findOne
({
productId
:
productId
,
where
:
{
status
:
status
productId
:
productId
,
}});
status
:
status
}
});
return
_productProcess
||
{};
return
_productProcess
||
{};
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
`系统错误 错误信息
${
error
}
`
);
console
.
log
(
`系统错误 错误信息
${
error
}
`
);
...
@@ -23,5 +26,36 @@ class OproductprocessDao extends Dao {
...
@@ -23,5 +26,36 @@ class OproductprocessDao extends Dao {
}
}
}
}
async
findMapByProductProductIds
(
productPid
,
productIds
)
{
let
result
=
{};
let
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"*"
);
sql
.
push
(
"FROM o_product_process"
);
sql
.
push
(
"WHERE product_pid = :productPid"
);
if
(
productIds
&&
productIds
.
length
>
0
)
{
sql
.
push
(
"AND product_id IN (:productIds)"
);
}
sql
.
push
(
"ORDER BY sort ASC"
);
let
list
=
await
this
.
customQuery
(
sql
,
{
productPid
:
productPid
,
productIds
:
productIds
});
if
(
!
list
||
list
.
length
)
{
return
result
;
}
for
(
let
item
of
list
)
{
let
productId
=
item
.
product_id
;
let
items
=
result
[
productId
];
if
(
!
items
)
{
items
=
[];
}
items
.
push
(
item
);
result
[
key
]
=
items
;
}
return
result
;
}
}
}
module
.
exports
=
OproductprocessDao
;
module
.
exports
=
OproductprocessDao
;
\ No newline at end of file
xggsve-order/app/base/service/impl/order/oorderSve.js
View file @
8e83344a
...
@@ -51,7 +51,7 @@ class OorderService extends ServiceBase {
...
@@ -51,7 +51,7 @@ class OorderService extends ServiceBase {
}
}
// 获取产品状态
// 获取产品状态
await
this
.
getProductProcess
(
);
await
this
.
getProductProcess
List
(
productId
,
);
// 查询产品订单状态
// 查询产品订单状态
...
@@ -79,33 +79,42 @@ class OorderService extends ServiceBase {
...
@@ -79,33 +79,42 @@ class OorderService extends ServiceBase {
// 调用状态func(order, nextObj, params)
// 调用状态func(order, nextObj, params)
}
}
async
getProductProcessList
(
params
)
{
/**
var
options
=
{};
* 构建产品流程对象
options
.
where
=
params
;
* @param productPid
options
.
raw
=
true
;
* @param chooseProductIds
options
.
order
=
[[
'sort'
,
'ASC'
]];
* @returns {Promise<void>}
*/
var
oplist
=
await
this
.
oproductprocessDao
.
model
.
findAll
(
options
);
async
getProductProcessList
(
productPid
,
chooseProductIds
)
{
if
(
!
oplist
)
{
// 查询所有产品子项
return
[];
let
productList
=
await
this
.
oproductDao
.
findListByPid
(
productPid
);
// 根据所选产品id, 查询产品流程
let
productIds
=
[];
for
(
let
product
of
productList
)
{
// 过滤未选择产品
if
(
product
.
is_choose
&&
chooseProductIds
&&
chooseProductIds
.
indexOf
(
product
.
id
)
==
-
1
)
{
continue
;
}
}
productIds
.
push
(
product
.
id
);
let
processIds
=
[];
}
for
(
var
item
of
oplist
)
{
if
(
productIds
.
length
==
0
)
{
processIds
.
push
(
item
.
processId
)
;
return
null
;
}
}
var
optionsProcess
=
{};
// 查询产品流程
optionsProcess
.
where
=
{
let
processMap
=
await
this
.
oproductprocessDao
.
findMapByProductProductIds
(
productPid
,
productIds
);
let
orderProcessList
=
[];
};
optionsProcess
.
raw
=
true
;
optionsProcess
.
order
=
[[
'sort'
,
'ASC'
]];
await
this
.
oprocessDao
.
model
.
findAll
();
for
(
let
productId
of
productIds
)
{
let
currentProcess
=
processMap
[
productId
];
let
orderProcess
=
{};
if
(
processList
.
length
>
0
)
{
let
lastProcess
=
productList
[
processList
.
length
-
1
];
}
}
}
}
}
}
module
.
exports
=
OorderService
;
module
.
exports
=
OorderService
;
\ No newline at end of file
xggsve-order/app/base/service/impl/product/oproductSve.js
View file @
8e83344a
...
@@ -7,7 +7,12 @@ class OproductService extends ServiceBase {
...
@@ -7,7 +7,12 @@ class OproductService extends ServiceBase {
constructor
()
{
constructor
()
{
super
(
"product"
,
ServiceBase
.
getDaoName
(
OproductService
));
super
(
"product"
,
ServiceBase
.
getDaoName
(
OproductService
));
this
.
oproductprocessDao
=
system
.
getObject
(
"db.product.oproductprocessDao"
);
this
.
oproductprocessDao
=
system
.
getObject
(
"db.product.oproductprocessDao"
);
this
.
iborderbaseDao
=
system
.
getObject
(
"db.product.iborderbaseDao"
);
}
async
getProcessList
(
productPid
,
productIds
)
{
}
}
/**
/**
...
...
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