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
2517cf22
Commit
2517cf22
authored
Mar 17, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
d7af117a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
352 additions
and
7 deletions
+352
-7
bpo-web/app/base/api/impl/econtractApi.js
+89
-0
bpo-web/app/base/api/impl/testApi.js
+10
-5
bpo-web/app/base/service/impl/econtractSve.js
+205
-0
bpo-web/app/base/service/impl/utilesignbaoSve.js
+48
-2
No files found.
bpo-web/app/base/api/impl/econtractApi.js
View file @
2517cf22
...
@@ -872,6 +872,95 @@ class EcontractApi {
...
@@ -872,6 +872,95 @@ class EcontractApi {
}
}
}
}
async
autoSignPersonalTwo
(
pobj
)
{
// 处理参数
var
param
=
{
ecid
:
this
.
trim
(
pobj
.
ecid
),
appId
:
this
.
trim
(
pobj
.
appId
),
userId
:
this
.
trim
(
pobj
.
userId
),
idName
:
this
.
trim
(
pobj
.
idName
),
idNo
:
this
.
trim
(
pobj
.
idNo
),
nonceStr
:
this
.
trim
(
pobj
.
nonceStr
),
sign
:
this
.
trim
(
pobj
.
sign
)
};
if
(
!
param
.
ecid
)
{
return
this
.
returnjson
(
-
1
,
"请传入薪必果提供的ecid"
)
}
if
(
!
param
.
appId
)
{
return
this
.
returnjson
(
-
1
,
"请传入薪必果提供的appId"
)
}
if
(
!
param
.
userId
)
{
return
this
.
returnjson
(
-
1
,
"请提供该用户的userId"
)
}
if
(
!
param
.
idName
)
{
return
this
.
returnjson
(
-
1
,
"请提供该用户姓名"
)
}
if
(
!
param
.
idNo
)
{
return
this
.
returnjson
(
-
1
,
"请提供该用户身份证号"
)
}
if
(
!
await
this
.
idcardClient
.
checkIDCard
(
param
.
idNo
))
{
return
this
.
returnjson
(
-
1
,
"身份证格式不正确"
);
}
let
busiIds
=
await
this
.
etemplatebusiSve
.
busiIdsByTemplateId
(
param
.
ecid
);
let
num
=
await
this
.
esettleSve
.
isValidAge
(
busiIds
);
if
(
num
)
{
let
card
=
await
this
.
idcardClient
.
cardInfo
(
param
.
idNo
);
let
age
=
card
.
age
||
0
;
if
(
!
age
)
{
return
this
.
returnjson
(
-
1
,
"身份证号格式错误, 只支持18位身份证号码"
);
}
if
(
card
.
sex
==
'male'
)
{
if
(
age
<
18
||
age
>
60
)
{
return
this
.
returnjson
(
-
1
,
"签约失败,男限制18-60岁之间"
)
}
}
else
{
if
(
age
<
18
||
age
>
55
)
{
return
this
.
returnjson
(
-
1
,
"签约失败,女限制18-55岁之间"
)
}
}
}
if
(
!
param
.
nonceStr
)
{
return
this
.
returnjson
(
-
1
,
"请提供随机码"
)
}
// 查appId关联key
var
busi
=
await
this
.
ecompanybusiSve
.
findOne
({
appId
:
param
.
appId
});
if
(
!
busi
||
!
busi
.
key
)
{
return
this
.
returnjson
(
1001003
,
"配置信息错误,请联系薪必果人员进行配置"
);
}
// 签名
var
signArr
=
[];
var
keys
=
Object
.
keys
(
param
).
sort
();
for
(
var
i
=
0
;
i
<
keys
.
length
;
i
++
)
{
var
k
=
keys
[
i
];
var
v
=
param
[
k
];
if
(
!
k
||
!
v
||
k
==
'sign'
)
{
continue
;
}
signArr
.
push
(
k
+
"="
+
v
);
}
var
signStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
busi
.
key
;
var
sign
=
md5
(
signStr
).
toUpperCase
();
console
.
log
(
signStr
,
sign
);
if
(
param
.
sign
!=
sign
)
{
return
this
.
returnjson
(
1001001
,
"签名错误"
);
}
try
{
var
result
=
await
this
.
econtractSve
.
autoSignPersonalTwo
(
param
);
return
result
;
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
async
formateTime
(
inputTime
)
{
async
formateTime
(
inputTime
)
{
if
(
!
inputTime
)
{
if
(
!
inputTime
)
{
return
''
;
return
''
;
...
...
bpo-web/app/base/api/impl/testApi.js
View file @
2517cf22
...
@@ -4,7 +4,7 @@ const crypto = require('crypto');
...
@@ -4,7 +4,7 @@ const crypto = require('crypto');
const
cryptoJS
=
require
(
"crypto-js"
);
const
cryptoJS
=
require
(
"crypto-js"
);
const
querystring
=
require
(
'querystring'
);
const
querystring
=
require
(
'querystring'
);
const
logCtl
=
System
.
getObject
(
"web.oplogCtl"
);
const
logCtl
=
System
.
getObject
(
"web.oplogCtl"
);
const
fs
=
require
(
"fs"
);
const
fs
=
require
(
"fs"
);
const
xlsx
=
require
(
'node-xlsx'
)
const
xlsx
=
require
(
'node-xlsx'
)
var
moment
=
require
(
'moment'
)
var
moment
=
require
(
'moment'
)
class
TestApi
{
class
TestApi
{
...
@@ -12,6 +12,11 @@ class TestApi {
...
@@ -12,6 +12,11 @@ class TestApi {
this
.
utilesignbaoSve
=
System
.
getObject
(
"service.utilesignbaoSve"
);
this
.
utilesignbaoSve
=
System
.
getObject
(
"service.utilesignbaoSve"
);
}
}
async
personTwo
()
{
let
rs
=
await
this
.
utilesignbaoSve
.
personTwo
({
name
:
"王昆"
,
"idno"
:
"222403198301071778"
},
"test"
);
return
rs
;
}
async
genPosterQrcodeImg
(
obj
)
{
async
genPosterQrcodeImg
(
obj
)
{
return
await
this
.
imghandleApi
.
genPosterQrcodeImg
(
obj
.
qrcode
,
obj
.
bakImg
);
return
await
this
.
imghandleApi
.
genPosterQrcodeImg
(
obj
.
qrcode
,
obj
.
bakImg
);
}
}
...
@@ -36,10 +41,10 @@ class TestApi {
...
@@ -36,10 +41,10 @@ class TestApi {
async
importexcel
()
{
async
importexcel
()
{
var
names
=
[];
var
names
=
[];
for
(
var
i
=
1
;
i
<=
6
;
i
++
)
{
for
(
var
i
=
1
;
i
<=
6
;
i
++
)
{
try
{
try
{
var
filePath
=
"/tmp/banks"
+
i
+
".xlsx"
;
var
filePath
=
"/tmp/banks"
+
i
+
".xlsx"
;
console
.
log
(
"----------------------------- begin "
+
i
+
" -----------------------------"
);
console
.
log
(
"----------------------------- begin "
+
i
+
" -----------------------------"
);
var
sheets
=
xlsx
.
parse
(
filePath
);
var
sheets
=
xlsx
.
parse
(
filePath
);
if
(
!
sheets
||
sheets
.
length
==
0
)
{
if
(
!
sheets
||
sheets
.
length
==
0
)
{
return
result
;
return
result
;
...
@@ -64,7 +69,7 @@ class TestApi {
...
@@ -64,7 +69,7 @@ class TestApi {
}
}
await
this
.
ebankSve
.
create
(
obj
);
await
this
.
ebankSve
.
create
(
obj
);
}
}
console
.
log
(
"----------------------------- end "
+
i
+
"-----------------------------"
);
console
.
log
(
"----------------------------- end "
+
i
+
"-----------------------------"
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
.
stack
);
console
.
log
(
error
.
stack
);
}
}
...
...
bpo-web/app/base/service/impl/econtractSve.js
View file @
2517cf22
...
@@ -1817,6 +1817,211 @@ class EcontractService extends ServiceBase {
...
@@ -1817,6 +1817,211 @@ class EcontractService extends ServiceBase {
return
this
.
returnjson
(
-
1
,
tt
.
message
||
"签约失败"
,
tt
.
code
);
return
this
.
returnjson
(
-
1
,
tt
.
message
||
"签约失败"
,
tt
.
code
);
}
}
/**
* 静默签
* @param {ecid, appId, userId, idName, idNo, nonceStr, sign} params
*/
async
autoSignPersonalTwo
(
params
)
{
var
ecid
=
params
.
ecid
;
var
unionId
=
params
.
appId
+
"_"
+
params
.
userId
;
// ecid etemplate
var
etemplate
=
await
this
.
etemplateSve
.
findById
(
ecid
);
// ecompany
var
ecompany
=
await
this
.
ecompanyDao
.
findById
(
etemplate
.
ecompany_id
);
// p_user
var
user
=
await
this
.
userDao
.
findOne
({
unionId
:
unionId
,
});
if
(
!
user
)
{
user
=
await
this
.
userDao
.
create
({
appkey
:
params
.
appId
,
unionId
:
unionId
,
userName
:
params
.
idName
,
userId3rd
:
params
.
userId
,
userCode3rd
:
""
,
branchCode3rd
:
""
,
mobile
:
""
,
utype
:
0
,
});
}
// p_user_eaccount
var
eaccount
=
await
this
.
usereaccountDao
.
findOne
({
user_id
:
user
.
id
,
personsSign
:
params
.
idNo
,
})
||
{};
var
isNeedCreate
=
!
eaccount
.
eaccountid
||
eaccount
.
userName
!=
params
.
idName
;
eaccount
.
user_id
=
user
.
id
;
eaccount
.
userName
=
params
.
idName
;
eaccount
.
personsSign
=
params
.
idNo
;
if
(
eaccount
.
id
)
{
await
eaccount
.
save
();
}
else
{
eaccount
=
await
this
.
usereaccountDao
.
create
(
eaccount
);
}
// c_econtract
var
econtract
=
await
this
.
dao
.
findOne
({
eflowstatus
:
'2'
,
usereaccount_id
:
eaccount
.
id
,
etemplate_id
:
ecid
,
});
if
(
econtract
)
{
return
this
.
returnjson
(
0
,
"用户已经签约"
,
{
contractId
:
econtract
.
id
});
}
// e签宝流程
if
(
isNeedCreate
)
{
let
log
=
await
this
.
bankthreelogDao
.
findOne
({
userName
:
eaccount
.
userName
,
userIdNo
:
eaccount
.
personsSign
,
use_esign
:
1
,
});
if
(
!
log
)
{
log
=
await
this
.
bankthreelogDao
.
create
({
appId
:
params
.
appId
,
userName
:
eaccount
.
userName
,
userIdNo
:
eaccount
.
personsSign
,
use_esign
:
1
,
});
var
vparam
=
{
name
:
eaccount
.
userName
,
idno
:
eaccount
.
personsSign
,
};
var
threeResult
=
await
this
.
utilesignbaoSve
.
personTwo
(
vparam
,
"autoSignPT"
);
console
.
log
(
"threeResult-----------------------------"
,
threeResult
);
if
(
!
threeResult
||
threeResult
.
code
==
-
120
)
{
return
this
.
returnjson
(
-
1
,
"银行三要素(姓名、身份证、银行卡号)验证失败"
);
}
if
(
threeResult
.
code
==
-
110
)
{
return
this
.
returnjson
(
-
1
,
"银行三要素验证失败"
);
}
log
.
result
=
1
;
log
.
save
();
}
var
uidStr
=
await
this
.
getUidStr
(
8
,
36
);
var
thirdId
=
etemplate
.
id
+
"_"
+
eaccount
.
id
+
uidStr
;
//2.创建e签宝account 5.2.1 , 创建后save()
var
params
=
{
thirdId
:
thirdId
,
name
:
eaccount
.
userName
,
idNo
:
eaccount
.
personsSign
,
idType
:
19
,
};
var
getAccount
=
await
this
.
utilesignbaoSve
.
createAccountId
(
params
,
"econtractSve"
);
if
(
getAccount
&&
getAccount
.
code
==
1
&&
getAccount
.
data
)
{
eaccount
.
eaccountid
=
getAccount
.
data
.
accountId
;
await
eaccount
.
save
();
}
else
{
return
this
.
returnjson
(
-
1
,
"账户创建失败"
);
}
}
// 3.设置静默签署授权 5.2.5
if
(
!
eaccount
.
isGrantAuto
)
{
var
paramsGrant
=
{
grantAccountId
:
eaccount
.
eaccountid
};
var
grantAuto
=
await
this
.
utilesignbaoSve
.
grantAuthorization
(
paramsGrant
,
"econtractSve"
);
if
(
grantAuto
.
code
!=
1
)
{
return
this
.
returnjson
(
-
1
,
"静默签署设置失败"
);
}
eaccount
.
isGrantAuto
=
true
;
await
eaccount
.
save
();
}
// 创建合同 fileurl、esignUrl 怎么赋值????????????
econtract
=
{
name
:
ecompany
.
name
,
eflowstatusname
:
"签约中"
,
eflowstatus
:
"1"
,
// begin_at: now,
// completed_at: now,
user_id
:
eaccount
.
user_id
,
usereaccount_id
:
eaccount
.
id
,
etemplate_id
:
etemplate
.
id
,
ecompany_id
:
ecompany
.
id
,
// end_at: end,
};
econtract
=
await
this
.
create
(
econtract
);
// 创建印章id
var
sealId
=
""
;
var
eseal
=
await
this
.
esealSve
.
findOne
({
nameA
:
etemplate
.
nameA
});
// 生产环境需要打开
if
(
!
eseal
)
{
// var accountId = ""; // 测试
var
rs
=
await
this
.
utilesignbaoSve
.
creatEntSignet
(
settings
.
apiconfig
.
companyAccountId
(),
etemplate
.
nameA
+
"alias"
,
etemplate
.
nameA
,
""
,
""
,
"econtractSve"
);
// var rs = await this.utilesignbaoSve.creatEntSignet("740b19e0799a4d7abacfa1a31fb72b1e", etemplate.nameA + "alias", etemplate.nameA, "", "", "econtractSve");
if
(
rs
&&
rs
.
code
==
1
)
{
sealId
=
rs
.
data
.
sealId
;
await
this
.
esealSve
.
create
({
nameA
:
etemplate
.
nameA
,
sealId
:
sealId
,
});
}
else
{
return
this
.
returnjson
(
-
1
,
"生成印章错误"
);
}
}
else
{
sealId
=
eseal
.
sealId
;
}
let
today
=
new
Date
().
Format
(
"yyyy-MM-dd"
);
var
signParams
=
{
templateId
:
etemplate
.
templateid
,
//模板id,由创建模板接口调用返回的templateId 必填
name
:
ecompany
.
name
,
//合同模板名称 必填
simpleFormFields
:
{
nameA
:
etemplate
.
nameA
,
//甲方 必填
nameB
:
eaccount
.
userName
,
//乙方 必填
unit
:
ecompany
.
name
,
//合作单位(国美) 必填---------------------------超出长度风险---目前不知多少长度
signDateA
:
today
,
//甲方签约日期 必填
signDateB
:
today
//乙方签约日期 必填
}
};
var
ebaoAccountId
=
eaccount
.
eaccountid
;
//签署人账户id-- 必填
var
thirdOrderNo
=
econtract
.
id
;
//第三方流水号,通知回调使用---选填
var
eBaoRedirectBossUrl
=
""
;
var
tt
=
await
this
.
utilesignbaoSve
.
userAutoSignContractNoTemplate
(
signParams
,
ebaoAccountId
,
thirdOrderNo
,
eBaoRedirectBossUrl
,
"econtractSve"
,
sealId
);
if
(
tt
&&
tt
.
data
&&
tt
.
code
==
1
)
{
econtract
.
eflowid
=
tt
.
data
.
flowId
;
econtract
.
edocid
=
tt
.
data
.
docId
;
econtract
.
eflowstatus
=
'2'
;
econtract
.
eflowstatusname
=
"已完成"
;
var
signTime
=
new
Date
();
econtract
.
completed_at
=
signTime
;
econtract
.
begin_at
=
signTime
;
var
end_at
=
new
Date
();
end_at
.
setFullYear
(
end_at
.
getFullYear
()
+
1
);
econtract
.
end_at
=
end_at
;
await
econtract
.
save
();
this
.
syncSign
(
econtract
.
id
);
return
this
.
returnjson
(
0
,
"success"
,
{
contractId
:
econtract
.
id
});
}
return
this
.
returnjson
(
-
1
,
tt
.
message
||
"签约失败"
,
tt
.
code
);
}
returnjson
(
code
,
msg
,
data
)
{
returnjson
(
code
,
msg
,
data
)
{
return
{
return
{
code
:
code
,
code
:
code
,
...
...
bpo-web/app/base/service/impl/utilesignbaoSve.js
View file @
2517cf22
...
@@ -19,6 +19,34 @@ class UtilESignBaoService {
...
@@ -19,6 +19,34 @@ class UtilESignBaoService {
}
}
//-------------------------------------------------------------------------e签宝银行四要素、三要素验证---开始----------------
//-------------------------------------------------------------------------e签宝银行四要素、三要素验证---开始----------------
async
personTwo
(
params
,
opName
)
{
// 个人二要素验证
var
result
=
{
code
:
1
,
message
:
"success"
,
data
:
{}
};
var
reqUrl
=
this
.
eSignBaoBankVerifyUrl
+
"/infoauth/psn/identity"
;
var
tResult
=
await
this
.
returnResult
(
params
,
reqUrl
,
opName
,
"personTwo"
,
result
);
if
(
tResult
.
errCode
!=
0
)
{
result
.
code
=
-
110
;
if
(
tResult
.
message
&&
tResult
.
message
.
indexOf
(
":"
)
>
0
)
{
var
tmpListStr
=
tResult
.
message
.
split
(
':'
);
result
.
message
=
tmpListStr
[
1
]
?
tmpListStr
[
1
]
:
tmpListStr
[
0
];
}
else
{
result
.
message
=
"个人二要素验证失败"
;
}
return
result
;
}
if
(
tResult
.
errCode
==
0
&&
tResult
.
data
&&
!
tResult
.
data
.
pass
)
{
result
.
code
=
-
120
;
result
.
message
=
"姓名或身份证错误"
;
return
result
;
}
result
.
data
=
tResult
.
data
;
return
result
;
}
async
bankthree
(
params
,
opName
)
{
//三要素验证
async
bankthree
(
params
,
opName
)
{
//三要素验证
var
result
=
{
var
result
=
{
code
:
1
,
code
:
1
,
...
@@ -116,6 +144,7 @@ class UtilESignBaoService {
...
@@ -116,6 +144,7 @@ class UtilESignBaoService {
};
};
return
result
;
return
result
;
}
}
async
getUserContractFile
(
flowId
,
opName
,
result
)
{
//获取用户的签署合同文件
async
getUserContractFile
(
flowId
,
opName
,
result
)
{
//获取用户的签署合同文件
var
param
=
{
var
param
=
{
flowId
:
flowId
flowId
:
flowId
...
@@ -137,6 +166,7 @@ class UtilESignBaoService {
...
@@ -137,6 +166,7 @@ class UtilESignBaoService {
result
.
data
=
tResult
.
data
;
result
.
data
=
tResult
.
data
;
return
result
;
return
result
;
}
}
async
opDownFileInfo
(
docUrl
,
flowId
,
result
)
{
//从oss下载到本地并上传到自己oss,之后删除本地文件
async
opDownFileInfo
(
docUrl
,
flowId
,
result
)
{
//从oss下载到本地并上传到自己oss,之后删除本地文件
/*docUrl下载链接,全路径,如:https://XXXXXX.pdf?XXXXX */
/*docUrl下载链接,全路径,如:https://XXXXXX.pdf?XXXXX */
try
{
try
{
...
@@ -190,6 +220,7 @@ class UtilESignBaoService {
...
@@ -190,6 +220,7 @@ class UtilESignBaoService {
result
.
data
=
tResult
.
data
;
result
.
data
=
tResult
.
data
;
return
result
;
return
result
;
}
}
async
grantAuthorization
(
params
,
opName
)
{
//设置企业静默签署授权
async
grantAuthorization
(
params
,
opName
)
{
//设置企业静默签署授权
var
result
=
{
var
result
=
{
code
:
1
,
code
:
1
,
...
@@ -310,6 +341,7 @@ class UtilESignBaoService {
...
@@ -310,6 +341,7 @@ class UtilESignBaoService {
};
};
return
result
return
result
}
}
//-------------------------------------------------------------------------创建企业印章---结束----------------
//-------------------------------------------------------------------------创建企业印章---结束----------------
//-------------------------------------------------------------------------创建模板---开始----------------
//-------------------------------------------------------------------------创建模板---开始----------------
...
@@ -379,6 +411,7 @@ class UtilESignBaoService {
...
@@ -379,6 +411,7 @@ class UtilESignBaoService {
};
};
return
uploadFileResult
return
uploadFileResult
}
}
//curl文件到e签宝(参数:opFileAllName本地文件xxx.pdf、opUploadFileUrl运程上传文件、opFileKey上传文件的filekey、opContentMd5上传文件的md5、opName)
//curl文件到e签宝(参数:opFileAllName本地文件xxx.pdf、opUploadFileUrl运程上传文件、opFileKey上传文件的filekey、opContentMd5上传文件的md5、opName)
async
curlPutFileToeBao
(
opFileAllName
,
opUploadFileUrl
,
opFileKey
,
opContentMd5
,
opName
,
result
)
{
async
curlPutFileToeBao
(
opFileAllName
,
opUploadFileUrl
,
opFileKey
,
opContentMd5
,
opName
,
result
)
{
var
cmd
=
"curl -X PUT '"
+
opUploadFileUrl
+
"' -T "
+
opFileAllName
+
" -H 'Charset: utf-8' -H 'cache-control: no-cache' -H 'Content-Type: application/pdf'"
+
var
cmd
=
"curl -X PUT '"
+
opUploadFileUrl
+
"' -T "
+
opFileAllName
+
" -H 'Charset: utf-8' -H 'cache-control: no-cache' -H 'Content-Type: application/pdf'"
+
...
@@ -429,6 +462,7 @@ class UtilESignBaoService {
...
@@ -429,6 +462,7 @@ class UtilESignBaoService {
return
result
;
return
result
;
}
}
}
}
//上传模板到e签宝
//上传模板到e签宝
async
uploadfileToeBao
(
fileAllName
,
filesize
,
result
,
opName
)
{
async
uploadfileToeBao
(
fileAllName
,
filesize
,
result
,
opName
)
{
try
{
try
{
...
@@ -482,6 +516,7 @@ class UtilESignBaoService {
...
@@ -482,6 +516,7 @@ class UtilESignBaoService {
}
}
return
result
;
return
result
;
}
}
//从自己阿里云下载公司模板文件(selfTemplateUrl:公司合同模板链接文件)
//从自己阿里云下载公司模板文件(selfTemplateUrl:公司合同模板链接文件)
async
downloadEntTemplateFile
(
selfTemplateUrl
,
result
)
{
async
downloadEntTemplateFile
(
selfTemplateUrl
,
result
)
{
var
fileName
=
selfTemplateUrl
.
substr
(
selfTemplateUrl
.
lastIndexOf
(
"/"
)
+
1
,
selfTemplateUrl
.
lenght
);
var
fileName
=
selfTemplateUrl
.
substr
(
selfTemplateUrl
.
lastIndexOf
(
"/"
)
+
1
,
selfTemplateUrl
.
lenght
);
...
@@ -504,6 +539,7 @@ class UtilESignBaoService {
...
@@ -504,6 +539,7 @@ class UtilESignBaoService {
};
};
return
result
;
return
result
;
}
}
//获取文件信息
//获取文件信息
async
statpromise
(
filePath
)
{
async
statpromise
(
filePath
)
{
var
promise
=
new
Promise
((
resv
,
rej
)
=>
{
var
promise
=
new
Promise
((
resv
,
rej
)
=>
{
...
@@ -517,6 +553,7 @@ class UtilESignBaoService {
...
@@ -517,6 +553,7 @@ class UtilESignBaoService {
});
});
return
promise
;
return
promise
;
}
}
//-------------------------------------------------------------------------创建模板-----结束--------------
//-------------------------------------------------------------------------创建模板-----结束--------------
//-------------------------------------------------------------------------根据模板创建用户签署合同及签署过程-----开始--------------
//-------------------------------------------------------------------------根据模板创建用户签署合同及签署过程-----开始--------------
...
@@ -628,6 +665,7 @@ class UtilESignBaoService {
...
@@ -628,6 +665,7 @@ class UtilESignBaoService {
};
};
return
result
;
return
result
;
}
}
/*参数说明:
/*参数说明:
var params = {
var params = {
templateId: "2c98d5446734acf5016827d168a6013b", //模板id,由创建模板接口调用返回的templateId 必填
templateId: "2c98d5446734acf5016827d168a6013b", //模板id,由创建模板接口调用返回的templateId 必填
...
@@ -902,6 +940,7 @@ class UtilESignBaoService {
...
@@ -902,6 +940,7 @@ class UtilESignBaoService {
result
.
data
=
tResult
.
data
;
result
.
data
=
tResult
.
data
;
return
result
;
//获取用户合同id(docId)和合同e签宝url(docUrl)
return
result
;
//获取用户合同id(docId)和合同e签宝url(docUrl)
}
}
async
addProcess
(
params
,
opName
,
result
)
{
//创建合同签署流程
async
addProcess
(
params
,
opName
,
result
)
{
//创建合同签署流程
var
reqUrl
=
this
.
eSignBaoUrl
+
"/sign/contract/addProcess"
;
var
reqUrl
=
this
.
eSignBaoUrl
+
"/sign/contract/addProcess"
;
var
tResult
=
await
this
.
returnResult
(
params
,
reqUrl
,
opName
,
"addProcess"
,
result
);
var
tResult
=
await
this
.
returnResult
(
params
,
reqUrl
,
opName
,
"addProcess"
,
result
);
...
@@ -913,6 +952,7 @@ class UtilESignBaoService {
...
@@ -913,6 +952,7 @@ class UtilESignBaoService {
result
.
data
=
tResult
.
data
;
result
.
data
=
tResult
.
data
;
return
result
;
return
result
;
}
}
async
platformSignTask
(
params
,
opName
,
result
)
{
//发起对接平台自动签署
async
platformSignTask
(
params
,
opName
,
result
)
{
//发起对接平台自动签署
var
result
=
{
var
result
=
{
code
:
1
,
code
:
1
,
...
@@ -929,6 +969,7 @@ class UtilESignBaoService {
...
@@ -929,6 +969,7 @@ class UtilESignBaoService {
result
.
data
=
tResult
.
data
;
result
.
data
=
tResult
.
data
;
return
result
;
return
result
;
}
}
async
handPersonSignTask
(
params
,
opName
,
result
)
{
//发起个人手动签署
async
handPersonSignTask
(
params
,
opName
,
result
)
{
//发起个人手动签署
var
result
=
{
var
result
=
{
code
:
1
,
code
:
1
,
...
@@ -984,6 +1025,7 @@ class UtilESignBaoService {
...
@@ -984,6 +1025,7 @@ class UtilESignBaoService {
console
.
log
(
result
);
console
.
log
(
result
);
return
result
;
return
result
;
}
}
async
archiveProcess
(
params
,
opName
)
{
//归档流程
async
archiveProcess
(
params
,
opName
)
{
//归档流程
var
result
=
{
var
result
=
{
code
:
1
,
code
:
1
,
...
@@ -1004,17 +1046,21 @@ class UtilESignBaoService {
...
@@ -1004,17 +1046,21 @@ class UtilESignBaoService {
}
}
return
result
;
return
result
;
}
}
//-------------------------------------------------------------------------签署成功后归档-----结束--------------
//-------------------------------------------------------------------------签署成功后归档-----结束--------------
async
returnResult
(
params
,
reqUrl
,
opClassName
,
opMethod
,
result
)
{
async
returnResult
(
params
,
reqUrl
,
opClassName
,
opMethod
,
result
)
{
var
data
=
JSON
.
stringify
(
params
);
var
data
=
JSON
.
stringify
(
params
);
var
rtn
=
null
;
var
rtn
=
null
;
try
{
try
{
if
(
settings
.
env
==
'dev'
)
{
if
(
settings
.
env
==
'dev'
)
{
let
rs
=
await
axios
({
let
rs
=
await
axios
({
method
:
'post'
,
method
:
'post'
,
url
:
reqUrl
,
url
:
reqUrl
,
data
:
params
,
data
:
params
,
headers
:
{
'X-Tsign-Open-App-Id'
:
'5111588557'
,
'X-Tsign-Open-App-Secret'
:
'1595787e8d5b7d19f7b6798f16f41fc2'
},
headers
:
{
'X-Tsign-Open-App-Id'
:
'5111588557'
,
'X-Tsign-Open-App-Secret'
:
'1595787e8d5b7d19f7b6798f16f41fc2'
},
});
});
console
.
log
(
rs
);
console
.
log
(
rs
);
if
(
rs
.
data
.
errCode
!=
0
)
{
if
(
rs
.
data
.
errCode
!=
0
)
{
...
...
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