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
72b96f35
Commit
72b96f35
authored
Feb 29, 2020
by
zhaoxiqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
61ebcf44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
38 deletions
+52
-38
bpo-web/app/base/service/impl/entcontractSve.js
+52
-38
No files found.
bpo-web/app/base/service/impl/entcontractSve.js
View file @
72b96f35
...
...
@@ -26,13 +26,15 @@ class EntcontractService extends ServiceBase {
this
.
URL
=
"http://39.106.185.66:8000/merchant/busi/reg"
;
this
.
YZKEY
=
"4a112ce87c38464d8d454caf23b7b31f"
this
.
YZKEY
=
"4a112ce87c38464d8d454caf23b7b31f"
;
this
.
YZHDURL
=
"http://bifrost-youzan-gateway.qa.s.qima-inc.com/api/auth_exempt/youzan.pay.finance.tax.sign.merchant.gsb.notify/1.0.0"
;
}
async
getAppConfig
()
{
return
{
appId
:
"1201869719607517185"
,
key
:
"bee7870e008ab144bf518b70ef91f8ac"
,
appId
:
"1201869719607517185"
,
key
:
"bee7870e008ab144bf518b70ef91f8ac"
,
}
}
...
...
@@ -204,7 +206,6 @@ class EntcontractService extends ServiceBase {
}
async
createYzMerchant
(
params
)
{
var
data
=
{
appId
:
"1202849621743763458"
,
...
...
@@ -279,17 +280,17 @@ class EntcontractService extends ServiceBase {
}
let
ecompany
=
await
this
.
ecompanyDao
.
findOne
({
"name"
:
params
.
merchantName
,
"name"
:
params
.
merchantName
,
})
if
(
!
ecompany
)
{
if
(
!
ecompany
)
{
// 创建ecompany
ecompany
=
await
this
.
ecompanyDao
.
create
({
"name"
:
params
.
merchantName
,
"nameA"
:
''
,
"isEnabled"
:
true
,
"isQuiet"
:
true
,
"sealurl"
:
""
,
"encryptkey"
:
""
,
"name"
:
params
.
merchantName
,
"nameA"
:
''
,
"isEnabled"
:
true
,
"isQuiet"
:
true
,
"sealurl"
:
""
,
"encryptkey"
:
""
,
"posturl"
:
""
});
}
...
...
@@ -299,22 +300,22 @@ class EntcontractService extends ServiceBase {
let
template
=
await
this
.
etemplateDao
.
findOne
({
ecompany_id
:
ecompany
.
id
,
});
if
(
!
template
)
{
if
(
!
template
)
{
template
=
await
this
.
etemplateDao
.
create
({
ecompany_id
:
ecompany
.
id
,
name
:
ecompany
.
name
,
templateid
:
temp
.
templateid
,
ecompany_id
:
ecompany
.
id
,
name
:
ecompany
.
name
,
templateid
:
temp
.
templateid
,
ecompanyMainId
:
temp
.
ecompanyMainId
,
nameA
:
temp
.
nameA
,
filekey
:
temp
.
filekey
,
//e签宝返回文件key
filepath
:
temp
.
filepath
,
//需要在后台补充
placeholderkey
:
temp
.
placeholderkey
,
//模板占位信息
isEnabled
:
true
,
filekey
:
temp
.
filekey
,
//e签宝返回文件key
filepath
:
temp
.
filepath
,
//需要在后台补充
placeholderkey
:
temp
.
placeholderkey
,
//模板占位信息
isEnabled
:
true
,
});
}
reso
.
data
.
ecid
=
template
.
id
;
if
(
!
erchants
.
ecid
)
{
if
(
!
erchants
.
ecid
)
{
erchants
.
ecid
=
template
.
id
;
await
erchants
.
save
();
}
...
...
@@ -323,7 +324,7 @@ class EntcontractService extends ServiceBase {
ecompany_id
:
ecompany
.
id
,
etemplate_id
:
template
.
id
,
});
if
(
!
busi
)
{
if
(
!
busi
)
{
await
this
.
ecompanybusiDao
.
create
({
ecompany_id
:
ecompany
.
id
,
etemplate_id
:
template
.
id
,
...
...
@@ -540,13 +541,13 @@ class EntcontractService extends ServiceBase {
let
merchantSign
=
await
this
.
yzmerchantsignedDao
.
findOne
({
entcontract_id
:
entcontract
.
id
,
});
if
(
!
merchantSign
)
{
if
(
!
merchantSign
)
{
return
this
.
returnjson
(
500
,
"数据错误"
);
}
let
res
=
{
code
:
0
,
msg
:
"执行成功"
,
msg
:
"执行成功"
,
data
:
{
ecid
:
merchantSign
.
ecid
,
appId
:
merchantSign
.
appId
,
...
...
@@ -706,7 +707,7 @@ class EntcontractService extends ServiceBase {
}
if
(
!
contract
.
fileurl
)
{
await
this
.
syncYzSign
(
2134
);
//
await this.syncYzSign(2134);
// 请求文件地址
let
fileRs
=
await
this
.
utilesignbaoSve
.
downloadUserContractFile
(
contract
.
eflowid
,
"econtractSve"
);
if
(
fileRs
.
code
==
1
&&
fileRs
.
data
.
selfossUrl
)
{
...
...
@@ -755,7 +756,7 @@ class EntcontractService extends ServiceBase {
// 查用户
var
user
=
await
this
.
userDao
.
findById
(
account
.
user_id
);
// 查商户签约返回值
let
signInfo
=
await
this
.
yzmerchantsignedDao
.
findOne
({
entcontract_id
:
contractId
});
let
signInfo
=
await
this
.
yzmerchantsignedDao
.
findOne
({
entcontract_id
:
contractId
});
if
(
!
signInfo
)
{
return
null
;
}
...
...
@@ -763,13 +764,13 @@ class EntcontractService extends ServiceBase {
let
conf
=
await
this
.
getAppConfig
();
// 推送数据
var
param
=
{
"appId"
:
conf
.
appId
,
// appId
"appId"
:
conf
.
appId
,
// appId
"merchantName"
:
signInfo
.
companyName
,
// 有赞商户名称
"merchantId"
:
user
.
userId3rd
,
// 有赞商户id
"fileUrl"
:
contract
.
fileurl
,
// 签约合同pdf文件
"idName"
:
account
.
userName
,
// 代理人姓名
"idNo"
:
account
.
personsSign
,
// 代理人身份证
"mobile"
:
account
.
mobile
,
//代理人手机号
"mobile"
:
account
.
mobile
,
//代理人手机号
"nonceStr"
:
await
this
.
getUidStr
(
16
),
// 随机码
"beginDate"
:
await
this
.
formateTime
(
contract
.
begin_at
),
// 合同开始时间
"endDate"
:
await
this
.
formateTime
(
contract
.
end_at
),
// 合同结束时间
...
...
@@ -785,20 +786,33 @@ class EntcontractService extends ServiceBase {
console
.
log
(
JSON
.
stringify
(
param
));
var
rs
=
""
;
try
{
var
rs
=
await
this
.
restClient
.
execPost
(
param
,
"有赞给出的回调地址"
);
if
(
rs
.
stdout
)
{
let
rsData
=
JSON
.
parse
(
rs
.
stdout
);
if
(
rsData
.
code
==
"0"
||
rsData
.
code
==
"0000"
)
{
account
.
isPush
=
true
;
account
.
save
();
}
}
return
rs
.
stdout
;
rs
=
await
axios
({
method
:
'post'
,
url
:
this
.
YZHDURL
,
data
:
param
,
headers
:
{
'X-Service-Chain'
:
{
"name"
:
"prj0015875"
}},
});
}
catch
(
error
)
{
console
.
log
(
rs
,
"push sign url
"
+
busi
.
postsignurl
,
"rs = "
+
rs
);
console
.
log
(
rs
,
"push sign url
有赞回调接口"
,
"rs = "
+
rs
);
console
.
log
(
error
);
return
"error"
;
}
// try {
// var rs = await this.restClient.execPost(param, "http://bifrost-youzan-gateway.qa.uth_exence.tax.sign.merchant.gsb.notify/1.0.");
// if (rs.stdout) {
// let rsData = JSON.parse(rs.stdout);
// if (rsData.code == "0" || rsData.code == "0000") {
// account.isPush = true;
// account.save();
// }
// }
// return rs.stdout;
// } catch (error) {
// console.log(rs, "push sign url 有赞回调接口", "rs = " + rs);
// console.log(error);
// return "error";
// }
}
async
formateTime
(
inputTime
)
{
...
...
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