Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
0a91f018
提交
0a91f018
authored
8月 15, 2021
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[核查模块] 优化了detail的测试
上级
46692d0d
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
47 行增加
和
2 行删除
+47
-2
ObjTransUtil.java
.../com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
+19
-2
DeviceLibraryCacheService.java
...dev/device/library/service/DeviceLibraryCacheService.java
+10
-0
MyInitializer.java
...va/com/tykj/dev/device/library/service/MyInitializer.java
+4
-0
CacheLibraryServiceImpl.java
.../device/library/service/impl/CacheLibraryServiceImpl.java
+14
-0
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
浏览文件 @
0a91f018
...
...
@@ -10,6 +10,7 @@ import com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat;
import
com.tykj.dev.device.confirmcheck.entity.vo.*
;
import
com.tykj.dev.device.file.service.FilesUtil
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.service.DeviceLibraryCacheService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.packing.service.PackingLibraryService
;
import
com.tykj.dev.device.task.repository.TaskDao
;
...
...
@@ -27,6 +28,7 @@ import com.tykj.dev.misc.base.BeanHelper;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.modelmapper.ModelMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
...
...
@@ -48,6 +50,7 @@ import static java.util.stream.Collectors.toList;
* @since 2020/8/17 at 8:45 下午
*/
@SuppressWarnings
(
"ALL"
)
@Slf4j
@Component
public
class
ObjTransUtil
{
...
...
@@ -72,6 +75,9 @@ public class ObjTransUtil {
@Autowired
private
TaskDao
taskDao
;
@Autowired
private
DeviceLibraryCacheService
dlcService
;
@Resource
(
name
=
"unMap"
)
private
Map
<
String
,
AreaUnit
>
unMap
;
...
...
@@ -320,6 +326,9 @@ public class ObjTransUtil {
List
<
DeviceNotInLibVo
>
notInLibVoList
=
new
ArrayList
<>();
String
checkDetail
=
detailDo
.
getCheckDetail
();
List
<
String
>
devCheckList
=
Lists
.
newArrayList
(
checkDetail
.
split
(
","
));
long
start
=
System
.
currentTimeMillis
();
Map
<
Integer
,
DeviceLibrary
>
map
=
dlcService
.
getDevicesMap
();
for
(
String
detail
:
devCheckList
)
{
if
(
StringUtils
.
isEmpty
(
detail
))
{
continue
;
...
...
@@ -328,8 +337,12 @@ public class ObjTransUtil {
Integer
deviceId
=
Integer
.
valueOf
(
array
[
0
]);
int
proofResult
=
Integer
.
parseInt
(
array
[
1
]);
// 搜索装备
DeviceLibrary
device
=
deviceRepo
.
findById
(
deviceId
).
orElseThrow
(
()
->
new
ApiException
(
ResponseEntity
.
badRequest
().
body
(
String
.
format
(
"检查到装备序号为%d的装备不在资料库中,请先执行入库操作!"
,
deviceId
)))).
setConfigName
();
DeviceLibrary
device
=
Optional
.
ofNullable
(
map
.
get
(
deviceId
))
.
orElseThrow
(()
->
new
ApiException
(
ResponseEntity
.
badRequest
().
body
(
String
.
format
(
"检查到装备序号为%d的装备不在资料库中,请先执行入库操作!"
,
deviceId
)))).
setConfigName
();
// DeviceLibrary device = deviceRepo.findById(deviceId).orElseThrow(
// () -> new ApiException(ResponseEntity.badRequest().body(String.format("检查到装备序号为%d的装备不在资料库中,请先执行入库操作!", deviceId)))).setConfigName();
//依据proofResult的个位数 判断是否是在库装备
int
digit
=
proofResult
%
10
;
if
(
digit
==
3
)
{
...
...
@@ -341,6 +354,10 @@ public class ObjTransUtil {
inLibVoList
.
add
(
toCheckInLibVo
(
device
,
proofResult
));
}
}
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"[性能测试] 装备搜索耗时 {} ms"
,
end
-
start
);
// detailDo -> detailVo
ModelMapper
modelMapper
=
BeanHelper
.
getUserMapper
();
CheckDetailVo
detailVo
=
modelMapper
.
map
(
detailDo
,
CheckDetailVo
.
class
);
...
...
dev-library/src/main/java/com/tykj/dev/device/library/service/DeviceLibraryCacheService.java
浏览文件 @
0a91f018
package
com
.
tykj
.
dev
.
device
.
library
.
service
;
import
com.oracle.tools.packager.mac.MacAppBundler
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
java.util.List
;
import
java.util.Map
;
/**
* DATE:2021-8-11
...
...
@@ -13,6 +15,14 @@ public interface DeviceLibraryCacheService {
/**
* 查询全部
* @return List形式的DeviceLibrary
*/
List
<
DeviceLibrary
>
getAllDeviceLibraryList
();
/**
*
* 以Map的形式获得所有装备列表
* @return key = 装备主键id , Value = {@link DeviceLibrary}
*/
Map
<
Integer
,
DeviceLibrary
>
getDevicesMap
();
}
dev-library/src/main/java/com/tykj/dev/device/library/service/MyInitializer.java
浏览文件 @
0a91f018
package
com
.
tykj
.
dev
.
device
.
library
.
service
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.context.event.ApplicationReadyEvent
;
import
org.springframework.context.ApplicationListener
;
...
...
@@ -10,11 +11,14 @@ import org.springframework.stereotype.Component;
* Author:zsp
*/
@Component
@Slf4j
public
class
MyInitializer
implements
ApplicationListener
<
ApplicationReadyEvent
>
{
@Autowired
private
DeviceLibraryCacheService
cacheLibraryService
;
@Override
public
void
onApplicationEvent
(
ApplicationReadyEvent
event
)
{
log
.
info
(
"[缓存模块] 加载装备缓存模块..."
);
cacheLibraryService
.
getAllDeviceLibraryList
();
cacheLibraryService
.
getDevicesMap
();
}
}
dev-library/src/main/java/com/tykj/dev/device/library/service/impl/CacheLibraryServiceImpl.java
浏览文件 @
0a91f018
...
...
@@ -9,6 +9,9 @@ import org.springframework.cache.annotation.Cacheable;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* DATE:2021-8-11
...
...
@@ -33,4 +36,15 @@ public class CacheLibraryServiceImpl implements DeviceLibraryCacheService {
return
all
;
}
/**
* 以Map的形式获得所有装备列表
*
* @return key = 装备主键id , Value = {@link DeviceLibrary}
*/
@Override
public
Map
<
Integer
,
DeviceLibrary
>
getDevicesMap
()
{
return
deviceLibraryDao
.
findAll
().
stream
()
.
collect
(
Collectors
.
toMap
(
DeviceLibrary:
:
getId
,
Function
.
identity
()));
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论