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
0c6000be
Commit
0c6000be
authored
Sep 10, 2020
by
DESKTOP-7Q3CA17\86137
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
c80cf04b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
496 additions
and
180 deletions
+496
-180
bpo-web/app/base/api/impl/gemaApi.js
+103
-94
bpo-web/app/base/api/impl/qbgecontractApi.js
+290
-0
bpo-web/app/base/api/impl/yzcontractApi.js
+24
-18
bpo-web/app/base/service/impl/qbgconfigSve.js
+71
-64
bpo-web/app/config/localsettings.js
+8
-4
No files found.
bpo-web/app/base/api/impl/gemaApi.js
View file @
0c6000be
...
...
@@ -14,7 +14,109 @@ class GemaApi {
}
// //三要素验证
/**
* 两方电子签
* @param pobj
* @returns {Promise<{msg: *, code: *, data: (*|null)}|{msg: *, code: *, data}|*|{msg: *, code: *, data}>}
*/
async
autoSign
(
pobj
)
{
// 处理参数
var
param
=
{
ecid
:
this
.
trim
(
pobj
.
ecid
),
appId
:
this
.
trim
(
pobj
.
appId
),
userId
:
this
.
trim
(
pobj
.
userId
),
idName
:
this
.
trim
(
pobj
.
idName
),
mobile
:
this
.
trim
(
pobj
.
mobile
),
idNo
:
this
.
trim
(
pobj
.
idNo
),
bankno
:
this
.
trim
(
pobj
.
bankno
),
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
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
.
bankno
)
{
return
this
.
returnjson
(
-
1
,
"请提供该用户银行卡号"
)
}
if
(
!
param
.
nonceStr
)
{
return
this
.
returnjson
(
-
1
,
"请提供随机码"
)
}
// 查appId关联key
var
qbg
=
await
this
.
qbgconfigSve
.
findOne
({
appId
:
param
.
appId
});
if
(
!
qbg
||
!
qbg
.
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="
+
qbg
.
key
;
var
sign
=
md5
(
signStr
).
toUpperCase
();
console
.
log
(
"---autoSign---签名---"
,
signStr
,
sign
);
if
(
param
.
sign
!=
sign
)
{
return
this
.
returnjson
(
1001001
,
`签名错误`
);
}
try
{
param
.
idNo
=
param
.
idNo
.
toUpperCase
();
param
.
bankno
=
param
.
bankno
.
replace
(
/
\s
*/g
,
""
);
var
key
=
param
.
idNo
+
"_"
+
param
.
ecid
const
id
=
uuidv1
();
await
this
.
redisLock
.
lock
(
key
,
id
,
20
);
var
result
=
await
this
.
qbgconfigSve
.
autoSigns
(
param
,
qbg
);
await
this
.
redisLock
.
unLock
(
key
,
id
);
return
result
;
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
/**
* 三方电子签
*/
// async autoSign(pobj) {
// // 处理参数
// var param = {
...
...
@@ -109,100 +211,7 @@ class GemaApi {
// console.log(error);
// }
// }
//三要素验证
async
autoSign
(
pobj
)
{
// 处理参数
var
param
=
{
ecid
:
this
.
trim
(
pobj
.
ecid
),
appId
:
this
.
trim
(
pobj
.
appId
),
userId
:
this
.
trim
(
pobj
.
userId
),
idName
:
this
.
trim
(
pobj
.
idName
),
mobile
:
this
.
trim
(
pobj
.
mobile
),
idNo
:
this
.
trim
(
pobj
.
idNo
),
bankno
:
this
.
trim
(
pobj
.
bankno
),
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
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
.
bankno
)
{
return
this
.
returnjson
(
-
1
,
"请提供该用户银行卡号"
)
}
if
(
!
param
.
nonceStr
)
{
return
this
.
returnjson
(
-
1
,
"请提供随机码"
)
}
// 查appId关联key
var
qbg
=
await
this
.
qbgconfigSve
.
findOne
({
appId
:
param
.
appId
});
if
(
!
qbg
||
!
qbg
.
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="
+
qbg
.
key
;
var
sign
=
md5
(
signStr
).
toUpperCase
();
console
.
log
(
"---autoSign---签名---"
,
signStr
,
sign
);
if
(
param
.
sign
!=
sign
)
{
return
this
.
returnjson
(
1001001
,
`签名错误`
);
}
try
{
param
.
idNo
=
param
.
idNo
.
toUpperCase
();
param
.
bankno
=
param
.
bankno
.
replace
(
/
\s
*/g
,
""
);
var
key
=
param
.
idNo
+
"_"
+
param
.
ecid
const
id
=
uuidv1
();
await
this
.
redisLock
.
lock
(
key
,
id
,
20
);
var
result
=
await
this
.
qbgconfigSve
.
autoSigns
(
param
,
qbg
);
await
this
.
redisLock
.
unLock
(
key
,
id
);
return
result
;
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
async
sinedUser
(
obj
,
req
)
{
// 验证合法性
...
...
bpo-web/app/base/api/impl/qbgecontractApi.js
0 → 100644
View file @
0c6000be
var
system
=
require
(
"../../system"
)
const
md5
=
require
(
"MD5"
);
const
uuidv1
=
require
(
'uuid/v1'
);
class
QbgecontractApi
{
constructor
()
{
this
.
etemplatebusiSve
=
system
.
getObject
(
"service.etemplatebusiSve"
);
this
.
esettleSve
=
system
.
getObject
(
"service.esettleSve"
);
this
.
qbgconfigSve
=
system
.
getObject
(
"service.qbgconfigSve"
);
this
.
redisLock
=
system
.
getObject
(
"util.redisLock"
);
this
.
idcardClient
=
system
.
getObject
(
"util.idcardClient"
);
this
.
econtractSve
=
system
.
getObject
(
"service.econtractSve"
);
this
.
dkcontractSve
=
system
.
getObject
(
"service.dkcontractSve"
);
}
// /**
// * 两方电子签
// * @param pobj
// * @returns {Promise<{msg: *, code: *, data: (*|null)}|{msg: *, code: *, data}|*|{msg: *, code: *, data}>}
// */
// async autoSign(pobj) {
// // 处理参数
// var param = {
// ecid: this.trim(pobj.ecid),
// appId: this.trim(pobj.appId),
// userId: this.trim(pobj.userId),
// idName: this.trim(pobj.idName),
// mobile: this.trim(pobj.mobile),
// idNo: this.trim(pobj.idNo),
// bankno: this.trim(pobj.bankno),
// 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 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.bankno) {
// return this.returnjson(-1, "请提供该用户银行卡号")
// }
// if (!param.nonceStr) {
// return this.returnjson(-1, "请提供随机码")
// }
//
// // 查appId关联key
// var qbg = await this.qbgconfigSve.findOne({
// appId: param.appId
// });
// if (!qbg || !qbg.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=" + qbg.key;
// var sign = md5(signStr).toUpperCase();
// console.log("---autoSign---签名---", signStr, sign);
// if (param.sign != sign) {
// return this.returnjson(1001001, `签名错误`);
// }
// try {
// param.idNo = param.idNo.toUpperCase();
// param.bankno = param.bankno.replace(/\s*/g, "");
// var key = param.idNo + "_" + param.ecid
// const id = uuidv1();
// await this.redisLock.lock(key, id, 20);
// var result = await this.qbgconfigSve.autoSigns(param, qbg);
// await this.redisLock.unLock(key, id);
// return result;
// } catch (error) {
// console.log(error);
// }
// }
/**
* 三方电子签
*/
async
autoSign
(
pobj
)
{
// 处理参数
var
param
=
{
ecid
:
this
.
trim
(
pobj
.
ecid
),
appId
:
this
.
trim
(
pobj
.
appId
),
userId
:
this
.
trim
(
pobj
.
userId
),
idName
:
this
.
trim
(
pobj
.
idName
),
mobile
:
this
.
trim
(
pobj
.
mobile
),
idNo
:
this
.
trim
(
pobj
.
idNo
),
bankno
:
this
.
trim
(
pobj
.
bankno
),
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
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
.
bankno
)
{
return
this
.
returnjson
(
-
1
,
"请提供该用户银行卡号"
)
}
if
(
!
param
.
nonceStr
)
{
return
this
.
returnjson
(
-
1
,
"请提供随机码"
)
}
// 查appId关联key
var
qbg
=
await
this
.
qbgconfigSve
.
findOne
({
appId
:
param
.
appId
});
if
(
!
qbg
||
!
qbg
.
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="
+
qbg
.
key
;
var
sign
=
md5
(
signStr
).
toUpperCase
();
console
.
log
(
"---autoSign---签名---"
,
signStr
,
sign
);
if
(
param
.
sign
!=
sign
)
{
return
this
.
returnjson
(
1001001
,
`签名错误`
);
}
try
{
param
.
idNo
=
param
.
idNo
.
toUpperCase
();
param
.
bankno
=
param
.
bankno
.
replace
(
/
\s
*/g
,
""
);
var
key
=
param
.
idNo
+
"_"
+
param
.
ecid
const
id
=
uuidv1
();
await
this
.
redisLock
.
lock
(
key
,
id
,
20
);
var
result
=
await
this
.
qbgconfigSve
.
autoSign
(
param
,
qbg
);
await
this
.
redisLock
.
unLock
(
key
,
id
);
return
result
;
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
async
sinedUser
(
obj
,
req
)
{
// 验证合法性
let
appId
=
obj
.
appId
;
let
nonceStr
=
obj
.
nonceStr
;
let
ecid
=
obj
.
ecid
||
""
;
let
idNo
=
obj
.
idNo
;
let
busi
=
await
this
.
qbgconfigSve
.
findOne
({
appId
:
appId
});
if
(
!
busi
)
{
return
{
code
:
1001003
,
msg
:
"配置信息错误,请联系薪必果人员进行配置"
};
}
let
signArr
=
[];
signArr
.
push
(
"appId="
+
appId
);
signArr
.
push
(
"ecid="
+
ecid
);
signArr
.
push
(
"idNo="
+
idNo
);
signArr
.
push
(
"nonceStr="
+
nonceStr
);
signArr
.
push
(
"key="
+
busi
.
key
);
let
signStr
=
signArr
.
join
(
"&"
)
let
sign
=
md5
(
signStr
).
toUpperCase
();
console
.
log
(
signStr
,
sign
);
if
(
sign
!=
obj
.
sign
)
{
return
{
code
:
1001001
,
msg
:
"签名失败"
};
}
let
params
=
{
template_id
:
ecid
,
idNo
:
idNo
.
toUpperCase
(),
};
try
{
let
user
=
await
this
.
econtractSve
.
findSingleSignedUser
(
params
);
let
result
=
{
code
:
0
,
msg
:
"success"
,
data
:
user
};
return
result
;
}
catch
(
e
)
{
let
result
=
{
code
:
500
,
msg
:
"接口异常"
};
console
.
log
(
e
.
stack
);
return
result
;
}
}
trim
(
o
)
{
if
(
!
o
)
{
return
""
;
}
return
o
.
toString
().
trim
();
}
returnjson
(
code
,
msg
,
data
)
{
return
{
code
:
code
,
msg
:
msg
,
data
:
data
||
null
}
}
}
module
.
exports
=
QbgecontractApi
;
bpo-web/app/base/api/impl/yzcontractApi.js
View file @
0c6000be
...
...
@@ -245,24 +245,30 @@ class YZContractApi {
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岁之间"
)
}
}
}
let
card
=
await
this
.
idcardClient
.
cardInfo
(
param
.
idNo
);
let
age
=
card
.
age
||
0
;
if
(
!
age
)
{
return
this
.
returnjson
(
-
1
,
"身份证号格式错误, 只支持18位身份证号码"
);
}
// 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
,
"请提供随机码"
);
...
...
bpo-web/app/base/service/impl/qbgconfigSve.js
View file @
0c6000be
...
...
@@ -16,18 +16,18 @@ class QbgconfigService extends ServiceBase {
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
EXCEPT_KEYS
=
[
'sign'
,
'requestid'
,
'simpleFormFields'
];
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
}
this
.
dkcompanyDao
=
system
.
getObject
(
"db.dkcompanyDao"
);
/**
* 静默签 普票
* @param {ecid, appId, userId, idName, mobile, idNo, bankno, nonceStr, sign} params
*/
async
autoSign
(
params
,
qbg
)
{
}
//两方
async
autoSigns
(
params
,
qbg
)
{
let
ecid
=
params
.
ecid
;
// 验证身份证是否签约过
let
todays
=
moment
().
format
(
"YYYY-MM-DD"
)
+
" 00:00:00"
;
let
contractId
=
await
this
.
econtractDao
.
findSignedContractId
({
let
contractId
=
await
this
.
dkcontractDao
.
findSignedContractId
({
idno
:
params
.
idNo
,
ecid
:
ecid
,
today
:
todays
...
...
@@ -59,7 +59,6 @@ class QbgconfigService extends ServiceBase {
return
this
.
returnjson
(
-
1
,
bankthrees
.
data
.
msg
);
}
//2、 创建账户--p_user
var
unionId
=
params
.
appId
+
"_"
+
params
.
ecid
+
"_"
+
params
.
userId
;
var
user
=
await
this
.
userDao
.
findOne
({
...
...
@@ -110,7 +109,7 @@ class QbgconfigService extends ServiceBase {
data
:
createAccount
,
});
console
.
log
(
qbgaccount
)
console
.
log
(
"创建账户返回参数===================================="
,
qbgaccount
)
if
(
qbgaccount
.
data
.
status
==
0
&&
!
qbgaccount
.
data
.
data
.
accountId
)
{
return
this
.
returnjson
(
-
1
,
bankthrees
.
data
.
msg
);
}
...
...
@@ -118,7 +117,6 @@ class QbgconfigService extends ServiceBase {
eaccount
.
save
();
}
var
today
=
moment
().
format
(
"YYYY-MM-DD"
)
//发起签署
...
...
@@ -129,14 +127,22 @@ class QbgconfigService extends ServiceBase {
initiatorAccountId
:
qbg
.
initiator_account
,
accountId
:
eaccount
.
eaccountid
,
channel
:
1
,
entSealId
:
qbg
.
seal_id
,
entSealId
:
qbg
.
seal_id
,
contractName
:
qbg
.
merchant_name
,
simpleFormFields
:
{
nameA
:
qbg
.
ecompany_name
,
nameA
:
qbg
.
merchant_name
,
addressA
:
qbg
.
addressA
,
phoneA
:
qbg
.
phoneA
,
nameB
:
params
.
idName
,
unit
:
qbg
.
merchant_name
,
signDateA
:
today
,
signDateB
:
today
phoneB
:
params
.
mobile
,
nameC
:
params
.
idName
,
banknoC
:
params
.
bankno
,
phoneC
:
params
.
mobile
,
idcardC
:
params
.
idNo
,
signdate
:
today
,
},
templateId
:
params
.
ecid
}
...
...
@@ -153,41 +159,49 @@ class QbgconfigService extends ServiceBase {
console
.
log
(
econtr
)
// 创建合同
let
econtract
=
{
let
dk
econtract
=
{
name
:
qbg
.
merchant_name
,
eflowstatusname
:
"签约中"
,
eflowstatus
:
"1"
,
dktemplate_id
:
qbg
.
template_id
,
user_id
:
eaccount
.
user_id
,
usereaccount_id
:
eaccount
.
id
,
etemplate_id
:
qbg
.
template_id
,
ecompany_id
:
qbg
.
ecompany_id
,
};
econtract
=
await
this
.
econtractDao
.
create
(
econtract
);
dkcompany_id
:
qbg
.
ecompany_id
,
edocid
:
""
,
eflowid
:
""
,
esignUrl
:
""
,
eflowstatus
:
"1"
,
}
dkecontract
=
await
this
.
dkcontractDao
.
create
(
dkecontract
);
if
(
econtr
&&
econtr
.
data
&&
econtr
.
data
.
status
==
0
)
{
econtract
.
eflowid
=
econtr
.
data
.
data
.
flowId
;
econtract
.
edocid
=
econtr
.
data
.
data
.
docId
;
econtract
.
eflowstatus
=
'2'
;
econtract
.
eflowstatusname
=
"已完成"
;
dk
econtract
.
eflowid
=
econtr
.
data
.
data
.
flowId
;
dk
econtract
.
edocid
=
econtr
.
data
.
data
.
docId
;
dk
econtract
.
eflowstatus
=
'2'
;
dk
econtract
.
eflowstatusname
=
"已完成"
;
var
signTime
=
new
Date
();
econtract
.
completed_at
=
signTime
;
econtract
.
begin_at
=
signTime
;
dk
econtract
.
completed_at
=
signTime
;
dk
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
.
redisClient
.
rpushBCD
({
id
:
econtract
.
id
,
sve
:
"e"
});
dk
econtract
.
end_at
=
end_at
;
await
dk
econtract
.
save
();
this
.
redisClient
.
rpushBCD
({
id
:
dk
econtract
.
id
,
sve
:
"e"
});
return
this
.
returnjson
(
0
,
"success"
,
{
contractId
:
econtract
.
id
contractId
:
dk
econtract
.
id
});
}
return
this
.
returnjson
(
-
1
,
econtr
.
data
.
msg
||
"签约失败"
,
econtr
.
data
.
status
);
}
async
autoSigns
(
params
,
qbg
)
{
/**
* 三方静默签
* @param {ecid, appId, userId, idName, mobile, idNo, bankno, nonceStr, sign} params
*/
async
autoSign
(
params
,
qbg
)
{
let
ecid
=
params
.
ecid
;
// 验证身份证是否签约过
let
todays
=
moment
().
format
(
"YYYY-MM-DD"
)
+
" 00:00:00"
;
let
contractId
=
await
this
.
dk
contractDao
.
findSignedContractId
({
let
contractId
=
await
this
.
e
contractDao
.
findSignedContractId
({
idno
:
params
.
idNo
,
ecid
:
ecid
,
today
:
todays
...
...
@@ -219,7 +233,6 @@ class QbgconfigService extends ServiceBase {
return
this
.
returnjson
(
-
1
,
bankthrees
.
data
.
msg
);
}
//2、 创建账户--p_user
var
unionId
=
params
.
appId
+
"_"
+
params
.
ecid
+
"_"
+
params
.
userId
;
var
user
=
await
this
.
userDao
.
findOne
({
...
...
@@ -278,6 +291,7 @@ class QbgconfigService extends ServiceBase {
eaccount
.
save
();
}
var
today
=
moment
().
format
(
"YYYY-MM-DD"
)
//发起签署
...
...
@@ -288,19 +302,14 @@ class QbgconfigService extends ServiceBase {
initiatorAccountId
:
qbg
.
initiator_account
,
accountId
:
eaccount
.
eaccountid
,
channel
:
1
,
entSealId
:
qbg
.
seal_id
,
entSealId
:
qbg
.
seal_id
,
contractName
:
qbg
.
merchant_name
,
simpleFormFields
:
{
nameA
:
qbg
.
merchant_name
,
addressA
:
qbg
.
addressA
,
phoneA
:
qbg
.
phoneA
,
nameA
:
qbg
.
ecompany_name
,
nameB
:
params
.
idName
,
phoneB
:
params
.
mobile
,
nameC
:
params
.
idName
,
banknoC
:
params
.
bankno
,
phoneC
:
params
.
mobile
,
idcardC
:
params
.
idNo
,
signdate
:
today
,
unit
:
qbg
.
merchant_name
,
signDateA
:
today
,
signDateB
:
today
},
templateId
:
params
.
ecid
}
...
...
@@ -317,34 +326,32 @@ class QbgconfigService extends ServiceBase {
console
.
log
(
econtr
)
// 创建合同
let
dk
econtract
=
{
let
econtract
=
{
name
:
qbg
.
merchant_name
,
dktemplate_id
:
qbg
.
template_id
,
eflowstatusname
:
"签约中"
,
eflowstatus
:
"1"
,
user_id
:
eaccount
.
user_id
,
usereaccount_id
:
eaccount
.
id
,
dkcompany_id
:
qbg
.
ecompany_id
,
edocid
:
""
,
eflowid
:
""
,
esignUrl
:
""
,
eflowstatus
:
"1"
,
}
dkecontract
=
await
this
.
dkcontractDao
.
create
(
dkecontract
);
etemplate_id
:
qbg
.
template_id
,
ecompany_id
:
qbg
.
ecompany_id
,
};
econtract
=
await
this
.
econtractDao
.
create
(
econtract
);
if
(
econtr
&&
econtr
.
data
&&
econtr
.
data
.
status
==
0
)
{
dk
econtract
.
eflowid
=
econtr
.
data
.
data
.
flowId
;
dk
econtract
.
edocid
=
econtr
.
data
.
data
.
docId
;
dk
econtract
.
eflowstatus
=
'2'
;
dk
econtract
.
eflowstatusname
=
"已完成"
;
econtract
.
eflowid
=
econtr
.
data
.
data
.
flowId
;
econtract
.
edocid
=
econtr
.
data
.
data
.
docId
;
econtract
.
eflowstatus
=
'2'
;
econtract
.
eflowstatusname
=
"已完成"
;
var
signTime
=
new
Date
();
dk
econtract
.
completed_at
=
signTime
;
dk
econtract
.
begin_at
=
signTime
;
econtract
.
completed_at
=
signTime
;
econtract
.
begin_at
=
signTime
;
var
end_at
=
new
Date
();
end_at
.
setFullYear
(
end_at
.
getFullYear
()
+
1
);
dk
econtract
.
end_at
=
end_at
;
await
dk
econtract
.
save
();
this
.
redisClient
.
rpushBCD
({
id
:
dk
econtract
.
id
,
sve
:
"e"
});
econtract
.
end_at
=
end_at
;
await
econtract
.
save
();
this
.
redisClient
.
rpushBCD
({
id
:
econtract
.
id
,
sve
:
"e"
});
return
this
.
returnjson
(
0
,
"success"
,
{
contractId
:
dk
econtract
.
id
contractId
:
econtract
.
id
});
}
return
this
.
returnjson
(
-
1
,
econtr
.
data
.
msg
||
"签约失败"
,
econtr
.
data
.
status
);
...
...
bpo-web/app/config/localsettings.js
View file @
0c6000be
var
settings
=
{
// redis: {
// host: "43.247.184.32",
// port: 8967,
// password: "Gongsibao2018",
// db: 11,
// },
redis
:
{
host
:
"43.247.184.32"
,
port
:
8967
,
password
:
"Gongsibao2018"
,
db
:
11
,
host
:
"39.107.234.14"
,
port
:
6379
,
},
database
:
{
dbname
:
"bpo"
,
...
...
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