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
83396dbe
Commit
83396dbe
authored
Jan 14, 2020
by
赵庆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
9aaef0f0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
14 deletions
+66
-14
bpo-web/app/base/api/impl/econtractApi.js
+35
-8
bpo-web/app/base/service/impl/etemplateSve.js
+13
-6
bpo-web/app/base/service/impl/usereaccountSve.js
+18
-0
No files found.
bpo-web/app/base/api/impl/econtractApi.js
View file @
83396dbe
...
...
@@ -770,6 +770,7 @@ class EcontractApi {
}
var
signStr
=
signArr
.
join
(
"&"
)
+
"&key="
+
busi
.
key
;
var
sign
=
md5
(
signStr
).
toUpperCase
();
console
.
log
(
sign
);
if
(
param
.
sign
!=
sign
)
{
return
this
.
returnjson
(
1001001
,
"签名错误"
);
}
...
...
@@ -1234,9 +1235,11 @@ class EcontractApi {
msg
:
"请更新电子签企业"
};
}
// 3 查签约模板
var
templateIds
=
await
this
.
etemplateSve
.
findIdsByCompanyIdAndMainId
(
companybpo
.
ecompany_id
,
companybpo
.
mainId
);
if
(
!
templateIds
||
templateIds
.
length
==
0
)
{
// 3 查签约模板(c_etemplate_busi)
var
templateIds
=
await
this
.
etemplateSve
.
findIdsByCompanyIdAndMainId
(
companybpo
.
mtchId
);
if
(
templateIds
.
idsO
.
length
==
0
&&
templateIds
.
idsT
.
length
==
0
)
{
return
{
code
:
1
,
msg
:
"电子签模板签约主体设置错误,请到bpo后台重新设置"
...
...
@@ -1245,13 +1248,23 @@ class EcontractApi {
var
signList
=
[];
var
unSignList
=
[];
// 4 查签约用户
var
accounts
=
await
this
.
usereaccountSve
.
getSignAccounts
(
templateIds
,
idNoList
,
idNameList
);
var
accountMap
=
{};
for
(
var
signer
of
accounts
)
{
accountMap
[
signer
.
userName
+
"_"
+
signer
.
personsSign
]
=
1
;
// 4 查签约用户
if
(
templateIds
.
idsO
.
length
>
0
)
{
var
idsOCOunt
=
await
this
.
usereaccountSve
.
getSignAccounts
(
templateIds
.
idsO
,
idNoList
,
idNameList
);
for
(
var
idO
of
idsOCOunt
)
{
accountMap
[
idO
.
userName
+
"_"
+
idO
.
personsSign
]
=
1
;
}
}
if
(
templateIds
.
idsT
.
length
>
0
)
{
var
idsTCount
=
await
this
.
usereaccountSve
.
getSignAccounts_dk
(
templateIds
.
idsT
,
idNoList
,
idNameList
);
for
(
var
idT
of
idsTCount
)
{
accountMap
[
idT
.
userName
+
"_"
+
idT
.
personsSign
]
=
1
;
}
}
// 5 比对用户是否签约
for
(
var
u
of
userList
)
{
if
(
accountMap
[
u
.
idName
+
"_"
+
u
.
idNo
])
{
...
...
@@ -1260,6 +1273,18 @@ class EcontractApi {
unSignList
.
push
(
u
);
}
}
var
hash
=
{};
signList
=
signList
.
reduce
(
function
(
item
,
next
)
{
hash
[
next
.
idNo
]
?
''
:
hash
[
next
.
idNo
]
=
true
&&
item
.
push
(
next
);
return
item
},
[]);
unSignList
=
unSignList
.
reduce
(
function
(
item
,
next
)
{
hash
[
next
.
idNo
]
?
''
:
hash
[
next
.
idNo
]
=
true
&&
item
.
push
(
next
);
return
item
},
[]);
return
{
code
:
0
,
msg
:
""
,
...
...
@@ -1273,7 +1298,7 @@ class EcontractApi {
code
:
1
,
msg
:
"接口异常"
};
console
.
log
(
e
.
stack
);
console
.
log
(
e
rror
);
//日志记录
logCtl
.
error
({
optitle
:
"校验签约error"
,
...
...
@@ -1284,6 +1309,7 @@ class EcontractApi {
return
result
;
}
}
}
module
.
exports
=
EcontractApi
;
\ No newline at end of file
bpo-web/app/base/service/impl/etemplateSve.js
View file @
83396dbe
...
...
@@ -114,14 +114,21 @@ class EtemplateService extends ServiceBase{
return
list
;
}
async
findIdsByCompanyIdAndMainId
(
ecompanyId
,
mainId
)
{
var
sql
=
"SELECT id FROM `c_etemplate` WHERE ecompany_id = :ecompanyId AND mainId = :mainId"
;
var
list
=
await
this
.
dao
.
customQuery
(
sql
,
{
ecompanyId
:
ecompanyId
,
mainId
:
mainId
});
var
ids
=
[];
async
findIdsByCompanyIdAndMainId
(
mtchId
)
{
var
sql
=
"SELECT template_id,template_type FROM `c_etemplate_busi` WHERE busi_id = :busiId"
;
var
list
=
await
this
.
dao
.
customQuery
(
sql
,
{
busiId
:
mtchId
});
var
ids
=
{
idsO
:[],
idsT
:[],
};
if
(
list
)
{
for
(
var
item
of
list
)
{
ids
.
push
(
item
.
id
);
if
(
item
.
template_type
==
1
){
ids
.
idsO
.
push
(
item
.
template_id
)
}
else
if
(
item
.
template_type
==
2
){
ids
.
idsT
.
push
(
item
.
template_id
)
}
}
}
return
ids
;
...
...
bpo-web/app/base/service/impl/usereaccountSve.js
View file @
83396dbe
...
...
@@ -160,6 +160,24 @@ class UsereaccountService extends ServiceBase{
});
return
list
||
[];
}
async
getSignAccounts_dk
(
etemplateIds
,
idNoList
,
idNameList
)
{
var
sql
=
[];
sql
.
push
(
"SELECT "
);
sql
.
push
(
"t2.userName, t2.personsSign"
);
sql
.
push
(
"FROM c_dkcontract t1"
);
sql
.
push
(
"INNER JOIN p_user_eaccount t2 ON t1.usereaccount_id = t2.id"
);
sql
.
push
(
"WHERE t1.dktemplate_id IN (:etemplateIds) AND t1.`eflowstatus` = '2'"
);
sql
.
push
(
"AND t2.`userName` IN (:idNameList)"
);
sql
.
push
(
"AND t2.`personsSign` IN (:idNoList)"
);
var
list
=
await
this
.
dao
.
customQuery
(
sql
.
join
(
" "
),
{
etemplateIds
:
etemplateIds
,
idNameList
:
idNameList
,
idNoList
:
idNoList
,
});
return
list
||
[];
}
}
module
.
exports
=
UsereaccountService
;
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