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
b183e84a
Commit
b183e84a
authored
Dec 09, 2019
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
cbcc40e8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
219 additions
and
166 deletions
+219
-166
xggsve-order/app/base/db/models/order/iborderbase.js
+1
-1
xggsve-order/app/base/service/impl/order/iborderbaseSve.js
+2
-1
xggsve-order/app/base/service/impl/order/iborderdkSve.js
+178
-146
xggsve-order/app/base/service/impl/order/iborderdzSve.js
+38
-18
No files found.
xggsve-order/app/base/db/models/order/iborderbase.js
View file @
b183e84a
...
@@ -18,7 +18,7 @@ module.exports = (db, DataTypes) => {
...
@@ -18,7 +18,7 @@ module.exports = (db, DataTypes) => {
type
:
DataTypes
.
BOOLEAN
,
type
:
DataTypes
.
BOOLEAN
,
defaultValue
:
false
defaultValue
:
false
},
},
payType
:
DataTypes
.
INTEGER
,
field
:
'pay_type'
,
comment
:
'付款方式 10 按照次付费 20 按照年付费'
payType
:
{
type
:
DataTypes
.
INTEGER
,
field
:
'pay_type'
,
comment
:
'付款方式 10 按照次付费 20 按照年付费'
},
},
{
},
{
paranoid
:
true
,
//假的删除
paranoid
:
true
,
//假的删除
underscored
:
true
,
underscored
:
true
,
...
...
xggsve-order/app/base/service/impl/order/iborderbaseSve.js
View file @
b183e84a
...
@@ -97,7 +97,8 @@ class IborderbaseService extends ServiceBase {
...
@@ -97,7 +97,8 @@ class IborderbaseService extends ServiceBase {
*/
*/
async
apiCompletedOrder
(
params
)
{
async
apiCompletedOrder
(
params
)
{
try
{
try
{
let
childSve
=
this
.
getService
(
this
.
trim
(
params
.
productType
));
let
baseorder
=
await
this
.
dao
.
findById
(
params
.
id
);
let
childSve
=
this
.
getService
(
baseorder
.
productType
);
return
await
childSve
.
completedOrder
(
params
);
return
await
childSve
.
completedOrder
(
params
);
}
catch
(
error
)
{
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
...
...
xggsve-order/app/base/service/impl/order/iborderdkSve.js
View file @
b183e84a
...
@@ -3,6 +3,7 @@ const ServiceBase = require("../../sve.base")
...
@@ -3,6 +3,7 @@ const ServiceBase = require("../../sve.base")
const
settings
=
require
(
"../../../../config/settings"
)
const
settings
=
require
(
"../../../../config/settings"
)
const
moment
=
require
(
"moment"
);
const
moment
=
require
(
"moment"
);
const
calInvoice
=
require
(
"../../../utils/calInvoice"
);
const
calInvoice
=
require
(
"../../../utils/calInvoice"
);
class
IborderdkService
extends
ServiceBase
{
class
IborderdkService
extends
ServiceBase
{
constructor
()
{
constructor
()
{
super
(
"order"
,
ServiceBase
.
getDaoName
(
IborderdkService
));
super
(
"order"
,
ServiceBase
.
getDaoName
(
IborderdkService
));
...
@@ -31,8 +32,8 @@ class IborderdkService extends ServiceBase {
...
@@ -31,8 +32,8 @@ class IborderdkService extends ServiceBase {
/**
/**
* 更新数据
* 更新数据
* @param {*} params
* @param {*} params
* @param {*} t
* @param {*} t
*/
*/
async
updateOrder
(
params
,
t
)
{
async
updateOrder
(
params
,
t
)
{
try
{
try
{
...
@@ -61,14 +62,26 @@ class IborderdkService extends ServiceBase {
...
@@ -61,14 +62,26 @@ class IborderdkService extends ServiceBase {
try
{
try
{
//1 检查个体户是否存在 (根据统一社会信用代码查个体工商户是否存在)
//1 检查个体户是否存在 (根据统一社会信用代码查个体工商户是否存在)
this
.
trimObject
(
params
);
this
.
trimObject
(
params
);
if
(
!
params
.
orderId
)
{
return
system
.
getResult
(
null
,
`参数错误 ID 不能为空`
);
}
else
{
if
(
!
params
.
orderId
)
{
return
system
.
getResult
(
null
,
`参数错误 ID 不能为空`
);
}
else
{
params
.
order_id
=
this
.
trim
(
params
.
orderId
);
params
.
order_id
=
this
.
trim
(
params
.
orderId
);
}
}
if
(
!
params
.
legalName
)
{
return
system
.
getResult
(
null
,
`参数错误 法人姓名不能为空`
);
}
if
(
!
params
.
legalName
)
{
if
(
!
params
.
legalMobile
)
{
return
system
.
getResult
(
null
,
`参数错误 法人电话不能为空`
);
}
return
system
.
getResult
(
null
,
`参数错误 法人姓名不能为空`
);
if
(
!
params
.
creditCode
)
{
return
system
.
getResult
(
null
,
`参数错误 法人统一社会信用代码不能为空`
);
}
}
if
(
!
params
.
names
)
{
return
system
.
getResult
(
null
,
`参数错误 个体户名称不能为空`
);
}
if
(
!
params
.
legalMobile
)
{
if
(
!
params
.
businessScope
)
{
return
system
.
getResult
(
null
,
`参数错误 经营范围不能为空`
);
}
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 如果不存在添加保存个体户 完善信息
//2 如果不存在添加保存个体户 完善信息
let
_businessmenRes
=
await
this
.
businessmenDao
.
findBusinessmenByCreditCode
(
this
.
trim
(
params
.
creditCode
));
let
_businessmenRes
=
await
this
.
businessmenDao
.
findBusinessmenByCreditCode
(
this
.
trim
(
params
.
creditCode
));
...
@@ -82,25 +95,44 @@ class IborderdkService extends ServiceBase {
...
@@ -82,25 +95,44 @@ class IborderdkService extends ServiceBase {
return
system
.
getResult
(
null
,
`参数错误 订单不存在`
);
return
system
.
getResult
(
null
,
`参数错误 订单不存在`
);
}
}
let
self
=
this
;
let
self
=
this
;
//向参数中添加 是否完善信息标识
//向参数中添加 是否完善信息标识
// 更新字段设置
let
updateFields
=
{
businessmen_id
:
self
.
trim
(
_businessmenRes
.
id
),
id
:
self
.
trim
(
params
.
id
),
isInfoComplete
:
1
};
// 如果businessmen不存在order_id, 设置更新
if
(
!
_businessmenRes
||
!
_businessmenRes
.
order_id
)
{
updateFields
.
order_id
=
_iborderbase
.
id
;
}
await
this
.
db
.
transaction
(
async
t
=>
{
await
this
.
db
.
transaction
(
async
t
=>
{
//更新主表
//更新主表
await
self
.
iborderbaseDao
.
update
({
businessmen_id
:
self
.
trim
(
_businessmenRes
.
id
),
await
self
.
iborderbaseDao
.
update
(
updateFields
,
t
);
id
:
self
.
trim
(
params
.
order_id
),
isInfoComplete
:
1
},
t
);
//更新子表
//更新子表
params
.
id
=
self
.
trim
(
params
.
order_id
);
params
.
id
=
self
.
trim
(
params
.
order_id
);
params
.
isInfoComplete
=
1
;
params
.
isInfoComplete
=
1
;
await
self
.
dao
.
update
(
params
,
t
);
await
self
.
dao
.
update
(
params
,
t
);
});
});
}
else
{
}
else
{
delete
params
.
id
;
// 删除id, 因为这个id是 orderId
let
self
=
this
;
let
self
=
this
;
await
this
.
db
.
transaction
(
async
t
=>
{
await
this
.
db
.
transaction
(
async
t
=>
{
//如果不存在id 创建后更新
//如果不存在id 创建后更新
let
_businessment
=
await
this
.
businessmenDao
.
create
(
params
,
t
);
let
_businessment
=
await
this
.
businessmenDao
.
create
(
params
,
t
);
//更新主表
//更新主表
params
.
id
=
self
.
trim
(
params
.
orderId
);
params
.
id
=
self
.
trim
(
params
.
orderId
);
params
.
isInfoComplete
=
1
;
params
.
isInfoComplete
=
1
;
await
self
.
iborderbaseDao
.
update
({
businessmen_id
:
self
.
trim
(
_businessment
.
id
),
isInfoComplete
:
1
,
id
:
params
.
id
},
t
);
await
self
.
iborderbaseDao
.
update
({
businessmen_id
:
self
.
trim
(
_businessment
.
id
),
isInfoComplete
:
1
,
id
:
params
.
id
},
t
);
//更新子表
//更新子表
await
self
.
dao
.
update
(
params
,
t
);
await
self
.
dao
.
update
(
params
,
t
);
});
});
...
@@ -113,7 +145,7 @@ class IborderdkService extends ServiceBase {
...
@@ -113,7 +145,7 @@ class IborderdkService extends ServiceBase {
/**
/**
* 订单办理
* 订单办理
* @param {} params
* @param {} params
* businessmenId 个体户ID
* businessmenId 个体户ID
* id 订单ID
* id 订单ID
*/
*/
...
@@ -130,32 +162,32 @@ class IborderdkService extends ServiceBase {
...
@@ -130,32 +162,32 @@ class IborderdkService extends ServiceBase {
return
system
.
getResult
(
null
,
`订单未支付`
);
return
system
.
getResult
(
null
,
`订单未支付`
);
}
}
//3 判断是按照年付费还是按照月付费
//3 判断是按照年付费还是按照月付费
let
valueAddedTax
=
0
;
let
valueAddedTax
=
0
;
let
additionalTax
=
0
;
let
additionalTax
=
0
;
///**************************************************************** */
///**************************************************************** */
if
(
_iborderbase
.
payType
!=
20
)
{
if
(
_iborderbase
.
payType
!=
20
)
{
//如果不是年付费 计算费用
//如果不是年付费 计算费用
let
invoiceParams
=
await
this
.
buildParamForCalInvoice
(
params
);
let
invoiceParams
=
await
this
.
buildParamForCalInvoice
(
params
);
valueAddedTax
=
await
calInvoice
.
calculationValueAddedTax
(
invoiceParams
);
valueAddedTax
=
await
calInvoice
.
calculationValueAddedTax
(
invoiceParams
);
//填充 增值税参数
//填充 增值税参数
invoiceParams
.
valueAddedTax
=
valueAddedTax
;
invoiceParams
.
valueAddedTax
=
valueAddedTax
;
additionalTax
=
await
calInvoice
.
calculationAdditionalTax
(
invoiceParams
);
additionalTax
=
await
calInvoice
.
calculationAdditionalTax
(
invoiceParams
);
let
res
=
{
valueAddedTax
:
valueAddedTax
,
additionalTax
:
additionalTax
};
let
res
=
{
valueAddedTax
:
valueAddedTax
,
additionalTax
:
additionalTax
};
//4 推送计算结果 暂不推送
//4 推送计算结果 暂不推送
return
system
.
getResult
(
res
);
return
system
.
getResult
(
res
);
}
else
{
}
else
{
//5 如果是不是按照年付款 直接更新订单金额
//5 如果是不是按照年付款 直接更新订单金额
// let _arguments = {};
// let _arguments = {};
// _arguments.price=Number(valueAddedTax) + Number(additionalTax);
// _arguments.price=Number(valueAddedTax) + Number(additionalTax);
// let updatePriceRes =await this.updateOrder(_arguments);
// let updatePriceRes =await this.updateOrder(_arguments);
//6 提交发票申请
//6 提交发票申请
let
submitApplyInvoiceParams
=
await
this
.
buildParamForApplyInvoice
(
params
);
let
submitApplyInvoiceParams
=
await
this
.
buildParamForApplyInvoice
(
params
);
if
(
submitApplyInvoiceParams
.
hasOwnProperty
(
"status"
)
==
0
)
{
if
(
submitApplyInvoiceParams
.
hasOwnProperty
(
"status"
)
==
0
)
{
return
system
.
getResultSuccess
(
null
,
`发票申请已提交`
);
return
system
.
getResultSuccess
(
null
,
`发票申请已提交`
);
}
else
{
}
else
{
return
system
.
getResult
(
null
,
`发票申请失败`
);
return
system
.
getResult
(
null
,
`发票申请失败`
);
}
}
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -167,64 +199,64 @@ class IborderdkService extends ServiceBase {
...
@@ -167,64 +199,64 @@ class IborderdkService extends ServiceBase {
* 创建计算发票所需的参数
* 创建计算发票所需的参数
*/
*/
async
buildParamForCalInvoice
(
params
)
{
async
buildParamForCalInvoice
(
params
)
{
let
data
=
{
let
data
=
{
"businessmenCreditCode"
:
"111"
,
"businessmenCreditCode"
:
"111"
,
"businessmenType"
:
"10"
,
"businessmenType"
:
"10"
,
"calNames"
:
"valueAddedTax"
,
"calNames"
:
"valueAddedTax"
,
"valCalWay"
:
"1"
,
"valCalWay"
:
"1"
,
"businessmenId"
:
"12795594625000138"
,
"businessmenId"
:
"12795594625000138"
,
"taxIncPriRat"
:
0.03
,
"taxIncPriRat"
:
0.03
,
"invoiceTime"
:
"2019-11-26"
,
"invoiceTime"
:
"2019-11-26"
,
"invoiceAmount"
:
20000000
,
"invoiceAmount"
:
20000000
,
"perIncTaxRange"
:
[
"perIncTaxRange"
:
[
{
{
"minValue"
:
0
,
"minValue"
:
0
,
"rate"
:
"5"
,
"rate"
:
"5"
,
"quiCalDed"
:
0
,
"quiCalDed"
:
0
,
"maxValue"
:
3000000
"maxValue"
:
3000000
},
},
{
{
"minValue"
:
3000100
,
"minValue"
:
3000100
,
"rate"
:
"6"
,
"rate"
:
"6"
,
"quiCalDed"
:
200000
,
"quiCalDed"
:
200000
,
"maxValue"
:
10000000
"maxValue"
:
10000000
},
},
{
{
"minValue"
:
10000001
,
"minValue"
:
10000001
,
"rate"
:
"8"
,
"rate"
:
"8"
,
"quiCalDed"
:
0
,
"quiCalDed"
:
0
,
"maxValue"
:
214748364700
"maxValue"
:
214748364700
}
}
],
],
"valAddTaxRange"
:
[
"valAddTaxRange"
:
[
{
{
"minValue"
:
0
,
"minValue"
:
0
,
"zengzhiRate"
:
"3"
,
"zengzhiRate"
:
"3"
,
"fujiaRate"
:
"12"
,
"fujiaRate"
:
"12"
,
"maxValue"
:
3000000
"maxValue"
:
3000000
},
},
{
{
"minValue"
:
3000100
,
"minValue"
:
3000100
,
"zengzhiRate"
:
"3"
,
"zengzhiRate"
:
"3"
,
"fujiaRate"
:
"15"
,
"fujiaRate"
:
"15"
,
"maxValue"
:
10000000
"maxValue"
:
10000000
},
},
{
{
"minValue"
:
10000001
,
"minValue"
:
10000001
,
"zengzhiRate"
:
"4"
,
"zengzhiRate"
:
"4"
,
"fujiaRate"
:
"16"
,
"fujiaRate"
:
"16"
,
"maxValue"
:
214748364700
"maxValue"
:
214748364700
}
}
]
]
}
}
return
data
;
return
data
;
}
}
/**
/**
* 创建申请发票所需的参数
* 创建申请发票所需的参数
* @param {*} params
* @param {*} params
*/
*/
async
buildParamForApplyInvoice
(
params
){
async
buildParamForApplyInvoice
(
params
)
{
let
data
=
{
let
data
=
{
"serviceRate"
:
4
,
"serviceRate"
:
4
,
"perCalWay"
:
"1"
,
"perCalWay"
:
"1"
,
...
@@ -233,118 +265,118 @@ class IborderdkService extends ServiceBase {
...
@@ -233,118 +265,118 @@ class IborderdkService extends ServiceBase {
"taxIncPriRat"
:
1.50
,
"taxIncPriRat"
:
1.50
,
"invoiceTime"
:
"2019-10-19"
,
"invoiceTime"
:
"2019-10-19"
,
"perIncTaxRange"
:
[
"perIncTaxRange"
:
[
{
{
"minValue"
:
0
,
"minValue"
:
0
,
"rate"
:
"1"
,
"rate"
:
"1"
,
"quiCalDed"
:
100000
,
"quiCalDed"
:
100000
,
"maxValue"
:
3000000
"maxValue"
:
3000000
},
},
{
{
"minValue"
:
3000100
,
"minValue"
:
3000100
,
"rate"
:
"1.5"
,
"rate"
:
"1.5"
,
"quiCalDed"
:
200000
,
"quiCalDed"
:
200000
,
"maxValue"
:
10000000
"maxValue"
:
10000000
},
},
{
{
"minValue"
:
10000001
,
"minValue"
:
10000001
,
"rate"
:
"4.86"
,
"rate"
:
"4.86"
,
"quiCalDed"
:
300000
,
"quiCalDed"
:
300000
,
"maxValue"
:
214748364700
"maxValue"
:
214748364700
}
}
],
],
"valAddTaxRange"
:
[
"valAddTaxRange"
:
[
{
{
"minValue"
:
0
,
"minValue"
:
0
,
"zengzhiRate"
:
"1"
,
"zengzhiRate"
:
"1"
,
"fujiaRate"
:
"6"
,
"fujiaRate"
:
"6"
,
"maxValue"
:
3000000
"maxValue"
:
3000000
},
},
{
{
"minValue"
:
3000100
,
"minValue"
:
3000100
,
"zengzhiRate"
:
"2"
,
"zengzhiRate"
:
"2"
,
"fujiaRate"
:
"8"
,
"fujiaRate"
:
"8"
,
"maxValue"
:
10000000
"maxValue"
:
10000000
},
},
{
{
"minValue"
:
10000001
,
"minValue"
:
10000001
,
"zengzhiRate"
:
"3"
,
"zengzhiRate"
:
"3"
,
"fujiaRate"
:
"12"
,
"fujiaRate"
:
"12"
,
"maxValue"
:
214748364700
"maxValue"
:
214748364700
}
}
],
],
"merchantId"
:
"11064622752480055"
,
"merchantId"
:
"11064622752480055"
,
"merchantAccount"
:
"driverBabyPublicAccount"
,
"merchantAccount"
:
"driverBabyPublicAccount"
,
"merchantName"
:
"司机宝"
,
"merchantName"
:
"司机宝"
,
"merchantCreditCode"
:
"91110108MA008KB56P"
,
"merchantCreditCode"
:
"91110108MA008KB56P"
,
"merchantAddr"
:
"北京市海淀区北太平庄路18号3层3-0227"
,
"merchantAddr"
:
"北京市海淀区北太平庄路18号3层3-0227"
,
"merchantMobile"
:
"010-5369854"
,
"merchantMobile"
:
"010-5369854"
,
"merchantBank"
:
"110108022130868"
,
"merchantBank"
:
"110108022130868"
,
"businessmenId"
:
"110115023996882"
,
"businessmenId"
:
"110115023996882"
,
"businessmenCreditCode"
:
"91110115MA00HDC44L"
,
"businessmenCreditCode"
:
"91110115MA00HDC44L"
,
"businessName"
:
"北京富通勤国际贸易有限责任公司(个体工商)"
,
"businessName"
:
"北京富通勤国际贸易有限责任公司(个体工商)"
,
"isBank"
:
1
,
"isBank"
:
1
,
"taxAuthorities"
:
"北京大兴税务局"
,
"taxAuthorities"
:
"北京大兴税务局"
,
"type"
:
20
,
"type"
:
20
,
"invoiceAmount"
:
4000000
,
"invoiceAmount"
:
4000000
,
"statements"
:
"wwww.baidu.com"
,
"statements"
:
"wwww.baidu.com"
,
"contract"
:
"www.qq.com"
,
"contract"
:
"www.qq.com"
,
"applyNo"
:
"gongsibao-futong001"
,
"applyNo"
:
"gongsibao-futong001"
,
"isInvalid"
:
2
,
"isInvalid"
:
2
,
"parentId"
:
null
,
"parentId"
:
null
,
"status"
:
"1000"
,
"status"
:
"1000"
,
"customerStatus"
:
"1000"
,
"customerStatus"
:
"1000"
,
"payWay"
:
"20"
,
"payWay"
:
"20"
,
"payAccount"
:
null
,
"payAccount"
:
null
,
"isPay"
:
1
,
"isPay"
:
1
,
"mailAddr"
:
"北京市海淀区北太平庄路18号3层3-0227"
,
"mailAddr"
:
"北京市海淀区北太平庄路18号3层3-0227"
,
"mailMobile"
:
"18633923636"
,
"mailMobile"
:
"18633923636"
,
"mailTo"
:
"赵彩红"
"mailTo"
:
"赵彩红"
}
}
return
data
;
return
data
;
}
}
/**
/**
* 更新订单金额 、订单的状态
* 更新订单金额 、订单的状态
* @param {*} params
* @param {*} params
* id 订单的ID
* id 订单的ID
* price 订单的金额
* price 订单的金额
* status 订单的状态
* status 订单的状态
* orderpay_id 订单的支付Id
* orderpay_id 订单的支付Id
*/
*/
async
updateOrder
(
params
){
async
updateOrder
(
params
)
{
try
{
try
{
if
(
!
params
.
id
)
{
if
(
!
params
.
id
)
{
return
system
.
getResult
(
null
,
`参数错误 ID不能为空`
);
return
system
.
getResult
(
null
,
`参数错误 ID不能为空`
);
}
}
let
_iborderbase
=
await
this
.
iborderbaseDao
.
findById
(
this
.
trim
(
params
.
id
));
let
_iborderbase
=
await
this
.
iborderbaseDao
.
findById
(
this
.
trim
(
params
.
id
));
if
(
!
_iborderbase
)
{
if
(
!
_iborderbase
)
{
return
system
.
getResult
(
null
,
`订单不存在`
);
return
system
.
getResult
(
null
,
`订单不存在`
);
}
}
let
_iborderdk
=
await
this
.
_ibOrderDk
.
findById
(
this
.
trim
(
params
.
id
));
let
_iborderdk
=
await
this
.
_ibOrderDk
.
findById
(
this
.
trim
(
params
.
id
));
if
(
!
_iborderdk
)
{
if
(
!
_iborderdk
)
{
return
system
.
getResult
(
null
,
`订单不存在`
);
return
system
.
getResult
(
null
,
`订单不存在`
);
}
}
let
updateDate
=
{};
let
updateDate
=
{};
if
(
params
.
status
)
{
if
(
params
.
status
)
{
updateDate
.
status
=
this
.
trim
(
params
.
status
);
updateDate
.
status
=
this
.
trim
(
params
.
status
);
}
}
if
(
params
.
price
)
{
if
(
params
.
price
)
{
updateDate
.
price
=
Number
(
params
.
price
||
0
);
updateDate
.
price
=
Number
(
params
.
price
||
0
);
}
}
if
(
params
.
orderpay_id
)
{
if
(
params
.
orderpay_id
)
{
updateDate
.
orderpay_id
=
this
.
trim
(
params
.
orderpay_id
);
updateDate
.
orderpay_id
=
this
.
trim
(
params
.
orderpay_id
);
}
}
let
self
=
this
;
let
self
=
this
;
let
res
=
await
this
.
dao
.
db
.
transaction
(
async
t
=>
{
let
res
=
await
this
.
dao
.
db
.
transaction
(
async
t
=>
{
//更新主表
//更新主表
await
self
.
_iborderbase
.
dao
.
update
(
updateDate
,
t
);
await
self
.
_iborderbase
.
dao
.
update
(
updateDate
,
t
);
//更新子表
//更新子表
await
self
.
dao
.
update
(
updateDate
,
t
);
await
self
.
dao
.
update
(
updateDate
,
t
);
});
});
return
system
.
getResult
(
res
);
return
system
.
getResult
(
res
);
}
catch
(
error
)
{
}
catch
(
error
)
{
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
}
}
...
...
xggsve-order/app/base/service/impl/order/iborderdzSve.js
View file @
b183e84a
...
@@ -67,48 +67,68 @@ class IborderdzService extends ServiceBase {
...
@@ -67,48 +67,68 @@ class IborderdzService extends ServiceBase {
try
{
try
{
//1 检查个体户是否存在 (根据统一社会信用代码查个体工商户是否存在)
//1 检查个体户是否存在 (根据统一社会信用代码查个体工商户是否存在)
this
.
trimObject
(
params
);
this
.
trimObject
(
params
);
if
(
!
params
.
id
)
{
return
system
.
getResult
(
null
,
`参数错误 ID 不能为空`
);
}
if
(
!
params
.
id
)
{
if
(
!
params
.
legalName
)
{
return
system
.
getResult
(
null
,
`参数错误 法人姓名不能为空`
);
}
return
system
.
getResult
(
null
,
`参数错误 ID 不能为空`
);
if
(
!
params
.
legalMobile
)
{
return
system
.
getResult
(
null
,
`参数错误 法人电话不能为空`
);
}
}
if
(
!
params
.
creditCode
)
{
return
system
.
getResult
(
null
,
`参数错误 法人统一社会信用代码不能为空`
);
}
if
(
!
params
.
legalName
)
{
if
(
!
params
.
names
)
{
return
system
.
getResult
(
null
,
`参数错误 个体户名称不能为空`
);
}
return
system
.
getResult
(
null
,
`参数错误 法人姓名不能为空`
);
if
(
!
params
.
businessScope
)
{
return
system
.
getResult
(
null
,
`参数错误 经营范围不能为空`
);
}
}
if
(
!
params
.
legalMobile
)
{
//2 如果不存在添加保存个体户 完善信息
return
system
.
getResult
(
null
,
`参数错误 法人电话不能为空`
);
let
_businessmenRes
=
await
this
.
businessmenDao
.
findBusinessmenByCreditCode
(
this
.
trim
(
params
.
creditCode
));
if
(
_businessmenRes
.
hasOwnProperty
(
"status"
))
{
return
_businessmenRes
;
}
}
if
(
_businessmenRes
.
id
)
{
if
(
!
params
.
creditCode
)
{
//如果用户存在id 直接更新
return
system
.
getResult
(
null
,
`参数错误 法人统一社会信用代码不能为空`
);
}
if
(
!
params
.
names
)
{
return
system
.
getResult
(
null
,
`参数错误 个体户名称不能为空`
);
}
if
(
!
params
.
businessScope
)
{
return
system
.
getResult
(
null
,
`参数错误 经营范围不能为空`
);
}
params
.
order_id
=
params
.
id
;
//2 如果不存在添加保存个体户 完善信息
let
_businessmen
=
await
this
.
businessmenDao
.
findOne
({
creditCode
:
this
.
trim
(
params
.
creditCode
)});
if
(
_businessmen
)
{
//如果用户存在 直接更新
let
_iborderbase
=
await
this
.
iborderbaseDao
.
findById
(
this
.
trim
(
params
.
id
));
let
_iborderbase
=
await
this
.
iborderbaseDao
.
findById
(
this
.
trim
(
params
.
id
));
if
(
!
_iborderbase
)
{
if
(
!
_iborderbase
)
{
return
system
.
getResult
(
null
,
`参数错误 订单不存在`
);
return
system
.
getResult
(
null
,
`参数错误 订单不存在`
);
}
}
let
self
=
this
;
let
self
=
this
;
//向参数中添加 是否完善信息标识
//向参数中添加 是否完善信息标识
params
.
isInfoComplete
=
1
;
params
.
isInfoComplete
=
1
;
var
updateFields
=
{
businessmen_id
:
self
.
trim
(
_businessmen
.
id
),
id
:
self
.
trim
(
params
.
id
),
isInfoComplete
:
1
};
if
(
!
_businessmen
||
!
_businessmen
.
order_id
)
{
updateFields
.
order_id
=
_iborderbase
.
id
;
}
await
this
.
db
.
transaction
(
async
t
=>
{
await
this
.
db
.
transaction
(
async
t
=>
{
//更新主表
//更新主表
await
self
.
iborderbaseDao
.
update
({
businessmen_id
:
self
.
trim
(
_businessmenRes
.
id
),
await
self
.
iborderbaseDao
.
update
(
updateFields
,
t
);
id
:
self
.
trim
(
params
.
id
),
isInfoComplete
:
1
},
t
);
//更新子表
//更新子表
await
this
.
dao
.
update
(
params
,
t
);
await
this
.
dao
.
update
(
params
,
t
);
});
});
}
else
{
}
else
{
delete
params
.
id
;
let
self
=
this
;
let
self
=
this
;
await
this
.
db
.
transaction
(
async
t
=>
{
await
this
.
db
.
transaction
(
async
t
=>
{
//如果不存在id 创建后更新
//如果不存在id 创建后更新
let
_businessment
=
await
this
.
businessmenDao
.
create
(
params
,
t
);
let
_businessment
=
await
this
.
businessmenDao
.
create
(
params
,
t
);
//更新主表
//更新主表
await
self
.
iborderbaseDao
.
update
({
businessmen_id
:
self
.
trim
(
_businessment
.
id
),
id
:
self
.
trim
(
params
.
id
),
await
self
.
iborderbaseDao
.
update
({
isInfoComplete
:
1
},
t
);
businessmen_id
:
self
.
trim
(
_businessment
.
id
),
id
:
self
.
trim
(
params
.
id
),
isInfoComplete
:
1
},
t
);
//更新子表
//更新子表
await
this
.
dao
.
update
(
params
,
t
);
await
this
.
dao
.
update
(
params
,
t
);
});
});
}
}
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
return
system
.
getResult
(
null
,
`系统错误 错误信息
${
error
}
`
);
}
}
}
}
...
...
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