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
cf0a880e
Commit
cf0a880e
authored
Feb 28, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
ea4cbcdc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
2 deletions
+77
-2
bpo-web/app/base/db/models/entcontract.js
+4
-0
bpo-web/app/base/service/impl/entcontractSve.js
+73
-2
No files found.
bpo-web/app/base/db/models/entcontract.js
View file @
cf0a880e
...
...
@@ -33,6 +33,10 @@ module.exports = (db, DataTypes) => {
begin_at
:
DataTypes
.
DATE
,
end_at
:
DataTypes
.
DATE
,
isPush
:
{
type
:
DataTypes
.
BOOLEAN
,
defaultValue
:
true
},
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
...
...
bpo-web/app/base/service/impl/entcontractSve.js
View file @
cf0a880e
...
...
@@ -29,6 +29,13 @@ class EntcontractService extends ServiceBase {
this
.
YZKEY
=
"4a112ce87c38464d8d454caf23b7b31f"
}
async
getAppConfig
()
{
return
{
appId
:
"1201869719607517185"
,
key
:
"bee7870e008ab144bf518b70ef91f8ac"
,
}
}
async
autoSign
(
params
)
{
var
ecid
=
params
.
ecid
;
var
unionId
=
params
.
appId
+
"_"
+
params
.
userId
;
...
...
@@ -705,13 +712,15 @@ class EntcontractService extends ServiceBase {
let
fileRs
=
await
this
.
utilesignbaoSve
.
downloadUserContractFile
(
contract
.
eflowid
,
"econtractSve"
);
if
(
fileRs
.
code
==
1
&&
fileRs
.
data
.
selfossUrl
)
{
contract
.
fileurl
=
fileRs
.
data
.
selfossUrl
;
contract
.
save
();
await
contract
.
save
();
this
.
syncYzSign
();
}
else
{
await
this
.
utilesignbaoSve
.
archiveProcess
({
flowId
:
contract
.
eflowid
},
"econtractSve"
);
let
fileRs
=
await
this
.
utilesignbaoSve
.
downloadUserContractFile
(
contract
.
eflowid
,
"econtractSve"
);
if
(
fileRs
.
code
==
1
&&
fileRs
.
data
.
selfossUrl
)
{
contract
.
fileurl
=
fileRs
.
data
.
selfossUrl
;
contract
.
save
();
await
contract
.
save
();
this
.
syncYzSign
();
}
}
}
...
...
@@ -732,6 +741,67 @@ class EntcontractService extends ServiceBase {
}
}
}
async
syncYzSign
(
contractId
)
{
// 查询合同
var
contract
=
await
this
.
dao
.
findById
(
contractId
);
if
(
!
contract
)
{
return
null
;
}
// 查代理人
var
account
=
await
this
.
usereaccountDao
.
findById
(
contract
.
usereaccount_id
);
if
(
!
account
)
{
return
null
;
}
// 查用户
var
user
=
await
this
.
userDao
.
findById
(
account
.
user_id
);
// 查商户签约返回值
let
signInfo
=
this
.
yzmerchantsignedDao
.
findOne
({
entcontract_id
:
contractId
});
// 获取yz配置
let
conf
=
this
.
getAppConfig
();
// 推送数据
var
param
=
{
"appId"
:
conf
.
appId
,
// appId
"merchantName"
:
signInfo
.
companyName
,
// 有赞商户名称
"merchantId"
:
user
.
userId3rd
,
// 有赞商户id
"fileUrl"
:
contract
.
fileurl
,
// 签约合同pdf文件
"idName"
:
account
.
userName
,
// 代理人姓名
"idNo"
:
account
.
personsSign
,
// 代理人身份证
"nonceStr"
:
await
this
.
getUidStr
(
16
),
// 随机码
"beginDate"
:
await
this
.
formateTime
(
contract
.
begin_at
),
// 合同开始时间
"endDate"
:
await
this
.
formateTime
(
contract
.
end_at
),
// 合同结束时间
}
// 签名
var
signArr
=
[];
signArr
.
push
(
"appId="
+
param
.
appId
);
// ...补全签名信息
signArr
.
push
(
"nonceStr="
+
param
.
nonceStr
);
signArr
.
push
(
"key="
+
busi
.
key
);
param
.
sign
=
md5
(
signArr
.
join
(
"&"
)).
toUpperCase
();
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
;
}
catch
(
error
)
{
console
.
log
(
rs
,
"push sign url "
+
busi
.
postsignurl
,
"rs = "
+
rs
);
console
.
log
(
error
);
return
"error"
;
}
}
}
module
.
exports
=
EntcontractService
;
\ No newline at end of file
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