Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
fda21153
提交
fda21153
authored
9月 22, 2020
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[核查模块] 修复了初始化自动核查的统计数据异常
上级
fc021738
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
150 行增加
和
0 行删除
+150
-0
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+0
-0
AreaCache.java
.../tykj/dev/device/confirmcheck/entity/cache/AreaCache.java
+39
-0
CacheBeanConfig.java
...dev/device/confirmcheck/entity/cache/CacheBeanConfig.java
+24
-0
CheckAreaStatVo.java
...kj/dev/device/confirmcheck/entity/vo/CheckAreaStatVo.java
+5
-0
CheckDeviceStatVo.java
.../dev/device/confirmcheck/entity/vo/CheckDeviceStatVo.java
+5
-0
MapperUtils.java
...sc/src/main/java/com/tykj/dev/misc/utils/MapperUtils.java
+77
-0
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
fda21153
差异被折叠。
点击展开。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/cache/AreaCache.java
0 → 100644
浏览文件 @
fda21153
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
cache
;
import
com.tykj.dev.device.user.subject.entity.Area
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* AreaCache.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2020/9/22 at 5:33 下午
*/
public
class
AreaCache
{
private
Map
<
String
,
Area
>
nameMap
;
private
Map
<
Integer
,
Area
>
idMap
;
public
AreaCache
(
List
<
Area
>
areaList
)
{
nameMap
=
areaList
.
stream
().
collect
(
Collectors
.
toMap
(
Area:
:
getName
,
Function
.
identity
()));
idMap
=
areaList
.
stream
().
collect
(
Collectors
.
toMap
(
Area:
:
getId
,
Function
.
identity
()));
}
public
Area
findFatherByName
(
String
name
)
{
Area
area
=
nameMap
.
get
(
name
);
return
idMap
.
get
(
area
.
getFatherId
());
}
public
Area
findByName
(
String
name
)
{
return
nameMap
.
get
(
name
);
}
public
Area
findById
(
Integer
id
)
{
return
idMap
.
get
(
id
);
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/cache/CacheBeanConfig.java
0 → 100644
浏览文件 @
fda21153
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
cache
;
import
com.tykj.dev.device.user.subject.dao.AreaDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* CacheBeanConfig.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2020/9/22 at 6:24 下午
*/
@Configuration
public
class
CacheBeanConfig
{
@Autowired
private
AreaDao
areaRepo
;
@Bean
public
AreaCache
initAreaCache
()
{
return
new
AreaCache
(
areaRepo
.
findAll
());
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/CheckAreaStatVo.java
浏览文件 @
fda21153
...
...
@@ -49,4 +49,9 @@ public class CheckAreaStatVo {
* 该地区对应的详情账单id
*/
private
int
areaDetailId
;
public
CheckAreaStatVo
addSuppose
(
int
supposeCount
)
{
this
.
supposeCount
+=
supposeCount
;
return
this
;
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/CheckDeviceStatVo.java
浏览文件 @
fda21153
...
...
@@ -76,4 +76,9 @@ public class CheckDeviceStatVo {
return
this
;
}
public
CheckDeviceStatVo
addDeviceCount
(
int
count
){
this
.
deviceCount
+=
count
;
return
this
;
}
}
dev-misc/src/main/java/com/tykj/dev/misc/utils/MapperUtils.java
0 → 100644
浏览文件 @
fda21153
package
com
.
tykj
.
dev
.
misc
.
utils
;
import
org.modelmapper.ModelMapper
;
import
org.modelmapper.convention.MatchingStrategies
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* ObjectMapperUtils.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2020/9/22 at 7:05 下午
*/
public
class
MapperUtils
{
private
static
ModelMapper
modelMapper
=
new
ModelMapper
();
/**
* Model mapper property setting are specified in the following block.
* Default property matching strategy is set to Strict see {@link MatchingStrategies}
* Custom mappings are added using {@link ModelMapper#addMappings(PropertyMap)}
*/
static
{
modelMapper
=
new
ModelMapper
();
modelMapper
.
getConfiguration
().
setAmbiguityIgnored
(
true
);
//设置为严格匹配
modelMapper
.
getConfiguration
().
setFullTypeMatchingRequired
(
true
);
modelMapper
.
getConfiguration
().
setMatchingStrategy
(
MatchingStrategies
.
STRICT
);
}
/**
* Hide from public usage.
*/
private
MapperUtils
()
{
}
/**
* <p>Note: outClass object must have default constructor with no arguments</p>
*
* @param <D> type of result object.
* @param <T> type of source object to map from.
* @param entity entity that needs to be mapped.
* @param outClass class of result object.
* @return new object of <code>outClass</code> type.
*/
public
static
<
D
,
T
>
D
map
(
final
T
entity
,
Class
<
D
>
outClass
)
{
return
modelMapper
.
map
(
entity
,
outClass
);
}
/**
* <p>Note: outClass object must have default constructor with no arguments</p>
*
* @param entityList list of entities that needs to be mapped
* @param outCLass class of result list element
* @param <D> type of objects in result list
* @param <T> type of entity in <code>entityList</code>
* @return list of mapped object with <code><D></code> type.
*/
public
static
<
D
,
T
>
List
<
D
>
mapAll
(
final
Collection
<
T
>
entityList
,
Class
<
D
>
outCLass
)
{
return
entityList
.
stream
()
.
map
(
entity
->
map
(
entity
,
outCLass
))
.
collect
(
Collectors
.
toList
());
}
/**
* Maps {@code source} to {@code destination}.
*
* @param source object to map from
* @param destination object to map to
*/
public
static
<
S
,
D
>
D
map
(
final
S
source
,
D
destination
)
{
modelMapper
.
map
(
source
,
destination
);
return
destination
;
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论