Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
99f3b55e
提交
99f3b55e
authored
9月 07, 2020
作者:
邓砥奕
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新业务查询
上级
89a22fd8
显示空白字符变更
内嵌
并排
正在显示
26 个修改的文件
包含
899 行增加
和
397 行删除
+899
-397
pom.xml
dev-device/device-allot/pom.xml
+19
-0
pom.xml
dev-device/device-apply/pom.xml
+24
-0
pom.xml
dev-device/device-library/pom.xml
+6
-0
DeviceLibraryController.java
...ev/device/library/controller/DeviceLibraryController.java
+244
-0
DeviceLibraryService.java
...tykj/dev/device/library/service/DeviceLibraryService.java
+3
-3
DeviceLibraryServiceImpl.java
...device/library/service/impl/DeviceLibraryServiceImpl.java
+88
-162
DeviceLogDto.java
...com/tykj/dev/device/library/subject/Dto/DeviceLogDto.java
+21
-0
DeviceLog.java
.../com/tykj/dev/device/library/subject/domin/DeviceLog.java
+0
-12
DeviceDetailVo.java
...om/tykj/dev/device/library/subject/vo/DeviceDetailVo.java
+1
-1
DeviceLogUserVo.java
...m/tykj/dev/device/library/subject/vo/DeviceLogUserVo.java
+37
-0
package-info.java
dev-device/device-matching/src/main/java/package-info.java
+0
-0
pom.xml
dev-device/device-packing/pom.xml
+8
-0
PackingLibraryServiceImpl.java
...evice/packing/service/impl/PackingLibraryServiceImpl.java
+0
-1
pom.xml
dev-device/device-selfcheck/pom.xml
+12
-0
pom.xml
dev-device/device-storage/pom.xml
+19
-0
pom.xml
dev-device/device-task/pom.xml
+12
-0
TaskController.java
...a/com/tykj/dev/device/task/controller/TaskController.java
+56
-199
TaskService.java
...in/java/com/tykj/dev/device/task/service/TaskService.java
+6
-0
TaskServiceImpl.java
...om/tykj/dev/device/task/service/impl/TaskServiceImpl.java
+149
-1
TaskBto.java
...in/java/com/tykj/dev/device/task/subject/bto/TaskBto.java
+5
-4
TaskLogBto.java
...java/com/tykj/dev/device/task/subject/bto/TaskLogBto.java
+21
-0
TaskLog.java
.../java/com/tykj/dev/device/task/subject/domin/TaskLog.java
+0
-12
TaskLogUserVo.java
...va/com/tykj/dev/device/task/subject/vo/TaskLogUserVo.java
+38
-0
TaskUtils.java
...c/main/java/com/tykj/dev/device/task/utils/TaskUtils.java
+84
-0
UserUtils.java
...rc/main/java/com/tykj/dev/device/user/util/UserUtils.java
+2
-2
PageUtil.java
dev-misc/src/main/java/com/tykj/dev/misc/utils/PageUtil.java
+44
-0
没有找到文件。
dev-device/device-allot/pom.xml
浏览文件 @
99f3b55e
...
@@ -16,14 +16,32 @@
...
@@ -16,14 +16,32 @@
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-user
</artifactId>
<artifactId>
device-user
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-allot
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-library
</artifactId>
<artifactId>
device-library
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-allot
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-task
</artifactId>
<artifactId>
device-task
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-allot
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
dev-device/device-apply/pom.xml
浏览文件 @
99f3b55e
...
@@ -14,18 +14,42 @@
...
@@ -14,18 +14,42 @@
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-user
</artifactId>
<artifactId>
device-user
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-apply
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-task
</artifactId>
<artifactId>
device-task
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-apply
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-allot
</artifactId>
<artifactId>
device-allot
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-apply
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-library
</artifactId>
<artifactId>
device-library
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-apply
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
dev-device/device-library/pom.xml
浏览文件 @
99f3b55e
...
@@ -12,6 +12,12 @@
...
@@ -12,6 +12,12 @@
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-user
</artifactId>
<artifactId>
device-user
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-library
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
</dependencies>
</dependencies>
<artifactId>
device-library
</artifactId>
<artifactId>
device-library
</artifactId>
...
...
dev-device/device-library/src/main/java/com/tykj/dev/device/library/controller/DeviceLibraryController.java
0 → 100644
浏览文件 @
99f3b55e
package
com
.
tykj
.
dev
.
device
.
library
.
controller
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.repository.DeviceLogDao
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
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.misc.utils.ResultUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author dengdiyi
*/
@RestController
@RequestMapping
(
value
=
"/device"
)
@AutoDocument
@Api
(
tags
=
"装备管理模块"
,
description
=
"装备管理接口"
)
public
class
DeviceLibraryController
{
@Autowired
private
DeviceLibraryService
deviceLibraryService
;
@Autowired
private
DeviceLibraryDao
deviceLibraryDao
;
@Autowired
private
DeviceLogDao
deviceLogDao
;
// @Autowired
// private PackingLibraryService packingLibraryService;
@ApiOperation
(
value
=
"模糊查询装备分页"
,
notes
=
"可以通过这个接口查询装备"
)
@PostMapping
(
"/selectDevicePage"
)
public
ResponseEntity
<
Page
<
DeviceLibrary
>>
selectDevicePage
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
){
Page
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryService
.
getPage
(
deviceLibrarySelectVo
,
deviceLibrarySelectVo
.
getPageable
());
return
ResultUtil
.
success
(
deviceLibraryEntities
);
}
@ApiOperation
(
value
=
"模糊查询装备列表"
,
notes
=
"可以通过这个接口查询装备列表"
)
@PostMapping
(
"/selectDeviceList"
)
public
ResponseEntity
<
List
<
DeviceLibrary
>>
selectDeviceList
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
){
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryService
.
getList
(
deviceLibrarySelectVo
);
return
ResultUtil
.
success
(
deviceLibraryEntities
);
}
@ApiOperation
(
value
=
"查询所有装备列表"
,
notes
=
"可以通过这个接口查询所有装备列表"
)
@PostMapping
(
"/selectAllDeviceList"
)
public
ResponseEntity
<
List
<
DeviceLibrary
>>
selectAllDeviceList
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
){
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryService
.
getAllList
(
deviceLibrarySelectVo
);
return
ResultUtil
.
success
(
deviceLibraryEntities
);
}
@ApiOperation
(
value
=
"查询检查装备列表"
,
notes
=
"可以通过这个接口查询装备列表"
)
@GetMapping
(
"/selectCheckDeviceList"
)
public
ResponseEntity
<
List
<
DeviceLibrary
>>
selectDeviceList
(){
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryService
.
getCheckList
();
return
ResultUtil
.
success
(
deviceLibraryEntities
);
}
@ApiOperation
(
value
=
"模糊查询可配发的在库装备列表"
,
notes
=
"可以通过这个接口查询可配发装备"
)
@PostMapping
(
"/selectAllotDeviceList"
)
public
ResponseEntity
<
List
<
DeviceLibrary
>>
selectAllotDeviceList
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
){
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryService
.
getAllotList
(
deviceLibrarySelectVo
);
return
ResultUtil
.
success
(
deviceLibraryEntities
);
}
@ApiOperation
(
value
=
"模糊查询核心装备分页"
,
notes
=
"可以通过这个接口查询装备列表"
)
@PostMapping
(
"/core/feature/summary"
)
public
ResponseEntity
<
Page
<
DeviceLibrary
>>
selectCoreDevicePage
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
){
Page
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryService
.
getCoreDevicePage
(
deviceLibrarySelectVo
,
deviceLibrarySelectVo
.
getPageable
());
return
ResultUtil
.
success
(
deviceLibraryEntities
);
}
@ApiOperation
(
value
=
"查询存在的装备名称"
,
notes
=
"可以通过这个接口查询存在的装备名称"
)
@GetMapping
(
"/selectAllName"
)
public
ResponseEntity
<
List
<
String
>>
selectAllName
(){
return
ResultUtil
.
success
(
deviceLibraryService
.
getAllName
());
}
@ApiOperation
(
value
=
"模糊查询标签管理装备分页"
,
notes
=
"可以通过这个接口查询装备列表"
)
@PostMapping
(
"/selectTagDevicePage"
)
public
ResponseEntity
<
Page
<
DeviceLibrary
>>
selectTagDevicePage
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
){
Page
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryService
.
getTagPage
(
deviceLibrarySelectVo
,
deviceLibrarySelectVo
.
getPageable
());
return
ResultUtil
.
success
(
deviceLibraryEntities
);
}
@ApiOperation
(
value
=
"模糊查询核心装备统计分页"
,
notes
=
"可以通过这个接口查询装备列表"
)
@PostMapping
(
"/core/stat/summary"
)
public
ResponseEntity
<
Page
<
DeviceStatisticsVo
>>
getDeviceStatisticsPage
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
){
Page
<
DeviceStatisticsVo
>
deviceStatisticsVos
=
deviceLibraryService
.
getDeviceStatisticsPage
(
deviceLibrarySelectVo
,
deviceLibrarySelectVo
.
getPageable
());
return
ResultUtil
.
success
(
deviceStatisticsVos
);
}
@ApiOperation
(
value
=
"查询核心装备详情的详情"
,
notes
=
"可以通过这个接口查询核心装备详情的详情"
)
@GetMapping
(
"/core/feature/detail/{id}"
)
public
ResponseEntity
<
DeviceDetailVo
>
getDeviceDetail
(
@PathVariable
(
"id"
)
int
id
){
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
DeviceDetailVo
deviceDetailVo
=
new
DeviceDetailVo
();
List
<
DeviceLibrary
>
libraryEntities
=
new
ArrayList
<>();
//查询日志
List
<
DeviceLogUserVo
>
deviceLogEntities
=
orderByCreateTimeAsc
(
deviceLogDao
.
getAllByDeviceIdAndType
(
id
,
0
).
stream
()
.
map
(
DeviceLog:
:
parse2Dto
)
.
map
(
DeviceLogDto:
:
toVo
)
.
collect
(
Collectors
.
toList
()));
libraryEntities
.
add
(
deviceLibraryEntity
);
if
(
deviceLibraryEntity
.
getIsPart
()==
0
){
List
<
DeviceLibrary
>
partList
=
deviceLibraryDao
.
getAllByPartParentIdAndIsPart
(
id
,
1
);
libraryEntities
.
addAll
(
partList
);
deviceDetailVo
.
setDeviceList
(
libraryEntities
);
deviceDetailVo
.
setDeviceLogEntityList
(
deviceLogEntities
);
// PackingLibrary p = packingLibraryService.getOne(deviceLibraryEntity.getPackingId());
// deviceDetailVo.setImageName(p.getImageName());
// deviceDetailVo.setImageUrl(p.getImageUrl());
return
ResultUtil
.
success
(
deviceDetailVo
);
}
else
{
if
(
deviceLibraryEntity
.
getPartParentId
()==
null
)
{
deviceDetailVo
.
setDeviceList
(
libraryEntities
);
deviceDetailVo
.
setDeviceLogEntityList
(
deviceLogEntities
);
return
ResultUtil
.
success
(
deviceDetailVo
);
}
libraryEntities
.
add
(
deviceLibraryService
.
getOne
(
deviceLibraryEntity
.
getPartParentId
()));
deviceDetailVo
.
setDeviceList
(
libraryEntities
);
deviceDetailVo
.
setDeviceLogEntityList
(
deviceLogEntities
);
return
ResultUtil
.
success
(
deviceDetailVo
);
}
}
@ApiOperation
(
value
=
"更新装备库"
,
notes
=
"可以通过这个接口更新装备库"
)
@PostMapping
(
"/updateDeviceLibrary"
)
public
ResponseEntity
<
String
>
updateDeviceLibrary
(
@RequestBody
DeviceEditVo
deviceEditVo
)
{
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
deviceEditVo
.
getDeviceId
());
if
(
deviceEditVo
.
getUpdateVoList
()!=
null
)
{
DeviceLibraryUpdateVo
libraryUpdateVo
=
deviceEditVo
.
getUpdateVoList
();
if
(
libraryUpdateVo
.
getInvisibleRange
()!=
null
){
deviceLibraryEntity
.
setInvisibleRange
(
libraryUpdateVo
.
getInvisibleRange
());
}
if
(
libraryUpdateVo
.
getLifeStatus
()!=
null
){
deviceLibraryEntity
.
setLifeStatus
(
libraryUpdateVo
.
getLifeStatus
());
}
if
(
libraryUpdateVo
.
getLocationUnit
()!=
null
){
deviceLibraryEntity
.
setLocationUnit
(
libraryUpdateVo
.
getLocationUnit
());
}
if
(
libraryUpdateVo
.
getManageStatus
()!=
null
){
deviceLibraryEntity
.
setManageStatus
(
libraryUpdateVo
.
getManageStatus
());
}
if
(
libraryUpdateVo
.
getMatchingRange
()!=
null
){
deviceLibraryEntity
.
setMatchingRange
(
libraryUpdateVo
.
getMatchingRange
());
}
if
(
libraryUpdateVo
.
getModel
()!=
null
){
deviceLibraryEntity
.
setModel
(
libraryUpdateVo
.
getModel
());
}
if
(
libraryUpdateVo
.
getName
()!=
null
){
deviceLibraryEntity
.
setName
(
libraryUpdateVo
.
getName
());
}
if
(
libraryUpdateVo
.
getOwnUnit
()!=
null
){
deviceLibraryEntity
.
setOwnUnit
(
libraryUpdateVo
.
getOwnUnit
());
}
if
(
libraryUpdateVo
.
getProdNumber
()!=
null
){
deviceLibraryEntity
.
setProdNumber
(
libraryUpdateVo
.
getProdNumber
());
}
if
(
libraryUpdateVo
.
getSecretLevel
()!=
null
){
deviceLibraryEntity
.
setSecretLevel
(
libraryUpdateVo
.
getSecretLevel
());
}
if
(
libraryUpdateVo
.
getSeqNumber
()!=
null
){
deviceLibraryEntity
.
setSeqNumber
(
libraryUpdateVo
.
getSeqNumber
());
}
if
(
libraryUpdateVo
.
getStorageType
()!=
null
){
deviceLibraryEntity
.
setStorageType
(
libraryUpdateVo
.
getStorageType
());
}
if
(
libraryUpdateVo
.
getType
()!=
null
){
deviceLibraryEntity
.
setType
(
libraryUpdateVo
.
getType
());
}
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
if
(
deviceEditVo
.
getPartAddIdList
()!=
null
){
for
(
Integer
id:
deviceEditVo
.
getPartAddIdList
())
{
if
(
id
>
0
)
{
DeviceLibrary
d
=
deviceLibraryService
.
getOne
(
id
);
if
(
deviceLibraryEntity
.
getIsPart
()==
0
&&
d
.
getIsPart
()==
1
&&
d
.
getPartParentId
()==
null
){
d
.
setPartParentId
(
deviceEditVo
.
getDeviceId
());
deviceLibraryService
.
update
(
d
);
}
if
(
deviceLibraryEntity
.
getIsPart
()==
1
&&
d
.
getIsPart
()==
0
){
deviceLibraryEntity
.
setPartParentId
(
id
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
}
}
if
(
deviceEditVo
.
getPartIdDeleteList
()!=
null
){
for
(
Integer
id:
deviceEditVo
.
getPartIdDeleteList
())
{
if
(
id
>
0
)
{
DeviceLibrary
d
=
deviceLibraryService
.
getOne
(
id
);
if
(
d
.
getIsPart
()==
1
&&
d
.
getPartParentId
().
equals
(
deviceEditVo
.
getDeviceId
())){
d
.
setPartParentId
(
null
);
deviceLibraryService
.
update
(
d
);
}
if
(
deviceLibraryEntity
.
getIsPart
()==
1
&&
d
.
getIsPart
()==
0
&&
deviceLibraryEntity
.
getPartParentId
().
equals
(
id
)){
deviceLibraryEntity
.
setPartParentId
(
null
);
deviceLibraryService
.
update
(
deviceLibraryEntity
);
}
}
}
}
return
ResultUtil
.
success
(
"更新成功"
);
}
@ApiOperation
(
value
=
"通过表面号查询配件"
,
notes
=
"通过表面号查询配件"
)
@GetMapping
(
"/selectPart/{rfid}"
)
public
ResponseEntity
<
List
<
DeviceLibrary
>>
selectPart
(
@PathVariable
(
"rfid"
)
String
rfid
){
List
<
DeviceLibrary
>
libraryEntities
=
deviceLibraryDao
.
getAllByRfidSurfaceId
(
rfid
);
List
<
DeviceLibrary
>
deviceLibraryEntityList
=
libraryEntities
.
stream
().
filter
(
deviceLibraryEntity
->
deviceLibraryEntity
.
getIsPart
()==
1
).
collect
(
Collectors
.
toList
());
return
ResultUtil
.
success
(
deviceLibraryEntityList
);
}
@ApiOperation
(
value
=
"通过表面号查询装备"
,
notes
=
"通过表面号查询装备"
)
@GetMapping
(
"/selectDevice/{rfid}"
)
public
ResponseEntity
<
List
<
DeviceLibrary
>>
selectDevice
(
@PathVariable
(
"rfid"
)
String
rfid
){
List
<
DeviceLibrary
>
libraryEntities
=
deviceLibraryDao
.
getAllByRfidSurfaceId
(
rfid
);
List
<
DeviceLibrary
>
deviceLibraryEntityList
=
libraryEntities
.
stream
().
filter
(
deviceLibraryEntity
->
deviceLibraryEntity
.
getIsPart
()==
0
).
collect
(
Collectors
.
toList
());
return
ResultUtil
.
success
(
deviceLibraryEntityList
);
}
private
List
<
DeviceLogUserVo
>
orderByCreateTimeAsc
(
List
<
DeviceLogUserVo
>
list
){
Collections
.
sort
(
list
,
(
o1
,
o2
)
->
{
int
flag
=
o1
.
getCreateTime
().
compareTo
(
o2
.
getCreateTime
());
return
flag
;
});
return
list
;
}
}
dev-device/device-library/src/main/java/com/tykj/dev/device/library/service/DeviceLibraryService.java
浏览文件 @
99f3b55e
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.library.service;
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.library.service;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
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.DeviceLibrarySelectVo
;
import
com.tykj.dev.device.library.subject.vo.DeviceStatisticsVo
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
...
@@ -11,9 +12,8 @@ import java.util.List;
...
@@ -11,9 +12,8 @@ import java.util.List;
* @author dengdiyi
* @author dengdiyi
*/
*/
public
interface
DeviceLibraryService
{
public
interface
DeviceLibraryService
{
DeviceLibrary
addEntity
(
DeviceLibrary
deviceLibraryEntity
);
List
<
DeviceLibrary
>
addEntityList
(
List
<
DeviceLibrary
>
list
);
DeviceLibrary
addEntity
(
DeviceLibrary
deviceLibraryEntity
);
Page
<
DeviceLibrary
>
getPage
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
Pageable
pageable
);
Page
<
DeviceLibrary
>
getPage
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
Pageable
pageable
);
...
@@ -23,7 +23,7 @@ public interface DeviceLibraryService {
...
@@ -23,7 +23,7 @@ public interface DeviceLibraryService {
Page
<
DeviceLibrary
>
getCoreDevicePage
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
Pageable
pageable
);
Page
<
DeviceLibrary
>
getCoreDevicePage
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
Pageable
pageable
);
// Page<DeviceLibrary
> getDeviceStatisticsPage(DeviceLibrarySelectVo deviceLibrarySelectVo, Pageable pageable);
Page
<
DeviceStatisticsVo
>
getDeviceStatisticsPage
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
Pageable
pageable
);
List
<
String
>
getAllName
();
List
<
String
>
getAllName
();
...
...
dev-device/device-library/src/main/java/com/tykj/dev/device/library/service/impl/DeviceLibraryServiceImpl.java
浏览文件 @
99f3b55e
...
@@ -6,11 +6,14 @@ import com.tykj.dev.device.library.repository.DeviceLibraryDao;
...
@@ -6,11 +6,14 @@ import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
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.DeviceLibrarySelectVo
;
import
com.tykj.dev.device.library.subject.vo.DeviceStatisticsVo
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.device.user.util.UserUtils
;
import
com.tykj.dev.device.user.util.UserUtils
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.utils.GetTreeUtils
;
import
com.tykj.dev.misc.utils.GetTreeUtils
;
import
com.tykj.dev.misc.utils.PageUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.PageImpl
;
...
@@ -38,19 +41,11 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
...
@@ -38,19 +41,11 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Autowired
@Autowired
private
UserPublicService
userPublicService
;
private
UserPublicService
userPublicService
;
// @Autowired
// private StorageBillService storageBillService;
@Override
@Override
public
DeviceLibrary
addEntity
(
DeviceLibrary
deviceLibraryEntity
)
{
public
DeviceLibrary
addEntity
(
DeviceLibrary
deviceLibraryEntity
)
{
return
deviceLibraryDao
.
save
(
deviceLibraryEntity
);
return
deviceLibraryDao
.
save
(
deviceLibraryEntity
);
}
}
@Override
public
List
<
DeviceLibrary
>
addEntityList
(
List
<
DeviceLibrary
>
list
)
{
return
null
;
}
@Override
@Override
public
Page
<
DeviceLibrary
>
getPage
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
Pageable
pageable
)
{
public
Page
<
DeviceLibrary
>
getPage
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
Pageable
pageable
)
{
Specification
<
DeviceLibrary
>
selectSpecification
=
getSelectSpecification
(
deviceLibrarySelectVo
);
Specification
<
DeviceLibrary
>
selectSpecification
=
getSelectSpecification
(
deviceLibrarySelectVo
);
...
@@ -87,23 +82,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
...
@@ -87,23 +82,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
resultList
.
addAll
(
d
.
getChilds
());
resultList
.
addAll
(
d
.
getChilds
());
}
}
}
}
if
(
resultList
.
size
()<=
deviceLibrarySelectVo
.
getSize
())
{
return
PageUtil
.
getPerPage
(
deviceLibrarySelectVo
.
getPage
(),
deviceLibrarySelectVo
.
getSize
(),
resultList
,
pageable
);
return
new
PageImpl
<>(
resultList
,
pageable
,
resultList
.
size
());
}
else
{
Double
d
=
Math
.
ceil
(
resultList
.
size
()/
deviceLibrarySelectVo
.
getSize
().
doubleValue
());
int
num
=
new
Double
(
d
).
intValue
();
if
(
deviceLibrarySelectVo
.
getPage
()>=
num
){
return
null
;
}
else
{
int
index
=
deviceLibrarySelectVo
.
getPage
()*
deviceLibrarySelectVo
.
getSize
();
if
(
deviceLibrarySelectVo
.
getPage
()==
num
-
1
){
return
new
PageImpl
<>(
resultList
.
subList
(
index
,
resultList
.
size
()),
pageable
,
resultList
.
size
());
}
return
new
PageImpl
<>(
resultList
.
subList
(
index
,
index
+
deviceLibrarySelectVo
.
getSize
()),
pageable
,
resultList
.
size
());
}
}
}
}
else
{
else
{
Integer
selectLevel
=
userPublicService
.
getArea
(
selectAreaId
).
getType
();
Integer
selectLevel
=
userPublicService
.
getArea
(
selectAreaId
).
getType
();
...
@@ -117,23 +96,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
...
@@ -117,23 +96,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
resultList
.
addAll
(
d
.
getChilds
());
resultList
.
addAll
(
d
.
getChilds
());
}
}
}
}
if
(
resultList
.
size
()<=
deviceLibrarySelectVo
.
getSize
())
{
return
PageUtil
.
getPerPage
(
deviceLibrarySelectVo
.
getPage
(),
deviceLibrarySelectVo
.
getSize
(),
resultList
,
pageable
);
return
new
PageImpl
<>(
resultList
,
pageable
,
resultList
.
size
());
}
else
{
Double
d
=
Math
.
ceil
(
resultList
.
size
()/
deviceLibrarySelectVo
.
getSize
().
doubleValue
());
int
num
=
new
Double
(
d
).
intValue
();
if
(
deviceLibrarySelectVo
.
getPage
()>=
num
){
return
null
;
}
else
{
int
index
=
deviceLibrarySelectVo
.
getPage
()*
deviceLibrarySelectVo
.
getSize
();
if
(
deviceLibrarySelectVo
.
getPage
()==
num
-
1
){
return
new
PageImpl
<>(
resultList
.
subList
(
index
,
resultList
.
size
()),
pageable
,
resultList
.
size
());
}
return
new
PageImpl
<>(
resultList
.
subList
(
index
,
index
+
deviceLibrarySelectVo
.
getSize
()),
pageable
,
resultList
.
size
());
}
}
}
}
if
(
selectLevel
==
1
){
if
(
selectLevel
==
1
){
List
<
DeviceLibrary
>
libraryEntities
=
deviceLibraryDao
.
findAll
();
List
<
DeviceLibrary
>
libraryEntities
=
deviceLibraryDao
.
findAll
();
...
@@ -144,23 +107,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
...
@@ -144,23 +107,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
resultList
.
addAll
(
d
.
getChilds
());
resultList
.
addAll
(
d
.
getChilds
());
}
}
}
}
if
(
resultList
.
size
()<=
deviceLibrarySelectVo
.
getSize
())
{
return
PageUtil
.
getPerPage
(
deviceLibrarySelectVo
.
getPage
(),
deviceLibrarySelectVo
.
getSize
(),
resultList
,
pageable
);
return
new
PageImpl
<>(
resultList
,
pageable
,
resultList
.
size
());
}
else
{
Double
d
=
Math
.
ceil
(
resultList
.
size
()/
deviceLibrarySelectVo
.
getSize
().
doubleValue
());
int
num
=
new
Double
(
d
).
intValue
();
if
(
deviceLibrarySelectVo
.
getPage
()>=
num
){
return
null
;
}
else
{
int
index
=
deviceLibrarySelectVo
.
getPage
()*
deviceLibrarySelectVo
.
getSize
();
if
(
deviceLibrarySelectVo
.
getPage
()==
num
-
1
){
return
new
PageImpl
<>(
resultList
.
subList
(
index
,
resultList
.
size
()),
pageable
,
resultList
.
size
());
}
return
new
PageImpl
<>(
resultList
.
subList
(
index
,
index
+
deviceLibrarySelectVo
.
getSize
()),
pageable
,
resultList
.
size
());
}
}
}
}
else
{
else
{
throw
new
ApiException
(
ResultUtil
.
failed
());
throw
new
ApiException
(
ResultUtil
.
failed
());
...
@@ -168,98 +115,83 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
...
@@ -168,98 +115,83 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
}
}
}
}
// @Override
@Override
// public Page<DeviceStatisticsVo> getDeviceStatisticsPage(DeviceLibrarySelectVo deviceLibrarySelectVo, Pageable pageable) {
public
Page
<
DeviceStatisticsVo
>
getDeviceStatisticsPage
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
Pageable
pageable
)
{
// List<String> list = getAllModel();
List
<
String
>
list
=
getAllModel
();
// List<DeviceStatisticsVo> deviceStatisticsVos = new ArrayList<>();
List
<
DeviceStatisticsVo
>
deviceStatisticsVos
=
new
ArrayList
<>();
// DeviceLibrarySelectVo d = new DeviceLibrarySelectVo();
DeviceLibrarySelectVo
d
=
new
DeviceLibrarySelectVo
();
// BeanUtils.copyProperties(deviceLibrarySelectVo,d);
BeanUtils
.
copyProperties
(
deviceLibrarySelectVo
,
d
);
// d.setSize(Integer.MAX_VALUE);
d
.
setSize
(
Integer
.
MAX_VALUE
);
// List<DeviceLibrary> libraryEntities = getCoreDevicePage(d,d.getPageable()).getContent();
List
<
DeviceLibrary
>
libraryEntities
=
getCoreDevicePage
(
d
,
d
.
getPageable
()).
getContent
();
// if (libraryEntities.size()>0) {
if
(
libraryEntities
.
size
()>
0
)
{
// for (String model : list) {
for
(
String
model
:
list
)
{
// DeviceStatisticsVo deviceStatisticsVo = new DeviceStatisticsVo();
DeviceStatisticsVo
deviceStatisticsVo
=
new
DeviceStatisticsVo
();
// deviceStatisticsVo.setModel(model);
deviceStatisticsVo
.
setModel
(
model
);
// Integer num = 0;
int
num
=
0
;
// Integer inLibraryNum = 0;
int
inLibraryNum
=
0
;
// Integer repairNum = 0;
int
repairNum
=
0
;
// Integer destoryNum = 0;
int
destoryNum
=
0
;
// Integer scrappedNum = 0;
int
scrappedNum
=
0
;
// Integer allotNum = 0;
int
allotNum
=
0
;
// Integer retiredNum = 0;
int
retiredNum
=
0
;
// Integer useNum = 0;
int
useNum
=
0
;
// for (DeviceLibrary d2 : libraryEntities) {
for
(
DeviceLibrary
d2
:
libraryEntities
)
{
// if (d2.getModel().equals(model)) {
if
(
d2
.
getModel
().
equals
(
model
))
{
// deviceStatisticsVo.setName(d2.getName());
deviceStatisticsVo
.
setName
(
d2
.
getName
());
// num++;
num
++;
// switch (d2.getLifeStatus()) {
switch
(
d2
.
getLifeStatus
())
{
// case 2:
case
2
:
// inLibraryNum++;
inLibraryNum
++;
// break;
break
;
// case 3:
case
3
:
// allotNum++;
allotNum
++;
// break;
break
;
// case 4:
case
4
:
// repairNum++;
repairNum
++;
// break;
break
;
// case 5:
case
5
:
// scrappedNum++;
scrappedNum
++;
// break;
break
;
// case 6:
case
6
:
// allotNum++;
allotNum
++;
// break;
break
;
// case 12:
case
12
:
// retiredNum++;
retiredNum
++;
// break;
break
;
// case 9:
case
9
:
// destoryNum++;
destoryNum
++;
// break;
break
;
// case 10:
case
10
:
// destoryNum++;
destoryNum
++;
// break;
break
;
// case 13:
case
13
:
// scrappedNum++;
scrappedNum
++;
// break;
break
;
// case 14:
case
14
:
// useNum++;
useNum
++;
// break;
break
;
// default:
default
:
// break;
break
;
// }
}
// }
}
// }
}
// if (num > 0) {
if
(
num
>
0
)
{
// deviceStatisticsVo.setDeviceNumber(num);
deviceStatisticsVo
.
setDeviceNumber
(
num
);
// deviceStatisticsVo.setAllotNum(allotNum);
deviceStatisticsVo
.
setAllotNum
(
allotNum
);
// deviceStatisticsVo.setInLibraryNum(inLibraryNum);
deviceStatisticsVo
.
setInLibraryNum
(
inLibraryNum
);
// deviceStatisticsVo.setRepairNum(repairNum);
deviceStatisticsVo
.
setRepairNum
(
repairNum
);
// deviceStatisticsVo.setDestoryNum(destoryNum);
deviceStatisticsVo
.
setDestoryNum
(
destoryNum
);
// deviceStatisticsVo.setScrappedNum(scrappedNum);
deviceStatisticsVo
.
setScrappedNum
(
scrappedNum
);
// deviceStatisticsVo.setRetiredNum(retiredNum);
deviceStatisticsVo
.
setRetiredNum
(
retiredNum
);
// deviceStatisticsVo.setUseNum(useNum);
deviceStatisticsVo
.
setUseNum
(
useNum
);
// deviceStatisticsVos.add(deviceStatisticsVo);
deviceStatisticsVos
.
add
(
deviceStatisticsVo
);
// }
}
//
// }
}
//
return
PageUtil
.
getPerPage
(
deviceLibrarySelectVo
.
getPage
(),
deviceLibrarySelectVo
.
getSize
(),
deviceStatisticsVos
,
pageable
);
// if (deviceStatisticsVos.size() <= deviceLibrarySelectVo.getSize()) {
}
// return new PageImpl<>(deviceStatisticsVos, pageable, deviceStatisticsVos.size());
return
new
PageImpl
<>(
deviceStatisticsVos
,
pageable
,
deviceStatisticsVos
.
size
());
// } else {
}
// Double v = Math.ceil(deviceStatisticsVos.size() / deviceLibrarySelectVo.getSize().doubleValue());
// int value = new Double(v).intValue();
// if (deviceLibrarySelectVo.getPage() >= value) {
// return null;
// } else {
// int index = deviceLibrarySelectVo.getPage() * deviceLibrarySelectVo.getSize();
// if (deviceLibrarySelectVo.getPage() == value - 1) {
// return new PageImpl<>(deviceStatisticsVos.subList(index, deviceStatisticsVos.size()), pageable, deviceStatisticsVos.size());
// }
// return new PageImpl<>(deviceStatisticsVos.subList(index, index + deviceLibrarySelectVo.getSize()), pageable, deviceStatisticsVos.size());
// }
// }
// }
// return new PageImpl<>(deviceStatisticsVos, pageable, deviceStatisticsVos.size());
// }
@Override
@Override
public
List
<
String
>
getAllName
()
{
public
List
<
String
>
getAllName
()
{
...
@@ -276,46 +208,41 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
...
@@ -276,46 +208,41 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryDao
.
findAll
(
getSelectSpecification
(
deviceLibrarySelectVo
));
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryDao
.
findAll
(
getSelectSpecification
(
deviceLibrarySelectVo
));
Map
<
Integer
,
DeviceLibrary
>
nodeCollect
=
Map
<
Integer
,
DeviceLibrary
>
nodeCollect
=
deviceLibraryEntities
.
stream
().
collect
(
Collectors
.
toMap
(
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
deviceLibraryEntity
));
deviceLibraryEntities
.
stream
().
collect
(
Collectors
.
toMap
(
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
deviceLibraryEntity
));
List
<
DeviceLibrary
>
deviceLibraryEntities1
=
GetTreeUtils
.
parseTreeFromDown
(
return
GetTreeUtils
.
parseTreeFromDown
(
deviceLibraryEntities
,
deviceLibraryEntities
,
DeviceLibrary:
:
getId
,
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
deviceLibraryEntity
.
getPartParentId
())),
deviceLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
deviceLibraryEntity
.
getPartParentId
())),
DeviceLibrary:
:
addChildNode
DeviceLibrary:
:
addChildNode
);
);
return
deviceLibraryEntities1
;
}
}
public
List
<
DeviceLibrary
>
getList2
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
)
{
public
List
<
DeviceLibrary
>
getList2
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
)
{
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryDao
.
findAll
(
getSelectSpecification6
(
deviceLibrarySelectVo
));
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryDao
.
findAll
(
getSelectSpecification6
(
deviceLibrarySelectVo
));
Map
<
Integer
,
DeviceLibrary
>
nodeCollect
=
Map
<
Integer
,
DeviceLibrary
>
nodeCollect
=
deviceLibraryEntities
.
stream
().
collect
(
Collectors
.
toMap
(
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
deviceLibraryEntity
));
deviceLibraryEntities
.
stream
().
collect
(
Collectors
.
toMap
(
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
deviceLibraryEntity
));
List
<
DeviceLibrary
>
deviceLibraryEntities1
=
GetTreeUtils
.
parseTreeFromDown
(
return
GetTreeUtils
.
parseTreeFromDown
(
deviceLibraryEntities
,
deviceLibraryEntities
,
DeviceLibrary:
:
getId
,
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
deviceLibraryEntity
.
getPartParentId
())),
deviceLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
deviceLibraryEntity
.
getPartParentId
())),
DeviceLibrary:
:
addChildNode
DeviceLibrary:
:
addChildNode
);
);
return
deviceLibraryEntities1
;
}
}
public
List
<
DeviceLibrary
>
getList3
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
String
name
)
{
public
List
<
DeviceLibrary
>
getList3
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
,
String
name
)
{
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryDao
.
findAll
(
getSelectSpecification2
(
deviceLibrarySelectVo
,
name
));
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryDao
.
findAll
(
getSelectSpecification2
(
deviceLibrarySelectVo
,
name
));
Map
<
Integer
,
DeviceLibrary
>
nodeCollect
=
Map
<
Integer
,
DeviceLibrary
>
nodeCollect
=
deviceLibraryEntities
.
stream
().
collect
(
Collectors
.
toMap
(
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
deviceLibraryEntity
));
deviceLibraryEntities
.
stream
().
collect
(
Collectors
.
toMap
(
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
deviceLibraryEntity
));
List
<
DeviceLibrary
>
deviceLibraryEntities1
=
GetTreeUtils
.
parseTreeFromDown
(
return
GetTreeUtils
.
parseTreeFromDown
(
deviceLibraryEntities
,
deviceLibraryEntities
,
DeviceLibrary:
:
getId
,
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
deviceLibraryEntity
.
getPartParentId
())),
deviceLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
deviceLibraryEntity
.
getPartParentId
())),
DeviceLibrary:
:
addChildNode
DeviceLibrary:
:
addChildNode
);
);
return
deviceLibraryEntities1
;
}
}
@Override
@Override
public
List
<
DeviceLibrary
>
getListWithoutParent
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
)
{
public
List
<
DeviceLibrary
>
getListWithoutParent
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
)
{
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryDao
.
findAll
(
getSelectSpecification
(
deviceLibrarySelectVo
));
return
deviceLibraryDao
.
findAll
(
getSelectSpecification
(
deviceLibrarySelectVo
));
return
deviceLibraryEntities
;
}
}
@Override
@Override
...
@@ -346,13 +273,12 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
...
@@ -346,13 +273,12 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryDao
.
findAll
(
getAllotSelectSpecification
(
deviceLibrarySelectVo
));
List
<
DeviceLibrary
>
deviceLibraryEntities
=
deviceLibraryDao
.
findAll
(
getAllotSelectSpecification
(
deviceLibrarySelectVo
));
Map
<
Integer
,
DeviceLibrary
>
nodeCollect
=
Map
<
Integer
,
DeviceLibrary
>
nodeCollect
=
deviceLibraryEntities
.
stream
().
collect
(
Collectors
.
toMap
(
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
deviceLibraryEntity
));
deviceLibraryEntities
.
stream
().
collect
(
Collectors
.
toMap
(
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
deviceLibraryEntity
));
List
<
DeviceLibrary
>
deviceLibraryEntities1
=
GetTreeUtils
.
parseTreeFromDown
(
return
GetTreeUtils
.
parseTreeFromDown
(
deviceLibraryEntities
,
deviceLibraryEntities
,
DeviceLibrary:
:
getId
,
DeviceLibrary:
:
getId
,
deviceLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
deviceLibraryEntity
.
getPartParentId
())),
deviceLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
deviceLibraryEntity
.
getPartParentId
())),
DeviceLibrary:
:
addChildNode
DeviceLibrary:
:
addChildNode
);
);
return
deviceLibraryEntities1
;
}
}
@Override
@Override
...
...
dev-device/device-library/src/main/java/com/tykj/dev/device/library/subject/Dto/DeviceLogDto.java
浏览文件 @
99f3b55e
package
com
.
tykj
.
dev
.
device
.
library
.
subject
.
Dto
;
package
com
.
tykj
.
dev
.
device
.
library
.
subject
.
Dto
;
import
com.tykj.dev.device.library.subject.domin.DeviceLog
;
import
com.tykj.dev.device.library.subject.domin.DeviceLog
;
import
com.tykj.dev.device.library.subject.vo.DeviceLogUserVo
;
import
com.tykj.dev.device.library.subject.vo.FileVo
;
import
com.tykj.dev.device.library.subject.vo.FileVo
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.utils.SpringUtils
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
org.modelmapper.ModelMapper
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -75,4 +80,20 @@ public class DeviceLogDto {
...
@@ -75,4 +80,20 @@ public class DeviceLogDto {
this
.
remark
=
remark
;
this
.
remark
=
remark
;
this
.
fileVoList
=
fileVoList
;
this
.
fileVoList
=
fileVoList
;
}
}
/**
* dto类转化为vo类
*/
public
DeviceLogUserVo
toVo
(){
UserPublicService
userPublicService
=
SpringUtils
.
getBean
(
"userPublicServiceImpl"
);
//复制相同属性
ModelMapper
modelMapper
=
BeanHelper
.
getUserMapper
();
DeviceLogUserVo
deviceLogUserVo
=
modelMapper
.
map
(
this
,
DeviceLogUserVo
.
class
);
//set vo字段
if
(
userPublicService
!=
null
){
deviceLogUserVo
.
setUser
(
userPublicService
.
getOne
(
this
.
createUserId
).
getName
());
deviceLogUserVo
.
setUnit
(
userPublicService
.
findUnitsNameByUserId
(
this
.
createUserId
));
}
return
deviceLogUserVo
;
}
}
}
dev-device/device-library/src/main/java/com/tykj/dev/device/library/subject/domin/DeviceLog.java
浏览文件 @
99f3b55e
...
@@ -89,18 +89,6 @@ public class DeviceLog {
...
@@ -89,18 +89,6 @@ public class DeviceLog {
@ApiModelProperty
(
value
=
"删除标记(0:未删除,1:已删除)"
)
@ApiModelProperty
(
value
=
"删除标记(0:未删除,1:已删除)"
)
private
Integer
deleteTag
=
0
;
private
Integer
deleteTag
=
0
;
@ApiModelProperty
(
value
=
"操作用户"
)
@Transient
private
String
user
;
@ApiModelProperty
(
value
=
"操作单位"
)
@Transient
private
String
unit
;
@ApiModelProperty
(
value
=
"附件信息"
)
@Transient
private
List
<
FileVo
>
fileVoList
;
/**
/**
* do类转化为dto类
* do类转化为dto类
*/
*/
...
...
dev-device/device-library/src/main/java/com/tykj/dev/device/library/subject/vo/DeviceDetailVo.java
浏览文件 @
99f3b55e
...
@@ -18,7 +18,7 @@ public class DeviceDetailVo {
...
@@ -18,7 +18,7 @@ public class DeviceDetailVo {
private
List
<
DeviceLibrary
>
deviceList
;
private
List
<
DeviceLibrary
>
deviceList
;
private
List
<
DeviceLog
>
deviceLogEntityList
;
private
List
<
DeviceLog
UserVo
>
deviceLogEntityList
;
private
String
imageName
;
private
String
imageName
;
...
...
dev-device/device-library/src/main/java/com/tykj/dev/device/library/subject/vo/DeviceLogUserVo.java
0 → 100644
浏览文件 @
99f3b55e
package
com
.
tykj
.
dev
.
device
.
library
.
subject
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
import
java.util.List
;
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
DeviceLogUserVo
{
@ApiModelProperty
(
name
=
"主键id"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"业务id"
)
private
Integer
taskId
;
@ApiModelProperty
(
value
=
"操作描述"
)
private
String
remark
;
@ApiModelProperty
(
value
=
"附件信息"
)
private
List
<
FileVo
>
fileVoList
;
@ApiModelProperty
(
value
=
"操作用户"
)
private
String
user
;
@ApiModelProperty
(
value
=
"操作单位"
)
private
String
unit
;
@ApiModelProperty
(
value
=
"操作时间"
)
private
Date
createTime
;
}
dev-device/device-matching/src/main/java/package-info.java
deleted
100644 → 0
浏览文件 @
89a22fd8
dev-device/device-packing/pom.xml
浏览文件 @
99f3b55e
...
@@ -14,7 +14,14 @@
...
@@ -14,7 +14,14 @@
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-task
</artifactId>
<artifactId>
device-task
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-packing
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
dev-device/device-packing/src/main/java/com/tykj/dev/device/packing/service/impl/PackingLibraryServiceImpl.java
浏览文件 @
99f3b55e
...
@@ -55,7 +55,6 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
...
@@ -55,7 +55,6 @@ public class PackingLibraryServiceImpl implements PackingLibraryService {
packingLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
packingLibraryEntity
.
getPartParentId
())),
packingLibraryEntity
->
Optional
.
ofNullable
(
nodeCollect
.
get
(
packingLibraryEntity
.
getPartParentId
())),
PackingLibrary:
:
addChildNode
PackingLibrary:
:
addChildNode
);
);
return
packingLibraryEntityList
;
return
packingLibraryEntityList
;
}
}
...
...
dev-device/device-selfcheck/pom.xml
浏览文件 @
99f3b55e
...
@@ -14,10 +14,22 @@
...
@@ -14,10 +14,22 @@
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-library
</artifactId>
<artifactId>
device-library
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-selfcheck
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-task
</artifactId>
<artifactId>
device-task
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-selfcheck
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
dev-device/device-storage/pom.xml
浏览文件 @
99f3b55e
...
@@ -15,14 +15,32 @@
...
@@ -15,14 +15,32 @@
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-library
</artifactId>
<artifactId>
device-library
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-storage
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-packing
</artifactId>
<artifactId>
device-packing
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-storage
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-task
</artifactId>
<artifactId>
device-task
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-storage
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
dev-device/device-task/pom.xml
浏览文件 @
99f3b55e
...
@@ -20,10 +20,22 @@
...
@@ -20,10 +20,22 @@
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-user
</artifactId>
<artifactId>
device-user
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-task
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-library
</artifactId>
<artifactId>
device-library
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
device-task
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
dev-device/device-task/src/main/java/com/tykj/dev/device/task/controller/TaskController.java
浏览文件 @
99f3b55e
package
com
.
tykj
.
dev
.
device
.
task
.
controller
;
package
com
.
tykj
.
dev
.
device
.
task
.
controller
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.library.repository.DeviceLogDao
;
import
com.tykj.dev.device.task.repository.TaskLogDao
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.task.subject.bto.TaskLogBto
;
import
com.tykj.dev.device.task.subject.domin.Task
;
import
com.tykj.dev.device.task.subject.domin.TaskLog
;
import
com.tykj.dev.device.task.subject.vo.TaskLogUserVo
;
import
com.tykj.dev.device.task.subject.vo.TaskSelectVo
;
import
com.tykj.dev.device.task.subject.vo.TaskSelectVo
;
import
com.tykj.dev.device.task.subject.vo.TaskTopVo
;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
com.tykj.dev.device.
user.subject.service.UserPublicService
;
import
com.tykj.dev.device.
task.utils.TaskUtils
;
import
com.tykj.dev.device.user.util.UserUtils
;
import
com.tykj.dev.device.user.util.UserUtils
;
import
com.tykj.dev.misc.utils.PageUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -36,177 +43,65 @@ public class TaskController {
...
@@ -36,177 +43,65 @@ public class TaskController {
private
UserUtils
userUtils
;
private
UserUtils
userUtils
;
@Autowired
@Autowired
private
DeviceLibraryService
deviceLibraryService
;
private
TaskUtils
taskUtils
;
@Autowired
@Autowired
private
UserPublicService
userPublicService
;
private
TaskLogDao
taskLogDao
;
@Autowired
@ApiOperation
(
value
=
"业务分页查询"
,
notes
=
"可以通过这个接口分页查询业务"
)
private
DeviceLogDao
deviceLogDao
;
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/manage/summary"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Page
<
TaskUserVo
>>
getTaskPage
(
@RequestBody
TaskSelectVo
taskSelectVo
){
// @ApiOperation(value = "业务分页查询",notes = "可以通过这个接口分页查询业务")
List
<
TaskUserVo
>
taskUserVos
=
taskService
.
getManageList
(
taskSelectVo
);
// @RequestMapping(method = RequestMethod.POST , value = "/manage/summary",produces = MediaType.APPLICATION_JSON_VALUE)
return
ResultUtil
.
success
(
PageUtil
.
getPerPage
(
taskSelectVo
.
getPage
(),
taskSelectVo
.
getSize
(),
taskUtils
.
orderByTopDescAndReadAsc
(
taskUserVos
),
taskSelectVo
.
getPageable
()));
// public ResultObj getTaskPage(@RequestBody TaskSelectVo taskSelectVo){
}
// List<TaskEntity> taskServicePage = taskService.getPage(taskSelectVo, taskSelectVo.getPageable());
// List<TaskEntity> list = new ArrayList<>();
// List<TaskEntity> list1 = new ArrayList<>();
// List<TaskEntity> list2 = new ArrayList<>();
// for (TaskEntity t:taskServicePage) {
// if (t.getIsTop()==1){
// list1.add(t);
// }
// }
// for (TaskEntity t:list1) {
// if (t.getIsRead()==0){
// list.add(t);
// }
// }
// for (TaskEntity t:list1) {
// if (t.getIsRead()==1){
// list.add(t);
// }
// }
// for (TaskEntity t:taskServicePage) {
// if (t.getIsTop()==0){
// list2.add(t);
// }
// }
// for (TaskEntity t:list2) {
// if (t.getIsRead()==0){
// list.add(t);
// }
// }
// for (TaskEntity t:list2) {
// if (t.getIsRead()==1){
// list.add(t);
// }
// }
// if (list.size()<=taskSelectVo.getSize()) {
// return new ResultObj(new PageImpl<>(list, taskSelectVo.getPageable(), list.size()),"查询成功");
// }
// else {
// Double d = Math.ceil(list.size()/taskSelectVo.getSize().doubleValue());
// int value = new Double(d).intValue();
// if (taskSelectVo.getPage()>=value){
// return null;
// }
// else {
// int index = taskSelectVo.getPage()*taskSelectVo.getSize();
// if (taskSelectVo.getPage()==value){
// return new ResultObj(new PageImpl<>(list.subList(index,list.size()), taskSelectVo.getPageable(), list.size()),"查询成功");
// }
// return new ResultObj(new PageImpl<>(list.subList(index,index+taskSelectVo.getSize()), taskSelectVo.getPageable(), list.size()),"查询成功");
// }
// }
// }
@ApiOperation
(
value
=
"业务跟踪待办列表查询"
,
notes
=
"可以通过这个接口查询业务"
)
@ApiOperation
(
value
=
"业务跟踪待办列表查询"
,
notes
=
"可以通过这个接口查询业务"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/getTaskList"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/getTaskList"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
TaskUserVo
>>
getTaskList
(
@RequestBody
TaskSelectVo
taskSelectVo
){
public
ResponseEntity
<
List
<
TaskUserVo
>>
getTaskList
(
@RequestBody
TaskSelectVo
taskSelectVo
){
List
<
TaskUserVo
>
taskEntities
=
taskService
.
getList
(
taskSelectVo
);
List
<
TaskUserVo
>
taskUserVos
=
taskService
.
getList
(
taskSelectVo
);
//按置顶第一顺序,未读第二顺序排序输出
return
ResultUtil
.
success
(
taskUtils
.
orderByTopDescAndReadAsc
(
taskUserVos
));
List
<
TaskUserVo
>
list
=
new
ArrayList
<>();
List
<
TaskUserVo
>
list1
=
new
ArrayList
<>();
List
<
TaskUserVo
>
list2
=
new
ArrayList
<>();
//将置顶筛选到list1
for
(
TaskUserVo
t:
taskEntities
)
{
if
(
t
.
getIsTop
()==
1
){
list1
.
add
(
t
);
}
}
//list1中将未读的放在list最前面
for
(
TaskUserVo
t:
list1
)
{
if
(
t
.
getIsRead
()==
0
){
list
.
add
(
t
);
}
}
@ApiOperation
(
value
=
"置顶设置"
,
notes
=
"可以通过这个接口置顶业务"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/setTop"
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
TaskUserVo
>
setTop
(
@RequestBody
TaskTopVo
taskTopVo
){
TaskBto
taskBto
=
taskService
.
get
(
taskTopVo
.
getTaskId
());
Integer
userId
=
userUtils
.
getCurrentUserId
();
List
<
Integer
>
userIds
=
taskBto
.
getTopFlagDetailList
();
if
(
taskTopVo
.
getTopFlag
()==
1
)
{
if
(
userIds
!=
null
)
{
taskBto
.
getTopFlagDetailList
().
add
(
userId
);
}
}
//list1中将已读的放在list最后面
for
(
TaskUserVo
t:
list1
)
{
if
(
t
.
getIsRead
()==
1
){
list
.
add
(
t
);
}
}
if
(
taskTopVo
.
getTopFlag
()==
0
){
if
(
userIds
!=
null
&&
userIds
.
contains
(
userId
))
{
userIds
.
removeAll
(
new
ArrayList
<>(
Collections
.
singletonList
(
userId
)));
}
}
//将未置顶的放入list2中
for
(
TaskUserVo
t:
taskEntities
)
{
if
(
t
.
getIsTop
()==
0
){
list2
.
add
(
t
);
}
}
Task
task
=
taskService
.
update
(
taskBto
);
return
ResultUtil
.
success
(
task
.
parse2Bto
().
toVo
());
}
}
//将未读的优先放入list中
for
(
TaskUserVo
t:
list2
)
{
@ApiOperation
(
value
=
"是否已读设置"
,
notes
=
"可以通过这个接口设置业务的是否已读"
)
if
(
t
.
getIsRead
()==
0
){
@PostMapping
(
"/setRead"
)
list
.
add
(
t
);
public
ResponseEntity
<
TaskUserVo
>
setRead
(
@RequestBody
TaskTopVo
taskTopVo
){
TaskBto
taskBto
=
taskService
.
get
(
taskTopVo
.
getTaskId
());
Integer
userId
=
userUtils
.
getCurrentUserId
();
List
<
Integer
>
userIds
=
taskBto
.
getUserReadDetailList
();
if
(
taskTopVo
.
getTopFlag
()==
1
)
{
if
(
userIds
!=
null
)
{
taskBto
.
getTopFlagDetailList
().
add
(
userId
);
}
}
}
}
//将已读的放入list
if
(
taskTopVo
.
getTopFlag
()==
0
){
for
(
TaskUserVo
t:
list2
)
{
if
(
userIds
!=
null
&&
userIds
.
contains
(
userId
))
{
if
(
t
.
getIsRead
()==
1
){
userIds
.
removeAll
(
new
ArrayList
<>(
Collections
.
singletonList
(
userId
)));
list
.
add
(
t
);
}
}
}
}
return
ResultUtil
.
success
(
list
);
Task
task
=
taskService
.
update
(
taskBto
);
return
ResultUtil
.
success
(
task
.
parse2Bto
().
toVo
());
}
}
// @ApiOperation(value = "置顶设置",notes = "可以通过这个接口置顶业务")
// @RequestMapping(method = RequestMethod.PUT , value = "/setTop",produces = MediaType.APPLICATION_JSON_VALUE)
// public ResultObj setTop(@RequestBody TaskTopVo taskTopVo){
// TaskEntity taskEntity = taskService.getOne(taskTopVo.getTaskId());
// Integer userId = userUtils.getCurrentUserId();
// if (taskTopVo.getTopFlag()==1) {
// if (taskEntity.getTopFlagDetail()!=null) {
// taskEntity.setTopFlagDetail(taskEntity.getTopFlagDetail() + userId + "x");
// }
// else {
// taskEntity.setTopFlagDetail("x" + userId + "x");
// }
// }
// if (taskTopVo.getTopFlag()==0){
// List<Integer> idList = StringSplitUtil.userIdSplit(taskEntity.getTopFlagDetail());
// StringBuffer stringBuffer = new StringBuffer();
// stringBuffer.append("x");
// if (idList.size()>0){
// for (Integer id:idList) {
// if (!id.equals(userId)){
// stringBuffer.append(id+"x");
// }
// }
// }
// taskEntity.setTopFlagDetail(stringBuffer.toString());
// }
// TaskEntity taskEntityUpdated = taskService.update(taskEntity);
// return new ResultObj(taskEntityUpdated,"修改置顶标志成功");
// }
//
// @ApiOperation(value = "是否已读设置",notes = "可以通过这个接口设置业务的是否已读")
// @PostMapping("/setRead")
// public ResultObj setRead(@RequestBody TaskTopVo taskTopVo){
// TaskEntity taskEntity = taskService.getOne(taskTopVo.getTaskId());
// Integer userId = userUtils.getCurrentUserId();
// if (taskTopVo.getTopFlag()==1) {
// if (taskEntity.getUserReadDetail()!=null) {
// taskEntity.setUserReadDetail(taskEntity.getUserReadDetail() + userId + "x");
// }
// else {
// taskEntity.setUserReadDetail("x" + userId + "x");
// }
// }
// if (taskTopVo.getTopFlag()==0){
// List<Integer> idList = StringSplitUtil.userIdSplit(taskEntity.getUserReadDetail());
// StringBuffer stringBuffer = new StringBuffer();
// stringBuffer.append("x");
// if (idList.size()>0){
// for (Integer id:idList) {
// if (!id.equals(userId)){
// stringBuffer.append(id+"x");
// }
// }
// }
// taskEntity.setUserReadDetail(stringBuffer.toString());
// }
// TaskEntity taskEntityUpdated = taskService.update(taskEntity);
// return new ResultObj(taskEntityUpdated,"修改阅读标志成功");
// }
// @ApiOperation(value = "查询业务对应页面的数据",notes = "可以通过这个接口查询业务对应页面的数据")
// @ApiOperation(value = "查询业务对应页面的数据",notes = "可以通过这个接口查询业务对应页面的数据")
// @GetMapping("/manage/detail/{id}")
// @GetMapping("/manage/detail/{id}")
// public ResultObj selectData(@PathVariable("id") int taskId){
// public ResultObj selectData(@PathVariable("id") int taskId){
...
@@ -395,48 +290,10 @@ public class TaskController {
...
@@ -395,48 +290,10 @@ public class TaskController {
// return list;
// return list;
// }
// }
//
//
// @ApiOperation(value = "查询业务日志",notes = "可以通过这个接口查询查询业务日志")
@ApiOperation
(
value
=
"查询业务日志"
,
notes
=
"可以通过这个接口查询查询业务日志"
)
// @GetMapping("/manage/detail/log/{id}")
@GetMapping
(
"/manage/detail/log/{id}"
)
// public ResultObj selectLog(@PathVariable("id") int taskId){
public
ResponseEntity
<
List
<
TaskLogUserVo
>>
selectLog
(
@PathVariable
(
"id"
)
int
taskId
){
// Set<String> remarkList = new HashSet<>();
List
<
TaskLog
>
taskLogs
=
taskUtils
.
orderByCreateTimeAsc
(
taskLogDao
.
getAllByTaskId
(
taskId
));
// List<DeviceLogEntity> deviceLogEntities = new ArrayList<>();
return
ResultUtil
.
success
(
taskLogs
.
stream
().
map
(
TaskLog:
:
parse2bto
).
map
(
TaskLogBto:
:
toVo
).
collect
(
Collectors
.
toList
()));
// List<DeviceLogEntity> logEntities = orderByTime(deviceLogDao.getAllByTaskId(taskId));
}
// if (logEntities.size()>0){
// logEntities.forEach(deviceLogEntity -> {
// if (!remarkList.contains(deviceLogEntity.getRemark())){
// deviceLogEntities.add(deviceLogEntity);
// remarkList.add(deviceLogEntity.getRemark());
// }
// });
// }
// for (DeviceLogEntity d:deviceLogEntities) {
// d.setUser(userPublicService.getOne(d.getUserId()).getName());
// d.setUnit(userPublicService.findUnitsNameByUserId(d.getUserId()));
// String[] strings = d.getFileDetail().split("Ǵ");
// List<FileVo> fileVos = new ArrayList<>();
// if (strings.length>0){
// for (String s:strings) {
// if (s.length()>0){
// String[] strings1 = s.split("Ǒ");
// if ("".equals(strings1[0])&&strings1.length==4){
// FileVo fileVo = new FileVo();
// fileVo.setFileName(strings1[1]);
// fileVo.setFileUrl(strings1[2]);
// fileVo.setTitle(strings1[3]);
// fileVos.add(fileVo);
// }
// if (!"".equals(strings1[0])&&strings1.length==3){
// FileVo fileVo = new FileVo();
// fileVo.setFileName(strings1[0]);
// fileVo.setFileUrl(strings1[1]);
// fileVo.setTitle(strings1[2]);
// fileVos.add(fileVo);
// }
// }
// }
// }
// d.setFileVoList(fileVos);
// }
// return new ResultObj(deviceLogEntities,"查询成功");
// }
}
}
dev-device/device-task/src/main/java/com/tykj/dev/device/task/service/TaskService.java
浏览文件 @
99f3b55e
...
@@ -97,4 +97,10 @@ public interface TaskService {
...
@@ -97,4 +97,10 @@ public interface TaskService {
* 获取跟踪和待办业务列表
* 获取跟踪和待办业务列表
*/
*/
List
<
TaskUserVo
>
getList
(
TaskSelectVo
taskSelectVo
);
List
<
TaskUserVo
>
getList
(
TaskSelectVo
taskSelectVo
);
/**
* @param taskSelectVo
* 获取业务管理中的业务列表
*/
List
<
TaskUserVo
>
getManageList
(
TaskSelectVo
taskSelectVo
);
}
}
dev-device/device-task/src/main/java/com/tykj/dev/device/task/service/impl/TaskServiceImpl.java
浏览文件 @
99f3b55e
package
com
.
tykj
.
dev
.
device
.
task
.
service
.
impl
;
package
com
.
tykj
.
dev
.
device
.
task
.
service
.
impl
;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.Specifications
;
import
com.github.wenhao.jpa.Specifications
;
import
com.tykj.dev.device.task.repository.TaskDao
;
import
com.tykj.dev.device.task.repository.TaskDao
;
import
com.tykj.dev.device.task.repository.TaskLogDao
;
import
com.tykj.dev.device.task.repository.TaskLogDao
;
...
@@ -17,12 +18,14 @@ import com.tykj.dev.device.user.util.UserUtils;
...
@@ -17,12 +18,14 @@ import com.tykj.dev.device.user.util.UserUtils;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
javax.persistence.Transient
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
/**
* @author dengdiyi
* @author dengdiyi
...
@@ -280,6 +283,97 @@ public class TaskServiceImpl implements TaskService {
...
@@ -280,6 +283,97 @@ public class TaskServiceImpl implements TaskService {
return
taskEntities
;
return
taskEntities
;
}
}
/**
* @param taskSelectVo 获取业务管理中的业务列表
*/
@Override
public
List
<
TaskUserVo
>
getManageList
(
TaskSelectVo
taskSelectVo
)
{
Integer
num
=
taskSelectVo
.
getSelectNum
();
Integer
userId
=
userUtils
.
getCurrentUserId
();
//业务管理中的待办和跟踪
if
(
num
==
2
||
num
==
3
){
//查询出符合筛选条件的所有task
List
<
TaskUserVo
>
list
=
taskDao
.
findAll
(
getSelectSpecification
(
taskSelectVo
)).
stream
()
.
map
(
Task:
:
parse2Bto
)
.
map
(
TaskBto:
:
toVo
)
.
collect
(
Collectors
.
toList
());
//查询当前用户的跟踪和待办并和list按id取交集
List
<
TaskUserVo
>
taskUserVos
=
getList
(
taskSelectVo
).
stream
()
.
filter
(
taskUserVo
->
find
(
taskUserVo
.
getId
(),
list
)>-
1
)
.
collect
(
Collectors
.
toList
());
//判断是否需要按发起时间排序
if
(
taskSelectVo
.
getOrders
()!=
null
)
{
if
(
"createTime"
.
equals
(
taskSelectVo
.
getOrders
().
get
(
0
).
getCoulmn
()))
{
if
(
"ASC"
.
equals
(
taskSelectVo
.
getOrders
().
get
(
0
).
getDirection
().
toString
()))
{
return
taskUtils
.
orderByCreateTimeAsc2
(
taskUserVos
);
}
if
(
"DESC"
.
equals
(
taskSelectVo
.
getOrders
().
get
(
0
).
getDirection
().
toString
()))
{
return
taskUtils
.
orderByCreateTimeDesc2
(
taskUserVos
);
}
}
}
return
taskUserVos
;
}
if
(
num
==
4
||
num
==
5
||
num
==
1
||
num
==
0
)
{
//获取单位等级
Integer
level
=
userUtils
.
getCurrentUnitLevel
();
//获取该单位以及下属单位所有用户Id
List
<
Integer
>
idLists
=
userPublicService
.
findAllUserIdByUnitsName
(
userUtils
.
getCurrentUserUnitName
());
List
<
TaskUserVo
>
taskUserVos
=
new
ArrayList
<>();
//省能看到所有业务
if
(
level
==
1
)
{
taskUserVos
=
taskDao
.
findAll
(
getSelectSpecification
(
taskSelectVo
)).
stream
()
.
map
(
Task:
:
parse2Bto
)
.
map
(
TaskBto:
:
toVo
)
.
collect
(
Collectors
.
toList
());
}
//市或县只能看到涉及人员和idLists有交集的
if
(
level
==
2
||
level
==
3
){
taskUserVos
=
taskDao
.
findAll
(
getSelectSpecification
(
taskSelectVo
)).
stream
()
.
map
(
Task:
:
parse2Bto
)
.
map
(
TaskBto:
:
toVo
)
.
filter
(
taskUserVo
->
!
Collections
.
disjoint
(
idLists
,
taskUserVo
.
getInvolveUserIdList
()))
.
collect
(
Collectors
.
toList
());
}
//set经办人,置顶以及阅读情况
for
(
TaskUserVo
taskUserVo:
taskUserVos
)
{
List
<
Integer
>
idList
=
taskUserVo
.
getUserReadDetailList
();
List
<
Integer
>
idList2
=
taskUserVo
.
getTopFlagDetailList
();
if
(
taskUserVo
.
getInvolveUserIdList
()
!=
null
&&
taskUserVo
.
getInvolveUserIdList
().
size
()
>
0
)
{
//筛选出userId大于0的
List
<
Integer
>
userIds
=
taskUserVo
.
getInvolveUserIdList
().
stream
().
filter
(
integer
->
integer
>
0
).
collect
(
Collectors
.
toList
());
if
(
userIds
.
size
()
>
0
)
{
//List最后一个id即为最新经办人
taskUserVo
.
setProcessingUser
(
userPublicService
.
getOne
(
userIds
.
get
(
userIds
.
size
()
-
1
)).
getName
());
}
}
//判断当前用户是否已读
if
(
idList
.
contains
(
userId
))
{
taskUserVo
.
setIsRead
(
1
);
}
//判断当前用户是否置顶
if
(
idList2
.
contains
(
userId
))
{
taskUserVo
.
setIsTop
(
1
);
}
}
//判断是否需要按发起时间排序
if
(
taskSelectVo
.
getOrders
()!=
null
)
{
if
(
"createTime"
.
equals
(
taskSelectVo
.
getOrders
().
get
(
0
).
getCoulmn
()))
{
if
(
"ASC"
.
equals
(
taskSelectVo
.
getOrders
().
get
(
0
).
getDirection
().
toString
()))
{
return
taskUtils
.
orderByCreateTimeAsc2
(
taskUserVos
);
}
if
(
"DESC"
.
equals
(
taskSelectVo
.
getOrders
().
get
(
0
).
getDirection
().
toString
()))
{
return
taskUtils
.
orderByCreateTimeDesc2
(
taskUserVos
);
}
}
}
return
taskUserVos
;
}
else
{
throw
new
ApiException
(
ResultUtil
.
failed
(
"selectNum只能为0,1,2,3,4,5"
));
}
}
/**
/**
* @param taskSelectVo 查询vo
* @param taskSelectVo 查询vo
* 查询跟踪和待办列表
* 查询跟踪和待办列表
...
@@ -423,4 +517,58 @@ public class TaskServiceImpl implements TaskService {
...
@@ -423,4 +517,58 @@ public class TaskServiceImpl implements TaskService {
return
null
;
return
null
;
}
}
}
}
/**
* @param taskSelectVo
* task查询器
*/
private
Specification
<
Task
>
getSelectSpecification
(
TaskSelectVo
taskSelectVo
){
PredicateBuilder
<
Task
>
predicateBuilder
=
Specifications
.
and
();
if
(
taskSelectVo
.
getBussinessType
()!=
null
){
predicateBuilder
.
eq
(
"bussinessType"
,
taskSelectVo
.
getBussinessType
());
}
if
(
taskSelectVo
.
getContent
()!=
null
){
Class
<
Task
>
taskEntityClass
=
Task
.
class
;
Field
[]
declaredFields
=
taskEntityClass
.
getDeclaredFields
();
PredicateBuilder
<
Task
>
p
=
Specifications
.
or
();
for
(
Field
field
:
declaredFields
)
{
if
(
field
.
getType
().
equals
(
String
.
class
)&&
field
.
getAnnotation
(
Transient
.
class
)==
null
)
{
p
.
like
(
field
.
getName
(),
"%"
+
taskSelectVo
.
getContent
()
+
"%"
);
}
}
predicateBuilder
.
predicate
(
p
.
build
());
}
if
(
taskSelectVo
.
getStartTime
()!=
null
){
predicateBuilder
.
gt
(
"createTime"
,
taskSelectVo
.
getStartTime
());
}
if
(
taskSelectVo
.
getEndTime
()!=
null
){
predicateBuilder
.
lt
(
"createTime"
,
taskSelectVo
.
getEndTime
());
}
if
(
taskSelectVo
.
getSelectNum
()==
4
){
predicateBuilder
.
eq
(
"billStatus"
,
13
);
}
if
(
taskSelectVo
.
getSelectNum
()==
5
){
predicateBuilder
.
eq
(
"billStatus"
,
14
);
}
if
(
taskSelectVo
.
getSelectNum
()==
1
){
predicateBuilder
.
eq
(
"createUserId"
,
userUtils
.
getCurrentUnitId
());
}
return
predicateBuilder
.
build
();
}
/**
* 判断list中是否包含某个id的taskUserVo,若不存在返回-1,存在则返回第一次出现的索引值
*/
int
find
(
Integer
id
,
List
<
TaskUserVo
>
list
){
int
index
=
-
1
;
if
(
list
!=
null
&&
list
.
size
()>
0
){
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
if
(
list
.
get
(
i
).
getId
().
equals
(
id
)){
index
=
i
;
break
;
}
}
}
return
index
;
}
}
}
dev-device/device-task/src/main/java/com/tykj/dev/device/task/subject/bto/TaskBto.java
浏览文件 @
99f3b55e
...
@@ -5,6 +5,7 @@ import com.tykj.dev.device.task.subject.domin.Task;
...
@@ -5,6 +5,7 @@ import com.tykj.dev.device.task.subject.domin.Task;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.utils.SpringUtils
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
...
@@ -13,6 +14,7 @@ import lombok.NoArgsConstructor;
...
@@ -13,6 +14,7 @@ import lombok.NoArgsConstructor;
import
org.modelmapper.ModelMapper
;
import
org.modelmapper.ModelMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -23,12 +25,8 @@ import java.util.List;
...
@@ -23,12 +25,8 @@ import java.util.List;
@Data
@Data
@NoArgsConstructor
@NoArgsConstructor
@AllArgsConstructor
@AllArgsConstructor
@Repository
public
class
TaskBto
{
public
class
TaskBto
{
@Autowired
private
UserPublicService
userPublicService
;
@ApiModelProperty
(
value
=
"主键id"
)
@ApiModelProperty
(
value
=
"主键id"
)
private
Integer
id
;
private
Integer
id
;
...
@@ -97,11 +95,14 @@ public class TaskBto {
...
@@ -97,11 +95,14 @@ public class TaskBto {
* bto类转化为vo类
* bto类转化为vo类
*/
*/
public
TaskUserVo
toVo
(){
public
TaskUserVo
toVo
(){
UserPublicService
userPublicService
=
SpringUtils
.
getBean
(
"userPublicServiceImpl"
);
//复制相同属性
//复制相同属性
ModelMapper
modelMapper
=
BeanHelper
.
getUserMapper
();
ModelMapper
modelMapper
=
BeanHelper
.
getUserMapper
();
TaskUserVo
taskUserVo
=
modelMapper
.
map
(
this
,
TaskUserVo
.
class
);
TaskUserVo
taskUserVo
=
modelMapper
.
map
(
this
,
TaskUserVo
.
class
);
//set vo字段
//set vo字段
if
(
userPublicService
!=
null
)
{
taskUserVo
.
setStartUnit
(
userPublicService
.
findUnitsNameByUserId
(
this
.
createUserId
));
taskUserVo
.
setStartUnit
(
userPublicService
.
findUnitsNameByUserId
(
this
.
createUserId
));
}
taskUserVo
.
setStatus
(
GlobalMap
.
getStatusEnumMap
().
get
(
this
.
billStatus
).
name
);
taskUserVo
.
setStatus
(
GlobalMap
.
getStatusEnumMap
().
get
(
this
.
billStatus
).
name
);
return
taskUserVo
;
return
taskUserVo
;
}
}
...
...
dev-device/device-task/src/main/java/com/tykj/dev/device/task/subject/bto/TaskLogBto.java
浏览文件 @
99f3b55e
...
@@ -2,10 +2,15 @@ package com.tykj.dev.device.task.subject.bto;
...
@@ -2,10 +2,15 @@ package com.tykj.dev.device.task.subject.bto;
import
com.tykj.dev.device.task.subject.domin.TaskLog
;
import
com.tykj.dev.device.task.subject.domin.TaskLog
;
import
com.tykj.dev.device.library.subject.vo.FileVo
;
import
com.tykj.dev.device.library.subject.vo.FileVo
;
import
com.tykj.dev.device.task.subject.vo.TaskLogUserVo
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.utils.SpringUtils
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
org.modelmapper.ModelMapper
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -64,4 +69,20 @@ public class TaskLogBto {
...
@@ -64,4 +69,20 @@ public class TaskLogBto {
this
.
remark
=
remark
;
this
.
remark
=
remark
;
this
.
fileVoList
=
fileVoList
;
this
.
fileVoList
=
fileVoList
;
}
}
/**
* bto类转化为vo类
*/
public
TaskLogUserVo
toVo
(){
UserPublicService
userPublicService
=
SpringUtils
.
getBean
(
"userPublicServiceImpl"
);
//复制相同属性
ModelMapper
modelMapper
=
BeanHelper
.
getUserMapper
();
TaskLogUserVo
taskLogUserVo
=
modelMapper
.
map
(
this
,
TaskLogUserVo
.
class
);
//set vo字段
if
(
userPublicService
!=
null
){
taskLogUserVo
.
setUser
(
userPublicService
.
getOne
(
this
.
createUserId
).
getName
());
taskLogUserVo
.
setUnit
(
userPublicService
.
findUnitsNameByUserId
(
this
.
createUserId
));
}
return
taskLogUserVo
;
}
}
}
dev-device/device-task/src/main/java/com/tykj/dev/device/task/subject/domin/TaskLog.java
浏览文件 @
99f3b55e
...
@@ -84,18 +84,6 @@ public class TaskLog {
...
@@ -84,18 +84,6 @@ public class TaskLog {
@ApiModelProperty
(
value
=
"删除标记(0:未删除,1:已删除)"
)
@ApiModelProperty
(
value
=
"删除标记(0:未删除,1:已删除)"
)
private
Integer
deleteTag
=
0
;
private
Integer
deleteTag
=
0
;
@ApiModelProperty
(
value
=
"操作用户"
)
@Transient
private
String
user
;
@ApiModelProperty
(
value
=
"操作单位"
)
@Transient
private
String
unit
;
@ApiModelProperty
(
value
=
"附件信息"
)
@Transient
private
List
<
FileVo
>
fileVoList
;
/**
/**
* do类转化为bto类
* do类转化为bto类
*/
*/
...
...
dev-device/device-task/src/main/java/com/tykj/dev/device/task/subject/vo/TaskLogUserVo.java
0 → 100644
浏览文件 @
99f3b55e
package
com
.
tykj
.
dev
.
device
.
task
.
subject
.
vo
;
import
com.tykj.dev.device.library.subject.vo.FileVo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
import
java.util.List
;
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
TaskLogUserVo
{
@ApiModelProperty
(
name
=
"主键id"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"业务id"
)
private
Integer
taskId
;
@ApiModelProperty
(
value
=
"操作描述"
)
private
String
remark
;
@ApiModelProperty
(
value
=
"附件信息"
)
private
List
<
FileVo
>
fileVoList
;
@ApiModelProperty
(
value
=
"操作用户"
)
private
String
user
;
@ApiModelProperty
(
value
=
"操作单位"
)
private
String
unit
;
@ApiModelProperty
(
value
=
"操作时间"
)
private
Date
createTime
;
}
dev-device/device-task/src/main/java/com/tykj/dev/device/task/utils/TaskUtils.java
浏览文件 @
99f3b55e
...
@@ -4,6 +4,7 @@ import com.tykj.dev.device.task.subject.domin.TaskLog;
...
@@ -4,6 +4,7 @@ import com.tykj.dev.device.task.subject.domin.TaskLog;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
...
@@ -26,6 +27,18 @@ public class TaskUtils {
...
@@ -26,6 +27,18 @@ public class TaskUtils {
return
list
;
return
list
;
}
}
/**
* @param list 业务日志list
* 按照日志创建时间增序排列
*/
public
List
<
TaskLog
>
orderByCreateTimeAsc
(
List
<
TaskLog
>
list
){
Collections
.
sort
(
list
,
(
o1
,
o2
)
->
{
int
flag
=
o1
.
getCreateTime
().
compareTo
(
o2
.
getCreateTime
());
return
flag
;
});
return
list
;
}
/**
/**
* @param list taskUserVo list
* @param list taskUserVo list
* 按照跟踪时间增序排列
* 按照跟踪时间增序排列
...
@@ -73,4 +86,75 @@ public class TaskUtils {
...
@@ -73,4 +86,75 @@ public class TaskUtils {
});
});
return
list
;
return
list
;
}
}
/**
* @param list taskUserVo list
* 按照发起时间降序排列
*/
public
List
<
TaskUserVo
>
orderByCreateTimeDesc2
(
List
<
TaskUserVo
>
list
){
Collections
.
sort
(
list
,
(
o1
,
o2
)
->
{
int
flag
=
o2
.
getCreateTime
().
compareTo
(
o1
.
getCreateTime
());
return
flag
;
});
return
list
;
}
/**
* @param list taskUserVo list
* 按照发起时间升序排列
*/
public
List
<
TaskUserVo
>
orderByCreateTimeAsc2
(
List
<
TaskUserVo
>
list
){
Collections
.
sort
(
list
,
(
o1
,
o2
)
->
{
int
flag
=
o1
.
getCreateTime
().
compareTo
(
o2
.
getCreateTime
());
return
flag
;
});
return
list
;
}
/**
* @param taskUserVos
* 按置顶第一顺序,未读第二顺序排序输出
*/
public
List
<
TaskUserVo
>
orderByTopDescAndReadAsc
(
List
<
TaskUserVo
>
taskUserVos
){
List
<
TaskUserVo
>
list
=
new
ArrayList
<>();
List
<
TaskUserVo
>
list1
=
new
ArrayList
<>();
List
<
TaskUserVo
>
list2
=
new
ArrayList
<>();
//将置顶筛选到list1
for
(
TaskUserVo
t:
taskUserVos
)
{
if
(
t
.
getIsTop
()==
1
){
list1
.
add
(
t
);
}
}
//list1中将未读的放在list最前面
for
(
TaskUserVo
t:
list1
)
{
if
(
t
.
getIsRead
()==
0
){
list
.
add
(
t
);
}
}
//list1中将已读的放在list最后面
for
(
TaskUserVo
t:
list1
)
{
if
(
t
.
getIsRead
()==
1
){
list
.
add
(
t
);
}
}
//将未置顶的放入list2中
for
(
TaskUserVo
t:
taskUserVos
)
{
if
(
t
.
getIsTop
()==
0
){
list2
.
add
(
t
);
}
}
//将未读的优先放入list中
for
(
TaskUserVo
t:
list2
)
{
if
(
t
.
getIsRead
()==
0
){
list
.
add
(
t
);
}
}
//将已读的放入list
for
(
TaskUserVo
t:
list2
)
{
if
(
t
.
getIsRead
()==
1
){
list
.
add
(
t
);
}
}
return
list
;
}
}
}
dev-device/device-user/src/main/java/com/tykj/dev/device/user/util/UserUtils.java
浏览文件 @
99f3b55e
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.user.util;
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.user.util;
import
com.tykj.dev.device.user.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.entity.SecurityUser
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
com.tykj.dev.misc.utils.SpringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -12,8 +13,7 @@ import org.springframework.stereotype.Component;
...
@@ -12,8 +13,7 @@ import org.springframework.stereotype.Component;
@Component
@Component
public
class
UserUtils
{
public
class
UserUtils
{
@Autowired
private
UnitsService
unitsService
=
SpringUtils
.
getBean
(
"unitsServiceImpl"
);
private
UnitsService
unitsService
;
public
Integer
getCurrentUserId
(){
public
Integer
getCurrentUserId
(){
SecurityUser
authentication
=
AuthenticationUtils
.
getAuthentication
();
SecurityUser
authentication
=
AuthenticationUtils
.
getAuthentication
();
...
...
dev-misc/src/main/java/com/tykj/dev/misc/utils/PageUtil.java
0 → 100644
浏览文件 @
99f3b55e
package
com
.
tykj
.
dev
.
misc
.
utils
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Pageable
;
import
java.util.List
;
/**
* @author dengdiyi
* 分页工具类
*/
public
class
PageUtil
{
/**
* @param page 当前页数,默认0为第一页
* @param size 分页大小
* 获取分页后每一页的分页信息
*/
public
static
<
T
>
Page
<
T
>
getPerPage
(
Integer
page
,
Integer
size
,
List
<
T
>
list
,
Pageable
pageable
){
//若List的size小于分页大小(只有一页)
if
(
list
.
size
()<=
size
)
{
return
new
PageImpl
<>(
list
,
pageable
,
list
.
size
());
}
else
{
//计算分了几页
double
d
=
Math
.
ceil
(
list
.
size
()/
size
.
doubleValue
());
int
value
=
new
Double
(
d
).
intValue
();
//当前页数超出了最大页数
if
(
page
>=
value
){
return
null
;
}
else
{
//当前页的第一条记录的索引值
int
index
=
page
*
size
;
//当前页为最后一页
if
(
page
==
value
-
1
){
return
new
PageImpl
<>(
list
.
subList
(
index
,
list
.
size
()),
pageable
,
list
.
size
());
}
return
new
PageImpl
<>(
list
.
subList
(
index
,
index
+
size
),
pageable
,
list
.
size
());
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论