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
7103ea63
Commit
7103ea63
authored
Dec 09, 2022
by
陈明豪
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
a374fc75
cb2fc6ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
35 deletions
+35
-35
JieLinkInterController.java
...ntegration/jieLink/Controller/JieLinkInterController.java
+0
-1
JieLinkServiceImpl.java
.../integration/jieLink/service/impl/JieLinkServiceImpl.java
+35
-34
No files found.
src/main/java/org/rcisoft/integration/jieLink/Controller/JieLinkInterController.java
View file @
7103ea63
...
...
@@ -53,7 +53,6 @@ public class JieLinkInterController {
}
@CyOpeLogAnno
(
title
=
"jieLinkInter-同步设备信息"
,
businessType
=
CyLogTypeEnum
.
INSERT
)
@ApiOperation
(
value
=
"捷顺对接集成"
,
notes
=
"同步设备信息"
)
@GetMapping
(
value
=
"/syncDeviceData"
)
public
JieLinkResultDto
syncDeviceData
()
{
...
...
src/main/java/org/rcisoft/integration/jieLink/service/impl/JieLinkServiceImpl.java
View file @
7103ea63
...
...
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateTime;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -94,12 +95,12 @@ public class JieLinkServiceImpl implements IJieLinkService {
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
try
{
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
String
.
class
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"getAppKeyInfo接口返回信息:{0}"
,
responseEntity
.
getBody
());
J
ieLinkResultDto
<
List
<
AppInfoDto
>>
resultData
=
JSONObject
.
parseObject
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(
),
"0"
)){
List
<
AppInfoDto
>
appInfoDtoList
=
resultData
.
getData
(
);
log
.
debug
(
"getAppKeyInfo接口返回信息:{0}"
,
responseEntity
.
getBody
()
.
toJSONString
()
);
J
SONObject
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
()){
AppInfoDto
appInfoDto
=
appInfoDtoList
.
get
(
0
);
SignDto
signData
=
new
SignDto
();
...
...
@@ -112,13 +113,13 @@ public class JieLinkServiceImpl implements IJieLinkService {
}
}
else
{
log
.
error
(
"getAppKeyInfo接口返回错误信息:"
+
resultData
.
getMsg
(
));
log
.
error
(
"getAppKeyInfo接口返回错误信息:"
+
body
.
getString
(
"msg"
));
//请求返回结果错误啦
return
null
;
}
}
else
{
//请求失败啦
log
.
error
(
"getAppKeyInfo接口
返回错误信息:{0}"
,
responseEntity
.
getBody
()
);
log
.
error
(
"getAppKeyInfo接口
请求失败"
);
return
null
;
}
}
catch
(
Exception
ex
){
...
...
@@ -141,11 +142,11 @@ public class JieLinkServiceImpl implements IJieLinkService {
HttpEntity
<
JieLinkPersonDto
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
String
.
class
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"pushAddUserData接口返回信息:{0}"
,
responseEntity
.
getBody
());
JieLinkResultDto
<
JieLinkPersonDto
>
resultData
=
JSONObject
.
parse
Object
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
log
.
debug
(
"pushAddUserData接口返回信息:{0}"
,
responseEntity
.
getBody
()
.
toJSONString
()
);
JieLinkResultDto
<
JieLinkPersonDto
>
resultData
=
JSONObject
.
toJava
Object
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
)){
JieLinkPersonDto
persion
=
resultData
.
getData
();
if
(
persion
!=
null
){
...
...
@@ -171,7 +172,7 @@ public class JieLinkServiceImpl implements IJieLinkService {
}
}
else
{
//请求失败啦
log
.
error
(
"pushAddUserData接口
返回错误信息:{0}"
,
responseEntity
.
getBody
()
);
log
.
error
(
"pushAddUserData接口
请求失败"
);
return
false
;
}
}
catch
(
Exception
ex
){
...
...
@@ -202,11 +203,11 @@ public class JieLinkServiceImpl implements IJieLinkService {
HttpEntity
<
JieLinkPersonDto
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
String
.
class
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"pushModifyUserData接口返回信息:{0}"
,
responseEntity
.
getBody
());
JieLinkResultDto
<
JieLinkPersonDto
>
resultData
=
JSONObject
.
parse
Object
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
log
.
debug
(
"pushModifyUserData接口返回信息:{0}"
,
responseEntity
.
getBody
()
.
toJSONString
()
);
JieLinkResultDto
<
JieLinkPersonDto
>
resultData
=
JSONObject
.
toJava
Object
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
)){
return
true
;
}
else
{
...
...
@@ -216,7 +217,7 @@ public class JieLinkServiceImpl implements IJieLinkService {
}
}
else
{
//请求失败啦
log
.
error
(
"pushAddUserData接口
返回错误信息:{0}"
,
responseEntity
.
getBody
()
);
log
.
error
(
"pushAddUserData接口
请求失败"
);
return
false
;
}
}
catch
(
Exception
ex
){
...
...
@@ -282,12 +283,12 @@ public class JieLinkServiceImpl implements IJieLinkService {
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
String
.
class
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
//后续处理逻辑
log
.
debug
(
"pushVisitorData接口返回信息:{0}"
,
responseEntity
.
getBody
());
JieLinkResultDto
<
JSONObject
>
resultData
=
JSONObject
.
parse
Object
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
log
.
debug
(
"pushVisitorData接口返回信息:{0}"
,
responseEntity
.
getBody
()
.
toJSONString
()
);
JieLinkResultDto
<
JSONObject
>
resultData
=
JSONObject
.
toJava
Object
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
)){
return
true
;
}
else
{
...
...
@@ -297,7 +298,7 @@ public class JieLinkServiceImpl implements IJieLinkService {
}
}
else
{
//请求失败啦
log
.
error
(
"pushVisitorData接口
返回错误信息:{0}"
,
responseEntity
.
getBody
()
);
log
.
error
(
"pushVisitorData接口
请求失败"
);
return
false
;
}
}
catch
(
Exception
ex
){
...
...
@@ -336,11 +337,11 @@ public class JieLinkServiceImpl implements IJieLinkService {
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
String
.
class
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"cancelVisitorData接口返回信息:{0}"
,
responseEntity
.
getBody
());
JieLinkResultDto
resultData
=
JSONObject
.
parse
Object
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
log
.
debug
(
"cancelVisitorData接口返回信息:{0}"
,
responseEntity
.
getBody
()
.
toJSONString
()
);
JieLinkResultDto
resultData
=
JSONObject
.
toJava
Object
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
)){
return
true
;
}
else
{
...
...
@@ -350,7 +351,7 @@ public class JieLinkServiceImpl implements IJieLinkService {
}
}
else
{
//请求失败啦
log
.
error
(
"cancelVisitorData接口
返回错误信息:{0}"
,
responseEntity
.
getBody
()
);
log
.
error
(
"cancelVisitorData接口
请求失败"
);
return
false
;
}
}
catch
(
Exception
ex
){
...
...
@@ -486,11 +487,11 @@ public class JieLinkServiceImpl implements IJieLinkService {
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
pushData
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
String
.
class
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"pullVisitUserQrCode接口返回信息:{0}"
,
responseEntity
.
getBody
());
JieLinkResultDto
<
JSONObject
>
resultData
=
JSONObject
.
parse
Object
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
log
.
debug
(
"pullVisitUserQrCode接口返回信息:{0}"
,
responseEntity
.
getBody
()
.
toJSONString
()
);
JieLinkResultDto
<
JSONObject
>
resultData
=
JSONObject
.
toJava
Object
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
)){
JSONObject
data
=
resultData
.
getData
();
if
(
data
.
containsKey
(
"qrCodeData"
)){
...
...
@@ -505,7 +506,7 @@ public class JieLinkServiceImpl implements IJieLinkService {
}
}
else
{
//请求失败啦
log
.
error
(
"pullVisitUserQrCode接口
返回错误信息:{0}"
,
responseEntity
.
getBody
()
);
log
.
error
(
"pullVisitUserQrCode接口
请求失败"
);
return
null
;
}
}
catch
(
Exception
ex
){
...
...
@@ -639,13 +640,13 @@ public class JieLinkServiceImpl implements IJieLinkService {
HttpEntity
<
JSONObject
>
httpEntity
=
new
HttpEntity
<>(
null
,
headers
);
StringBuffer
uriAddr
=
new
StringBuffer
();
uriAddr
.
append
(
jieLinkUri
).
append
(
apiUri
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
String
.
class
);
ResponseEntity
<
JSONObject
>
responseEntity
=
restTemplate
.
postForEntity
(
uriAddr
.
toString
(),
httpEntity
,
JSONObject
.
class
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
log
.
debug
(
"syncDeviceInfo接口返回信息:{0}"
,
responseEntity
.
getBody
());
J
ieLinkResultDto
<
List
<
Devices
>>
resultData
=
JSONObject
.
parseObject
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(
),
"0"
)){
List
<
Devices
>
devicesList
=
resultData
.
getData
(
);
log
.
info
(
"syncDeviceInfo接口返回信息:{0}"
,
responseEntity
.
getBody
().
toJSONString
());
J
SONObject
body
=
responseEntity
.
getBody
(
);
if
(
StringUtils
.
equals
(
body
.
getString
(
"code"
),
"0"
)){
List
<
Devices
>
devicesList
=
JSONObject
.
parseArray
(
body
.
getString
(
"data"
),
Devices
.
class
);
if
(
devicesList
!=
null
&&
!
devicesList
.
isEmpty
()){
List
<
Devices
>
searchList
=
devicesService
.
findAll
(
null
);
Map
<
String
,
Devices
>
searchMap
=
new
HashMap
<>();
...
...
@@ -661,10 +662,10 @@ public class JieLinkServiceImpl implements IJieLinkService {
}
}
}
else
{
log
.
error
(
"syncDeviceInfo接口返回错误信息:"
+
resultData
.
getMsg
(
));
log
.
error
(
"syncDeviceInfo接口返回错误信息:"
+
body
.
getString
(
"msg"
));
}
}
else
{
log
.
error
(
"syncDeviceInfo接口
返回错误信息:{0}"
,
responseEntity
.
getBody
()
);
log
.
error
(
"syncDeviceInfo接口
请求失败"
);
}
}
catch
(
Exception
ex
){
log
.
error
(
ex
.
getMessage
(),
ex
);
...
...
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