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
93704ae0
Commit
93704ae0
authored
Nov 24, 2022
by
zhangyanduan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 提交捷顺道闸对接接口代码
parent
74a602fa
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
111 additions
and
14 deletions
+111
-14
JieLinkInterController.java
...ntegration/jieLink/Controller/JieLinkInterController.java
+14
-5
IJieLinkService.java
.../rcisoft/integration/jieLink/service/IJieLinkService.java
+1
-1
JieLinkServiceImpl.java
.../integration/jieLink/service/impl/JieLinkServiceImpl.java
+69
-8
DevicesRepository.java
...n/java/org/rcisoft/sys/devices/dao/DevicesRepository.java
+9
-0
DevicesService.java
.../java/org/rcisoft/sys/devices/service/DevicesService.java
+7
-0
DevicesServiceImpl.java
.../rcisoft/sys/devices/service/impl/DevicesServiceImpl.java
+6
-0
DevicesMapper.xml
src/main/resources/mapper/DevicesMapper.xml
+5
-0
No files found.
src/main/java/org/rcisoft/integration/jieLink/Controller/JieLinkInterController.java
View file @
93704ae0
...
...
@@ -9,10 +9,7 @@ import org.rcisoft.integration.jieLink.dto.JieLinkDoorRecordDto;
import
org.rcisoft.integration.jieLink.dto.JieLinkResultDto
;
import
org.rcisoft.integration.jieLink.service.IJieLinkService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
@Slf4j
@RestController
...
...
@@ -26,7 +23,7 @@ public class JieLinkInterController {
@CyOpeLogAnno
(
title
=
"jieLinkInter-捷顺道闸上传门禁记录"
,
businessType
=
CyLogTypeEnum
.
INSERT
)
@ApiOperation
(
value
=
"捷顺对接集成"
,
notes
=
"门禁数据上传"
)
@PostMapping
(
value
=
"/doorrecord"
)
public
JieLinkResultDto
add
(
@RequestBody
JieLinkDoorRecordDto
recodeDto
)
{
public
JieLinkResultDto
add
Doorrecord
(
@RequestBody
JieLinkDoorRecordDto
recodeDto
)
{
JieLinkResultDto
result
=
new
JieLinkResultDto
();
if
(
recodeDto
!=
null
&&
StringUtils
.
isNotBlank
(
recodeDto
.
getRecordId
())){
/**
...
...
@@ -56,4 +53,16 @@ public class JieLinkInterController {
}
@CyOpeLogAnno
(
title
=
"jieLinkInter-同步设备信息"
,
businessType
=
CyLogTypeEnum
.
INSERT
)
@ApiOperation
(
value
=
"捷顺对接集成"
,
notes
=
"同步设备信息"
)
@GetMapping
(
value
=
"/syncDeviceData"
)
public
JieLinkResultDto
syncDeviceData
()
{
jieLinkService
.
syncDeviceInfo
();
JieLinkResultDto
result
=
new
JieLinkResultDto
();
result
.
setMsg
(
"同步完成"
);
result
.
setCode
(
"0"
);
return
result
;
}
}
src/main/java/org/rcisoft/integration/jieLink/service/IJieLinkService.java
View file @
93704ae0
...
...
@@ -65,5 +65,5 @@ public interface IJieLinkService {
*/
public
JieLinkResultDto
saveDoorRecordInfo
(
JieLinkDoorRecordDto
recordDto
);
public
void
syncDeviceInfo
();
}
src/main/java/org/rcisoft/integration/jieLink/service/impl/JieLinkServiceImpl.java
View file @
93704ae0
...
...
@@ -13,6 +13,8 @@ import org.rcisoft.core.model.CyPersistModel;
import
org.rcisoft.integration.jieLink.common.SignUtils
;
import
org.rcisoft.integration.jieLink.dto.*
;
import
org.rcisoft.integration.jieLink.service.IJieLinkService
;
import
org.rcisoft.sys.devices.entity.Devices
;
import
org.rcisoft.sys.devices.service.DevicesService
;
import
org.rcisoft.sys.sysuser.entity.DoorRecord
;
import
org.rcisoft.sys.sysuser.entity.SysUser
;
import
org.rcisoft.sys.sysuser.service.DoorRecordService
;
...
...
@@ -26,9 +28,7 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.*
;
/**
* 捷顺道闸对接接口实现
...
...
@@ -63,6 +63,9 @@ public class JieLinkServiceImpl implements IJieLinkService {
@Autowired
private
DoorRecordService
doorRecordService
;
@Autowired
private
DevicesService
devicesService
;
/**
* 获取签名所需相关参数
...
...
@@ -482,8 +485,24 @@ public class JieLinkServiceImpl implements IJieLinkService {
return
result
;
}
JieLinkDeviceDto
device
=
recordDto
.
getDevice
();
Devices
devices
=
null
;
if
(
device
!=
null
){
if
(
StringUtils
.
isNotBlank
(
device
.
getDeviceGuid
())){
Devices
deviceInfo
=
devicesService
.
getDeviceInfoByDeviceGuid
(
device
.
getDeviceGuid
());
if
(
deviceInfo
!=
null
){
devices
=
deviceInfo
;
}
else
{
//设备无了
result
.
setCode
(
"ILLEGAL_ARGUMENT"
);
result
.
setMsg
(
"设备未获取或关键信息错误,请检查参数"
);
return
result
;
}
}
else
{
//设备无了
result
.
setCode
(
"ILLEGAL_ARGUMENT"
);
result
.
setMsg
(
"设备关键信息丢失,请检查参数"
);
return
result
;
}
}
else
{
//设备无了
result
.
setCode
(
"ILLEGAL_ARGUMENT"
);
...
...
@@ -497,13 +516,14 @@ public class JieLinkServiceImpl implements IJieLinkService {
record
.
setMobile
(
sysUserData
.
getPhone
());
record
.
setTenementType
(
sysUserData
.
getUserType
());
record
.
setRemark
(
recordDto
.
getRemark
());
record
.
setDeviceId
(
""
);
//需要根据设备补全
record
.
setDeviceName
(
""
);
//需要根据设备补全
record
.
setDeviceType
(
""
);
//需要根据设备不全
record
.
setDeviceId
(
device
.
getDeviceGuid
());
//需要根据设备补全
record
.
setDeviceName
(
device
.
getDeviceName
());
//需要根据设备补全
//TODO 此处字段需要后续修改,需要根据业务调整
record
.
setDeviceType
(
device
.
getDeviceType
()+
""
);
//需要根据设备不全
record
.
setCardType
(
recordDto
.
getCardType
()+
""
);
record
.
setCardNo
(
recordDto
.
getCardNo
());
if
(
StringUtils
.
isNotBlank
(
recordDto
.
getCrossTime
())){
//
设备
无了
//
触发时间
无了
result
.
setCode
(
"ILLEGAL_ARGUMENT"
);
result
.
setMsg
(
"闸机触发时间丢失,请检查参数"
);
return
result
;
...
...
@@ -520,6 +540,47 @@ public class JieLinkServiceImpl implements IJieLinkService {
return
result
;
}
@Override
public
void
syncDeviceInfo
()
{
String
apiUri
=
"/api/base/devices"
;
HttpHeaders
headers
=
this
.
loadHeaderHandle
();
if
(
headers
!=
null
){
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
);
try
{
if
(
HttpStatus
.
OK
.
value
()
==
responseEntity
.
getStatusCode
().
value
())
{
JieLinkResultDto
<
List
<
Devices
>>
resultData
=
JSONObject
.
parseObject
(
responseEntity
.
getBody
(),
JieLinkResultDto
.
class
);
if
(
StringUtils
.
equals
(
resultData
.
getCode
(),
"0"
)){
List
<
Devices
>
devicesList
=
resultData
.
getData
();
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
);
}
for
(
Devices
inDevice:
devicesList
){
if
(
searchMap
.
containsKey
(
inDevice
.
getDeviceGuid
())){
devicesService
.
merge
(
inDevice
);
}
else
{
devicesService
.
persist
(
inDevice
);
}
}
}
}
else
{
log
.
error
(
"syncDeviceInfo接口返回错误信息:"
+
resultData
.
getMsg
());
}
}
else
{
}
}
catch
(
Exception
ex
){
log
.
error
(
ex
.
getMessage
(),
ex
);
}
}
else
{
//认证信息获取失败
}
}
/**
* 创建hander头信息
...
...
src/main/java/org/rcisoft/sys/devices/dao/DevicesRepository.java
View file @
93704ae0
...
...
@@ -25,5 +25,14 @@ public interface DevicesRepository extends CyBaseMapper<Devices> {
*
*/
IPage
<
Devices
>
queryDevicessPaged
(
CyPageInfo
cyPageInfo
,
@Param
(
"entity"
)
Devices
devices
);
/**
* 根据设备的GUID查询对象
* @param deviceGuid
* @return
*/
Devices
getDeviceInfoByDeviceGuid
(
@Param
(
"deviceGuid"
)
String
deviceGuid
);
}
src/main/java/org/rcisoft/sys/devices/service/DevicesService.java
View file @
93704ae0
...
...
@@ -64,4 +64,11 @@ public interface DevicesService {
*/
List
<
Devices
>
export
(
Devices
devices
);
/**
* 根据设备唯一标识查询设备
* @param deviceGuid
* @return
*/
Devices
getDeviceInfoByDeviceGuid
(
String
deviceGuid
);
}
src/main/java/org/rcisoft/sys/devices/service/impl/DevicesServiceImpl.java
View file @
93704ae0
...
...
@@ -116,4 +116,10 @@ public class DevicesServiceImpl extends ServiceImpl<DevicesRepository,Devices>
return
devicesList
;
}
@Override
public
Devices
getDeviceInfoByDeviceGuid
(
String
deviceGuid
)
{
return
baseMapper
.
getDeviceInfoByDeviceGuid
(
deviceGuid
);
}
}
src/main/resources/mapper/DevicesMapper.xml
View file @
93704ae0
...
...
@@ -25,4 +25,9 @@
select * from devices
where 1=1
</select>
<select
id=
"getDeviceInfoByGuid"
resultMap=
"BaseResultMap"
>
SELECT * FROM devices where device_guid = #{deviceGuid} limit 0,1
</select>
</mapper>
\ No newline at end of file
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