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
4a9870f1
Commit
4a9870f1
authored
Oct 10, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
334b21c2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
222 additions
and
3 deletions
+222
-3
bpo-web/app/base/api/impl/innerApi.js
+133
-2
bpo-web/app/base/db/models/dkcontract.js
+2
-0
bpo-web/app/base/service/impl/dkcontractSve.js
+84
-1
bpo-web/app/base/service/impl/utilesignbaoSve.js
+3
-0
No files found.
bpo-web/app/base/api/impl/innerApi.js
View file @
4a9870f1
...
@@ -8,7 +8,7 @@ class innerApi {
...
@@ -8,7 +8,7 @@ class innerApi {
constructor
()
{
constructor
()
{
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
this
.
redisLock
=
system
.
getObject
(
"util.redisLock"
);
this
.
redisLock
=
system
.
getObject
(
"util.redisLock"
);
this
.
utilesignbaoSve
=
system
.
getObject
(
"service.utilesignbaoSve"
);
this
.
userSve
=
system
.
getObject
(
"service.userSve"
);
this
.
userSve
=
system
.
getObject
(
"service.userSve"
);
this
.
usereaccountSve
=
system
.
getObject
(
"service.usereaccountSve"
);
this
.
usereaccountSve
=
system
.
getObject
(
"service.usereaccountSve"
);
...
@@ -200,7 +200,7 @@ class innerApi {
...
@@ -200,7 +200,7 @@ class innerApi {
return
await
this
.
dkcontractSve
.
appAutoSign
({
return
await
this
.
dkcontractSve
.
appAutoSign
({
ecid
:
etemplateBusi
.
template_id
,
ecid
:
etemplateBusi
.
template_id
,
usereaccountId
:
accountId
,
usereaccountId
:
accountId
,
forceFace
:
tru
e
forceFace
:
fals
e
});
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
"innerApi-autoSign error"
,
e
.
stack
);
console
.
log
(
"innerApi-autoSign error"
,
e
.
stack
);
...
@@ -213,6 +213,137 @@ class innerApi {
...
@@ -213,6 +213,137 @@ class innerApi {
}
}
}
}
/**
* 手动签
* @param obj
* @param req
* @returns {Promise<{msg: string, data: *, status: number}>}
*/
async
appHandSign
(
obj
,
req
)
{
let
mchtId
,
accountId
,
notifyUrl
,
val
,
key
;
try
{
await
this
.
valid
(
obj
,
req
);
accountId
=
this
.
trim
(
obj
.
accountId
);
mchtId
=
this
.
trim
(
obj
.
mchtId
);
notifyUrl
=
this
.
trim
(
obj
.
notifyUrl
);
key
=
`
${
mchtId
}
_
${
accountId
}
`
;
val
=
uuidv4
();
if
(
!
accountId
)
{
return
system
.
getErrResult2
(
"缺少accountId"
);
}
if
(
!
mchtId
)
{
return
system
.
getErrResult2
(
"缺少商户id"
);
}
if
(
!
notifyUrl
)
{
return
system
.
getErrResult2
(
"缺少签约notifyUrl"
);
}
// 1.获取签约模板id,张娇保证一个商户只有一个模板id
let
etemplateBusi
=
await
this
.
etemplatebusiSve
.
findOne
({
busi_id
:
mchtId
});
if
(
!
etemplateBusi
||
!
etemplateBusi
.
template_id
)
{
return
system
.
getErrResult2
(
"配置信息错误,请联系薪必果人员进行配置"
);
}
await
this
.
redisLock
.
lock
(
key
,
val
,
20
);
// 3. 签约
let
res
=
await
this
.
dkcontractSve
.
appHandSign
({
ecid
:
etemplateBusi
.
template_id
,
usereaccountId
:
accountId
,
forceFace
:
false
,
notifyUrl
:
notifyUrl
,
noticeUrl
:
"https://bpohhr.gongsibao.com/api/innerApi/appHandSignNotice"
,
callbackUrl
:
obj
.
callbackUrl
||
"https://bpohhr.gongsibao.com/blank"
,
});
if
(
res
.
status
===
0
)
{
let
contract
=
res
.
data
.
contract
;
return
system
.
getResult2
({
contractId
:
contract
.
id
,
accountId
:
accountId
,
mchtId
:
mchtId
,
signUrl
:
contract
.
esignUrl
});
}
return
res
;
}
catch
(
e
)
{
console
.
log
(
"innerApi-autoSign error"
,
e
.
stack
);
return
this
.
errorTip
(
e
.
name
);
}
finally
{
if
(
key
&&
val
)
{
// 解锁
await
this
.
redisLock
.
unLock
(
key
,
val
);
}
}
}
async
testNotifyUrl
(
params
)
{
console
.
log
(
"----------------testNotifyUrl----------------"
,
params
);
}
async
appHandSignNotice
(
params
)
{
if
(
!
this
.
checkNoticeParams
(
params
))
{
return
;
}
try
{
// 更新合同状态
let
contract
=
await
this
.
dkcontractSve
.
updateCallbackStatus
(
params
);
// 归档
await
this
.
utilesignbaoSve
.
archiveProcess
(
params
,
"innerApi.appHandSignNotice"
);
// 推送
if
(
contract
.
notify_url
)
{
try
{
let
notifyResult
=
await
axios
({
method
:
'post'
,
url
:
contract
.
notify_url
,
data
:
{
contractId
:
contract
.
id
,
accountId
:
contract
.
usereaccount_id
,
eflowstatus
:
contract
.
eflowstatus
,
},
});
console
.
log
(
`-----innerApi.appHandSignNotice.notify_url---------`
,
contract
.
id
,
notifyResult
);
}
catch
(
e
)
{
console
.
log
(
`-----innerApi.appHandSignNotice.notify_url--exception-------`
,
contract
.
id
,
e
.
stack
);
}
}
console
.
log
(
params
);
}
catch
(
e
)
{
console
.
log
(
`------innerApi.js----appHandSignNotice----exception-----`
,
e
.
stack
);
}
// {
// "action": "SIGN_FLOW_UPDATE",
// "flowId": "002d788293274f168400138920b7a710",
// "accountId": "120853bb59d74496b01ae03a7dbaeaf7",
// "signTime": "2020-09-30 13:37:51",
// "signResult": 2,
// "serialNumber": "dk_4218",
// "thirdOrderNo": "dk_4218",
// "resultDescription": "执行成功"
// }
}
checkNoticeParams
(
params
)
{
let
actions
=
[
'SIGN_FLOW_UPDATE'
,
"SIGN_FLOW_FINISH"
];
console
.
log
(
`------------innerApi.js--------------checkNoticeParams-------------
${
params
.
action
}
----------params--`
);
if
(
actions
.
indexOf
(
params
.
action
)
==
-
1
)
{
console
.
log
(
`------------innerApi--------------checkNoticeParams-------------
${
params
.
action
}
----------action错误--`
);
return
0
;
}
if
(
!
params
.
flowId
)
{
console
.
log
(
`------------innerApi--------------checkNoticeParams-------------
${
params
.
flowId
}
----------flowId错误--`
);
return
0
;
}
if
(
!
params
.
thirdOrderNo
)
{
console
.
log
(
`------------innerApi--------------checkNoticeParams-------------
${
params
.
thirdOrderNo
}
----------thirdOrderNo错误--`
);
return
0
;
}
return
1
;
}
async
signInfo
(
obj
,
req
)
{
async
signInfo
(
obj
,
req
)
{
let
contract
=
await
this
.
dkcontractSve
.
findById
(
obj
.
contractId
)
||
{};
let
contract
=
await
this
.
dkcontractSve
.
findById
(
obj
.
contractId
)
||
{};
...
...
bpo-web/app/base/db/models/dkcontract.js
View file @
4a9870f1
...
@@ -32,6 +32,8 @@ module.exports = (db, DataTypes) => {
...
@@ -32,6 +32,8 @@ module.exports = (db, DataTypes) => {
completed_at
:
DataTypes
.
DATE
,
completed_at
:
DataTypes
.
DATE
,
begin_at
:
DataTypes
.
DATE
,
begin_at
:
DataTypes
.
DATE
,
end_at
:
DataTypes
.
DATE
,
end_at
:
DataTypes
.
DATE
,
notify_url
:
DataTypes
.
STRING
,
},{
},{
paranoid
:
true
,
//假的删除
paranoid
:
true
,
//假的删除
underscored
:
true
,
underscored
:
true
,
...
...
bpo-web/app/base/service/impl/dkcontractSve.js
View file @
4a9870f1
...
@@ -833,7 +833,7 @@ class DKcontractService extends ServiceBase {
...
@@ -833,7 +833,7 @@ class DKcontractService extends ServiceBase {
var
sealId
=
dkcompany
.
sealId
;
var
sealId
=
dkcompany
.
sealId
;
let
tt
=
await
this
.
utilesignbaoSve
.
userAutoSignContractNoTemplate
(
contractParams
,
ebaoAccountId
,
thirdOrderNo
,
eBaoRedirectBossUrl
,
"econtractSve"
,
sealId
);
let
tt
=
await
this
.
utilesignbaoSve
.
userAutoSignContractNoTemplate
(
contractParams
,
ebaoAccountId
,
thirdOrderNo
,
eBaoRedirectBossUrl
,
"econtractSve"
,
sealId
);
console
.
log
(
"-
============= result ===========================
"
,
tt
);
console
.
log
(
"-
-----------appAutoSign--------utilesignbaoSve.userAutoSignContractNoTemplate----------- result------------------------------
"
,
tt
);
if
(
tt
&&
tt
.
data
&&
tt
.
code
==
1
)
{
if
(
tt
&&
tt
.
data
&&
tt
.
code
==
1
)
{
dkecontract
.
eflowid
=
tt
.
data
.
flowId
;
dkecontract
.
eflowid
=
tt
.
data
.
flowId
;
dkecontract
.
edocid
=
tt
.
data
.
docId
;
dkecontract
.
edocid
=
tt
.
data
.
docId
;
...
@@ -852,6 +852,89 @@ class DKcontractService extends ServiceBase {
...
@@ -852,6 +852,89 @@ class DKcontractService extends ServiceBase {
return
system
.
getResult2
({
contractId
:
dkecontract
.
id
},
{},
"success"
);
return
system
.
getResult2
({
contractId
:
dkecontract
.
id
},
{},
"success"
);
}
}
async
appHandSign
(
params
)
{
let
ecid
=
params
.
ecid
;
let
usereaccountId
=
params
.
usereaccountId
;
let
eaccount
=
await
this
.
usereaccountDao
.
findById
(
usereaccountId
);
if
(
!
eaccount
||
!
eaccount
.
eaccountid
)
{
return
system
.
getErrResult2
(
"账户不存在"
);
}
if
(
params
.
forceFace
&&
!
eaccount
.
face_auth_img
)
{
return
system
.
getErrResult2
(
"请先进行人脸识别"
);
}
let
todays
=
moment
().
format
(
"YYYY-MM-DD"
)
+
" 00:00:00"
;
let
contractId
=
await
this
.
dao
.
findSignedContractId
({
idno
:
eaccount
.
personsSign
,
ecid
:
ecid
,
today
:
todays
})
||
0
;
if
(
contractId
)
{
return
system
.
getResult2
({
contractId
:
contractId
},
{},
"用户已签约"
);
}
// ecid dketemplate
let
etemplate
=
await
this
.
dktemplateSve
.
findById
(
ecid
);
// dkecompany
let
dkcompany
=
await
this
.
dkcompanyDao
.
findById
(
etemplate
.
dkcompany_id
);
let
dkcontract
=
{
name
:
dkcompany
.
name
,
dktemplate_id
:
ecid
,
user_id
:
eaccount
.
user_id
,
usereaccount_id
:
eaccount
.
id
,
dkcompany_id
:
dkcompany
.
id
,
edocid
:
""
,
eflowid
:
""
,
esignUrl
:
""
,
eflowstatus
:
"1"
,
notify_url
:
params
.
notifyUrl
,
}
dkcontract
=
await
this
.
create
(
dkcontract
);
let
dkaggreement
=
await
this
.
dkaggreementDao
.
findById
(
etemplate
.
dkaggreement_id
);
let
contractParams
=
{
templateId
:
dkaggreement
.
templateid
,
//模板id,由创建模板接口调用返回的templateId 必填
name
:
dkcompany
.
name
,
//合同模板名称 必填
noticeUrl
:
params
.
noticeUrl
,
//合同模板名称 必填
simpleFormFields
:
{
nameA
:
dkcompany
.
name
,
//甲方 必填
addressA
:
dkcompany
.
addr
,
// 甲方地址
phoneA
:
dkcompany
.
phone
,
// 甲方电话
nameB
:
eaccount
.
userName
,
//乙方姓名 必填
phoneB
:
eaccount
.
mobile
,
//乙方电话 必填
nameC
:
eaccount
.
userName
,
// 已方姓名
phoneC
:
eaccount
.
mobile
,
// 乙方电话
idcardC
:
eaccount
.
personsSign
,
// 乙方身份证
banknoC
:
eaccount
.
bankno
,
// 乙方银行卡号
signdate
:
moment
().
format
(
"YYYY/MM/DD"
),
// 签约日期
}
};
let
ebaoAccountId
=
eaccount
.
eaccountid
;
//签署人账户id-- 必填
let
thirdOrderNo
=
"dk_"
+
dkcontract
.
id
;
//第三方流水号,通知回调使用---选填
let
eBaoRedirectBossUrl
=
params
.
callbackUrl
||
""
;
if
(
eBaoRedirectBossUrl
)
{
eBaoRedirectBossUrl
=
eBaoRedirectBossUrl
+
"?contractId="
+
dkcontract
.
id
;
}
let
sealId
=
dkcompany
.
sealId
;
// 手动签署
let
tt
=
await
this
.
utilesignbaoSve
.
userSignContractNoTemplate2
(
contractParams
,
ebaoAccountId
,
thirdOrderNo
,
eBaoRedirectBossUrl
,
"econtractSve"
,
sealId
);
console
.
log
(
"------appHandSign------utilesignbaoSve.userSignContractNoTemplate2------result------"
,
tt
);
if
(
tt
&&
tt
.
code
==
1
)
{
dkcontract
.
eflowid
=
tt
.
data
.
flowId
;
dkcontract
.
edocid
=
tt
.
data
.
docId
;
dkcontract
.
esignUrl
=
tt
.
data
.
signUrl
;
await
dkcontract
.
save
();
}
let
genResult
=
{
tt
:
tt
,
contract
:
dkcontract
,
params
:
params
,
ebaoAccountId
:
ebaoAccountId
,
thirdOrderNo
:
thirdOrderNo
}
return
system
.
getResult2
(
genResult
);
}
async
findSingleSignedUser
(
params
)
{
async
findSingleSignedUser
(
params
)
{
let
sql
=
[];
let
sql
=
[];
sql
.
push
(
"SELECT t1.id,t1.begin_at as beginDate,t1.end_at as endDate,"
);
sql
.
push
(
"SELECT t1.id,t1.begin_at as beginDate,t1.end_at as endDate,"
);
...
...
bpo-web/app/base/service/impl/utilesignbaoSve.js
View file @
4a9870f1
...
@@ -1151,6 +1151,9 @@ class UtilESignBaoService {
...
@@ -1151,6 +1151,9 @@ class UtilESignBaoService {
docId
:
tDocId
,
//合同id
docId
:
tDocId
,
//合同id
docName
:
""
//合同名称,默认使用创建合同时的名称-- 选填
docName
:
""
//合同名称,默认使用创建合同时的名称-- 选填
};
};
if
(
params
.
noticeUrl
)
{
addProcessParams
.
noticeUrl
=
params
.
noticeUrl
;
}
//2.创建合同签署流程 5.5.1
//2.创建合同签署流程 5.5.1
var
createAddProcess
=
await
self
.
addProcess
(
addProcessParams
,
opName
,
result
);
var
createAddProcess
=
await
self
.
addProcess
(
addProcessParams
,
opName
,
result
);
if
(
createAddProcess
.
code
!=
1
)
{
if
(
createAddProcess
.
code
!=
1
)
{
...
...
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