Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
2a1c02cf
提交
2a1c02cf
authored
9月 04, 2020
作者:
黄夏豪
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
项目重构代码补充
上级
3df11845
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
76 行增加
和
34 行删除
+76
-34
DeviceDestroyController.java
...roy/src/main/java/controller/DeviceDestroyController.java
+25
-6
GlobalExceptionHandler.java
...a/com/tykj/dev/misc/exception/GlobalExceptionHandler.java
+5
-0
RfidController.java
...ain/java/com/tykj/dev/rfid/controller/RfidController.java
+35
-16
LibraryWarningLog.java
...ava/com/tykj/dev/rfid/entity/domin/LibraryWarningLog.java
+3
-4
LibraryWarningLogDetail.java
...m/tykj/dev/rfid/entity/domin/LibraryWarningLogDetail.java
+3
-4
RfidChangeBill.java
...n/java/com/tykj/dev/rfid/entity/domin/RfidChangeBill.java
+3
-4
RfidChangeLog.java
...in/java/com/tykj/dev/rfid/entity/domin/RfidChangeLog.java
+2
-0
没有找到文件。
dev-device/device-destroy/src/main/java/controller/DeviceDestroyController.java
浏览文件 @
2a1c02cf
...
...
@@ -2,12 +2,17 @@ package controller;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLogService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo
;
import
com.tykj.dev.device.task.service.TaskLogService
;
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.TaskLogBto
;
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.domin.Task
;
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.service.UserPublicService
;
import
com.tykj.dev.device.user.util.AuthenticationUtils
;
...
...
@@ -21,6 +26,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -47,25 +53,28 @@ public class DeviceDestroyController {
private
final
DeviceLibraryService
deviceLibraryService
;
final
UserPublicService
userPublicService
;
private
final
UserPublicService
userPublicService
;
private
final
DeviceLogService
deviceLogService
;
private
final
TaskLogService
taskLogService
;
/**
* 装备销毁对应的生命周期编号
*/
private
static
final
Integer
DEVICE_DESTROY_LIFE_STATUS
=
10
;
public
DeviceDestroyController
(
DeviceDestroyBillService
deviceDestroyBillServiceyBillService
,
TaskService
taskService
,
DeviceLibraryService
deviceLibraryService
,
UserPublicService
userPublicService
)
{
public
DeviceDestroyController
(
DeviceDestroyBillService
deviceDestroyBillServiceyBillService
,
TaskService
taskService
,
DeviceLibraryService
deviceLibraryService
,
UserPublicService
userPublicService
,
DeviceLogService
deviceLogService
,
TaskLogService
taskLogService
)
{
this
.
deviceDestroyBillService
=
deviceDestroyBillServiceyBillService
;
this
.
taskService
=
taskService
;
this
.
deviceLibraryService
=
deviceLibraryService
;
this
.
userPublicService
=
userPublicService
;
this
.
deviceLogService
=
deviceLogService
;
this
.
taskLogService
=
taskLogService
;
}
// @Autowired
// MyWebSocket myWebSocket;
//
// @Autowired
// private DeviceLogService deviceLogService;
@ApiOperation
(
value
=
"查询销毁单"
,
notes
=
"可以通过这个接口查询销毁单"
)
@PostMapping
(
value
=
"/summary"
)
...
...
@@ -82,7 +91,17 @@ public class DeviceDestroyController {
DeviceDestroyBill
destroyBill
=
DeviceDestroyBill
.
formVoToBill
(
formVo
,
currentUserInfo
);
//保存销毁账单
DeviceDestroyBill
deviceDestroyBillEntitySaved
=
deviceDestroyBillService
.
addEntity
(
destroyBill
);
taskService
.
start
(
initTaskBto
(
deviceDestroyBillEntitySaved
));
//生成日志所需的文件列表
ArrayList
<
FileVo
>
billList
=
ListUtil
.
createList
(
new
FileVo
(
"标签替换单据"
,
deviceDestroyBillEntitySaved
.
getFileName
(),
deviceDestroyBillEntitySaved
.
getFileUrl
())
);
//生成装备变更日志
//生成销毁审核任务
Task
task
=
taskService
.
start
(
initTaskBto
(
deviceDestroyBillEntitySaved
));
//生成任务日志
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"发起标签销毁"
,
billList
));
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"标签销毁待审核"
,
billList
));
// myWebSocket.sendMessage1();
return
ResultUtil
.
success
(
"销毁-出库申请成功"
);
}
...
...
dev-misc/src/main/java/com/tykj/dev/misc/exception/GlobalExceptionHandler.java
浏览文件 @
2a1c02cf
...
...
@@ -31,6 +31,7 @@ public class GlobalExceptionHandler {
@ResponseBody
@ExceptionHandler
(
Exception
.
class
)
public
ResponseEntity
errorMessage
(
Exception
e
){
e
.
printStackTrace
();
return
ResultUtil
.
failed
();
}
...
...
@@ -41,6 +42,7 @@ public class GlobalExceptionHandler {
@ResponseBody
@ExceptionHandler
(
ApiException
.
class
)
public
ResponseEntity
errorMessage
(
ApiException
e
){
e
.
printStackTrace
();
if
(
e
.
getResponseEntity
()!=
null
){
return
e
.
getResponseEntity
();
}
...
...
@@ -54,6 +56,7 @@ public class GlobalExceptionHandler {
@ResponseBody
@ExceptionHandler
(
BindException
.
class
)
public
ResponseEntity
errorMessage
(
BindException
e
){
e
.
printStackTrace
();
BindingResult
bindingResult
=
e
.
getBindingResult
();
String
message
=
null
;
if
(
bindingResult
.
hasErrors
())
{
...
...
@@ -72,6 +75,7 @@ public class GlobalExceptionHandler {
@ResponseBody
@ExceptionHandler
(
AuthenticationException
.
class
)
public
ResponseEntity
errorMessage
(
AuthenticationException
e
){
e
.
printStackTrace
();
return
ResultUtil
.
unauthorized
();
}
...
...
@@ -82,6 +86,7 @@ public class GlobalExceptionHandler {
@ResponseBody
@ExceptionHandler
(
AccessDeniedException
.
class
)
public
ResponseEntity
errorMessage
(
AccessDeniedException
e
){
e
.
printStackTrace
();
return
ResultUtil
.
forbidden
();
}
...
...
dev-rfid/src/main/java/com/tykj/dev/rfid/controller/RfidController.java
浏览文件 @
2a1c02cf
...
...
@@ -13,6 +13,7 @@ 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.StatusEnum
;
import
com.tykj.dev.device.task.subject.domin.Task
;
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.service.UserPublicService
;
...
...
@@ -121,11 +122,11 @@ public class RfidController {
//生成详情信息
rfidChangeLogService
.
addEntity
(
initRfidChangeLog
(
currentUserInfo
,
rfidChangeBillSaved
,
d
));
//生成装备变更日志
deviceLogService
.
addLog
(
new
DeviceLogDto
(
rfidChangeBillSaved
.
getId
(),
"发起入库"
,
billList
));
deviceLogService
.
addLog
(
new
DeviceLogDto
(
rfidChangeBillSaved
.
getId
(),
"发起标签替换"
,
billList
));
deviceLogService
.
addLog
(
new
DeviceLogDto
(
rfidChangeBillSaved
.
getId
(),
"标签替换待审核"
,
billList
));
});
//生成Task
TaskBto
task
=
initTaskBto
(
currentUserInfo
,
rfidChangeBillSaved
);
taskService
.
start
(
task
);
Task
task
=
taskService
.
start
(
initTaskBto
(
currentUserInfo
,
rfidChangeBillSaved
));
//生成任务日志
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"发起标签销毁"
,
billList
));
taskLogService
.
addLog
(
new
TaskLogBto
(
task
.
getId
(),
"标签销毁待审核"
,
billList
));
...
...
@@ -166,16 +167,33 @@ public class RfidController {
RfidChangeBill
rfidChangeBill
=
rfidChangeBillService
.
getOne
(
task
.
getBillId
());
//判断审核结果
if
(
rfidChangeConfirmVo
.
getResult
()==
0
){
//更改账单状态
//更改账单状态
为 审核失败
rfidChangeBill
.
setStatus
(
RfidChangeStatus
.
CONFIRM_FAILED
.
getStatus
());
}
else
{
//更改账单状态
//更改账单状态
为 审核成功
rfidChangeBill
.
setStatus
(
RfidChangeStatus
.
CONFIRM_SUCCESS
.
getStatus
());
//构建查询VO
RfidChangeLogSelectVo
rfidChangeLogSelectVo
=
new
RfidChangeLogSelectVo
();
rfidChangeLogSelectVo
.
setBillId
(
task
.
getBillId
());
List
<
RfidChangeLog
>
rfidChangeLogEntities
=
rfidChangeLogService
.
getList
(
rfidChangeLogSelectVo
);
rfidChangeLogEntities
.
forEach
(
d
->{
}
//生成日志所需的文件列表
ArrayList
<
FileVo
>
billList
=
ListUtil
.
createList
(
new
FileVo
(
"标签替换单据"
,
rfidChangeBill
.
getFileName
(),
rfidChangeBill
.
getFileUrl
())
);
//处理详情和生成日志
handleBillDetail
(
task
,
billList
,
rfidChangeConfirmVo
.
getResult
());
//更新账单
rfidChangeBillService
.
updateEntity
(
rfidChangeBill
);
//更改对应任务的状态
taskService
.
update
(
taskService
.
moveToEnd
(
task
));
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
());
...
...
@@ -183,12 +201,13 @@ public class RfidController {
//将对应的账单详情记录变为审核成功
d
.
setValidTag
(
1
);
rfidChangeLogService
.
updateEntity
(
d
);
});
}
rfidChangeBillService
.
updateEntity
(
rfidChangeBill
);
//更改对应任务的状态
taskService
.
update
(
taskService
.
moveToEnd
(
task
));
return
selectRfidChangeDetail
(
rfidChangeBill
.
getId
());
//生成装备日志
deviceLogService
.
addLog
(
new
DeviceLogDto
(
task
.
getBillId
(),
"标签替换成功"
,
billList
));
}
else
{
deviceLogService
.
addLog
(
new
DeviceLogDto
(
task
.
getBillId
(),
"标签替换审核事变"
,
billList
));
}
});
}
@ApiOperation
(
value
=
"标签管理概览"
,
notes
=
"通过这个借口可以查看标签管理的概览"
)
...
...
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/domin/LibraryWarningLog.java
浏览文件 @
2a1c02cf
...
...
@@ -7,11 +7,9 @@ import org.hibernate.annotations.SQLDelete;
import
org.hibernate.annotations.Where
;
import
org.springframework.data.annotation.CreatedDate
;
import
org.springframework.data.annotation.LastModifiedDate
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.*
;
import
java.util.Date
;
/**
...
...
@@ -20,6 +18,7 @@ import java.util.Date;
*/
@Data
@Entity
@EntityListeners
(
AuditingEntityListener
.
class
)
@SQLDelete
(
sql
=
"update library_warning_log set delete_tag = 1 where id = ?"
)
@Where
(
clause
=
"delete_tag = 0"
)
@ApiModel
(
"库房告警日志"
)
...
...
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/domin/LibraryWarningLogDetail.java
浏览文件 @
2a1c02cf
...
...
@@ -7,11 +7,9 @@ import org.hibernate.annotations.SQLDelete;
import
org.hibernate.annotations.Where
;
import
org.springframework.data.annotation.CreatedDate
;
import
org.springframework.data.annotation.LastModifiedDate
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.*
;
import
java.util.Date
;
/**
...
...
@@ -21,6 +19,7 @@ import java.util.Date;
*/
@Data
@Entity
@EntityListeners
(
AuditingEntityListener
.
class
)
@SQLDelete
(
sql
=
"update library_warning_log_detail set delete_tag = 1 where id = ?"
)
@Where
(
clause
=
"delete_tag = 0"
)
@ApiModel
(
"库房告警详情"
)
...
...
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/domin/RfidChangeBill.java
浏览文件 @
2a1c02cf
...
...
@@ -11,11 +11,9 @@ import org.springframework.data.annotation.CreatedBy;
import
org.springframework.data.annotation.CreatedDate
;
import
org.springframework.data.annotation.LastModifiedBy
;
import
org.springframework.data.annotation.LastModifiedDate
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.*
;
import
java.util.Date
;
/**
...
...
@@ -26,6 +24,7 @@ import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@EntityListeners
(
AuditingEntityListener
.
class
)
@Entity
@SQLDelete
(
sql
=
"update rfid_change_bill set delete_tag = 1 where id = ?"
)
@Where
(
clause
=
"delete_tag = 0"
)
...
...
dev-rfid/src/main/java/com/tykj/dev/rfid/entity/domin/RfidChangeLog.java
浏览文件 @
2a1c02cf
...
...
@@ -11,6 +11,7 @@ import org.springframework.data.annotation.CreatedBy;
import
org.springframework.data.annotation.CreatedDate
;
import
org.springframework.data.annotation.LastModifiedBy
;
import
org.springframework.data.annotation.LastModifiedDate
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.*
;
import
java.util.Date
;
...
...
@@ -23,6 +24,7 @@ import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@EntityListeners
(
AuditingEntityListener
.
class
)
@Entity
@SQLDelete
(
sql
=
"update rfid_change_log set delete_tag = 1 where id = ?"
)
@Where
(
clause
=
"delete_tag = 0"
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论