Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
b6468c5e
提交
b6468c5e
authored
4月 20, 2022
作者:
zhoushaopan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(配套设备库模块): 新增库房修改
新增库房修改
上级
91a9521d
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
227 行增加
和
145 行删除
+227
-145
MatchingDeviceController.java
.../device/matching/controller/MatchingDeviceController.java
+180
-145
LocationVO.java
...a/com/tykj/dev/device/matching/subject/vo/LocationVO.java
+24
-0
StorageLocationVO.java
...ykj/dev/device/matching/subject/vo/StorageLocationVO.java
+23
-0
没有找到文件。
dev-matching/src/main/java/com/tykj/dev/device/matching/controller/MatchingDeviceController.java
浏览文件 @
b6468c5e
...
...
@@ -11,6 +11,7 @@ import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.domin.DeviceLog
;
import
com.tykj.dev.device.library.subject.vo.*
;
import
com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao
;
import
com.tykj.dev.device.matching.repository.MatchingRepairBillDao
;
import
com.tykj.dev.device.matching.rfid.MatchingDeviceRfidService
;
import
com.tykj.dev.device.matching.rfid.MatchingDeviceRfidServiceImpl
;
...
...
@@ -25,6 +26,7 @@ import com.tykj.dev.device.matching.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.user.cache.StoreCache
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.read.service.MessageService
;
import
com.tykj.dev.device.user.read.subject.bto.MessageBto
;
...
...
@@ -54,6 +56,7 @@ import javax.annotation.Resource;
import
javax.validation.constraints.Min
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -117,6 +120,12 @@ public class MatchingDeviceController {
@Resource
private
UnitsService
unitsService
;
@Resource
private
MatchingDeviceLibraryDao
matchingDeviceLibraryDao
;
@Resource
private
StoreCache
storeCache
;
@ApiOperation
(
value
=
"将设备进行拆分"
,
notes
=
"将设备进行拆分"
)
@PostMapping
(
value
=
"/matchingDeviceSplit"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -125,14 +134,14 @@ public class MatchingDeviceController {
//当手动输入序列号的时候 需要进行遍历成集合
matchingDeviceSaveVos
.
forEach
(
matchingDeviceSaveVo
->
{
if
(
matchingDeviceSaveVo
.
getSeqList
().
isEmpty
()){
List
<
String
>
deviceSeqs
=
DeviceSeqUtil
.
selectDeviceSeqsForMatchingDevice
(
matchingDeviceSaveVo
.
getSeqNumber
());
if
(
matchingDeviceSaveVo
.
getSeqList
().
isEmpty
())
{
List
<
String
>
deviceSeqs
=
DeviceSeqUtil
.
selectDeviceSeqsForMatchingDevice
(
matchingDeviceSaveVo
.
getSeqNumber
());
matchingDeviceSaveVo
.
setSeqList
(
deviceSeqs
);
}
});
//做校验 数量跟序列号
matchingDeviceSaveVos
.
forEach
(
matchingDeviceSaveVo
->
{
if
(
matchingDeviceSaveVo
.
getStorageCount
()
!=
matchingDeviceSaveVo
.
getSeqList
().
size
())
{
if
(
matchingDeviceSaveVo
.
getStorageCount
()
!=
matchingDeviceSaveVo
.
getSeqList
().
size
())
{
throw
new
ApiException
(
"序列号与入库数量不匹配"
);
}
});
...
...
@@ -141,7 +150,7 @@ public class MatchingDeviceController {
List
<
String
>
seqList
=
matchingDeviceSaveVo
.
getSeqList
();
for
(
int
i
=
0
;
i
<
seqList
.
size
();
i
++)
{
MatchingDeviceSaveVo
matchingDeviceSaveVo1
=
new
MatchingDeviceSaveVo
();
BeanUtils
.
copyProperties
(
matchingDeviceSaveVo
,
matchingDeviceSaveVo1
);
BeanUtils
.
copyProperties
(
matchingDeviceSaveVo
,
matchingDeviceSaveVo1
);
matchingDeviceSaveVo1
.
setSeqNumber
(
seqList
.
get
(
i
));
matchingDeviceSaveVoList
.
add
(
matchingDeviceSaveVo1
);
}
...
...
@@ -164,15 +173,15 @@ public class MatchingDeviceController {
//所有的入库配套设备的序列号
List
<
String
>
matchingDeviceLibraryListSeqNumberList
=
matchingDeviceLibraryService
.
getAllMatchingDeviceLibraryListSeqNumberList
();
matchingDeviceLibraryListSeqNumberList
.
retainAll
(
seqNumList
);
if
(
matchingDeviceLibraryListSeqNumberList
.
size
()
>
0
)
{
throw
new
ApiException
(
"序列号"
+
matchingDeviceLibraryListSeqNumberList
+
"已存在"
);
if
(
matchingDeviceLibraryListSeqNumberList
.
size
()
>
0
)
{
throw
new
ApiException
(
"序列号"
+
matchingDeviceLibraryListSeqNumberList
+
"已存在"
);
}
//做校验 入库的配套设备的序列号不能一样
//先去重
List
<
String
>
distinctSeqNumList
=
seqNumList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
distinctSeqNumList
.
forEach
(
s
->
{
int
frequency
=
Collections
.
frequency
(
seqNumList
,
s
);
if
(
frequency
>
1
)
{
if
(
frequency
>
1
)
{
throw
new
ApiException
(
"序列号不能相同"
);
}
});
...
...
@@ -187,18 +196,18 @@ public class MatchingDeviceController {
//更新后的MatchingDeviceBill
MatchingDeviceBill
updateMatchingDeviceBill
;
//处理账单
if
(
matchingDeviceBillSaveVo
.
getTaskId
()
!=
null
){
if
(
matchingDeviceBillSaveVo
.
getTaskId
()
!=
null
)
{
//从草稿进来的
taskBto1
=
taskService
.
get
(
matchingDeviceBillSaveVo
.
getTaskId
());
MatchingDeviceBill
matchingDeviceBill
=
matchingDeviceBillService
.
getOne
(
taskBto1
.
getBillId
());
MatchingDeviceBill
matchingDeviceBill1
=
matchingDeviceBillSaveVo
.
toDo
();
matchingDeviceBill
.
setFileRets
(
FilesUtil
.
stringFileToList
(
matchingDeviceBillSaveVo
.
getFileRets
()));
BeanUtils
.
copyProperties
(
matchingDeviceBill1
,
matchingDeviceBill
);
BeanUtils
.
copyProperties
(
matchingDeviceBill1
,
matchingDeviceBill
);
updateMatchingDeviceBill
=
matchingDeviceBillService
.
update
(
matchingDeviceBill
);
//结束Task
taskService
.
addInvolveUser
(
taskBto1
,
userId
);
taskService
.
addInvolveUser
(
taskBto1
,
userId
);
taskService
.
moveToEnd
(
taskBto1
);
}
else
{
}
else
{
//发起新的任务
updateMatchingDeviceBill
=
matchingDeviceBillService
.
addEntity
(
matchingDeviceBillSaveVo
.
toDo
());
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
END
.
id
,
"新增配套"
,
null
,
"."
,
...
...
@@ -213,10 +222,9 @@ public class MatchingDeviceController {
List
<
PrintVo
>
printVos
=
new
ArrayList
<>();
List
<
MatchingDeviceLibrary
>
matchingDeviceLibraries
=
new
ArrayList
<>();
String
logMessage
;
if
(
isPrint
){
if
(
isPrint
)
{
logMessage
=
"新增配套设备入库(打印标签)"
;
}
else
{
}
else
{
logMessage
=
"新增配套设备入库(未打印标签)"
;
}
//存储配套设备
...
...
@@ -228,14 +236,14 @@ public class MatchingDeviceController {
stringBuffer
.
append
(
matchingDeviceLibrary
.
getId
());
stringBuffer
.
append
(
"x"
);
//存装备日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceLibrary
.
getId
(),
logMessage
,
fileVoList
,
taskBto1
.
getId
());
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceLibrary
.
getId
(),
logMessage
,
fileVoList
,
taskBto1
.
getId
());
deviceLogService
.
addLog
(
deviceLogDto
);
}
//是否打印标签
if
(
matchingDeviceBillSaveVo
.
getIsPrint
()
==
1
){
if
(
matchingDeviceBillSaveVo
.
getIsPrint
()
==
1
)
{
for
(
MatchingDeviceLibrary
matchingDeviceLibrary
:
matchingDeviceLibraries
)
{
printVos
.
add
(
new
PrintVo
(
String
.
valueOf
(
matchingDeviceLibrary
.
getId
()),
matchingDeviceLibrary
.
getModel
(),
matchingDeviceLibrary
.
getName
(),
matchingDeviceLibrary
.
getSeqNumber
()));
matchingDeviceLibrary
.
getName
(),
matchingDeviceLibrary
.
getSeqNumber
()));
matchingDeviceLibrary
.
setRfidCardId
(
MatchingDeviceRfidServiceImpl
.
completeRfidStr2
(
String
.
valueOf
(
matchingDeviceLibrary
.
getId
())));
matchingDeviceLibraryService
.
update
(
matchingDeviceLibrary
);
}
...
...
@@ -247,7 +255,7 @@ public class MatchingDeviceController {
matchingDeviceBillService
.
update
(
updateMatchingDeviceBill
);
//发送阅知信息
List
<
Integer
>
ids
=
userPublicService
.
findOtherUser
(
userId
);
MessageBto
messageBto
=
new
MessageBto
(
taskBto1
.
getId
(),
taskBto1
.
getBusinessType
(),
"发起配套设备入库"
,
ids
,
1
);
MessageBto
messageBto
=
new
MessageBto
(
taskBto1
.
getId
(),
taskBto1
.
getBusinessType
(),
"发起配套设备入库"
,
ids
,
1
);
messageService
.
add
(
messageBto
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"ok"
);
...
...
@@ -325,7 +333,7 @@ public class MatchingDeviceController {
for
(
Integer
d
:
list
)
{
MatchingDeviceLibrary
deviceLibraryEntity
=
matchingDeviceLibraryService
.
getOne
(
d
);
deviceLibraryEntity
.
setLifeStatus
(
2
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
deviceLibraryEntity
.
getId
(),
"添加配套设备审核成功"
,
null
,
taskBto
.
getId
());
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
deviceLibraryEntity
.
getId
(),
"添加配套设备审核成功"
,
null
,
taskBto
.
getId
());
deviceLogService
.
addLog
(
deviceLogDto
);
matchingDeviceLibraryService
.
update
(
deviceLibraryEntity
);
}
...
...
@@ -346,7 +354,7 @@ public class MatchingDeviceController {
for
(
Integer
d
:
list
)
{
MatchingDeviceLibrary
deviceLibraryEntity
=
matchingDeviceLibraryService
.
getOne
(
d
);
deviceLibraryEntity
.
setLifeStatus
(
1
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
deviceLibraryEntity
.
getId
(),
"添加配套设备审核失败"
,
null
,
taskBto
.
getId
());
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
deviceLibraryEntity
.
getId
(),
"添加配套设备审核失败"
,
null
,
taskBto
.
getId
());
deviceLogService
.
addLog
(
deviceLogDto
);
matchingDeviceLibraryService
.
update
(
deviceLibraryEntity
);
}
...
...
@@ -373,7 +381,7 @@ public class MatchingDeviceController {
List
<
MatchingDeviceLibrary
>
matchingDeviceLibraryList
=
matchingDeviceLibraryService
.
getMatchingDevicePage
(
matchingDeviceSelectVo
);
//处理装备的序列号
matchingDeviceLibraryList
.
forEach
(
matchingDeviceLibrary
->
{
if
(
matchingDeviceLibrary
.
getDeviceId
()
!=
null
&&
matchingDeviceLibrary
.
getDeviceId
()
!=
0
)
{
if
(
matchingDeviceLibrary
.
getDeviceId
()
!=
null
&&
matchingDeviceLibrary
.
getDeviceId
()
!=
0
)
{
String
seqNumber
=
deviceLibraryService
.
getOne
(
matchingDeviceLibrary
.
getDeviceId
()).
getSeqNumber
();
matchingDeviceLibrary
.
setDeviceSeqNumber
(
seqNumber
);
}
...
...
@@ -383,60 +391,74 @@ public class MatchingDeviceController {
// List<DeviceLibrary> deviceLibraries = deviceLibraryService.findAllByIds(ids);
// List<String> seqList = deviceLibraries.stream().map(DeviceLibrary::getSeqNumber).collect(Collectors.toList());
Boolean
hasModelDim
=
matchingDeviceSelectVo
.
getModelDim
()
!=
null
;
Boolean
hasNameDim
=
matchingDeviceSelectVo
.
getNameDim
()
!=
null
;
Boolean
hasSeqDim
=
matchingDeviceSelectVo
.
getSeqDim
()
!=
null
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
if
(
hasModelDim
||
hasNameDim
||
hasSeqDim
)
{
Boolean
hasModelDim
=
matchingDeviceSelectVo
.
getModelDim
()
!=
null
;
Boolean
hasNameDim
=
matchingDeviceSelectVo
.
getNameDim
()
!=
null
;
Boolean
hasSeqDim
=
matchingDeviceSelectVo
.
getSeqDim
()
!=
null
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
if
(
hasModelDim
||
hasNameDim
||
hasSeqDim
)
{
matchingDeviceLibraryList
=
matchingDeviceLibraryList
.
stream
().
filter
(
deviceLibrary
->
{
Boolean
containModelDim
=
!
hasModelDim
||
deviceLibrary
.
getModel
().
contains
(
matchingDeviceSelectVo
.
getModelDim
());
Boolean
containNameDim
=
!
hasNameDim
||
deviceLibrary
.
getName
().
contains
(
matchingDeviceSelectVo
.
getNameDim
());
Boolean
containSeqDim
=
!
hasSeqDim
||
deviceLibrary
.
getSeqNumber
().
contains
(
matchingDeviceSelectVo
.
getSeqDim
());
return
containModelDim
&&
containNameDim
&&
containSeqDim
;
Boolean
containModelDim
=
!
hasModelDim
||
deviceLibrary
.
getModel
().
contains
(
matchingDeviceSelectVo
.
getModelDim
());
Boolean
containNameDim
=
!
hasNameDim
||
deviceLibrary
.
getName
().
contains
(
matchingDeviceSelectVo
.
getNameDim
());
Boolean
containSeqDim
=
!
hasSeqDim
||
deviceLibrary
.
getSeqNumber
().
contains
(
matchingDeviceSelectVo
.
getSeqDim
());
return
containModelDim
&&
containNameDim
&&
containSeqDim
;
}).
collect
(
Collectors
.
toList
());
}
// List<DeviceVo> deviceVos = matchingDeviceLibraryList.stream().map(DeviceLibrary::parseVo).collect(Collectors.toList());
Page
<
MatchingDeviceLibrary
>
deviceLibraryEntities
=
PageUtil
.
getPerPage
(
matchingDeviceSelectVo
.
getPage
(),
matchingDeviceSelectVo
.
getSize
(),
matchingDeviceLibraryList
,
matchingDeviceSelectVo
.
getPageable
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
matchingDeviceLibraryList
=
matchingDeviceLibraryList
.
stream
().
map
(
MatchingDeviceLibrary:
:
setConfigName
).
collect
(
Collectors
.
toList
());
map
.
put
(
"pages"
,
deviceLibraryEntities
);
map
.
put
(
"pages"
,
deviceLibraryEntities
);
ConfigCache
configCache
=
SpringUtils
.
getBean
(
"initConfigCache"
);
List
<
String
>
types
=
matchingDeviceLibraryList
.
stream
().
map
(
MatchingDeviceLibrary:
:
getType
).
collect
(
Collectors
.
toList
());
List
<
String
>
finalTypes
=
types
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
assert
configCache
!=
null
;
Map
<
Integer
,
String
>
matchingTypeMap
=
configCache
.
getMatchingTypeMap
().
entrySet
().
stream
().
filter
(
map1
->
finalTypes
.
contains
(
map1
.
getKey
().
toString
())).
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
map
.
put
(
"type"
,
matchingTypeMap
);
Map
<
Integer
,
String
>
matchingTypeMap
=
configCache
.
getMatchingTypeMap
().
entrySet
().
stream
().
filter
(
map1
->
finalTypes
.
contains
(
map1
.
getKey
().
toString
())).
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
));
map
.
put
(
"type"
,
matchingTypeMap
);
//修改 增加排序
//做一下去重
List
<
String
>
models
=
matchingDeviceLibraryList
.
stream
().
map
(
MatchingDeviceLibrary:
:
getModel
).
collect
(
Collectors
.
toList
());
List
<
String
>
finalModels
=
models
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
List
<
String
>
modelToSort
=
DeviceModelSort
.
modelToSort
(
finalModels
);
map
.
put
(
"models"
,
modelToSort
);
map
.
put
(
"models"
,
modelToSort
);
List
<
String
>
names
=
matchingDeviceLibraryList
.
stream
().
map
(
MatchingDeviceLibrary:
:
getName
).
collect
(
Collectors
.
toList
());
List
<
String
>
nameList
=
names
.
stream
().
distinct
().
sorted
(
Comparator
.
comparing
(
s
->
s
)).
collect
(
Collectors
.
toList
());
map
.
put
(
"names"
,
nameList
);
map
.
put
(
"names"
,
nameList
);
List
<
Integer
>
storageLocationIdList
=
matchingDeviceLibraryList
.
stream
().
map
(
MatchingDeviceLibrary:
:
getMatchingDeviceStorageLocationId
).
distinct
()
.
collect
(
Collectors
.
toList
());
Map
<
Integer
,
String
>
cacheIdMap
=
storeCache
.
getIdMap
();
List
<
StorageLocationVO
>
storageLocationList
=
new
ArrayList
<>();
storageLocationIdList
.
forEach
(
integer
->
{
String
s
=
cacheIdMap
.
get
(
integer
);
StorageLocationVO
storageLocationVO
=
new
StorageLocationVO
();
storageLocationVO
.
setMatchingDeviceStorageLocation
(
s
);
storageLocationVO
.
setMatchingDeviceStorageLocationId
(
integer
);
storageLocationList
.
add
(
storageLocationVO
);
});
map
.
put
(
"storageLocation"
,
storageLocationList
);
return
ResponseEntity
.
ok
(
map
);
}
@ApiOperation
(
value
=
"查询配套装备详情"
,
notes
=
"可以通过这个接口查询配套装备详情"
)
@GetMapping
(
"/feature/detail/{id}"
)
public
ResponseEntity
getDetail
(
@PathVariable
(
"id"
)
@Min
(
value
=
1
,
message
=
"id不能小于1"
)
int
id
)
{
public
ResponseEntity
getDetail
(
@PathVariable
(
"id"
)
@Min
(
value
=
1
,
message
=
"id不能小于1"
)
int
id
)
{
List
<
Object
>
list
=
new
ArrayList
<>();
Map
<
String
,
List
<
Object
>>
map
=
new
HashMap
<>();
Map
<
String
,
List
<
Object
>>
map
=
new
HashMap
<>();
//添加配套设备详情
MatchingDeviceLibrary
m
=
matchingDeviceLibraryService
.
getOne
(
id
);
list
.
add
(
m
);
//添加关联装备详情
if
(
m
.
getDeviceId
()!=
null
)
{
if
(
m
.
getDeviceId
()
!=
null
)
{
if
(
m
.
getDeviceId
()
!=
0
)
{
List
<
Object
>
deviceLibraryList
=
new
ArrayList
<>();
DeviceLibrary
deviceLibrary
=
deviceLibraryService
.
getOne
(
m
.
getDeviceId
());
deviceLibraryList
.
add
(
deviceLibrary
);
map
.
put
(
"deviceLibrary"
,
deviceLibraryList
);
map
.
put
(
"deviceLibrary"
,
deviceLibraryList
);
}
else
{
map
.
put
(
"deviceLibrary"
,
new
ArrayList
<>());
map
.
put
(
"deviceLibrary"
,
new
ArrayList
<>());
}
}
...
...
@@ -448,7 +470,7 @@ public class MatchingDeviceController {
Comparator
.
nullsLast
(
Date:
:
compareTo
).
reversed
()))
.
collect
(
Collectors
.
toList
());
list
.
add
(
deviceLogs
);
map
.
put
(
"list"
,
list
);
map
.
put
(
"list"
,
list
);
return
ResponseEntity
.
ok
(
map
);
}
...
...
@@ -463,15 +485,15 @@ public class MatchingDeviceController {
if
(
matchingDeviceEditVo
.
getCreateUnit
()
!=
null
&&
!
m
.
getCreateUnit
().
equals
(
matchingDeviceEditVo
.
getCreateUnit
()))
{
//添加设备日志
String
remark
=
"将设备的创建单位由"
+
m
.
getCreateUnit
()
+
"改为"
+
matchingDeviceEditVo
.
getCreateUnit
();
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
m
.
setCreateUnit
(
matchingDeviceEditVo
.
getCreateUnit
());
m
.
setCreateUnitId
(
matchingDeviceEditVo
.
getCreateUnitId
());
}
if
(
matchingDeviceEditVo
.
getLifeStatus
()
!=
null
&&
!
m
.
getLifeStatus
().
equals
(
matchingDeviceEditVo
.
getLifeStatus
()))
{
//添加设备日志
String
remark
=
"将设备的生命状态由"
+
configCache
.
getLifeStatusMap
().
getOrDefault
(
m
.
getLifeStatus
(),
"空"
)
+
"改为"
+
configCache
.
getLifeStatusMap
().
get
(
matchingDeviceEditVo
.
getLifeStatus
());
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
String
remark
=
"将设备的生命状态由"
+
configCache
.
getLifeStatusMap
().
getOrDefault
(
m
.
getLifeStatus
(),
"空"
)
+
"改为"
+
configCache
.
getLifeStatusMap
().
get
(
matchingDeviceEditVo
.
getLifeStatus
());
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
m
.
setLifeStatus
(
matchingDeviceEditVo
.
getLifeStatus
());
}
...
...
@@ -479,32 +501,32 @@ public class MatchingDeviceController {
//添加设备日志
DeviceLibrary
deviceLibrary
=
deviceLibraryService
.
getOne
(
matchingDeviceEditVo
.
getDeviceId
());
String
remark
=
"将该设备与装备序列号为"
+
deviceLibrary
.
getRfidSurfaceId
()
+
"的装备绑定"
;
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
m
.
setDeviceId
(
matchingDeviceEditVo
.
getDeviceId
());
}
if
(
matchingDeviceEditVo
.
getModel
()
!=
null
&&
!
m
.
getModel
().
equals
(
matchingDeviceEditVo
.
getModel
()))
{
//添加设备日志
String
remark
=
"将设备的型号由"
+
m
.
getModel
()
+
"改为"
+
matchingDeviceEditVo
.
getModel
();
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
m
.
setModel
(
matchingDeviceEditVo
.
getModel
());
}
if
(
matchingDeviceEditVo
.
getName
()
!=
null
&&
!
m
.
getName
().
equals
(
matchingDeviceEditVo
.
getName
()))
{
//添加设备日志
String
remark
=
"将设备的名称由"
+
m
.
getName
()
+
"改为"
+
matchingDeviceEditVo
.
getName
();
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
m
.
setName
(
matchingDeviceEditVo
.
getName
());
}
if
(
matchingDeviceEditVo
.
getSeqNumber
()
!=
null
&&
!
m
.
getSeqNumber
().
equals
(
matchingDeviceEditVo
.
getSeqNumber
()))
{
//添加设备日志
String
remark
=
"将设备的序列号由"
+
m
.
getSeqNumber
()
+
"改为"
+
matchingDeviceEditVo
.
getSeqNumber
();
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
if
(
seqNumberList
.
contains
(
matchingDeviceEditVo
.
getSeqNumber
())){
throw
new
ApiException
(
"序列号"
+
matchingDeviceEditVo
.
getSeqNumber
()+
"已经存在"
);
}
else
{
if
(
seqNumberList
.
contains
(
matchingDeviceEditVo
.
getSeqNumber
()))
{
throw
new
ApiException
(
"序列号"
+
matchingDeviceEditVo
.
getSeqNumber
()
+
"已经存在"
);
}
else
{
m
.
setSeqNumber
(
matchingDeviceEditVo
.
getSeqNumber
());
}
}
...
...
@@ -512,27 +534,27 @@ public class MatchingDeviceController {
//添加设备日志 需要前端同时传递type和typeName
// String remark = "将设备类型由" + m.getType() + "改为" + matchingDeviceEditVo.getType();
String
remark
=
"将设备类型由"
+
m
.
getTypeName
()
+
"改为"
+
matchingDeviceEditVo
.
getTypeName
();
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
m
.
setType
(
matchingDeviceEditVo
.
getType
());
m
.
setTypeName
(
matchingDeviceEditVo
.
getTypeName
());
}
//添加绑定和解绑装备
//添加
if
(
matchingDeviceEditVo
.
getAddDeviceId
()
!=
null
&&
!
matchingDeviceEditVo
.
getAddDeviceId
().
equals
(
m
.
getDeviceId
())){
if
(
matchingDeviceEditVo
.
getAddDeviceId
()
!=
null
&&
!
matchingDeviceEditVo
.
getAddDeviceId
().
equals
(
m
.
getDeviceId
()))
{
DeviceLibrary
deviceLibrary
=
deviceLibraryService
.
getOne
(
matchingDeviceEditVo
.
getAddDeviceId
());
String
remark
=
"将序列号为"
+
m
.
getSeqNumber
()
+
"的配套装备与序列号为"
+
deviceLibrary
.
getSeqNumber
()
+
"的装备绑定"
;
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
m
.
getId
(),
remark
,
null
,
null
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
m
.
getId
(),
remark
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
m
.
setDeviceId
(
matchingDeviceEditVo
.
getAddDeviceId
());
}
//删除
//zjm 上面执行了下面回覆盖上面的赋值
if
(
matchingDeviceEditVo
.
getAddDeviceId
()
==
null
&&
matchingDeviceEditVo
.
getDeleteDeviceId
()
!=
null
){
if
(
matchingDeviceEditVo
.
getAddDeviceId
()
==
null
&&
matchingDeviceEditVo
.
getDeleteDeviceId
()
!=
null
)
{
DeviceLibrary
deviceLibrary
=
deviceLibraryService
.
getOne
(
matchingDeviceEditVo
.
getDeleteDeviceId
());
String
remark
=
"将序列号为"
+
m
.
getSeqNumber
()
+
"的配套装备与序列号为"
+
deviceLibrary
.
getSeqNumber
()
+
"的装备进行解除绑定"
;
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
m
.
getId
(),
remark
,
null
,
null
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
m
.
getId
(),
remark
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
m
.
setDeviceId
(
0
);
...
...
@@ -542,7 +564,7 @@ public class MatchingDeviceController {
!
matchingDeviceEditVo
.
getMatchingDeviceStorageLocation
().
equals
(
m
.
getMatchingDeviceStorageLocation
()))
{
//添加设备日志 存放位置
String
remark
=
"将设备的存放位置改为"
+
matchingDeviceEditVo
.
getMatchingDeviceStorageLocation
();
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
1
,
matchingDeviceEditVo
.
getMatchingDeviceId
(),
remark
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
m
.
setMatchingDeviceStorageLocation
(
matchingDeviceEditVo
.
getMatchingDeviceStorageLocation
());
m
.
setMatchingDeviceStorageLocationId
(
matchingDeviceEditVo
.
getMatchingDeviceStorageLocationId
());
...
...
@@ -581,13 +603,13 @@ public class MatchingDeviceController {
@ApiOperation
(
value
=
"根据任务id查询相关单据"
,
notes
=
"根据任务id查询相关单据"
)
@GetMapping
(
value
=
"/fileMap/{taskId}"
)
public
ResponseEntity
selectFileRetMap
(
@PathVariable
(
"taskId"
)
int
taskId
)
{
Map
<
String
,
List
<
FileRet
>>
map
=
new
HashMap
<>();
Map
<
String
,
List
<
FileRet
>>
map
=
new
HashMap
<>();
//获取业务
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
//获取账单
MatchingDeviceBill
matchingDeviceBillEntity
=
matchingDeviceBillService
.
getOne
(
taskBto
.
getBillId
());
//获取设备
map
.
put
(
"配发单"
,
FilesUtil
.
stringFileToList
(
matchingDeviceBillEntity
.
getFileRets
()));
map
.
put
(
"配发单"
,
FilesUtil
.
stringFileToList
(
matchingDeviceBillEntity
.
getFileRets
()));
return
ResponseEntity
.
ok
(
map
);
}
...
...
@@ -605,26 +627,26 @@ public class MatchingDeviceController {
@ApiOperation
(
value
=
"上传维修单"
,
notes
=
"上传维修单"
)
@PostMapping
(
value
=
"/repair"
)
public
ResponseEntity
uploadRepairBill
(
@RequestBody
@Validated
MatchingRepairVo
matchingRepairVo
){
public
ResponseEntity
uploadRepairBill
(
@RequestBody
@Validated
MatchingRepairVo
matchingRepairVo
)
{
MatchingRepairBill
matchingRepairBill
=
new
MatchingRepairBill
();
BeanUtils
.
copyProperties
(
matchingRepairVo
,
matchingRepairBill
);
BeanUtils
.
copyProperties
(
matchingRepairVo
,
matchingRepairBill
);
return
ResponseEntity
.
ok
(
matchingRepairBillDao
.
save
(
matchingRepairBill
));
}
@ApiOperation
(
value
=
"自动生成配套设备的序列号"
,
notes
=
"可以通过这个接口自动生成配套设备序列号"
)
@PostMapping
(
value
=
"/autoCreateForMatchingDevice"
)
public
ResponseEntity
autoCreateForMatchingDevice
(
@RequestBody
MatchingDeviceCreateSeqVo
createSeqVo
){
public
ResponseEntity
autoCreateForMatchingDevice
(
@RequestBody
MatchingDeviceCreateSeqVo
createSeqVo
)
{
Integer
num
=
createSeqVo
.
getNum
();
//查询该型号是否是第一次生成(需要保证后4位数唯一)
List
<
String
>
byModelForSeqNumber
=
matchingDeviceLibraryService
.
findByModelForSeqNumber
(
createSeqVo
.
getModel
());
int
start
=
0
;
if
(!
CollectionUtils
.
isEmpty
(
byModelForSeqNumber
)
&&
byModelForSeqNumber
.
size
()>
0
)
{
int
start
=
0
;
if
(!
CollectionUtils
.
isEmpty
(
byModelForSeqNumber
)
&&
byModelForSeqNumber
.
size
()
>
0
)
{
//说明数据库中存有该集合中的数字 取出最大的
String
s
=
byModelForSeqNumber
.
get
(
0
);
start
=
Integer
.
parseInt
(
s
);
}
List
<
String
>
seq2
=
createSeq
(
start
+
1
,
start
+
1
+
num
);
List
<
String
>
seq2
=
createSeq
(
start
+
1
,
start
+
1
+
num
);
String
model
=
createSeqVo
.
getModel
();
//通过型号查询对应的id
...
...
@@ -632,17 +654,17 @@ public class MatchingDeviceController {
// MatchingDeviceModel matchingDeviceModel = matchingDeviceModelService.findByModelAndName(model, createSeqVo.getName());
String
style1
=
createSeqVo
.
getStyle
();
MatchingDeviceModel
matchingDeviceModel
;
if
(
style1
==
null
||
"0"
.
equals
(
style1
)){
if
(
style1
==
null
||
"0"
.
equals
(
style1
))
{
matchingDeviceModel
=
matchingDeviceModelService
.
findByModelAndNameAndStyle
(
model
,
createSeqVo
.
getName
(),
createSeqVo
.
getStyle
());
}
else
{
}
else
{
matchingDeviceModel
=
matchingDeviceModelService
.
findByModelAndName
(
model
,
createSeqVo
.
getName
());
}
String
idString
;
if
(
matchingDeviceModel
!=
null
){
if
(
matchingDeviceModel
!=
null
)
{
idString
=
matchingDeviceModel
.
getId
().
toString
();
}
else
{
}
else
{
MatchingDeviceModel
matchingDeviceModel1
=
new
MatchingDeviceModel
();
matchingDeviceModel1
.
setModel
(
model
);
matchingDeviceModel1
.
setName
(
createSeqVo
.
getName
());
...
...
@@ -650,26 +672,26 @@ public class MatchingDeviceController {
MatchingDeviceModel
addEntity
=
matchingDeviceModelService
.
addEntity
(
matchingDeviceModel1
);
idString
=
addEntity
.
getId
().
toString
();
}
switch
(
idString
.
length
()){
switch
(
idString
.
length
())
{
case
1
:
idString
=
"000"
+
idString
;
idString
=
"000"
+
idString
;
break
;
case
2
:
idString
=
"00"
+
idString
;
idString
=
"00"
+
idString
;
break
;
case
3
:
idString
=
"0"
+
idString
;
idString
=
"0"
+
idString
;
break
;
default
:
break
;
}
String
type
=
"02"
;
String
style
=
createSeqVo
.
getStyle
();
String
modelTypeStyle
;
if
(
style
.
length
()
<
2
)
{
style
=
"0"
+
style
;
String
modelTypeStyle
;
if
(
style
.
length
()
<
2
)
{
style
=
"0"
+
style
;
}
modelTypeStyle
=
idString
+
type
+
style
;
modelTypeStyle
=
idString
+
type
+
style
;
// if (style == null || "0".equals(style)){
// modelTypeStyle= idString+type;
...
...
@@ -683,21 +705,21 @@ public class MatchingDeviceController {
StringBuilder
stringBuilder
=
new
StringBuilder
();
if
(
num
==
1
){
if
(
num
==
1
)
{
stringBuilder
.
append
(
modelTypeStyle
)
.
append
(
seq2
.
get
(
0
));
}
else
{
}
else
{
stringBuilder
.
append
(
modelTypeStyle
)
.
append
(
seq2
.
get
(
0
))
.
append
(
"-"
)
.
append
(
modelTypeStyle
)
.
append
(
seq2
.
get
(
seq2
.
size
()
-
1
));
.
append
(
seq2
.
get
(
seq2
.
size
()
-
1
));
}
List
<
String
>
updateSeq2
=
seq2
.
stream
().
map
(
str
->
modelTypeStyle
+
str
).
collect
(
Collectors
.
toList
());
MatchingDeviceSeqVo
matchingDeviceSeqVo
=
new
MatchingDeviceSeqVo
(
model
,
createSeqVo
.
getName
(),
style
,
num
,
stringBuilder
.
toString
(),
updateSeq2
);
style
,
num
,
stringBuilder
.
toString
(),
updateSeq2
);
return
ResponseEntity
.
ok
(
matchingDeviceSeqVo
);
}
...
...
@@ -706,7 +728,7 @@ public class MatchingDeviceController {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
saveStorageBill
(
@RequestBody
MatchingDeviceBillSaveVo
matchingDeviceBillSaveVo
)
{
//第一次保存
if
(
matchingDeviceBillSaveVo
.
getTaskId
()
==
null
)
{
if
(
matchingDeviceBillSaveVo
.
getTaskId
()
==
null
)
{
//保存入库单
Integer
userId
=
userUtils
.
getCurrentUserId
();
List
<
Integer
>
userIds
=
new
ArrayList
<>();
...
...
@@ -716,68 +738,68 @@ public class MatchingDeviceController {
MatchingDeviceBill
matchingDeviceBill1
=
matchingDeviceBillService
.
addEntity
(
matchingDeviceBill
);
//发起任务
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_STORAGE
.
id
,
matchingDeviceBillSaveVo
.
getUseraId
()
+
"进行了新增配套设备业务"
,
null
,
matchingDeviceBillSaveVo
.
getUseraId
()
+
"进行了新增配套设备业务"
,
null
,
"."
,
matchingDeviceBill
.
getId
(),
19
,
userUtils
.
getCurrentUnitId
(),
0
,
null
,
userIds
);
TaskBto
taskBto1
=
taskService
.
start
(
taskBto
);
myWebSocket
.
sendMessage1
();
return
ResponseEntity
.
ok
(
"保存成功"
+
taskBto1
.
getId
());
}
else
{
return
ResponseEntity
.
ok
(
"保存成功"
+
taskBto1
.
getId
());
}
else
{
//更新账单
TaskBto
taskBto
=
taskService
.
get
(
matchingDeviceBillSaveVo
.
getTaskId
());
MatchingDeviceBill
matchingDeviceBill
=
matchingDeviceBillService
.
getOne
(
taskBto
.
getBillId
());
MatchingDeviceBill
matchingDeviceBill1
=
matchingDeviceBillSaveVo
.
toDo
();
matchingDeviceBill1
.
setBillStatus
(
0
);
MapperUtils
.
copyNoNullProperties
(
matchingDeviceBill1
,
matchingDeviceBill
);
MapperUtils
.
copyNoNullProperties
(
matchingDeviceBill1
,
matchingDeviceBill
);
matchingDeviceBillService
.
update
(
matchingDeviceBill
);
return
ResponseEntity
.
ok
(
"更新成功"
+
taskBto
.
getId
());
return
ResponseEntity
.
ok
(
"更新成功"
+
taskBto
.
getId
());
}
}
@ApiOperation
(
value
=
"查询可绑定的装备"
,
notes
=
"查询可绑定的装备"
)
@PostMapping
(
"/selectDevices"
)
public
ResponseEntity
selectPartDevice
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
){
Boolean
hasModelDim
=
deviceLibrarySelectVo
.
getModelDim
()
!=
null
;
Boolean
hasNameDim
=
deviceLibrarySelectVo
.
getNameDim
()
!=
null
;
Boolean
hasSeqDim
=
deviceLibrarySelectVo
.
getSeqDim
()
!=
null
;
Boolean
hasLocationUnitDim
=
deviceLibrarySelectVo
.
getLocationUnitDim
()
!=
null
;
Boolean
hasOwnUnitDim
=
deviceLibrarySelectVo
.
getOwnUnitDim
()
!=
null
;
Boolean
hasLifeStatusDim
=
deviceLibrarySelectVo
.
getLifeStatusDim
()
!=
null
;
Boolean
hasUpdateTimeDim
=
deviceLibrarySelectVo
.
getUpdateTimeDim
()
!=
null
;
Boolean
hasRfidCardDim
=
deviceLibrarySelectVo
.
getRfidCardDim
()
!=
null
;
public
ResponseEntity
selectPartDevice
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
)
{
Boolean
hasModelDim
=
deviceLibrarySelectVo
.
getModelDim
()
!=
null
;
Boolean
hasNameDim
=
deviceLibrarySelectVo
.
getNameDim
()
!=
null
;
Boolean
hasSeqDim
=
deviceLibrarySelectVo
.
getSeqDim
()
!=
null
;
Boolean
hasLocationUnitDim
=
deviceLibrarySelectVo
.
getLocationUnitDim
()
!=
null
;
Boolean
hasOwnUnitDim
=
deviceLibrarySelectVo
.
getOwnUnitDim
()
!=
null
;
Boolean
hasLifeStatusDim
=
deviceLibrarySelectVo
.
getLifeStatusDim
()
!=
null
;
Boolean
hasUpdateTimeDim
=
deviceLibrarySelectVo
.
getUpdateTimeDim
()
!=
null
;
Boolean
hasRfidCardDim
=
deviceLibrarySelectVo
.
getRfidCardDim
()
!=
null
;
//库存位置
Boolean
hasStorageLocationDim
=
deviceLibrarySelectVo
.
getRfidCardDim
()!=
null
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Boolean
hasStorageLocationDim
=
deviceLibrarySelectVo
.
getRfidCardDim
()
!=
null
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
List
<
DeviceLibrary
>
resultList
=
deviceLibraryService
.
getCoreDevicePage
(
deviceLibrarySelectVo
);
if
(
deviceLibrarySelectVo
.
getDeviceId
()
!=
null
){
if
(
deviceLibrarySelectVo
.
getDeviceId
()
!=
null
)
{
List
<
Integer
>
ids
=
new
ArrayList
<>(
Collections
.
singletonList
(
deviceLibrarySelectVo
.
getDeviceId
()));
resultList
=
resultList
.
stream
()
.
filter
(
deviceLibrary
->
deviceLibrary
.
getIsPart
()
==
0
&&
!
ids
.
contains
(
deviceLibrary
.
getId
()))
.
collect
(
Collectors
.
toList
());
}
else
{
}
else
{
resultList
=
resultList
.
stream
()
.
filter
(
deviceLibrary
->
deviceLibrary
.
getIsPart
()
==
0
)
.
collect
(
Collectors
.
toList
());
}
if
(
hasModelDim
||
hasLifeStatusDim
||
hasLocationUnitDim
||
hasNameDim
||
hasOwnUnitDim
||
hasSeqDim
)
{
if
(
hasModelDim
||
hasLifeStatusDim
||
hasLocationUnitDim
||
hasNameDim
||
hasOwnUnitDim
||
hasSeqDim
)
{
resultList
=
resultList
.
stream
().
filter
(
deviceLibrary
->
{
Boolean
containModelDim
=
!
hasModelDim
||
deviceLibrary
.
getModel
().
contains
(
deviceLibrarySelectVo
.
getModelDim
());
Boolean
containNameDim
=
!
hasNameDim
||
deviceLibrary
.
getName
().
contains
(
deviceLibrarySelectVo
.
getNameDim
());
Boolean
containSeqDim
=
!
hasSeqDim
||
deviceLibrary
.
getSeqNumber
().
contains
(
deviceLibrarySelectVo
.
getSeqDim
());
Boolean
containLocationUnitDim
=
!
hasLocationUnitDim
||
deviceLibrary
.
getLocationUnit
().
contains
(
deviceLibrarySelectVo
.
getLocationUnitDim
());
Boolean
containOwnUnitDim
=
!
hasOwnUnitDim
||
deviceLibrary
.
getOwnUnit
().
contains
(
deviceLibrarySelectVo
.
getOwnUnitDim
());
Boolean
containLifeStatusDim
=
!
hasLifeStatusDim
||
deviceLibrary
.
getLifeStatusName
().
contains
(
deviceLibrarySelectVo
.
getLifeStatusDim
());
Boolean
containUpdateTimeDim
=
!
hasUpdateTimeDim
||
sdf
.
format
(
deviceLibrary
.
getUpdateTime
()).
contains
(
deviceLibrarySelectVo
.
getUpdateTimeDim
());
Boolean
containRfidCardDim
=
!
hasRfidCardDim
||(
deviceLibrary
.
getRfidCardId
()!=
null
&&
deviceLibrary
.
getRfidCardId
().
contains
(
deviceLibrarySelectVo
.
getRfidCardDim
()));
Boolean
containStorageLocationDim
=
!
hasStorageLocationDim
||
deviceLibrary
.
getStorageLocation
().
contains
(
deviceLibrarySelectVo
.
getStorageLocationDim
());
Boolean
containModelDim
=
!
hasModelDim
||
deviceLibrary
.
getModel
().
contains
(
deviceLibrarySelectVo
.
getModelDim
());
Boolean
containNameDim
=
!
hasNameDim
||
deviceLibrary
.
getName
().
contains
(
deviceLibrarySelectVo
.
getNameDim
());
Boolean
containSeqDim
=
!
hasSeqDim
||
deviceLibrary
.
getSeqNumber
().
contains
(
deviceLibrarySelectVo
.
getSeqDim
());
Boolean
containLocationUnitDim
=
!
hasLocationUnitDim
||
deviceLibrary
.
getLocationUnit
().
contains
(
deviceLibrarySelectVo
.
getLocationUnitDim
());
Boolean
containOwnUnitDim
=
!
hasOwnUnitDim
||
deviceLibrary
.
getOwnUnit
().
contains
(
deviceLibrarySelectVo
.
getOwnUnitDim
());
Boolean
containLifeStatusDim
=
!
hasLifeStatusDim
||
deviceLibrary
.
getLifeStatusName
().
contains
(
deviceLibrarySelectVo
.
getLifeStatusDim
());
Boolean
containUpdateTimeDim
=
!
hasUpdateTimeDim
||
sdf
.
format
(
deviceLibrary
.
getUpdateTime
()).
contains
(
deviceLibrarySelectVo
.
getUpdateTimeDim
());
Boolean
containRfidCardDim
=
!
hasRfidCardDim
||
(
deviceLibrary
.
getRfidCardId
()
!=
null
&&
deviceLibrary
.
getRfidCardId
().
contains
(
deviceLibrarySelectVo
.
getRfidCardDim
()));
Boolean
containStorageLocationDim
=
!
hasStorageLocationDim
||
deviceLibrary
.
getStorageLocation
().
contains
(
deviceLibrarySelectVo
.
getStorageLocationDim
());
// Boolean containTypeDim = !hasTypeDim||deviceLibrary.getType().contains(deviceLibrarySelectVo.getTypeDim());
return
containModelDim
&&
containNameDim
&&
containSeqDim
&&
containLocationUnitDim
&&
containOwnUnitDim
&&
containLifeStatusDim
&&
containUpdateTimeDim
&&
containRfidCardDim
&&
containStorageLocationDim
;
return
containModelDim
&&
containNameDim
&&
containSeqDim
&&
containLocationUnitDim
&&
containOwnUnitDim
&&
containLifeStatusDim
&&
containUpdateTimeDim
&&
containRfidCardDim
&&
containStorageLocationDim
;
}).
collect
(
Collectors
.
toList
());
}
// List<DeviceVo> deviceVos = resultList.stream().map(DeviceLibrary::parseVo).collect(Collectors.toList());
Page
<
DeviceLibrary
>
deviceLibraryEntities
=
PageUtil
.
getPerPage
(
deviceLibrarySelectVo
.
getPage
(),
deviceLibrarySelectVo
.
getSize
(),
resultList
,
deviceLibrarySelectVo
.
getPageable
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
Integer
,
String
>
lifeStatusMap
=
configCache
.
getLifeStatusMap
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
Integer
,
String
>
lifeStatusMap
=
configCache
.
getLifeStatusMap
();
//
Map
<
Integer
,
String
>
styleMap
=
configCache
.
getStyleMap
();
...
...
@@ -800,30 +822,30 @@ public class MatchingDeviceController {
types
.
add
(
deviceVo
.
getType
());
});
map
.
put
(
"pages"
,
deviceLibraryEntities
);
map
.
put
(
"pages"
,
deviceLibraryEntities
);
//修改 增加排序
//做一下去重
List
<
String
>
finalModels
=
models
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
List
<
String
>
modelToSort
=
DeviceModelSort
.
modelToSort
(
finalModels
);
map
.
put
(
"models"
,
modelToSort
);
map
.
put
(
"models"
,
modelToSort
);
List
<
String
>
nameList
=
names
.
stream
().
distinct
().
sorted
(
Comparator
.
comparing
(
s
->
s
)).
collect
(
Collectors
.
toList
());
map
.
put
(
"names"
,
nameList
);
map
.
put
(
"names"
,
nameList
);
List
<
String
>
finalOwnUnits
=
DeviceModelSort
.
unitToSort
(
ownUnits
);
map
.
put
(
"ownUnits"
,
finalOwnUnits
.
stream
().
distinct
().
collect
(
Collectors
.
toList
()));
map
.
put
(
"ownUnits"
,
finalOwnUnits
.
stream
().
distinct
().
collect
(
Collectors
.
toList
()));
List
<
String
>
finalLocationUnits
=
DeviceModelSort
.
unitToSort
(
locationUnits
);
map
.
put
(
"locationUnits"
,
finalLocationUnits
.
stream
().
distinct
().
collect
(
Collectors
.
toList
()));
map
.
put
(
"lifeStatus"
,
status
.
stream
().
map
(
integer
->
new
LifeStatusVo
(
integer
,
lifeStatusMap
.
get
(
integer
))).
collect
(
Collectors
.
toList
()));
map
.
put
(
"storageLocation"
,
storageLocation
);
map
.
put
(
"locationUnits"
,
finalLocationUnits
.
stream
().
distinct
().
collect
(
Collectors
.
toList
()));
map
.
put
(
"lifeStatus"
,
status
.
stream
().
map
(
integer
->
new
LifeStatusVo
(
integer
,
lifeStatusMap
.
get
(
integer
))).
collect
(
Collectors
.
toList
()));
map
.
put
(
"storageLocation"
,
storageLocation
);
//形态
List
<
TypeVo
>
typeVoList
=
types
.
stream
().
distinct
().
map
(
integer
->
new
TypeVo
(
integer
,
styleMap
.
get
(
integer
))).
sorted
(
Comparator
.
comparing
(
TypeVo:
:
getType
)).
collect
(
Collectors
.
toList
());
map
.
put
(
"types"
,
typeVoList
);
map
.
put
(
"types"
,
typeVoList
);
return
ResultUtil
.
success
(
map
);
}
@ApiModelProperty
(
value
=
"关联装备"
,
notes
=
"关联装备"
)
@ApiModelProperty
(
value
=
"关联装备"
,
notes
=
"关联装备"
)
@PostMapping
(
"/relationDevice"
)
private
ResponseEntity
relationDevice
(
@RequestBody
RelationDeviceVo
relationDeviceVo
){
private
ResponseEntity
relationDevice
(
@RequestBody
RelationDeviceVo
relationDeviceVo
)
{
matchingDeviceLibraryService
.
relationDevice
(
relationDeviceVo
);
return
ResponseEntity
.
ok
(
"关联成功"
);
}
...
...
@@ -844,27 +866,40 @@ public class MatchingDeviceController {
return
ResponseEntity
.
ok
(
matchingDeviceLibrary
.
getRfidCardId
());
}
// @ApiOperation(value = "修改单位名称从而修改配套设备的创建单位", notes = "修改单位名称从而修改配套设备的创建单位")
// @PostMapping("/updateMatchingDeviceCreateUnitName")
// @Transactional(rollbackFor = Exception.class)
// public ResponseEntity<String> updateMatchingDeviceCreateUnitName(@RequestBody Units units) {
// String name = unitsCache.findById(units.getUnitId()).getName();
// UpdateUnitVo updateUnitVo = new UpdateUnitVo();
// MatchingUnitVo matchingUnitVo = new MatchingUnitVo();
// //调用单位
// unitsService.updateUnit(units);
// if (!name.equals(units.getName())){
// updateUnitVo.setOriginUnitName(name);
// updateUnitVo.setUpdateUnitName(units.getName());
// matchingUnitVo.setOriginUnitName(name);
// matchingUnitVo.setUpdateUnitName(units.getName());
// CompletableFuture.runAsync(()->deviceLibraryService.updateDeviceLocationAndOwnUnit(updateUnitVo));
// CompletableFuture.runAsync(()->matchingDeviceLibraryService.updateMatchingDeviceCreateUnitNameByUnitName(matchingUnitVo));
// }
// return ResponseEntity.ok("修改成功");
// }
@ApiOperation
(
value
=
"批量修改存放位置"
,
notes
=
"批量修改存放位置"
)
@PostMapping
(
"/batchUpdateLocation"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
batchUpdateLocation
(
@RequestBody
LocationVO
locationVO
)
{
List
<
DeviceLogDto
>
deviceLogDtos
=
new
ArrayList
<>();
List
<
Integer
>
deviceIds
=
locationVO
.
getMatchingDeviceId
();
Integer
userId
=
userUtils
.
getCurrentUserId
();
if
(!
CollectionUtils
.
isEmpty
(
deviceIds
))
{
//添加装备日志
deviceIds
.
forEach
(
integer
->
{
Integer
storageLocationId
=
locationVO
.
getMatchingDeviceStorageLocationId
();
//数据库中的库房id
MatchingDeviceLibrary
matchingDeviceLibrary
=
matchingDeviceLibraryService
.
getOne
(
integer
);
Integer
dataStorageLocationId
=
matchingDeviceLibrary
.
getMatchingDeviceStorageLocationId
();
if
(!
storageLocationId
.
equals
(
dataStorageLocationId
))
{
String
remark
=
matchingDeviceLibrary
.
getMatchingDeviceStorageLocation
()
==
null
?
"空"
:
matchingDeviceLibrary
.
getMatchingDeviceStorageLocation
();
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
integer
,
"将存放位置修改为"
+
remark
,
null
,
userId
);
deviceLogDto
.
setType
(
1
);
deviceLogDtos
.
add
(
deviceLogDto
);
matchingDeviceLibrary
.
setMatchingDeviceStorageLocationId
(
storageLocationId
);
matchingDeviceLibrary
.
setMatchingDeviceStorageLocation
(
locationVO
.
getMatchingDeviceStorageLocationName
());
matchingDeviceLibraryDao
.
save
(
matchingDeviceLibrary
);
}
});
}
else
{
throw
new
ApiException
(
"请选择要修改的装备"
);
}
CompletableFuture
.
runAsync
(()->{
deviceLogService
.
addAllLog
(
deviceLogDtos
);
});
return
ResponseEntity
.
ok
(
"修改成功"
);
}
/**
* @return 生成配套设备附件的序列号
*/
...
...
dev-matching/src/main/java/com/tykj/dev/device/matching/subject/vo/LocationVO.java
0 → 100644
浏览文件 @
b6468c5e
package
com
.
tykj
.
dev
.
device
.
matching
.
subject
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author dengdiyi
*/
@Data
@ApiModel
(
"存放位置vo"
)
public
class
LocationVO
{
@ApiModelProperty
(
name
=
"配套设备的id"
)
private
List
<
Integer
>
matchingDeviceId
;
@ApiModelProperty
(
name
=
"库房id"
)
private
Integer
matchingDeviceStorageLocationId
;
@ApiModelProperty
(
name
=
"库房名称"
)
private
String
matchingDeviceStorageLocationName
;
}
dev-matching/src/main/java/com/tykj/dev/device/matching/subject/vo/StorageLocationVO.java
0 → 100644
浏览文件 @
b6468c5e
package
com
.
tykj
.
dev
.
device
.
matching
.
subject
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author dengdiyi
*/
@Data
@ApiModel
(
"存放位置vo"
)
public
class
StorageLocationVO
{
@ApiModelProperty
(
value
=
"存放位置"
)
private
String
matchingDeviceStorageLocation
;
@ApiModelProperty
(
value
=
"存放位置id"
)
private
Integer
matchingDeviceStorageLocationId
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论