Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
27eaf547
提交
27eaf547
authored
11月 06, 2020
作者:
邓砥奕
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[门禁模块]实现门禁报警功能
上级
a46668b9
隐藏空白字符变更
内嵌
并排
正在显示
32 个修改的文件
包含
565 行增加
和
5 行删除
+565
-5
pom.xml
dev-allot/pom.xml
+5
-0
AllotBackBillController.java
.../dev/device/allot/controller/AllotBackBillController.java
+8
-0
AllotBillController.java
...tykj/dev/device/allot/controller/AllotBillController.java
+8
-0
DeviceApplyController.java
...kj/dev/device/apply/controller/DeviceApplyController.java
+1
-0
ApplyBillDetailVo.java
...m/tykj/dev/device/apply/subject/vo/ApplyBillDetailVo.java
+1
-0
DeviceApplyConfirmVo.java
...ykj/dev/device/apply/subject/vo/DeviceApplyConfirmVo.java
+1
-1
DeviceApplySaveVo.java
...m/tykj/dev/device/apply/subject/vo/DeviceApplySaveVo.java
+2
-0
pom.xml
dev-destroy/pom.xml
+4
-1
DeviceDestroyController.java
...ev/device/destroy/controller/DeviceDestroyController.java
+7
-2
MatchingDeviceBillSaveVo.java
.../device/matching/subject/vo/MatchingDeviceBillSaveVo.java
+2
-0
pom.xml
dev-repair/pom.xml
+5
-0
RepairController.java
...m/tykj/dev/device/repair/controller/RepairController.java
+8
-0
RepairBackBillSaveVo.java
...kj/dev/device/repair/subject/vo/RepairBackBillSaveVo.java
+2
-0
RepairBillSaveVo.java
...m/tykj/dev/device/repair/subject/vo/RepairBillSaveVo.java
+2
-0
AccessController.java
...n/java/com/tykj/dev/rfid/controller/AccessController.java
+165
-0
AccessControlName.java
...ava/com/tykj/dev/rfid/entity/domin/AccessControlName.java
+30
-0
InputOutputDevice.java
...ava/com/tykj/dev/rfid/entity/domin/InputOutputDevice.java
+10
-1
AccessData.java
...src/main/java/com/tykj/dev/rfid/entity/vo/AccessData.java
+15
-0
DataDetail.java
...src/main/java/com/tykj/dev/rfid/entity/vo/DataDetail.java
+18
-0
DataResult.java
...src/main/java/com/tykj/dev/rfid/entity/vo/DataResult.java
+31
-0
Record.java
...fid/src/main/java/com/tykj/dev/rfid/entity/vo/Record.java
+13
-0
Status.java
...fid/src/main/java/com/tykj/dev/rfid/entity/vo/Status.java
+10
-0
TimeConfirm.java
...rc/main/java/com/tykj/dev/rfid/entity/vo/TimeConfirm.java
+13
-0
TimeData.java
...d/src/main/java/com/tykj/dev/rfid/entity/vo/TimeData.java
+15
-0
AccessControlNameDao.java
...va/com/tykj/dev/rfid/repository/AccessControlNameDao.java
+12
-0
InputOutputDeviceDao.java
...va/com/tykj/dev/rfid/repository/InputOutputDeviceDao.java
+5
-0
AccessControlNameService.java
...a/com/tykj/dev/rfid/service/AccessControlNameService.java
+13
-0
InputOutputDeviceService.java
...a/com/tykj/dev/rfid/service/InputOutputDeviceService.java
+18
-0
AccessControlNameServiceImpl.java
...j/dev/rfid/service/impl/AccessControlNameServiceImpl.java
+27
-0
InputOutputDeviceServiceImpl.java
...j/dev/rfid/service/impl/InputOutputDeviceServiceImpl.java
+49
-0
AccessSchedulerTask.java
.../java/com/tykj/dev/rfid/timeTask/AccessSchedulerTask.java
+63
-0
StorageBillSaveVo.java
...tykj/dev/device/storage/subject/vo/StorageBillSaveVo.java
+2
-0
没有找到文件。
dev-allot/pom.xml
浏览文件 @
27eaf547
...
...
@@ -36,5 +36,9 @@
<groupId>
com.tykj.dev
</groupId>
<artifactId>
socket
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
rfid
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
dev-allot/src/main/java/com/tykj/dev/device/allot/controller/AllotBackBillController.java
浏览文件 @
27eaf547
...
...
@@ -20,6 +20,7 @@ import com.tykj.dev.device.user.util.UserUtils;
import
com.tykj.dev.misc.base.ResultObj
;
import
com.tykj.dev.misc.utils.Snowflake
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
com.tykj.dev.rfid.service.InputOutputDeviceService
;
import
com.tykj.dev.socket.MyWebSocket
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -75,6 +76,9 @@ public class AllotBackBillController {
@Autowired
private
Snowflake
snowflake
;
@Autowired
private
InputOutputDeviceService
inputOutputDeviceService
;
@ApiOperation
(
value
=
"发起配发退回业务"
,
notes
=
"可以通过这个接口发起配发退回任务"
)
@PostMapping
(
value
=
"/back"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -124,10 +128,12 @@ public class AllotBackBillController {
fileVoList
.
add
(
new
FileVo
(
"出库确认单"
,
allotBackBillSaveVo
.
getFileName
(),
allotBackBillSaveVo
.
getFileUrl
()));
}
String
[]
strings
=
allotBackBill1
.
getBackCheckDetail
().
split
(
"x"
);
List
<
Integer
>
ids
=
new
ArrayList
<>();
for
(
String
s
:
strings
)
{
//改变出库无误的装备的状态
if
(
s
.
length
()
>=
2
&&
"1"
.
equals
(
s
.
substring
(
s
.
length
()
-
1
)))
{
Integer
id
=
Integer
.
parseInt
(
s
.
substring
(
0
,
s
.
length
()
-
1
));
ids
.
add
(
id
);
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
deviceLibraryEntity
.
setLifeStatus
(
3
);
//记录装备日志
...
...
@@ -136,6 +142,8 @@ public class AllotBackBillController {
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
//添加出库白名单
inputOutputDeviceService
.
addWhiteDevices
(
ids
,
userUtils
.
getCurrentUnitId
(),
1
);
log
.
info
(
"[配发模块]:配发退回出库"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
taskBto1
,
signId
.
toString
()));
...
...
dev-allot/src/main/java/com/tykj/dev/device/allot/controller/AllotBillController.java
浏览文件 @
27eaf547
...
...
@@ -22,6 +22,7 @@ import com.tykj.dev.misc.base.ResultObj;
import
com.tykj.dev.misc.base.StatusEnum
;
import
com.tykj.dev.misc.utils.Snowflake
;
import
com.tykj.dev.misc.utils.TimestampUtil
;
import
com.tykj.dev.rfid.service.InputOutputDeviceService
;
import
com.tykj.dev.socket.MyWebSocket
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -77,6 +78,9 @@ public class AllotBillController {
@Autowired
private
Snowflake
snowflake
;
@Autowired
private
InputOutputDeviceService
inputOutputDeviceService
;
@ApiOperation
(
value
=
"发起配发业务"
,
notes
=
"可以通过这个接口发起配发任务"
)
@PostMapping
(
value
=
"/addAllotBill"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -140,9 +144,11 @@ public class AllotBillController {
//获取装备信息
String
deviceIdDetail
=
allotBillEntity
.
getAllotCheckDetail
();
String
[]
strings
=
deviceIdDetail
.
split
(
"x"
);
List
<
Integer
>
ids
=
new
ArrayList
<>();
for
(
String
s
:
strings
)
{
if
(
s
.
length
()
>=
2
)
{
Integer
id
=
Integer
.
parseInt
(
s
.
substring
(
0
,
s
.
length
()
-
1
));
ids
.
add
(
id
);
//改变装备状态
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
deviceLibraryEntity
.
setLifeStatus
(
3
);
...
...
@@ -153,6 +159,8 @@ public class AllotBillController {
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
//添加出库白名单
inputOutputDeviceService
.
addWhiteDevices
(
ids
,
userUtils
.
getCurrentUnitId
(),
1
);
log
.
info
(
"[配发模块]:配发审核成功并出库"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"审核成功"
);
...
...
dev-apply/src/main/java/com/tykj/dev/device/apply/controller/DeviceApplyController.java
浏览文件 @
27eaf547
...
...
@@ -52,6 +52,7 @@ import java.util.stream.Collectors;
@AutoDocument
@RequestMapping
(
"/apply"
)
@Slf4j
@Validated
public
class
DeviceApplyController
{
@Autowired
...
...
dev-apply/src/main/java/com/tykj/dev/device/apply/subject/vo/ApplyBillDetailVo.java
浏览文件 @
27eaf547
...
...
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.Valid
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
...
...
dev-apply/src/main/java/com/tykj/dev/device/apply/subject/vo/DeviceApplyConfirmVo.java
浏览文件 @
27eaf547
...
...
@@ -19,7 +19,7 @@ public class DeviceApplyConfirmVo {
private
Integer
taskId
;
@NotNull
(
message
=
"status不能为空"
)
@Min
(
value
=
1
,
message
=
"status不能小于1
"
)
@Min
(
value
=
0
,
message
=
"status不能小于0
"
)
@ApiModelProperty
(
name
=
"需要修改的状态"
,
example
=
"0"
,
value
=
"0为审核通过,1为驳回"
)
private
Integer
status
;
...
...
dev-apply/src/main/java/com/tykj/dev/device/apply/subject/vo/DeviceApplySaveVo.java
浏览文件 @
27eaf547
...
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
org.springframework.beans.BeanUtils
;
import
javax.validation.Valid
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
...
...
@@ -46,6 +47,7 @@ public class DeviceApplySaveVo {
@ApiModelProperty
(
value
=
"批复人id"
)
private
Integer
replyUseraId
;
@Valid
@NotEmpty
(
message
=
"storageBillDetailVoList不能为空"
)
@ApiModelProperty
(
value
=
"入库列装数量详情"
)
private
List
<
ApplyBillDetailVo
>
storageBillDetailVoList
;
...
...
dev-destroy/pom.xml
浏览文件 @
27eaf547
...
...
@@ -28,7 +28,10 @@
<groupId>
com.tykj.dev
</groupId>
<artifactId>
config
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
rfid
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
socket
</artifactId>
...
...
dev-destroy/src/main/java/com/tykj/dev/device/destroy/controller/DeviceDestroyController.java
浏览文件 @
27eaf547
...
...
@@ -23,6 +23,7 @@ import com.tykj.dev.misc.base.StatusEnum;
import
com.tykj.dev.misc.utils.ListUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
com.tykj.dev.rfid.service.InputOutputDeviceService
;
import
com.tykj.dev.socket.MyWebSocket
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -63,6 +64,8 @@ public class DeviceDestroyController {
private
AuthenticationUtils
AuthenticationUtils
;
@Autowired
private
UserUtils
userUtils
;
@Autowired
private
InputOutputDeviceService
inputOutputDeviceService
;
public
DeviceDestroyController
(
DeviceDestroyBillService
deviceDestroyBillServiceyBillService
,
TaskService
taskService
,
DeviceLibraryService
deviceLibraryService
,
UserPublicService
userPublicService
,
DeviceLogService
deviceLogService
,
TaskLogService
taskLogService
)
{
this
.
deviceDestroyBillService
=
deviceDestroyBillServiceyBillService
;
...
...
@@ -182,9 +185,9 @@ public class DeviceDestroyController {
this
.
deviceDestroyBillService
.
updateEntity
(
deviceDestroyBill
);
//将任务推进至下一步
taskService
.
moveToNext
(
task
,
deviceDestroyBill
.
getStartUserBId
());
//更改对应装备的状态为销毁
handleDeviceDetail
(
deviceDestroyBill
,
null
,
deviceDestoryConfirmVo
.
getResult
());
}
//更改对应装备的状态为销毁
handleDeviceDetail
(
deviceDestroyBill
,
null
,
deviceDestoryConfirmVo
.
getResult
());
myWebSocket
.
sendMessage1
();
return
selectDestroyDetail
(
deviceDestroyBill
.
getId
());
}
...
...
@@ -236,6 +239,8 @@ public class DeviceDestroyController {
deviceLogService
.
addLog
(
new
DeviceLogDto
(
id
,
flag
==
0
?
"装备销毁成功"
:
"装备销毁失败"
,
billList
));
}
}
//添加出库白名单
inputOutputDeviceService
.
addWhiteDevices
(
list
,
userUtils
.
getCurrentUnitId
(),
1
);
}
private
String
makeDocNumber
(
DeviceDestroyBill
deviceDestroyBill
)
{
...
...
dev-matching/src/main/java/com/tykj/dev/device/matching/subject/vo/MatchingDeviceBillSaveVo.java
浏览文件 @
27eaf547
...
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
org.springframework.beans.BeanUtils
;
import
javax.validation.Valid
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
...
...
@@ -36,6 +37,7 @@ public class MatchingDeviceBillSaveVo {
@ApiModelProperty
(
value
=
"审核人id"
)
private
Integer
userbId
;
@Valid
@NotEmpty
(
message
=
"matchingDeviceSaveVoList不能为空"
)
@ApiModelProperty
(
value
=
"配套设备列表"
)
private
List
<
MatchingDeviceSaveVo
>
matchingDeviceSaveVoList
;
...
...
dev-repair/pom.xml
浏览文件 @
27eaf547
...
...
@@ -36,6 +36,10 @@
<groupId>
com.tykj.dev
</groupId>
<artifactId>
config
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
rfid
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
dev-repair/src/main/java/com/tykj/dev/device/repair/controller/RepairController.java
浏览文件 @
27eaf547
...
...
@@ -34,6 +34,7 @@ import com.tykj.dev.misc.base.StatusEnum;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.misc.utils.Snowflake
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
com.tykj.dev.rfid.service.InputOutputDeviceService
;
import
com.tykj.dev.socket.MyWebSocket
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -104,6 +105,9 @@ public class RepairController {
@Autowired
private
Snowflake
snowflake
;
@Autowired
private
InputOutputDeviceService
inputOutputDeviceService
;
@ApiOperation
(
value
=
"发起维修"
,
notes
=
"可以通过这个接口发起维修"
)
@PostMapping
(
value
=
"/form"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -273,6 +277,8 @@ public class RepairController {
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
//添加出库白名单
inputOutputDeviceService
.
addWhiteDevices
(
idList
,
userUtils
.
getCurrentUnitId
(),
1
);
myWebSocket
.
sendMessage1
();
return
ResultUtil
.
success
(
"审核成功"
);
}
...
...
@@ -600,6 +606,8 @@ public class RepairController {
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
//添加出库白名单
inputOutputDeviceService
.
addWhiteDevices
(
idList
,
userUtils
.
getCurrentUnitId
(),
1
);
//设置任务的所属单位
taskBto
.
setOwnUnit
(
userPublicService
.
findUnitIdByName
(
repairBackBill
.
getReceiveUnit
()));
//不指定接收人
...
...
dev-repair/src/main/java/com/tykj/dev/device/repair/subject/vo/RepairBackBillSaveVo.java
浏览文件 @
27eaf547
...
...
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.Valid
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
...
...
@@ -81,6 +82,7 @@ public class RepairBackBillSaveVo {
@ApiModelProperty
(
value
=
"退回装备出库检查结果"
)
private
String
backCheckResult
;
@Valid
@NotEmpty
(
message
=
"deviceList不能为空"
)
@ApiModelProperty
(
value
=
"维修装备详情列表"
)
private
List
<
DeviceDetailVo
>
deviceList
;
...
...
dev-repair/src/main/java/com/tykj/dev/device/repair/subject/vo/RepairBillSaveVo.java
浏览文件 @
27eaf547
...
...
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.Valid
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
...
...
@@ -77,6 +78,7 @@ public class RepairBillSaveVo {
@ApiModelProperty
(
value
=
"送修装备出库检查结果"
)
private
String
repairDeviceCheckResult
;
@Valid
@NotEmpty
(
message
=
"deviceList不能为空"
)
@ApiModelProperty
(
value
=
"维修装备详情列表"
)
private
List
<
DeviceDetailVo
>
deviceList
;
...
...
dev-rfid/src/main/java/com/tykj/dev/rfid/controller/AccessController.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
controller
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.rfid.entity.domin.InputOutputDevice
;
import
com.tykj.dev.rfid.entity.domin.LibraryWarningLog
;
import
com.tykj.dev.rfid.entity.domin.LibraryWarningLogDetail
;
import
com.tykj.dev.rfid.entity.vo.*
;
import
com.tykj.dev.rfid.service.AccessControlNameService
;
import
com.tykj.dev.rfid.service.InputOutputDeviceService
;
import
com.tykj.dev.rfid.service.LibraryWarningLogDetailService
;
import
com.tykj.dev.rfid.service.LibraryWarningLogService
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.servlet.ServletInputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author dengdiyi
*/
@RestController
@Api
(
tags
=
"门禁模块"
,
value
=
"门禁模块"
)
@AutoDocument
@RequestMapping
(
"/access"
)
public
class
AccessController
{
@Autowired
private
AccessControlNameService
accessControlNameService
;
@Autowired
private
InputOutputDeviceService
inputOutputDeviceService
;
@Resource
private
UserPublicService
userPublicService
;
@Resource
private
DeviceLibraryDao
deviceLibraryDao
;
@Autowired
private
LibraryWarningLogService
libraryWarningLogService
;
@Autowired
private
LibraryWarningLogDetailService
libraryWarningLogDetailService
;
@PostMapping
(
"/send"
)
public
String
sendMessage
(
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
)
throws
IOException
{
//获取门禁传入json
ServletInputStream
inputStream
=
httpServletRequest
.
getInputStream
();
BufferedReader
bufferedInputStream
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
,
"utf-8"
));
StringBuffer
sp
=
new
StringBuffer
();
String
line
;
while
((
line
=
bufferedInputStream
.
readLine
())!=
null
){
sp
.
append
(
line
);
}
String
json
=
sp
.
toString
();
// System.out.println(json);
//数据提交
if
(
json
.
contains
(
"20001"
)){
//Json转对象
AccessData
accessData
=
JacksonUtil
.
readValue
(
sp
.
toString
(),
AccessData
.
class
);
if
(
accessData
!=
null
)
{
//获取该门禁设备所属单位
Integer
unitId
=
accessControlNameService
.
getByDeviceNo
(
accessData
.
getData
().
getDeviceNo
()).
getUnitId
();
//可以出库的装备
List
<
InputOutputDevice
>
outputDevices
=
inputOutputDeviceService
.
getByUnitIdAndDirection
(
unitId
,
1
);
// List<InputOutputDevice> inputDevices = inputOutputDeviceService.getByUnitIdAndDirection(unitId,0);
//可以出库的装备的卡号
List
<
String
>
canOutputCardIds
=
outputDevices
.
stream
().
map
(
InputOutputDevice:
:
getRfidCardId
).
collect
(
Collectors
.
toList
());
// List<String> canInputCardIds = outputDevices.stream().map(InputOutputDevice::getRfidCardId).collect(Collectors.toList());
//实际出库的装备卡号
List
<
String
>
outPutCardIds
=
accessData
.
getData
().
getEpcs
().
stream
()
.
filter
(
record
->
record
.
getDirection
()==
1
).
map
(
Record:
:
getEpc
)
.
collect
(
Collectors
.
toList
());
// for (int i = 0;i<outPutCardIds.size();i++){
// List<DeviceLibrary> deviceLibraries = deviceLibraryDao.getAllByRfidCardId(outPutCardIds.get(i));
// if (deviceLibraries.size()==0){
//
// }
// }
if
(
outPutCardIds
.
size
()>
0
)
{
//如果实际出库的卡号在可以出库的卡号范围内
if
(
canOutputCardIds
.
containsAll
(
outPutCardIds
))
{
//设置实际出库的装备白名单为已读
inputOutputDeviceService
.
setRead
(
outputDevices
.
stream
()
.
filter
(
inputOutputDevice
->
outPutCardIds
.
contains
(
inputOutputDevice
.
getRfidCardId
()))
.
collect
(
Collectors
.
toList
()));
//成功出库不报警
return
DataResult
.
success
();
}
else
{
//获取可出库装备和当前出库装备交集
canOutputCardIds
.
retainAll
(
outPutCardIds
);
//设置交集的装备白名单为已读
inputOutputDeviceService
.
setRead
(
outputDevices
.
stream
()
.
filter
(
inputOutputDevice
->
canOutputCardIds
.
contains
(
inputOutputDevice
.
getRfidCardId
()))
.
collect
(
Collectors
.
toList
()));
//获取所有不在白名单的装备
outPutCardIds
.
removeAll
(
canOutputCardIds
);
List
<
DeviceLibrary
>
deviceLibraries
=
new
ArrayList
<>();
outPutCardIds
.
forEach
(
s
->
deviceLibraries
.
addAll
(
deviceLibraryDao
.
getAllByRfidCardId
(
s
)));
//对交集外的装备进行告警
LibraryWarningLog
libraryWarningLog
=
new
LibraryWarningLog
();
libraryWarningLog
.
setUnit
(
userPublicService
.
findByUnitsToname
(
unitId
));
libraryWarningLog
.
setInventoryResults
(
"异常出库"
+
deviceLibraries
.
size
()
+
"台"
);
libraryWarningLog
.
setStatus
(
"1"
);
libraryWarningLog
.
setWarningHandle
(
0
);
libraryWarningLog
.
setWarningType
(
1
);
LibraryWarningLog
libraryWarningLog1
=
libraryWarningLogService
.
addEntity
(
libraryWarningLog
);
//添加详情
deviceLibraries
.
forEach
(
deviceLibrary
->
{
LibraryWarningLogDetail
libraryWarningLogDetail
=
new
LibraryWarningLogDetail
();
libraryWarningLogDetail
.
setDeviceId
(
deviceLibrary
.
getId
());
libraryWarningLogDetail
.
setInventoryResults
(
"异常出库"
);
libraryWarningLogDetail
.
setLibraryWarningLogId
(
libraryWarningLog1
.
getId
());
libraryWarningLogDetail
.
setStatus
(
1
);
libraryWarningLogDetail
.
setWarningHandle
(
0
);
libraryWarningLogDetailService
.
addEntity
(
libraryWarningLogDetail
);
});
//出库异常报警
return
DataResult
.
failed
();
}
}
else
{
return
DataResult
.
success
();
}
}
else
{
throw
new
ApiException
(
"json转对象异常:对象为Null"
);
}
}
//时间同步
else
if
(
json
.
contains
(
"20002"
)){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
TimeConfirm
timeConfirm
=
new
TimeConfirm
();
timeConfirm
.
setCmd
(
"20002"
);
timeConfirm
.
setData
(
new
TimeData
(
0
,
sdf
.
format
(
new
Date
())));
return
JacksonUtil
.
toJSon
(
timeConfirm
);
}
//心跳包
else
if
(
json
.
contains
(
"20003"
)){
return
DataResult
.
success
();
}
else
{
throw
new
ApiException
(
"未找到匹配的cmd"
);
}
}
}
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/domin/AccessControlName.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
entity
.
domin
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.Where
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.*
;
/**
* @author dengdiyi
*/
@Data
@Entity
@EntityListeners
(
AuditingEntityListener
.
class
)
@ApiModel
(
"单位对应门禁名称"
)
public
class
AccessControlName
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@ApiModelProperty
(
name
=
"主键id"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"门禁名称"
)
private
String
deviceNo
;
@ApiModelProperty
(
value
=
"所属单位"
)
private
Integer
unitId
;
}
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/domin/InputOutputDevice.java
浏览文件 @
27eaf547
...
...
@@ -21,7 +21,7 @@ import java.util.Date;
@Data
@Entity
@EntityListeners
(
AuditingEntityListener
.
class
)
@SQLDelete
(
sql
=
"update
library_warning_log
set delete_tag = 1 where id = ?"
)
@SQLDelete
(
sql
=
"update
input_output_device
set delete_tag = 1 where id = ?"
)
@Where
(
clause
=
"delete_tag = 0"
)
@ApiModel
(
"可出入库的装备,该表用于放置可以出库或者可以入库的装备"
)
public
class
InputOutputDevice
{
...
...
@@ -37,6 +37,15 @@ public class InputOutputDevice {
@ApiModelProperty
(
value
=
"装备ID"
)
private
Integer
deviceId
;
@ApiModelProperty
(
value
=
"rfid卡号"
)
private
String
rfidCardId
;
@ApiModelProperty
(
value
=
"报警单位"
)
private
Integer
unitId
;
@ApiModelProperty
(
value
=
"门禁是否已读(0:未读,1:已读)"
)
private
Integer
isRead
=
0
;
/**
* 允许出入库的方向 0为入 1为出
*/
...
...
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/vo/AccessData.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
entity
.
vo
;
import
lombok.Data
;
/**
* @author dengdiyi
*/
@Data
public
class
AccessData
{
private
String
cmd
;
private
DataDetail
data
;
}
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/vo/DataDetail.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
entity
.
vo
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author dengdiyi
*/
@Data
public
class
DataDetail
{
private
String
deviceNo
;
private
String
ip
;
private
List
<
Record
>
epcs
;
}
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/vo/DataResult.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
entity
.
vo
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
lombok.Data
;
/**
* @author dengdiyi
*/
@Data
public
class
DataResult
{
private
String
cmd
;
private
Status
data
;
//不报警
public
static
String
success
(){
DataResult
result
=
new
DataResult
();
result
.
setCmd
(
"20001"
);
result
.
setData
(
new
Status
(
0
));
return
JacksonUtil
.
toJSon
(
result
);
}
//报警
public
static
String
failed
(){
DataResult
result
=
new
DataResult
();
result
.
setCmd
(
"20001"
);
result
.
setData
(
new
Status
(
1
));
return
JacksonUtil
.
toJSon
(
result
);
}
}
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/vo/Record.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
entity
.
vo
;
import
lombok.Data
;
@Data
public
class
Record
{
private
String
epc
;
private
String
alarmtime
;
private
Integer
direction
;
}
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/vo/Status.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
entity
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
@AllArgsConstructor
@Data
public
class
Status
{
private
Integer
status
;
}
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/vo/TimeConfirm.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
entity
.
vo
;
import
lombok.Data
;
/**
* @author dengdiyi
*/
@Data
public
class
TimeConfirm
{
private
String
cmd
;
private
TimeData
data
;
}
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/vo/TimeData.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
entity
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
/**
* @author dengdiyi
*/
@Data
@AllArgsConstructor
public
class
TimeData
{
private
Integer
status
;
private
String
time
;
}
dev-rfid/src/main/java/com/tykj/dev/rfid/repository/AccessControlNameDao.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
repository
;
import
com.tykj.dev.rfid.entity.domin.AccessControlName
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
/**
* @author dengdiyi
*/
public
interface
AccessControlNameDao
extends
JpaRepository
<
AccessControlName
,
Integer
>,
JpaSpecificationExecutor
<
AccessControlName
>
{
AccessControlName
findByDeviceNo
(
String
deviceNo
);
}
dev-rfid/src/main/java/com/tykj/dev/rfid/repository/InputOutputDeviceDao.java
浏览文件 @
27eaf547
...
...
@@ -5,6 +5,8 @@ import com.tykj.dev.rfid.entity.domin.LibraryWarningLog;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
java.util.List
;
/**
* @author HuangXiahao
* @version V1.0
...
...
@@ -12,4 +14,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
**/
public
interface
InputOutputDeviceDao
extends
JpaRepository
<
InputOutputDevice
,
Integer
>,
JpaSpecificationExecutor
<
InputOutputDevice
>
{
List
<
InputOutputDevice
>
findAllByUnitIdAndDirection
(
Integer
unitId
,
Integer
direction
);
List
<
InputOutputDevice
>
findAllByIsRead
(
Integer
isRead
);
}
dev-rfid/src/main/java/com/tykj/dev/rfid/service/AccessControlNameService.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
service
;
import
com.tykj.dev.rfid.entity.domin.AccessControlName
;
/**
* @author dengdiyi
*/
public
interface
AccessControlNameService
{
AccessControlName
add
(
AccessControlName
accessControlName
);
AccessControlName
getByDeviceNo
(
String
deviceNo
);
}
dev-rfid/src/main/java/com/tykj/dev/rfid/service/InputOutputDeviceService.java
浏览文件 @
27eaf547
...
...
@@ -2,6 +2,8 @@ package com.tykj.dev.rfid.service;
import
com.tykj.dev.rfid.entity.domin.InputOutputDevice
;
import
java.util.List
;
/**
* @author HuangXiahao
* @version V1.0
...
...
@@ -16,4 +18,20 @@ public interface InputOutputDeviceService {
* @return
*/
InputOutputDevice
addEntity
(
InputOutputDevice
inputOutputDevice
);
List
<
InputOutputDevice
>
getByUnitIdAndDirection
(
Integer
unitId
,
Integer
direction
);
void
deleteAll
(
List
<
InputOutputDevice
>
inputOutputDevices
);
/**
* @param deviceIds 允许出入库的装备id列表
* @param unitId 出入库的单位
* @param direction 允许出入库的方向 0为入 1为出
*/
void
addWhiteDevices
(
List
<
Integer
>
deviceIds
,
Integer
unitId
,
Integer
direction
);
/**
* 设置白名单已经被读取到
*/
void
setRead
(
List
<
InputOutputDevice
>
inputOutputDevices
);
}
dev-rfid/src/main/java/com/tykj/dev/rfid/service/impl/AccessControlNameServiceImpl.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
service
.
impl
;
import
com.tykj.dev.rfid.entity.domin.AccessControlName
;
import
com.tykj.dev.rfid.repository.AccessControlNameDao
;
import
com.tykj.dev.rfid.service.AccessControlNameService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* @author dengdiyi
*/
@Service
public
class
AccessControlNameServiceImpl
implements
AccessControlNameService
{
@Autowired
private
AccessControlNameDao
accessControlNameDao
;
@Override
public
AccessControlName
add
(
AccessControlName
accessControlName
)
{
return
accessControlNameDao
.
save
(
accessControlName
);
}
@Override
public
AccessControlName
getByDeviceNo
(
String
deviceNo
)
{
return
accessControlNameDao
.
findByDeviceNo
(
deviceNo
);
}
}
dev-rfid/src/main/java/com/tykj/dev/rfid/service/impl/InputOutputDeviceServiceImpl.java
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
service
.
impl
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.rfid.entity.domin.InputOutputDevice
;
import
com.tykj.dev.rfid.repository.InputOutputDeviceDao
;
import
com.tykj.dev.rfid.service.InputOutputDeviceService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @author HuangXiahao
* @version V1.0
...
...
@@ -18,10 +23,54 @@ public class InputOutputDeviceServiceImpl implements InputOutputDeviceService {
@Autowired
InputOutputDeviceDao
inputOutputDeviceDao
;
@Resource
DeviceLibraryService
deviceLibraryService
;
@Override
public
InputOutputDevice
addEntity
(
InputOutputDevice
inputOutputDevice
)
{
return
inputOutputDeviceDao
.
save
(
inputOutputDevice
);
}
@Override
public
List
<
InputOutputDevice
>
getByUnitIdAndDirection
(
Integer
unitId
,
Integer
direction
)
{
return
inputOutputDeviceDao
.
findAllByUnitIdAndDirection
(
unitId
,
direction
);
}
@Override
public
void
deleteAll
(
List
<
InputOutputDevice
>
inputOutputDevices
)
{
inputOutputDevices
.
forEach
(
inputOutputDevice
->
inputOutputDeviceDao
.
deleteById
(
inputOutputDevice
.
getId
()));
}
/**
* @param deviceIds 允许出入库的装备id列表
* @param unitId 出入库的单位
* @param direction 允许出入库的方向 0为入 1为出
*/
@Override
public
void
addWhiteDevices
(
List
<
Integer
>
deviceIds
,
Integer
unitId
,
Integer
direction
)
{
deviceIds
.
forEach
(
integer
->
{
DeviceLibrary
deviceLibrary
=
deviceLibraryService
.
getOne
(
integer
);
InputOutputDevice
inputOutputDevice
=
new
InputOutputDevice
();
inputOutputDevice
.
setDeviceId
(
integer
);
inputOutputDevice
.
setRfidCardId
(
deviceLibrary
.
getRfidCardId
());
inputOutputDevice
.
setDirection
(
direction
);
inputOutputDevice
.
setUnitId
(
unitId
);
addEntity
(
inputOutputDevice
);
});
}
/**
* 设置白名单已经被读取到
*/
@Override
public
void
setRead
(
List
<
InputOutputDevice
>
inputOutputDevices
)
{
inputOutputDevices
.
forEach
(
inputOutputDevice
->
{
if
(
inputOutputDevice
.
getIsRead
()==
0
)
{
inputOutputDevice
.
setIsRead
(
1
);
inputOutputDeviceDao
.
save
(
inputOutputDevice
);
}
});
}
}
dev-rfid/src/main/java/com/tykj/dev/rfid/timeTask/AccessSchedulerTask.java
0 → 100644
浏览文件 @
27eaf547
package
com
.
tykj
.
dev
.
rfid
.
timeTask
;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.rfid.entity.domin.InputOutputDevice
;
import
com.tykj.dev.rfid.repository.InputOutputDeviceDao
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.support.CronTrigger
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.concurrent.ScheduledFuture
;
/**
* @author dengdiyi
*/
@Slf4j
@Component
@EnableAsync
@Data
public
class
AccessSchedulerTask
{
/**
* 每分钟
*/
private
String
cron
=
"0 0/1 * * * ?"
;
/**
* 门禁白名单过期时间(1分钟(毫秒))
*/
private
long
overTime
=
60_000
;
private
ScheduledFuture
scheduledFuture
;
final
InputOutputDeviceDao
inputOutputDeviceDao
;
public
AccessSchedulerTask
(
InputOutputDeviceDao
inputOutputDeviceDao
){
this
.
inputOutputDeviceDao
=
inputOutputDeviceDao
;
scheduledFuture
=
TaskBeanConfig
.
getThreadPoolTaskScheduler
().
schedule
(
new
AccessDeleteTask
(),
triggerContext
->
new
CronTrigger
(
cron
).
nextExecutionTime
(
triggerContext
));
log
.
info
(
"[门禁模块]:定时删除白名单任务执行了"
);
}
public
class
AccessDeleteTask
implements
Runnable
{
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
run
()
{
if
(
inputOutputDeviceDao
!=
null
){
List
<
InputOutputDevice
>
inputOutputDevices
=
inputOutputDeviceDao
.
findAllByIsRead
(
1
);
if
(
inputOutputDevices
.
size
()>
0
){
inputOutputDevices
.
forEach
(
inputOutputDevice
->
{
long
time
=
System
.
currentTimeMillis
()-
inputOutputDevice
.
getUpdateTime
().
getTime
();
if
(
time
>
overTime
){
inputOutputDeviceDao
.
deleteById
(
inputOutputDevice
.
getId
());
log
.
info
(
"[门禁模块]:删除了id为"
+
inputOutputDevice
.
getDeviceId
()+
"装备的白名单"
);
}
});
}
}
}
}
}
dev-storage/src/main/java/com/tykj/dev/device/storage/subject/vo/StorageBillSaveVo.java
浏览文件 @
27eaf547
...
...
@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
org.springframework.beans.BeanUtils
;
import
javax.validation.Valid
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
...
...
@@ -75,6 +76,7 @@ public class StorageBillSaveVo {
@ApiModelProperty
(
value
=
"已入库数量"
)
private
Integer
storagedCount
;
@Valid
@NotEmpty
(
message
=
"deviceLibrarySaveVoList不能为空"
)
@ApiModelProperty
(
value
=
"入库各装备详情"
)
private
List
<
DeviceLibrarySaveVo
>
deviceLibrarySaveVoList
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论