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
c553b7f0
Commit
c553b7f0
authored
Dec 07, 2019
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dd
parent
b9a0ea46
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
75 deletions
+71
-75
xggsve-order/app/base/db/impl/business/businessmenDao.js
+9
-0
xggsve-order/app/base/service/impl/business/businessmenSve.js
+0
-18
xggsve-order/app/base/service/impl/order/iborderbaseSve.js
+4
-57
xggsve-order/app/base/service/impl/order/iborderdkSve.js
+58
-0
No files found.
xggsve-order/app/base/db/impl/business/businessmenDao.js
View file @
c553b7f0
...
...
@@ -83,5 +83,13 @@ class BusinessmenDao extends Dao {
}
return
result
;
}
async
findBusinessmenByCreditCode
(
creditCode
){
try
{
return
await
this
.
dao
.
model
.
findOne
({
creditCode
:
creditCode
});
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
}
module
.
exports
=
BusinessmenDao
;
\ No newline at end of file
xggsve-order/app/base/service/impl/business/businessmenSve.js
View file @
c553b7f0
...
...
@@ -489,23 +489,5 @@ class BusinessmenService extends ServiceBase {
}
}
async
findBusinessmenByCreditCode
(
creditCode
){
try
{
if
(
!
creditCode
){
return
system
.
getResult
(
null
,
`参数错误 统一社会信用代码不能为空`
);
}
return
await
this
.
findById
(
creditCode
);
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
async
createBusinessment
(
params
){
try
{
this
.
trimObject
(
params
);
}
catch
(
error
)
{
}
}
}
module
.
exports
=
BusinessmenService
;
xggsve-order/app/base/service/impl/order/iborderbaseSve.js
View file @
c553b7f0
...
...
@@ -126,46 +126,8 @@ class IborderbaseService extends ServiceBase {
*/
async
completedOrder
(
params
)
{
try
{
//1 检查个体户是否存在 (根据统一社会信用代码查个体工商户是否存在)
this
.
trimObject
(
params
);
if
(
!
params
.
id
)
{
return
system
.
getResult
(
null
,
`参数错误 ID 不能为空`
);
}
if
(
!
params
.
legalName
)
{
return
system
.
getResult
(
null
,
`参数错误 法人姓名不能为空`
);
}
if
(
!
params
.
legalMobile
)
{
return
system
.
getResult
(
null
,
`参数错误 法人电话不能为空`
);
}
if
(
!
params
.
creditCode
)
{
return
system
.
getResult
(
null
,
`参数错误 法人统一社会信用代码不能为空`
);
}
if
(
!
params
.
names
)
{
return
system
.
getResult
(
null
,
`参数错误 个体户名称不能为空`
);
}
if
(
!
params
.
businessScope
)
{
return
system
.
getResult
(
null
,
`参数错误 经营范围不能为空`
);
}
//2 如果不存在添加保存个体户 完善信息
let
_businessmenRes
=
await
this
.
businessmenSve
.
findBusinessmenByCreditCode
(
this
.
trim
(
params
.
creditCode
));
if
(
_businessmenRes
.
hasOwnProperty
(
"status"
))
{
return
_businessmenRes
;
}
let
childSve
=
this
.
getService
(
productType
);
if
(
_businessmenRes
.
id
)
{
//如果用户存在id 直接更新
let
_iborderbase
=
await
this
.
dao
.
findById
(
this
.
trim
(
params
.
id
));
if
(
!
_iborderbase
)
{
return
system
.
getResult
(
null
,
`参数错误 订单不存在`
);
}
let
self
=
this
;
await
this
.
db
.
transaction
(
async
t
=>
{
//更新主表
await
self
.
dao
.
update
({
businessmen_id
:
self
.
trim
(
_businessmenRes
.
id
),
id
:
self
.
trim
(
params
.
id
)},
t
);
//更新子表
await
childSve
.
dao
.
update
(
params
,
null
);
});
}
else
{
let
self
=
this
;
await
this
.
db
.
transaction
(
async
t
=>
{
//如果不存在id 创建后更新
let
_businessment
=
await
this
.
businessmenSve
.
dao
.
create
(
params
,
t
);
//更新主表
await
self
.
dao
.
update
({
businessmen_id
:
self
.
trim
(
_businessment
.
id
),
id
:
self
.
trim
(
params
.
id
)},
t
);
//更新子表
await
childSve
.
dao
.
update
(
params
,
null
);
});
}
return
system
.
getResultSuccess
();
let
childSve
=
this
.
getService
();
return
await
childSve
.
completedOrder
(
params
);
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
...
...
@@ -181,15 +143,6 @@ class IborderbaseService extends ServiceBase {
}
/**
* 计算 增值税 和 附加税
* @param {*} params
*/
async
calInvoiceAmount
(
params
){
let
res
=
await
this
.
cal
}
/**
* 更新base表
* @param {*} params
*/
...
...
@@ -229,10 +182,4 @@ class IborderbaseService extends ServiceBase {
}
}
module
.
exports
=
IborderbaseService
;
// var task=new UserService();
// task.getUserStatisticGroupByApp().then(function(result){
// console.log((result));
// }).catch(function(e){
// console.log(e);
// });
\ No newline at end of file
module
.
exports
=
IborderbaseService
;
\ No newline at end of file
xggsve-order/app/base/service/impl/order/iborderdkSve.js
View file @
c553b7f0
...
...
@@ -8,6 +8,8 @@ class IborderdkService extends ServiceBase {
super
(
"order"
,
ServiceBase
.
getDaoName
(
IborderdkService
));
this
.
baseDao
=
system
.
getObject
(
"db.order.iborderbaseDao"
);
this
.
businessmenDao
=
system
.
getObject
(
"db.business.businessmenDao"
);
this
.
iborderbaseDao
=
system
.
getObject
(
"db.order.iborderbaseDao"
);
}
async
addOrder
(
params
)
{
...
...
@@ -55,6 +57,62 @@ class IborderdkService extends ServiceBase {
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
/**
* 完善信息
* @param {*} params
* legalName
* legalMobile
* names
* creditCode
* isBank
* businessScope
*/
async
completedOrder
(
params
)
{
try
{
//1 检查个体户是否存在 (根据统一社会信用代码查个体工商户是否存在)
this
.
trimObject
(
params
);
if
(
!
params
.
id
)
{
return
system
.
getResult
(
null
,
`参数错误 ID 不能为空`
);
}
if
(
!
params
.
legalName
)
{
return
system
.
getResult
(
null
,
`参数错误 法人姓名不能为空`
);
}
if
(
!
params
.
legalMobile
)
{
return
system
.
getResult
(
null
,
`参数错误 法人电话不能为空`
);
}
if
(
!
params
.
creditCode
)
{
return
system
.
getResult
(
null
,
`参数错误 法人统一社会信用代码不能为空`
);
}
if
(
!
params
.
names
)
{
return
system
.
getResult
(
null
,
`参数错误 个体户名称不能为空`
);
}
if
(
!
params
.
businessScope
)
{
return
system
.
getResult
(
null
,
`参数错误 经营范围不能为空`
);
}
//2 如果不存在添加保存个体户 完善信息
let
_businessmenRes
=
await
this
.
businessmenDao
.
findBusinessmenByCreditCode
(
this
.
trim
(
params
.
creditCode
));
if
(
_businessmenRes
.
hasOwnProperty
(
"status"
))
{
return
_businessmenRes
;
}
if
(
_businessmenRes
.
id
)
{
//如果用户存在id 直接更新
let
_iborderbase
=
await
this
.
iborderbaseDao
.
findById
(
this
.
trim
(
params
.
id
));
if
(
!
_iborderbase
)
{
return
system
.
getResult
(
null
,
`参数错误 订单不存在`
);
}
let
self
=
this
;
await
this
.
db
.
transaction
(
async
t
=>
{
//更新主表
await
self
.
iborderbaseDao
.
update
({
businessmen_id
:
self
.
trim
(
_businessmenRes
.
id
),
id
:
self
.
trim
(
params
.
id
)},
t
);
//更新子表
await
this
.
dao
.
update
(
params
,
t
);
});
}
else
{
let
self
=
this
;
await
this
.
db
.
transaction
(
async
t
=>
{
//如果不存在id 创建后更新
let
_businessment
=
await
this
.
businessmenDao
.
create
(
params
,
t
);
//更新主表
await
self
.
iborderbaseDao
.
update
({
businessmen_id
:
self
.
trim
(
_businessment
.
id
),
id
:
self
.
trim
(
params
.
id
)},
t
);
//更新子表
await
this
.
dao
.
update
(
params
,
t
);
});
}
return
system
.
getResultSuccess
();
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
}
module
.
exports
=
IborderdkService
;
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