Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
00177b97
提交
00177b97
authored
7月 27, 2021
作者:
zhoushaopan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[装备controller]新增更新序列号接口,新增装备序列号vo
上级
a76174c0
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
62 行增加
和
1 行删除
+62
-1
DeviceLibraryController.java
...ev/device/library/controller/DeviceLibraryController.java
+31
-1
DeviceLibraryDao.java
.../tykj/dev/device/library/repository/DeviceLibraryDao.java
+1
-0
DeviceLibraryService.java
...tykj/dev/device/library/service/DeviceLibraryService.java
+5
-0
DeviceLibraryServiceImpl.java
...device/library/service/impl/DeviceLibraryServiceImpl.java
+5
-0
DeviceSeqVo.java
...a/com/tykj/dev/device/library/subject/vo/DeviceSeqVo.java
+20
-0
没有找到文件。
dev-library/src/main/java/com/tykj/dev/device/library/controller/DeviceLibraryController.java
浏览文件 @
00177b97
...
...
@@ -21,6 +21,7 @@ import com.tykj.dev.misc.utils.GetTreeUtils;
import
com.tykj.dev.misc.utils.PageUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
...
...
@@ -96,7 +97,10 @@ public class DeviceLibraryController {
public
ResponseEntity
selectByIds
(
@RequestBody
DeviceSelectIdsVo
deviceSelectIdsVo
){
List
<
DeviceLibrary
>
deviceLibraries
=
new
ArrayList
<>();
deviceSelectIdsVo
.
getIds
().
forEach
(
integer
->
deviceLibraries
.
add
(
deviceLibraryService
.
getOne
(
integer
).
setConfigName
()));
return
ResponseEntity
.
ok
(
PageUtil
.
getPerPage
(
deviceSelectIdsVo
.
getPage
(),
deviceSelectIdsVo
.
getSize
(),
deviceLibraries
,
PageRequest
.
of
(
deviceSelectIdsVo
.
getPage
(),
deviceSelectIdsVo
.
getSize
())));
//进行排序
List
<
DeviceLibrary
>
libraryList
=
deviceLibraries
.
stream
().
sorted
(
Comparator
.
comparing
(
DeviceLibrary:
:
getModel
)
.
thenComparing
(
DeviceLibrary:
:
getName
).
thenComparing
(
DeviceLibrary:
:
getSeqNumber
)).
collect
(
Collectors
.
toList
());
return
ResponseEntity
.
ok
(
PageUtil
.
getPerPage
(
deviceSelectIdsVo
.
getPage
(),
deviceSelectIdsVo
.
getSize
(),
libraryList
,
PageRequest
.
of
(
deviceSelectIdsVo
.
getPage
(),
deviceSelectIdsVo
.
getSize
())));
}
@ApiOperation
(
value
=
"根据装备id查询装备详情"
,
notes
=
"根据装备id查询装备详情"
)
...
...
@@ -365,6 +369,7 @@ public class DeviceLibraryController {
Set
<
Integer
>
matchingRanges
=
new
HashSet
<>();
//添加装备形态
Set
<
Integer
>
types
=
new
HashSet
<>();
Set
<
String
>
storageLocation
=
new
HashSet
<>();
resultList
.
forEach
(
deviceVo
->
{
deviceVo
.
setConfigName
();
status
.
add
(
deviceVo
.
getLifeStatus
());
...
...
@@ -375,6 +380,7 @@ public class DeviceLibraryController {
matchingRanges
.
add
(
deviceVo
.
getMatchingRange
());
//添加形态
types
.
add
(
deviceVo
.
getType
());
storageLocation
.
add
(
deviceVo
.
getStorageLocation
());
});
List
<
String
>
finalModels
=
models
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
List
<
String
>
modelToSort
=
DeviceModelSort
.
modelToSort
(
finalModels
);
...
...
@@ -390,6 +396,7 @@ public class DeviceLibraryController {
Page
<
DeviceLibrary
>
deviceLibraryEntities
=
PageUtil
.
getPerPage
(
deviceLibrarySelectVo
.
getPage
(),
deviceLibrarySelectVo
.
getSize
(),
containList
,
deviceLibrarySelectVo
.
getPageable
());
map
.
put
(
"pages"
,
deviceLibraryEntities
);
map
.
put
(
"types"
,
types
.
stream
().
map
(
integer
->
new
TypeVo
(
integer
,
styleMap
.
get
(
integer
))).
collect
(
Collectors
.
toList
()));
map
.
put
(
"storageLocation"
,
storageLocation
);
return
ResultUtil
.
success
(
map
);
}
...
...
@@ -715,4 +722,27 @@ public class DeviceLibraryController {
deviceLibraryService
.
update
(
deviceLibrary
);
}
@ApiOperation
(
"根据装备id修改装备的序列号"
)
@PostMapping
(
"updateSeqByDeviceId"
)
public
ResponseEntity
updateSeqByDeviceId
(
@RequestBody
DeviceSeqVo
deviceSeqVo
){
DeviceLibrary
deviceLibrary
=
deviceLibraryService
.
getOne
(
deviceSeqVo
.
getId
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
//先判断序列号是否已经存在
DeviceLibrary
bySeqNumber
=
deviceLibraryService
.
findBySeqNumber
(
deviceSeqVo
.
getSeqNumber
());
if
(
bySeqNumber
!=
null
){
map
.
put
(
"error"
,
"该序列号已经存在,请重新更换序列号"
);
}
else
{
//修改序列号
deviceLibrary
.
setSeqNumber
(
deviceSeqVo
.
getSeqNumber
());
//添加日志
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
deviceSeqVo
.
getId
(),
"将装备序列号改为"
+
deviceSeqVo
.
getSeqNumber
(),
null
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
deviceLibraryService
.
update
(
deviceLibrary
);
map
.
put
(
"deviceLibrary"
,
deviceLibrary
);
map
.
put
(
"success"
,
"装备序列号信息更新成功"
);
}
return
ResponseEntity
.
ok
(
map
);
}
}
dev-library/src/main/java/com/tykj/dev/device/library/repository/DeviceLibraryDao.java
浏览文件 @
00177b97
...
...
@@ -157,5 +157,6 @@ public interface DeviceLibraryDao extends JpaRepository<DeviceLibrary, Integer>,
@Query
(
"update DeviceLibrary o set o.lifeStatus = :lifeStatus where o.id in :ids"
)
int
batchUpdate2
(
Integer
lifeStatus
,
List
<
Integer
>
ids
);
DeviceLibrary
findBySeqNumber
(
String
seqNumber
);
}
dev-library/src/main/java/com/tykj/dev/device/library/service/DeviceLibraryService.java
浏览文件 @
00177b97
...
...
@@ -198,4 +198,9 @@ public interface DeviceLibraryService {
void
updateLifeStatus2
(
Integer
lifeStatus
,
List
<
Integer
>
ids
);
List
<
DeviceLibrary
>
findByIds
(
List
<
Integer
>
ids
);
/**
* @param seqNumber 序列号
*/
DeviceLibrary
findBySeqNumber
(
String
seqNumber
);
}
dev-library/src/main/java/com/tykj/dev/device/library/service/impl/DeviceLibraryServiceImpl.java
浏览文件 @
00177b97
...
...
@@ -593,6 +593,11 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return
deviceLibraryDao
.
findAllByIdIn
(
ids
);
}
@Override
public
DeviceLibrary
findBySeqNumber
(
String
seqNumber
)
{
return
deviceLibraryDao
.
findBySeqNumber
(
seqNumber
);
}
@Override
public
void
isNotLoss
(
List
<
Integer
>
ids
)
{
...
...
dev-library/src/main/java/com/tykj/dev/device/library/subject/vo/DeviceSeqVo.java
0 → 100644
浏览文件 @
00177b97
package
com
.
tykj
.
dev
.
device
.
library
.
subject
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* DATE:2021-7-27
* Author:zsp
*/
@Data
@ApiModel
(
"装备序列号"
)
public
class
DeviceSeqVo
{
@ApiModelProperty
(
"装备id"
)
private
Integer
id
;
@ApiModelProperty
(
"装备序列号"
)
private
String
seqNumber
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论