Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
b0ff8938
提交
b0ff8938
authored
5月 17, 2021
作者:
邓砥奕
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新
上级
f3833cc9
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
258 行增加
和
286 行删除
+258
-286
AllotBillController.java
...tykj/dev/device/allot/controller/AllotBillController.java
+139
-234
BackController.java
.../com/tykj/dev/device/allot/controller/BackController.java
+90
-44
AllotBillSaveVo.java
...com/tykj/dev/device/allot/subject/vo/AllotBillSaveVo.java
+2
-0
DeviceLibraryService.java
...tykj/dev/device/library/service/DeviceLibraryService.java
+5
-5
DeviceLibraryServiceImpl.java
...device/library/service/impl/DeviceLibraryServiceImpl.java
+1
-1
PackingController.java
...tykj/dev/device/packing/controller/PackingController.java
+2
-2
TaskController.java
...a/com/tykj/dev/device/task/controller/TaskController.java
+6
-0
TaskUserVo.java
.../java/com/tykj/dev/device/task/subject/vo/TaskUserVo.java
+4
-0
MessageServiceImpl.java
...dev/device/user/read/service/impl/MessageServiceImpl.java
+6
-0
MessageUserVo.java
...m/tykj/dev/device/user/read/subject/vo/MessageUserVo.java
+3
-0
没有找到文件。
dev-allot/src/main/java/com/tykj/dev/device/allot/controller/AllotBillController.java
浏览文件 @
b0ff8938
...
...
@@ -5,7 +5,6 @@ import com.tykj.dev.config.cache.ConfigCache;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.allot.service.AllotBackBillService
;
import
com.tykj.dev.device.allot.service.AllotBillService
;
import
com.tykj.dev.device.allot.subject.domin.AllotBackBill
;
import
com.tykj.dev.device.allot.subject.domin.AllotBill
;
import
com.tykj.dev.device.allot.subject.vo.*
;
import
com.tykj.dev.device.file.service.FilesUtil
;
...
...
@@ -30,7 +29,6 @@ import com.tykj.dev.device.user.subject.service.AreaService;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.device.user.util.UserUtils
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.base.ResultObj
;
import
com.tykj.dev.misc.base.StatusEnum
;
import
com.tykj.dev.misc.exception.ApiException
;
...
...
@@ -148,21 +146,26 @@ public class AllotBillController {
@PostMapping
(
value
=
"/addAllotBill"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
addAllotBill
(
@RequestBody
@Validated
AllotBillSaveVo
allotBillSaveVo
)
{
//判断发起配发的装备的生命状态
if
(
allotBillSaveVo
.
getAllotCheckDetail
()!=
null
&&
allotBillSaveVo
.
getAllotCheckDetail
().
length
()>
0
)
{
deviceLibraryService
.
isInStockOrWaitRetired
(
StringSplitUtil
.
split
(
allotBillSaveVo
.
getAllotCheckDetail
()));
}
//1.添加配发单
AllotBill
a
=
allotBillSaveVo
.
toDo
();
if
(
allotBillSaveVo
.
getTaskId
()==
null
)
{
a
.
setSendUseraId
(
userUtils
.
getCurrentUserId
());
}
//保存后的实体
AllotBill
allotBillEntity
;
//如果是直接发起(不是草稿,没有taskId),当前操作人为发件方A岗,添加账单
if
(
allotBillSaveVo
.
getTaskId
()==
null
){
a
.
setSendUseraId
(
userUtils
.
getCurrentUserId
());
allotBillEntity
=
allotBillService
.
addEntity
(
a
);
}
//从草稿发起
else
{
//获取草稿账单
AllotBill
allotBill
=
allotBillService
.
getOne
(
taskService
.
get
(
allotBillSaveVo
.
getTaskId
()).
getBillId
());
//copy非null相同字段值
MapperUtils
.
copyNoNullProperties
(
a
,
allotBill
);
//判断是否取消上传申请单和批复单据
if
(
a
.
getApplyFiles
()==
null
||
""
.
equals
(
a
.
getApplyFiles
())){
allotBill
.
setApplyFiles
(
null
);
}
...
...
@@ -171,18 +174,20 @@ public class AllotBillController {
}
allotBillEntity
=
allotBillService
.
update
(
allotBill
);
}
//按照当前时间和保存账单的id拼接生成配发单号并保存
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
());
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
String
num
=
"NO:第"
+
year
+
"PF"
+
allotBillEntity
.
getId
()
+
"号"
;
allotBillEntity
.
setNum
(
num
);
//生成电子签章id
// Long signId = snowflake.creatNextId();
//生成接收方电子签章id
Long
signId2
=
snowflake
.
creatNextId
();
//判断是否上传了发送方签章id
if
(
allotBillSaveVo
.
getLeftSignatureId
()!=
null
)
{
allotBillEntity
.
setLeftSignatureId
(
allotBillSaveVo
.
getLeftSignatureId
());
}
allotBillEntity
.
setRightSignatureId
(
signId2
.
toString
());
//判断是否提交签发人
if
(
allotBillSaveVo
.
getSendUserbId
()!=
null
){
allotBillEntity
.
setSendUserbId
(
allotBillSaveVo
.
getSendUserbId
());
allotBillEntity
.
setAgent
(
userPublicService
.
getOne
(
allotBillSaveVo
.
getSendUserbId
()).
getName
());
...
...
@@ -192,88 +197,122 @@ public class AllotBillController {
Integer
userId
=
userUtils
.
getCurrentUserId
();
String
deviceIdDetail
=
allotBillEntity
.
getAllotCheckDetail
();
//2.发起任务
//构建task涉及人员集合
List
<
Integer
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
userId
);
userIds
.
add
(
0
);
//保存后的taskBto
TaskBto
saveEntity
;
//纵向
//纵向
配发
if
(
allotBillSaveVo
.
getAllotType
()==
1
)
{
//直接发起
if
(
allotBillSaveVo
.
getTaskId
()
==
null
)
{
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
ALLOTING
.
id
,
"配发业务"
,
null
,
"."
,
billId
,
3
,
userPublicService
.
findUnitIdByName
(
allotBillSaveVo
.
getReceiveUnit
()),
1
,
null
,
userIds
);
saveEntity
=
taskService
.
start
(
taskBto
);
}
else
{
}
//从草稿发起
else
{
TaskBto
taskBto
=
taskService
.
get
(
allotBillSaveVo
.
getTaskId
());
//添加当前操作人为涉及人员
TaskBto
taskBto1
=
taskService
.
addInvolveUser
(
taskBto
,
userId
);
//任务所属单位改为收件单位
taskBto1
.
setOwnUnit
(
userPublicService
.
findUnitIdByName
(
allotBillSaveVo
.
getReceiveUnit
()));
//推动任务到配发中状态
saveEntity
=
taskService
.
moveToSpecial
(
taskBto1
,
StatusEnum
.
ALLOTING
,
0
);
}
// if (allotBillSaveVo.getIsSigned()==null||allotBillSaveVo.getIsSigned()!=1) {
//生成发件方上传配发单的子任务
TaskBto
taskBto2
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_ALLOT_FILE
.
id
,
"配发业务"
,
saveEntity
.
getId
(),
saveEntity
.
getNodeIdDetail
()
+
saveEntity
.
getId
()
+
"."
,
saveEntity
.
getBillId
(),
3
,
userPublicService
.
findUnitIdByName
(
allotBillEntity
.
getSendUnit
()),
0
,
null
,
Collections
.
singletonList
(
0
));
taskService
.
start
(
taskBto2
);
// }
}
//横向配发
else
{
TaskBto
taskBto2
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_CROSS_FILE
.
id
,
"配发业务"
,
null
,
"."
,
billId
,
3
,
userPublicService
.
findUnitIdByName
(
allotBillEntity
.
getSendUnit
()),
1
,
"country"
,
userIds
);
saveEntity
=
taskService
.
start
(
taskBto2
);
}
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
// fileVoList.add(new FileVo("出库确认单", allotBillEntity.getFileName(), allotBillEntity.getFileUrl()));
//存装备日志
//分解装备id字符串
String
[]
strings
=
deviceIdDetail
.
split
(
"x"
);
//存放所有出库装备id
List
<
Integer
>
ids
=
new
ArrayList
<>();
//横纵向列装转换map
//横纵向列装转换map
(key:转换前列装id,value:转换后列装id),减少数据库查询
Map
<
Integer
,
Integer
>
changeMap
=
new
HashMap
<>();
for
(
String
s
:
strings
)
{
//最后一位原来为装备扫码结果,已弃用
if
(
s
.
length
()
>=
2
)
{
//去掉最后一位得到装备id
Integer
id
=
Integer
.
parseInt
(
s
.
substring
(
0
,
s
.
length
()
-
1
));
ids
.
add
(
id
);
//改变装备状态
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
//纵向配发
if
(
allotBillSaveVo
.
getAllotType
()
==
1
){
//如果当前装备的配用范围不是省以下纵向
if
(
deviceLibraryEntity
.
getMatchingRange
()!=
1
){
PackingLibrary
packingLibrary
=
packingLibraryService
.
getOne
(
deviceLibraryEntity
.
getPackingId
());
PackingLibrary
packingLibrary1
=
packingLibraryService
.
findSamePacking
(
packingLibrary
.
getPartParentId
(),
1
,
packingLibrary
.
getType
(),
packingLibrary
.
getStyle
(),
packingLibrary
.
getName
(),
packingLibrary
.
getSecretLevel
(),
packingLibrary
.
getInvisibleRange
());
if
(
packingLibrary1
==
null
){
throw
new
ApiException
(
ResponseEntity
.
status
(
20000
).
body
(
new
ResultObj
(
"序列号为"
+
deviceLibraryEntity
.
getSeqNumber
()+
"的装备所属列装不存在配用范围为省对下纵向的相同列装装备"
)));
//判断changeMap是否存在该列装的转换信息
if
(
changeMap
.
get
(
deviceLibraryEntity
.
getPackingId
())!=
null
){
//改变装备所属列装以及配用范围
deviceLibraryEntity
.
setPackingId
(
changeMap
.
get
(
deviceLibraryEntity
.
getPackingId
()));
deviceLibraryEntity
.
setMatchingRange
(
1
);
}
else
{
deviceLibraryEntity
.
setPackingId
(
packingLibrary1
.
getId
());
deviceLibraryEntity
.
setMatchingRange
(
1
);
//判断是否存在省以下纵向的相同列装装备
PackingLibrary
packingLibrary
=
packingLibraryService
.
getOne
(
deviceLibraryEntity
.
getPackingId
());
PackingLibrary
packingLibrary1
=
packingLibraryService
.
findSamePacking
(
packingLibrary
.
getPartParentId
(),
1
,
packingLibrary
.
getType
(),
packingLibrary
.
getStyle
(),
packingLibrary
.
getName
(),
packingLibrary
.
getSecretLevel
(),
packingLibrary
.
getInvisibleRange
());
//不存在直接抛出异常
if
(
packingLibrary1
==
null
)
{
throw
new
ApiException
(
ResponseEntity
.
status
(
20000
).
body
(
new
ResultObj
(
"序列号为"
+
deviceLibraryEntity
.
getSeqNumber
()
+
"的装备所属列装不存在配用范围为省对下纵向的相同列装装备"
)));
}
//存在的话改变装备所属列装以及配用范围
else
{
changeMap
.
put
(
deviceLibraryEntity
.
getPackingId
(),
packingLibrary1
.
getId
());
deviceLibraryEntity
.
setPackingId
(
packingLibrary1
.
getId
());
deviceLibraryEntity
.
setMatchingRange
(
1
);
}
}
// deviceLibraryEntity.setAllotType(2);
//存装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
id
,
"纵向配发将所属列装由"
+
deviceLibraryEntity
.
getMatchingRangeName
()
+
"的列装改为"
+
configCache
.
getMatchingRangeMap
().
get
(
1
)+
"的列装"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
}
//改变装备生命状态为配发
deviceLibraryEntity
.
setLifeStatus
(
3
);
//改变装备管理状态为不在本单位
deviceLibraryEntity
.
setManageStatus
(
0
);
}
//横向配发
else
{
if
(
deviceLibraryEntity
.
getMatchingRange
()!=
3
){
//如果当前装备的配用范围不是省以下横向
if
(
deviceLibraryEntity
.
getMatchingRange
()!=
3
)
{
//判断changeMap是否存在该列装的转换信息
if
(
changeMap
.
get
(
deviceLibraryEntity
.
getPackingId
())!=
null
){
//改变装备所属列装以及配用范围
deviceLibraryEntity
.
setPackingId
(
changeMap
.
get
(
deviceLibraryEntity
.
getPackingId
()));
deviceLibraryEntity
.
setMatchingRange
(
3
);
}
else
{
//判断是否存在省以下横向的相同列装装备
PackingLibrary
packingLibrary
=
packingLibraryService
.
getOne
(
deviceLibraryEntity
.
getPackingId
());
PackingLibrary
packingLibrary1
=
packingLibraryService
.
findSamePacking
(
packingLibrary
.
getPartParentId
(),
3
,
packingLibrary
.
getType
(),
packingLibrary
.
getStyle
(),
packingLibrary
.
getName
(),
packingLibrary
.
getSecretLevel
(),
packingLibrary
.
getInvisibleRange
());
PackingLibrary
packingLibrary1
=
packingLibraryService
.
findSamePacking
(
packingLibrary
.
getPartParentId
(),
3
,
packingLibrary
.
getType
(),
packingLibrary
.
getStyle
(),
packingLibrary
.
getName
(),
packingLibrary
.
getSecretLevel
(),
packingLibrary
.
getInvisibleRange
());
//不存在直接抛出异常
if
(
packingLibrary1
==
null
)
{
throw
new
ApiException
(
ResponseEntity
.
status
(
20000
).
body
(
new
ResultObj
(
"序列号为"
+
deviceLibraryEntity
.
getSeqNumber
()
+
"的装备所属列装不存在配用范围为省对下横向的相同列装装备"
)));
}
//存在的话改变装备所属列装以及配用范围
else
{
changeMap
.
put
(
deviceLibraryEntity
.
getPackingId
(),
packingLibrary1
.
getId
());
changeMap
.
put
(
packingLibrary1
.
getId
(),
deviceLibraryEntity
.
getPackingId
());
changeMap
.
put
(
deviceLibraryEntity
.
getPackingId
(),
packingLibrary1
.
getId
());
deviceLibraryEntity
.
setPackingId
(
packingLibrary1
.
getId
());
deviceLibraryEntity
.
setMatchingRange
(
3
);
}
}
// deviceLibraryEntity.setAllotType(1);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
id
,
"横向配发将所属列装由"
+
deviceLibraryEntity
.
getMatchingRangeName
()
+
"的列装改为"
+
configCache
.
getMatchingRangeMap
().
get
(
3
)+
"的列装"
,
fileVoList
);
//存装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
id
,
"横向配发将所属列装由"
+
deviceLibraryEntity
.
getMatchingRangeName
()
+
"的列装改为"
+
configCache
.
getMatchingRangeMap
().
get
(
3
)
+
"的列装"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
}
//横向直接改变装备所属所在
deviceLibraryEntity
.
setLocationUnit
(
allotBillSaveVo
.
getReceiveUnit
());
deviceLibraryEntity
.
setOwnUnit
(
allotBillSaveVo
.
getReceiveUnit
());
}
deviceLibraryService
.
update
(
deviceLibraryEntity
);
//存装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
id
,
"对"
+
allotBillEntity
.
getReceiveUnit
()
+
"发起配发"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
}
...
...
@@ -282,21 +321,25 @@ public class AllotBillController {
inputOutputDeviceService
.
addWhiteDevices
(
ids
,
userUtils
.
getCurrentUnitId
(),
1
);
//发送阅知信息
List
<
Integer
>
idList
=
userPublicService
.
findOtherUser
(
userId
);
//纵向配发阅知要发给收件单位的人
if
(
allotBillSaveVo
.
getAllotType
()==
1
)
{
idList
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
allotBillEntity
.
getReceiveUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
}
//给被选签发人推阅知
if
(
allotBillSaveVo
.
getSendUserbId
()!=
null
)
{
List
<
Integer
>
idList1
=
new
ArrayList
<>();
idList1
.
add
(
allotBillSaveVo
.
getSendUserbId
());
MessageBto
messageBto
=
new
MessageBto
(
saveEntity
.
getId
(),
saveEntity
.
getBusinessType
(),
"被选为签发人"
,
idList1
,
1
);
messageService
.
add
(
messageBto
);
}
//给同单位专管员和收件单位专管员推阅知
MessageBto
messageBto
=
new
MessageBto
(
saveEntity
.
getId
(),
saveEntity
.
getBusinessType
(),
"对"
+
userPublicService
.
getAreaNameByUnitName
(
allotBillEntity
.
getReceiveUnit
())
+
"发起配发"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
log
.
info
(
"[配发模块]:"
+
allotBillEntity
.
getSendUnit
()
+
"对"
+
allotBillEntity
.
getReceiveUnit
()
+
"发起配发"
);
myWebSocket
.
sendMessage1
();
//set配发单四个人中文名
allotBill
.
setSenderUserA
(
userService
.
getOne
(
allotBill
.
getSendUseraId
()).
getName
());
allotBill
.
setSenderUserB
(
allotBill
.
getAgent
());
if
(
allotBill
.
getReceiveUseraId
()
!=
null
)
{
...
...
@@ -305,132 +348,68 @@ public class AllotBillController {
if
(
allotBill
.
getReceiveUserbId
()
!=
null
)
{
allotBill
.
setReceiveUserB
(
userService
.
getOne
(
allotBill
.
getReceiveUserbId
()).
getName
());
}
//set单据集合
allotBill
.
setSendFileList
(
FilesUtil
.
stringFileToList
(
allotBill
.
getSendFiles
()));
allotBill
.
setReplyFileList
(
FilesUtil
.
stringFileToList
(
allotBill
.
getReplyFiles
()));
//输出配发单给前端
return
ResponseEntity
.
ok
(
new
ResultObj
(
allotBill
,
"发起成功"
));
}
@ApiOperation
(
value
=
"配发审核"
,
notes
=
"可以通过这个接口对配发审核"
)
@PostMapping
(
value
=
"/allotConfirm"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
allotConfirm
(
@RequestBody
@Validated
AllotBillConfirmVo
allotBillConfirmVo
)
{
TaskBto
taskBto
=
taskService
.
get
(
allotBillConfirmVo
.
getTaskId
());
//1.审核通过,改变装备状态,审核任务完成,发起新的配发接收任务
if
(
allotBillConfirmVo
.
getStatus
()
==
0
)
{
//更新账单状态
AllotBill
allotBillEntity
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
allotBillEntity
.
setAllotStatus
(
2
);
allotBillEntity
.
setSendTime
(
TimestampUtil
.
getCurrentTimestamp
());
allotBillService
.
update
(
allotBillEntity
);
//task推至下一阶段
TaskBto
taskBto1
=
taskService
.
moveToNext
(
taskBto
,
allotBillEntity
.
getReceiveUseraId
());
taskBto1
.
setOwnUnit
(
userPublicService
.
findUnitIdByName
(
allotBillEntity
.
getReceiveUnit
()));
taskService
.
update
(
taskBto1
);
//获取装备信息
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
);
deviceLibraryEntity
.
setManageStatus
(
0
);
//存装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
id
,
"审核成功并出库"
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
//添加出库白名单
inputOutputDeviceService
.
addWhiteDevices
(
ids
,
userUtils
.
getCurrentUnitId
(),
1
);
log
.
info
(
"[配发模块]:配发审核成功并出库"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"审核成功"
);
}
//2.审核失败
if
(
allotBillConfirmVo
.
getStatus
()
==
1
)
{
//业务封存
taskService
.
update
(
taskService
.
moveToArchive
(
taskBto
));
//更新账单状态
AllotBill
allotBillEntity
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
allotBillEntity
.
setAllotStatus
(
1
);
allotBillService
.
update
(
allotBillEntity
);
String
deviceIdDetail
=
allotBillEntity
.
getAllotCheckDetail
();
String
[]
strings
=
deviceIdDetail
.
split
(
"x"
);
//添加装备日志
for
(
String
s
:
strings
)
{
if
(
s
.
length
()
>=
2
)
{
Integer
id
=
Integer
.
parseInt
(
s
.
substring
(
0
,
s
.
length
()
-
1
));
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
id
,
"配发出库审核失败"
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
}
}
log
.
info
(
"[配发模块]:配发出库审核失败"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"配发审核失败"
);
}
else
{
return
ResponseEntity
.
ok
(
"status只能为0或1"
);
}
}
@ApiOperation
(
value
=
"接收配发装备"
,
notes
=
"可以通过这个接口接收配发装备"
)
@PostMapping
(
value
=
"/receiveDevice"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
receiveDevice
(
@RequestBody
@Validated
AllotReceiveVo
allotReceiveVo
)
{
//当前操作人id
Integer
userId
=
userUtils
.
getCurrentUserId
();
//获取当前任务
TaskBto
taskBto
=
taskService
.
get
(
allotReceiveVo
.
getTaskId
());
//判断当前任务状态是否已经被操作
List
<
StatusEnum
>
statusEnums
=
Arrays
.
asList
(
StatusEnum
.
ALLOTING
,
StatusEnum
.
WAIT_SIGN
);
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
statusEnums
);
//配发单
AllotBill
allotBillEntity
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
//签发人是否上传
boolean
sendbIsExist
=
allotBillEntity
.
getSendUserbId
()!=
null
;
//上传文件存储集合
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
// if (allotReceiveVo.getBillFileName()!=null&&allotReceiveVo.getBillFileUrl()!=null) {
// fileVoList.add(new FileVo("配发单", allotReceiveVo.getBillFileName(), allotReceiveVo.getBillFileUrl()));
// }
if
(
allotReceiveVo
.
getReceiveFileList
()!=
null
&&
allotReceiveVo
.
getReceiveFileList
().
size
()>
0
){
allotReceiveVo
.
getReceiveFileList
().
forEach
(
fileRet
->
{
fileVoList
.
add
(
new
FileVo
(
"配发单"
,
fileRet
.
getName
(),
fileRet
.
getPreviewPath
()));
});
allotBillEntity
.
setReceiveFiles
(
FilesUtil
.
stringFileToList
(
allotReceiveVo
.
getReceiveFileList
()));
}
//是否上传了收件单位签章id
if
(
allotReceiveVo
.
getRightSignatureId
()!=
null
&&!
""
.
equals
(
allotReceiveVo
.
getRightSignatureId
()))
{
allotBillEntity
.
setRightSignatureId
(
allotReceiveVo
.
getRightSignatureId
());
}
// fileVoList.add(new FileVo("入库确认单", allotReceiveVo.getReceiveFileName(), allotReceiveVo.getReceiveFileUrl()));
//更新账单状态
//更新账单状态为配发完成
allotBillEntity
.
setAllotStatus
(
5
);
//复制非空相同字段
MapperUtils
.
copyNoNullProperties
(
allotReceiveVo
,
allotBillEntity
);
//set接收时间
allotBillEntity
.
setReceiveTime
(
TimestampUtil
.
getCurrentTimestamp
());
//如果收件方A岗未上传,默认为当前操作人
if
(
allotBillEntity
.
getReceiveUseraId
()==
null
)
{
allotBillEntity
.
setReceiveUseraId
(
userId
);
}
//判断是否上传发件方签发人
if
(
allotReceiveVo
.
getSendUserbId
()!=
null
){
allotBillEntity
.
setSendUserbId
(
allotReceiveVo
.
getSendUserbId
());
allotBillEntity
.
setAgent
(
userPublicService
.
getOne
(
allotReceiveVo
.
getSendUserbId
()).
getName
());
}
allotBillEntity
.
setBillFileName
(
allotReceiveVo
.
getBillFileName
());
allotBillEntity
.
setBillFileUrl
(
allotReceiveVo
.
getBillFileUrl
());
allotBillService
.
update
(
allotBillEntity
);
//添加当前用户为涉及人员
taskService
.
addInvolveUser
(
taskBto
,
userId
);
// //推至下一阶段
// taskService.update(taskService.moveToNext(taskBto, allotReceiveVo.getReceiveUserbId()));
//如果上传了单据或双方都盖章,该业务和子业务都办结
if
(
allotReceiveVo
.
getStatus
()==
0
)
{
taskService
.
moveToEnd
(
taskBto
);
//子任务完结
taskService
.
moveAllSonNodeToEnd
(
taskBto
.
getId
());
}
else
{
//推至待上传签收单的状态
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
WAIT_UPLOAD_ALLOT_RECEIVE_FILE
,
0
);
}
//生成上级上传单据任务
// List<Integer> userIds = new ArrayList();
// userIds.add(0);
// TaskBto taskBto2 = new TaskBto(StatusEnum.WAIT_UPLOAD_ALLOT_FILE.id, "配发单据", taskBto.getId(), taskBto.getNodeIdDetail()+taskBto.getId()+".", taskBto.getBillId(), 3, userPublicService.findUnitIdByName(allotBillEntity.getSendUnit()), 0, null, userIds);
// taskService.start(taskBto);
//分隔装备id信息
String
deviceIdDetail
=
allotReceiveVo
.
getReceiveCheckDetail
();
String
[]
strings
=
deviceIdDetail
.
split
(
"x"
);
...
...
@@ -438,15 +417,15 @@ public class AllotBillController {
if
(
s
.
length
()
>=
2
)
{
//接收无误
if
(
"1"
.
equals
(
s
.
substring
(
s
.
length
()
-
1
)))
{
//装备id
Integer
id
=
Integer
.
parseInt
(
s
.
substring
(
0
,
s
.
length
()
-
1
));
//改变装备状态
//改变装备状态
、所属所在
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
// deviceLibraryEntity.setLifeStatus(0);
deviceLibraryEntity
.
setLocationUnit
(
userUtils
.
getCurrentUserUnitName
());
deviceLibraryEntity
.
setLifeStatus
(
2
);
deviceLibraryEntity
.
setOwnUnit
(
userUtils
.
getCurrentUserUnitName
());
deviceLibraryEntity
.
setManageStatus
(
1
);
//生产号
//
如果接收时填写了
生产号
if
(
allotReceiveVo
.
getMap
().
get
(
id
)!=
null
){
deviceLibraryEntity
.
setProdNumber
(
allotReceiveVo
.
getMap
().
get
(
id
));
}
...
...
@@ -473,18 +452,21 @@ public class AllotBillController {
ids
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
allotBillEntity
.
getSendUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
//经办人阅知
if
(
allotReceiveVo
.
getReceiveUserbId
()!=
null
)
{
List
<
Integer
>
idList1
=
new
ArrayList
<>();
idList1
.
add
(
allotReceiveVo
.
getReceiveUserbId
());
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
idList1
,
1
);
messageService
.
add
(
messageBto
);
}
//签发人阅知
if
(
allotReceiveVo
.
getSendUserbId
()!=
null
&&
sendbIsExist
)
{
List
<
Integer
>
idList1
=
new
ArrayList
<>();
idList1
.
add
(
allotReceiveVo
.
getSendUserbId
());
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
idList1
,
1
);
messageService
.
add
(
messageBto
);
}
//根据status判断是否业务完结,发送不同的阅知message
String
message
=
allotReceiveVo
.
getStatus
()==
0
?
"业务办结"
:
"接收配发装备"
;
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
message
,
ids
,
1
);
messageService
.
add
(
messageBto
);
...
...
@@ -492,128 +474,32 @@ public class AllotBillController {
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"配发接收入库"
);
}
@ApiOperation
(
value
=
"接收配发装备审核"
,
notes
=
"可以通过这个接口对接收配发装备审核"
)
@PostMapping
(
value
=
"/receiveConfirm"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
receiveConfirm
(
@RequestBody
@Validated
AllotReceiveConfirmVo
allotReceiveConfirmVo
)
{
//获取任务和账单
TaskBto
taskBto
=
taskService
.
get
(
allotReceiveConfirmVo
.
getTaskId
());
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
StatusEnum
.
ALLOTING
);
AllotBill
allotBillEntity
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
String
deviceIdDetail
=
allotBillEntity
.
getAllotCheckDetail
();
String
[]
strings
=
deviceIdDetail
.
split
(
"x"
);
//审核通过
// if (allotReceiveConfirmVo.getStatus() == 0) {
// //业务完结
// taskService.update(taskService.moveToEnd(taskBto));
// //更新账单
// allotBillEntity.setAllotStatus(5);
// allotBillService.update(allotBillEntity);
// 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));
// DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
// deviceLibraryEntity.setLifeStatus(2);
// deviceLibraryEntity.setOwnUnit(userUtils.getCurrentUserUnitName());
// deviceLibraryEntity.setManageStatus(1);
// DeviceLogDto deviceLogDto = new DeviceLogDto(id, "审核成功并入库", null);
// deviceLogService.addLog(deviceLogDto);
// deviceLibraryService.update(deviceLibraryEntity);
// }
// }
// log.info("[配发模块]:审核成功并入库");
// myWebSocket.sendMessage1();
// return ResponseEntity.ok("审核成功");
// }
//拒绝接收
if
(
allotReceiveConfirmVo
.
getStatus
()
==
1
)
{
taskService
.
addInvolveUser
(
taskBto
,
userUtils
.
getCurrentUserId
());
//业务封存
taskService
.
moveToEnd
(
taskBto
);
//更新账单状态
AllotBill
allotBillEntity2
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
allotBillEntity2
.
setAllotStatus
(
4
);
allotBillService
.
update
(
allotBillEntity2
);
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
));
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
deviceLibraryEntity
.
setLifeStatus
(
3
);
deviceLibraryEntity
.
setLocationUnit
(
userUtils
.
getCurrentUserUnitName
());
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
id
,
"拒绝接收配发装备"
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
//发送阅知信息
List
<
Integer
>
ids
=
userPublicService
.
findOtherUser
(
userUtils
.
getCurrentUserId
());
ids
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
allotBillEntity
.
getSendUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"拒绝接收配发装备"
,
ids
);
messageService
.
add
(
messageBto
);
//生成配发退回单
AllotBackBill
allotBackBill
=
new
AllotBackBill
();
allotBackBill
.
setAllotBillId
(
taskBto
.
getBillId
());
allotBackBill
.
setSendUseraId
(
userUtils
.
getCurrentUserId
());
allotBackBill
.
setSendUnit
(
userUtils
.
getCurrentUserUnitName
());
allotBackBill
.
setReceiveUnit
(
allotBillEntity
.
getSendUnit
());
allotBackBill
.
setBackCheckDetail
(
allotBillEntity
.
getAllotCheckDetail
());
AllotBackBill
allotBackBill1
=
allotBackBillService
.
addEntity
(
allotBackBill
);
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
allotBackBill1
.
getCreateTime
());
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
String
num
=
"NO:第"
+
year
+
"TH"
+
allotBackBill1
.
getId
()
+
"号"
;
allotBackBill1
.
setNum
(
num
);
allotBackBillService
.
update
(
allotBackBill1
);
//生成配发退回子业务
List
<
Integer
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
userUtils
.
getCurrentUserId
());
userIds
.
add
(
0
);
TaskBto
taskBto1
=
new
TaskBto
(
StatusEnum
.
ALLOT_BACKING
.
id
,
"配发退回业务"
,
taskBto
.
getId
(),
taskBto
.
getNodeIdDetail
()
+
taskBto
.
getId
()
+
"."
,
allotBackBill1
.
getId
(),
BusinessEnum
.
ALLOT_BACK
.
id
,
userPublicService
.
findUnitIdByName
(
allotBillEntity
.
getSendUnit
()),
1
,
null
,
userIds
);
TaskBto
task
=
taskService
.
start
(
taskBto1
);
log
.
info
(
"[配发模块]:配发入库审核失败"
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
task
);
}
else
{
return
ResponseEntity
.
ok
(
"status只能为0或1"
);
}
}
@ApiOperation
(
value
=
"保存配发操作"
,
notes
=
"可以通过这个接口保存配发操作"
)
@ApiOperation
(
value
=
"保存配发操作(草稿)"
,
notes
=
"可以通过这个接口保存配发操作"
)
@PostMapping
(
value
=
"/saveAllotBill"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
saveAllotBill
(
@RequestBody
AllotBillSaveVo
allotBillSaveVo
)
{
//判断装备的生命状态是否能配发
if
(
allotBillSaveVo
.
getAllotCheckDetail
()!=
null
&&
allotBillSaveVo
.
getAllotCheckDetail
().
length
()>
0
)
{
deviceLibraryService
.
isInStockOrWaitRetired
(
StringSplitUtil
.
split
(
allotBillSaveVo
.
getAllotCheckDetail
()));
}
//第一次保存
//第一次保存
(没有taskId)
if
(
allotBillSaveVo
.
getTaskId
()==
null
){
Integer
userId
=
userUtils
.
getCurrentUserId
();
//保存入库单
List
<
Integer
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
userId
);
//转Do
AllotBill
allotBill1
=
allotBillSaveVo
.
toDo
();
//状态设为草稿
allotBill1
.
setAllotStatus
(
0
);
//发件A岗设为当前操作人
allotBill1
.
setSendUseraId
(
userId
);
AllotBill
allotBill
=
allotBillService
.
addEntity
(
allotBill1
);
//发起任务
//发起
草稿
任务
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
ALLOT_DRAFT
.
id
,
"配发业务"
,
null
,
"."
,
allotBill
.
getId
(),
3
,
userUtils
.
getCurrentUnitId
(),
0
,
null
,
userIds
);
TaskBto
taskBto1
=
taskService
.
start
(
taskBto
);
//改变装备状态为待配发
// if (allotBillSaveVo.getAllotCheckDetail()!=null){
// Map<Integer,DeviceLibrary> map = deviceLibraryService.getAllDeviceMap();
// StringSplitUtil.split(allotBillSaveVo.getAllotCheckDetail()).forEach(integer -> {
// if (map.get(integer)!=null){
// DeviceLibrary deviceLibrary = map.get(integer);
// deviceLibrary.setLifeStatus(21);
// deviceLibraryService.update(deviceLibrary);
// }
// });
// }
//返回保存成功的id
Integer
id
=
taskBto1
.
getId
();
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"保存成功"
+
id
);
...
...
@@ -623,10 +509,10 @@ public class AllotBillController {
TaskBto
taskBto
=
taskService
.
get
(
allotBillSaveVo
.
getTaskId
());
AllotBill
allotBill
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
AllotBill
allotBill1
=
allotBillSaveVo
.
toDo
();
//状态设为草稿
allotBill1
.
setAllotStatus
(
0
);
MapperUtils
.
copyNoNullProperties
(
allotBill1
,
allotBill
);
allotBillService
.
update
(
allotBill
);
//改变装备状态为待配发
return
ResponseEntity
.
ok
(
"更新成功"
+
taskBto
.
getId
());
}
}
...
...
@@ -639,18 +525,6 @@ public class AllotBillController {
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
TaskBto
taskBto1
=
taskService
.
addInvolveUser
(
taskBto
,
userUtils
.
getCurrentUserId
());
taskService
.
moveToArchive
(
taskBto1
);
//更改装备状态为在库
// AllotBill allotBill = allotBillService.getOne(taskBto1.getBillId());
// if (allotBill.getAllotCheckDetail()!=null){
// Map<Integer,DeviceLibrary> map = deviceLibraryService.getAllDeviceMap();
// StringSplitUtil.split(allotBill.getAllotCheckDetail()).forEach(integer -> {
// if (map.get(integer)!=null){
// DeviceLibrary deviceLibrary = map.get(integer);
// deviceLibrary.setLifeStatus(2);
// deviceLibraryService.update(deviceLibrary);
// }
// });
// }
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"删除成功"
);
}
...
...
@@ -659,13 +533,16 @@ public class AllotBillController {
@PostMapping
(
value
=
"/applySign/{taskId}/{userId}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
applySign
(
@PathVariable
(
"taskId"
)
int
taskId
,
@PathVariable
(
"userId"
)
int
userId
)
{
//
推动任务
//
获取任务和账单
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
AllotBill
allotBill
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
//如果是收件方申请电子签章
if
(
allotBill
.
getAllotStatus
()!=
0
){
//当前用户设为接收A岗
allotBill
.
setReceiveUseraId
(
userUtils
.
getCurrentUserId
());
allotBillService
.
update
(
allotBill
);
}
//推动任务到盖章待审核状态
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
SIGN_WAIT_CONFIRM
,
userId
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"申请成功"
);
...
...
@@ -675,24 +552,32 @@ public class AllotBillController {
@PostMapping
(
value
=
"/applySignConfirm/{taskId}/{status}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
applySignConfirm
(
@PathVariable
(
"taskId"
)
int
taskId
,
@PathVariable
(
"status"
)
int
status
)
{
//
推动任务
//
获取任务和单据
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
AllotBill
allotBill
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
//如果同意
if
(
status
==
1
){
//推动任务到等待盖章状态
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
WAIT_SIGN
);
//发件方盖章
if
(
allotBill
.
getAllotStatus
()==
0
)
{
//当前用户设为签发人
allotBill
.
setSendUserbId
(
userUtils
.
getCurrentUserId
());
allotBill
.
setAgent
(
userUtils
.
getCurrentName
());
}
//收件方盖章
else
{
//当前用户设为接收方B岗
allotBill
.
setReceiveUserbId
(
userUtils
.
getCurrentUserId
());
}
allotBillService
.
update
(
allotBill
);
}
else
{
//发件方盖章不同意任务返回草稿状态
if
(
allotBill
.
getAllotStatus
()==
0
)
{
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
ALLOT_DRAFT
,
taskBto
.
getCreateUserId
());
}
//收件方返回到待入库状态
else
{
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
ALLOTING
,
allotBill
.
getReceiveUseraId
());
}
...
...
@@ -705,8 +590,10 @@ public class AllotBillController {
@PostMapping
(
value
=
"/selectAllotDetail/{taskId}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
selectAllotDetail
(
@PathVariable
(
"taskId"
)
int
taskId
)
{
//获取业务和账单
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
AllotBill
allotBillEntity
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
//将用户id转为名字
if
(
allotBillEntity
.
getSendUseraId
()
!=
null
)
{
allotBillEntity
.
setSenderUserA
(
userPublicService
.
getOne
(
allotBillEntity
.
getSendUseraId
()).
getName
());
}
...
...
@@ -719,14 +606,17 @@ public class AllotBillController {
if
(
allotBillEntity
.
getReceiveUserbId
()
!=
null
)
{
allotBillEntity
.
setReceiveUserB
(
userPublicService
.
getOne
(
allotBillEntity
.
getReceiveUserbId
()).
getName
());
}
//分隔装备id得到装备信息
if
(
allotBillEntity
.
getAllotCheckDetail
()!=
null
){
List
<
Integer
>
ids
=
StringSplitUtil
.
split
(
allotBillEntity
.
getAllotCheckDetail
());
List
<
DeviceLibrary
>
deviceLibraryList
=
new
ArrayList
<>();
ids
.
forEach
(
integer
->
deviceLibraryList
.
add
(
deviceLibraryService
.
getOne
(
integer
)));
allotBillEntity
.
setDeviceLibraries
(
deviceLibraryList
);
}
//设置申请和批复文件列表
allotBillEntity
.
setReplyFileList
(
FilesUtil
.
stringFileToList
(
allotBillEntity
.
getReplyFiles
()));
allotBillEntity
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
allotBillEntity
.
getApplyFiles
()));
//返回前端单据json详情
if
(
allotBillEntity
.
getScriptJson
()!=
null
){
allotBillEntity
.
setScripts
(
JacksonUtil
.
readValue
(
allotBillEntity
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{}));
}
...
...
@@ -738,23 +628,26 @@ public class AllotBillController {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
uploadAllotBill
(
@RequestBody
@Validated
FileUploadVo
fileUploadVo
){
TaskBto
taskBto
=
taskService
.
get
(
fileUploadVo
.
getTaskId
());
//判断业务状态是否被操作
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
StatusEnum
.
WAIT_UPLOAD_ALLOT_RECEIVE_FILE
);
Integer
userId
=
userUtils
.
getCurrentUserId
();
taskService
.
addInvolveUser
(
taskBto
,
userId
);
//业务和子业务办结
taskService
.
moveToEnd
(
taskBto
);
taskService
.
moveAllSonNodeToEnd
(
taskBto
.
getId
());
AllotBill
allotBill
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
allotBill
.
setBillFileName
(
fileUploadVo
.
getBillFileName
());
allotBill
.
setBillFileUrl
(
fileUploadVo
.
getBillFileUrl
());
//是否上传发件方签发人
if
(
fileUploadVo
.
getSendUserbId
()!=
null
){
allotBill
.
setSendUserbId
(
fileUploadVo
.
getSendUserbId
());
allotBill
.
setAgent
(
userPublicService
.
getOne
(
fileUploadVo
.
getSendUserbId
()).
getName
());
}
//是否上传接收方B岗
if
(
fileUploadVo
.
getReceiveUserbId
()!=
null
){
allotBill
.
setReceiveUserbId
(
fileUploadVo
.
getReceiveUserbId
());
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
Collections
.
singletonList
(
fileUploadVo
.
getReceiveUserbId
()),
1
);
messageService
.
add
(
messageBto
);
}
//文件列表
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
if
(
fileUploadVo
.
getReceiveFileList
()!=
null
&&
fileUploadVo
.
getReceiveFileList
().
size
()>
0
){
fileUploadVo
.
getReceiveFileList
().
forEach
(
fileRet
->
{
...
...
@@ -762,7 +655,6 @@ public class AllotBillController {
});
allotBill
.
setReceiveFiles
(
FilesUtil
.
stringFileToList
(
fileUploadVo
.
getReceiveFileList
()));
}
// fileVoList.add(new FileVo("配发单", allotBill.getBillFileName(), allotBill.getBillFileUrl()));
allotBillService
.
update
(
allotBill
);
//添加装备日志
List
<
Integer
>
deviceIds
=
StringSplitUtil
.
split
(
allotBill
.
getAllotCheckDetail
());
...
...
@@ -771,6 +663,7 @@ public class AllotBillController {
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
integer
,
"上传配发单据"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
});
//签发人阅知
if
(
fileUploadVo
.
getSendUserbId
()!=
null
)
{
List
<
Integer
>
idList1
=
new
ArrayList
<>();
idList1
.
add
(
fileUploadVo
.
getSendUserbId
());
...
...
@@ -794,11 +687,14 @@ public class AllotBillController {
//获取task
TaskBto
taskBto
=
taskService
.
get
(
fileVo
.
getTaskId
());
taskService
.
addInvolveUser
(
taskBto
,
userUtils
.
getCurrentUserId
());
//判断业务状态是否被操作
List
<
StatusEnum
>
statusEnums
=
new
ArrayList
<>();
statusEnums
.
add
(
StatusEnum
.
WAIT_UPLOAD_CROSS_FILE
);
statusEnums
.
add
(
StatusEnum
.
WAIT_UPLOAD_ALLOT_FILE
);
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
statusEnums
);
//获取账单
AllotBill
allotBill
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
//存放接收方经办人id
List
<
Integer
>
idList
=
new
ArrayList
<>();
if
(
fileVo
.
getReceiveUseraId
()!=
null
)
{
allotBill
.
setReceiveUseraId
(
fileVo
.
getReceiveUseraId
());
...
...
@@ -808,6 +704,7 @@ public class AllotBillController {
allotBill
.
setReceiveUserbId
(
fileVo
.
getReceiveUserbId
());
idList
.
add
(
fileVo
.
getReceiveUserbId
());
}
//签发人阅知
if
(
fileVo
.
getSendUserbId
()!=
null
){
allotBill
.
setSendUserbId
(
fileVo
.
getSendUserbId
());
allotBill
.
setAgent
(
userPublicService
.
getOne
(
fileVo
.
getSendUserbId
()).
getName
());
...
...
@@ -817,10 +714,14 @@ public class AllotBillController {
messageService
.
add
(
messageBto
);
}
//保存账单
//回执单
allotBill
.
setSendFiles
(
FilesUtil
.
stringFileToList
(
fileVo
.
getAllotFiles
()));
//状态配发完成
allotBill
.
setAllotStatus
(
5
);
//接收时间
allotBill
.
setReceiveTime
(
TimestampUtil
.
getCurrentTimestamp
());
allotBillService
.
update
(
allotBill
);
//装备Id集合
List
<
Integer
>
ids
=
StringSplitUtil
.
split
(
allotBill
.
getAllotCheckDetail
());
//业务完结
taskService
.
moveToEnd
(
taskBto
);
...
...
@@ -828,7 +729,7 @@ public class AllotBillController {
if
(
taskBto
.
getParentTaskId
()!=
null
)
{
taskService
.
moveToEnd
(
taskService
.
get
(
taskBto
.
getParentTaskId
()));
}
//
装备日志
//
添加装备日志,改变装备状态
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
fileVo
.
getAllotFiles
().
forEach
(
fileRet
->
fileVoList
.
add
(
new
FileVo
(
"配发单"
,
fileRet
.
getName
(),
fileRet
.
getPreviewPath
())));
ids
.
forEach
(
integer
->
{
...
...
@@ -841,6 +742,7 @@ public class AllotBillController {
deviceLibrary
.
setManageStatus
(
1
);
deviceLibraryService
.
update
(
deviceLibrary
);
});
//经办人阅知
if
(
idList
.
size
()>
0
)
{
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
...
...
@@ -858,11 +760,14 @@ public class AllotBillController {
@ApiOperation
(
value
=
"上传发送方签发人"
,
notes
=
"上传发送方签发人"
)
@PostMapping
(
value
=
"/updateAgent"
)
public
ResponseEntity
updateAgent
(
@RequestBody
AgentVo
agentVo
){
//获取业务
TaskBto
taskBto
=
taskService
.
get
(
agentVo
.
getId
());
List
<
Integer
>
idList
=
new
ArrayList
<>();
idList
.
add
(
agentVo
.
getSendUserbId
());
//签发人阅知
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
//账单保存签发人
AllotBill
allotBill
=
allotBillService
.
getOne
(
taskBto
.
getBillId
());
allotBill
.
setAgent
(
agentVo
.
getName
());
allotBill
.
setSendUserbId
(
agentVo
.
getSendUserbId
());
...
...
dev-allot/src/main/java/com/tykj/dev/device/allot/controller/BackController.java
浏览文件 @
b0ff8938
...
...
@@ -87,21 +87,26 @@ public class BackController {
@PostMapping
(
value
=
"/addBackBill"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
addBackBill
(
@RequestBody
@Validated
AllotBillSaveVo
allotBillSaveVo
)
{
//判断发起退回的装备的生命状态
if
(
allotBillSaveVo
.
getAllotCheckDetail
()!=
null
&&
allotBillSaveVo
.
getAllotCheckDetail
().
length
()>
0
)
{
deviceLibraryService
.
isInStockOrWaitRetired
(
StringSplitUtil
.
split
(
allotBillSaveVo
.
getAllotCheckDetail
()));
}
//1.添加
配发
单
//1.添加
退回
单
AllotBackBill
a
=
allotBillSaveVo
.
toBackDo
();
if
(
allotBillSaveVo
.
getTaskId
()==
null
)
{
a
.
setSendUseraId
(
userUtils
.
getCurrentUserId
());
}
//保存后的实体
AllotBackBill
allotBackBill
;
//如果是直接发起(不是草稿,没有taskId),当前操作人为发件方A岗,添加账单
if
(
allotBillSaveVo
.
getTaskId
()==
null
){
a
.
setSendUseraId
(
userUtils
.
getCurrentUserId
());
allotBackBill
=
allotBackBillService
.
addEntity
(
a
);
}
//从草稿发起
else
{
//获取草稿账单
allotBackBill
=
allotBackBillService
.
getOne
(
taskService
.
get
(
allotBillSaveVo
.
getTaskId
()).
getBillId
());
//copy非null相同字段值
MapperUtils
.
copyNoNullProperties
(
a
,
allotBackBill
);
//判断是否取消上传申请单和批复单据
if
(
a
.
getApplyFiles
()==
null
||
""
.
equals
(
a
.
getApplyFiles
())){
allotBackBill
.
setApplyFiles
(
null
);
}
...
...
@@ -110,14 +115,15 @@ public class BackController {
}
allotBackBill
=
allotBackBillService
.
update
(
allotBackBill
);
}
//按照当前时间和保存账单的id拼接生成退回单号并保存
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
());
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
String
num
=
"NO:第"
+
year
+
"TH"
+
allotBackBill
.
getId
()
+
"号"
;
allotBackBill
.
setNum
(
num
);
//生成电子签章id
// Long signId = snowflake.creatNextId();
//生成接收方电子签章id
Long
signId2
=
snowflake
.
creatNextId
();
//判断是否上传了发送方签章id
if
(
allotBillSaveVo
.
getLeftSignatureId
()!=
null
)
{
allotBackBill
.
setLeftSignatureId
(
allotBillSaveVo
.
getLeftSignatureId
());
}
...
...
@@ -127,26 +133,34 @@ public class BackController {
Integer
userId
=
userUtils
.
getCurrentUserId
();
String
deviceIdDetail
=
allotBackBill
.
getBackCheckDetail
();
//2.发起任务
//构建task涉及人员集合
List
<
Integer
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
userId
);
userIds
.
add
(
0
);
//保存后的taskBto
TaskBto
saveEntity
;
//直接发起
if
(
allotBillSaveVo
.
getTaskId
()==
null
)
{
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
ALLOT_BACKING
.
id
,
"退回业务"
,
null
,
"."
,
billId
,
22
,
userPublicService
.
findUnitIdByName
(
allotBillSaveVo
.
getReceiveUnit
()),
1
,
null
,
userIds
);
saveEntity
=
taskService
.
start
(
taskBto
);
}
//从草稿发起
else
{
TaskBto
taskBto
=
taskService
.
get
(
allotBillSaveVo
.
getTaskId
());
//添加当前操作人为涉及人员
TaskBto
taskBto1
=
taskService
.
addInvolveUser
(
taskBto
,
userId
);
//任务所属单位改为收件单位
taskBto1
.
setOwnUnit
(
userPublicService
.
findUnitIdByName
(
allotBillSaveVo
.
getReceiveUnit
()));
//推动任务到退回中状态
saveEntity
=
taskService
.
moveToSpecial
(
taskBto1
,
StatusEnum
.
ALLOT_BACKING
,
0
);
}
//生成发件方上传退回单的子任务
TaskBto
taskBto2
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_BACK_FILE_2
.
id
,
"退回业务"
,
saveEntity
.
getId
(),
saveEntity
.
getNodeIdDetail
()
+
saveEntity
.
getId
()
+
"."
,
saveEntity
.
getBillId
(),
22
,
userPublicService
.
findUnitIdByName
(
allotBackBill1
.
getSendUnit
()),
0
,
null
,
Collections
.
singletonList
(
0
));
taskService
.
start
(
taskBto2
);
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
// fileVoList.add(new FileVo("出库确认单", allotBillEntity.getFileName(), allotBillEntity.getFileUrl()));
//存装备日志
String
[]
strings
=
deviceIdDetail
.
split
(
"x"
);
//存放所有出库装备id
List
<
Integer
>
ids
=
new
ArrayList
<>();
for
(
String
s
:
strings
)
{
if
(
s
.
length
()
>=
2
)
{
...
...
@@ -157,6 +171,7 @@ public class BackController {
deviceLibraryEntity
.
setLifeStatus
(
3
);
deviceLibraryEntity
.
setManageStatus
(
0
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
//存装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
id
,
"对"
+
allotBackBill
.
getReceiveUnit
()
+
"发起退回"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
}
...
...
@@ -168,12 +183,14 @@ public class BackController {
idList
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
allotBackBill
.
getReceiveUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
//给被选签发人推阅知
if
(
allotBillSaveVo
.
getSendUserbId
()!=
null
)
{
List
<
Integer
>
idList1
=
new
ArrayList
<>();
idList1
.
add
(
allotBillSaveVo
.
getSendUserbId
());
MessageBto
messageBto
=
new
MessageBto
(
saveEntity
.
getId
(),
saveEntity
.
getBusinessType
(),
"被选为签发人"
,
idList1
,
1
);
messageService
.
add
(
messageBto
);
}
//给同单位专管员和收件单位专管员推阅知
MessageBto
messageBto
=
new
MessageBto
(
saveEntity
.
getId
(),
saveEntity
.
getBusinessType
(),
"对"
+
userPublicService
.
getAreaNameByUnitName
(
allotBackBill
.
getReceiveUnit
())
+
"发起退回"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
log
.
info
(
"[退回模块]:"
+
allotBackBill
.
getSendUnit
()
+
"对"
+
allotBackBill
.
getReceiveUnit
()
+
"发起退回"
);
...
...
@@ -185,12 +202,16 @@ public class BackController {
@PostMapping
(
value
=
"/receiveDevice"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
receiveDevice
(
@RequestBody
@Validated
AllotBackReceiveVo
allotBackReceiveVo
)
{
//当前操作人id
Integer
userId
=
userUtils
.
getCurrentUserId
();
//获取当前任务
TaskBto
taskBto
=
taskService
.
get
(
allotBackReceiveVo
.
getTaskId
());
//判断当前任务状态是否已经被操作
List
<
StatusEnum
>
statusEnums
=
Arrays
.
asList
(
StatusEnum
.
ALLOT_BACKING
,
StatusEnum
.
BACK_WAIT_SIGN
);
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
statusEnums
);
//退回单
AllotBackBill
allotBackBill
=
allotBackBillService
.
getOne
(
taskBto
.
getBillId
());
//上传文件存储集合
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
if
(
allotBackReceiveVo
.
getReceiveFileList
()!=
null
&&
allotBackReceiveVo
.
getReceiveFileList
().
size
()>
0
){
allotBackReceiveVo
.
getReceiveFileList
().
forEach
(
fileRet
->
{
...
...
@@ -198,31 +219,36 @@ public class BackController {
});
allotBackBill
.
setReceiveFiles
(
FilesUtil
.
stringFileToList
(
allotBackReceiveVo
.
getReceiveFileList
()));
}
// fileVoList.add(new FileVo("退回单", allotBackReceiveVo.getBillFileName(), allotBackReceiveVo.getBillFileUrl()));
// fileVoList.add(new FileVo("入库确认单", allotReceiveVo.getReceiveFileName(), allotReceiveVo.getReceiveFileUrl()));
//更新账单状态
//是否上传了收件单位签章id
if
(
allotBackReceiveVo
.
getRightSignatureId
()!=
null
&&!
""
.
equals
(
allotBackReceiveVo
.
getRightSignatureId
()))
{
allotBackBill
.
setRightSignatureId
(
allotBackReceiveVo
.
getRightSignatureId
());
}
//更新账单状态为退回完成
allotBackBill
.
setBackStatus
(
3
);
//复制非空相同字段
MapperUtils
.
copyNoNullProperties
(
allotBackReceiveVo
,
allotBackBill
);
//set接收时间
allotBackBill
.
setReceiveTime
(
TimestampUtil
.
getCurrentTimestamp
());
//如果收件方A岗未上传,默认为当前操作人
if
(
allotBackBill
.
getReceiveUseraId
()==
null
)
{
allotBackBill
.
setReceiveUseraId
(
userId
);
}
//判断是否上传发件方签发人
if
(
allotBackReceiveVo
.
getSendUserbId
()!=
null
){
allotBackBill
.
setSendUserbId
(
allotBackReceiveVo
.
getSendUserbId
());
allotBackBill
.
setAgent
(
userPublicService
.
getOne
(
allotBackReceiveVo
.
getSendUserbId
()).
getName
());
}
allotBackBillService
.
update
(
allotBackBill
);
//添加当前用户为涉及人员
taskService
.
addInvolveUser
(
taskBto
,
userId
);
// //推至下一阶段
// taskService.update(taskService.moveToNext(taskBto, allotReceiveVo.getReceiveUserbId()));
//如果上传了单据或双方都盖章,该业务和子业务都办结
if
(
allotBackReceiveVo
.
getStatus
()==
0
)
{
taskService
.
moveToEnd
(
taskBto
);
//子任务完结
taskService
.
moveAllSonNodeToEnd
(
taskBto
.
getId
());
}
else
{
//推至待上传签收单的状态
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
WAIT_UPLOAD_ALLOT_BACK_FILE
,
0
);
}
//分隔装备id信息
...
...
@@ -232,10 +258,10 @@ public class BackController {
if
(
s
.
length
()
>=
2
)
{
//接收无误
if
(
"1"
.
equals
(
s
.
substring
(
s
.
length
()
-
1
)))
{
//装备id
Integer
id
=
Integer
.
parseInt
(
s
.
substring
(
0
,
s
.
length
()
-
1
));
//改变装备状态
//改变装备状态
、所属所在
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
// deviceLibraryEntity.setLifeStatus(0);
deviceLibraryEntity
.
setLocationUnit
(
userUtils
.
getCurrentUserUnitName
());
deviceLibraryEntity
.
setLifeStatus
(
2
);
deviceLibraryEntity
.
setOwnUnit
(
userUtils
.
getCurrentUserUnitName
());
...
...
@@ -263,18 +289,21 @@ public class BackController {
ids
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
allotBackBill
.
getSendUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
//经办人阅知
if
(
allotBackReceiveVo
.
getReceiveUserbId
()!=
null
)
{
List
<
Integer
>
idList1
=
new
ArrayList
<>();
idList1
.
add
(
allotBackReceiveVo
.
getReceiveUserbId
());
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
idList1
,
1
);
messageService
.
add
(
messageBto
);
}
//签发人阅知
if
(
allotBackReceiveVo
.
getSendUserbId
()!=
null
)
{
List
<
Integer
>
idList1
=
new
ArrayList
<>();
idList1
.
add
(
allotBackReceiveVo
.
getSendUserbId
());
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
idList1
,
1
);
messageService
.
add
(
messageBto
);
}
//根据status判断是否业务完结,发送不同的阅知message
String
message
=
allotBackReceiveVo
.
getStatus
()==
0
?
"业务办结"
:
"接收退回装备"
;
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
message
,
ids
,
1
);
messageService
.
add
(
messageBto
);
...
...
@@ -288,23 +317,28 @@ public class BackController {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
uploadAllotBill
(
@RequestBody
@Validated
FileUploadVo
fileUploadVo
){
TaskBto
taskBto
=
taskService
.
get
(
fileUploadVo
.
getTaskId
());
//判断业务状态是否被操作
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
StatusEnum
.
WAIT_UPLOAD_ALLOT_BACK_FILE
);
Integer
userId
=
userUtils
.
getCurrentUserId
();
taskService
.
addInvolveUser
(
taskBto
,
userId
);
//业务和子业务办结
taskService
.
moveToEnd
(
taskBto
);
taskService
.
moveAllSonNodeToEnd
(
taskBto
.
getId
());
AllotBackBill
allotBackBill
=
allotBackBillService
.
getOne
(
taskBto
.
getBillId
());
allotBackBill
.
setBillFileName
(
fileUploadVo
.
getBillFileName
());
allotBackBill
.
setBillFileUrl
(
fileUploadVo
.
getBillFileUrl
());
//是否上传发件方签发人
if
(
fileUploadVo
.
getSendUserbId
()!=
null
){
allotBackBill
.
setSendUserbId
(
fileUploadVo
.
getSendUserbId
());
allotBackBill
.
setAgent
(
userPublicService
.
getOne
(
fileUploadVo
.
getSendUserbId
()).
getName
());
}
//是否上传接收方B岗
if
(
fileUploadVo
.
getReceiveUserbId
()!=
null
){
allotBackBill
.
setReceiveUserbId
(
fileUploadVo
.
getReceiveUserbId
());
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
Collections
.
singletonList
(
fileUploadVo
.
getReceiveUserbId
()),
1
);
messageService
.
add
(
messageBto
);
}
//文件列表
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
if
(
fileUploadVo
.
getReceiveFileList
()!=
null
&&
fileUploadVo
.
getReceiveFileList
().
size
()>
0
){
fileUploadVo
.
getReceiveFileList
().
forEach
(
fileRet
->
{
...
...
@@ -313,7 +347,6 @@ public class BackController {
allotBackBill
.
setReceiveFiles
(
FilesUtil
.
stringFileToList
(
fileUploadVo
.
getReceiveFileList
()));
}
allotBackBillService
.
update
(
allotBackBill
);
// fileVoList.add(new FileVo("退回单", allotBackBill.getBillFileName(), allotBackBill.getBillFileUrl()));
//添加装备日志
List
<
Integer
>
deviceIds
=
StringSplitUtil
.
split
(
allotBackBill
.
getBackCheckDetail
());
deviceIds
.
forEach
(
integer
->
{
...
...
@@ -321,6 +354,7 @@ public class BackController {
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
integer
,
"上传退回单据"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
});
//签发人阅知
if
(
fileUploadVo
.
getSendUserbId
()!=
null
)
{
List
<
Integer
>
idList1
=
new
ArrayList
<>();
idList1
.
add
(
fileUploadVo
.
getSendUserbId
());
...
...
@@ -344,10 +378,13 @@ public class BackController {
//获取task
TaskBto
taskBto
=
taskService
.
get
(
fileVo
.
getTaskId
());
taskService
.
addInvolveUser
(
taskBto
,
userUtils
.
getCurrentUserId
());
//判断业务状态是否被操作
List
<
StatusEnum
>
statusEnums
=
new
ArrayList
<>();
statusEnums
.
add
(
StatusEnum
.
WAIT_UPLOAD_BACK_FILE_2
);
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
statusEnums
);
//获取账单
AllotBackBill
allotBackBill
=
allotBackBillService
.
getOne
(
taskBto
.
getBillId
());
//存放接收方经办人id
List
<
Integer
>
idList
=
new
ArrayList
<>();
if
(
fileVo
.
getReceiveUseraId
()!=
null
)
{
allotBackBill
.
setReceiveUseraId
(
fileVo
.
getReceiveUseraId
());
...
...
@@ -357,6 +394,7 @@ public class BackController {
allotBackBill
.
setReceiveUserbId
(
fileVo
.
getReceiveUserbId
());
idList
.
add
(
fileVo
.
getReceiveUserbId
());
}
//签发人阅知
if
(
fileVo
.
getSendUserbId
()!=
null
){
allotBackBill
.
setSendUserbId
(
fileVo
.
getSendUserbId
());
allotBackBill
.
setAgent
(
userPublicService
.
getOne
(
fileVo
.
getSendUserbId
()).
getName
());
...
...
@@ -366,15 +404,20 @@ public class BackController {
messageService
.
add
(
messageBto
);
}
//保存账单
//回执单
allotBackBill
.
setSendFiles
(
FilesUtil
.
stringFileToList
(
fileVo
.
getAllotFiles
()));
//状态退回完成
allotBackBill
.
setBackStatus
(
3
);
//接收时间
allotBackBill
.
setReceiveTime
(
TimestampUtil
.
getCurrentTimestamp
());
allotBackBillService
.
update
(
allotBackBill
);
//装备Id集合
List
<
Integer
>
ids
=
StringSplitUtil
.
split
(
allotBackBill
.
getBackCheckDetail
());
//业务完结
taskService
.
moveToEnd
(
taskBto
);
//主业务完结
taskService
.
moveToEnd
(
taskService
.
get
(
taskBto
.
getParentTaskId
()));
//
装备日志
//
添加装备日志,改变装备状态
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
fileVo
.
getAllotFiles
().
forEach
(
fileRet
->
fileVoList
.
add
(
new
FileVo
(
"退回单"
,
fileRet
.
getName
(),
fileRet
.
getPreviewPath
())));
ids
.
forEach
(
integer
->
{
...
...
@@ -387,6 +430,7 @@ public class BackController {
deviceLibrary
.
setManageStatus
(
1
);
deviceLibraryService
.
update
(
deviceLibrary
);
});
//经办人阅知
if
(
idList
.
size
()>
0
)
{
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
...
...
@@ -404,48 +448,45 @@ public class BackController {
@ApiOperation
(
value
=
"上传发送方签发人"
,
notes
=
"上传发送方签发人"
)
@PostMapping
(
value
=
"/updateAgent"
)
public
ResponseEntity
updateAgent
(
@RequestBody
AgentVo
agentVo
){
//获取业务
TaskBto
taskBto
=
taskService
.
get
(
agentVo
.
getId
());
List
<
Integer
>
idList
=
new
ArrayList
<>();
idList
.
add
(
agentVo
.
getSendUserbId
());
//签发人阅知
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
//账单保存签发人
AllotBackBill
allotBackBill
=
allotBackBillService
.
getOne
(
taskBto
.
getBillId
());
allotBackBill
.
setAgent
(
agentVo
.
getName
());
allotBackBill
.
setSendUserbId
(
agentVo
.
getSendUserbId
());
return
ResponseEntity
.
ok
(
allotBackBillService
.
update
(
allotBackBill
));
}
@ApiOperation
(
value
=
"保存退回操作"
,
notes
=
"可以通过这个接口保存退回操作"
)
@ApiOperation
(
value
=
"保存退回操作
(草稿)
"
,
notes
=
"可以通过这个接口保存退回操作"
)
@PostMapping
(
value
=
"/saveBackBill"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
saveBackBill
(
@RequestBody
AllotBillSaveVo
allotBillSaveVo
)
{
//判断装备的生命状态是否能退回
if
(
allotBillSaveVo
.
getAllotCheckDetail
()!=
null
&&
allotBillSaveVo
.
getAllotCheckDetail
().
length
()>
0
)
{
deviceLibraryService
.
isInStockOrWaitRetired
(
StringSplitUtil
.
split
(
allotBillSaveVo
.
getAllotCheckDetail
()));
}
//第一次保存
//第一次保存
(没有taskId)
if
(
allotBillSaveVo
.
getTaskId
()==
null
){
Integer
userId
=
userUtils
.
getCurrentUserId
();
//保存退回单
List
<
Integer
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
userId
);
//转Do
AllotBackBill
allotBackBill
=
allotBillSaveVo
.
toBackDo
();
//状态设为草稿
allotBackBill
.
setBackStatus
(
1
);
//发件A岗设为当前操作人
allotBackBill
.
setSendUseraId
(
userId
);
AllotBackBill
allotBackBill1
=
allotBackBillService
.
addEntity
(
allotBackBill
);
//发起任务
//发起
草稿
任务
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
BACK_DRAFT
.
id
,
"退回业务"
,
null
,
"."
,
allotBackBill1
.
getId
(),
22
,
userUtils
.
getCurrentUnitId
(),
0
,
null
,
userIds
);
TaskBto
taskBto1
=
taskService
.
start
(
taskBto
);
//改变装备状态为待退回
// if (allotBillSaveVo.getAllotCheckDetail()!=null){
// Map<Integer,DeviceLibrary> map = deviceLibraryService.getAllDeviceMap();
// StringSplitUtil.split(allotBillSaveVo.getAllotCheckDetail()).forEach(integer -> {
// if (map.get(integer)!=null){
// DeviceLibrary deviceLibrary = map.get(integer);
// deviceLibrary.setLifeStatus(22);
// deviceLibraryService.update(deviceLibrary);
// }
// });
// }
//返回保存成功的id
Integer
id
=
taskBto1
.
getId
();
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"保存成功"
+
id
);
...
...
@@ -455,6 +496,7 @@ public class BackController {
TaskBto
taskBto
=
taskService
.
get
(
allotBillSaveVo
.
getTaskId
());
AllotBackBill
allotBackBill
=
allotBackBillService
.
getOne
(
taskBto
.
getBillId
());
AllotBackBill
allotBackBill1
=
allotBillSaveVo
.
toBackDo
();
//状态设为草稿
allotBackBill1
.
setBackStatus
(
1
);
MapperUtils
.
copyNoNullProperties
(
allotBackBill1
,
allotBackBill
);
allotBackBillService
.
update
(
allotBackBill
);
...
...
@@ -470,18 +512,6 @@ public class BackController {
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
TaskBto
taskBto1
=
taskService
.
addInvolveUser
(
taskBto
,
userUtils
.
getCurrentUserId
());
taskService
.
moveToArchive
(
taskBto1
);
//更改装备状态为在库
// AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto1.getBillId());
// if (allotBackBill.getBackCheckDetail()!=null){
// Map<Integer,DeviceLibrary> map = deviceLibraryService.getAllDeviceMap();
// StringSplitUtil.split(allotBackBill.getBackCheckDetail()).forEach(integer -> {
// if (map.get(integer)!=null){
// DeviceLibrary deviceLibrary = map.get(integer);
// deviceLibrary.setLifeStatus(2);
// deviceLibraryService.update(deviceLibrary);
// }
// });
// }
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"删除成功"
);
}
...
...
@@ -490,13 +520,16 @@ public class BackController {
@PostMapping
(
value
=
"/applySign/{taskId}/{userId}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
applySign
(
@PathVariable
(
"taskId"
)
int
taskId
,
@PathVariable
(
"userId"
)
int
userId
)
{
//
推动任务
//
获取任务和账单
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
AllotBackBill
allotBill
=
allotBackBillService
.
getOne
(
taskBto
.
getBillId
());
//如果是收件方申请电子签章
if
(
allotBill
.
getBackStatus
()!=
1
){
//当前用户设为接收A岗
allotBill
.
setReceiveUseraId
(
userUtils
.
getCurrentUserId
());
allotBackBillService
.
update
(
allotBill
);
}
//推动任务到盖章待审核状态
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
BACK_SIGN_WAIT_CONFIRM
,
userId
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"申请成功"
);
...
...
@@ -506,24 +539,32 @@ public class BackController {
@PostMapping
(
value
=
"/applySignConfirm/{taskId}/{status}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
applySignConfirm
(
@PathVariable
(
"taskId"
)
int
taskId
,
@PathVariable
(
"status"
)
int
status
)
{
//
推动任务
//
获取任务和单据
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
AllotBackBill
allotBill
=
allotBackBillService
.
getOne
(
taskBto
.
getBillId
());
//如果同意
if
(
status
==
1
){
//推动任务到等待盖章状态
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
BACK_WAIT_SIGN
);
//发件方盖章
if
(
allotBill
.
getBackStatus
()==
1
)
{
//当前用户设为签发人
allotBill
.
setSendUserbId
(
userUtils
.
getCurrentUserId
());
allotBill
.
setAgent
(
userUtils
.
getCurrentName
());
}
//收件方盖章
else
{
//当前用户设为接收方B岗
allotBill
.
setReceiveUserbId
(
userUtils
.
getCurrentUserId
());
}
allotBackBillService
.
update
(
allotBill
);
}
else
{
//发件方盖章不同意任务返回草稿状态
if
(
allotBill
.
getBackStatus
()==
1
)
{
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
BACK_DRAFT
,
taskBto
.
getCreateUserId
());
}
//收件方返回到待入库状态
else
{
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
ALLOT_BACKING
,
allotBill
.
getReceiveUseraId
());
}
...
...
@@ -536,8 +577,10 @@ public class BackController {
@PostMapping
(
value
=
"/selectBackDetail/{taskId}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
selectBackDetail
(
@PathVariable
(
"taskId"
)
int
taskId
)
{
//获取业务和账单
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
AllotBackBill
allotBillEntity
=
allotBackBillService
.
getOne
(
taskBto
.
getBillId
());
//将用户id转为名字
if
(
allotBillEntity
.
getSendUseraId
()
!=
null
)
{
allotBillEntity
.
setSenderUserA
(
userPublicService
.
getOne
(
allotBillEntity
.
getSendUseraId
()).
getName
());
}
...
...
@@ -550,14 +593,17 @@ public class BackController {
if
(
allotBillEntity
.
getReceiveUserbId
()
!=
null
)
{
allotBillEntity
.
setReceiveUserB
(
userPublicService
.
getOne
(
allotBillEntity
.
getReceiveUserbId
()).
getName
());
}
//分隔装备id得到装备信息
if
(
allotBillEntity
.
getBackCheckDetail
()!=
null
){
List
<
Integer
>
ids
=
StringSplitUtil
.
split
(
allotBillEntity
.
getBackCheckDetail
());
List
<
DeviceLibrary
>
deviceLibraryList
=
new
ArrayList
<>();
ids
.
forEach
(
integer
->
deviceLibraryList
.
add
(
deviceLibraryService
.
getOne
(
integer
)));
allotBillEntity
.
setDeviceLibraries
(
deviceLibraryList
);
}
//设置申请和批复文件列表
allotBillEntity
.
setReplyFileList
(
FilesUtil
.
stringFileToList
(
allotBillEntity
.
getReplyFiles
()));
allotBillEntity
.
setApplyFileList
(
FilesUtil
.
stringFileToList
(
allotBillEntity
.
getApplyFiles
()));
//返回前端单据json详情
if
(
allotBillEntity
.
getScriptJson
()!=
null
){
allotBillEntity
.
setScripts
(
JacksonUtil
.
readValue
(
allotBillEntity
.
getScriptJson
(),
new
TypeReference
<
List
<
ScriptSaveVo
>>()
{}));
}
...
...
dev-allot/src/main/java/com/tykj/dev/device/allot/subject/vo/AllotBillSaveVo.java
浏览文件 @
b0ff8938
...
...
@@ -143,8 +143,10 @@ public class AllotBillSaveVo {
if
(
this
.
applyFiles
!=
null
){
allotBillEntity
.
setApplyFiles
(
FilesUtil
.
stringFileToList
(
this
.
applyFiles
));
}
//退回状态为退回中
allotBillEntity
.
setBackStatus
(
0
);
allotBillEntity
.
setSendTime
(
TimestampUtil
.
getCurrentTimestamp
());
//字段和配发不同的单独set
allotBillEntity
.
setBackCheckDetail
(
this
.
allotCheckDetail
);
allotBillEntity
.
setBackCheckResult
(
this
.
allotCheckResult
);
allotBillEntity
.
setBackCount
(
this
.
allotCount
);
...
...
dev-library/src/main/java/com/tykj/dev/device/library/service/DeviceLibraryService.java
浏览文件 @
b0ff8938
...
...
@@ -125,29 +125,29 @@ public interface DeviceLibraryService {
List
<
DeviceLibrary
>
getSendBackDevice
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
);
/**
* 判断装备状态是否在库
* 判断装备状态是否在库
(若不是抛出303异常)
*/
void
isInStock
(
List
<
Integer
>
ids
);
/**
* 判断装备状态是否待退役
* 判断装备状态是否待退役
(若不是抛出303异常)
*/
void
isWaitRetired
(
List
<
Integer
>
ids
);
/**
* 判断装备状态是否在库或待退役
* 判断装备状态是否在库或待退役
(若不是抛出303异常)
*/
void
isInStockOrWaitRetired
(
List
<
Integer
>
ids
);
/**
* 判断装备状态是否丢失
* 判断装备状态是否丢失
(若不是抛出303异常)
* @param ids
*/
void
isNotLoss
(
List
<
Integer
>
ids
);
/**
* 判断装备状态是否在库或维修中
* 判断装备状态是否在库或维修中
(若不是抛出303异常)
*/
void
isInStockOrRepairing
(
List
<
Integer
>
ids
);
...
...
dev-library/src/main/java/com/tykj/dev/device/library/service/impl/DeviceLibraryServiceImpl.java
浏览文件 @
b0ff8938
...
...
@@ -469,7 +469,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
}
/**
* 判断装备状态是否在库或待退役
* 判断装备状态是否在库或待退役
(若不是抛出303异常)
*
* @param ids 装备id集合
*/
...
...
dev-packing/src/main/java/com/tykj/dev/device/packing/controller/PackingController.java
浏览文件 @
b0ff8938
...
...
@@ -166,7 +166,7 @@ public class PackingController {
}
if
(
packingLibraryService
.
matchingRangeIsExist
(
addPack
.
getPartParentId
(),
addPack
.
getMatchingRange
(),
addPack
.
getType
(),
addPack
.
getStyle
(),
addPack
.
getName
(),
addPack
.
getSecretLevel
(),
addPack
.
getInvisibleRange
())){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"error"
,
"型号"
+
addPack
.
getModel
()+
"下配用范围为"
+
configCache
.
getMatchingRangeMap
().
get
(
addPack
.
getMatchingRange
())+
"的装备已存在"
);
map
.
put
(
"error"
,
"型号"
+
addPack
.
getModel
()+
"下配用范围为"
+
configCache
.
getMatchingRangeMap
().
get
(
addPack
.
getMatchingRange
())+
"的
该
装备已存在"
);
return
ResponseEntity
.
ok
(
map
);
}
PackingLibrary
packingLibrary
=
addPack
.
toDo
();
...
...
@@ -448,7 +448,7 @@ public class PackingController {
public
ResponseEntity
updateDevice
(
@RequestBody
@Validated
PackingLibraryUpdateVo
packingLibraryUpdateVo
){
PackingLibrary
packingLibrary
=
packingLibraryService
.
getOne
(
packingLibraryUpdateVo
.
getPackingId
());
if
(!
packingLibraryUpdateVo
.
getMatchingRange
().
equals
(
packingLibrary
.
getMatchingRange
())&&
packingLibraryService
.
matchingRangeIsExist
(
packingLibrary
.
getPartParentId
(),
packingLibraryUpdateVo
.
getMatchingRange
(),
packingLibraryUpdateVo
.
getType
(),
packingLibraryUpdateVo
.
getStyle
(),
packingLibraryUpdateVo
.
getName
(),
packingLibraryUpdateVo
.
getSecretLevel
(),
packingLibraryUpdateVo
.
getInvisibleRange
())){
throw
new
ApiException
(
"该型号下已存在配用范围为"
+
configCache
.
getMatchingRangeMap
().
get
(
packingLibraryUpdateVo
.
getMatchingRange
())+
"的装备"
);
throw
new
ApiException
(
"该型号下已存在配用范围为"
+
configCache
.
getMatchingRangeMap
().
get
(
packingLibraryUpdateVo
.
getMatchingRange
())+
"的
相同
装备"
);
}
//复制相同的字段
if
(
packingLibraryUpdateVo
.
getName
()!=
null
&&!
packingLibraryUpdateVo
.
getName
().
equals
(
packingLibrary
.
getName
())&&!
packingLibraryService
.
nameIsExist
(
packingLibrary
.
getModel
(),
packingLibraryUpdateVo
.
getName
())){
...
...
dev-task/src/main/java/com/tykj/dev/device/task/controller/TaskController.java
浏览文件 @
b0ff8938
...
...
@@ -165,6 +165,12 @@ public class TaskController {
}
}
}
//set新增的task高亮字段
taskUserVos
.
forEach
(
taskUserVo
->
{
if
(
taskIds
.
contains
(
taskUserVo
.
getId
())){
taskUserVo
.
setIsNew
(
1
);
}
});
}
}
return
ResultUtil
.
success
(
taskUtils
.
orderByTopDescAndReadAsc
(
taskUserVos
));
...
...
dev-task/src/main/java/com/tykj/dev/device/task/subject/vo/TaskUserVo.java
浏览文件 @
b0ff8938
...
...
@@ -91,6 +91,10 @@ public class TaskUserVo {
@Transient
private
Integer
isTop
=
0
;
@ApiModelProperty
(
value
=
"是否新高亮待办(0:不是,1:是)"
)
@Transient
private
Integer
isNew
=
0
;
@ApiModelProperty
(
value
=
"状态描述"
)
private
String
status
;
...
...
dev-user/src/main/java/com/tykj/dev/device/user/read/service/impl/MessageServiceImpl.java
浏览文件 @
b0ff8938
...
...
@@ -121,6 +121,12 @@ public class MessageServiceImpl implements MessageService {
userRecordService
.
save
(
userRecord
);
}
}
//设置新增的阅知字段
messageUserVos
.
forEach
(
messageUserVo
->
{
if
(
ids
.
contains
(
messageUserVo
.
getId
())){
messageUserVo
.
setIsNew
(
1
);
}
});
return
messageUserVos
;
}
...
...
dev-user/src/main/java/com/tykj/dev/device/user/read/subject/vo/MessageUserVo.java
浏览文件 @
b0ff8938
...
...
@@ -54,6 +54,9 @@ public class MessageUserVo {
@ApiModelProperty
(
value
=
"是否高亮(0:不是,1:是)"
)
private
Integer
isHighLight
=
0
;
@ApiModelProperty
(
value
=
"是否新增(0:不是,1:是)"
)
private
Integer
isNew
=
0
;
@ApiModelProperty
(
value
=
"操作人"
)
private
String
operator
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论