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
62fc7de1
Commit
62fc7de1
authored
Apr 16, 2020
by
zhaoxiqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
350d0abe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
71 deletions
+87
-71
bpo-web/app/base/db/models/yzmerchantsigned.js
+2
-2
bpo-web/app/base/service/impl/dkcontractSve.js
+18
-24
bpo-web/app/base/service/impl/entcontractSve.js
+67
-45
No files found.
bpo-web/app/base/db/models/yzmerchantsigned.js
View file @
62fc7de1
...
...
@@ -9,6 +9,7 @@ module.exports = (db, DataTypes) => {
mainId
:
DataTypes
.
STRING
,
secret
:
DataTypes
.
STRING
,
ecid
:
DataTypes
.
INTEGER
,
params
:
DataTypes
.
TEXT
,
entcontract_id
:
DataTypes
.
INTEGER
,
},
{
paranoid
:
true
,
//假的删除
...
...
@@ -53,4 +54,4 @@ module.exports = (db, DataTypes) => {
// }
]
});
}
\ No newline at end of file
}
bpo-web/app/base/service/impl/dkcontractSve.js
View file @
62fc7de1
...
...
@@ -506,10 +506,11 @@ class DKcontractService extends ServiceBase {
});
}
if
(
isNeedCreate
)
{
var
uidStr
=
await
this
.
getUidStr
(
8
,
36
);
var
thirdId
=
etemplate
.
id
+
"_"
+
eaccount
.
id
+
uidStr
;
//
2.
创建e签宝account 5.2.1 , 创建后save()
//创建e签宝account 5.2.1 , 创建后save()
var
params
=
{
thirdId
:
thirdId
,
name
:
eaccount
.
userName
,
...
...
@@ -524,21 +525,34 @@ class DKcontractService extends ServiceBase {
}
else
{
return
this
.
returnjson
(
-
1
,
"账户创建失败"
);
}
}
// TODO 静默前授权
// 设置静默签署授权 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
();
}
dkecontract
=
{
name
:
dkcompany
.
name
,
dktemplate_id
:
ecid
,
user_id
:
user
.
id
,
usereaccount_id
:
eaccount
.
id
,
dkcompany_id
:
dkcompany
.
dkcompany
,
dkcompany_id
:
dkcompany
.
id
,
edocid
:
""
,
eflowid
:
""
,
esignUrl
:
""
,
eflowstatus
:
"1"
,
}
dkecontract
=
await
this
.
create
(
dkecontract
);
var
dkaggreement
=
await
this
.
dkaggreementDao
.
findById
(
etemplate
.
dkaggreement_id
);
var
params
=
{
templateId
:
dkaggreement
.
templateid
,
//模板id,由创建模板接口调用返回的templateId 必填
...
...
@@ -565,27 +579,7 @@ class DKcontractService extends ServiceBase {
var
eBaoRedirectBossUrl
=
""
;
var
sealId
=
dkcompany
.
sealId
;
let
tt
=
await
this
.
utilesignbaoSve
.
userSignContractNoTemplate2
(
params
,
ebaoAccountId
,
thirdOrderNo
,
eBaoRedirectBossUrl
,
"econtractSve"
,
sealId
);
// TODO 静默签代码
// var autoUserSignTaskParams = {
// flowId: tFlowId, //流程id-- 必填
// accountId: ebaoAccountId, //签署人账户id-- 必填
// thirdOrderNo: tThirdOrderNo, //第三方流水号,通知回调使用
// sealType: "0", //印章类型, 指定签署印章类型,0:手绘印章;1:模板印章-- 必填 ?????????????????????????????
// posList: [{
// signType: 1, //盖章位置定位方式,1关键字定位-- 必填
// key: "sealB" //-- 必填
// }]
// };
//
// //4.发起用户自动签署 5.5.3
// var autoUserSignTaskResult = await self.autoUserSignTask(autoUserSignTaskParams, opName, result);
// if (autoUserSignTaskResult.code != 1) {
// return result;
// }
// // 打开这行注释
// await this.archiveProcess({flowId: tFlowId}, opName);
let
tt
=
await
this
.
utilesignbaoSve
.
userAutoSignContractNoTemplate
(
params
,
ebaoAccountId
,
thirdOrderNo
,
eBaoRedirectBossUrl
,
"econtractSve"
,
sealId
);
console
.
log
(
"-============= result ==========================="
,
tt
);
if
(
tt
&&
tt
.
data
&&
tt
.
code
==
1
)
{
dkecontract
.
eflowid
=
tt
.
data
.
flowId
;
...
...
bpo-web/app/base/service/impl/entcontractSve.js
View file @
62fc7de1
...
...
@@ -24,7 +24,7 @@ class EntcontractService extends ServiceBase {
this
.
ecompanyDao
=
system
.
getObject
(
"db.ecompanyDao"
);
this
.
econtractDao
=
system
.
getObject
(
"db.econtractDao"
);
this
.
etemplatebusiDao
=
system
.
getObject
(
"db.etemplatebusiDao"
);
this
.
etemplatebusiDao
=
system
.
getObject
(
"db.etemplatebusiDao"
);
this
.
bankthreelogDao
=
system
.
getObject
(
"db.bankthreelogDao"
);
...
...
@@ -232,7 +232,7 @@ class EntcontractService extends ServiceBase {
// mchtId: "1202848945651318786",
appId
:
params
.
toAppId
,
mchtId
:
params
.
toMcthid
,
ageFlag
:
0
,
ageFlag
:
0
,
type
:
"0"
,
// 类型 0 一般纳税人 1 小规模纳税人
companyName
:
params
.
merchantName
,
//商户名称
mobile
:
params
.
mobile
,
//手机号
...
...
@@ -353,9 +353,9 @@ class EntcontractService extends ServiceBase {
await
erchants
.
save
();
}
var
etemplatebusi
=
await
this
.
etemplatebusiDao
.
findOne
({
template_id
:
erchants
.
ecid
,
busi_id
:
erchants
.
mchtId
,
var
etemplatebusi
=
await
this
.
etemplatebusiDao
.
findOne
({
template_id
:
erchants
.
ecid
,
busi_id
:
erchants
.
mchtId
,
});
if
(
!
etemplatebusi
)
{
this
.
etemplatebusiDao
.
create
({
...
...
@@ -399,8 +399,7 @@ class EntcontractService extends ServiceBase {
}
async
yzMerchantAutoSigns
(
params
,
enttemplate
){
async
yzMerchantAutoSigns
(
params
,
enttemplate
)
{
//判断商户是否签约
var
ecid
=
params
.
ecid
;
var
unionId
=
params
.
appId
+
"_"
+
params
.
merchantId
+
"_"
+
params
.
idNo
;
...
...
@@ -444,27 +443,34 @@ class EntcontractService extends ServiceBase {
}
let
res
=
{
code
:
0
,
msg
:
"
签约
成功"
,
msg
:
"
执行
成功"
,
data
:
{
entcontract
:
entcontract
.
id
,
ecid
:
merchantSign
.
ecid
,
appId
:
merchantSign
.
appId
,
mchtId
:
merchantSign
.
mchtId
,
mainId
:
merchantSign
.
mainId
,
secret
:
merchantSign
.
secret
,
},
}
;
}
return
res
;
}
var
reso
=
await
this
.
createYzMerchant_1
(
params
,
enttemplate
);
if
(
reso
.
code
==
-
1
){
var
reso
=
await
this
.
createYzMerchant_1
(
params
,
enttemplate
);
if
(
reso
.
code
==
-
1
)
{
return
this
.
returnjson
(
-
1
,
"签约失败"
);
}
this
.
toSignUp
(
params
,
eaccount
,
user
,
entcontract
,
reso
.
erchants
);
return
this
.
returnjson
(
0
,
"签约成功"
);
this
.
toSignUp
(
params
,
eaccount
,
user
,
entcontract
,
reso
.
erchants
);
delete
reso
.
erchants
;
return
reso
;
}
async
createYzMerchant_1
(
params
,
enttemplate
){
async
createYzMerchant_1
(
params
,
enttemplate
)
{
var
data
=
{
appId
:
enttemplate
.
appid
,
mchtId
:
enttemplate
.
mcthid
,
ageFlag
:
0
,
ageFlag
:
0
,
type
:
"0"
,
// 类型 0 一般纳税人 1 小规模纳税人
companyName
:
params
.
merchantName
,
//商户名称
mobile
:
params
.
mobile
,
//手机号
...
...
@@ -514,6 +520,25 @@ class EntcontractService extends ServiceBase {
}
];
try
{
var
erchants
=
await
this
.
yzmerchantsignedDao
.
findOne
({
companyName
:
params
.
merchantName
,
});
if
(
erchants
)
{
return
{
code
:
0
,
msg
:
"执行成功"
,
data
:
{
ecid
:
erchants
.
ecid
,
appId
:
erchants
.
appId
,
mchtId
:
erchants
.
mchtId
,
mainId
:
erchants
.
mainId
,
secret
:
erchants
.
secret
,
},
erchants
:
erchants
}
}
let
url
=
settings
.
apiconfig
.
settleApiConfig
().
createMerchantApi
;
console
.
log
(
"有赞商户创建url:"
,
url
);
let
rs
=
await
axios
({
...
...
@@ -522,34 +547,30 @@ class EntcontractService extends ServiceBase {
data
:
data
,
});
var
reso
=
rs
.
data
;
if
(
reso
.
code
==
-
1
)
{
if
(
reso
.
code
==
-
1
)
{
console
.
log
(
"有赞创建商户错误==========="
,
reso
)
return
reso
;
}
var
erchants
=
await
this
.
yzmerchantsignedDao
.
findOne
({
erchants
=
{
companyName
:
params
.
merchantName
,
});
if
(
!
erchants
)
{
erchants
=
{
companyName
:
params
.
merchantName
,
appId
:
reso
.
data
.
appId
,
mchtId
:
reso
.
data
.
mchtId
,
mainId
:
reso
.
data
.
mainId
,
secret
:
reso
.
data
.
secret
,
params
:
JSON
.
stringify
(
params
),
ecid
:
10287
};
try
{
erchants
=
await
this
.
yzmerchantsignedDao
.
create
(
erchants
);
}
catch
(
e
)
{
console
.
log
(
"c_yzmerchant_signed插入失败"
,
erchants
);
console
.
log
(
e
.
stack
);
}
appId
:
reso
.
data
.
appId
,
mchtId
:
reso
.
data
.
mchtId
,
mainId
:
reso
.
data
.
mainId
,
secret
:
reso
.
data
.
secret
,
params
:
JSON
.
stringify
(
params
),
ecid
:
10287
};
try
{
erchants
=
await
this
.
yzmerchantsignedDao
.
create
(
erchants
);
}
catch
(
e
)
{
console
.
log
(
"c_yzmerchant_signed插入失败"
,
erchants
);
console
.
log
(
e
.
stack
);
}
var
etemplatebusi
=
await
this
.
etemplatebusiDao
.
findOne
({
template_id
:
erchants
.
ecid
,
busi_id
:
erchants
.
mchtId
,
var
etemplatebusi
=
await
this
.
etemplatebusiDao
.
findOne
({
template_id
:
erchants
.
ecid
,
busi_id
:
erchants
.
mchtId
,
});
if
(
!
etemplatebusi
)
{
this
.
etemplatebusiDao
.
create
({
...
...
@@ -563,12 +584,12 @@ class EntcontractService extends ServiceBase {
return
reso
;
}
catch
(
e
)
{
console
.
log
(
e
.
stack
);
return
{
code
:
-
1
,
message
:
"操作异常"
};
return
{
code
:
-
1
,
message
:
"操作异常"
};
}
}
async
toSignUp
(
params
,
eaccount
,
user
,
entcontract
,
erchants
)
{
async
toSignUp
(
params
,
eaccount
,
user
,
entcontract
,
erchants
)
{
var
ecid
=
params
.
ecid
;
var
unionId
=
params
.
appId
+
"_"
+
params
.
merchantId
+
"_"
+
params
.
idNo
;
// enttemplate 模板查询
...
...
@@ -682,9 +703,10 @@ class EntcontractService extends ServiceBase {
params
.
key
=
enttemplate
.
key
;
// 合同下载任务
this
.
redisClient
.
rpushBCD
({
id
:
entcontract
.
id
,
sve
:
"ent"
});
console
.
log
(
"===============有赞商户签约异步签约成功==============="
,
new
Date
())
console
.
log
(
"===============有赞商户签约异步签约成功==============="
,
new
Date
())
}
else
{
console
.
log
(
new
Date
(),
"===============有赞商户签约异步签约失败==============="
,
tt
)
}
console
.
log
(
new
Date
(),
"===============有赞商户签约异步签约失败==============="
,
tt
)
}
...
...
@@ -1089,7 +1111,7 @@ class EntcontractService extends ServiceBase {
try
{
let
contract
=
await
this
.
dao
.
findById
(
id
);
if
(
!
contract
||
contract
.
eflowstatus
!=
"2"
||
contract
.
fileurl
)
{
return
;
return
;
}
//await this.syncYzSign(2134);
...
...
@@ -1165,11 +1187,11 @@ class EntcontractService extends ServiceBase {
console
.
log
(
JSON
.
stringify
(
param
));
var
rs
=
""
;
try
{
rs
=
await
axios
({
rs
=
await
axios
({
method
:
'post'
,
url
:
this
.
YZHDURL
,
data
:
param
,
headers
:
{
'X-Service-Chain'
:
{
"name"
:
"prj0015875"
}},
headers
:
{
'X-Service-Chain'
:
{
"name"
:
"prj0015875"
}},
});
}
catch
(
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