Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
3955411a
提交
3955411a
authored
8月 12, 2021
作者:
zhoushaopan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改多个模块
上级
96d656dc
流水线
#310
已失败 于阶段
变更
19
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
19 个修改的文件
包含
328 行增加
和
9 行删除
+328
-9
MyThread.java
...fig/src/main/java/com/tykj/dev/config/cache/MyThread.java
+29
-0
pom.xml
dev-library/pom.xml
+5
-0
CacheLibraryController.java
...dev/device/library/controller/CacheLibraryController.java
+34
-0
DeviceLibraryController.java
...ev/device/library/controller/DeviceLibraryController.java
+91
-2
CacheLibraryService.java
.../tykj/dev/device/library/service/CacheLibraryService.java
+17
-0
DeviceLibraryService.java
...tykj/dev/device/library/service/DeviceLibraryService.java
+5
-0
MyInitializer.java
...va/com/tykj/dev/device/library/service/MyInitializer.java
+20
-0
CacheLibraryServiceImpl.java
.../device/library/service/impl/CacheLibraryServiceImpl.java
+37
-0
DeviceLibraryServiceImpl.java
...device/library/service/impl/DeviceLibraryServiceImpl.java
+18
-2
DeviceLibrary.java
.../tykj/dev/device/library/subject/domin/DeviceLibrary.java
+4
-0
DeviceNewVo.java
...a/com/tykj/dev/device/library/subject/vo/DeviceNewVo.java
+4
-0
DeviceStatisticsVo.java
...ykj/dev/device/library/subject/vo/DeviceStatisticsVo.java
+3
-0
PackingController.java
...tykj/dev/device/packing/controller/PackingController.java
+1
-1
RepairController.java
...m/tykj/dev/device/repair/controller/RepairController.java
+19
-4
StorageBillController.java
.../dev/device/storage/controller/StorageBillController.java
+18
-0
UnionApplication.java
...on/src/main/java/com/tykj/dev/union/UnionApplication.java
+2
-0
MessageBto.java
...com/tykj/dev/device/user/read/subject/bto/MessageBto.java
+15
-0
Message.java
.../com/tykj/dev/device/user/read/subject/domin/Message.java
+3
-0
MessageUserVo.java
...m/tykj/dev/device/user/read/subject/vo/MessageUserVo.java
+3
-0
没有找到文件。
dev-config/src/main/java/com/tykj/dev/config/cache/MyThread.java
0 → 100644
浏览文件 @
3955411a
package
com
.
tykj
.
dev
.
config
.
cache
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.ThreadPoolExecutor
;
/**
* DATE:2021-8-10
* Author:zsp
*/
@Configuration
public
class
MyThread
{
@Bean
(
"taskExecutor"
)
public
Executor
taskExecutor
()
{
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
executor
.
setCorePoolSize
(
20
);
executor
.
setMaxPoolSize
(
50
);
executor
.
setQueueCapacity
(
200
);
executor
.
setKeepAliveSeconds
(
60
*
24
*
7
);
executor
.
setThreadNamePrefix
(
"scheduleTask-"
);
executor
.
setAwaitTerminationSeconds
(
60
*
5
);
executor
.
setRejectedExecutionHandler
(
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
return
executor
;
}
}
dev-library/pom.xml
浏览文件 @
3955411a
...
...
@@ -50,5 +50,9 @@
<artifactId>
easypoi-annotation
</artifactId>
<version>
3.2.0
</version>
</dependency>
<dependency>
<groupId>
com.github.ben-manes.caffeine
</groupId>
<artifactId>
caffeine
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
dev-library/src/main/java/com/tykj/dev/device/library/controller/CacheLibraryController.java
0 → 100644
浏览文件 @
3955411a
package
com
.
tykj
.
dev
.
device
.
library
.
controller
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.library.service.CacheLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* DATE:2021-8-11
* Author:zsp
*/
@RestController
@RequestMapping
(
value
=
"/cacheLibrary"
)
@AutoDocument
@Api
(
tags
=
"装备缓存模块"
,
description
=
"装备缓存接口"
)
@Slf4j
public
class
CacheLibraryController
{
@Autowired
private
CacheLibraryService
cacheLibraryService
;
@GetMapping
(
"getAll"
)
public
List
<
DeviceLibrary
>
getAll
(){
return
cacheLibraryService
.
getAllDeviceLibraryList
();
}
}
dev-library/src/main/java/com/tykj/dev/device/library/controller/DeviceLibraryController.java
浏览文件 @
3955411a
...
...
@@ -6,6 +6,7 @@ import com.tykj.dev.config.cache.ConfigCache;
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.CacheLibraryService
;
import
com.tykj.dev.device.library.service.DeviceChangeService
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLogService
;
...
...
@@ -23,6 +24,8 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -33,6 +36,8 @@ import org.springframework.web.bind.annotation.*;
import
javax.validation.constraints.Min
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.Executor
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -66,20 +71,36 @@ public class DeviceLibraryController {
@Autowired
private
ConfigCache
configCache
;
@Autowired
@Qualifier
(
"taskExecutor"
)
private
Executor
executor
;
@Autowired
private
CacheLibraryService
cacheLibraryService
;
@ApiOperation
(
value
=
"修改装备备注"
,
notes
=
"修改装备备注"
)
@PostMapping
(
"/setRecord"
)
@CacheEvict
(
value
=
"devicesLibraryList"
,
key
=
"'device'"
,
allEntries
=
true
)
public
ResponseEntity
setRecord
(
@RequestBody
Record
record
){
DeviceLibrary
deviceLibrary
=
deviceLibraryService
.
getOne
(
record
.
getId
());
deviceLibrary
.
setRecord
(
record
.
getRecord
());
deviceLibraryService
.
update
(
deviceLibrary
);
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
record
.
getId
(),
"将备注改为"
+
record
.
getRecord
(),
null
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
//异步去查询数据库
executor
.
execute
(
()->{
cacheLibraryService
.
getAllDeviceLibraryList
();
}
);
return
ResponseEntity
.
ok
(
"修改成功"
);
}
@ApiOperation
(
value
=
"修改装备生命状态"
,
notes
=
"修改装备生命状态"
)
@PostMapping
(
"/updateLifeStatus/{lifeStatus}"
)
@CacheEvict
(
value
=
"devicesLibraryList"
,
key
=
"'device'"
,
allEntries
=
true
)
public
ResponseEntity
selectByIds
(
@RequestBody
List
<
Integer
>
ids
,
@PathVariable
(
"lifeStatus"
)
int
lifeStatus
){
List
<
DeviceLogDto
>
deviceLogDtos
=
new
ArrayList
<>();
ids
.
forEach
(
integer
->
{
...
...
@@ -89,6 +110,12 @@ public class DeviceLibraryController {
deviceLibraryService
.
update
(
deviceLibrary
);
});
deviceLogService
.
addAllLog
(
deviceLogDtos
);
//异步去查询数据库
executor
.
execute
(
()->{
cacheLibraryService
.
getAllDeviceLibraryList
();
}
);
return
ResponseEntity
.
ok
(
"修改成功"
);
}
...
...
@@ -465,7 +492,10 @@ public class DeviceLibraryController {
public
ResponseEntity
getDeviceStatisticsPage
(
@RequestBody
DeviceLibrarySelectVo
deviceLibrarySelectVo
)
{
List
<
DeviceStatisticsVo
>
deviceStatisticsVoList
=
deviceLibraryService
.
getDeviceStatisticsPage
(
deviceLibrarySelectVo
,
deviceLibrarySelectVo
.
getPageable
(),
deviceLibrarySelectVo
.
getPageable
().
getSort
());
List
<
DeviceStatisticsVo
>
deviceStatisticsVoSorts
=
deviceStatisticsVoList
.
stream
()
.
sorted
(
Comparator
.
comparing
(
DeviceStatisticsVo:
:
getModel
).
thenComparing
(
DeviceStatisticsVo:
:
getName
)).
collect
(
Collectors
.
toList
());
.
sorted
(
Comparator
.
comparing
(
DeviceStatisticsVo:
:
getModel
)
// .thenComparing(DeviceStatisticsVo::getName)
.
thenComparing
(
DeviceStatisticsVo:
:
getMatchingRangeName
)
.
thenComparing
(
DeviceStatisticsVo:
:
getIsPart
)).
collect
(
Collectors
.
toList
());
// Page<DeviceStatisticsVo> deviceStatisticsVos = PageUtil.getPerPage(deviceLibrarySelectVo.getPage(), deviceLibrarySelectVo.getSize(), deviceStatisticsVoList, deviceLibrarySelectVo.getPageable());
Page
<
DeviceStatisticsVo
>
deviceStatisticsVos
=
PageUtil
.
getPerPage
(
deviceLibrarySelectVo
.
getPage
(),
deviceLibrarySelectVo
.
getSize
(),
deviceStatisticsVoSorts
,
deviceLibrarySelectVo
.
getPageable
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
@@ -533,6 +563,7 @@ public class DeviceLibraryController {
@ApiOperation
(
value
=
"更新装备库"
,
notes
=
"可以通过这个接口更新装备库"
)
@PostMapping
(
"/updateDeviceLibrary"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@CacheEvict
(
value
=
"devicesLibraryList"
,
key
=
"'device'"
,
allEntries
=
true
)
public
ResponseEntity
updateDeviceLibrary
(
@RequestBody
@Validated
DeviceEditVo
deviceEditVo
)
{
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
deviceEditVo
.
getDeviceId
());
//更新装备信息
...
...
@@ -685,6 +716,12 @@ public class DeviceLibraryController {
}
}
}
//异步去查询数据库
executor
.
execute
(
()->{
cacheLibraryService
.
getAllDeviceLibraryList
();
}
);
return
ResultUtil
.
success
(
"更新成功"
);
}
...
...
@@ -717,6 +754,7 @@ public class DeviceLibraryController {
@ApiOperation
(
value
=
"修改装备的存放位置"
)
@PostMapping
(
"/updateDeviceLibraryLocation"
)
@CacheEvict
(
value
=
"devicesLibraryList"
,
key
=
"'device'"
,
allEntries
=
true
)
public
void
updateDeviceLibraryLocation
(
@RequestBody
DeviceStorageLocation
deviceStorageLocation
){
DeviceLibrary
deviceLibrary
=
deviceLibraryService
.
getOne
(
deviceStorageLocation
.
getDevId
());
//添加修改存放装备位置
...
...
@@ -724,10 +762,17 @@ public class DeviceLibraryController {
DeviceLogDto
deviceLogDto
=
new
DeviceLogDto
(
deviceStorageLocation
.
getDevId
(),
"将存放位置改为"
+
deviceStorageLocation
.
getStorageLocation
(),
null
,
null
,
null
);
deviceLogService
.
addLog
(
deviceLogDto
);
deviceLibraryService
.
update
(
deviceLibrary
);
//异步去查询数据库
executor
.
execute
(
()->{
cacheLibraryService
.
getAllDeviceLibraryList
();
}
);
}
@ApiOperation
(
"根据装备id修改装备的序列号"
)
@PostMapping
(
"updateSeqByDeviceId"
)
@CacheEvict
(
value
=
"devicesLibraryList"
,
key
=
"'device'"
,
allEntries
=
true
)
public
ResponseEntity
updateSeqByDeviceId
(
@RequestBody
DeviceSeqVo
deviceSeqVo
){
DeviceLibrary
deviceLibrary
=
deviceLibraryService
.
getOne
(
deviceSeqVo
.
getId
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
@@ -746,6 +791,12 @@ public class DeviceLibraryController {
map
.
put
(
"deviceLibrary"
,
deviceLibrary
);
map
.
put
(
"success"
,
"装备序列号信息更新成功"
);
}
//异步去查询数据库
executor
.
execute
(
()->{
cacheLibraryService
.
getAllDeviceLibraryList
();
}
);
return
ResponseEntity
.
ok
(
map
);
}
...
...
@@ -758,10 +809,48 @@ public class DeviceLibraryController {
Map
<
String
,
List
<
DeviceLibrary
>>
map
=
byIds
.
stream
().
collect
(
Collectors
.
groupingBy
(
DeviceLibrary:
:
getOwnUnit
));
List
<
DeviceNewVo
>
deviceNewVoList
=
new
ArrayList
<>();
map
.
forEach
((
k
,
v
)->{
DeviceNewVo
deviceNewVo
=
new
DeviceNewVo
(
v
.
get
(
0
).
getModel
(),
v
.
get
(
0
).
getName
(),
v
.
get
(
0
).
getMatchingRangeName
(),
v
.
get
(
0
).
getTypeName
(),
v
.
size
(),
k
);
DeviceNewVo
deviceNewVo
=
new
DeviceNewVo
(
v
.
get
(
0
).
getModel
(),
v
.
get
(
0
).
getName
(),
v
.
get
(
0
).
getMatchingRangeName
(),
v
.
get
(
0
).
getTypeName
(),
v
.
size
(),
k
,
v
.
stream
().
map
(
DeviceLibrary:
:
getId
).
collect
(
Collectors
.
toList
()));
deviceNewVoList
.
add
(
deviceNewVo
);
});
return
deviceNewVoList
;
}
/**
* 测试
*/
// @GetMapping("/setNumber")
// public List<DeviceLibrary> setNumber(){
//
// List<DeviceLibrary> allListAndParent = getAllListAndParent();
// List<DeviceLibrary> deviceLibraries = setOrderNumber(allListAndParent);
// return deviceLibraries;
// }
//
// public List<DeviceLibrary> getAllListAndParent(){
// DeviceLibrarySelectVo deviceLibrarySelectVo = new DeviceLibrarySelectVo();
// List<DeviceLibrary> deviceLibraryServiceAllList = deviceLibraryService.getAllList(deviceLibrarySelectVo);
// Map<Integer, DeviceLibrary> collect = deviceLibraryServiceAllList.stream().collect(Collectors.toMap(DeviceLibrary::getId, Function.identity()));
// List<DeviceLibrary> containList = GetTreeUtils.parseTreeFromDown(
// deviceLibraryServiceAllList,
// DeviceLibrary::getId,
// deviceLibraryEntity -> Optional.ofNullable(collect.get(deviceLibraryEntity.getPartParentId())),
// DeviceLibrary::addChildNode
// );
// return containList;
// }
//
// private List<DeviceLibrary> setOrderNumber(List<DeviceLibrary> allListAndParent) {
// for (int i = 0; i < allListAndParent.size(); i++) {
// DeviceLibrary deviceLibrary = allListAndParent.get(i);
// deviceLibrary.setOrderNumber(i+1);
// i++;
// if (deviceLibrary.getChilds().size()>0){
// setOrderNumber(deviceLibrary.getChilds());
// }
// }
// return allListAndParent;
// }
}
dev-library/src/main/java/com/tykj/dev/device/library/service/CacheLibraryService.java
0 → 100644
浏览文件 @
3955411a
package
com
.
tykj
.
dev
.
device
.
library
.
service
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
java.util.List
;
/**
* DATE:2021-8-11
* Author:zsp
*/
public
interface
CacheLibraryService
{
/**
* 查询全部
*/
List
<
DeviceLibrary
>
getAllDeviceLibraryList
();
}
dev-library/src/main/java/com/tykj/dev/device/library/service/DeviceLibraryService.java
浏览文件 @
3955411a
...
...
@@ -208,4 +208,9 @@ public interface DeviceLibraryService {
// *
// */
// List<DeviceLibrary> findByIds2(List<Integer> ids);
/**
* 得到所有的装备
*/
List
<
DeviceLibrary
>
getAllDeviceList
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
);
}
dev-library/src/main/java/com/tykj/dev/device/library/service/MyInitializer.java
0 → 100644
浏览文件 @
3955411a
package
com
.
tykj
.
dev
.
device
.
library
.
service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.event.ApplicationReadyEvent
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.stereotype.Component
;
/**
* DATE:2021-8-11
* Author:zsp
*/
@Component
public
class
MyInitializer
implements
ApplicationListener
<
ApplicationReadyEvent
>
{
@Autowired
private
CacheLibraryService
cacheLibraryService
;
@Override
public
void
onApplicationEvent
(
ApplicationReadyEvent
event
)
{
cacheLibraryService
.
getAllDeviceLibraryList
();
}
}
dev-library/src/main/java/com/tykj/dev/device/library/service/impl/CacheLibraryServiceImpl.java
0 → 100644
浏览文件 @
3955411a
package
com
.
tykj
.
dev
.
device
.
library
.
service
.
impl
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.service.CacheLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.concurrent.ConcurrentMapCacheManager
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* DATE:2021-8-11
* Author:zsp
*/
@Service
@CacheConfig
(
cacheNames
=
"devicesLibraryList"
)
public
class
CacheLibraryServiceImpl
implements
CacheLibraryService
{
@Autowired
private
DeviceLibraryDao
deviceLibraryDao
;
// @Autowired
// private ConcurrentMapCacheManager mapCacheManager;
@Override
@Cacheable
(
key
=
"'device'"
)
public
List
<
DeviceLibrary
>
getAllDeviceLibraryList
()
{
long
l
=
System
.
currentTimeMillis
();
List
<
DeviceLibrary
>
all
=
deviceLibraryDao
.
findAll
();
System
.
out
.
println
(
"缓存时间"
+(
System
.
currentTimeMillis
()-
l
));
return
all
;
}
}
dev-library/src/main/java/com/tykj/dev/device/library/service/impl/DeviceLibraryServiceImpl.java
浏览文件 @
3955411a
...
...
@@ -7,6 +7,7 @@ import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import
com.tykj.dev.config.TaskBeanConfig
;
import
com.tykj.dev.config.base.DeviceLifeStatus
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.service.CacheLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo
;
...
...
@@ -18,6 +19,7 @@ import com.tykj.dev.device.user.util.UserUtils;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.utils.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
...
...
@@ -54,6 +56,8 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Autowired
private
UnitsService
unitsService
;
@Autowired
private
CacheLibraryService
cacheLibraryService
;
@Override
public
DeviceLibrary
addEntity
(
DeviceLibrary
deviceLibraryEntity
)
{
DeviceLibrary
deviceLibrary
=
deviceLibraryDao
.
save
(
deviceLibraryEntity
);
...
...
@@ -210,11 +214,11 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
List
<
DeviceLibrary
>
libraryEntities
=
getCoreDevicePage
(
d
);
if
(
libraryEntities
.
size
()
>
0
)
{
// Map<String, List<DeviceLibrary>> map = libraryEntities.stream().collect(groupingBy(deviceLibrary -> deviceLibrary.getModel()+"Ǵ"+deviceLibrary.getName()));
Map
<
String
,
List
<
DeviceLibrary
>>
map
=
libraryEntities
.
stream
().
collect
(
groupingBy
(
deviceLibrary
->
deviceLibrary
.
getModel
()+
"Ǵ"
+
deviceLibrary
.
getName
()+
"Ǵ"
+
deviceLibrary
.
getType
()+
"Ǵ"
+
deviceLibrary
.
getMatchingRangeName
()));
Map
<
String
,
List
<
DeviceLibrary
>>
map
=
libraryEntities
.
stream
().
collect
(
groupingBy
(
deviceLibrary
->
deviceLibrary
.
getModel
()+
"Ǵ"
+
deviceLibrary
.
getName
()+
"Ǵ"
+
deviceLibrary
.
getType
()+
"Ǵ"
+
deviceLibrary
.
getMatchingRangeName
()
+
"Ǵ"
+
deviceLibrary
.
getIsPart
()
));
//按型号遍历统计各种状态的装备数量
for
(
String
s
:
map
.
keySet
())
{
String
[]
strings
=
s
.
split
(
"Ǵ"
);
if
(
strings
.
length
==
4
)
{
if
(
strings
.
length
==
5
)
{
DeviceStatisticsVo
deviceStatisticsVo
=
new
DeviceStatisticsVo
();
List
<
Integer
>
deviceIds
=
new
ArrayList
<>();
List
<
String
>
devSeqs
=
new
ArrayList
<>();
...
...
@@ -222,6 +226,7 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
deviceStatisticsVo
.
setName
(
strings
[
1
]);
deviceStatisticsVo
.
setType
(
Integer
.
valueOf
(
strings
[
2
]));
deviceStatisticsVo
.
setMatchingRangeName
(
strings
[
3
]);
deviceStatisticsVo
.
setIsPart
(
Integer
.
valueOf
(
strings
[
4
]));
// deviceStatisticsVo.setDeviceNumber(map.get(s).size());
// deviceStatisticsVo.setDeviceIds(map.get(s).stream().map(DeviceLibrary::getId).collect(Collectors.toList()));
int
num
=
0
;
...
...
@@ -608,6 +613,15 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
return
deviceLibraryDao
.
findBySeqNumber
(
seqNumber
);
}
@Override
@Cacheable
()
public
List
<
DeviceLibrary
>
getAllDeviceList
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
)
{
long
l
=
System
.
currentTimeMillis
();
List
<
DeviceLibrary
>
all
=
deviceLibraryDao
.
findAll
();
System
.
out
.
println
(
"查询时间为"
+(
System
.
currentTimeMillis
()-
l
));
return
all
;
}
@Override
public
void
isNotLoss
(
List
<
Integer
>
ids
)
{
ids
.
forEach
(
integer
->
{
...
...
@@ -620,7 +634,9 @@ public class DeviceLibraryServiceImpl implements DeviceLibraryService {
@Override
public
List
<
DeviceLibrary
>
getAllList
(
DeviceLibrarySelectVo
deviceLibrarySelectVo
)
{
// List<DeviceLibrary> allDeviceLibraryList = cacheLibraryService.getAllDeviceLibraryList();
return
deviceLibraryDao
.
findAll
(
getSelectSpecification4
(
deviceLibrarySelectVo
),
deviceLibrarySelectVo
.
getPageable
().
getSort
());
// return allDeviceLibraryList;
}
@Override
...
...
dev-library/src/main/java/com/tykj/dev/device/library/subject/domin/DeviceLibrary.java
浏览文件 @
3955411a
...
...
@@ -269,6 +269,10 @@ public class DeviceLibrary {
@Transient
private
int
isOne
;
@ApiModelProperty
(
value
=
"序号"
)
@Transient
private
Integer
orderNumber
;
public
void
addChildNode
(
DeviceLibrary
deviceLibraryEntity
)
{
childs
.
add
(
deviceLibraryEntity
);
}
...
...
dev-library/src/main/java/com/tykj/dev/device/library/subject/vo/DeviceNewVo.java
浏览文件 @
3955411a
...
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
* DATE:2021-8-10
...
...
@@ -34,4 +35,7 @@ public class DeviceNewVo {
@ApiModelProperty
(
value
=
"所属单位"
,
example
=
"省机要局"
)
private
String
ownUnit
;
@ApiModelProperty
(
value
=
"装备id"
)
private
List
<
Integer
>
devicesId
;
}
dev-library/src/main/java/com/tykj/dev/device/library/subject/vo/DeviceStatisticsVo.java
浏览文件 @
3955411a
...
...
@@ -85,5 +85,8 @@ public class DeviceStatisticsVo {
@ApiModelProperty
(
value
=
"装备配用范围"
)
public
String
matchingRangeName
;
@ApiModelProperty
(
value
=
"是不是配件(0:不是,1:是)"
)
private
Integer
isPart
;
}
dev-packing/src/main/java/com/tykj/dev/device/packing/controller/PackingController.java
浏览文件 @
3955411a
...
...
@@ -118,7 +118,7 @@ public class PackingController {
PackingLibrary
packingLibrary
=
new
PackingLibrary
();
BeanUtils
.
copyProperties
(
addModel
,
packingLibrary
);
packingLibrary
.
setIsRoot
(
1
);
packingLibrary
.
setName
(
addModel
.
getModel
()
);
packingLibrary
.
setName
(
""
);
packingLibrary
.
setPackingStatus
(
2
);
packingLibrary
.
setShowOrder
(
99999
);
PackingLibrary
packingLibrary1
=
packingLibraryService
.
addEntity
(
packingLibrary
);
...
...
dev-repair/src/main/java/com/tykj/dev/device/repair/controller/RepairController.java
浏览文件 @
3955411a
...
...
@@ -407,8 +407,12 @@ public class RepairController {
deviceRepairSendBillEntity
.
setRepairDeviceDetail
(
stringBuffer
.
toString
());
deviceRepairSendBillEntity
.
setDeviceRepairBillId
(
repairBill1
.
getId
());
deviceRepairSendBillEntity
.
setAgent
(
repairBillSaveVo
.
getAgent
());
if
(
repairBillSaveVo
.
getReceiveUnit
().
contains
(
"中办"
)){
deviceRepairSendBillEntity
.
setTitle
(
"["
+
repairBillSaveVo
.
getReceiveUnit
()
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
().
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
);
}
else
{
deviceRepairSendBillEntity
.
setTitle
(
"["
+
repairBillSaveVo
.
getReceiveUnit
().
substring
(
0
,
3
)
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
().
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
);
deviceRepairSendBillEntity
.
setTitle
(
"["
+
repairBillSaveVo
.
getReceiveUnit
().
substring
(
0
,
3
)
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
().
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
);
}
if
(
repairBillSaveVo
.
getSendFileList
()
!=
null
&&
repairBillSaveVo
.
getSendFileList
().
size
()
>
0
)
{
deviceRepairSendBillEntity
.
setSendFiles
(
FilesUtil
.
stringFileToList
(
repairBillSaveVo
.
getSendFileList
()));
}
...
...
@@ -424,13 +428,24 @@ public class RepairController {
ownUnit
=
userUtils
.
getCurrentUnitId
();
//直接发起的
if
(
repairBillSaveVo
.
getTaskId
()
==
null
)
{
TaskBto
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_FILE
.
id
,
"["
+
repairBillSaveVo
.
getReceiveUnit
().
substring
(
0
,
3
)
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
().
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
,
null
,
"."
,
repairBill1
.
getId
(),
5
,
ownUnit
,
1
,
"country"
,
userIds
);
TaskBto
taskBto
;
if
(
repairBillSaveVo
.
getReceiveUnit
().
contains
(
"中办"
)){
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_FILE
.
id
,
"["
+
repairBillSaveVo
.
getReceiveUnit
()
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
().
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
,
null
,
"."
,
repairBill1
.
getId
(),
5
,
ownUnit
,
1
,
"country"
,
userIds
);
}
else
{
taskBto
=
new
TaskBto
(
StatusEnum
.
WAIT_UPLOAD_FILE
.
id
,
"["
+
repairBillSaveVo
.
getReceiveUnit
().
substring
(
0
,
3
)
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
().
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
,
null
,
"."
,
repairBill1
.
getId
(),
5
,
ownUnit
,
1
,
"country"
,
userIds
);
}
saveEntity
=
taskService
.
start
(
taskBto
);
}
//从草稿发起的
else
{
TaskBto
taskBto1
=
taskService
.
get
(
repairBillSaveVo
.
getTaskId
());
taskBto1
.
setTitle
(
"["
+
repairBillSaveVo
.
getReceiveUnit
().
substring
(
0
,
3
)
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
().
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
);
if
(
repairBillSaveVo
.
getReceiveUnit
().
contains
(
"中办"
)){
taskBto1
.
setTitle
(
"["
+
repairBillSaveVo
.
getReceiveUnit
()
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
().
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
);
}
else
{
taskBto1
.
setTitle
(
"["
+
repairBillSaveVo
.
getReceiveUnit
().
substring
(
0
,
3
)
+
"]型号"
+
StringSplitUtil
.
stringListToString
(
repairBillSaveVo
.
getScriptSaveVos
().
stream
().
map
(
ScriptSaveVo:
:
getModel
).
distinct
().
collect
(
Collectors
.
toList
()))
+
"共有"
+
repairBillSaveVo
.
getSendingCount
()
+
"件"
);
}
taskBto1
.
setCustomInfo
(
"country"
);
saveEntity
=
taskService
.
moveToSpecial
(
taskBto1
,
StatusEnum
.
WAIT_UPLOAD_FILE
);
}
...
...
@@ -1189,7 +1204,7 @@ public class RepairController {
messageService
.
add
(
messageBto
);
}
String
message
=
repairReceiveVo
.
getStatus
()
==
0
?
"业务办结"
:
"接收维修领取装备"
;
MessageBto
messageBto
=
new
MessageBto
(
taskBto2
.
getId
(),
taskBto2
.
getBusinessType
(),
message
,
ids
,
1
);
MessageBto
messageBto
=
new
MessageBto
(
taskBto2
.
getId
(),
taskBto2
.
getBusinessType
(),
message
,
ids
,
1
,
0
);
messageService
.
add
(
messageBto
);
//遍历map依次发送阅知
messageMap
.
keySet
().
forEach
(
integer
->
{
...
...
dev-storage/src/main/java/com/tykj/dev/device/storage/controller/StorageBillController.java
浏览文件 @
3955411a
...
...
@@ -9,6 +9,7 @@ import com.tykj.dev.device.apply.subject.vo.ApplyBillDetailVo;
import
com.tykj.dev.device.file.entity.FileRet
;
import
com.tykj.dev.device.file.service.FilesUtil
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.service.CacheLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.service.DeviceLogService
;
import
com.tykj.dev.device.library.subject.Dto.DeviceLogDto
;
...
...
@@ -44,12 +45,15 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.*
;
import
java.util.concurrent.Executor
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -112,6 +116,13 @@ public class StorageBillController {
@Autowired
private
RfidService
rfidService
;
@Autowired
@Qualifier
(
"taskExecutor"
)
private
Executor
executor
;
@Autowired
private
CacheLibraryService
cacheLibraryService
;
@ApiOperation
(
value
=
"判断序列号是否存在申请任务中"
,
notes
=
"判断序列号是否存在申请任务中"
)
@PostMapping
(
value
=
"/existApplyTask"
)
public
ResponseEntity
existApplyTask
(
@RequestBody
List
<
String
>
seqs
){
...
...
@@ -364,6 +375,7 @@ public class StorageBillController {
@ApiOperation
(
value
=
"添加入库单"
,
notes
=
"可以通过这个接口发起入库业务"
)
@PostMapping
(
value
=
"/addStorageBill"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@CacheEvict
(
value
=
"devicesLibraryList"
,
key
=
"'device'"
,
allEntries
=
true
)
public
ResponseEntity
addStorageBill
(
@RequestBody
@Validated
StorageBillSaveVo
storageBillSaveVo
)
{
//是否申请业务导入
List
<
DeviceApplyBill
>
deviceApplyBills
=
new
ArrayList
<>();
...
...
@@ -598,6 +610,12 @@ public class StorageBillController {
}
}
}
//异步去查询数据库
executor
.
execute
(
()->{
cacheLibraryService
.
getAllDeviceLibraryList
();
}
);
myWebSocket
.
sendMessage1
();
return
ResultUtil
.
success
(
taskEntity1
);
}
...
...
dev-union/src/main/java/com/tykj/dev/union/UnionApplication.java
浏览文件 @
3955411a
...
...
@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.web.servlet.ServletComponentScan
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
...
...
@@ -20,6 +21,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableJpaAuditing
@EnableTransactionManagement
@EnableScheduling
@EnableCaching
public
class
UnionApplication
extends
SpringBootServletInitializer
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
UnionApplication
.
class
,
args
);
...
...
dev-user/src/main/java/com/tykj/dev/device/user/read/subject/bto/MessageBto.java
浏览文件 @
3955411a
...
...
@@ -73,6 +73,9 @@ public class MessageBto {
@ApiModelProperty
(
value
=
"是否高亮(0:不是,1:是)"
)
private
Integer
isHighLight
=
0
;
@ApiModelProperty
(
value
=
"是否置顶(0:不是,1:是)"
)
private
Integer
isTop
=
0
;
/**
* bto类转化为do类
*/
...
...
@@ -99,6 +102,7 @@ public class MessageBto {
//set vo字段
if
(
userUtils
!=
null
&&
userReadDetailList
.
contains
(
userUtils
.
getCurrentUserId
())){
messageUserVo
.
setIsRead
(
1
);
messageUserVo
.
setIsTop
(
1
);
}
if
(
messageUserVo
.
getCreateUserId
()!=
null
){
messageUserVo
.
setOperator
(
userPublicService
.
getOne
(
messageUserVo
.
getCreateUserId
()).
getName
());
...
...
@@ -122,6 +126,15 @@ public class MessageBto {
this
.
record
=
record
;
}
public
MessageBto
(
Integer
taskId
,
Integer
businessType
,
String
content
,
List
<
Integer
>
involveUserIdList
,
Integer
isHighLight
,
Integer
isTop
)
{
this
.
taskId
=
taskId
;
this
.
businessType
=
businessType
;
this
.
content
=
content
;
this
.
involveUserIdList
=
involveUserIdList
;
this
.
isHighLight
=
isHighLight
;
this
.
isTop
=
isTop
;
}
public
MessageBto
(
Integer
taskId
,
Integer
businessType
,
String
content
,
List
<
Integer
>
involveUserIdList
,
Integer
isHighLight
)
{
this
.
taskId
=
taskId
;
this
.
businessType
=
businessType
;
...
...
@@ -131,4 +144,6 @@ public class MessageBto {
}
}
dev-user/src/main/java/com/tykj/dev/device/user/read/subject/domin/Message.java
浏览文件 @
3955411a
...
...
@@ -86,6 +86,9 @@ public class Message {
@ApiModelProperty
(
value
=
"是否高亮(0:不是,1:是)"
)
private
Integer
isHighLight
=
0
;
@ApiModelProperty
(
value
=
"是否置顶(0:不是,1:是)"
)
private
Integer
isTop
=
0
;
/**
* do类转化为bto类
*/
...
...
dev-user/src/main/java/com/tykj/dev/device/user/read/subject/vo/MessageUserVo.java
浏览文件 @
3955411a
...
...
@@ -62,4 +62,7 @@ public class MessageUserVo {
@ApiModelProperty
(
value
=
"操作人单位"
)
private
String
unit
;
@ApiModelProperty
(
value
=
"是否置顶(0:不是,1:是)"
)
private
Integer
isTop
=
0
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论