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
8d2d9283
Commit
8d2d9283
authored
Mar 21, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
6f5182bb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
454 additions
and
0 deletions
+454
-0
xggsve-order/app/base/api/impl/op/action.js
+14
-0
xggsve-order/app/base/db/impl/saas/saasorderDao.js
+114
-0
xggsve-order/app/base/db/impl/saas/saasorderbminfoDao.js
+84
-0
xggsve-order/app/base/db/models/saas/saasorder.js
+65
-0
xggsve-order/app/base/db/models/saas/saasorderbminfo.js
+69
-0
xggsve-order/app/base/service/impl/saas/saasorderSve.js
+108
-0
No files found.
xggsve-order/app/base/api/impl/op/action.js
View file @
8d2d9283
...
@@ -21,6 +21,9 @@ class ActionAPI extends APIBase {
...
@@ -21,6 +21,9 @@ class ActionAPI extends APIBase {
this
.
oprocessSve
=
system
.
getObject
(
"service.product.oprocessSve"
);
this
.
oprocessSve
=
system
.
getObject
(
"service.product.oprocessSve"
);
this
.
oproductSve
=
system
.
getObject
(
"service.product.oproductSve"
);
this
.
oproductSve
=
system
.
getObject
(
"service.product.oproductSve"
);
this
.
obusinessmenSve
=
system
.
getObject
(
"service.order.obusinessmenSve"
);
this
.
obusinessmenSve
=
system
.
getObject
(
"service.order.obusinessmenSve"
);
this
.
saasorderSve
=
system
.
getObject
(
"service.saas.saasorderSve"
);
}
}
/**
/**
* 接口跳转
* 接口跳转
...
@@ -114,6 +117,17 @@ class ActionAPI extends APIBase {
...
@@ -114,6 +117,17 @@ class ActionAPI extends APIBase {
case
"businessManagement"
:
//业务办理
case
"businessManagement"
:
//业务办理
opResult
=
await
this
.
oorderdeliverSve
.
businessManagement
(
action_body
);
opResult
=
await
this
.
oorderdeliverSve
.
businessManagement
(
action_body
);
break
;
break
;
//*****************************个体宝saas*************************************** */
case
"saasOrderMicroAdd"
:
// 小程序下单
opResult
=
await
this
.
saasorderSve
.
microAdd
(
action_body
);
break
;
case
"saasOrderInfo"
:
// 订单信息
opResult
=
await
this
.
saasorderSve
.
info
(
action_body
);
break
;
case
"saasOrderPage"
:
// 订单信息
opResult
=
await
this
.
saasorderSve
.
pageByCondition
(
action_body
);
break
;
//******************************************************************** */
//******************************************************************** */
// // 订单
// // 订单
...
...
xggsve-order/app/base/db/impl/saas/saasorderDao.js
0 → 100644
View file @
8d2d9283
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
SaasOrderDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
SaasOrderDao
));
}
async
countByCondition
(
params
)
{
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"count(1) as num"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
"saas_order t1"
);
sql
.
push
(
"INNER JOIN `saas_order_bminfo` t2 ON t1.`id` = t2.`id`"
);
sql
.
push
(
"WHERE t1.deleted_at IS NULL"
);
this
.
setCondition
(
sql
,
params
);
var
list
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
if
(
!
list
||
list
.
length
==
0
)
{
return
0
;
}
return
list
[
0
].
num
;
}
async
listByCondition
(
params
)
{
params
.
startRow
=
Number
(
params
.
startRow
||
0
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"t1.*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
"saas_order t1"
);
sql
.
push
(
"INNER JOIN `saas_order_bminfo` t2 ON t1.`id` = t2.`id`"
);
sql
.
push
(
"WHERE t1.deleted_at IS NULL"
);
this
.
setCondition
(
sql
,
params
);
sql
.
push
(
"ORDER BY t1.id DESC"
);
sql
.
push
(
"LIMIT :startRow, :pageSize"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
setCondition
(
sql
,
params
)
{
if
(
!
params
||
!
sql
)
{
return
;
}
if
(
params
.
saas_id
)
{
sql
.
push
(
"AND t1.saas_id = :saas_id"
);
}
if
(
params
.
merchant_id
)
{
sql
.
push
(
"AND t1.merchant_id = :merchant_id"
);
}
if
(
params
.
pay_status
)
{
sql
.
push
(
"AND t1.pay_status = :pay_status"
);
}
if
(
params
.
audit_status
)
{
sql
.
push
(
"AND t1.audit_status = :audit_status"
);
}
if
(
params
.
saas_merchant_id
)
{
sql
.
push
(
"AND t1.merchant_id = :saas_merchant_id"
);
}
if
(
params
.
createBegin
)
{
sql
.
push
(
"AND t1.created_at >= :createBegin"
);
}
if
(
params
.
createEnd
)
{
sql
.
push
(
"AND t1.created_at <= :createEnd"
);
}
if
(
params
.
legal_idno
)
{
sql
.
push
(
"AND t2.legal_idno = :legal_idno"
);
}
if
(
params
.
merchant_app_user_id
)
{
sql
.
push
(
"AND t2.merchant_app_user_id = :merchant_app_user_id"
);
}
}
async
mapByIds
(
ids
,
attrs
)
{
let
result
=
{};
if
(
!
ids
||
ids
.
length
==
0
)
{
return
result
;
}
let
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
attrs
||
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE id IN (:ids)"
);
var
list
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
ids
:
ids
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
}
module
.
exports
=
SaasOrderDao
;
\ No newline at end of file
xggsve-order/app/base/db/impl/saas/saasorderbminfoDao.js
0 → 100644
View file @
8d2d9283
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
SaasOrderBmInfoDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
SaasOrderBmInfoDao
));
}
async
countByCondition
(
params
)
{
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"count(1) as num"
);
sql
.
push
(
"FROM "
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE deleted_at IS NULL"
);
this
.
setCondition
(
sql
,
params
);
var
list
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
if
(
!
list
||
list
.
length
==
0
)
{
return
0
;
}
return
list
[
0
].
num
;
}
async
listByCondition
(
params
)
{
params
.
startRow
=
Number
(
params
.
startRow
||
0
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE deleted_at IS NULL"
);
this
.
setCondition
(
sql
,
params
);
sql
.
push
(
"ORDER BY id DESC"
);
sql
.
push
(
"LIMIT :startRow, :pageSize"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
setCondition
(
sql
,
params
)
{
if
(
!
params
||
!
sql
)
{
return
;
}
if
(
params
.
createBegin
)
{
sql
.
push
(
"AND created_at >= :createBegin"
);
}
if
(
params
.
createEnd
)
{
sql
.
push
(
"AND created_at <= :createEnd"
);
}
}
async
mapByIds
(
ids
,
attrs
)
{
let
result
=
{};
if
(
!
ids
||
ids
.
length
==
0
)
{
return
result
;
}
let
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
attrs
||
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE id IN (:ids)"
);
var
list
=
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
ids
:
ids
});
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
}
module
.
exports
=
SaasOrderBmInfoDao
;
\ No newline at end of file
xggsve-order/app/base/db/models/saas/saasorder.js
0 → 100644
View file @
8d2d9283
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"saasorder"
,
{
saas_id
:
DataTypes
.
STRING
,
merchant_id
:
DataTypes
.
STRING
,
channel_id
:
DataTypes
.
STRING
,
product_id
:
DataTypes
.
STRING
,
deliver_order_id
:
DataTypes
.
STRING
,
merchant_app_user_id
:
DataTypes
.
STRING
,
price
:
DataTypes
.
BIGINT
,
pay_status
:
DataTypes
.
STRING
,
pay_voucher_img
:
DataTypes
.
STRING
,
audit_status
:
DataTypes
.
STRING
,
audit_remark
:
DataTypes
.
STRING
,
handle_status
:
DataTypes
.
STRING
,
deliver_man
:
DataTypes
.
STRING
,
deliver_mobile
:
DataTypes
.
STRING
,
deliver_addr
:
DataTypes
.
STRING
,
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'saas_order'
,
validate
:
{
},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
\ No newline at end of file
xggsve-order/app/base/db/models/saas/saasorderbminfo.js
0 → 100644
View file @
8d2d9283
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"saasorderbminfo"
,
{
merchant_id
:
DataTypes
.
STRING
,
channel_id
:
DataTypes
.
STRING
,
idcard_front
:
DataTypes
.
STRING
,
idcard_back
:
DataTypes
.
STRING
,
legal_name
:
DataTypes
.
STRING
,
legal_mobile
:
DataTypes
.
STRING
,
legal_idno
:
DataTypes
.
STRING
,
company_names
:
DataTypes
.
STRING
,
bank_front
:
DataTypes
.
STRING
,
bank_back
:
DataTypes
.
STRING
,
bank_name
:
DataTypes
.
STRING
,
bank_no
:
DataTypes
.
STRING
,
bank_mobile
:
DataTypes
.
STRING
,
domicile_id
:
DataTypes
.
STRING
,
domicile_name
:
DataTypes
.
STRING
,
business_scope_id
:
DataTypes
.
STRING
,
business_type
:
DataTypes
.
STRING
,
business_scope
:
DataTypes
.
STRING
,
bankfour
:
DataTypes
.
INTEGER
,
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'saas_order_bminfo'
,
validate
:
{
},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
\ No newline at end of file
xggsve-order/app/base/service/impl/saas/saasorderSve.js
0 → 100644
View file @
8d2d9283
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
)
const
settings
=
require
(
"../../../../config/settings"
)
class
SaasOrderService
extends
ServiceBase
{
constructor
()
{
super
(
"saas"
,
ServiceBase
.
getDaoName
(
SaasOrderService
));
this
.
saasorderbminfoDao
=
system
.
getObject
(
"db.saas.saasorderbminfoDao"
);
}
// -----------------------以此间隔,上面为API,下面为service---------------------------------
async
info
(
params
)
{
if
(
!
params
.
id
)
{
return
system
.
getResult
(
null
,
"id不存在"
);
}
let
order
=
await
this
.
dao
.
getById
(
params
.
id
);
if
(
!
order
)
{
return
system
.
getResult
(
null
,
"订单不存在"
);
}
order
.
bminfo
=
await
this
.
saasorderbminfoDao
.
getById
(
params
.
id
);
this
.
handleDate
(
order
,
[
"created_at"
],
null
,
-
8
);
return
system
.
getResultSuccess
(
order
);
}
async
microAdd
(
params
)
{
let
saas_id
=
this
.
trim
(
params
.
saas_id
);
let
merchant_id
=
this
.
trim
(
params
.
merchant_id
);
let
product_id
=
this
.
trim
(
params
.
product_id
);
let
merchant_app_user_id
=
this
.
trim
(
params
.
merchant_app_user_id
);
let
price
=
Number
(
params
.
price
||
0
);
let
bminfo
=
params
.
bminfo
;
let
order
=
{
saas_id
:
saas_id
,
merchant_id
:
merchant_id
,
product_id
:
product_id
,
merchant_app_user_id
:
merchant_app_user_id
,
price
:
price
,
pay_status
:
10
,
audit_status
:
10
,
}
let
self
=
this
;
order
=
await
this
.
db
.
transaction
(
async
t
=>
{
//创建orderdeliver记录
order
=
await
self
.
dao
.
create
(
order
,
t
);
//更新oorder订单记录
bminfo
.
id
=
order
.
id
;
await
self
.
saasorderbminfoDao
.
create
(
bminfo
,
t
);
return
order
;
});
return
system
.
getResultSuccess
(
order
);
}
async
pageByCondition
(
params
)
{
let
page
=
{
count
:
0
,
rows
:
[]
}
params
.
currentPage
=
Number
(
params
.
currentPage
||
1
);
params
.
pageSize
=
Number
(
params
.
pageSize
||
10
);
params
.
startRow
=
(
params
.
currentPage
-
1
)
*
params
.
pageSize
;
page
.
total
=
await
this
.
dao
.
countByCondition
(
params
);
if
(
page
.
total
==
0
)
{
return
system
.
getResultSuccess
(
page
);
}
page
.
rows
=
await
this
.
dao
.
listByCondition
(
params
);
if
(
page
.
rows
)
{
for
(
var
row
of
page
.
rows
)
{
this
.
handleDate
(
row
,
[
"created_at"
],
null
,
-
8
);
}
await
this
.
setBminfo
(
page
.
rows
);
}
return
system
.
getResultSuccess
(
page
);
}
async
mapByIds
(
params
)
{
if
(
!
params
.
ids
||
params
.
ids
.
length
==
0
)
{
return
system
.
getResultSuccess
({});
}
let
rs
=
await
this
.
dao
.
mapByIds
(
params
.
ids
);
return
system
.
getResultSuccess
(
rs
);
}
async
setBminfo
(
rows
)
{
if
(
!
rows
||
rows
.
length
==
0
)
{
return
;
}
let
ids
=
[];
for
(
let
row
of
rows
)
{
ids
.
push
(
row
.
id
);
}
let
map
=
await
this
.
saasorderbminfoDao
.
mapByIds
(
ids
)
||
{};
for
(
let
row
of
rows
)
{
row
.
bminfo
=
map
[
row
.
id
]
||
{};
}
}
}
module
.
exports
=
SaasOrderService
;
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