Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
entrance_api
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王琮
entrance_api
Commits
509ac65a
Commit
509ac65a
authored
Dec 27, 2022
by
王琮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口逻辑调整
parent
31b49141
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
261 additions
and
222 deletions
+261
-222
JieLinkServiceImpl.java
.../integration/jieLink/service/impl/JieLinkServiceImpl.java
+234
-202
SysUserController.java
...org/rcisoft/sys/sysuser/controller/SysUserController.java
+10
-2
SysUserServiceImpl.java
.../rcisoft/sys/sysuser/service/impl/SysUserServiceImpl.java
+5
-11
VisitInfomationServiceImpl.java
...ft/sys/visit/service/impl/VisitInfomationServiceImpl.java
+8
-2
SysUserRepositorys.xml
src/main/resources/mapper/SysUserRepositorys.xml
+3
-2
VisitInfomationMapper.xml
src/main/resources/mapper/VisitInfomationMapper.xml
+1
-3
No files found.
src/main/java/org/rcisoft/integration/jieLink/service/impl/JieLinkServiceImpl.java
View file @
509ac65a
...
...
@@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.*
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Isolation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.client.RestTemplate
;
...
...
@@ -41,7 +42,7 @@ import java.util.*;
@Service
@Slf4j
@Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
class
JieLinkServiceImpl
implements
IJieLinkService
{
public
class
JieLinkServiceImpl
implements
IJieLinkService
{
/**
* 捷顺服务地址
...
...
@@ -77,69 +78,76 @@ public class JieLinkServiceImpl implements IJieLinkService {
@Autowired
private
SysDictDataRepositorys
dictDataRepositorys
;
@Value
(
"${global.path.base_discovery}"
)
private
String
baseDiscovery
;
@Value
(
"${global.path.base_upload_location}"
)
private
String
baseUploadLocation
;
/**
* 获取签名所需相关参数
*
* @return
*/
@Override
public
SignDto
getAppKeyInfo
()
{
String
apiUri
=
"/api/internal/sign"
;
String
apiUri
=
"/api/internal/sign"
;
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON_UTF8
);
headers
.
set
(
"Accept"
,
MediaType
.
APPLICATION_JSON_VALUE
);
JSONObject
paramMap
=
new
JSONObject
();
paramMap
.
put
(
"userName"
,
jieLinkUser
);
paramMap
.
put
(
"password"
,
jieLinkPwd
);
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
paramMap
,
headers
);
paramMap
.
put
(
"userName"
,
jieLinkUser
);
paramMap
.
put
(
"password"
,
jieLinkPwd
);
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
paramMap
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
try
{
try
{
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"getAppKeyInfo接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"getAppKeyInfo接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
JSONObject
body
=
responseEntity
.
getBody
();
if
(
StringUtils
.
equals
(
body
.
getString
(
"code"
),
"0"
))
{
List
<
AppInfoDto
>
appInfoDtoList
=
JSONArray
.
parseArray
(
body
.
getJSONArray
(
"data"
).
toJSONString
(),
AppInfoDto
.
class
);
if
(
appInfoDtoList
!=
null
&&
!
appInfoDtoList
.
isEmpty
())
{
if
(
StringUtils
.
equals
(
body
.
getString
(
"code"
),
"0"
))
{
List
<
AppInfoDto
>
appInfoDtoList
=
JSONArray
.
parseArray
(
body
.
getJSONArray
(
"data"
).
toJSONString
(),
AppInfoDto
.
class
);
if
(
appInfoDtoList
!=
null
&&
!
appInfoDtoList
.
isEmpty
())
{
AppInfoDto
appInfoDto
=
appInfoDtoList
.
get
(
0
);
SignDto
signData
=
new
SignDto
();
signData
.
setAppId
(
appInfoDto
.
getAppId
());
signData
.
setKey
(
appInfoDto
.
getKey
());
return
signData
;
}
else
{
}
else
{
//返回结果为空
return
null
;
}
}
else
{
log
.
error
(
"getAppKeyInfo接口返回错误信息:"
+
body
.
getString
(
"msg"
));
}
else
{
log
.
error
(
"getAppKeyInfo接口返回错误信息:"
+
body
.
getString
(
"msg"
));
//请求返回结果错误啦
return
null
;
}
}
else
{
}
else
{
//请求失败啦
log
.
error
(
"getAppKeyInfo接口请求失败"
);
return
null
;
}
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
return
null
;
}
}
/**
* 推送新增用户对象到捷顺服务中
*
* @param userData
* @return
*/
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
public
boolean
pushAddUserData
(
SysUser
userData
)
{
String
apiUri
=
"/api/base/addperson"
;
HttpHeaders
headers
=
this
.
loadHeaderHandle
();
if
(
headers
!=
null
)
{
if
(
headers
!=
null
)
{
JieLinkPersonDto
pushData
=
this
.
convertUserBean
(
userData
);
HttpEntity
<
JieLinkPersonDto
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
HttpEntity
<
JieLinkPersonDto
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
...
...
@@ -161,7 +169,7 @@ public class JieLinkServiceImpl implements IJieLinkService {
log
.
error
(
"pushAddUserData接口请求时缺少用户ID"
);
return
false
;
}
}
else
{
}
else
{
//返回结果为空
return
false
;
}
...
...
@@ -170,16 +178,16 @@ public class JieLinkServiceImpl implements IJieLinkService {
//请求返回结果错误啦
return
false
;
}
}
else
{
}
else
{
//请求失败啦
log
.
error
(
"pushAddUserData接口请求失败"
);
return
false
;
}
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
return
false
;
}
}
else
{
}
else
{
//认证信息获取失败
log
.
error
(
"pushAddUserData接口获取认证参数失败"
);
return
false
;
...
...
@@ -189,49 +197,50 @@ public class JieLinkServiceImpl implements IJieLinkService {
/**
* 推送更新的用户信息到接口服务中
*
* @param userData
* @return
*/
@Override
public
boolean
pushModifyUserData
(
SysUser
userData
)
{
if
(
userData
!=
null
&&
StringUtils
.
isNotBlank
(
userData
.
getPersonId
()))
{
if
(
userData
!=
null
&&
StringUtils
.
isNotBlank
(
userData
.
getPersonId
()))
{
String
apiUri
=
"/api/base/updateperson"
;
HttpHeaders
headers
=
this
.
loadHeaderHandle
();
if
(
headers
!=
null
)
{
if
(
headers
!=
null
)
{
JieLinkPersonDto
pushData
=
this
.
convertUserBean
(
userData
);
pushData
.
setPersonId
(
userData
.
getPersonId
());
//此处写死部门
pushData
.
setDeptId
(
"5a9dc528-e7ad-4952-9f21-a885b6564a1c"
);
HttpEntity
<
JieLinkPersonDto
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
HttpEntity
<
JieLinkPersonDto
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"pushModifyUserData接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"pushModifyUserData接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
JieLinkResultDto
<
JieLinkPersonDto
>
resultData
=
JSONObject
.
toJavaObject
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
))
{
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
))
{
return
true
;
}
else
{
log
.
error
(
"pushAddUserData接口返回错误信息:"
+
resultData
.
getMsg
());
}
else
{
log
.
error
(
"pushAddUserData接口返回错误信息:"
+
resultData
.
getMsg
());
//请求返回结果错误啦
return
false
;
}
}
else
{
}
else
{
//请求失败啦
log
.
error
(
"pushAddUserData接口请求失败"
);
return
false
;
}
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
return
false
;
}
}
else
{
}
else
{
//认证信息获取失败
log
.
error
(
"pushAddUserData接口获取认证参数失败"
);
return
false
;
}
}
else
{
}
else
{
log
.
error
(
"当前用户没有捷顺系统的ID,无法更新"
);
return
true
;
}
...
...
@@ -239,42 +248,42 @@ public class JieLinkServiceImpl implements IJieLinkService {
@Override
public
boolean
pushDelUserData
(
SysUser
userData
)
{
if
(
userData
!=
null
&&
StringUtils
.
isNotBlank
(
userData
.
getPersonId
()))
{
if
(
userData
!=
null
&&
StringUtils
.
isNotBlank
(
userData
.
getPersonId
()))
{
String
apiUri
=
"/api/base/deleteperson"
;
HttpHeaders
headers
=
this
.
loadHeaderHandle
();
if
(
headers
!=
null
)
{
if
(
headers
!=
null
)
{
JSONObject
paramMap
=
new
JSONObject
();
paramMap
.
put
(
"personId"
,
userData
.
getPersonId
());
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
paramMap
,
headers
);
paramMap
.
put
(
"personId"
,
userData
.
getPersonId
());
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
paramMap
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"pushDelUserData接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"pushDelUserData接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
JieLinkResultDto
<
JieLinkPersonDto
>
resultData
=
JSONObject
.
toJavaObject
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
))
{
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
))
{
return
true
;
}
else
{
log
.
error
(
"pushDelUserData接口返回错误信息:"
+
resultData
.
getMsg
());
}
else
{
log
.
error
(
"pushDelUserData接口返回错误信息:"
+
resultData
.
getMsg
());
//请求返回结果错误啦
return
false
;
}
}
else
{
}
else
{
//请求失败啦
log
.
error
(
"pushDelUserData接口请求失败"
);
return
false
;
}
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
return
false
;
}
}
else
{
}
else
{
//认证信息获取失败
log
.
error
(
"pushDelUserData接口获取认证参数失败"
);
return
false
;
}
}
else
{
}
else
{
log
.
error
(
"当前用户没有捷顺系统的ID,无法更新"
);
return
true
;
}
...
...
@@ -282,27 +291,31 @@ public class JieLinkServiceImpl implements IJieLinkService {
/**
* 用户对象转换
*
* @param userData
* @return
*/
private
JieLinkPersonDto
convertUserBean
(
SysUser
userData
){
private
JieLinkPersonDto
convertUserBean
(
SysUser
userData
)
{
JieLinkPersonDto
pushData
=
new
JieLinkPersonDto
();
pushData
.
setPersonNo
(
userData
.
getUsername
());
//人员编号
pushData
.
setPersonName
(
userData
.
getName
());
//姓名 必填
pushData
.
setPersonGender
(
StringUtils
.
equals
(
"0"
,
userData
.
getSex
())?
1
:
StringUtils
.
equals
(
"1"
,
userData
.
getSex
())?
0
:
null
);
//性别
pushData
.
setPersonGender
(
StringUtils
.
equals
(
"0"
,
userData
.
getSex
())
?
1
:
StringUtils
.
equals
(
"1"
,
userData
.
getSex
())
?
0
:
null
);
//性别
//此处需要将头像信息转换成BASE64数据存储
if
(
StringUtils
.
isNotBlank
(
userData
.
getFaceAddress
()))
{
if
(
StringUtils
.
isNotBlank
(
userData
.
getFaceAddress
()))
{
//读取文件将文件转换为base64字符串
String
picBase64Str
=
encryptToBase64
(
userData
.
getFaceAddress
());
if
(
StringUtils
.
isNotBlank
(
picBase64Str
)){
String
path
=
userData
.
getFaceAddress
().
replaceAll
(
baseDiscovery
,
baseUploadLocation
);
log
.
error
(
"path-----------"
+
path
);
String
picBase64Str
=
encryptToBase64
(
path
);
if
(
StringUtils
.
isNotBlank
(
picBase64Str
))
{
pushData
.
setPersonPhoto
(
picBase64Str
);
}
log
.
error
(
"图片转换成功"
);
}
//身份证处理
if
(
StringUtils
.
isNotBlank
(
userData
.
getIdNumber
()))
{
if
(
userData
.
getIdNumber
().
trim
().
length
()==
15
)
{
if
(
StringUtils
.
isNotBlank
(
userData
.
getIdNumber
()))
{
if
(
userData
.
getIdNumber
().
trim
().
length
()
==
15
)
{
pushData
.
setCertificateType
(
"GENERIDENT"
);
//一代身份证
}
else
{
}
else
{
//其他类型不符合长度要求,默认按照二代身份证处理
pushData
.
setCertificateType
(
"IDENTITY"
);
//默认二代身份证
}
...
...
@@ -310,19 +323,20 @@ public class JieLinkServiceImpl implements IJieLinkService {
}
pushData
.
setMobile
(
userData
.
getPhone
());
//必填
pushData
.
setEmail
(
userData
.
getEmail
());
if
(
StringUtils
.
isNotBlank
(
userData
.
getUserType
()))
{
if
(
StringUtils
.
equals
(
"0"
,
userData
.
getUserType
()))
{
if
(
StringUtils
.
isNotBlank
(
userData
.
getUserType
()))
{
if
(
StringUtils
.
equals
(
"0"
,
userData
.
getUserType
()))
{
pushData
.
setTenementType
(
1
);
//正式员工
}
else
{
}
else
{
pushData
.
setTenementType
(
5
);
//非正式员工以外全部定义为临时人员
}
}
return
pushData
;
return
pushData
;
}
/**
* 推送方可邀请记录到接口服务中
*
* @param visitInfoMation
* @return
*/
...
...
@@ -330,34 +344,34 @@ public class JieLinkServiceImpl implements IJieLinkService {
public
boolean
pushVisitorData
(
VisitInfoMation
visitInfoMation
)
{
String
apiUri
=
"/api/base/visitordatainvite"
;
HttpHeaders
headers
=
this
.
loadHeaderHandle
();
if
(
headers
!=
null
)
{
if
(
headers
!=
null
)
{
JSONObject
pushData
=
this
.
convertVisitorData
(
visitInfoMation
);
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
//后续处理逻辑
log
.
debug
(
"pushVisitorData接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
//后续处理逻辑
log
.
debug
(
"pushVisitorData接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
JieLinkResultDto
<
JSONObject
>
resultData
=
JSONObject
.
toJavaObject
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
))
{
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
))
{
return
true
;
}
else
{
log
.
error
(
"pushVisitorData接口返回错误信息:"
+
resultData
.
getMsg
());
}
else
{
log
.
error
(
"pushVisitorData接口返回错误信息:"
+
resultData
.
getMsg
());
//请求返回结果错误啦
return
false
;
}
}
else
{
}
else
{
//请求失败啦
log
.
error
(
"pushVisitorData接口请求失败"
);
return
false
;
}
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
return
false
;
}
}
else
{
}
else
{
//认证信息获取失败
log
.
error
(
"pushVisitorData接口获取认证参数失败"
);
return
false
;
...
...
@@ -367,6 +381,7 @@ public class JieLinkServiceImpl implements IJieLinkService {
/**
* 撤销邀访记录
*
* @param visitUserId 邀访人Id
* @param visitInfoId 邀请记录ID
* @return
...
...
@@ -375,42 +390,42 @@ public class JieLinkServiceImpl implements IJieLinkService {
public
boolean
cancelVisitorData
(
String
visitUserId
,
String
visitInfoId
)
{
String
apiUri
=
"/api/base/visitdatacancelinvite"
;
HttpHeaders
headers
=
this
.
loadHeaderHandle
();
if
(
headers
!=
null
)
{
if
(
headers
!=
null
)
{
JSONObject
pushData
=
new
JSONObject
();
if
(
StringUtils
.
isNotBlank
(
visitInfoId
))
{
pushData
.
put
(
"inviteId"
,
visitInfoId
);
}
else
if
(
StringUtils
.
isNotBlank
(
visitUserId
))
{
pushData
.
put
(
"visitorId"
,
visitUserId
);
}
else
{
if
(
StringUtils
.
isNotBlank
(
visitInfoId
))
{
pushData
.
put
(
"inviteId"
,
visitInfoId
);
}
else
if
(
StringUtils
.
isNotBlank
(
visitUserId
))
{
pushData
.
put
(
"visitorId"
,
visitUserId
);
}
else
{
//
log
.
error
(
"cancelVisitorData 接口传递的参数信息有误,请检查参数"
);
return
false
;
}
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"cancelVisitorData接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"cancelVisitorData接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
JieLinkResultDto
resultData
=
JSONObject
.
toJavaObject
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
))
{
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
))
{
return
true
;
}
else
{
log
.
error
(
"cancelVisitorData接口返回错误信息:"
+
resultData
.
getMsg
());
}
else
{
log
.
error
(
"cancelVisitorData接口返回错误信息:"
+
resultData
.
getMsg
());
//请求返回结果错误啦
return
false
;
}
}
else
{
}
else
{
//请求失败啦
log
.
error
(
"cancelVisitorData接口请求失败"
);
return
false
;
}
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
return
false
;
}
}
else
{
}
else
{
//认证信息获取失败
log
.
error
(
"cancelVisitorData接口获取认证参数失败"
);
return
false
;
...
...
@@ -420,34 +435,48 @@ public class JieLinkServiceImpl implements IJieLinkService {
/**
* 所有设备ID
*/
public
static
List
<
Map
<
String
,
String
>>
deviceGuidAllArray
=
new
ArrayList
<>();
public
static
List
<
Map
<
String
,
String
>>
deviceGuidAllArray
=
new
ArrayList
<>();
/**
* 门口设备集合
*/
public
static
List
<
Map
<
String
,
String
>>
deviceGuidInArray
=
new
ArrayList
<>();
static
{
deviceGuidAllArray
.
add
(
new
HashMap
(){{
put
(
"deviceApGuid"
,
"59c50c9c-3d75-420f-be9b-ad2db1aee432"
);}});
//右出口
deviceGuidAllArray
.
add
(
new
HashMap
(){{
put
(
"deviceApGuid"
,
"64467dcf-9e59-495e-b9e4-f65a98732a99"
);}});
//右入口
deviceGuidAllArray
.
add
(
new
HashMap
(){{
put
(
"deviceApGuid"
,
"6e2bfaad-feb3-4171-9b85-86f00589bcce"
);}});
//左入口
deviceGuidAllArray
.
add
(
new
HashMap
(){{
put
(
"deviceApGuid"
,
"e90c55ec-bc68-498d-966c-66091ee85c27"
);}});
//左出口
deviceGuidAllArray
.
add
(
new
HashMap
(){{
put
(
"deviceApGuid"
,
"754fdf10-be59-4004-b869-969dbc61987d"
);}});
//大门出口
deviceGuidAllArray
.
add
(
new
HashMap
(){{
put
(
"deviceApGuid"
,
"a3dc7973-a64c-4359-bdc9-a19fe32a9f9d"
);}});
//大门入口
public
static
List
<
Map
<
String
,
String
>>
deviceGuidInArray
=
new
ArrayList
<>();
static
{
deviceGuidAllArray
.
add
(
new
HashMap
()
{{
put
(
"deviceApGuid"
,
"59c50c9c-3d75-420f-be9b-ad2db1aee432"
);
}});
//右出口
deviceGuidAllArray
.
add
(
new
HashMap
()
{{
put
(
"deviceApGuid"
,
"64467dcf-9e59-495e-b9e4-f65a98732a99"
);
}});
//右入口
deviceGuidAllArray
.
add
(
new
HashMap
()
{{
put
(
"deviceApGuid"
,
"6e2bfaad-feb3-4171-9b85-86f00589bcce"
);
}});
//左入口
deviceGuidAllArray
.
add
(
new
HashMap
()
{{
put
(
"deviceApGuid"
,
"e90c55ec-bc68-498d-966c-66091ee85c27"
);
}});
//左出口
deviceGuidAllArray
.
add
(
new
HashMap
()
{{
put
(
"deviceApGuid"
,
"754fdf10-be59-4004-b869-969dbc61987d"
);
}});
//大门出口
deviceGuidAllArray
.
add
(
new
HashMap
()
{{
put
(
"deviceApGuid"
,
"a3dc7973-a64c-4359-bdc9-a19fe32a9f9d"
);
}});
//大门入口
//门口访客机器
deviceGuidInArray
.
add
(
new
HashMap
(){{
put
(
"deviceApGuid"
,
""
);}});
deviceGuidInArray
.
add
(
new
HashMap
()
{{
put
(
"deviceApGuid"
,
""
);
}});
}
/**
* 邀访记录转换
*
* @param infoMation
* @return
*/
private
JSONObject
convertVisitorData
(
VisitInfoMation
infoMation
){
private
JSONObject
convertVisitorData
(
VisitInfoMation
infoMation
)
{
JSONObject
result
=
new
JSONObject
();
VisitDataInviteDto
manData
=
new
VisitDataInviteDto
();
manData
.
setPersonId
(
sysUserService
.
getPersionIdByUserId
(
infoMation
.
getUserId
()));
//转换ID
...
...
@@ -460,49 +489,49 @@ public class JieLinkServiceImpl implements IJieLinkService {
queryDicData
.
setFlag
(
"1"
);
List
<
SysDictData
>
dictDataList
=
dictDataRepositorys
.
querySysDictDatas
(
queryDicData
);
JSONObject
timeObj
=
new
JSONObject
();
for
(
SysDictData
dicData:
dictDataList
)
{
for
(
SysDictData
dicData
:
dictDataList
)
{
String
dictValue
=
dicData
.
getDictValue
();
//此处可能会有类型转换报错的BUG
int
factor
=
Integer
.
parseInt
(
dictValue
);
int
factor
=
Integer
.
parseInt
(
dictValue
);
String
dictLabel
=
dicData
.
getDictLabel
();
if
(
StringUtils
.
equals
(
"advance"
,
dictLabel
))
{
Date
startTime
=
new
Date
(
visitRealTime
.
getTime
()
-(
factor
*
60
*
1000
));
timeObj
.
put
(
"sd"
,
DateUtil
.
format
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
));
}
else
if
(
StringUtils
.
equals
(
"late"
,
dictLabel
))
{
Date
startTime
=
new
Date
(
visitRealTime
.
getTime
()
+(
factor
*
60
*
1000
));
timeObj
.
put
(
"ed"
,
DateUtil
.
format
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
));
if
(
StringUtils
.
equals
(
"advance"
,
dictLabel
))
{
Date
startTime
=
new
Date
(
visitRealTime
.
getTime
()
-
(
factor
*
60
*
1000
));
timeObj
.
put
(
"sd"
,
DateUtil
.
format
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
));
}
else
if
(
StringUtils
.
equals
(
"late"
,
dictLabel
))
{
Date
startTime
=
new
Date
(
visitRealTime
.
getTime
()
+
(
factor
*
60
*
1000
));
timeObj
.
put
(
"ed"
,
DateUtil
.
format
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
));
}
}
manData
.
setTimeDesc
(
timeObj
.
toJSONString
());
//邀访时间格式 需要根据两个字段以及数据字典中对应的类型进行计算得到开始和结束时间
manData
.
setVisitorType
(
"3"
);
//访客类型
//到访事由 两个字段做或判断
if
(
StringUtils
.
isNotBlank
(
infoMation
.
getVisitReason
()))
{
if
(
StringUtils
.
isNotBlank
(
infoMation
.
getVisitReason
()))
{
manData
.
setContent
(
infoMation
.
getVisitReason
());
}
else
{
}
else
{
manData
.
setContent
(
infoMation
.
getVisitReasonOther
());
}
//访问区域设置
if
(
StringUtils
.
isNotBlank
(
infoMation
.
getVisitRegionCode
()))
{
if
(
StringUtils
.
isNotBlank
(
infoMation
.
getVisitRegionCode
()))
{
String
[]
codeArray
=
infoMation
.
getVisitRegionCode
().
split
(
","
);
if
(
codeArray
.
length
==
1
)
{
if
(
codeArray
.
length
==
1
)
{
//判断设备是办公楼 则认为是全部设备,相反则只有门口的设备
if
(
StringUtils
.
equals
(
"0"
,
codeArray
[
0
]))
{
if
(
StringUtils
.
equals
(
"0"
,
codeArray
[
0
]))
{
manData
.
setDeviceApList
(
deviceGuidAllArray
);
}
else
{
}
else
{
manData
.
setDeviceApList
(
deviceGuidInArray
);
}
}
else
if
(
codeArray
.
length
==
2
)
{
}
else
if
(
codeArray
.
length
==
2
)
{
//两个都选了,则认为是所有设备全部开启
manData
.
setDeviceApList
(
deviceGuidAllArray
);
manData
.
setDeviceApList
(
deviceGuidAllArray
);
}
}
else
{
}
else
{
//默认只给门口设备的权限
manData
.
setDeviceApList
(
deviceGuidInArray
);
}
List
<
VisitDataSubItemDto
>
userList
=
new
ArrayList
<>();
if
(
infoMation
.
getUserList
()!=
null
&&
!
infoMation
.
getUserList
().
isEmpty
())
{
if
(
infoMation
.
getUserList
()
!=
null
&&
!
infoMation
.
getUserList
().
isEmpty
())
{
List
<
VisitUser
>
userDataList
=
infoMation
.
getUserList
();
for
(
VisitUser
user:
userDataList
)
{
for
(
VisitUser
user
:
userDataList
)
{
VisitDataSubItemDto
userItemDto
=
new
VisitDataSubItemDto
();
//此处的访客ID存在问题,一会沟通下
userItemDto
.
setVisitorId
(
user
.
getPersonId
());
//访客ID
...
...
@@ -521,8 +550,8 @@ public class JieLinkServiceImpl implements IJieLinkService {
userList
.
add
(
userItemDto
);
}
}
result
.
put
(
"visitDataInviteModel"
,
manData
);
result
.
put
(
"visitDataSubItemModelList"
,
userList
);
result
.
put
(
"visitDataInviteModel"
,
manData
);
result
.
put
(
"visitDataSubItemModelList"
,
userList
);
return
result
;
}
...
...
@@ -535,39 +564,39 @@ public class JieLinkServiceImpl implements IJieLinkService {
public
String
pullVisitUserQrCode
(
String
visitUserId
)
{
String
apiUri
=
"/api/base/getqrcodedata"
;
HttpHeaders
headers
=
this
.
loadHeaderHandle
();
if
(
headers
!=
null
)
{
if
(
headers
!=
null
)
{
JSONObject
pushData
=
new
JSONObject
();
pushData
.
put
(
"guid"
,
visitUserId
);
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
pushData
.
put
(
"guid"
,
visitUserId
);
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"pullVisitUserQrCode接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"pullVisitUserQrCode接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
JieLinkResultDto
<
JSONObject
>
resultData
=
JSONObject
.
toJavaObject
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
))
{
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
))
{
JSONObject
data
=
resultData
.
getData
();
if
(
data
.
containsKey
(
"qrCodeData"
))
{
if
(
data
.
containsKey
(
"qrCodeData"
))
{
return
data
.
getString
(
"qrCodeData"
);
}
else
{
}
else
{
return
null
;
}
}
else
{
log
.
error
(
"pullVisitUserQrCode接口返回错误信息:"
+
resultData
.
getMsg
());
}
else
{
log
.
error
(
"pullVisitUserQrCode接口返回错误信息:"
+
resultData
.
getMsg
());
//请求返回结果错误啦
return
null
;
}
}
else
{
}
else
{
//请求失败啦
log
.
error
(
"pullVisitUserQrCode接口请求失败"
);
return
null
;
}
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
return
null
;
}
}
else
{
}
else
{
//认证信息获取失败
log
.
error
(
"pullVisitUserQrCode接口获取认证参数失败"
);
return
null
;
...
...
@@ -577,6 +606,7 @@ public class JieLinkServiceImpl implements IJieLinkService {
/**
* 保存门禁访问记录
*
* @param recordDto
* @return
*/
...
...
@@ -591,11 +621,11 @@ public class JieLinkServiceImpl implements IJieLinkService {
JieLinkResultDto
result
=
new
JieLinkResultDto
();
JieLinkPersonDto
person
=
recordDto
.
getPerson
();
SysUser
sysUserData
=
null
;
if
(
person
!=
null
)
{
//
if
(
person
!=
null
)
{
//
String
personId
=
person
.
getPersonId
();
if
(
StringUtils
.
isNotBlank
(
personId
))
{
if
(
StringUtils
.
isNotBlank
(
personId
))
{
sysUserData
=
sysUserService
.
getUserDataByPersonId
(
personId
);
if
(
sysUserData
==
null
)
{
if
(
sysUserData
==
null
)
{
//将用户添加到SYS_USER表
sysUserData
=
new
SysUser
();
sysUserData
.
setPersonId
(
personId
);
//对应ID
...
...
@@ -603,13 +633,13 @@ public class JieLinkServiceImpl implements IJieLinkService {
sysUserData
.
setUserType
(
"1"
);
//默认定义为游客用户
sysUserData
.
setEmail
(
person
.
getEmail
());
//邮箱
sysUserData
.
setPhone
(
person
.
getMobile
());
//手机号
sysUserData
.
setSex
(
person
.
getPersonGender
()
==
0
?
"1"
:
"0"
);
//性别
sysUserData
.
setSex
(
person
.
getPersonGender
()
==
0
?
"1"
:
"0"
);
//性别
//证件信息
if
(
StringUtils
.
equals
(
person
.
getCertificateType
(),
"GENERIDENT"
)
||
StringUtils
.
equals
(
person
.
getCertificateType
(),
"IDENTITY"
))
{
if
(
StringUtils
.
equals
(
person
.
getCertificateType
(),
"GENERIDENT"
)
||
StringUtils
.
equals
(
person
.
getCertificateType
(),
"IDENTITY"
))
{
sysUserData
.
setIdNumber
(
person
.
getIdentityNo
());
}
else
{
}
else
{
log
.
error
(
"添加的用户使用的是非身份证信息,暂时将其写入到身份证字段中"
);
sysUserData
.
setIdNumber
(
person
.
getCertificateType
()
+
"_"
+
person
.
getIdentityNo
());
sysUserData
.
setIdNumber
(
person
.
getCertificateType
()
+
"_"
+
person
.
getIdentityNo
());
}
//地址
sysUserData
.
setAddress
(
person
.
getAddress
());
//
...
...
@@ -618,13 +648,13 @@ public class JieLinkServiceImpl implements IJieLinkService {
//此处还需要查询一次用户的ID
sysUserData
=
sysUserService
.
getUserDataByPersonId
(
personId
);
}
}
else
{
}
else
{
//访客ID无了
result
.
setCode
(
"ILLEGAL_ARGUMENT"
);
result
.
setMsg
(
"人员信息丢失,请检查参数"
);
return
result
;
}
}
else
{
}
else
{
//访客记录为空了
result
.
setCode
(
"ILLEGAL_ARGUMENT"
);
result
.
setMsg
(
"人员信息丢失,请检查参数"
);
...
...
@@ -632,24 +662,24 @@ public class JieLinkServiceImpl implements IJieLinkService {
}
JieLinkDeviceDto
device
=
recordDto
.
getDevice
();
Devices
devices
=
null
;
if
(
device
!=
null
)
{
if
(
StringUtils
.
isNotBlank
(
device
.
getDeviceGuid
()))
{
if
(
device
!=
null
)
{
if
(
StringUtils
.
isNotBlank
(
device
.
getDeviceGuid
()))
{
Devices
deviceInfo
=
devicesService
.
getDeviceInfoByDeviceGuid
(
device
.
getDeviceGuid
());
if
(
deviceInfo
!=
null
)
{
if
(
deviceInfo
!=
null
)
{
devices
=
deviceInfo
;
}
else
{
}
else
{
//设备无了
result
.
setCode
(
"ILLEGAL_ARGUMENT"
);
result
.
setMsg
(
"设备未获取或关键信息错误,请检查参数"
);
return
result
;
}
}
else
{
}
else
{
//设备无了
result
.
setCode
(
"ILLEGAL_ARGUMENT"
);
result
.
setMsg
(
"设备关键信息丢失,请检查参数"
);
return
result
;
}
}
else
{
}
else
{
//设备无了
result
.
setCode
(
"ILLEGAL_ARGUMENT"
);
result
.
setMsg
(
"设备信息丢失,请检查参数"
);
...
...
@@ -665,20 +695,20 @@ public class JieLinkServiceImpl implements IJieLinkService {
record
.
setDeviceId
(
device
.
getDeviceGuid
());
//需要根据设备补全
record
.
setDeviceName
(
device
.
getDeviceName
());
//需要根据设备补全
//TODO 此处字段需要后续修改,需要根据业务调整
record
.
setDeviceType
(
device
.
getDeviceType
()
+
""
);
//需要根据设备不全
record
.
setCardType
(
recordDto
.
getCardType
()
+
""
);
record
.
setDeviceType
(
device
.
getDeviceType
()
+
""
);
//需要根据设备不全
record
.
setCardType
(
recordDto
.
getCardType
()
+
""
);
record
.
setCardNo
(
recordDto
.
getCardNo
());
if
(
StringUtils
.
isNotBlank
(
recordDto
.
getCrossTime
()))
{
if
(
StringUtils
.
isNotBlank
(
recordDto
.
getCrossTime
()))
{
//触发时间无了
result
.
setCode
(
"ILLEGAL_ARGUMENT"
);
result
.
setMsg
(
"闸机触发时间丢失,请检查参数"
);
return
result
;
}
else
{
}
else
{
DateTime
crossTime
=
DateUtil
.
parse
(
recordDto
.
getCrossTime
(),
"yyyy-MM-dd HH:mm:ss"
);
record
.
setCrossTime
(
crossTime
.
toJdkDate
());
}
record
.
setRecordType
(
recordDto
.
getRecordType
()
+
""
);
record
.
setEventType
(
recordDto
.
getEventType
()
+
""
);
record
.
setRecordType
(
recordDto
.
getRecordType
()
+
""
);
record
.
setEventType
(
recordDto
.
getEventType
()
+
""
);
record
.
setFlag
(
"0"
);
record
.
setDelFlag
(
"0"
);
record
.
setCreateBy
(
null
);
...
...
@@ -690,46 +720,46 @@ public class JieLinkServiceImpl implements IJieLinkService {
public
void
syncDeviceInfo
()
{
String
apiUri
=
"/api/base/devices"
;
HttpHeaders
headers
=
this
.
loadHeaderHandle
();
if
(
headers
!=
null
)
{
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
null
,
headers
);
if
(
headers
!=
null
)
{
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
null
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
info
(
"syncDeviceInfo接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
info
(
"syncDeviceInfo接口返回信息:"
+
responseEntity
.
getBody
().
toJSONString
());
JSONObject
body
=
responseEntity
.
getBody
();
if
(
StringUtils
.
equals
(
body
.
getString
(
"code"
),
"0"
))
{
if
(
StringUtils
.
equals
(
body
.
getString
(
"code"
),
"0"
))
{
JSONObject
data
=
body
.
getJSONObject
(
"data"
);
if
(
data
.
containsKey
(
"devices"
)
&&
StringUtils
.
isNotBlank
(
data
.
getString
(
"devices"
)))
{
List
<
Devices
>
devicesList
=
JSONArray
.
parseArray
(
data
.
getJSONArray
(
"devices"
).
toJSONString
(),
Devices
.
class
);
if
(
devicesList
!=
null
&&
!
devicesList
.
isEmpty
())
{
if
(
data
.
containsKey
(
"devices"
)
&&
StringUtils
.
isNotBlank
(
data
.
getString
(
"devices"
)))
{
List
<
Devices
>
devicesList
=
JSONArray
.
parseArray
(
data
.
getJSONArray
(
"devices"
).
toJSONString
(),
Devices
.
class
);
if
(
devicesList
!=
null
&&
!
devicesList
.
isEmpty
())
{
List
<
Devices
>
searchList
=
devicesService
.
findAll
(
null
);
Map
<
String
,
Devices
>
searchMap
=
new
HashMap
<>();
for
(
Devices
d:
searchList
)
{
searchMap
.
put
(
d
.
getDeviceGuid
(),
d
);
Map
<
String
,
Devices
>
searchMap
=
new
HashMap
<>();
for
(
Devices
d
:
searchList
)
{
searchMap
.
put
(
d
.
getDeviceGuid
(),
d
);
}
for
(
Devices
inDevice:
devicesList
)
{
for
(
Devices
inDevice
:
devicesList
)
{
inDevice
.
setDeviceType
(
null
);
inDevice
.
setDeviceioType
(
null
);
if
(
searchMap
.
containsKey
(
inDevice
.
getDeviceGuid
()))
{
if
(
searchMap
.
containsKey
(
inDevice
.
getDeviceGuid
()))
{
devicesService
.
merge
(
inDevice
);
}
else
{
}
else
{
devicesService
.
persist
(
inDevice
);
}
}
}
}
}
else
{
log
.
error
(
"syncDeviceInfo接口返回错误信息:"
+
body
.
getString
(
"msg"
));
}
else
{
log
.
error
(
"syncDeviceInfo接口返回错误信息:"
+
body
.
getString
(
"msg"
));
}
}
else
{
}
else
{
log
.
error
(
"syncDeviceInfo接口请求失败"
);
}
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
(),
ex
);
}
}
else
{
}
else
{
//认证信息获取失败
log
.
error
(
"syncDeviceInfo接口获取认证参数失败"
);
}
...
...
@@ -771,36 +801,37 @@ public class JieLinkServiceImpl implements IJieLinkService {
/**
* 创建hander头信息
*
* @return
*/
private
HttpHeaders
loadHeaderHandle
(){
private
HttpHeaders
loadHeaderHandle
()
{
//加载头部信息
if
(
SignUtils
.
signData
!=
null
)
{
if
(
SignUtils
.
signData
!=
null
)
{
SignDto
signData
=
SignUtils
.
getSignData
(
SignUtils
.
signData
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON_UTF8
);
headers
.
set
(
"Accept"
,
MediaType
.
APPLICATION_JSON_VALUE
);
headers
.
set
(
"appId"
,
signData
.
getAppId
());
headers
.
set
(
"v"
,
signData
.
getV
());
headers
.
set
(
"random"
,
signData
.
getRandom
());
headers
.
set
(
"timestamp"
,
signData
.
getTimestamp
());
headers
.
set
(
"sign"
,
signData
.
getSign
());
headers
.
set
(
"appId"
,
signData
.
getAppId
());
headers
.
set
(
"v"
,
signData
.
getV
());
headers
.
set
(
"random"
,
signData
.
getRandom
());
headers
.
set
(
"timestamp"
,
signData
.
getTimestamp
());
headers
.
set
(
"sign"
,
signData
.
getSign
());
return
headers
;
}
else
{
}
else
{
SignDto
appKeyInfo
=
this
.
getAppKeyInfo
();
if
(
appKeyInfo
!=
null
)
{
if
(
appKeyInfo
!=
null
)
{
SignUtils
.
signData
=
appKeyInfo
;
SignDto
signData
=
SignUtils
.
getSignData
(
appKeyInfo
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON_UTF8
);
headers
.
set
(
"Accept"
,
MediaType
.
APPLICATION_JSON_VALUE
);
headers
.
set
(
"appId"
,
signData
.
getAppId
());
headers
.
set
(
"v"
,
signData
.
getV
());
headers
.
set
(
"random"
,
signData
.
getRandom
());
headers
.
set
(
"timestamp"
,
signData
.
getTimestamp
());
headers
.
set
(
"sign"
,
signData
.
getSign
());
headers
.
set
(
"appId"
,
signData
.
getAppId
());
headers
.
set
(
"v"
,
signData
.
getV
());
headers
.
set
(
"random"
,
signData
.
getRandom
());
headers
.
set
(
"timestamp"
,
signData
.
getTimestamp
());
headers
.
set
(
"sign"
,
signData
.
getSign
());
return
headers
;
}
else
{
}
else
{
return
null
;
}
}
...
...
@@ -808,6 +839,7 @@ public class JieLinkServiceImpl implements IJieLinkService {
/**
* 将文件转换为base64字符串
*
* @param filePath
* @return
*/
...
...
@@ -819,7 +851,7 @@ public class JieLinkServiceImpl implements IJieLinkService {
byte
[]
b
=
Files
.
readAllBytes
(
Paths
.
get
(
filePath
));
return
Base64
.
getEncoder
().
encodeToString
(
b
);
}
catch
(
IOException
e
)
{
log
.
error
(
"读取用户头像文件失败:"
+
e
.
getMessage
(),
e
);
log
.
error
(
"读取用户头像文件失败:"
+
e
.
getMessage
(),
e
);
}
return
null
;
}
...
...
src/main/java/org/rcisoft/sys/sysuser/controller/SysUserController.java
View file @
509ac65a
...
...
@@ -73,6 +73,11 @@ public class SysUserController extends CyPaginationController<SysUser> {
@Autowired
private
IJieLinkService
jieLinkServiceImpl
;
/**
* 捷顺开关
*/
@Value
(
"${jieLink.synchronization}"
)
private
boolean
synchronization
;
//@PreAuthorize("@cyPerm.hasPerm('sys:user:add')")
@CyOpeLogAnno
(
title
=
"system-用户表管理-新增用户表"
,
businessType
=
CyLogTypeEnum
.
INSERT
)
...
...
@@ -272,8 +277,11 @@ public class SysUserController extends CyPaginationController<SysUser> {
@ResponseBody
public
CyResult
getTradeScan
(
@PathVariable
String
personId
)
{
// 根据用户id获取personId
// String codeUrl = jieLinkServiceImpl.pullVisitUserQrCode(personId);
String
codeUrl
=
"sysUserServiceImpl.findById(businessId).toString()"
;
String
codeUrl
=
""
;
if
(
synchronization
)
codeUrl
=
jieLinkServiceImpl
.
pullVisitUserQrCode
(
personId
);
else
codeUrl
=
"sysUserServiceImpl.findById(businessId).toString()"
;
String
png_base64
=
null
;
//返回二维码 并且构造支付包web支付对象
ByteArrayOutputStream
baOp
=
new
ByteArrayOutputStream
();
...
...
src/main/java/org/rcisoft/sys/sysuser/service/impl/SysUserServiceImpl.java
View file @
509ac65a
...
...
@@ -4,7 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.rcisoft.core.component.CyDownErrorTxtComp
;
import
org.rcisoft.core.exception.CyServiceException
;
import
org.rcisoft.core.result.enums.CyResSvcExcEnum
;
import
org.rcisoft.core.util.CyCompareToolUtils
;
...
...
@@ -13,7 +12,6 @@ import org.rcisoft.core.model.CyPersistModel;
import
org.rcisoft.integration.jieLink.service.impl.JieLinkServiceImpl
;
import
org.rcisoft.sys.dictionary.dao.DictDataRepository
;
import
org.rcisoft.sys.dictionary.entity.DictData
;
import
org.rcisoft.sys.dictionary.service.DictionaryService
;
import
org.rcisoft.sys.rbac.dept.dao.SysDeptRbacRepository
;
import
org.rcisoft.sys.rbac.dept.dto.SysDeptRbacDTO
;
import
org.rcisoft.sys.rbac.dept.entity.SysDeptRbac
;
...
...
@@ -41,15 +39,12 @@ import org.springframework.transaction.annotation.Isolation;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.rcisoft.core.model.CyPageInfo
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
/**
...
...
@@ -68,23 +63,19 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
@Autowired
private
SysDictDataRepositorys
sysDictDataRepositorys
;
@Autowired
private
DictionaryService
dictionaryService
;
@Autowired
private
DictDataRepository
dictDataRepository
;
@Autowired
private
SysDeptRbacRepository
sysDeptRbacRepository
;
@Autowired
private
JieLinkServiceImpl
jieLinkService
;
@Autowired
private
CyDownErrorTxtComp
errorTxt
;
@Autowired
private
SysUserRoleRepository
sysUserRoleRepository
;
@Autowired
private
PasswordEncoder
passwordEncoder
;
@Value
(
"${cy.init.password}"
)
private
String
password
;
/**
*
接口密码
*
捷顺开关
*/
@Value
(
"${jieLink.synchronization}"
)
private
boolean
synchronization
;
...
...
@@ -101,7 +92,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
// 如果传入的sysUser有id,则说明传入的用户为访客,则删除其作为访客的数据
if
(
sysUser
.
getBusinessId
()
!=
null
)
{
visitPersonRepositorys
.
delSysUser
(
Long
.
valueOf
(
sysUser
.
getBusinessId
()));
if
(
synchronization
)
{
if
(
synchronization
)
{
if
(!
jieLinkService
.
pushDelUserData
(
sysUser
))
{
try
{
throw
new
CyServiceException
(
500
,
"添加员工失败,请稍后重试"
);
...
...
@@ -195,6 +186,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
int
line
=
baseMapper
.
deleteById
(
sysUser
);
log
.
debug
(
CyUserUtil
.
getAuthenUsername
()
+
"逻辑删除了ID为"
+
sysUser
.
getBusinessId
()
+
"的用户表信息"
);
if
(
synchronization
)
jieLinkService
.
pushDelUserData
(
sysUser
);
return
new
CyPersistModel
(
line
);
}
...
...
@@ -602,6 +595,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
* @return
*/
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
public
boolean
saveJieLinkId
(
String
persionId
,
Integer
userId
)
{
/**
* TODO 此处需要格局用户的主键ID将捷顺的主键ID存储进去
...
...
src/main/java/org/rcisoft/sys/visit/service/impl/VisitInfomationServiceImpl.java
View file @
509ac65a
...
...
@@ -93,6 +93,12 @@ public class VisitInfomationServiceImpl extends ServiceImpl<VisitInfomationRepos
@Autowired
private
SysUserServiceImpl
sysUserService
;
/**
* 捷顺开关
*/
@Value
(
"${jieLink.synchronization}"
)
private
boolean
synchronization
;
/**
* 保存 邀访信息
*
...
...
@@ -168,10 +174,10 @@ public class VisitInfomationServiceImpl extends ServiceImpl<VisitInfomationRepos
u
.
setNormal
();
visitUserRepository
.
insert
(
u
);
});
/* if(
jieLinkService.pushVisitorData(visitInfomation)) {
if
(
synchronization
&&
jieLinkService
.
pushVisitorData
(
visitInfomation
))
{
visitInfomation
.
setSynStatus
(
"1"
);
baseMapper
.
updateById
(
visitInfomation
);
}
*/
}
return
new
CyPersistModel
(
line
);
}
...
...
src/main/resources/mapper/SysUserRepositorys.xml
View file @
509ac65a
...
...
@@ -221,7 +221,7 @@
</trim>
</insert>
<insert
id=
"addSysUsers"
parameterType=
"org.rcisoft.sys.sysuser.entity.SysUser"
useGeneratedKeys=
"true"
>
<insert
id=
"addSysUsers"
parameterType=
"org.rcisoft.sys.sysuser.entity.SysUser"
useGeneratedKeys=
"true"
keyProperty=
"businessId"
>
insert into sys_user
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"username != null"
>
username ,
</if>
...
...
@@ -306,6 +306,7 @@
address,
dept_id,
position,
person_id,
nlt_bz,
flag
from sys_user
...
...
@@ -365,7 +366,7 @@
<update
id=
"saveJieLinkPersionId"
parameterType=
"org.rcisoft.sys.sysuser.entity.SysUser"
>
update sys_user
set person_id = #{entity.personId}
where business_id = #{businessId}
where business_id = #{
entity.
businessId}
</update>
<select
id=
"getPersionIdByUserId"
resultType=
"java.lang.String"
>
...
...
src/main/resources/mapper/VisitInfomationMapper.xml
View file @
509ac65a
...
...
@@ -446,9 +446,7 @@
vi.visit_region,
vi.visit_date,
vi.visit_time,
vi.visit_status,
vu.user_name,
vu.visit_phone
vi.visit_status
from visit_infomation vi
where vi.del_flag = '0'
and vi.flag = '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