Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
ea9ff455
提交
ea9ff455
authored
1月 18, 2021
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[核查模块] 修复了核查速度过慢的问题
上级
ba71042a
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
51 行增加
和
6 行删除
+51
-6
UnitAreaBean.java
...com/tykj/dev/device/confirmcheck/common/UnitAreaBean.java
+40
-0
ObjTransUtil.java
.../com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
+8
-6
AreaUnit.java
...com/tykj/dev/device/user/subject/entity/bto/AreaUnit.java
+3
-0
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/common/UnitAreaBean.java
0 → 100644
浏览文件 @
ea9ff455
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
common
;
import
com.tykj.dev.device.user.subject.dao.AreaDao
;
import
com.tykj.dev.device.user.subject.dao.UnitsDao
;
import
com.tykj.dev.device.user.subject.entity.Area
;
import
com.tykj.dev.device.user.subject.entity.bto.AreaUnit
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* UnitAreaBean.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/1/18 at 4:45 下午
*/
@Configuration
public
class
UnitAreaBean
{
@Autowired
private
AreaDao
areaDao
;
@Autowired
private
UnitsDao
unitsDao
;
@Bean
(
name
=
"unMap"
)
public
Map
<
String
,
AreaUnit
>
unitNameMap
(){
return
unitsDao
.
findAll
().
stream
()
.
map
(
unit
->
{
int
areaId
=
unitsDao
.
findAreaIdByName
(
unit
.
getName
());
Area
area
=
areaDao
.
findById
(
areaId
).
get
();
return
new
AreaUnit
(
area
,
unit
);
}).
collect
(
Collectors
.
toMap
(
AreaUnit:
:
getUnitName
,
Function
.
identity
()));
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
浏览文件 @
ea9ff455
...
@@ -17,6 +17,7 @@ import com.tykj.dev.device.user.subject.dao.AreaDao;
...
@@ -17,6 +17,7 @@ import com.tykj.dev.device.user.subject.dao.AreaDao;
import
com.tykj.dev.device.user.subject.dao.UnitsDao
;
import
com.tykj.dev.device.user.subject.dao.UnitsDao
;
import
com.tykj.dev.device.user.subject.dao.UserDao
;
import
com.tykj.dev.device.user.subject.dao.UserDao
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.device.user.subject.entity.bto.AreaUnit
;
import
com.tykj.dev.device.user.subject.service.AuService
;
import
com.tykj.dev.device.user.subject.service.AuService
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.base.BusinessEnum
;
...
@@ -29,11 +30,9 @@ import org.springframework.stereotype.Component;
...
@@ -29,11 +30,9 @@ import org.springframework.stereotype.Component;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.StringJoiner
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -67,6 +66,9 @@ public class ObjTransUtil {
...
@@ -67,6 +66,9 @@ public class ObjTransUtil {
@Autowired
@Autowired
private
TaskDao
taskDao
;
private
TaskDao
taskDao
;
@Resource
(
name
=
"unMap"
)
private
Map
<
String
,
AreaUnit
>
unMap
;
/**
/**
* 装备转化为初始化的装备统计类
* 装备转化为初始化的装备统计类
...
@@ -76,8 +78,8 @@ public class ObjTransUtil {
...
@@ -76,8 +78,8 @@ public class ObjTransUtil {
*/
*/
public
CheckDeviceStatVo
device2InitStatVo
(
DeviceLibrary
device
)
{
public
CheckDeviceStatVo
device2InitStatVo
(
DeviceLibrary
device
)
{
String
ownUnit
=
device
.
getOwnUnit
();
String
ownUnit
=
device
.
getOwnUnit
();
int
areaId
=
unitRepo
.
findAreaIdByName
(
ownUnit
);
// 这里选择从初始化集合中获取
String
areaName
=
areaRepo
.
findNameById
(
areaId
);
String
areaName
=
unMap
.
get
(
ownUnit
).
getName
(
);
List
<
CheckAreaStatVo
>
areaStatList
=
Lists
.
newArrayList
(
new
CheckAreaStatVo
(
areaName
,
0
,
1
,
0
,
0
,
0
,
0
));
List
<
CheckAreaStatVo
>
areaStatList
=
Lists
.
newArrayList
(
new
CheckAreaStatVo
(
areaName
,
0
,
1
,
0
,
0
,
0
,
0
));
return
new
CheckDeviceStatVo
(
device
.
getModel
(),
device
.
getName
(),
1
,
areaStatList
);
return
new
CheckDeviceStatVo
(
device
.
getModel
(),
device
.
getName
(),
1
,
areaStatList
);
}
}
...
...
dev-user/src/main/java/com/tykj/dev/device/user/subject/entity/bto/AreaUnit.java
浏览文件 @
ea9ff455
...
@@ -29,6 +29,8 @@ public class AreaUnit {
...
@@ -29,6 +29,8 @@ public class AreaUnit {
private
Integer
fatherId
;
private
Integer
fatherId
;
private
String
unitName
;
/**
/**
* 默认等于{@link #unitList}里的第一个元素
* 默认等于{@link #unitList}里的第一个元素
*/
*/
...
@@ -45,6 +47,7 @@ public class AreaUnit {
...
@@ -45,6 +47,7 @@ public class AreaUnit {
this
.
type
=
area
.
getType
();
this
.
type
=
area
.
getType
();
this
.
orders
=
area
.
getOrders
();
this
.
orders
=
area
.
getOrders
();
this
.
fatherId
=
area
.
getFatherId
();
this
.
fatherId
=
area
.
getFatherId
();
this
.
unitName
=
units
.
getName
();
this
.
unit
=
new
Unit
(
units
.
getUnitId
(),
units
.
getName
(),
units
.
getUnitDesc
(),
units
.
getCode
());
this
.
unit
=
new
Unit
(
units
.
getUnitId
(),
units
.
getName
(),
units
.
getUnitDesc
(),
units
.
getCode
());
this
.
unitList
=
Lists
.
newArrayList
(
this
.
unit
);
this
.
unitList
=
Lists
.
newArrayList
(
this
.
unit
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论