Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
cc48e970
提交
cc48e970
authored
9月 04, 2020
作者:
黄夏豪
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
项目重构代码补充
上级
2a1c02cf
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
137 行增加
和
130 行删除
+137
-130
pom.xml
dev-device/device-destroy/pom.xml
+1
-1
DeviceDestroyController.java
...roy/src/main/java/controller/DeviceDestroyController.java
+37
-50
DeviceRetiredController.java
...red/src/main/java/controller/DeviceRetiredController.java
+24
-29
DeviceRetiredBill.java
...etired/src/main/java/entity/domain/DeviceRetiredBill.java
+29
-0
RfidController.java
...ain/java/com/tykj/dev/rfid/controller/RfidController.java
+32
-50
RfidChangeBill.java
...n/java/com/tykj/dev/rfid/entity/domin/RfidChangeBill.java
+14
-0
没有找到文件。
dev-device/device-destroy/pom.xml
浏览文件 @
cc48e970
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
device-dest
or
y
</artifactId>
<artifactId>
device-dest
ro
y
</artifactId>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
...
...
dev-device/device-destroy/src/main/java/controller/DeviceDestroyController.java
浏览文件 @
cc48e970
...
@@ -3,6 +3,7 @@ package controller;
...
@@ -3,6 +3,7 @@ package controller;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLogService
;
import
com.tykj.dev.device.library.service.DeviceLogService
;
import
com.tykj.dev.device.library.subject.Dto.DeviceLogDto
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo
;
import
com.tykj.dev.device.task.service.TaskLogService
;
import
com.tykj.dev.device.task.service.TaskLogService
;
...
@@ -93,15 +94,18 @@ public class DeviceDestroyController {
...
@@ -93,15 +94,18 @@ public class DeviceDestroyController {
DeviceDestroyBill
deviceDestroyBillEntitySaved
=
deviceDestroyBillService
.
addEntity
(
destroyBill
);
DeviceDestroyBill
deviceDestroyBillEntitySaved
=
deviceDestroyBillService
.
addEntity
(
destroyBill
);
//生成日志所需的文件列表
//生成日志所需的文件列表
ArrayList
<
FileVo
>
billList
=
ListUtil
.
createList
(
ArrayList
<
FileVo
>
billList
=
ListUtil
.
createList
(
new
FileVo
(
"
标签替换
单据"
,
deviceDestroyBillEntitySaved
.
getFileName
(),
deviceDestroyBillEntitySaved
.
getFileUrl
())
new
FileVo
(
"
销毁
单据"
,
deviceDestroyBillEntitySaved
.
getFileName
(),
deviceDestroyBillEntitySaved
.
getFileUrl
())
);
);
//生成装备变更日志
//生成装备变更日志
formVo
.
getDevices
().
forEach
(
d
->{
deviceLogService
.
addLog
(
new
DeviceLogDto
(
d
,
"发起销毁"
,
billList
));
deviceLogService
.
addLog
(
new
DeviceLogDto
(
d
,
"销毁待审核"
,
billList
));
});
//生成销毁审核任务
//生成销毁审核任务
Task
task
=
taskService
.
start
(
initTaskBto
(
deviceDestroyBillEntitySaved
));
Task
task
=
taskService
.
start
(
initTaskBto
(
deviceDestroyBillEntitySaved
));
//生成任务日志
//生成任务日志
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"发起
标签
销毁"
,
billList
));
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"发起销毁"
,
billList
));
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"
标签
销毁待审核"
,
billList
));
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"销毁待审核"
,
billList
));
// myWebSocket.sendMessage1();
// myWebSocket.sendMessage1();
return
ResultUtil
.
success
(
"销毁-出库申请成功"
);
return
ResultUtil
.
success
(
"销毁-出库申请成功"
);
}
}
...
@@ -139,6 +143,7 @@ public class DeviceDestroyController {
...
@@ -139,6 +143,7 @@ public class DeviceDestroyController {
}
}
//如果装备已经被销毁则生成拼接文号
//如果装备已经被销毁则生成拼接文号
docNumber
=
makeDocNumber
(
destroyBill
);
docNumber
=
makeDocNumber
(
destroyBill
);
//拼接ResultVo
destroyDetailResultVo
=
new
DeviceDestroyDetailResultVo
(
destroyDetailResultVo
=
new
DeviceDestroyDetailResultVo
(
destroyBill
.
getStartUserAId
(),
destroyBill
.
getStartUserAId
(),
destroyBill
.
getStartUserBId
(),
destroyBill
.
getStartUserBId
(),
...
@@ -172,67 +177,49 @@ public class DeviceDestroyController {
...
@@ -172,67 +177,49 @@ public class DeviceDestroyController {
if
(
deviceDestoryConfirmVo
.
getResult
()
==
0
)
{
if
(
deviceDestoryConfirmVo
.
getResult
()
==
0
)
{
//更改账单状态
//更改账单状态
deviceDestroyBill
.
setDestroyStatus
(
DestroyStatus
.
CONFIRM_FAILED
.
getStatus
());
deviceDestroyBill
.
setDestroyStatus
(
DestroyStatus
.
CONFIRM_FAILED
.
getStatus
());
//生成对应的日志
// List<Integer> list = StringSplitUtil.split(deviceDestroyBillEntity.getDestroyDeviceDetail());
// if (list.size()>0) {
// for (Integer id : list) {
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ");
// bussinessLogVo.setRemark("销毁审核失败");
// bussinessLogVo.setTaskId(task.getId());
// deviceLogService.addLog(bussinessLogVo);
// }
// }
}
else
{
}
else
{
//更改账单状态
//更改账单状态
deviceDestroyBill
.
setDestroyStatus
(
DestroyStatus
.
CONFIRM_SUCCESS
.
getStatus
());
deviceDestroyBill
.
setDestroyStatus
(
DestroyStatus
.
CONFIRM_SUCCESS
.
getStatus
());
//设置销毁时间
deviceDestroyBill
.
setDestroyTime
(
new
Date
());
deviceDestroyBill
.
setDestroyTime
(
new
Date
());
//更改对应装备的状态为销毁
List
<
Integer
>
list
=
StringSplitUtil
.
split
(
deviceDestroyBill
.
getDestroyDeviceDetail
());
for
(
Integer
id
:
list
)
{
if
(
id
>
0
)
{
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
deviceLibraryEntity
.
setLifeStatus
(
DEVICE_DESTROY_LIFE_STATUS
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
// LogVo bussinessLogVo = new LogVo();
// bussinessLogVo.setDeviceId(id);
// bussinessLogVo.setFileDetail("Ǵ");
// bussinessLogVo.setRemark("审核成功并出库");
// bussinessLogVo.setTaskId(task.getId());
// deviceLogService.addLog(bussinessLogVo);
}
}
//为账单新增文号
//为账单新增文号
deviceDestroyBill
.
setDocNumber
(
this
.
deviceDestroyBillService
.
getNewDocNumber
());
deviceDestroyBill
.
setDocNumber
(
this
.
deviceDestroyBillService
.
getNewDocNumber
());
//变更任务状态
task
.
setBillStatus
(
StatusEnum
.
DESTROY_BUSINESS_CONFIRM_FINISH_SUCCESS
.
id
);
task
.
setBillStatus
(
StatusEnum
.
DESTROY_BUSINESS_CONFIRM_FINISH_SUCCESS
.
id
);
}
}
//生成日志所需的文件列表
ArrayList
<
FileVo
>
billList
=
ListUtil
.
createList
(
new
FileVo
(
"标签替换单据"
,
deviceDestroyBill
.
getFileName
(),
deviceDestroyBill
.
getFileUrl
())
);
//更改对应装备的状态为销毁
handleDeviceDetail
(
deviceDestroyBill
,
billList
,
deviceDestoryConfirmVo
.
getResult
());
//更新销毁账单
this
.
deviceDestroyBillService
.
updateEntity
(
deviceDestroyBill
);
//将任务推进至完结
//将任务推进至完结
taskService
.
moveToEnd
(
task
);
taskService
.
moveToEnd
(
task
);
this
.
deviceDestroyBillService
.
updateEntity
(
deviceDestroyBill
);
taskService
.
update
(
task
);
taskService
.
update
(
task
);
//生成任务日志
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
deviceDestoryConfirmVo
.
getResult
()
==
0
?
"销毁成功"
:
"销毁审核失败"
,
billList
));
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"业务完结"
,
billList
));
// myWebSocket.sendMessage1();
// myWebSocket.sendMessage1();
return
selectDestoryDetail
(
deviceDestroyBill
.
getId
());
return
selectDestoryDetail
(
deviceDestroyBill
.
getId
());
}
}
/**
private
void
handleDeviceDetail
(
DeviceDestroyBill
deviceDestroyBill
,
ArrayList
<
FileVo
>
billList
,
Integer
flag
)
{
* 生成变更日志
List
<
Integer
>
list
=
StringSplitUtil
.
split
(
deviceDestroyBill
.
getDestroyDeviceDetail
());
*
for
(
Integer
id
:
list
)
{
* @return 装备出库详情
if
(
id
>
0
)
{
*/
if
(
flag
==
1
){
private
void
createDeviceLog
(
List
<
Integer
>
deviceIds
)
{
//将装备装备变更为销毁
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
deviceIds
.
forEach
(
device
->
{
deviceLibraryEntity
.
setLifeStatus
(
DEVICE_DESTROY_LIFE_STATUS
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
//生成日志
}
// LogVo bussinessLogVo = new LogVo();
//生成装备日志
// bussinessLogVo.setDeviceId(device);
deviceLogService
.
addLog
(
new
DeviceLogDto
(
id
,
flag
==
1
?
"装备销毁成功"
:
"装备销毁失败"
,
billList
));
// bussinessLogVo.setFileDetail("Ǵ"+deviceDestoryBillEntity.getFileName()+"Ǒ"+deviceDestoryBillEntity.getFileUrl()+"Ǒ"+"出库确认单"+"Ǵ");
}
// bussinessLogVo.setRemark("发起销毁");
}
// bussinessLogVo.setTaskId(taskEntitySaved.getId());
// deviceLogService.addLog(bussinessLogVo);
});
}
}
private
String
makeDocNumber
(
DeviceDestroyBill
deviceDestroyBill
)
{
private
String
makeDocNumber
(
DeviceDestroyBill
deviceDestroyBill
)
{
...
...
dev-device/device-retired/src/main/java/controller/DeviceRetiredController.java
浏览文件 @
cc48e970
...
@@ -2,15 +2,21 @@ package controller;
...
@@ -2,15 +2,21 @@ package controller;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLogService
;
import
com.tykj.dev.device.library.subject.Dto.DeviceLogDto
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo
;
import
com.tykj.dev.device.packing.service.PackingLibraryService
;
import
com.tykj.dev.device.packing.service.PackingLibraryService
;
import
com.tykj.dev.device.packing.subject.domin.PackingLibrary
;
import
com.tykj.dev.device.packing.subject.domin.PackingLibrary
;
import
com.tykj.dev.device.packing.subject.vo.PackingLibrarySelectVo
;
import
com.tykj.dev.device.packing.subject.vo.PackingLibrarySelectVo
;
import
com.tykj.dev.device.task.service.TaskLogService
;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.task.subject.bto.TaskLogBto
;
import
com.tykj.dev.device.task.subject.common.BusinessEnum
;
import
com.tykj.dev.device.task.subject.common.BusinessEnum
;
import
com.tykj.dev.device.task.subject.common.StatusEnum
;
import
com.tykj.dev.device.task.subject.common.StatusEnum
;
import
com.tykj.dev.device.task.subject.domin.TaskLog
;
import
com.tykj.dev.device.task.subject.vo.FileVo
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.device.user.util.AuthenticationUtils
;
import
com.tykj.dev.device.user.util.AuthenticationUtils
;
import
com.tykj.dev.misc.utils.ListUtil
;
import
com.tykj.dev.misc.utils.ListUtil
;
...
@@ -21,6 +27,7 @@ import entity.vo.*;
...
@@ -21,6 +27,7 @@ import entity.vo.*;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.scheduling.support.TaskUtils
;
import
org.springframework.scheduling.support.TaskUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -52,23 +59,25 @@ public class DeviceRetiredController {
...
@@ -52,23 +59,25 @@ public class DeviceRetiredController {
private
final
DeviceLibraryService
deviceLibraryService
;
private
final
DeviceLibraryService
deviceLibraryService
;
private
final
DeviceLogService
deviceLogService
;
private
final
TaskLogService
taskLogService
;
final
final
TaskUtils
taskUtils
;
TaskUtils
taskUtils
;
public
DeviceRetiredController
(
DeviceRetiredBillService
deviceRetiredBillService
,
TaskService
taskService
,
PackingLibraryService
packingLibraryService
,
DeviceLibraryService
deviceLibraryService
,
TaskUtils
taskUtils
)
{
public
DeviceRetiredController
(
DeviceRetiredBillService
deviceRetiredBillService
,
TaskService
taskService
,
PackingLibraryService
packingLibraryService
,
DeviceLibraryService
deviceLibraryService
,
TaskUtils
taskUtils
,
DeviceLogService
deviceLogService
,
TaskLogService
taskLogService
)
{
this
.
deviceRetiredBillService
=
deviceRetiredBillService
;
this
.
deviceRetiredBillService
=
deviceRetiredBillService
;
this
.
taskService
=
taskService
;
this
.
taskService
=
taskService
;
this
.
packingLibraryService
=
packingLibraryService
;
this
.
packingLibraryService
=
packingLibraryService
;
this
.
deviceLibraryService
=
deviceLibraryService
;
this
.
deviceLibraryService
=
deviceLibraryService
;
this
.
taskUtils
=
taskUtils
;
this
.
taskUtils
=
taskUtils
;
this
.
deviceLogService
=
deviceLogService
;
this
.
taskLogService
=
taskLogService
;
}
}
// @Autowired
// @Autowired
// MyWebSocket myWebSocket;
// MyWebSocket myWebSocket;
//
// @Autowired
// private DeviceLogService deviceLogService;
@ApiOperation
(
value
=
"查询可退装装备"
,
notes
=
"可以通过这个接口查询销毁单"
)
@ApiOperation
(
value
=
"查询可退装装备"
,
notes
=
"可以通过这个接口查询销毁单"
)
@PostMapping
(
value
=
"/devices"
)
@PostMapping
(
value
=
"/devices"
)
...
@@ -93,19 +102,18 @@ public class DeviceRetiredController {
...
@@ -93,19 +102,18 @@ public class DeviceRetiredController {
public
ResponseEntity
<
String
>
selectRepairBill
(
@Validated
@RequestBody
DeviceRetiredFormVo
formVo
)
{
public
ResponseEntity
<
String
>
selectRepairBill
(
@Validated
@RequestBody
DeviceRetiredFormVo
formVo
)
{
//生成销毁账单
//生成销毁账单
User
currentUserInfo
=
Objects
.
requireNonNull
(
AuthenticationUtils
.
getAuthentication
()).
getCurrentUserInfo
();
User
currentUserInfo
=
Objects
.
requireNonNull
(
AuthenticationUtils
.
getAuthentication
()).
getCurrentUserInfo
();
DeviceRetiredBill
retiredBill
=
new
DeviceRetiredBill
(
DeviceRetiredBill
retiredBill
=
DeviceRetiredBill
.
formVoToBill
(
formVo
,
currentUserInfo
);
currentUserInfo
.
getUserId
(),
formVo
.
getConfirmUserId
(),
RetiredStatus
.
NEED_CONFIRM
.
getStatus
(),
packingListToString
(
formVo
.
getPackings
())
);
//生成装备销毁出库详情
retiredBill
=
deviceRetiredBillService
.
addEntity
(
retiredBill
);
retiredBill
=
deviceRetiredBillService
.
addEntity
(
retiredBill
);
//生成日志所需的文件列表
ArrayList
<
FileVo
>
billList
=
ListUtil
.
createList
(
new
FileVo
(
"标签替换单据"
,
null
,
null
)
);
//生成Task
//生成Task
TaskBto
task
=
initTaskBto
(
retiredBill
);
TaskBto
task
=
initTaskBto
(
retiredBill
);
taskService
.
start
(
task
);
taskService
.
start
(
task
);
//todo 日志
//生成任务日志
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"发起退装"
,
billList
));
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"退装待审核"
,
billList
));
// myWebSocket.sendMessage1();
// myWebSocket.sendMessage1();
return
ResultUtil
.
success
(
"退装申请成功"
);
return
ResultUtil
.
success
(
"退装申请成功"
);
}
}
...
@@ -160,6 +168,7 @@ public class DeviceRetiredController {
...
@@ -160,6 +168,7 @@ public class DeviceRetiredController {
taskService
.
moveToEnd
(
task
);
taskService
.
moveToEnd
(
task
);
//更改对应任务的状态
//更改对应任务的状态
taskService
.
update
(
task
);
taskService
.
update
(
task
);
//生成任务日志
// myWebSocket.sendMessage1();
// myWebSocket.sendMessage1();
...
@@ -209,21 +218,7 @@ public class DeviceRetiredController {
...
@@ -209,21 +218,7 @@ public class DeviceRetiredController {
});
});
}
}
/**
* 生成装备销毁出库详情,并为对应的装备生成变更日志
*
* @return 装备出库详情
*/
private
String
packingListToString
(
List
<
Integer
>
packings
)
{
StringBuffer
deviceDetail
=
new
StringBuffer
();
deviceDetail
.
append
(
"x"
);
packings
.
forEach
(
packing
->
{
deviceDetail
.
append
(
packing
.
toString
());
deviceDetail
.
append
(
1
);
deviceDetail
.
append
(
"x"
);
});
return
deviceDetail
.
toString
();
}
private
TaskBto
initTaskBto
(
DeviceRetiredBill
retiredBill
){
private
TaskBto
initTaskBto
(
DeviceRetiredBill
retiredBill
){
//生成Task
//生成Task
...
...
dev-device/device-retired/src/main/java/entity/domain/DeviceRetiredBill.java
浏览文件 @
cc48e970
package
entity
.
domain
;
package
entity
.
domain
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
entity.enums.RetiredStatus
;
import
entity.vo.DeviceRetiredFormVo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -13,6 +16,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
...
@@ -13,6 +16,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* entity class for device_retired_bill
* entity class for device_retired_bill
...
@@ -81,4 +85,29 @@ public class DeviceRetiredBill {
...
@@ -81,4 +85,29 @@ public class DeviceRetiredBill {
this
.
retiredStatus
=
retiredStatus
;
this
.
retiredStatus
=
retiredStatus
;
this
.
retiredDetail
=
retiredDetail
;
this
.
retiredDetail
=
retiredDetail
;
}
}
public
static
DeviceRetiredBill
formVoToBill
(
DeviceRetiredFormVo
formVo
,
User
user
){
return
new
DeviceRetiredBill
(
user
.
getUserId
(),
formVo
.
getConfirmUserId
(),
RetiredStatus
.
NEED_CONFIRM
.
getStatus
(),
packingListToString
(
formVo
.
getPackings
())
);
}
/**
* 生成装备销毁出库详情,并为对应的装备生成变更日志
*
* @return 装备出库详情
*/
private
static
String
packingListToString
(
List
<
Integer
>
packings
)
{
StringBuffer
deviceDetail
=
new
StringBuffer
();
deviceDetail
.
append
(
"x"
);
packings
.
forEach
(
packing
->
{
deviceDetail
.
append
(
packing
.
toString
());
deviceDetail
.
append
(
1
);
deviceDetail
.
append
(
"x"
);
});
return
deviceDetail
.
toString
();
}
}
}
dev-rfid/src/main/java/com/tykj/dev/rfid/controller/RfidController.java
浏览文件 @
cc48e970
...
@@ -110,8 +110,8 @@ public class RfidController {
...
@@ -110,8 +110,8 @@ public class RfidController {
public
ResponseEntity
<
String
>
form
(
@Validated
@RequestBody
RfidFormVo
formVo
){
public
ResponseEntity
<
String
>
form
(
@Validated
@RequestBody
RfidFormVo
formVo
){
//获取当前登录用户
//获取当前登录用户
User
currentUserInfo
=
Objects
.
requireNonNull
(
AuthenticationUtils
.
getAuthentication
()).
getCurrentUserInfo
();
User
currentUserInfo
=
Objects
.
requireNonNull
(
AuthenticationUtils
.
getAuthentication
()).
getCurrentUserInfo
();
//生成
销毁
账单
//生成账单
RfidChangeBill
rfidChangeBill
=
initRfidChange
Bill
(
formVo
,
currentUserInfo
);
RfidChangeBill
rfidChangeBill
=
RfidChangeBill
.
formVoTo
Bill
(
formVo
,
currentUserInfo
);
RfidChangeBill
rfidChangeBillSaved
=
rfidChangeBillService
.
addEntity
(
rfidChangeBill
);
RfidChangeBill
rfidChangeBillSaved
=
rfidChangeBillService
.
addEntity
(
rfidChangeBill
);
//生成日志所需的文件列表
//生成日志所需的文件列表
ArrayList
<
FileVo
>
billList
=
ListUtil
.
createList
(
ArrayList
<
FileVo
>
billList
=
ListUtil
.
createList
(
...
@@ -122,14 +122,14 @@ public class RfidController {
...
@@ -122,14 +122,14 @@ public class RfidController {
//生成详情信息
//生成详情信息
rfidChangeLogService
.
addEntity
(
initRfidChangeLog
(
currentUserInfo
,
rfidChangeBillSaved
,
d
));
rfidChangeLogService
.
addEntity
(
initRfidChangeLog
(
currentUserInfo
,
rfidChangeBillSaved
,
d
));
//生成装备变更日志
//生成装备变更日志
deviceLogService
.
addLog
(
new
DeviceLogDto
(
rfidChangeBillSaved
.
get
Id
(),
"发起标签替换"
,
billList
));
deviceLogService
.
addLog
(
new
DeviceLogDto
(
d
.
getDevice
Id
(),
"发起标签替换"
,
billList
));
deviceLogService
.
addLog
(
new
DeviceLogDto
(
rfidChangeBillSaved
.
get
Id
(),
"标签替换待审核"
,
billList
));
deviceLogService
.
addLog
(
new
DeviceLogDto
(
d
.
getDevice
Id
(),
"标签替换待审核"
,
billList
));
});
});
//生成Task
//生成Task
Task
task
=
taskService
.
start
(
initTaskBto
(
currentUserInfo
,
rfidChangeBillSaved
));
Task
task
=
taskService
.
start
(
initTaskBto
(
currentUserInfo
,
rfidChangeBillSaved
));
//生成任务日志
//生成任务日志
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"发起标签
销毁
"
,
billList
));
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"发起标签
替换
"
,
billList
));
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"标签
销毁
待审核"
,
billList
));
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"标签
替换
待审核"
,
billList
));
return
ResultUtil
.
success
(
"标签修改申请成功"
);
return
ResultUtil
.
success
(
"标签修改申请成功"
);
}
}
...
@@ -165,20 +165,17 @@ public class RfidController {
...
@@ -165,20 +165,17 @@ public class RfidController {
//初始化需要的数据
//初始化需要的数据
TaskBto
task
=
taskService
.
get
(
rfidChangeConfirmVo
.
getTaskId
());
TaskBto
task
=
taskService
.
get
(
rfidChangeConfirmVo
.
getTaskId
());
RfidChangeBill
rfidChangeBill
=
rfidChangeBillService
.
getOne
(
task
.
getBillId
());
RfidChangeBill
rfidChangeBill
=
rfidChangeBillService
.
getOne
(
task
.
getBillId
());
//判断审核结果
if
(
rfidChangeConfirmVo
.
getResult
()==
0
){
//更改账单状态 为 审核失败
rfidChangeBill
.
setStatus
(
RfidChangeStatus
.
CONFIRM_FAILED
.
getStatus
());
}
else
{
//更改账单状态 为 审核成功
rfidChangeBill
.
setStatus
(
RfidChangeStatus
.
CONFIRM_SUCCESS
.
getStatus
());
}
//生成日志所需的文件列表
//生成日志所需的文件列表
ArrayList
<
FileVo
>
billList
=
ListUtil
.
createList
(
ArrayList
<
FileVo
>
billList
=
ListUtil
.
createList
(
new
FileVo
(
"标签替换单据"
,
rfidChangeBill
.
getFileName
(),
rfidChangeBill
.
getFileUrl
())
new
FileVo
(
"标签替换单据"
,
rfidChangeBill
.
getFileName
(),
rfidChangeBill
.
getFileUrl
())
);
);
//更改账单状态 1为审核成功 否则为审核失败
rfidChangeBill
.
setStatus
(
rfidChangeConfirmVo
.
getResult
()==
1
?
RfidChangeStatus
.
CONFIRM_SUCCESS
.
getStatus
():
RfidChangeStatus
.
CONFIRM_FAILED
.
getStatus
());
//处理详情和生成日志
//处理详情和生成日志
handleBillDetail
(
task
,
billList
,
rfidChangeConfirmVo
.
getResult
());
handleBillDetail
(
task
,
billList
,
rfidChangeConfirmVo
.
getResult
());
//生成任务变更日志
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
rfidChangeConfirmVo
.
getResult
()==
1
?
"标签替换审核成功"
:
"标签替换审核失败"
,
billList
));
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"业务完结"
,
billList
));
//更新账单
//更新账单
rfidChangeBillService
.
updateEntity
(
rfidChangeBill
);
rfidChangeBillService
.
updateEntity
(
rfidChangeBill
);
//更改对应任务的状态
//更改对应任务的状态
...
@@ -186,30 +183,6 @@ public class RfidController {
...
@@ -186,30 +183,6 @@ public class RfidController {
return
selectRfidChangeDetail
(
rfidChangeBill
.
getId
());
return
selectRfidChangeDetail
(
rfidChangeBill
.
getId
());
}
}
private
void
handleBillDetail
(
TaskBto
task
,
ArrayList
<
FileVo
>
billList
,
Integer
flag
)
{
//构建查询VO
RfidChangeLogSelectVo
rfidChangeLogSelectVo
=
new
RfidChangeLogSelectVo
();
rfidChangeLogSelectVo
.
setBillId
(
task
.
getBillId
());
//查询账单详情
List
<
RfidChangeLog
>
rfidChangeLogEntities
=
rfidChangeLogService
.
getList
(
rfidChangeLogSelectVo
);
rfidChangeLogEntities
.
forEach
(
d
->{
if
(
flag
==
1
){
//更改对应装备的RFID号
DeviceLibrary
device
=
deviceLibraryService
.
getOne
(
d
.
getDeviceId
());
device
.
setRfidCardId
(
d
.
getNewCardId
());
deviceLibraryService
.
update
(
device
);
//将对应的账单详情记录变为审核成功
d
.
setValidTag
(
1
);
rfidChangeLogService
.
updateEntity
(
d
);
//生成装备日志
deviceLogService
.
addLog
(
new
DeviceLogDto
(
task
.
getBillId
(),
"标签替换成功"
,
billList
));
}
else
{
deviceLogService
.
addLog
(
new
DeviceLogDto
(
task
.
getBillId
(),
"标签替换审核事变"
,
billList
));
}
});
}
@ApiOperation
(
value
=
"标签管理概览"
,
notes
=
"通过这个借口可以查看标签管理的概览"
)
@ApiOperation
(
value
=
"标签管理概览"
,
notes
=
"通过这个借口可以查看标签管理的概览"
)
@PostMapping
(
value
=
"/summary"
)
@PostMapping
(
value
=
"/summary"
)
public
ResponseEntity
<
Page
<
DeviceLibrary
>>
getTagSummary
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
){
public
ResponseEntity
<
Page
<
DeviceLibrary
>>
getTagSummary
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
){
...
@@ -325,18 +298,6 @@ public class RfidController {
...
@@ -325,18 +298,6 @@ public class RfidController {
return
ResultUtil
.
success
(
tagDetailVo
);
return
ResultUtil
.
success
(
tagDetailVo
);
}
}
private
RfidChangeBill
initRfidChangeBill
(
RfidFormVo
formVo
,
User
currentUserInfo
)
{
RfidChangeBill
rfidChangeBill
=
new
RfidChangeBill
(
currentUserInfo
.
getUserId
(),
formVo
.
getConfirmId
(),
currentUserInfo
.
getUnits
().
getUnitId
(),
RfidChangeStatus
.
NEED_CONFIRM
.
getStatus
(),
formVo
.
getFileName
(),
formVo
.
getFileUrl
()
);
return
rfidChangeBill
;
}
private
RfidChangeLog
initRfidChangeLog
(
User
currentUserInfo
,
RfidChangeBill
rfidChangeBillSaved
,
RfidChangeInfoVo
d
)
{
private
RfidChangeLog
initRfidChangeLog
(
User
currentUserInfo
,
RfidChangeBill
rfidChangeBillSaved
,
RfidChangeInfoVo
d
)
{
RfidChangeLog
rfidChangeLog
=
new
RfidChangeLog
(
RfidChangeLog
rfidChangeLog
=
new
RfidChangeLog
(
d
.
getDeviceId
(),
d
.
getDeviceId
(),
...
@@ -366,4 +327,25 @@ public class RfidController {
...
@@ -366,4 +327,25 @@ public class RfidController {
);
);
return
task
;
return
task
;
}
}
private
void
handleBillDetail
(
TaskBto
task
,
ArrayList
<
FileVo
>
billList
,
Integer
flag
)
{
//构建查询VO
RfidChangeLogSelectVo
rfidChangeLogSelectVo
=
new
RfidChangeLogSelectVo
();
rfidChangeLogSelectVo
.
setBillId
(
task
.
getBillId
());
//查询账单详情
List
<
RfidChangeLog
>
rfidChangeLogEntities
=
rfidChangeLogService
.
getList
(
rfidChangeLogSelectVo
);
rfidChangeLogEntities
.
forEach
(
d
->{
if
(
flag
==
1
){
//更改对应装备的RFID号
DeviceLibrary
device
=
deviceLibraryService
.
getOne
(
d
.
getDeviceId
());
device
.
setRfidCardId
(
d
.
getNewCardId
());
deviceLibraryService
.
update
(
device
);
//将对应的账单详情记录变为审核成功
d
.
setValidTag
(
1
);
rfidChangeLogService
.
updateEntity
(
d
);
}
//生成装备日志
deviceLogService
.
addLog
(
new
DeviceLogDto
(
d
.
getDeviceId
(),
flag
==
1
?
"标签替换成功"
:
"标签替换审核失败"
,
billList
));
});
}
}
}
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/domin/RfidChangeBill.java
浏览文件 @
cc48e970
package
com
.
tykj
.
dev
.
rfid
.
entity
.
domin
;
package
com
.
tykj
.
dev
.
rfid
.
entity
.
domin
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.rfid.entity.enums.RfidChangeStatus
;
import
com.tykj.dev.rfid.entity.vo.RfidFormVo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
...
@@ -107,4 +110,15 @@ public class RfidChangeBill {
...
@@ -107,4 +110,15 @@ public class RfidChangeBill {
this
.
fileName
=
fileName
;
this
.
fileName
=
fileName
;
this
.
fileUrl
=
fileUrl
;
this
.
fileUrl
=
fileUrl
;
}
}
public
static
RfidChangeBill
formVoToBill
(
RfidFormVo
formVo
,
User
user
){
return
new
RfidChangeBill
(
user
.
getUserId
(),
formVo
.
getConfirmId
(),
user
.
getUnits
().
getUnitId
(),
RfidChangeStatus
.
NEED_CONFIRM
.
getStatus
(),
formVo
.
getFileName
(),
formVo
.
getFileUrl
()
);
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论