Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
debb315a
提交
debb315a
authored
5月 25, 2021
作者:
邓砥奕
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新
上级
a8ee7c2f
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
483 行增加
和
349 行删除
+483
-349
DeviceApplyBillService.java
...tykj/dev/device/apply/service/DeviceApplyBillService.java
+1
-0
DeviceApplyBillServiceImpl.java
...device/apply/service/impl/DeviceApplyBillServiceImpl.java
+20
-0
DeviceApplyBill.java
.../tykj/dev/device/apply/subject/domin/DeviceApplyBill.java
+6
-1
DeviceApplyAllotSaveVo.java
...j/dev/device/apply/subject/vo/DeviceApplyAllotSaveVo.java
+1
-0
DeviceApplySaveVo.java
...m/tykj/dev/device/apply/subject/vo/DeviceApplySaveVo.java
+11
-0
DeviceLibraryServiceImpl.java
...device/library/service/impl/DeviceLibraryServiceImpl.java
+8
-0
DeviceStatisticsVo.java
...ykj/dev/device/library/subject/vo/DeviceStatisticsVo.java
+3
-0
PackingController.java
...tykj/dev/device/packing/controller/PackingController.java
+43
-21
PackingLibraryServiceImpl.java
...evice/packing/service/impl/PackingLibraryServiceImpl.java
+1
-0
AllotMaxNum.java
...a/com/tykj/dev/device/packing/subject/vo/AllotMaxNum.java
+20
-0
RepairController.java
...m/tykj/dev/device/repair/controller/RepairController.java
+355
-325
RepairBackBill.java
.../tykj/dev/device/repair/subject/domin/RepairBackBill.java
+3
-0
RepairBill.java
.../com/tykj/dev/device/repair/subject/domin/RepairBill.java
+1
-1
RepairDetail.java
...om/tykj/dev/device/repair/subject/domin/RepairDetail.java
+4
-0
RepairSendBill.java
.../tykj/dev/device/repair/subject/domin/RepairSendBill.java
+3
-0
AgentBackVo.java
...va/com/tykj/dev/device/repair/subject/vo/AgentBackVo.java
+1
-1
RepairBillSaveVo.java
...m/tykj/dev/device/repair/subject/vo/RepairBillSaveVo.java
+1
-0
RepairReceiveVo.java
...om/tykj/dev/device/repair/subject/vo/RepairReceiveVo.java
+1
-0
没有找到文件。
dev-apply/src/main/java/com/tykj/dev/device/apply/service/DeviceApplyBillService.java
浏览文件 @
debb315a
...
...
@@ -24,6 +24,7 @@ public interface DeviceApplyBillService {
/**
* @param scriptSaveVos 退役/报废/销毁装备单据详情
* 更新装备对应申请任务的已完成数量
*/
void
updateCompleteNum
(
Integer
applyType
,
List
<
ScriptSaveVo
>
scriptSaveVos
);
...
...
dev-apply/src/main/java/com/tykj/dev/device/apply/service/impl/DeviceApplyBillServiceImpl.java
浏览文件 @
debb315a
...
...
@@ -110,39 +110,55 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
@Override
public
void
updateCompleteNum
(
Integer
applyType
,
List
<
ScriptSaveVo
>
scriptSaveVos
)
{
//筛选出所有申请完成后待执行的任务
Map
<
Integer
,
Task
>
taskMap
=
taskDao
.
findAllByBusinessTypeAndBillStatus
(
9
,
StatusEnum
.
WAIT_CONFIRM_APPLY_DEVICE
.
id
).
stream
().
collect
(
Collectors
.
toMap
(
Task:
:
getId
,
Function
.
identity
()));
//所有申请单Id的map
Map
<
Integer
,
DeviceApplyBill
>
billMap
=
deviceApplyBillDao
.
findAll
().
stream
().
collect
(
Collectors
.
toMap
(
DeviceApplyBill:
:
getId
,
Function
.
identity
()));
//所有装备序列号map
Map
<
String
,
DeviceLibrary
>
seqMap
=
deviceLibraryService
.
getAllDeviceSeqMap
();
//根据序列号区间找到所有装备
List
<
DeviceLibrary
>
deviceLibraries
=
new
ArrayList
<>();
for
(
ScriptSaveVo
s:
scriptSaveVos
)
{
if
(
s
.
getSeqNumber
()!=
null
){
DeviceSeqUtil
.
selectDeviceSeqs
(
s
.
getSeqNumber
()).
forEach
(
s1
->
deviceLibraries
.
add
(
seqMap
.
get
(
s1
)));
}
}
//taskId为主键,对应装备集合为值的map
Map
<
Integer
,
List
<
DeviceLibrary
>>
taskIdMap
=
deviceLibraries
.
stream
().
filter
(
deviceLibrary
->
deviceLibrary
.
getApplyTaskId
()!=
null
).
collect
(
groupingBy
(
DeviceLibrary:
:
getApplyTaskId
));
//根据taskIdMap遍历
for
(
Integer
taskId:
taskIdMap
.
keySet
())
{
//将该task涉及装备按列装id分组
Map
<
Integer
,
List
<
DeviceLibrary
>>
map
=
taskIdMap
.
get
(
taskId
).
stream
().
collect
(
groupingBy
(
DeviceLibrary:
:
getPackingId
));
TaskBto
taskBto
=
taskMap
.
get
(
taskId
).
parse2Bto
();
DeviceApplyBill
deviceApplyBill
=
billMap
.
get
(
taskBto
.
getBillId
());
//该任务是否完成
Boolean
isComplete
=
true
;
if
(
deviceApplyBill
.
getReplyVos
()!=
null
&&!
""
.
equals
(
deviceApplyBill
.
getReplyVos
()))
{
//转换json
List
<
ReplyVo
>
replyVos
=
JacksonUtil
.
readValue
(
deviceApplyBill
.
getReplyVos
(),
new
TypeReference
<
List
<
ReplyVo
>>()
{
});
//存放未完成数量装备
List
<
DeviceLibrary
>
deviceLibraryList
=
new
ArrayList
<>();
if
(
replyVos
!=
null
)
{
for
(
ReplyVo
r:
replyVos
){
if
(
map
.
get
(
r
.
getId
())!=
null
){
//完成数量增加
r
.
setCompleteCount
(
r
.
getCompleteCount
()+
map
.
get
(
r
.
getId
()).
size
());
//如果完成数量不等于申请数量
if
(!
r
.
getCompleteCount
().
equals
(
r
.
getNum
())){
isComplete
=
false
;
List
<
String
>
seqs
=
DeviceSeqUtil
.
selectDeviceSeqs
(
r
.
getSeqInterval
());
//移除已完成数量装备序列号
seqs
.
removeAll
(
map
.
get
(
r
.
getId
()).
stream
().
map
(
DeviceLibrary:
:
getSeqNumber
).
collect
(
Collectors
.
toList
()));
//将未完成的装备添加到集合
seqs
.
forEach
(
s
->
deviceLibraryList
.
add
(
seqMap
.
get
(
s
)));
}
}
}
if
(!
isComplete
){
//存放所有未完成装备生命状态
Set
<
Integer
>
lifeStatus
=
deviceLibraryList
.
stream
().
map
(
DeviceLibrary:
:
getLifeStatus
).
collect
(
Collectors
.
toSet
());
//存放所有完成的状态
Set
<
Integer
>
integers
=
new
HashSet
<>();
integers
.
add
(
11
);
if
(
applyType
==
2
)
{
...
...
@@ -160,11 +176,14 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
integers
.
add
(
10
);
integers
.
add
(
20
);
}
//判断剩下未完成的装备是否生命状态算完成
if
(
integers
.
containsAll
(
lifeStatus
)){
isComplete
=
true
;
}
}
//如果已完成
if
(
isComplete
){
//业务办结
taskService
.
addInvolveUser
(
taskBto
,
userUtils
.
getCurrentUserId
());
taskService
.
moveToEnd
(
taskBto
);
//发送阅知信息
...
...
@@ -176,6 +195,7 @@ public class DeviceApplyBillServiceImpl implements DeviceApplyBillService {
messageBto
.
setBusinessType
(
taskBto
.
getBusinessType
());
messageService
.
add
(
messageBto
);
}
//更新账单replyVos
deviceApplyBill
.
setReplyVos
(
JacksonUtil
.
toJSon
(
replyVos
));
update
(
deviceApplyBill
);
}
...
...
dev-apply/src/main/java/com/tykj/dev/device/apply/subject/domin/DeviceApplyBill.java
浏览文件 @
debb315a
...
...
@@ -137,19 +137,23 @@ public class DeviceApplyBill {
@ApiModelProperty
(
value
=
"区块链记录id"
)
private
String
recordId
;
@ApiModelProperty
(
value
=
"申请单"
)
@Column
(
name
=
"apply_files"
,
columnDefinition
=
"TEXT"
)
private
String
applyFiles
;
@ApiModelProperty
(
value
=
"批复单"
)
@Column
(
name
=
"back_files"
,
columnDefinition
=
"TEXT"
)
private
String
backFiles
;
@ApiModelProperty
(
value
=
"批复文号文件"
)
@Column
(
name
=
"apply_num_files"
,
columnDefinition
=
"TEXT"
)
private
String
applyNumFiles
;
@ApiModelProperty
(
value
=
"批复文号文件"
)
@Column
(
name
=
"reply_files"
,
columnDefinition
=
"TEXT"
)
private
String
replyFiles
;
@ApiModelProperty
(
value
=
"记录完成数量和未完成数量"
)
@Column
(
name
=
"reply_vos"
,
columnDefinition
=
"TEXT"
)
private
String
replyVos
;
...
...
@@ -168,6 +172,7 @@ public class DeviceApplyBill {
@Transient
private
List
<
ReplyVo
>
replyVoList
=
new
ArrayList
<>();
@ApiModelProperty
(
value
=
"申请装备序列号信息vo"
)
@Transient
private
List
<
ApplyBillDetailVo
>
applyBillDetailVos
=
new
ArrayList
<>();
}
dev-apply/src/main/java/com/tykj/dev/device/apply/subject/vo/DeviceApplyAllotSaveVo.java
浏览文件 @
debb315a
...
...
@@ -53,5 +53,6 @@ public class DeviceApplyAllotSaveVo {
@ApiModelProperty
(
value
=
"左签章Id"
)
private
String
leftSignatureId
;
@ApiModelProperty
(
value
=
"单据保存vo"
)
private
List
<
ScriptSaveVo
>
scriptSaveVos
;
}
dev-apply/src/main/java/com/tykj/dev/device/apply/subject/vo/DeviceApplySaveVo.java
浏览文件 @
debb315a
...
...
@@ -70,14 +70,20 @@ public class DeviceApplySaveVo {
@ApiModelProperty
(
value
=
"申请类型(1:装备申请,2:退役申请,3:报废申请,4:销毁申请)"
)
private
Integer
applyType
;
/**
* 转实体
*/
public
DeviceApplyBill
toDo
()
{
ModelMapper
mapper
=
BeanHelper
.
getUserMapper
();
DeviceApplyBill
deviceApplyBillEntity
=
mapper
.
map
(
this
,
DeviceApplyBill
.
class
);
deviceApplyBillEntity
.
setApplyStatus
(
0
);
StringBuffer
stringBuffer
=
new
StringBuffer
();
stringBuffer
.
append
(
"x"
);
//申请详情
if
(
this
.
storageBillDetailVoList
!=
null
&&
this
.
storageBillDetailVoList
.
size
()
>
0
)
{
//分解父子结构
List
<
ApplyBillDetailVo
>
applyBillDetailVos
=
GetTreeUtils
.
splitTree
(
storageBillDetailVoList
,
ApplyBillDetailVo:
:
getChilds
,
ApplyBillDetailVo:
:
setChildNull
);
//拼接列装id和申请数量字符串
for
(
ApplyBillDetailVo
s
:
applyBillDetailVos
)
{
stringBuffer
.
append
(
s
.
getPackingId
()).
append
(
"x"
);
if
(
s
.
getStorageCount
()!=
null
)
{
...
...
@@ -87,7 +93,9 @@ public class DeviceApplySaveVo {
stringBuffer
.
append
(
0
).
append
(
"x"
);
}
}
//转为json存储
deviceApplyBillEntity
.
setApplyStat
(
JacksonUtil
.
toJSon
(
applyBillDetailVos
));
//如果不是装备申请,添加replyVo
if
(
this
.
applyType
!=
1
){
List
<
ReplyVo
>
replyVos
=
new
ArrayList
<>();
for
(
ApplyBillDetailVo
applyBillDetailVo
:
applyBillDetailVos
){
...
...
@@ -97,10 +105,13 @@ public class DeviceApplySaveVo {
replyVo
.
setSeqInterval
(
applyBillDetailVo
.
getSeqInterval
());
replyVos
.
add
(
replyVo
);
}
//转为json存储
deviceApplyBillEntity
.
setReplyVos
(
JacksonUtil
.
toJSon
(
replyVos
));
}
}
//set组合字符串
deviceApplyBillEntity
.
setApplyDetail
(
stringBuffer
.
toString
());
//单据转换
if
(
this
.
applyFiles
!=
null
&&
this
.
applyFiles
.
size
()>
0
){
deviceApplyBillEntity
.
setApplyFiles
(
FilesUtil
.
stringFileToList
(
this
.
applyFiles
));
}
...
...
dev-library/src/main/java/com/tykj/dev/device/library/service/impl/DeviceLibraryServiceImpl.java
浏览文件 @
debb315a
...
...
@@ -322,6 +322,14 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
deviceStatisticsVo
.
setRetiredNum
(
retiredNum
);
deviceStatisticsVo
.
setUseNum
(
useNum
);
deviceStatisticsVo
.
setOtherNum
(
num
-
allotNum
-
inLibraryNum
-
repairNum
-
destoryNum
-
scrappedNum
-
retiredNum
-
useNum
);
deviceIds
.
removeAll
(
allotIds
);
deviceIds
.
removeAll
(
destoryIds
);
deviceIds
.
removeAll
(
inLibraryIds
);
deviceIds
.
removeAll
(
repairIds
);
deviceIds
.
removeAll
(
retiredIds
);
deviceIds
.
removeAll
(
scrappedIds
);
deviceIds
.
removeAll
(
useIds
);
deviceStatisticsVo
.
setOtherNumIds
(
deviceIds
);
deviceStatisticsVo
.
setSeqs
(
StringSplitUtil
.
stringListToString
(
DeviceSeqUtil
.
getContinuousSeqs
(
devSeqs
)));
deviceStatisticsVos
.
add
(
deviceStatisticsVo
);
}
...
...
dev-library/src/main/java/com/tykj/dev/device/library/subject/vo/DeviceStatisticsVo.java
浏览文件 @
debb315a
...
...
@@ -50,6 +50,9 @@ public class DeviceStatisticsVo {
@ApiModelProperty
(
value
=
"其他数量"
,
example
=
"10"
)
private
Integer
otherNum
;
@ApiModelProperty
(
value
=
"其他数量id"
,
example
=
"10"
)
private
List
<
Integer
>
otherNumIds
=
new
ArrayList
<>();
@ApiModelProperty
(
value
=
"该型号所有装备Id列表"
)
private
List
<
Integer
>
deviceIds
=
new
ArrayList
<>();
...
...
dev-packing/src/main/java/com/tykj/dev/device/packing/controller/PackingController.java
浏览文件 @
debb315a
...
...
@@ -5,6 +5,7 @@ import com.tykj.dev.config.swagger.AutoDocument;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo
;
import
com.tykj.dev.device.library.subject.vo.DeviceLogUserVo
;
import
com.tykj.dev.device.packing.repository.PackingLibraryDao
;
import
com.tykj.dev.device.packing.repository.PackingLogDao
;
...
...
@@ -36,6 +37,8 @@ import javax.validation.constraints.Min;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
java
.
util
.
stream
.
Collectors
.
groupingBy
;
@RestController
@Api
(
tags
=
"列装管理模块"
,
description
=
"列装管理接口"
)
@AutoDocument
...
...
@@ -287,29 +290,48 @@ public class PackingController {
return
ResponseEntity
.
ok
(
allotSeqs1
);
}
@ApiOperation
(
value
=
"配发设置区间"
)
@PostMapping
(
"/setAllotSeqs/{id}/{num}/{seq}"
)
public
ResponseEntity
setAllotSeqs
(
@PathVariable
(
"id"
)
int
id
,
@PathVariable
(
"num"
)
int
num
,
@PathVariable
(
"seq"
)
String
seq
){
List
<
DeviceLibrary
>
deviceLibraries
=
packingLibraryService
.
getAllotDevSeqs
(
id
);
List
<
String
>
existSeqs
=
deviceLibraries
.
stream
().
map
(
DeviceLibrary:
:
getSeqNumber
).
collect
(
Collectors
.
toList
());
List
<
String
>
inputSeqs
=
DeviceSeqUtil
.
selectDeviceSeqs
(
seq
);
if
(
existSeqs
.
containsAll
(
inputSeqs
)){
if
(
inputSeqs
.
size
()!=
num
){
return
ResponseEntity
.
ok
(
"序列号区间装备数量为"
+
inputSeqs
.
size
()+
",与填写数量不符"
);
}
else
{
List
<
Integer
>
ids
=
deviceLibraries
.
stream
().
filter
(
deviceLibrary
->
inputSeqs
.
contains
(
deviceLibrary
.
getSeqNumber
())).
map
(
DeviceLibrary:
:
getId
).
collect
(
Collectors
.
toList
());
return
ResponseEntity
.
ok
(
ids
);
}
@ApiOperation
(
value
=
"获取批量配发最大数量"
)
@PostMapping
(
"/getMaxAllotNum"
)
public
ResponseEntity
getMaxAllotNum
(
@RequestBody
List
<
Integer
>
ids
){
//输出集合
List
<
AllotMaxNum
>
allotMaxNums
=
new
ArrayList
<>();
//筛选出当前单位在库的装备
DeviceLibrarySelectVo
deviceLibrarySelectVo
=
new
DeviceLibrarySelectVo
();
deviceLibrarySelectVo
.
setLifeStatus
(
Collections
.
singletonList
(
2
));
List
<
DeviceLibrary
>
deviceLibraries
=
deviceLibraryService
.
getList
(
deviceLibrarySelectVo
);
//转为列装id的map
Map
<
Integer
,
List
<
DeviceLibrary
>>
map
=
deviceLibraries
.
stream
().
collect
(
groupingBy
(
DeviceLibrary:
:
getPackingId
));
ids
.
forEach
(
integer
->
{
//创建返回对象
AllotMaxNum
allotMaxNum
=
new
AllotMaxNum
();
allotMaxNum
.
setId
(
integer
);
//map里value的集合大小为最大可配发数量
allotMaxNum
.
setMaxNum
(
map
.
get
(
integer
).
size
());
allotMaxNums
.
add
(
allotMaxNum
);
});
return
ResponseEntity
.
ok
(
allotMaxNums
);
}
@ApiOperation
(
value
=
"批量配发设置区间"
)
@PostMapping
(
"/getAllotSeqs/{id}/{num}"
)
public
ResponseEntity
getAllotSeqs
(
@PathVariable
(
"id"
)
int
id
,
@PathVariable
(
"num"
)
int
num
,
@RequestBody
List
<
Integer
>
existIds
){
//获取可配发装备,排除已经生成了序列号在批量配发中的装备,按序列号排序
List
<
DeviceLibrary
>
deviceLibraries
=
packingLibraryService
.
getAllotDevSeqs
(
id
).
stream
()
.
filter
(
deviceLibrary
->
!
existIds
.
contains
(
deviceLibrary
.
getId
()))
.
sorted
(
Comparator
.
comparing
(
DeviceLibrary:
:
getSeqNumber
))
.
collect
(
Collectors
.
toList
());
if
(
deviceLibraries
.
size
()<
num
){
return
ResponseEntity
.
ok
(
ResultUtil
.
success
(
"该装备最大可配发数量为"
+
deviceLibraries
.
size
()+
"小于填写数量"
));
}
else
{
StringBuffer
stringBuffer
=
new
StringBuffer
();
stringBuffer
.
append
(
"序列号"
);
inputSeqs
.
removeAll
(
existSeqs
);
inputSeqs
.
forEach
(
s
->
stringBuffer
.
append
(
s
).
append
(
","
));
stringBuffer
.
deleteCharAt
(
stringBuffer
.
length
()-
1
);
stringBuffer
.
append
(
"不存在"
);
return
ResponseEntity
.
ok
(
stringBuffer
.
toString
());
//获取前num个装备
List
<
DeviceLibrary
>
deviceLibraryList
=
deviceLibraries
.
subList
(
0
,
num
);
List
<
Integer
>
ids
=
deviceLibraryList
.
stream
().
map
(
DeviceLibrary:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
String
>
seqs
=
deviceLibraryList
.
stream
().
map
(
DeviceLibrary:
:
getSeqNumber
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"ids"
,
ids
);
map
.
put
(
"seqs"
,
StringSplitUtil
.
stringListToString
(
DeviceSeqUtil
.
getContinuousSeqs
(
seqs
)));
return
ResponseEntity
.
ok
(
map
);
}
}
...
...
dev-packing/src/main/java/com/tykj/dev/device/packing/service/impl/PackingLibraryServiceImpl.java
浏览文件 @
debb315a
...
...
@@ -529,6 +529,7 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
public
List
<
DeviceLibrary
>
getAllotDevSeqs
(
Integer
packingId
)
{
PredicateBuilder
<
DeviceLibrary
>
predicateBuilder
=
Specifications
.
and
();
predicateBuilder
.
eq
(
"ownUnit"
,
userUtils
.
getCurrentUserUnitName
());
predicateBuilder
.
eq
(
"locationUnit"
,
userUtils
.
getCurrentUserUnitName
());
predicateBuilder
.
eq
(
"lifeStatus"
,
2
);
predicateBuilder
.
eq
(
"packingId"
,
packingId
);
return
deviceLibraryDao
.
findAll
(
predicateBuilder
.
build
());
...
...
dev-packing/src/main/java/com/tykj/dev/device/packing/subject/vo/AllotMaxNum.java
0 → 100644
浏览文件 @
debb315a
package
com
.
tykj
.
dev
.
device
.
packing
.
subject
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
org.springframework.stereotype.Repository
;
/**
* @author dengdiyi
*/
@Repository
@Data
@ApiModel
(
"最大配发数量返回类"
)
public
class
AllotMaxNum
{
//列装id
private
Integer
id
;
//最大可配发的在库数量
private
Integer
maxNum
;
}
dev-repair/src/main/java/com/tykj/dev/device/repair/controller/RepairController.java
浏览文件 @
debb315a
...
...
@@ -29,7 +29,6 @@ import com.tykj.dev.device.repair.subject.vo.*;
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.user.read.service.MessageService
;
import
com.tykj.dev.device.user.read.subject.bto.MessageBto
;
import
com.tykj.dev.device.user.subject.dao.UserDao
;
...
...
@@ -39,7 +38,6 @@ 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.RepairStatusEnum
;
import
com.tykj.dev.misc.base.StatusEnum
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.utils.*
;
...
...
@@ -133,12 +131,14 @@ public class RepairController {
@PostMapping
(
value
=
"/judge"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
judge
(
@RequestBody
List
<
Integer
>
ids
)
{
//存放所有维修记录的发件单位
Set
<
String
>
sendUnits
=
new
HashSet
<>();
ids
.
forEach
(
integer
->
{
RepairDetail
repairDetail
=
deviceRepairDetailService
.
getOne
(
integer
);
RepairBill
repairBill
=
deviceRepairBillService
.
getOne
(
repairDetail
.
getDeviceRepairBillId
());
sendUnits
.
add
(
repairBill
.
getSendUnit
());
});
//如果是同一单位返回单位名称,否则返error
if
(
sendUnits
.
size
()==
1
){
return
ResponseEntity
.
ok
(
sendUnits
.
iterator
().
next
());
}
...
...
@@ -151,6 +151,7 @@ public class RepairController {
@PostMapping
(
value
=
"/saveRepairBill"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
saveRepairBill
(
@RequestBody
RepairBillSaveVo
repairBillSaveVo
)
{
//判断装备的状态是否在库或维修中
deviceLibraryService
.
isInStockOrRepairing
(
StringSplitUtil
.
split
(
repairBillSaveVo
.
getRepairDeviceCheckDetail
()));
//第一次保存
if
(
repairBillSaveVo
.
getTaskId
()==
null
){
...
...
@@ -161,10 +162,13 @@ public class RepairController {
//添加维修单和送修单
RepairBill
repairBill
=
new
RepairBill
();
RepairSendBill
deviceRepairSendBillEntity
=
new
RepairSendBill
();
//相同字段直接拷贝
BeanUtils
.
copyProperties
(
repairBillSaveVo
,
repairBill
);
BeanUtils
.
copyProperties
(
repairBillSaveVo
,
deviceRepairSendBillEntity
);
//维修状态为草稿
repairBill
.
setRepairStatus
(
0
);
deviceRepairSendBillEntity
.
setRepairStatus
(
0
);
//set不相同的字段
if
(
repairBillSaveVo
.
getScriptSaveVos
()!=
null
){
deviceRepairSendBillEntity
.
setScriptJson
(
JacksonUtil
.
toJSon
(
repairBillSaveVo
.
getScriptSaveVos
()));
}
...
...
@@ -174,11 +178,12 @@ public class RepairController {
repairBill
.
setStartUserB
(
repairBillSaveVo
.
getAgent
());
repairBill
.
setStartUserA
(
userPublicService
.
getOne
(
repairBillSaveVo
.
getStartUseraId
()).
getName
());
RepairBill
repairBill1
=
deviceRepairBillService
.
addEntity
(
repairBill
);
//生成单据号
Calendar
calendar
=
Calendar
.
getInstance
();
String
s1
=
"NO:第"
+
calendar
.
get
(
Calendar
.
YEAR
)
+
"WX"
+
repairBill1
.
getId
()
+
"号"
;
repairBill1
.
setDocNum
(
s1
);
deviceRepairBillService
.
update
(
repairBill1
);
repairBill1
.
setDocNum
(
s1
);
//set 关联id
deviceRepairSendBillEntity
.
setDeviceRepairBillId
(
repairBill1
.
getId
());
deviceRepairSendBillService
.
addEntity
(
deviceRepairSendBillEntity
);
//发起任务
...
...
@@ -195,6 +200,7 @@ public class RepairController {
RepairSendBill
repairSendBill
=
deviceRepairSendBillDao
.
findByDeviceRepairBillId
(
repairBill1
.
getId
());
RepairBill
repairBill
=
new
RepairBill
();
RepairSendBill
deviceRepairSendBillEntity
=
new
RepairSendBill
();
//复制到新的二个对象
BeanUtils
.
copyProperties
(
repairBillSaveVo
,
repairBill
);
BeanUtils
.
copyProperties
(
repairBillSaveVo
,
deviceRepairSendBillEntity
);
repairBill
.
setRepairStatus
(
0
);
...
...
@@ -207,6 +213,7 @@ public class RepairController {
}
repairBill
.
setStartUserB
(
repairBillSaveVo
.
getAgent
());
repairBill
.
setStartUserA
(
userPublicService
.
getOne
(
repairBillSaveVo
.
getStartUseraId
()).
getName
());
//将新对象不为null的值拷贝到真实对象
MapperUtils
.
copyNoNullProperties
(
repairBill
,
repairBill1
);
MapperUtils
.
copyNoNullProperties
(
deviceRepairSendBillEntity
,
repairSendBill
);
deviceRepairBillService
.
update
(
repairBill1
);
...
...
@@ -219,12 +226,16 @@ public class RepairController {
@PostMapping
(
value
=
"/add"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
addRepairDevice
(
@RequestBody
List
<
Integer
>
ids
)
{
//判断是否在库
deviceLibraryService
.
isInStock
(
ids
);
//存放详情id
List
<
Integer
>
detailIds
=
new
ArrayList
<>();
for
(
Integer
integer:
ids
)
{
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
integer
);
//装备状态改成维修中
deviceLibraryEntity
.
setLifeStatus
(
4
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
//创建新的维修详情
RepairDetail
repairDetail
=
new
RepairDetail
();
repairDetail
.
setDeviceId
(
integer
);
repairDetail
.
setLocationUnit
(
userUtils
.
getCurrentUserUnitName
());
...
...
@@ -245,6 +256,7 @@ public class RepairController {
//发送阅知信息
List
<
Integer
>
userIds
=
userPublicService
.
findOtherUser
(
userUtils
.
getCurrentUserId
());
MessageBto
messageBto
=
new
MessageBto
(
0
,
5
,
"添加维修装备"
,
userIds
,
1
);
//阅知记录存放detailIds
messageBto
.
setRecord
(
StringSplitUtil
.
idListToString
(
detailIds
));
messageService
.
add
(
messageBto
);
return
ResponseEntity
.
ok
(
"添加成功"
);
...
...
@@ -254,13 +266,16 @@ public class RepairController {
@PostMapping
(
value
=
"/form"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
createRepair
(
@RequestBody
@Validated
RepairBillSaveVo
repairBillSaveVo
)
{
//判断装备状态是不是在库和维修中
deviceLibraryService
.
isInStockOrRepairing
(
StringSplitUtil
.
split
(
repairBillSaveVo
.
getRepairDeviceCheckDetail
()));
//存放详情id
List
<
Integer
>
detailIds
=
new
ArrayList
<>();
repairBillSaveVo
.
getDeviceList
().
forEach
(
deviceDetailVo
->
{
if
(
deviceDetailVo
.
getId
()!=
null
){
detailIds
.
add
(
deviceDetailVo
.
getId
());
}
});
//判断维修详情的状态
if
(
detailIds
.
size
()>
0
){
detailIds
.
forEach
(
integer
->
{
RepairDetail
repairDetail
=
deviceRepairDetailService
.
getOne
(
integer
);
...
...
@@ -274,6 +289,7 @@ public class RepairController {
//添加维修单和送修单
RepairBill
repairBill
;
RepairSendBill
deviceRepairSendBillEntity
;
//草稿发起的
if
(
repairBillSaveVo
.
getTaskId
()!=
null
){
repairBill
=
deviceRepairBillService
.
getOne
(
taskService
.
get
(
repairBillSaveVo
.
getTaskId
()).
getBillId
());
deviceRepairSendBillEntity
=
deviceRepairSendBillDao
.
findByDeviceRepairBillId
(
repairBill
.
getId
());
...
...
@@ -312,6 +328,7 @@ public class RepairController {
}
repairBill
.
setRightSignatureId
(
signId2
.
toString
());
RepairBill
repairBill1
=
deviceRepairBillService
.
update
(
repairBill
);
//生成单据号
Calendar
calendar
=
Calendar
.
getInstance
();
String
s1
=
"NO:第"
+
calendar
.
get
(
Calendar
.
YEAR
)
+
"WX"
+
repairBill1
.
getId
()
+
"号"
;
repairBill1
.
setDocNum
(
s1
);
...
...
@@ -320,12 +337,15 @@ public class RepairController {
List
<
Integer
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
userId
);
userIds
.
add
(
0
);
//
存业务日志
//
发送时间
deviceRepairSendBillEntity
.
setSendTime
(
new
Date
());
//存放维修装备id和维修原因的组合字段
StringBuffer
stringBuffer
=
new
StringBuffer
();
//存维修详情单
for
(
DeviceDetailVo
d
:
repairBillSaveVo
.
getDeviceList
())
{
//存放旧详情
RepairDetail
oldRepairDetail
=
null
;
//从待维修列表发起维修的
if
(
d
.
getId
()!=
null
)
{
oldRepairDetail
=
deviceRepairDetailService
.
getOne
(
d
.
getId
());
}
...
...
@@ -333,7 +353,9 @@ public class RepairController {
stringBuffer
.
append
(
"Ǵ"
);
stringBuffer
.
append
(
d
.
getRemark
());
stringBuffer
.
append
(
"Ǵ"
);
//获取装备信息
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
d
.
getDeviceId
());
//待维修列表当前单位自己添加的维修记录
if
(
oldRepairDetail
!=
null
&&
oldRepairDetail
.
getDeviceRepairBillId
()==
0
)
{
oldRepairDetail
.
setRemark
(
d
.
getRemark
());
oldRepairDetail
.
setDeviceRepairBillId
(
repairBill1
.
getId
());
...
...
@@ -342,7 +364,9 @@ public class RepairController {
}
else
{
RepairDetail
repairDetail
=
new
RepairDetail
();
//如果是下级待维修装备继续发起维修
if
(
d
.
getId
()
!=
null
)
{
//set父id
repairDetail
.
setPid
(
d
.
getId
());
RepairDetail
repairDetail1
=
deviceRepairDetailService
.
getOne
(
d
.
getId
());
repairDetail1
.
setRepairStatus
(
8
);
...
...
@@ -383,15 +407,21 @@ public class RepairController {
deviceRepairSendBillEntity
.
setSendFiles
(
FilesUtil
.
stringFileToList
(
repairBillSaveVo
.
getSendFileList
()));
}
RepairSendBill
repairSendBill
=
deviceRepairSendBillService
.
update
(
deviceRepairSendBillEntity
);
//业务的待办所属单位
Integer
ownUnit
;
//保存后的taskBto
TaskBto
saveEntity
;
//当前单位其他专管员id集合
List
<
Integer
>
ids
=
userPublicService
.
findOtherUser
(
userUtils
.
getCurrentUserId
());
//省向国家发起的
if
(
level
==
1
)
{
ownUnit
=
userUtils
.
getCurrentUnitId
();
//直接发起的
if
(
repairBillSaveVo
.
getTaskId
()==
null
)
{
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_FILE
.
id
,
"维修业务"
,
null
,
"."
,
repairBill1
.
getId
(),
5
,
ownUnit
,
1
,
"country"
,
userIds
);
saveEntity
=
taskService
.
start
(
taskBto
);
}
//从草稿发起的
else
{
TaskBto
taskBto1
=
taskService
.
get
(
repairBillSaveVo
.
getTaskId
());
taskBto1
.
setCustomInfo
(
"country"
);
...
...
@@ -399,21 +429,26 @@ public class RepairController {
}
}
else
{
ownUnit
=
userPublicService
.
findUnitIdByName
(
repairBill
.
getReceiveUnit
());
//直接发起的
if
(
repairBillSaveVo
.
getTaskId
()==
null
)
{
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_RECEIVE
.
id
,
"维修业务"
,
null
,
"."
,
repairBill1
.
getId
(),
5
,
ownUnit
,
1
,
null
,
userIds
);
saveEntity
=
taskService
.
start
(
taskBto
);
}
//从草稿发起的
else
{
TaskBto
taskBto1
=
taskService
.
get
(
repairBillSaveVo
.
getTaskId
());
taskBto1
.
setOwnUnit
(
ownUnit
);
saveEntity
=
taskService
.
moveToSpecial
(
taskBto1
,
StatusEnum
.
WAIT_RECEIVE
);
}
//阅知集合加上收件单位所有专管员
ids
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
repairBill
.
getReceiveUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
//生成子任务(发件方上传回执单)
TaskBto
taskBto2
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_SEND_FILE
.
id
,
"维修业务"
,
saveEntity
.
getId
(),
saveEntity
.
getNodeIdDetail
()
+
saveEntity
.
getId
()
+
"."
,
saveEntity
.
getBillId
(),
5
,
userPublicService
.
findUnitIdByName
(
repairSendBill
.
getSendUnit
()),
0
,
null
,
Collections
.
singletonList
(
0
));
taskService
.
start
(
taskBto2
);
}
//获取装备id集合
String
deviceIdDetail
=
deviceRepairSendBillEntity
.
getRepairDeviceCheckDetail
();
List
<
Integer
>
idList
=
StringSplitUtil
.
split
(
deviceIdDetail
);
//如果当前为省,改变装备的所在为中办
...
...
@@ -425,6 +460,7 @@ public class RepairController {
repairDetail
.
setLocationUnit
(
repairBillSaveVo
.
getReceiveUnit
());
repairDetail
.
setRepairStatus
(
1
);
deviceRepairDetailService
.
update
(
repairDetail
);
//同时改变所有父节点的所在单位
if
(
repairDetail
.
getPid
()!=
null
){
RepairDetail
repairDetail1
=
deviceRepairDetailService
.
getOne
(
repairDetail
.
getPid
());
repairDetail1
.
setLocationUnit
(
repairBill
.
getReceiveUnit
());
...
...
@@ -465,6 +501,7 @@ public class RepairController {
public
ResponseEntity
receiveDevice
(
@RequestBody
@Validated
RepairReceiveVo
repairReceiveVo
)
{
//获取当前任务
TaskBto
taskBto
=
taskService
.
get
(
repairReceiveVo
.
getTaskId
());
//判断业务当前状态
List
<
StatusEnum
>
statusEnums
=
new
ArrayList
<>();
statusEnums
.
add
(
StatusEnum
.
WAIT_RECEIVE
);
statusEnums
.
add
(
StatusEnum
.
REPAIR_SEND_WAIT_SIGN
);
...
...
@@ -475,6 +512,7 @@ public class RepairController {
RepairSendBill
repairSendBill
=
deviceRepairSendBillDao
.
findByDeviceRepairBillId
(
repairBill
.
getId
());
String
deviceIdDetail
=
repairReceiveVo
.
getReceiveCheckDetail
();
List
<
RepairDetail
>
repairDetailEntities
=
deviceRepairDetailService
.
findByBillId
(
repairBill
.
getId
());
//如果盖章了set接收方签章id
if
(
repairReceiveVo
.
getRightSignatureId
()!=
null
&&!
""
.
equals
(
repairReceiveVo
.
getRightSignatureId
())){
repairBill
.
setRightSignatureId
(
repairReceiveVo
.
getRightSignatureId
());
}
...
...
@@ -483,6 +521,7 @@ public class RepairController {
repairSendBill
.
setRepairUseraId
(
userId
);
taskService
.
addInvolveUser
(
taskBto
,
userId
);
}
//阅知人员id集合
List
<
Integer
>
ids
=
userPublicService
.
findOtherUser
(
userUtils
.
getCurrentUserId
());
ids
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
repairBill
.
getSendUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
...
...
@@ -510,6 +549,7 @@ public class RepairController {
repairSendBill
.
setRepairReciveCheckDetail
(
repairReceiveVo
.
getReceiveCheckDetail
());
repairSendBill
.
setRepairReciveCheckResult
(
repairReceiveVo
.
getReceiveCheckResult
());
repairSendBill
.
setRepairUserbId
(
repairReceiveVo
.
getReceiveUserbId
());
//单据不缺少,直接办结
if
(
repairReceiveVo
.
getStatus
()==
0
)
{
if
(
repairReceiveVo
.
getReceiveFiles
()!=
null
&&
repairReceiveVo
.
getReceiveFiles
().
size
()>
0
){
repairReceiveVo
.
getReceiveFiles
().
forEach
(
fileRet
->
{
...
...
@@ -525,6 +565,7 @@ public class RepairController {
messageService
.
add
(
messageBto
);
}
else
{
//推到待上传签收单状态
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
WAIT_UPLOAD_FILE
);
}
deviceRepairSendBillService
.
update
(
repairSendBill
);
...
...
@@ -566,6 +607,7 @@ public class RepairController {
repairDetail
.
setLocationUnit
(
repairBill
.
getReceiveUnit
());
repairDetail
.
setRepairStatus
(
1
);
deviceRepairDetailService
.
update
(
repairDetail
);
//改变父详情的所在
if
(
repairDetail
.
getPid
()!=
null
){
RepairDetail
repairDetail1
=
deviceRepairDetailService
.
getOne
(
repairDetail
.
getPid
());
repairDetail1
.
setLocationUnit
(
repairBill
.
getReceiveUnit
());
...
...
@@ -595,9 +637,10 @@ public class RepairController {
@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
);
RepairBill
repairBill
=
deviceRepairBillService
.
getOne
(
taskBto
.
getBillId
());
//如果是接收方申请盖章
if
(
repairBill
.
getRepairStatus
()!=
0
){
RepairSendBill
repairSendBill
=
deviceRepairSendBillDao
.
findByDeviceRepairBillId
(
repairBill
.
getId
());
repairSendBill
.
setRepairUseraId
(
userUtils
.
getCurrentUserId
());
...
...
@@ -611,6 +654,7 @@ public class RepairController {
else
{
taskBto
.
setRemark
(
"出库盖章"
);
}
//推动任务
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
REPAIR_SEND_SIGN_WAIT_CONFIRM
,
userId
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"申请成功"
);
...
...
@@ -620,17 +664,20 @@ public class RepairController {
@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
);
RepairBill
repairBill
=
deviceRepairBillService
.
getOne
(
taskBto
.
getBillId
());
RepairSendBill
repairSendBill
=
deviceRepairSendBillDao
.
findByDeviceRepairBillId
(
repairBill
.
getId
());
//审核通过
if
(
status
==
1
){
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
REPAIR_SEND_WAIT_SIGN
);
//发件方盖章
if
(
repairBill
.
getRepairStatus
()==
0
)
{
repairSendBill
.
setStartUserbId
(
userUtils
.
getCurrentUserId
());
repairSendBill
.
setAgent
(
userUtils
.
getCurrentName
());
repairBill
.
setStartUserB
(
repairSendBill
.
getAgent
());
}
//收件方盖章
else
{
repairSendBill
.
setRepairUserbId
(
userUtils
.
getCurrentUserId
());
repairBill
.
setRepairUserB
(
userUtils
.
getCurrentName
());
...
...
@@ -639,10 +686,14 @@ public class RepairController {
deviceRepairSendBillService
.
update
(
repairSendBill
);
}
else
{
//发件方盖章
if
(
repairBill
.
getRepairStatus
()==
0
)
{
//推到草稿状态
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
REPAIR_SEND_DRAFT
,
taskBto
.
getCreateUserId
());
}
//收件方盖章
else
{
//推到待接收状态
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
WAIT_RECEIVE
,
repairSendBill
.
getRepairUseraId
());
}
}
...
...
@@ -650,73 +701,71 @@ public class RepairController {
return
ResponseEntity
.
ok
(
"申请成功"
);
}
@ApiOperation
(
value
=
"上传送修单"
,
notes
=
"可以通过这个接口上传送修单"
)
@ApiOperation
(
value
=
"上传
接收方
送修单"
,
notes
=
"可以通过这个接口上传送修单"
)
@PostMapping
(
value
=
"/uploadRepairBill"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
uploadRepairBill
(
@RequestBody
@Validated
FileUploadVo
fileUploadVo
){
TaskBto
taskBto
=
taskService
.
get
(
fileUploadVo
.
getTaskId
());
//判断业务状态
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
StatusEnum
.
WAIT_UPLOAD_FILE
);
Integer
userId
=
userUtils
.
getCurrentUserId
();
taskService
.
addInvolveUser
(
taskBto
,
userId
);
//不上传单据
if
(
fileUploadVo
.
getStatus
()==
0
){
taskService
.
moveToArchive
(
taskBto
);
}
else
{
RepairBill
repairBill
=
deviceRepairBillService
.
getOne
(
taskBto
.
getBillId
());
RepairSendBill
repairSendBill
=
deviceRepairSendBillDao
.
findByDeviceRepairBillId
(
taskBto
.
getBillId
());
List
<
Integer
>
ids
=
userPublicService
.
findOtherUser
(
userId
);
ids
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
repairSendBill
.
getSendUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
taskService
.
moveToEnd
(
taskBto
);
taskService
.
moveAllSonNodeToEnd
(
taskBto
.
getId
());
//阅知
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"业务办结"
,
ids
,
1
);
messageService
.
add
(
messageBto
);
repairSendBill
.
setBillFileName
(
fileUploadVo
.
getBillFileName
());
repairSendBill
.
setBillFileUrl
(
fileUploadVo
.
getBillFileUrl
());
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
if
(
fileUploadVo
.
getReceiveFiles
()!=
null
&&
fileUploadVo
.
getReceiveFiles
().
size
()>
0
){
fileUploadVo
.
getReceiveFiles
().
forEach
(
fileRet
->
{
fileVoList
.
add
(
new
FileVo
(
"维修单"
,
fileRet
.
getName
(),
fileRet
.
getPreviewPath
()));
});
repairSendBill
.
setReceiveFiles
(
FilesUtil
.
stringFileToList
(
fileUploadVo
.
getReceiveFiles
()));
}
if
(
fileUploadVo
.
getStartUserbId
()!=
null
){
String
s
=
userPublicService
.
getOne
(
fileUploadVo
.
getStartUserbId
()).
getName
();
repairBill
.
setStartUserB
(
s
);
repairSendBill
.
setStartUserbId
(
fileUploadVo
.
getStartUserbId
());
repairSendBill
.
setAgent
(
s
);
MessageBto
messageBto1
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
Collections
.
singletonList
(
fileUploadVo
.
getStartUserbId
()),
1
);
messageService
.
add
(
messageBto1
);
}
if
(
fileUploadVo
.
getRepairUserbId
()!=
null
){
repairSendBill
.
setRepairUserbId
(
fileUploadVo
.
getRepairUserbId
());
repairBill
.
setRepairUserB
(
userPublicService
.
getOne
(
fileUploadVo
.
getRepairUserbId
()).
getName
());
MessageBto
messageBto2
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
Collections
.
singletonList
(
fileUploadVo
.
getRepairUserbId
()),
1
);
messageService
.
add
(
messageBto2
);
}
if
(
fileUploadVo
.
getRepairUseraId
()!=
null
){
repairSendBill
.
setRepairUseraId
(
fileUploadVo
.
getRepairUseraId
());
repairBill
.
setRepairUserA
(
userPublicService
.
getOne
(
fileUploadVo
.
getRepairUseraId
()).
getName
());
// MessageBto messageBto2 = new MessageBto(taskBto.getId(), taskBto.getBusinessType(), "被选为经办人", Collections.singletonList(fileUploadVo.getRepairUserbId()), 1);
// messageService.add(messageBto2);
}
deviceRepairBillService
.
update
(
repairBill
);
deviceRepairSendBillService
.
update
(
repairSendBill
);
//添加装备日志
List
<
Integer
>
deviceIds
=
StringSplitUtil
.
split
(
repairSendBill
.
getRepairDeviceCheckDetail
());
deviceIds
.
forEach
(
integer
->
{
//存装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
integer
,
"上传送修单据"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
//获取账单
RepairBill
repairBill
=
deviceRepairBillService
.
getOne
(
taskBto
.
getBillId
());
RepairSendBill
repairSendBill
=
deviceRepairSendBillDao
.
findByDeviceRepairBillId
(
taskBto
.
getBillId
());
//阅知人员
List
<
Integer
>
ids
=
userPublicService
.
findOtherUser
(
userId
);
ids
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
repairSendBill
.
getSendUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
//当前业务和子业务办结
taskService
.
moveToEnd
(
taskBto
);
taskService
.
moveAllSonNodeToEnd
(
taskBto
.
getId
());
//阅知
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"业务办结"
,
ids
,
1
);
messageService
.
add
(
messageBto
);
repairSendBill
.
setBillFileName
(
fileUploadVo
.
getBillFileName
());
repairSendBill
.
setBillFileUrl
(
fileUploadVo
.
getBillFileUrl
());
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
if
(
fileUploadVo
.
getReceiveFiles
()!=
null
&&
fileUploadVo
.
getReceiveFiles
().
size
()>
0
){
fileUploadVo
.
getReceiveFiles
().
forEach
(
fileRet
->
{
fileVoList
.
add
(
new
FileVo
(
"维修单"
,
fileRet
.
getName
(),
fileRet
.
getPreviewPath
()));
});
repairSendBill
.
setReceiveFiles
(
FilesUtil
.
stringFileToList
(
fileUploadVo
.
getReceiveFiles
()));
}
//签发人
if
(
fileUploadVo
.
getStartUserbId
()!=
null
){
String
s
=
userPublicService
.
getOne
(
fileUploadVo
.
getStartUserbId
()).
getName
();
repairBill
.
setStartUserB
(
s
);
repairSendBill
.
setStartUserbId
(
fileUploadVo
.
getStartUserbId
());
repairSendBill
.
setAgent
(
s
);
MessageBto
messageBto1
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
Collections
.
singletonList
(
fileUploadVo
.
getStartUserbId
()),
1
);
messageService
.
add
(
messageBto1
);
}
//收件方经办人
if
(
fileUploadVo
.
getRepairUserbId
()!=
null
){
repairSendBill
.
setRepairUserbId
(
fileUploadVo
.
getRepairUserbId
());
repairBill
.
setRepairUserB
(
userPublicService
.
getOne
(
fileUploadVo
.
getRepairUserbId
()).
getName
());
MessageBto
messageBto2
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
Collections
.
singletonList
(
fileUploadVo
.
getRepairUserbId
()),
1
);
messageService
.
add
(
messageBto2
);
}
if
(
fileUploadVo
.
getRepairUseraId
()!=
null
){
repairSendBill
.
setRepairUseraId
(
fileUploadVo
.
getRepairUseraId
());
repairBill
.
setRepairUserA
(
userPublicService
.
getOne
(
fileUploadVo
.
getRepairUseraId
()).
getName
());
}
deviceRepairBillService
.
update
(
repairBill
);
deviceRepairSendBillService
.
update
(
repairSendBill
);
//添加装备日志
List
<
Integer
>
deviceIds
=
StringSplitUtil
.
split
(
repairSendBill
.
getRepairDeviceCheckDetail
());
deviceIds
.
forEach
(
integer
->
{
//存装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
integer
,
"上传送修单据"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
});
return
ResponseEntity
.
ok
(
"上传成功"
);
}
@ApiOperation
(
value
=
"保存维修退回操作"
,
notes
=
"可以通过这个接口保存维修退回操作"
)
@ApiOperation
(
value
=
"保存维修退回操作
(草稿)
"
,
notes
=
"可以通过这个接口保存维修退回操作"
)
@PostMapping
(
value
=
"/saveRepairBackBill"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
saveRepairBackBill
(
@RequestBody
RepairBackBillSaveVo
repairBackBillSaveVo
)
{
...
...
@@ -759,12 +808,14 @@ public class RepairController {
@PostMapping
(
value
=
"/back"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
repairBack
(
@RequestBody
@Validated
RepairBackBillSaveVo
repairBackBillSaveVo
)
{
//存放详情id
List
<
Integer
>
detailIds
=
new
ArrayList
<>();
repairBackBillSaveVo
.
getDeviceList
().
forEach
(
deviceDetailVo
->
{
if
(
deviceDetailVo
.
getId
()!=
null
){
detailIds
.
add
(
deviceDetailVo
.
getId
());
}
});
//判断维修记录的状态
if
(
detailIds
.
size
()>
0
){
detailIds
.
forEach
(
integer
->
{
RepairDetail
repairDetail
=
deviceRepairDetailService
.
getOne
(
integer
);
...
...
@@ -777,6 +828,7 @@ public class RepairController {
Integer
userId
=
userUtils
.
getCurrentUserId
();
//生成维修退回单
RepairBackBill
repairBackBill
;
//草稿发起
if
(
repairBackBillSaveVo
.
getTaskId
()!=
null
){
repairBackBill
=
deviceRepairBackBillService
.
getOne
(
taskService
.
get
(
repairBackBillSaveVo
.
getTaskId
()).
getBillId
());
MapperUtils
.
copyNoNullProperties
(
repairBackBillSaveVo
,
repairBackBill
);
...
...
@@ -809,6 +861,7 @@ public class RepairController {
userIds
.
add
(
userId
);
userIds
.
add
(
0
);
TaskBto
task
;
//草稿发起
if
(
repairBackBillSaveVo
.
getTaskId
()==
null
)
{
TaskBto
taskBto1
=
new
TaskBto
(
StatusEnum
.
WAIT_BACK_RECEIVE
.
id
,
"维修退回"
,
null
,
"."
,
deviceRepairBackBillEntity1
.
getId
(),
BusinessEnum
.
REPAIR_BACK
.
id
,
userPublicService
.
findUnitIdByName
(
repairBackBill
.
getReceiveUnit
()),
1
,
null
,
userIds
);
task
=
taskService
.
start
(
taskBto1
);
...
...
@@ -822,7 +875,7 @@ public class RepairController {
taskService
.
start
(
taskBto2
);
//添加业务日志
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
//添加装备日志
//
更新装备和详情的状态,
添加装备日志
for
(
DeviceDetailVo
d
:
repairBackBillSaveVo
.
getDeviceList
())
{
RepairDetail
repairDetail
=
deviceRepairDetailService
.
getOne
(
d
.
getId
());
repairDetail
.
setRepairBackBillId
(
deviceRepairBackBillEntity1
.
getId
());
...
...
@@ -865,6 +918,7 @@ public class RepairController {
Integer
userId
=
userUtils
.
getCurrentUserId
();
//获取退回单和装备id
RepairBackBill
repairBackBill
;
//正常退回接收
if
(
repairReceiveVo
.
getTaskId
()!=
null
)
{
taskBto
=
taskService
.
get
(
repairReceiveVo
.
getTaskId
());
List
<
StatusEnum
>
statusEnums
=
new
ArrayList
<>();
...
...
@@ -873,7 +927,10 @@ public class RepairController {
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
statusEnums
);
taskService
.
addInvolveUser
(
taskBto
,
userId
);
repairBackBill
=
deviceRepairBackBillService
.
getOne
(
taskBto
.
getBillId
());
}
else
{
}
//中办维修完成接收入库
else
{
//新生成业务和账单
taskBto
=
new
TaskBto
();
repairBackBill
=
new
RepairBackBill
();
repairBackBill
.
setSendUnit
(
deviceLibraryService
.
getOne
(
repairReceiveVo
.
getDeviceList
().
get
(
0
).
getDeviceId
()).
getLocationUnit
());
...
...
@@ -920,10 +977,14 @@ public class RepairController {
String
s1
=
"NO:第"
+
calendar
.
get
(
Calendar
.
YEAR
)
+
"LQ"
+
repairBackBill
.
getId
()
+
"号"
;
repairBackBill1
.
setDocNum
(
s1
);
deviceRepairBackBillService
.
save
(
repairBackBill1
);
//保存后的taskBto
TaskBto
taskBto2
;
//key为单位id,value为该单位维修完成的装备维修详情id的用来发阅知的map
Map
<
Integer
,
List
<
Integer
>>
messageMap
=
new
HashMap
<>();
//中办维修完成接收入库
if
(
repairReceiveVo
.
getTaskId
()==
null
)
{
List
<
Integer
>
userIds
=
new
ArrayList
<>();
//不缺少单据直接办结
if
(
repairReceiveVo
.
getStatus
()==
0
)
{
userIds
.
add
(
userId
);
TaskBto
taskBto1
=
new
TaskBto
(
StatusEnum
.
END
.
id
,
"维修退回"
,
null
,
"."
,
repairBackBill1
.
getId
(),
BusinessEnum
.
REPAIR_BACK
.
id
,
userUtils
.
getCurrentUnitId
(),
0
,
"country"
,
userIds
);
...
...
@@ -934,21 +995,27 @@ public class RepairController {
TaskBto
taskBto1
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_BACK_FILE
.
id
,
"维修退回"
,
null
,
"."
,
repairBackBill1
.
getId
(),
BusinessEnum
.
REPAIR_BACK
.
id
,
userUtils
.
getCurrentUnitId
(),
0
,
"country"
,
userIds
);
taskBto2
=
taskService
.
start
(
taskBto1
);
}
//遍历改变维修详情
for
(
DeviceDetailVo
d
:
repairReceiveVo
.
getDeviceList
())
{
RepairDetail
repairDetail
=
deviceRepairDetailService
.
getOne
(
d
.
getId
());
//set领取单id
repairDetail
.
setRepairBackBillId
(
repairBackBill1
.
getId
());
repairDetail
.
setRepairStatus
(
5
);
repairDetail
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
//同时改变所有父节点的维修状态和所在单位
if
(
repairDetail
.
getPid
()!=
null
)
{
RepairDetail
repairDetail1
=
deviceRepairDetailService
.
getOne
(
repairDetail
.
getPid
());
repairDetail1
.
setRepairStatus
(
2
);
repairDetail1
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
deviceRepairDetailService
.
update
(
repairDetail1
);
//该维修记录发件单位
Integer
unitId
=
userPublicService
.
getOne
(
repairDetail1
.
getCreateUserId
()).
getUnitsId
();
//如果map不存在该单位id,直接put
if
(
messageMap
.
get
(
unitId
)==
null
)
{
messageMap
.
put
(
unitId
,
Collections
.
singletonList
(
repairDetail1
.
getId
()));
}
else
{
//get添加后再重新set
List
<
Integer
>
ids
=
new
ArrayList
<>(
messageMap
.
getOrDefault
(
unitId
,
new
ArrayList
<>()));
ids
.
add
(
repairDetail1
.
getId
());
messageMap
.
put
(
unitId
,
ids
);
...
...
@@ -962,6 +1029,7 @@ public class RepairController {
deviceRepairDetailService
.
update
(
repairDetail
);
}
}
else
{
//不缺少单据
if
(
repairReceiveVo
.
getStatus
()==
0
)
{
taskBto2
=
taskService
.
moveToEnd
(
taskBto
);
//子任务完结
...
...
@@ -972,6 +1040,7 @@ public class RepairController {
}
//获取维修详情
List
<
RepairDetail
>
repairDetailList
=
repairDetailDao
.
findByRepairBackBillId
(
repairBackBill
.
getId
());
//改变该维修详情及所有父详情
repairDetailList
.
forEach
(
repairDetail
->
{
repairDetail
.
setRepairStatus
(
5
);
repairDetail
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
...
...
@@ -1007,6 +1076,7 @@ public class RepairController {
//更改装备状态
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
deviceLibraryEntity
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
//如果所属和所在一致,状态改为在库
if
(
deviceLibraryEntity
.
getOwnUnit
().
equals
(
deviceLibraryEntity
.
getLocationUnit
()))
{
deviceLibraryEntity
.
setLifeStatus
(
2
);
}
...
...
@@ -1051,12 +1121,14 @@ public class RepairController {
String
message
=
repairReceiveVo
.
getStatus
()==
0
?
"业务办结"
:
"接收维修领取装备"
;
MessageBto
messageBto
=
new
MessageBto
(
taskBto2
.
getId
(),
taskBto2
.
getBusinessType
(),
message
,
ids
,
1
);
messageService
.
add
(
messageBto
);
//遍历map依次发送阅知
messageMap
.
keySet
().
forEach
(
integer
->
{
List
<
Integer
>
integerList
=
new
ArrayList
<>();
integerList
.
addAll
(
userDao
.
findAllByUnitsId
(
integer
).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
MessageBto
messageBto2
=
new
MessageBto
(
0
,
5
,
"待领取送修装备"
,
integerList
);
//存放详情id集合
messageBto2
.
setRecord
(
StringSplitUtil
.
idListToString
(
messageMap
.
get
(
integer
)));
messageService
.
add
(
messageBto2
);
});
...
...
@@ -1068,9 +1140,10 @@ public class RepairController {
@PostMapping
(
value
=
"/backApplySign/{taskId}/{userId}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
backApplySign
(
@PathVariable
(
"taskId"
)
int
taskId
,
@PathVariable
(
"userId"
)
int
userId
)
{
//
推动任务
//
获取业务和账单
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
RepairBackBill
repairBackBill
=
deviceRepairBackBillService
.
getOne
(
taskBto
.
getBillId
());
//接收方申请盖章
if
(
repairBackBill
.
getBackStatus
()!=
0
){
repairBackBill
.
setReceiveUseraId
(
userUtils
.
getCurrentUserId
());
deviceRepairBackBillService
.
update
(
repairBackBill
);
...
...
@@ -1081,6 +1154,7 @@ public class RepairController {
else
{
taskBto
.
setRemark
(
"出库盖章"
);
}
//推动任务
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
REPAIR_BACK_SIGN_WAIT_CONFIRM
,
userId
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"申请成功"
);
...
...
@@ -1090,24 +1164,30 @@ public class RepairController {
@PostMapping
(
value
=
"/backApplySignConfirm/{taskId}/{status}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
backApplySignConfirm
(
@PathVariable
(
"taskId"
)
int
taskId
,
@PathVariable
(
"status"
)
int
status
)
{
//
推动任务
//
获取业务和账单
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
RepairBackBill
repairBackBill
=
deviceRepairBackBillService
.
getOne
(
taskBto
.
getBillId
());
//同意盖章
if
(
status
==
1
){
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
REPAIR_BACK_WAIT_SIGN
);
//发件方盖章
if
(
repairBackBill
.
getBackStatus
()==
0
)
{
repairBackBill
.
setStartUserbId
(
userUtils
.
getCurrentUserId
());
repairBackBill
.
setAgent
(
userUtils
.
getCurrentName
());
}
//收件方
else
{
repairBackBill
.
setReceiveUserbId
(
userUtils
.
getCurrentUserId
());
}
deviceRepairBackBillService
.
update
(
repairBackBill
);
}
//不同意
else
{
//出库推至草稿状态
if
(
repairBackBill
.
getBackStatus
()==
0
)
{
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
REPAIR_BACK_DRAFT
,
taskBto
.
getCreateUserId
());
}
//入库推至待接收装备状态
else
{
taskService
.
moveToSpecial
(
taskBto
,
StatusEnum
.
WAIT_BACK_RECEIVE
,
repairBackBill
.
getReceiveUseraId
());
}
...
...
@@ -1116,19 +1196,23 @@ public class RepairController {
return
ResponseEntity
.
ok
(
"申请成功"
);
}
@ApiOperation
(
value
=
"
上传回执单"
,
notes
=
"可以通过这个接口上传回执
单"
)
@ApiOperation
(
value
=
"
接收方上传领取单"
,
notes
=
"可以通过这个接口上传领取
单"
)
@PostMapping
(
value
=
"/uploadRepairBackBill"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
uploadRepairBackBill
(
@RequestBody
@Validated
FileUploadVo
fileUploadVo
){
//获取业务
TaskBto
taskBto
=
taskService
.
get
(
fileUploadVo
.
getTaskId
());
//判断业务状态
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
StatusEnum
.
WAIT_UPLOAD_BACK_FILE
);
Integer
userId
=
userUtils
.
getCurrentUserId
();
taskService
.
addInvolveUser
(
taskBto
,
userId
);
RepairBackBill
repairBackBill
=
deviceRepairBackBillService
.
getOne
(
taskBto
.
getBillId
());
//阅知人员集合
List
<
Integer
>
ids
=
userPublicService
.
findOtherUser
(
userId
);
ids
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
repairBackBill
.
getSendUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
//该业务和子业务办结
taskService
.
moveToEnd
(
taskBto
);
taskService
.
moveAllSonNodeToEnd
(
taskBto
.
getId
());
//阅知
...
...
@@ -1136,12 +1220,14 @@ public class RepairController {
messageService
.
add
(
messageBto
);
repairBackBill
.
setBillFileName
(
fileUploadVo
.
getBillFileName
());
repairBackBill
.
setBillFileUrl
(
fileUploadVo
.
getBillFileUrl
());
//签发人阅知
if
(
fileUploadVo
.
getStartUserbId
()!=
null
){
repairBackBill
.
setStartUserbId
(
fileUploadVo
.
getStartUserbId
());
repairBackBill
.
setAgent
(
userPublicService
.
getOne
(
fileUploadVo
.
getStartUserbId
()).
getName
());
MessageBto
messageBto1
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
Collections
.
singletonList
(
fileUploadVo
.
getStartUserbId
()),
1
);
messageService
.
add
(
messageBto1
);
}
//经办人阅知
if
(
fileUploadVo
.
getReceiveUserbId
()!=
null
){
repairBackBill
.
setReceiveUserbId
(
fileUploadVo
.
getReceiveUserbId
());
MessageBto
messageBto2
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
Collections
.
singletonList
(
fileUploadVo
.
getReceiveUserbId
()),
1
);
...
...
@@ -1169,12 +1255,14 @@ public class RepairController {
@PostMapping
(
value
=
"/change"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
changeRepairDeviceStatus
(
@RequestBody
@Validated
RepairStatusChangeVo
repairStatusChangeVo
)
{
//判断维修记录的维修状态
repairStatusChangeVo
.
getId
().
forEach
(
integer
->
{
RepairDetail
repairDetail
=
deviceRepairDetailService
.
getOne
(
integer
);
if
(
repairDetail
.
getRepairStatus
()!=
1
&&
repairDetail
.
getRepairStatus
()!=
9
){
throw
new
ApiException
(
ResponseEntity
.
status
(
303
).
body
(
"序列号"
+
repairDetail
.
getSeqNumber
()+
"的装备已被其他专管员操作"
));
}
});
//各单位阅知map
Map
<
Integer
,
List
<
Integer
>>
messageMap
=
new
HashMap
<>();
for
(
Integer
id
:
repairStatusChangeVo
.
getId
())
{
//获取维修详情单
...
...
@@ -1219,10 +1307,13 @@ public class RepairController {
//装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
repairDetail1
.
getDeviceId
(),
remark
,
fileVos
);
deviceLogService
.
addLog
(
deviceLogDto
);
//如果状态改为了待领取
if
(
repairStatusChangeVo
.
getNewStatus
()
==
2
)
{
Integer
unitId
=
userPublicService
.
getOne
(
repairDetail1
.
getCreateUserId
()).
getUnitsId
();
//存在父节点
if
(
repairDetail1
.
getPid
()
!=
null
)
{
RepairDetail
repairDetail
=
deviceRepairDetailService
.
getOne
(
repairDetail1
.
getPid
());
//往map里插入该单位的维修详情id
if
(
messageMap
.
get
(
unitId
)
==
null
)
{
messageMap
.
put
(
unitId
,
Collections
.
singletonList
(
repairDetail
.
getId
()));
}
else
{
...
...
@@ -1242,6 +1333,7 @@ public class RepairController {
}
}
}
//根据map每个单位发阅知
messageMap
.
keySet
().
forEach
(
integer
->
{
List
<
Integer
>
ids2
=
new
ArrayList
<>();
ids2
.
addAll
(
userDao
.
findAllByUnitsId
(
integer
).
stream
()
...
...
@@ -1254,74 +1346,6 @@ public class RepairController {
return
ResultUtil
.
success
(
"修改成功"
);
}
@ApiOperation
(
value
=
"维修换新设备"
,
notes
=
"可以通过这个接口维修换新设备"
)
@PostMapping
(
value
=
"/change/new"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
changeNewDevice
(
@RequestBody
@Validated
ChangeNewDeviceVo
changeNewDeviceVo
)
{
//获取当前任务
TaskBto
taskBto
=
taskService
.
get
(
changeNewDeviceVo
.
getTaskId
());
//获取当前单位
String
unit
=
userUtils
.
getCurrentUserUnitName
();
//获取所有父任务id
List
<
Integer
>
fathers
=
StringSplitUtil
.
taskIdSplit
(
taskBto
.
getNodeIdDetail
());
//获取维修详情单
RepairDetail
repairDetail1
=
deviceRepairDetailService
.
getOne
(
changeNewDeviceVo
.
getId
());
//获取原装备
DeviceLibrary
originDevice
=
deviceLibraryService
.
getOne
(
repairDetail1
.
getDeviceId
());
//获取换新装备
DeviceLibrary
deviceLibrary
=
deviceLibraryService
.
getOne
(
changeNewDeviceVo
.
getDeviceId
());
//判断当前装备是否已报废
if
(
repairDetail1
.
getNewDeviceDetailId
()
!=
null
&&
repairDetail1
.
getNewDeviceDetailId
()
==
0
)
{
//添加新的维修装备详情
RepairDetail
repairDetail
=
new
RepairDetail
();
repairDetail
.
setModel
(
deviceLibrary
.
getModel
());
repairDetail
.
setName
(
deviceLibrary
.
getName
());
repairDetail
.
setType
(
deviceLibrary
.
getType
());
repairDetail
.
setDeviceRepairBillId
(
repairDetail1
.
getDeviceRepairBillId
());
repairDetail
.
setOwnUnit
(
repairDetail1
.
getOwnUnit
());
repairDetail
.
setLocationUnit
(
repairDetail1
.
getLocationUnit
());
if
(
changeNewDeviceVo
.
getType
()
==
0
)
{
repairDetail
.
setRepairStatus
(
RepairStatusEnum
.
CHANGE_NEW
.
id
);
}
else
{
repairDetail
.
setRepairStatus
(
RepairStatusEnum
.
CHANGE_NEW_DEVICE
.
id
);
}
repairDetail
.
setDeviceId
(
changeNewDeviceVo
.
getDeviceId
());
repairDetail
.
setNewDeviceDetailId
(
null
);
repairDetail
.
setRfidSurfaceId
(
deviceLibrary
.
getRfidSurfaceId
());
repairDetail
.
setSeqNumber
(
deviceLibrary
.
getSeqNumber
());
//当前业务和父任务添加该详情
RepairDetail
repairDetail8
=
deviceRepairDetailService
.
save
(
repairDetail
);
repairDetail1
.
setNewDeviceDetailId
(
repairDetail8
.
getId
());
deviceRepairDetailService
.
update
(
repairDetail1
);
fathers
.
forEach
(
integer
->
{
RepairBill
repairBill
=
deviceRepairBillService
.
getOne
(
taskService
.
get
(
integer
).
getBillId
());
RepairDetail
repairDetail2
=
new
RepairDetail
();
BeanUtils
.
copyProperties
(
repairDetail
,
repairDetail2
);
repairDetail2
.
setId
(
null
);
repairDetail2
.
setDeviceRepairBillId
(
repairBill
.
getId
());
deviceRepairDetailService
.
save
(
repairDetail2
);
});
//改变装备的所属
deviceLibrary
.
setOwnUnit
(
repairDetail
.
getOwnUnit
());
deviceLibraryService
.
update
(
deviceLibrary
);
//如果是新装备换新,添加换新记录
if
(
changeNewDeviceVo
.
getType
()
==
1
)
{
DeviceChange
deviceChange
=
new
DeviceChange
();
deviceChange
.
setNewDeviceId
(
deviceLibrary
.
getId
());
deviceChange
.
setOldDeviceId
(
originDevice
.
getId
());
deviceChangeService
.
add
(
deviceChange
);
}
//添加业务日志
String
remark
=
"添加维修换新装备"
+
deviceLibrary
.
getName
();
TaskLogBto
taskLogBto
=
new
TaskLogBto
(
taskBto
.
getId
(),
remark
,
null
);
taskLogService
.
addLog
(
taskLogBto
);
//添加装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
originDevice
.
getId
(),
remark
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
}
return
ResultUtil
.
success
(
"换新成功"
);
}
@ApiOperation
(
value
=
"查询维修详情"
,
notes
=
"可以通过这个接口查询维修详情"
)
@GetMapping
(
value
=
"/detail/{id}"
)
public
ResponseEntity
getDetail
(
@PathVariable
(
"id"
)
int
id
)
{
...
...
@@ -1338,6 +1362,7 @@ public class RepairController {
repairBillDetailVo
.
setRepairBill
(
repairBill
);
//获取装备列表
RepairSendBill
repairSendBill
=
deviceRepairSendBillDao
.
findByDeviceRepairBillId
(
repairBill
.
getId
());
//set需要转换的字段
repairSendBill
.
setSendFileList
(
FilesUtil
.
stringFileToList
(
repairSendBill
.
getSendFiles
()));
repairSendBill
.
setReceiveFileList
(
FilesUtil
.
stringFileToList
(
repairSendBill
.
getReceiveFiles
()));
if
(
repairSendBill
.
getStartUseraId
()
!=
null
)
{
...
...
@@ -1356,6 +1381,7 @@ public class RepairController {
repairBillDetailVo
.
setRepairSendBill
(
repairSendBill
);
List
<
DeviceLibrary
>
deviceLibraries
=
new
ArrayList
<>();
if
(
repairSendBill
.
getRepairDeviceCheckDetail
()
!=
null
)
{
//获取发送装备信息
String
[]
strings1
=
repairSendBill
.
getRepairDeviceCheckDetail
().
split
(
"x"
);
for
(
String
s
:
strings1
)
{
if
(
s
.
length
()
>=
2
&&
"1"
.
equals
(
s
.
substring
(
s
.
length
()
-
1
)))
{
...
...
@@ -1381,6 +1407,7 @@ public class RepairController {
}
});
if
(
repairSendBill
.
getRepairReciveCheckDetail
()
!=
null
)
{
//获取接收装备信息
List
<
DeviceLibrary
>
deviceLibraries1
=
new
ArrayList
<>();
String
[]
strings
=
repairSendBill
.
getRepairReciveCheckDetail
().
split
(
"x"
);
for
(
String
s
:
strings
)
{
...
...
@@ -1392,6 +1419,7 @@ public class RepairController {
deviceLibraries1
.
add
(
deviceLibraryEntity
);
}
}
//set维修原因
deviceLibraries1
.
forEach
(
deviceLibrary
->
{
for
(
RepairDetail
r
:
repairDetails
)
{
if
(
r
.
getDeviceId
().
equals
(
deviceLibrary
.
getId
()))
{
...
...
@@ -1406,6 +1434,7 @@ public class RepairController {
case
10
:
//获取维修退回单
RepairBackBill
repairBackBill
=
deviceRepairBackBillService
.
getOne
(
taskBto
.
getBillId
());
//set需要转换的字段
repairBackBill
.
setSendFileList
(
FilesUtil
.
stringFileToList
(
repairBackBill
.
getSendFiles
()));
repairBackBill
.
setReceiveFileList
(
FilesUtil
.
stringFileToList
(
repairBackBill
.
getReceiveFiles
()));
if
(
repairBackBill
.
getScriptJson
()!=
null
){
...
...
@@ -1426,6 +1455,7 @@ public class RepairController {
List
<
DeviceLibrary
>
deviceLibraryList2
=
new
ArrayList
<>();
String
[]
strings1
;
if
(
repairBackBill
.
getBackReciveCheckDetail
()
!=
null
)
{
//接收的装备
strings1
=
repairBackBill
.
getBackReciveCheckDetail
().
split
(
"x"
);
for
(
String
s
:
strings1
)
{
if
(
s
.
length
()
>=
2
&&
"1"
.
equals
(
s
.
substring
(
s
.
length
()
-
1
)))
{
...
...
@@ -1438,6 +1468,7 @@ public class RepairController {
}
}
if
(
repairBackBill
.
getBackCheckDetail
()
!=
null
)
{
//发送的装备
strings1
=
repairBackBill
.
getBackCheckDetail
().
split
(
"x"
);
for
(
String
s
:
strings1
)
{
if
(
s
.
length
()
>=
2
&&
"1"
.
equals
(
s
.
substring
(
s
.
length
()
-
1
)))
{
...
...
@@ -1449,16 +1480,13 @@ public class RepairController {
}
}
}
//获取维修详情
List
<
RepairDetail
>
repairDetailList
=
repairDetailDao
.
findByRepairBackBillId
(
repairBackBill
.
getId
());
repairDetailList
.
forEach
(
repairDetail
->
{
DeviceLibrary
deviceLibrary
=
deviceLibraryMap
.
get
(
repairDetail
.
getDeviceId
());
repairDetail
.
setLocationUnit
(
deviceLibrary
.
getLocationUnit
());
repairDetail
.
setConfigName
();
});
repairBillDetailVo
.
setRepairDetails
(
repairDetailList
);
//设置装备备注
//设置装备备注
和维修状态
deviceLibraryList
.
forEach
(
deviceLibrary
->
{
for
(
RepairDetail
r
:
repairDetailList
)
{
if
(
r
.
getDeviceId
().
equals
(
deviceLibrary
.
getId
()))
{
...
...
@@ -1497,10 +1525,9 @@ public class RepairController {
@ApiOperation
(
value
=
"查询维修管理列表"
,
notes
=
"可以通过这个接口查询维修管理列表"
)
@PostMapping
(
value
=
"/repairList"
)
public
ResponseEntity
getRepairList
(
@RequestBody
RepairTaskSelectVo
repairTaskSelectVo
)
{
// Map<Integer,DeviceLibrary> deviceLibraryMap = deviceLibraryService.getAllDeviceMap();
Integer
type
=
repairTaskSelectVo
.
getType
();
// Integer userId = userUtils.getCurrentUserId();
String
unitName
=
userUtils
.
getCurrentUserUnitName
();
//是否有年份筛选
Integer
year
=
repairTaskSelectVo
.
getYear
();
Boolean
hasYear
=
year
!=
null
&&
year
>
0
;
//待维修装备
...
...
@@ -1508,11 +1535,12 @@ public class RepairController {
List
<
Integer
>
integerList
=
new
ArrayList
<>();
integerList
.
add
(
1
);
integerList
.
add
(
9
);
//筛选维修状态为1,9的
List
<
RepairDetail
>
repairDetails
=
repairDetailDao
.
findAllByRepairStatusIn
(
integerList
,
repairTaskSelectVo
.
getPageable
().
getSort
());
repairDetails
.
forEach
(
repairDetail
->
{
// repairDetail.setLocationUnit(deviceLibraryMap.get(repairDetail.getDeviceId()).getLocationUnit());
repairDetail
.
setConfigName
();
});
//所在为当前单位
List
<
RepairDetail
>
repairDetails1
=
repairDetails
.
stream
().
filter
(
repairDetail
->
repairDetail
.
getLocationUnit
().
equals
(
unitName
)).
collect
(
Collectors
.
toList
());
return
ResponseEntity
.
ok
(
PageUtil
.
getPerPage
(
repairTaskSelectVo
.
getPage
(),
repairTaskSelectVo
.
getSize
(),
repairDetails1
,
repairTaskSelectVo
.
getPageable
()));
}
...
...
@@ -1522,24 +1550,27 @@ public class RepairController {
integerList
.
add
(
5
);
integerList
.
add
(
9
);
integerList
.
add
(
4
);
//过滤掉状态4,5,9
List
<
RepairDetail
>
repairDetails1
=
repairDetailDao
.
findAllByRepairStatusNotIn
(
integerList
,
repairTaskSelectVo
.
getPageable
().
getSort
());
repairDetails1
.
forEach
(
repairDetail
->
{
// repairDetail.setLocationUnit(deviceLibraryMap.get(repairDetail.getDeviceId()).getLocationUnit());
repairDetail
.
setConfigName
();
});
//发起送修的单位为当前单位
List
<
RepairDetail
>
repairDetails2
=
repairDetails1
.
stream
().
filter
(
repairDetail
->
userPublicService
.
findUnitsNameByUserId
(
repairDetail
.
getCreateUserId
()).
equals
(
unitName
)).
collect
(
Collectors
.
toList
());
return
ResponseEntity
.
ok
(
PageUtil
.
getPerPage
(
repairTaskSelectVo
.
getPage
(),
repairTaskSelectVo
.
getSize
(),
repairDetails2
,
repairTaskSelectVo
.
getPageable
()));
}
//待领取装备
else
if
(
type
==
3
){
//筛选出维修状态为2的
List
<
RepairDetail
>
repairDetails
=
repairDetailDao
.
findAllByRepairStatus
(
2
,
repairTaskSelectVo
.
getPageable
().
getSort
());
repairDetails
.
forEach
(
repairDetail
->
{
// repairDetail.setLocationUnit(deviceLibraryMap.get(repairDetail.getDeviceId()).getLocationUnit());
repairDetail
.
setConfigName
();
});
//所在在当前单位的
List
<
RepairDetail
>
repairDetails2
=
repairDetails
.
stream
().
filter
(
repairDetail
->
repairDetail
.
getLocationUnit
().
equals
(
unitName
)).
collect
(
Collectors
.
toList
());
return
ResponseEntity
.
ok
(
PageUtil
.
getPerPage
(
repairTaskSelectVo
.
getPage
(),
repairTaskSelectVo
.
getSize
(),
repairDetails2
,
repairTaskSelectVo
.
getPageable
()));
}
//已领取装备
else
if
(
type
==
4
){
Integer
level
=
userUtils
.
getCurrentUnitLevel
();
List
<
RepairDetail
>
repairDetails
;
...
...
@@ -1557,9 +1588,11 @@ public class RepairController {
});
List
<
String
>
units
=
unitsService
.
findSuperiorUnitsList
().
stream
().
map
(
Units:
:
getName
).
collect
(
Collectors
.
toList
());
units
.
addAll
(
unitsService
.
findBySubordinateNotOneself
(
userUtils
.
getCurrentUnitId
()).
stream
().
map
(
Units:
:
getName
).
collect
(
Collectors
.
toList
()));
//所在单位在当前单位下级的
List
<
RepairDetail
>
repairDetails2
=
repairDetails
.
stream
().
filter
(
repairDetail
->
units
.
contains
(
repairDetail
.
getLocationUnit
())&&(!
hasYear
||
repairDetail
.
getUpdateTime
().
getYear
()==
year
-
1900
)).
collect
(
Collectors
.
toList
());
return
ResponseEntity
.
ok
(
PageUtil
.
getPerPage
(
repairTaskSelectVo
.
getPage
(),
repairTaskSelectVo
.
getSize
(),
repairDetails2
,
repairTaskSelectVo
.
getPageable
()));
}
//已报废装备
else
if
(
type
==
5
){
Integer
level
=
userUtils
.
getCurrentUnitLevel
();
List
<
RepairDetail
>
repairDetails
;
...
...
@@ -1585,6 +1618,7 @@ public class RepairController {
public
ResponseEntity
uploadRecord
(
@RequestBody
RepairRecord
repairRecord
)
{
Integer
level
=
userUtils
.
getCurrentUnitLevel
();
RepairDetail
repairDetail
=
deviceRepairDetailService
.
getOne
(
repairRecord
.
getId
());
//省市县三种备注
if
(
level
==
1
)
{
repairDetail
.
setRecord
(
repairRecord
.
getRecord
());
}
...
...
@@ -1605,15 +1639,7 @@ public class RepairController {
List
<
Integer
>
ids
=
StringSplitUtil
.
userIdSplit
(
string
);
ids
.
forEach
(
integer
->
{
RepairDetail
repairDetail
=
deviceRepairDetailService
.
getOne
(
integer
);
// if (repairDetail.getPid()==null){
repairDetail
.
setLocationUnit
(
deviceLibraryService
.
getOne
(
repairDetail
.
getDeviceId
()).
getLocationUnit
());
repairDetails
.
add
(
repairDetail
);
// }
// else {
// RepairDetail repairDetail2 = deviceRepairDetailService.getOne(repairDetail.getPid());
// repairDetail2.setLocationUnit(deviceLibraryService.getOne(repairDetail2.getDeviceId()).getLocationUnit());
// repairDetails.add(repairDetail2);
// }
repairDetails
.
add
(
repairDetail
);
});
return
ResponseEntity
.
ok
(
repairDetails
);
}
...
...
@@ -1622,6 +1648,7 @@ public class RepairController {
@PostMapping
(
value
=
"/changeNew"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
change
(
@RequestBody
DeviceEditVo
deviceEditVo
){
//获取维修详情和装备信息
RepairDetail
repairDetail
=
deviceRepairDetailService
.
getOne
(
deviceEditVo
.
getId
());
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
deviceEditVo
.
getDeviceId
());
//创建新装备
...
...
@@ -1629,10 +1656,12 @@ public class RepairController {
BeanUtils
.
copyProperties
(
deviceLibraryEntity
,
newDevice
);
newDevice
.
setId
(
null
);
newDevice
.
setLocationUnit
(
userUtils
.
getCurrentUserUnitName
());
//如果所属和所在相同,装备直接入库,状态为在库
if
(
newDevice
.
getOwnUnit
().
equals
(
newDevice
.
getLocationUnit
()))
{
newDevice
.
setLifeStatus
(
2
);
}
DeviceLibrary
deviceLibrary
=
deviceLibraryService
.
addEntity
(
newDevice
);
//改变旧装备绑定的子装备的父id
List
<
DeviceLibrary
>
deviceLibraries
=
deviceLibraryDao
.
getAllByPartParentId
(
deviceLibraryEntity
.
getId
());
deviceLibraries
.
forEach
(
deviceLibrary1
->
{
deviceLibrary1
.
setPartParentId
(
deviceLibrary
.
getId
());
...
...
@@ -1645,11 +1674,14 @@ public class RepairController {
newRepairDetail
.
setDeviceId
(
deviceLibrary
.
getId
());
newRepairDetail
.
setLocationUnit
(
userUtils
.
getCurrentUserUnitName
());
newRepairDetail
.
setRepairStatus
(
5
);
//如果该维修记录有父id
if
(
newRepairDetail
.
getPid
()!=
null
)
{
//获取父记录,改变维修状态和所在
RepairDetail
repairDetail1
=
deviceRepairDetailService
.
getOne
(
repairDetail
.
getPid
());
repairDetail1
.
setRepairStatus
(
2
);
repairDetail1
.
setLocationUnit
(
userUtils
.
getCurrentUserUnitName
());
deviceRepairDetailService
.
update
(
repairDetail1
);
//给下级单位发送阅知
Integer
unitId
=
userPublicService
.
getOne
(
repairDetail1
.
getCreateUserId
()).
getUnitsId
();
List
<
Integer
>
integerList
=
new
ArrayList
<>();
integerList
.
addAll
(
userDao
.
findAllByUnitsId
(
unitId
).
stream
()
...
...
@@ -1663,11 +1695,13 @@ public class RepairController {
repairDetail
.
setRepairStatus
(
4
);
repairDetail
.
setLocationUnit
(
deviceLibraryEntity
.
getLocationUnit
());
repairDetail
.
setOwnUnit
(
deviceLibraryEntity
.
getLocationUnit
());
//装备改为已报废
deviceLibraryEntity
.
setOwnUnit
(
deviceLibraryEntity
.
getLocationUnit
());
deviceLibraryEntity
.
setLifeStatus
(
5
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
if
(
deviceEditVo
.
getUpdateVoList
()
!=
null
)
{
DeviceLibraryUpdateVo
libraryUpdateVo
=
deviceEditVo
.
getUpdateVoList
();
//生产号修改
if
(
libraryUpdateVo
.
getProdNumber
()
!=
null
&&
!
libraryUpdateVo
.
getProdNumber
().
equals
(
deviceLibraryEntity
.
getProdNumber
()))
{
//添加装备日志
String
remark
=
"装备换新:将装备生产序列号由"
+
deviceLibraryEntity
.
getProdNumber
()
+
"换为"
+
libraryUpdateVo
.
getProdNumber
();
...
...
@@ -1675,11 +1709,13 @@ public class RepairController {
deviceLogService
.
addLog
(
deviceLogDto
);
deviceLibrary
.
setProdNumber
(
libraryUpdateVo
.
getProdNumber
());
}
//序列号修改
if
(
libraryUpdateVo
.
getSeqNumber
()
!=
null
&&
!
libraryUpdateVo
.
getSeqNumber
().
equals
(
deviceLibraryEntity
.
getSeqNumber
()))
{
if
(
deviceLibraryDao
.
getAllBySeqNumber
(
libraryUpdateVo
.
getSeqNumber
()).
size
()>
0
){
throw
new
ApiException
(
"序列号"
+
libraryUpdateVo
.
getSeqNumber
()+
"已存在"
);
}
else
{
//添加装备日志
String
remark
=
"装备换新:将装备序列号由"
+
deviceLibraryEntity
.
getSeqNumber
()
+
"换为"
+
libraryUpdateVo
.
getSeqNumber
();
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
deviceEditVo
.
getDeviceId
(),
remark
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
...
...
@@ -1690,9 +1726,10 @@ public class RepairController {
}
deviceLibraryService
.
update
(
deviceLibrary
);
RepairDetail
repairDetail3
=
deviceRepairDetailService
.
save
(
newRepairDetail
);
//set换新后记录的id
repairDetail
.
setNewDeviceDetailId
(
repairDetail3
.
getId
());
deviceRepairDetailService
.
update
(
repairDetail
);
//修改所有父维修记录序列号
//修改所有父维修记录序列号
、装备序列号、所在单位
if
(
repairDetail3
.
getPid
()!=
null
){
RepairDetail
repairDetail1
=
deviceRepairDetailService
.
getOne
(
repairDetail3
.
getPid
());
repairDetail1
.
setSeqNumber
(
repairDetail3
.
getSeqNumber
());
...
...
@@ -1707,9 +1744,11 @@ public class RepairController {
deviceRepairDetailService
.
update
(
repairDetail2
);
}
}
//添加装备换新记录
DeviceChange
deviceChange
=
new
DeviceChange
();
deviceChange
.
setNewDeviceId
(
deviceLibrary
.
getId
());
deviceChange
.
setOldDeviceId
(
deviceLibraryEntity
.
getId
());
//换新文件
if
(
deviceEditVo
.
getSendFiles
()!=
null
&&
deviceEditVo
.
getSendFiles
().
size
()>
0
)
{
deviceChange
.
setChangeFiles
(
FilesUtil
.
stringFileToList
(
deviceEditVo
.
getSendFiles
()));
}
...
...
@@ -1725,193 +1764,193 @@ public class RepairController {
}
@ApiOperation
(
value
=
"上传领取单"
,
notes
=
"上传领取单"
)
@ApiOperation
(
value
=
"
发件方
上传领取单"
,
notes
=
"上传领取单"
)
@PostMapping
(
value
=
"/uploadFile"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
uploadFile
(
@RequestBody
@Validated
com
.
tykj
.
dev
.
device
.
repair
.
subject
.
vo
.
FileVo
fileVo
){
//获取task
TaskBto
taskBto
=
taskService
.
get
(
fileVo
.
getTaskId
());
taskService
.
addInvolveUser
(
taskBto
,
userUtils
.
getCurrentUserId
());
//判断业务状态
List
<
StatusEnum
>
statusEnums
=
new
ArrayList
<>();
statusEnums
.
add
(
StatusEnum
.
WAIT_UPLOAD_BACK_SEND_FILE
);
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
statusEnums
);
//不上传单据
if
(
fileVo
.
getStatus
()==
0
){
taskService
.
moveToArchive
(
taskBto
);
}
else
{
RepairBackBill
repairBackBill
=
deviceRepairBackBillService
.
getOne
(
taskBto
.
getBillId
());
//保存账单
repairBackBill
.
setSendFiles
(
FilesUtil
.
stringFileToList
(
fileVo
.
getSendFiles
()));
List
<
Integer
>
idList
=
new
ArrayList
<>();
if
(
fileVo
.
getReceiveUseraId
()!=
null
)
{
repairBackBill
.
setReceiveUseraId
(
fileVo
.
getReceiveUseraId
());
idList
.
add
(
fileVo
.
getReceiveUseraId
());
}
if
(
fileVo
.
getReceiveUserbId
()!=
null
)
{
repairBackBill
.
setReceiveUserbId
(
fileVo
.
getReceiveUserbId
());
idList
.
add
(
fileVo
.
getReceiveUserbId
());
}
if
(
fileVo
.
getStartUserbId
()!=
null
){
repairBackBill
.
setStartUserbId
(
fileVo
.
getStartUserbId
());
repairBackBill
.
setAgent
(
userPublicService
.
getOne
(
fileVo
.
getStartUserbId
()).
getName
());
MessageBto
messageBto1
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
Collections
.
singletonList
(
fileVo
.
getStartUserbId
()),
1
);
messageService
.
add
(
messageBto1
);
}
repairBackBill
.
setBackStatus
(
5
);
repairBackBill
.
setReceiveTime
(
new
Date
());
deviceRepairBackBillService
.
update
(
repairBackBill
);
List
<
Integer
>
ids
=
StringSplitUtil
.
split
(
repairBackBill
.
getBackCheckDetail
());
//业务完结
taskService
.
moveToEnd
(
taskBto
);
//主业务完结
taskService
.
moveToEnd
(
taskService
.
get
(
taskBto
.
getParentTaskId
()));
List
<
Integer
>
userIds
=
userPublicService
.
findOtherUser
(
userUtils
.
getCurrentUserId
());
userIds
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
repairBackBill
.
getReceiveUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
//阅知
MessageBto
messageBto1
=
new
MessageBto
(
taskBto
.
getParentTaskId
(),
taskBto
.
getBusinessType
(),
"业务办结"
,
userIds
,
1
);
RepairBackBill
repairBackBill
=
deviceRepairBackBillService
.
getOne
(
taskBto
.
getBillId
());
//保存账单
repairBackBill
.
setSendFiles
(
FilesUtil
.
stringFileToList
(
fileVo
.
getSendFiles
()));
List
<
Integer
>
idList
=
new
ArrayList
<>();
if
(
fileVo
.
getReceiveUseraId
()!=
null
)
{
repairBackBill
.
setReceiveUseraId
(
fileVo
.
getReceiveUseraId
());
idList
.
add
(
fileVo
.
getReceiveUseraId
());
}
if
(
fileVo
.
getReceiveUserbId
()!=
null
)
{
repairBackBill
.
setReceiveUserbId
(
fileVo
.
getReceiveUserbId
());
idList
.
add
(
fileVo
.
getReceiveUserbId
());
}
//签发人阅知
if
(
fileVo
.
getStartUserbId
()!=
null
){
repairBackBill
.
setStartUserbId
(
fileVo
.
getStartUserbId
());
repairBackBill
.
setAgent
(
userPublicService
.
getOne
(
fileVo
.
getStartUserbId
()).
getName
());
MessageBto
messageBto1
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
Collections
.
singletonList
(
fileVo
.
getStartUserbId
()),
1
);
messageService
.
add
(
messageBto1
);
//装备日志
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
fileVo
.
getSendFiles
().
forEach
(
fileRet
->
fileVoList
.
add
(
new
FileVo
(
"领取单"
,
fileRet
.
getName
(),
fileRet
.
getPreviewPath
())));
ids
.
forEach
(
integer
->
{
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
integer
,
"上传领取单"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
integer
);
deviceLibraryEntity
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
deviceLibraryEntity
.
setLifeStatus
(
2
);
deviceLibraryEntity
.
setManageStatus
(
1
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
});
//获取维修详情
List
<
RepairDetail
>
repairDetailList
=
repairDetailDao
.
findByRepairBackBillId
(
repairBackBill
.
getId
());
Map
<
Integer
,
List
<
Integer
>>
messageMap
=
new
HashMap
<>();
repairDetailList
.
forEach
(
repairDetail
->
{
repairDetail
.
setRepairStatus
(
5
);
repairDetail
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
if
(
repairDetail
.
getPid
()!=
null
)
{
RepairDetail
repairDetail1
=
deviceRepairDetailService
.
getOne
(
repairDetail
.
getPid
());
repairDetail1
.
setRepairStatus
(
2
);
repairDetail1
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
deviceRepairDetailService
.
update
(
repairDetail1
);
Integer
unitId
=
userPublicService
.
getOne
(
repairDetail1
.
getCreateUserId
()).
getUnitsId
();
if
(
messageMap
.
get
(
unitId
)==
null
)
{
messageMap
.
put
(
unitId
,
Collections
.
singletonList
(
repairDetail1
.
getId
()));
}
else
{
List
<
Integer
>
integers
=
new
ArrayList
<>(
messageMap
.
getOrDefault
(
unitId
,
new
ArrayList
<>()));
integers
.
add
(
repairDetail1
.
getId
());
messageMap
.
put
(
unitId
,
integers
);
}
if
(
repairDetail1
.
getPid
()!=
null
){
RepairDetail
repairDetail2
=
deviceRepairDetailService
.
getOne
(
repairDetail1
.
getPid
());
repairDetail2
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
deviceRepairDetailService
.
update
(
repairDetail2
);
}
}
repairBackBill
.
setBackStatus
(
5
);
repairBackBill
.
setReceiveTime
(
new
Date
());
deviceRepairBackBillService
.
update
(
repairBackBill
);
List
<
Integer
>
ids
=
StringSplitUtil
.
split
(
repairBackBill
.
getBackCheckDetail
());
//业务完结
taskService
.
moveToEnd
(
taskBto
);
//主业务完结
taskService
.
moveToEnd
(
taskService
.
get
(
taskBto
.
getParentTaskId
()));
List
<
Integer
>
userIds
=
userPublicService
.
findOtherUser
(
userUtils
.
getCurrentUserId
());
userIds
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
repairBackBill
.
getReceiveUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
//阅知
MessageBto
messageBto1
=
new
MessageBto
(
taskBto
.
getParentTaskId
(),
taskBto
.
getBusinessType
(),
"业务办结"
,
userIds
,
1
);
messageService
.
add
(
messageBto1
);
//装备日志
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
fileVo
.
getSendFiles
().
forEach
(
fileRet
->
fileVoList
.
add
(
new
FileVo
(
"领取单"
,
fileRet
.
getName
(),
fileRet
.
getPreviewPath
())));
ids
.
forEach
(
integer
->
{
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
integer
,
"上传领取单"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
integer
);
deviceLibraryEntity
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
deviceLibraryEntity
.
setLifeStatus
(
2
);
deviceLibraryEntity
.
setManageStatus
(
1
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
});
//获取维修详情
List
<
RepairDetail
>
repairDetailList
=
repairDetailDao
.
findByRepairBackBillId
(
repairBackBill
.
getId
());
//单位阅知map
Map
<
Integer
,
List
<
Integer
>>
messageMap
=
new
HashMap
<>();
//改变维修详情的维修状态、所在单位
repairDetailList
.
forEach
(
repairDetail
->
{
repairDetail
.
setRepairStatus
(
5
);
repairDetail
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
if
(
repairDetail
.
getPid
()!=
null
)
{
RepairDetail
repairDetail1
=
deviceRepairDetailService
.
getOne
(
repairDetail
.
getPid
());
repairDetail1
.
setRepairStatus
(
2
);
repairDetail1
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
deviceRepairDetailService
.
update
(
repairDetail1
);
Integer
unitId
=
userPublicService
.
getOne
(
repairDetail1
.
getCreateUserId
()).
getUnitsId
();
if
(
messageMap
.
get
(
unitId
)==
null
)
{
messageMap
.
put
(
unitId
,
Collections
.
singletonList
(
repairDetail1
.
getId
()));
}
else
{
List
<
Integer
>
integers
=
new
ArrayList
<>(
messageMap
.
getOrDefault
(
unitId
,
new
ArrayList
<>()));
integers
.
add
(
repairDetail1
.
getId
());
messageMap
.
put
(
unitId
,
integers
);
}
if
(
repairDetail1
.
getPid
()!=
null
){
RepairDetail
repairDetail2
=
deviceRepairDetailService
.
getOne
(
repairDetail1
.
getPid
());
repairDetail2
.
setLocationUnit
(
repairBackBill
.
getReceiveUnit
());
deviceRepairDetailService
.
update
(
repairDetail2
);
}
deviceRepairDetailService
.
update
(
repairDetail
);
});
if
(
idList
.
size
()>
0
)
{
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
}
messageMap
.
keySet
().
forEach
(
integer
->
{
List
<
Integer
>
integerList
=
new
ArrayList
<>();
integerList
.
addAll
(
userDao
.
findAllByUnitsId
(
integer
).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
MessageBto
messageBto2
=
new
MessageBto
(
0
,
5
,
"待领取送修装备"
,
integerList
);
messageBto2
.
setRecord
(
StringSplitUtil
.
idListToString
(
messageMap
.
get
(
integer
)));
messageService
.
add
(
messageBto2
);
});
deviceRepairDetailService
.
update
(
repairDetail
);
});
//经办人阅知
if
(
idList
.
size
()>
0
)
{
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
}
//按map中各个单位发送阅知
messageMap
.
keySet
().
forEach
(
integer
->
{
List
<
Integer
>
integerList
=
new
ArrayList
<>();
integerList
.
addAll
(
userDao
.
findAllByUnitsId
(
integer
).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
MessageBto
messageBto2
=
new
MessageBto
(
0
,
5
,
"待领取送修装备"
,
integerList
);
//阅知记录id拼接
messageBto2
.
setRecord
(
StringSplitUtil
.
idListToString
(
messageMap
.
get
(
integer
)));
messageService
.
add
(
messageBto2
);
});
return
ResponseEntity
.
ok
(
"OK"
);
}
@ApiOperation
(
value
=
"市县上传
维
修单"
,
notes
=
"市县上传维修单"
)
@ApiOperation
(
value
=
"市县上传
发送方送
修单"
,
notes
=
"市县上传维修单"
)
@PostMapping
(
value
=
"/uploadRepairFile"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
uploadRepairFile
(
@RequestBody
@Validated
com
.
tykj
.
dev
.
device
.
repair
.
subject
.
vo
.
FileVo
fileVo
){
//获取task
TaskBto
taskBto
=
taskService
.
get
(
fileVo
.
getTaskId
());
taskService
.
addInvolveUser
(
taskBto
,
userUtils
.
getCurrentUserId
());
//判断业务状态
List
<
StatusEnum
>
statusEnums
=
new
ArrayList
<>();
statusEnums
.
add
(
StatusEnum
.
WAIT_UPLOAD_SEND_FILE
);
TaskDisposeUtil
.
isNotSubmit
(
taskBto
.
getBillStatus
(),
statusEnums
);
//不上传单据
if
(
fileVo
.
getStatus
()==
0
){
taskService
.
moveToArchive
(
taskBto
);
}
else
{
RepairBill
repairBill
=
deviceRepairBillService
.
getOne
(
taskBto
.
getBillId
());
RepairSendBill
repairSendBill
=
deviceRepairSendBillDao
.
findByDeviceRepairBillId
(
repairBill
.
getId
());
List
<
RepairDetail
>
repairDetailEntities
=
deviceRepairDetailService
.
findByBillId
(
repairBill
.
getId
());
//保存账单
repairSendBill
.
setSendFiles
(
FilesUtil
.
stringFileToList
(
fileVo
.
getSendFiles
()));
List
<
Integer
>
idList
=
new
ArrayList
<>();
if
(
fileVo
.
getStartUserbId
()!=
null
){
String
startUserB
=
userPublicService
.
getOne
(
fileVo
.
getStartUserbId
()).
getName
();
repairBill
.
setStartUserB
(
startUserB
);
repairSendBill
.
setStartUserbId
(
fileVo
.
getStartUserbId
());
repairSendBill
.
setAgent
(
startUserB
);
MessageBto
messageBto1
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
Collections
.
singletonList
(
fileVo
.
getStartUserbId
()),
1
);
messageService
.
add
(
messageBto1
);
}
if
(
fileVo
.
getReceiveUseraId
()!=
null
)
{
repairBill
.
setRepairUserA
(
userPublicService
.
getOne
(
fileVo
.
getReceiveUseraId
()).
getName
());
repairSendBill
.
setRepairUseraId
(
fileVo
.
getReceiveUseraId
());
idList
.
add
(
fileVo
.
getReceiveUseraId
());
}
if
(
fileVo
.
getReceiveUserbId
()!=
null
)
{
repairBill
.
setRepairUserB
(
userPublicService
.
getOne
(
fileVo
.
getReceiveUserbId
()).
getName
());
repairSendBill
.
setRepairUserbId
(
fileVo
.
getReceiveUserbId
());
idList
.
add
(
fileVo
.
getReceiveUserbId
());
}
repairBill
.
setRepairStatus
(
4
);
repairSendBill
.
setRepairStatus
(
5
);
deviceRepairBillService
.
update
(
repairBill
);
deviceRepairSendBillService
.
update
(
repairSendBill
);
List
<
Integer
>
ids
=
StringSplitUtil
.
split
(
repairSendBill
.
getRepairDeviceCheckDetail
());
//业务完结
taskService
.
moveToEnd
(
taskBto
);
//主业务完结
taskService
.
moveToEnd
(
taskService
.
get
(
taskBto
.
getParentTaskId
()));
List
<
Integer
>
userIds
=
userPublicService
.
findOtherUser
(
userUtils
.
getCurrentUserId
());
userIds
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
repairSendBill
.
getReceiveUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
//阅知
MessageBto
messageBto1
=
new
MessageBto
(
taskBto
.
getParentTaskId
(),
taskBto
.
getBusinessType
(),
"业务办结"
,
userIds
,
1
);
//获取账单
RepairBill
repairBill
=
deviceRepairBillService
.
getOne
(
taskBto
.
getBillId
());
RepairSendBill
repairSendBill
=
deviceRepairSendBillDao
.
findByDeviceRepairBillId
(
repairBill
.
getId
());
List
<
RepairDetail
>
repairDetailEntities
=
deviceRepairDetailService
.
findByBillId
(
repairBill
.
getId
());
//保存账单
repairSendBill
.
setSendFiles
(
FilesUtil
.
stringFileToList
(
fileVo
.
getSendFiles
()));
List
<
Integer
>
idList
=
new
ArrayList
<>();
//签发人阅知
if
(
fileVo
.
getStartUserbId
()!=
null
){
String
startUserB
=
userPublicService
.
getOne
(
fileVo
.
getStartUserbId
()).
getName
();
repairBill
.
setStartUserB
(
startUserB
);
repairSendBill
.
setStartUserbId
(
fileVo
.
getStartUserbId
());
repairSendBill
.
setAgent
(
startUserB
);
MessageBto
messageBto1
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
Collections
.
singletonList
(
fileVo
.
getStartUserbId
()),
1
);
messageService
.
add
(
messageBto1
);
//装备日志
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
fileVo
.
getSendFiles
().
forEach
(
fileRet
->
fileVoList
.
add
(
new
FileVo
(
"维修单"
,
fileRet
.
getName
(),
fileRet
.
getPreviewPath
())));
ids
.
forEach
(
integer
->
{
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
integer
);
deviceLibraryEntity
.
setLifeStatus
(
4
);
deviceLibraryEntity
.
setLocationUnit
(
repairBill
.
getReceiveUnit
());
deviceLibraryEntity
.
setManageStatus
(
1
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
integer
,
"上传维修单"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
});
//改变维修详情装备所在单位为当前单位
repairDetailEntities
.
forEach
(
repairDetail
->
{
repairDetail
.
setLocationUnit
(
repairBill
.
getReceiveUnit
());
repairDetail
.
setRepairStatus
(
1
);
deviceRepairDetailService
.
update
(
repairDetail
);
if
(
repairDetail
.
getPid
()!=
null
){
RepairDetail
repairDetail1
=
deviceRepairDetailService
.
getOne
(
repairDetail
.
getPid
());
repairDetail1
.
setLocationUnit
(
repairBill
.
getReceiveUnit
());
deviceRepairDetailService
.
update
(
repairDetail1
);
}
});
if
(
idList
.
size
()>
0
)
{
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
}
if
(
fileVo
.
getReceiveUseraId
()!=
null
)
{
repairBill
.
setRepairUserA
(
userPublicService
.
getOne
(
fileVo
.
getReceiveUseraId
()).
getName
());
repairSendBill
.
setRepairUseraId
(
fileVo
.
getReceiveUseraId
());
idList
.
add
(
fileVo
.
getReceiveUseraId
());
}
if
(
fileVo
.
getReceiveUserbId
()!=
null
)
{
repairBill
.
setRepairUserB
(
userPublicService
.
getOne
(
fileVo
.
getReceiveUserbId
()).
getName
());
repairSendBill
.
setRepairUserbId
(
fileVo
.
getReceiveUserbId
());
idList
.
add
(
fileVo
.
getReceiveUserbId
());
}
repairBill
.
setRepairStatus
(
4
);
repairSendBill
.
setRepairStatus
(
5
);
deviceRepairBillService
.
update
(
repairBill
);
deviceRepairSendBillService
.
update
(
repairSendBill
);
List
<
Integer
>
ids
=
StringSplitUtil
.
split
(
repairSendBill
.
getRepairDeviceCheckDetail
());
//业务完结
taskService
.
moveToEnd
(
taskBto
);
//主业务完结
taskService
.
moveToEnd
(
taskService
.
get
(
taskBto
.
getParentTaskId
()));
List
<
Integer
>
userIds
=
userPublicService
.
findOtherUser
(
userUtils
.
getCurrentUserId
());
userIds
.
addAll
(
userDao
.
findAllByUnitsId
(
userPublicService
.
findUnitIdByName
(
repairSendBill
.
getReceiveUnit
())).
stream
()
.
map
(
User:
:
getUserId
)
.
collect
(
Collectors
.
toList
()));
//业务办结阅知
MessageBto
messageBto1
=
new
MessageBto
(
taskBto
.
getParentTaskId
(),
taskBto
.
getBusinessType
(),
"业务办结"
,
userIds
,
1
);
messageService
.
add
(
messageBto1
);
//装备日志
List
<
FileVo
>
fileVoList
=
new
ArrayList
<>();
fileVo
.
getSendFiles
().
forEach
(
fileRet
->
fileVoList
.
add
(
new
FileVo
(
"维修单"
,
fileRet
.
getName
(),
fileRet
.
getPreviewPath
())));
ids
.
forEach
(
integer
->
{
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
integer
);
deviceLibraryEntity
.
setLifeStatus
(
4
);
deviceLibraryEntity
.
setLocationUnit
(
repairBill
.
getReceiveUnit
());
deviceLibraryEntity
.
setManageStatus
(
1
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
integer
,
"上传维修单"
,
fileVoList
);
deviceLogService
.
addLog
(
deviceLogDto
);
});
//改变维修详情装备所在单位为当前单位
repairDetailEntities
.
forEach
(
repairDetail
->
{
repairDetail
.
setLocationUnit
(
repairBill
.
getReceiveUnit
());
repairDetail
.
setRepairStatus
(
1
);
deviceRepairDetailService
.
update
(
repairDetail
);
//同时改变父详情
if
(
repairDetail
.
getPid
()!=
null
){
RepairDetail
repairDetail1
=
deviceRepairDetailService
.
getOne
(
repairDetail
.
getPid
());
repairDetail1
.
setLocationUnit
(
repairBill
.
getReceiveUnit
());
deviceRepairDetailService
.
update
(
repairDetail1
);
}
});
//经办人阅知
if
(
idList
.
size
()>
0
)
{
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为经办人"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
}
return
ResponseEntity
.
ok
(
"OK"
);
}
...
...
@@ -1919,21 +1958,10 @@ public class RepairController {
/**
* @param repairBillId 维修单id
* @return 维修详情列表
* 根据维修单Id查询维修详情
,排序返回
* 根据维修单Id查询维修详情
*/
private
List
<
RepairDetail
>
getRepairDetail
(
int
repairBillId
)
{
List
<
RepairDetail
>
repairDetails
=
deviceRepairDetailService
.
findByBillId
(
repairBillId
);
// List<RepairDetail> orderList = new ArrayList<>();
// repairDetails.forEach(repairDetail -> {
// if (!repairDetail.getRepairStatus().equals(RepairStatusEnum.CHANGE_NEW.id) && !repairDetail.getRepairStatus().equals(RepairStatusEnum.CHANGE_NEW_DEVICE.id)) {
// orderList.add(repairDetail);
// if (repairDetail.getRepairStatus().equals(RepairStatusEnum.SCRAPPED.id)) {
// if (repairDetail.getNewDeviceDetailId() > 0) {
// orderList.add(deviceRepairDetailService.getOne(repairDetail.getNewDeviceDetailId()));
// }
// }
// }
// });
return
repairDetails
;
}
...
...
@@ -1943,6 +1971,7 @@ public class RepairController {
TaskBto
taskBto
=
taskService
.
get
(
agentBackVo
.
getId
());
List
<
Integer
>
idList
=
new
ArrayList
<>();
idList
.
add
(
agentBackVo
.
getStartUserbId
());
//签发人阅知
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
RepairBill
repairBill
=
deviceRepairBillService
.
getOne
(
taskBto
.
getBillId
());
...
...
@@ -1959,6 +1988,7 @@ public class RepairController {
TaskBto
taskBto
=
taskService
.
get
(
agentBackVo
.
getId
());
List
<
Integer
>
idList
=
new
ArrayList
<>();
idList
.
add
(
agentBackVo
.
getStartUserbId
());
//签发人阅知
MessageBto
messageBto
=
new
MessageBto
(
taskBto
.
getId
(),
taskBto
.
getBusinessType
(),
"被选为签发人"
,
idList
,
1
);
messageService
.
add
(
messageBto
);
RepairBackBill
repairBackBill
=
deviceRepairBackBillService
.
getOne
(
taskBto
.
getBillId
());
...
...
dev-repair/src/main/java/com/tykj/dev/device/repair/subject/domin/RepairBackBill.java
浏览文件 @
debb315a
...
...
@@ -238,12 +238,15 @@ public class RepairBackBill {
@ApiModelProperty
(
value
=
"区块链记录id"
)
private
String
recordId
;
@ApiModelProperty
(
value
=
"发件方上传单据"
)
@Column
(
name
=
"send_files"
,
columnDefinition
=
"TEXT"
)
private
String
sendFiles
;
@ApiModelProperty
(
value
=
"收件方上传单据"
)
@Column
(
name
=
"receive_files"
,
columnDefinition
=
"TEXT"
)
private
String
receiveFiles
;
@ApiModelProperty
(
value
=
"单据json"
)
@Column
(
name
=
"script_json"
,
columnDefinition
=
"TEXT"
)
private
String
scriptJson
;
...
...
dev-repair/src/main/java/com/tykj/dev/device/repair/subject/domin/RepairBill.java
浏览文件 @
debb315a
...
...
@@ -57,7 +57,7 @@ public class RepairBill {
/**
* 维修状态
*/
@ApiModelProperty
(
value
=
"维修状态"
)
@ApiModelProperty
(
value
=
"维修状态
(0.草稿,1.发起审核失败,2.运输中,3.维修方审核失败,4.维修中,5.维修完成,6:维修方接收待审核)
"
)
private
Integer
repairStatus
;
/**
* 创建用户id
...
...
dev-repair/src/main/java/com/tykj/dev/device/repair/subject/domin/RepairDetail.java
浏览文件 @
debb315a
...
...
@@ -149,12 +149,16 @@ public class RepairDetail {
@ApiModelProperty
(
value
=
"维修记录信息"
)
private
String
record3
;
@ApiModelProperty
(
value
=
"领取单id"
)
private
Integer
repairBackBillId
;
@ApiModelProperty
(
value
=
"形态"
)
@Transient
private
String
typeName
;
/**
* set 中文名称
*/
public
RepairDetail
setConfigName
(){
ConfigCache
configCache
=
SpringUtils
.
getBean
(
"initConfigCache"
);
if
(
configCache
!=
null
)
{
...
...
dev-repair/src/main/java/com/tykj/dev/device/repair/subject/domin/RepairSendBill.java
浏览文件 @
debb315a
...
...
@@ -230,12 +230,15 @@ public class RepairSendBill {
@ApiModelProperty
(
value
=
"区块链记录id"
)
private
String
recordId
;
@ApiModelProperty
(
value
=
"发件方上传单据"
)
@Column
(
name
=
"send_files"
,
columnDefinition
=
"TEXT"
)
private
String
sendFiles
;
@ApiModelProperty
(
value
=
"收件方上传单据"
)
@Column
(
name
=
"receive_files"
,
columnDefinition
=
"TEXT"
)
private
String
receiveFiles
;
@ApiModelProperty
(
value
=
"单据json"
)
@Column
(
name
=
"script_json"
,
columnDefinition
=
"TEXT"
)
private
String
scriptJson
;
...
...
dev-repair/src/main/java/com/tykj/dev/device/repair/subject/vo/AgentBackVo.java
浏览文件 @
debb315a
...
...
@@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
@Data
@ApiModel
(
"
配发审核
类"
)
@ApiModel
(
"
上传签发人
类"
)
public
class
AgentBackVo
{
private
Integer
id
;
...
...
dev-repair/src/main/java/com/tykj/dev/device/repair/subject/vo/RepairBillSaveVo.java
浏览文件 @
debb315a
...
...
@@ -95,5 +95,6 @@ public class RepairBillSaveVo {
@ApiModelProperty
(
value
=
"发送方附件"
)
private
List
<
FileRet
>
sendFileList
;
@ApiModelProperty
(
value
=
"单据保存vo"
)
private
List
<
ScriptSaveVo
>
scriptSaveVos
;
}
dev-repair/src/main/java/com/tykj/dev/device/repair/subject/vo/RepairReceiveVo.java
浏览文件 @
debb315a
...
...
@@ -76,5 +76,6 @@ public class RepairReceiveVo {
@ApiModelProperty
(
value
=
"收件单位签章id"
)
private
String
rightSignatureId
;
@ApiModelProperty
(
value
=
"单据保存vo"
)
private
List
<
ScriptSaveVo
>
scriptSaveVos
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论