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
b5355a48
Commit
b5355a48
authored
Jan 09, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dd
parent
8e83344a
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
307 additions
and
14 deletions
+307
-14
xggsve-order/app/base/api/impl/op/action.js
+22
-3
xggsve-order/app/base/db/impl/common/osourceDao.js
+24
-0
xggsve-order/app/base/db/impl/order/oorderDao.js
+47
-0
xggsve-order/app/base/db/impl/order/oorderdeliverDao.js
+24
-0
xggsve-order/app/base/db/impl/product/oproductDao.js
+24
-0
xggsve-order/app/base/db/models/order/oorder.js
+2
-2
xggsve-order/app/base/db/models/order/osource.js
+1
-1
xggsve-order/app/base/db/models/product/oproduct.js
+1
-1
xggsve-order/app/base/service/impl/order/oorderSve.js
+154
-0
xggsve-order/app/base/service/impl/order/oorderdeliverSve.js
+1
-0
xggsve-order/app/config/localsettings.js
+1
-1
xggsve-order/app/config/routes/web.js
+6
-6
No files found.
xggsve-order/app/base/api/impl/op/action.js
View file @
b5355a48
...
...
@@ -12,6 +12,12 @@ class ActionAPI extends APIBase {
this
.
businessmenSve
=
system
.
getObject
(
"service.business.businessmenSve"
);
this
.
businessmencontractSve
=
system
.
getObject
(
"service.business.businessmencontractSve"
);
//-----------------------------------------------------------------------------------------
this
.
oorderSve
=
system
.
getObject
(
"service.order.oorderSve"
);
this
.
oorderdeliverSve
=
system
.
getObject
(
"service.order.oorderdeliverSve"
);
}
/**
* 接口跳转
...
...
@@ -39,6 +45,19 @@ class ActionAPI extends APIBase {
async
handleRequest
(
action_process
,
action_type
,
action_body
)
{
var
opResult
=
null
;
switch
(
action_type
)
{
case
"orders"
:
//订单列表
opResult
=
await
this
.
oorderSve
.
orders
(
action_body
);
break
;
case
"assignSalesman"
:
//分配业务员
opResult
=
await
this
.
oorderSve
.
assignSalesman
(
action_body
);
break
;
case
"assignDeliver"
:
//分配交付商
opResult
=
await
this
.
oorderSve
.
assignDeliver
(
action_body
);
break
;
//******************************************************************** */
// 订单
case
"createOrder"
:
//创建订单
opResult
=
await
this
.
iborderbaseSve
.
apiCreateOrder
(
action_body
);
...
...
@@ -49,9 +68,9 @@ class ActionAPI extends APIBase {
case
"handling"
:
//订单办理接口
opResult
=
await
this
.
iborderbaseSve
.
apiHandling
(
action_body
);
break
;
case
"orders"
:
//订单列表
opResult
=
await
this
.
iborderbaseSve
.
apiOrders
(
action_body
);
break
;
//
case "orders": //订单列表
//
opResult = await this.iborderbaseSve.apiOrders(action_body);
//
break;
case
"addOrder"
:
opResult
=
await
this
.
iborderSve
.
apiAdd
(
action_body
);
break
;
...
...
xggsve-order/app/base/db/impl/common/osourceDao.js
View file @
b5355a48
...
...
@@ -5,5 +5,28 @@ class OsourceDao extends Dao {
super
(
Dao
.
getModelName
(
OsourceDao
));
}
/**
* 条件查询所有符合条件的来源数据
* @param {*} params
*/
async
listByIds
(
ids
){
if
(
!
ids
||
ids
.
length
==
0
)
{
return
[];
}
let
sql
=
[];
sql
.
push
(
`SELECT * FROM o_source WHERE id in (:sourceIdList)`
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
sourceIdList
:
ids
});
}
async
mapByIds
(
params
)
{
let
list
=
await
this
.
listByIds
(
params
);
var
result
=
{};
for
(
let
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
}
module
.
exports
=
OsourceDao
;
\ No newline at end of file
xggsve-order/app/base/db/impl/order/oorderDao.js
View file @
b5355a48
...
...
@@ -5,5 +5,51 @@ class OorderDao extends Dao {
super
(
Dao
.
getModelName
(
OorderDao
));
}
/**
* 订单管理列表 分页总数查询
* @param {*} params
*/
async
ordersCount
(
params
){
let
sql
=
[];
sql
.
push
(
'SELECT COUNT(1) AS orderCount FROM o_order WHERE 1 = 1 '
);
this
.
setOrderCount
(
sql
,
params
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
/**
* 订单列表 分页
* @param {*} params
*/
async
findAll
(
params
){
let
sql
=
[];
sql
.
push
(
`SELECT * FROM o_order WHERE 1=1 `
);
this
.
setOrderCount
(
sql
,
params
);
sql
.
push
(
`limit
${
params
.
currentPage
}
,
${
params
.
pageSize
}
`
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
/**
* 订单管理列表查询条件参数设置
* @param {*} params
*/
async
setOrderCount
(
sql
,
params
){
if
(
params
.
id
){
sql
.
push
(
`AND id = :id `
);
}
if
(
params
.
progress
){
sql
.
push
(
`AND progress = :progress `
);
}
if
(
params
.
deliver_id
){
sql
.
push
(
`AND deliver_id = :deliver_id `
);
}
if
(
params
.
begin
)
{
sql
.
push
(
`AND created_at >= :begin `
);
}
if
(
params
.
end
)
{
sql
.
push
(
`AND created_at <= :end`
);
}
}
}
module
.
exports
=
OorderDao
;
\ No newline at end of file
xggsve-order/app/base/db/impl/order/oorderdeliverDao.js
View file @
b5355a48
...
...
@@ -4,5 +4,28 @@ class OorderdeliverDao extends Dao {
constructor
()
{
super
(
Dao
.
getModelName
(
OorderdeliverDao
));
}
/**
* 条件查询所有符合条件的产品
* @param {*} params
*/
async
listByIds
(
ids
){
if
(
!
ids
||
ids
.
length
==
0
)
{
return
[];
}
let
sql
=
[];
sql
.
push
(
`SELECT * FROM o_order_deliver WHERE id in (:deliverIdList)`
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
deliverIdList
:
ids
});
}
async
mapByIds
(
params
)
{
let
list
=
await
this
.
listByIds
(
params
);
var
result
=
{};
for
(
let
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
}
module
.
exports
=
OorderdeliverDao
;
\ No newline at end of file
xggsve-order/app/base/db/impl/product/oproductDao.js
View file @
b5355a48
...
...
@@ -23,5 +23,28 @@ class OproductDao extends Dao {
return
item
.
id
;
}
/**
* 条件查询所有符合条件的产品
* @param {*} params
*/
async
listByIds
(
ids
){
if
(
!
ids
||
ids
.
length
==
0
)
{
return
[];
}
let
sql
=
[];
sql
.
push
(
`SELECT * FROM o_product WHERE id in (:productIdList)`
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
productIdList
:
ids
});
}
async
mapByIds
(
params
)
{
let
list
=
await
this
.
listByIds
(
params
);
var
result
=
{};
for
(
let
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
}
module
.
exports
=
OproductDao
;
\ No newline at end of file
xggsve-order/app/base/db/models/order/oorder.js
View file @
b5355a48
...
...
@@ -5,12 +5,12 @@
module
.
exports
=
function
(
db
,
DataTypes
)
{
return
db
.
define
(
'oorder'
,
{
merchant_id
:
{
type
:
DataTypes
.
STRING
,
field
:
'merchant_id'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'商户id, 为了兼容司机宝'
},
order_id
:
{
type
:
DataTypes
.
STRING
,
field
:
'order_id'
,
allowNull
:
true
,
comment
:
'订单ID'
},
//
order_id: {type: DataTypes.STRING, field: 'order_id', allowNull: true, comment:'订单ID' },
busi_type
:
{
type
:
DataTypes
.
STRING
,
field
:
'busi_type'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'业务类型 1个体户 2...暂不知道'
},
busi_id
:
{
type
:
DataTypes
.
STRING
,
field
:
'busi_id'
,
allowNull
:
false
,
defaultValue
:
''
,
comment
:
'业务id'
},
product_id
:
{
type
:
DataTypes
.
BIGINT
,
field
:
'product_id'
,
allowNull
:
true
,
defaultValue
:
0
,
comment
:
'产品id'
},
price
:
{
type
:
DataTypes
.
BIGINT
,
field
:
'price'
,
allowNull
:
true
,
defaultValue
:
0
,
comment
:
'订单价格'
},
status
:
{
type
:
DataTypes
.
INTEGER
,
field
:
'status'
,
allowNull
:
true
,
defaultValue
:
'0'
,
comment
:
'订单状态'
},
status
:
{
type
:
DataTypes
.
INTEGER
,
field
:
'status'
,
allowNull
:
true
,
defaultValue
:
'0'
,
comment
:
'订单状态
业务进度
'
},
assign_time
:
{
type
:
DataTypes
.
DATE
,
field
:
'assign_time'
,
allowNull
:
true
,
defaultValue
:
null
,
comment
:
'分配时间'
},
assign_user_id
:
{
type
:
DataTypes
.
BIGINT
,
field
:
'assign_user_id'
,
allowNull
:
true
,
defaultValue
:
'0'
,
comment
:
'分配人id'
},
deliver_id
:
{
type
:
DataTypes
.
STRING
,
field
:
'deliver_id'
,
allowNull
:
true
,
defaultValue
:
''
,
comment
:
'交付商id common微服务下'
},
...
...
xggsve-order/app/base/db/models/order/osource.js
View file @
b5355a48
...
...
@@ -10,7 +10,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/db/models/product/oproduct.js
View file @
b5355a48
...
...
@@ -15,7 +15,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/oorderSve.js
View file @
b5355a48
...
...
@@ -115,6 +115,159 @@ class OorderService extends ServiceBase {
}
}
/**
* 订单管理列表
* @param {*} params
*/
async
orders
(
params
){
let
where
=
{};
if
(
params
.
id
){
where
.
id
=
this
.
trim
(
params
.
id
);
}
if
(
params
.
progress
){
where
.
progress
=
this
.
trim
(
params
.
progress
);
}
if
(
params
.
beginDate
&&
params
.
endDate
){
where
.
beginDate
=
this
.
trim
(
params
.
beginDate
);
where
.
endDate
=
this
.
trim
(
params
.
endDate
);
}
if
(
params
.
deliver_id
){
where
.
deliver_id
=
this
.
trim
(
params
.
deliver_id
);
}
where
.
currentPage
=
Number
(
params
.
currentPage
||
1
);
where
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
where
.
startRow
=
(
where
.
currentPage
-
1
)
*
where
.
pageSize
;
try
{
let
ordersCountRes
=
await
this
.
dao
.
ordersCount
(
where
);
let
count
=
ordersCountRes
[
0
][
'orderCount'
];
let
rows
=
await
this
.
dao
.
findAll
(
where
);
//格式化订单来源
this
.
formateSource
(
rows
);
//格式化订单产品
this
.
formateProduct
(
rows
);
//格式化交付商
this
.
formateDeliver
(
rows
);
//格式化业务员
let
res
=
{
count
,
rows
};
return
system
.
getResult
(
res
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
/**
* 格式化列表来源数据
* @param {*} orderList
*/
async
formateSource
(
orderList
){
let
sourceIdList
=
[];
for
(
let
item
of
orderList
)
{
if
(
item
.
source_id
){
sourceIdList
.
push
(
item
.
source_id
);
}
}
let
sourceMap
=
await
this
.
osourceDao
.
mapByIds
(
sourceIdList
);
for
(
let
item
of
orderList
)
{
item
.
osource
=
sourceMap
[
item
.
source_id
]
||
{}
}
}
/**
* 格式化订单产品
* @param {*} orderList
*/
async
formateProduct
(
orderList
){
let
productIdList
=
[];
for
(
let
item
of
orderList
)
{
if
(
item
.
product_id
){
productIdList
.
push
(
item
.
product_id
);
}
}
let
productMap
=
await
this
.
oproductDao
.
mapByIds
(
productIdList
);
for
(
let
item
of
productMap
)
{
item
.
oproduct
=
productMap
[
item
.
product_id
]
||
{}
}
}
/**
* 格式化订单交付商
* @param {*} orderList
*/
async
formateDeliver
(
orderList
){
let
deliverIdList
=
[];
for
(
let
item
of
orderList
)
{
if
(
item
.
deliver_id
){
deliverIdList
.
push
(
item
.
deliver_id
);
}
}
let
deliverMap
=
await
this
.
oorderdeliverDao
.
mapByIds
(
deliverIdList
);
for
(
let
item
of
deliverMap
)
{
item
.
odeliver
=
deliverMap
[
item
.
deliver_id
]
||
{}
}
}
/**
* 分配业务员
* @param {*} params
* @id String 订单ID
* @bd_id String 业务员ID
*/
async
assignSalesman
(
params
){
if
(
!
params
.
bd_id
){
return
system
.
getResult
(
null
,
`参数错误 业务员ID不能为空`
);
}
try
{
let
_order
=
await
this
.
findById
(
params
.
id
);
_order
.
bd_id
=
this
.
trim
(
params
.
bd_id
);
let
res
=
await
_order
.
save
();
return
system
.
getResult
(
res
);
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
/**
* 分配交付商
* @param {*} params
* @id String 订单ID
*
*
*
*/
async
assignDeliver
(
params
){
//参数验证
if
(
!
params
.
id
){
return
system
.
getResult
(
null
,
`参数错误 订单ID不能为空`
);
}
if
(
!
params
.
deliver_id
){
return
system
.
getResult
(
null
,
`参数错误 交付商ID不能为空`
);
}
if
(
!
params
.
hasPropertyOne
(
deliver_divide
)){
return
system
.
getResult
(
null
,
`参数错误 订单ID不能为空`
);
}
//创建orderdeliver记录
//更新oorder订单记录
}
}
module
.
exports
=
OorderService
;
\ No newline at end of file
xggsve-order/app/base/service/impl/order/oorderdeliverSve.js
View file @
b5355a48
...
...
@@ -7,6 +7,7 @@ class OorderdeliverService extends ServiceBase {
constructor
()
{
super
(
"order"
,
ServiceBase
.
getDaoName
(
OorderdeliverService
));
}
}
...
...
xggsve-order/app/config/localsettings.js
View file @
b5355a48
...
...
@@ -6,7 +6,7 @@ var settings={
db
:
10
,
},
database
:{
dbname
:
"xgg-order"
,
dbname
:
"xgg-order
2
"
,
user
:
"write"
,
password
:
"write"
,
config
:
{
...
...
xggsve-order/app/config/routes/web.js
View file @
b5355a48
...
...
@@ -24,12 +24,12 @@ module.exports = function (app) {
return
next
();
}
if
(
!
jsonUser
)
{
res
.
end
(
JSON
.
stringify
({
status
:
-
99
,
msg
:
"no login"
}));
return
;
}
else
{
redisClient
.
setWithEx
(
xggadminsid
,
jsonUser
,
60
*
60
*
12
);
}
//
if (!jsonUser) {
//
res.end(JSON.stringify({ status: -99, msg: "no login" }));
//
return;
//
} else {
//
redisClient.setWithEx(xggadminsid, jsonUser, 60 * 60 * 12);
//
}
req
.
loginUser
=
JSON
.
parse
(
jsonUser
);
next
();
});
...
...
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