Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
8c61dd24
提交
8c61dd24
authored
9月 24, 2020
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[核查模块] 修复了统计数据的撞他异常的问题
上级
029df4f2
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
88 行增加
和
65 行删除
+88
-65
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+28
-43
DeviceCheckDetailEntity.java
...e/confirmcheck/entity/domain/DeviceCheckDetailEntity.java
+2
-2
DeviceCheckStat.java
...ev/device/confirmcheck/entity/domain/DeviceCheckStat.java
+2
-2
CheckAreaStatVo.java
...kj/dev/device/confirmcheck/entity/vo/CheckAreaStatVo.java
+12
-0
CheckDeviceStatVo.java
.../dev/device/confirmcheck/entity/vo/CheckDeviceStatVo.java
+19
-18
CheckStatVo.java
...m/tykj/dev/device/confirmcheck/entity/vo/CheckStatVo.java
+25
-0
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
8c61dd24
...
...
@@ -39,7 +39,6 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -89,7 +88,7 @@ public class DeviceCheckController {
@GetMapping
(
"/area/{fatherId}"
)
@ApiOperation
(
value
=
"查询指定区域下的所有区域信息"
)
public
ResponseEntity
findAreaUnderId
(
@PathVariable
Integer
fatherId
,
HttpServletRequest
request
)
{
public
ResponseEntity
findAreaUnderId
(
@PathVariable
Integer
fatherId
)
{
return
ResponseEntity
.
ok
(
new
ResultObj
(
areaRepo
.
findByFatherId
(
fatherId
)));
}
...
...
@@ -228,26 +227,28 @@ public class DeviceCheckController {
}
// 处理JSON INFO 数据
// 对于省统计来说,需要
去掉所有的区地区的数据
// 对于省统计来说,需要
把区的数据累加到市级中去
List
<
CheckDeviceStatVo
>
statVoListCopy1
=
MapperUtils
.
mapAll
(
statVoList
,
CheckDeviceStatVo
.
class
);
List
<
CheckDeviceStatVo
>
statVoListCopy2
=
MapperUtils
.
mapAll
(
statVoList
,
CheckDeviceStatVo
.
class
);
//
分组 分出区数据 与 非市数据 ,
市数据进行分组 - 按照model名分组 model - areaName - Object
//
按照区数据与
市数据进行分组 - 按照model名分组 model - areaName - Object
Map
<
Boolean
,
List
<
CheckDeviceStatVo
>>
regionMap
=
statVoListCopy1
.
stream
()
.
collect
(
partitioningBy
(
stat
->
countyAreaNames
.
contains
(
stat
.
getAreaStatList
().
get
(
0
).
getAreaName
())));
// 区数据
List
<
CheckDeviceStatVo
>
countyVo
=
regionMap
.
get
(
true
);
Map
<
String
,
Map
<
String
,
List
<
CheckDeviceStatVo
>>>
modAreaMap
=
regionMap
.
get
(
false
).
stream
()
.
collect
(
groupingBy
(
CheckDeviceStatVo:
:
getDeviceModel
,
groupingBy
(
c
->
c
.
getAreaStatList
().
get
(
0
).
getAreaName
())));
//查找区域数据内的父级地区(即市),将数据count数据add进去(通过两次get)
//查找区域数据内的父级地区(即市),将数据count数据add进去(通过两次get)
,将areaList数据也加进去
for
(
CheckDeviceStatVo
v
:
countyVo
)
{
String
couName
=
v
.
getAreaStatList
().
get
(
0
).
getAreaName
();
String
fatherName
=
areaCache
.
findFatherByName
(
couName
).
getName
();
String
father
Area
Name
=
areaCache
.
findFatherByName
(
couName
).
getName
();
modAreaMap
.
computeIfPresent
(
v
.
getDeviceModel
(),
(
k1
,
v1
)
->
{
v1
.
computeIfPresent
(
fatherName
,
(
k2
,
v2
)
->
{
v1
.
computeIfPresent
(
father
Area
Name
,
(
k2
,
v2
)
->
{
log
.
warn
(
"发现需要堆叠计算的装备,装备信息为: {}"
,
v2
);
v2
.
get
(
0
).
addDeviceCount
(
1
);
v2
.
get
(
0
).
getAreaStatList
().
get
(
0
).
addSuppose
(
1
);
v2
.
get
(
0
).
getAreaStatList
().
addAll
(
v
.
getAreaStatList
());
return
v2
;
});
return
v1
;
...
...
@@ -414,13 +415,12 @@ public class DeviceCheckController {
Integer
userBId
=
detailDo
.
getCheckUserBId
();
// 如果是4流程的,则需要指定核查组成员A接任务
detailRepo
.
updateCheckStatus
(
id
,
checkStatus
);
if
(
userAId
>
0
&&
userBId
>
0
)
{
detailRepo
.
updateCheckStatus
(
id
,
checkStatus
);
currentTask
=
taskService
.
moveToNext
(
currentTask
,
checkUserAId
);
logService
.
addLog
(
new
TaskLogBto
(
currentTask
.
getId
(),
"B岗审核成功,等待核查组确认"
));
}
else
{
// 如果是2流程的,则直接结束该任务
detailRepo
.
updateCheckStatus
(
id
,
checkStatus
);
taskService
.
moveToEnd
(
currentTask
);
logService
.
addLog
(
new
TaskLogBto
(
currentTask
.
getId
(),
"B岗审核成功"
));
}
...
...
@@ -471,12 +471,14 @@ public class DeviceCheckController {
// 获得当前城市的统计信息 以及 要汇总的地区信息 并累加保存
List
<
CheckDeviceStatVo
>
addVos
=
parseStatString2Vo
(
currentTask
,
level
,
currentDetail
.
getCheckDetail
());
CheckStatVo
resultVo
=
transUtil
.
checkStatDo2Vo
(
statRepo
.
findById
(
statId
).
get
());
resultVo
.
setDeviceStatVoList
(
accumulateStat
(
addVos
,
resultVo
.
getDeviceStatVoList
())
);
resultVo
=
resultVo
.
addStatList
(
addVos
);
statRepo
.
save
(
resultVo
.
toDo
());
// 判断地区数据是否均汇总完毕
boolean
over
=
taskService
.
TaskTreeIsOver
(
fatherTaskId
);
log
.
info
(
"[核查模块] D 汇总完毕,汇总的账单id为 {}, Task id为 {}"
,
statId
,
fatherTaskId
);
// 如果汇总完毕则将父级的统计任务推进
if
(
over
)
{
TaskBto
fatherTask
=
taskService
.
get
(
fatherTaskId
);
...
...
@@ -519,8 +521,7 @@ public class DeviceCheckController {
TaskBto
parentTask
=
taskService
.
get
(
parentTaskId
);
CheckStatVo
cityStat
=
transUtil
.
checkStatDo2Vo
(
statRepo
.
findById
(
statId
).
get
());
CheckStatVo
provinceStat
=
transUtil
.
checkStatDo2Vo
(
statRepo
.
findById
(
parentTask
.
getBillId
()).
get
());
List
<
CheckDeviceStatVo
>
accStat
=
accumulateStat
(
cityStat
.
getDeviceStatVoList
(),
provinceStat
.
getDeviceStatVoList
());
provinceStat
.
setDeviceStatVoList
(
accStat
);
provinceStat
.
addStatList
(
cityStat
.
getDeviceStatVoList
());
statRepo
.
save
(
provinceStat
.
toDo
());
// 如果所有子地区统计任务都已经完结,则推进父地区统计任务进度
boolean
allOver
=
taskService
.
TaskTreeIsOver
(
parentTaskId
);
...
...
@@ -546,49 +547,33 @@ public class DeviceCheckController {
return
GlobalMap
.
getStatusEnumMap
().
get
(
currentStatusId
-
remainder
);
}
private
List
<
CheckDeviceStatVo
>
accumulateStat
(
List
<
CheckDeviceStatVo
>
originalVos
,
List
<
CheckDeviceStatVo
>
addVos
)
{
for
(
CheckDeviceStatVo
originalVo
:
originalVos
)
{
for
(
CheckDeviceStatVo
addVo
:
addVos
)
{
if
(
originalVo
.
getDeviceModel
().
equals
(
addVo
.
getDeviceModel
()))
{
addVo
.
add
(
originalVo
);
}
}
}
return
addVos
;
}
public
List
<
CheckDeviceStatVo
>
parseStatString2Vo
(
TaskBto
task
,
int
cityLevel
,
String
statString
)
{
List
<
CheckDeviceStatVo
>
statVoList
=
new
ArrayList
<>();
//分为 id - status 的数组 其中status 0缺失 1无误 2新增 3不在库
String
[]
statArray
=
statString
.
split
(
","
);
//将 id - status 转化为 model - count - status(只统计新增和无误的作为数量)
// 根据unitId 查到 areaId 根据 areaId 查询到 areaName
int
areaId
=
unitsRepo
.
findAreaId
(
task
.
getOwnUnit
());
String
areaName
=
areaRepo
.
findNameById
(
areaId
);
for
(
String
s
:
statArray
)
{
String
[]
device
=
s
.
split
(
"-"
);
int
deviceId
=
Integer
.
parseInt
(
device
[
0
]);
int
deviceStatus
=
Integer
.
parseInt
(
device
[
1
]);
int
proofResult
=
Integer
.
parseInt
(
device
[
1
]);
DeviceLibrary
checkDevice
=
deviceRepo
.
findById
(
deviceId
).
get
();
//查询出地区对应的统计账单与详情账单
// 如果是level为3的城市,那么可以通过taskId获得详情id
int
statId
=
0
;
int
detailId
=
0
;
if
(
cityLevel
==
3
)
{
Integer
resultDetailId
=
taskRepo
.
findBillIdByTaskId
(
task
.
getId
());
detailId
=
resultDetailId
==
null
?
0
:
resultDetailId
;
}
// 查询出地区对应的统计账单与详情账单
// 查询出对应的detailId与statId(从fatherTask中获得)
int
detailId
=
Optional
.
ofNullable
(
taskRepo
.
findBillIdByTaskId
(
task
.
getId
())).
orElse
(
0
);
// 如果是level为2的城市,可以通过unitId以及fatherId获得统计
if
(
cityLevel
==
2
)
{
Integer
resultDetailId
=
taskRepo
.
findBillIdByTaskId
(
task
.
getId
());
detailId
=
resultDetailId
==
null
?
0
:
resultDetailId
;
Integer
resultStatId
=
taskRepo
.
findBillId
(
task
.
getParentTaskId
(),
CONFIRM_CHECK_STAT
.
id
);
statId
=
resultStatId
==
null
?
0
:
resultStatId
;
}
int
statId
=
Optional
.
ofNullable
(
taskRepo
.
findBillId
(
task
.
getParentTaskId
(),
CONFIRM_CHECK_STAT
.
id
))
.
orElse
(
0
);
// 根据unitId 查到 areaId 根据 areaId 查询到 areaName
int
areaId
=
unitsRepo
.
findAreaId
(
task
.
getOwnUnit
());
String
areaName
=
areaRepo
.
findNameById
(
areaId
);
CheckAreaStatVo
checkAreaStatVo
;
if
(
deviceStatus
==
1
)
{
// proofResult 9=(1,1) 1=(2,0) other=(2,1)
if
(
proofResult
==
9
)
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
1
,
1
,
statId
,
detailId
);
}
else
if
(
proofResult
==
1
)
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
2
,
0
,
statId
,
detailId
);
}
else
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
2
,
1
,
statId
,
detailId
);
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/domain/DeviceCheckDetailEntity.java
浏览文件 @
8c61dd24
...
...
@@ -59,14 +59,14 @@ public class DeviceCheckDetailEntity {
*/
@ApiModelProperty
(
value
=
"检查组成员1(省A岗)id"
)
@Column
(
name
=
"check_
U
serA_id"
)
@Column
(
name
=
"check_
u
serA_id"
)
private
Integer
checkUserAId
=
0
;
/**
* 检查组成员2(省A岗)id
*/
@ApiModelProperty
(
value
=
"检查组成员2(省A岗)id"
)
@Column
(
name
=
"check_
U
serB_id"
)
@Column
(
name
=
"check_
u
serB_id"
)
private
Integer
checkUserBId
=
0
;
/**
* 本级经办人id(A岗)
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/domain/DeviceCheckStat.java
浏览文件 @
8c61dd24
...
...
@@ -62,10 +62,10 @@ public class DeviceCheckStat {
*/
private
String
statInfo
;
@Column
(
name
=
"check_
U
serA_id"
)
@Column
(
name
=
"check_
u
serA_id"
)
private
Integer
checkUserAId
;
@Column
(
name
=
"check_
U
serB_id"
)
@Column
(
name
=
"check_
u
serB_id"
)
private
Integer
checkUserBId
;
private
String
remark
;
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/CheckAreaStatVo.java
浏览文件 @
8c61dd24
...
...
@@ -54,4 +54,16 @@ public class CheckAreaStatVo {
this
.
supposeCount
+=
supposeCount
;
return
this
;
}
public
CheckAreaStatVo
add
(
CheckAreaStatVo
other
)
{
this
.
areaName
=
other
.
getAreaName
();
this
.
areaStatId
=
other
.
getAreaStatId
();
this
.
areaDetailId
=
other
.
getAreaDetailId
();
this
.
actualCount
=
other
.
getActualCount
()
+
other
.
getActualCount
();
this
.
supposeCount
=
other
.
getSupposeCount
()
+
other
.
getSupposeCount
();
this
.
comProgress
=
other
.
getComProgress
();
this
.
comSituation
=
other
.
getComSituation
();
return
this
;
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/CheckDeviceStatVo.java
浏览文件 @
8c61dd24
...
...
@@ -8,6 +8,10 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.util.CollectionUtils
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
static
java
.
util
.
stream
.
Collectors
.
toMap
;
/**
* CheckDeviceStatVo.
...
...
@@ -53,30 +57,27 @@ public class CheckDeviceStatVo {
}
deviceCount
+=
other
.
getDeviceCount
();
// 如果源地区为空,则直接覆盖掉
if
(
CollectionUtils
.
isEmpty
(
areaStatList
))
{
areaStatList
=
other
.
getAreaStatList
();
}
Map
<
String
,
CheckAreaStatVo
>
areaMap
=
areaStatList
.
stream
()
.
collect
(
toMap
(
CheckAreaStatVo:
:
getAreaName
,
Function
.
identity
()));
for
(
CheckAreaStatVo
otherArea
:
other
.
getAreaStatList
())
{
if
(
deviceModel
.
equals
(
other
.
getDeviceModel
()))
{
if
(
CollectionUtils
.
isEmpty
(
areaStatList
))
{
areaStatList
=
other
.
getAreaStatList
();
}
for
(
CheckAreaStatVo
statVo
:
areaStatList
)
{
if
(
statVo
.
getAreaName
().
equals
(
otherArea
.
getAreaName
()))
{
statVo
.
setAreaName
(
otherArea
.
getAreaName
());
statVo
.
setAreaStatId
(
otherArea
.
getAreaStatId
());
statVo
.
setAreaDetailId
(
otherArea
.
getAreaDetailId
());
statVo
.
setActualCount
(
statVo
.
getActualCount
()
+
otherArea
.
getActualCount
());
statVo
.
setSupposeCount
(
statVo
.
getSupposeCount
()
+
otherArea
.
getSupposeCount
());
statVo
.
setComProgress
(
otherArea
.
getComProgress
());
statVo
.
setComSituation
(
otherArea
.
getComSituation
());
}
}
}
//如果原来的没有则添加,否则累加
areaMap
.
putIfAbsent
(
otherArea
.
getAreaName
(),
otherArea
);
areaMap
.
computeIfPresent
(
otherArea
.
getAreaName
(),
(
k
,
v
)
->
v
.
add
(
otherArea
));
}
areaStatList
=
(
List
<
CheckAreaStatVo
>)
areaMap
.
values
();
return
this
;
}
public
CheckDeviceStatVo
addDeviceCount
(
int
count
){
public
CheckDeviceStatVo
addDeviceCount
(
int
count
)
{
this
.
deviceCount
+=
count
;
return
this
;
}
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/CheckStatVo.java
浏览文件 @
8c61dd24
...
...
@@ -8,6 +8,7 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.modelmapper.ModelMapper
;
import
org.springframework.util.CollectionUtils
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
...
...
@@ -15,6 +16,9 @@ import javax.persistence.Id;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* DeviceCheckStatVo.
...
...
@@ -79,6 +83,7 @@ public class CheckStatVo {
*/
private
List
<
CheckDeviceStatVo
>
deviceStatVoList
;
public
CheckStatVo
(
String
remark
,
Integer
checkUserAId
,
Integer
checkUserBId
,
Integer
id
,
String
title
,
String
subtitle
,
Date
startTime
,
Date
endTime
,
List
<
CheckDeviceStatVo
>
deviceStatVoList
)
{
this
.
checkUserAId
=
checkUserAId
;
this
.
checkUserBId
=
checkUserBId
;
...
...
@@ -96,6 +101,26 @@ public class CheckStatVo {
return
new
CheckStatVo
(
""
,
0
,
0
,
0
,
"无指定数据"
,
"无指定数据"
,
null
,
null
,
emptyList
);
}
public
CheckStatVo
addStatList
(
List
<
CheckDeviceStatVo
>
otherList
)
{
if
(
CollectionUtils
.
isEmpty
(
deviceStatVoList
))
{
deviceStatVoList
=
otherList
;
return
this
;
}
Map
<
String
,
CheckDeviceStatVo
>
oriModelMap
=
deviceStatVoList
.
stream
()
.
collect
(
Collectors
.
toMap
(
CheckDeviceStatVo:
:
getDeviceModel
,
Function
.
identity
()));
//遍历要加入的LIST 如果在源数据map中寻找到了则累加,否则添加进去
for
(
CheckDeviceStatVo
vo
:
otherList
)
{
oriModelMap
.
putIfAbsent
(
vo
.
getDeviceModel
(),
vo
);
oriModelMap
.
computeIfPresent
(
vo
.
getDeviceModel
(),
(
k
,
v
)
->
v
.
add
(
vo
));
}
deviceStatVoList
=
(
List
<
CheckDeviceStatVo
>)
oriModelMap
.
values
();
return
this
;
}
/**
* Vo转Do
*/
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论