Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
eb1bea2e
提交
eb1bea2e
authored
3月 13, 2021
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[核查模块] 修复了统计数据覆盖的Bug
上级
c08f08ac
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
64 行增加
和
15 行删除
+64
-15
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+64
-15
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
eb1bea2e
...
@@ -6,7 +6,6 @@ import com.tykj.dev.config.GlobalMap;
...
@@ -6,7 +6,6 @@ import com.tykj.dev.config.GlobalMap;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.config.swagger.AutoDocument
;
import
com.tykj.dev.device.confirmcheck.common.CheckType
;
import
com.tykj.dev.device.confirmcheck.common.CheckType
;
import
com.tykj.dev.device.confirmcheck.common.TaskPeriod
;
import
com.tykj.dev.device.confirmcheck.common.TaskPeriod
;
import
com.tykj.dev.device.user.cache.AreaCache
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat
;
import
com.tykj.dev.device.confirmcheck.entity.vo.*
;
import
com.tykj.dev.device.confirmcheck.entity.vo.*
;
...
@@ -24,6 +23,7 @@ import com.tykj.dev.device.task.service.TaskService;
...
@@ -24,6 +23,7 @@ import com.tykj.dev.device.task.service.TaskService;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.task.subject.domin.Task
;
import
com.tykj.dev.device.task.subject.domin.Task
;
import
com.tykj.dev.device.user.base.enums.AuExample
;
import
com.tykj.dev.device.user.base.enums.AuExample
;
import
com.tykj.dev.device.user.cache.AreaCache
;
import
com.tykj.dev.device.user.subject.dao.AreaDao
;
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.entity.Area
;
import
com.tykj.dev.device.user.subject.entity.Area
;
...
@@ -175,6 +175,17 @@ public class DeviceCheckController {
...
@@ -175,6 +175,17 @@ public class DeviceCheckController {
return
ImmutableMap
.
of
(
"currentTaskPeriod"
,
periodName
);
return
ImmutableMap
.
of
(
"currentTaskPeriod"
,
periodName
);
}
}
@GetMapping
(
"/title/{examJobId}"
)
public
ResponseEntity
getNames
(
@PathVariable
Integer
examJobId
){
// 根据检查的主键id 查询到prov city Stat的title
Integer
provId
=
taskService
.
get
(
examJobId
).
getParentTaskId
();
// 检查的job id 找到 father 进而找到 father的billid 进而找到title Id
Integer
statId
=
taskService
.
get
(
provId
).
getBillId
();
String
title
=
statRepo
.
getOne
(
statId
).
getTitle
();
return
ResponseEntity
.
ok
(
title
);
}
@ApiOperation
(
value
=
"发起自动核查"
,
notes
=
"发起自动核查"
)
@ApiOperation
(
value
=
"发起自动核查"
,
notes
=
"发起自动核查"
)
@PostMapping
(
"/auto"
)
@PostMapping
(
"/auto"
)
public
ResultObj
<
Map
<
String
,
List
<
Integer
>>>
startAutoCheck
()
{
public
ResultObj
<
Map
<
String
,
List
<
Integer
>>>
startAutoCheck
()
{
...
@@ -254,8 +265,8 @@ public class DeviceCheckController {
...
@@ -254,8 +265,8 @@ public class DeviceCheckController {
log
.
info
(
"[核查模块]发起手动核查,发起单位为{},被查单位为{}"
,
startUnit
.
getName
(),
checkedUnitNames
);
log
.
info
(
"[核查模块]发起手动核查,发起单位为{},被查单位为{}"
,
startUnit
.
getName
(),
checkedUnitNames
);
// 2-1 构建发起单位的 统计账单
// 2-1 构建发起单位的 统计账单
DeviceCheckStat
provinceCheckStat
;
DeviceCheckStat
provinceCheckStat
;
//根据examStatId来判断是update还是create
//根据examStatId来判断是update还是create
此时初始化的为指定检查区域的数据
DeviceCheckStat
initCheckStat
=
initStatData
(
ceVo
.
getTitle
(),
groupUserString
,
0
,
0
,
startUnit
.
getName
(),
checkedUnits
,
ceVo
.
getEndTime
().
atStartOfDay
());
DeviceCheckStat
initCheckStat
=
initStatData
(
c
heckedUnitNames
,
c
eVo
.
getTitle
(),
groupUserString
,
0
,
0
,
startUnit
.
getName
(),
checkedUnits
,
ceVo
.
getEndTime
().
atStartOfDay
());
if
(
ceVo
.
getExamStatId
()
!=
0
)
{
if
(
ceVo
.
getExamStatId
()
!=
0
)
{
DeviceCheckStat
oriCheckStat
=
statRepo
.
findById
(
ceVo
.
getExamStatId
()).
get
();
DeviceCheckStat
oriCheckStat
=
statRepo
.
findById
(
ceVo
.
getExamStatId
()).
get
();
oriCheckStat
.
setRemark
(
initCheckStat
.
getRemark
());
oriCheckStat
.
setRemark
(
initCheckStat
.
getRemark
());
...
@@ -426,7 +437,7 @@ public class DeviceCheckController {
...
@@ -426,7 +437,7 @@ public class DeviceCheckController {
public
ResponseEntity
<
ResultObj
>
checkUserB
(
@PathVariable
Integer
id
,
public
ResponseEntity
<
ResultObj
>
checkUserB
(
@PathVariable
Integer
id
,
@RequestParam
int
checkStatus
,
@RequestParam
int
checkStatus
,
@RequestParam
(
required
=
false
,
defaultValue
=
"0"
)
int
checkUserAId
,
@RequestParam
(
required
=
false
,
defaultValue
=
"0"
)
int
checkUserAId
,
@RequestParam
(
required
=
false
,
defaultValue
=
"0"
)
int
checkUserBId
,
@RequestBody
List
<
FileRet
>
checkFiles
)
{
@RequestParam
(
required
=
false
,
defaultValue
=
"0"
)
int
checkUserBId
,
@RequestBody
List
<
FileRet
>
checkFiles
)
{
log
.
info
(
"[核查模块] 专管员B正在进行核查操作,核查账单id为 {} ,且审核状态为 : {}"
,
id
,
checkStatus
==
1
?
"通过"
:
"不通过"
);
log
.
info
(
"[核查模块] 专管员B正在进行核查操作,核查账单id为 {} ,且审核状态为 : {}"
,
id
,
checkStatus
==
1
?
"通过"
:
"不通过"
);
if
(
checkStatus
==
0
)
{
if
(
checkStatus
==
0
)
{
return
ResponseEntity
.
status
(
400
).
body
(
new
ResultObj
<>(
"checkStatus不应该为0!"
));
return
ResponseEntity
.
status
(
400
).
body
(
new
ResultObj
<>(
"checkStatus不应该为0!"
));
...
@@ -453,7 +464,7 @@ public class DeviceCheckController {
...
@@ -453,7 +464,7 @@ public class DeviceCheckController {
// 如果是4流程的,则需要指定核查组成员A接任务
// 如果是4流程的,则需要指定核查组成员A接任务
detailRepo
.
updateCheckStatus
(
id
,
checkStatus
);
detailRepo
.
updateCheckStatus
(
id
,
checkStatus
);
//是否上传检查单
//是否上传检查单
if
(
checkFiles
!=
null
&&
checkFiles
.
size
()>
0
)
{
if
(
checkFiles
!=
null
&&
checkFiles
.
size
()
>
0
)
{
DeviceCheckDetail
deviceCheckDetail
=
detailRepo
.
findById
(
id
).
get
();
DeviceCheckDetail
deviceCheckDetail
=
detailRepo
.
findById
(
id
).
get
();
deviceCheckDetail
.
setCheckFiles
(
FilesUtil
.
stringFileToList
(
checkFiles
));
deviceCheckDetail
.
setCheckFiles
(
FilesUtil
.
stringFileToList
(
checkFiles
));
detailRepo
.
save
(
deviceCheckDetail
);
detailRepo
.
save
(
deviceCheckDetail
);
...
@@ -554,11 +565,11 @@ public class DeviceCheckController {
...
@@ -554,11 +565,11 @@ public class DeviceCheckController {
.
map
(
vo
->
vo
.
combine
(
cityName
,
cityStat
.
getId
()))
.
map
(
vo
->
vo
.
combine
(
cityName
,
cityStat
.
getId
()))
.
collect
(
toList
());
.
collect
(
toList
());
// 如果是第一个市,则替换,否则累加
// 如果是第一个市,则替换,否则累加
boolean
firstCity
=
taskService
.
TaskTreeIsStart
(
cityTask
.
getParentTaskId
(),
true
);
boolean
firstCity
=
taskService
.
TaskTreeIsStart
(
cityTask
.
getParentTaskId
(),
true
);
if
(
firstCity
){
if
(
firstCity
)
{
provinceStat
.
setDeviceStatVoList
(
mergedVo
);
provinceStat
.
setDeviceStatVoList
(
mergedVo
);
log
.
info
(
"[核查模块] 检测到该任务的合并状态为第一个市统计任务,因此直接替换省级统计数据"
);
log
.
info
(
"[核查模块] 检测到该任务的合并状态为第一个市统计任务,因此直接替换省级统计数据"
);
}
else
{
}
else
{
provinceStat
.
cleanReduce
(
mergedVo
);
provinceStat
.
cleanReduce
(
mergedVo
);
log
.
info
(
"[核查模块] 数据累加成功"
);
log
.
info
(
"[核查模块] 数据累加成功"
);
}
}
...
@@ -613,7 +624,7 @@ public class DeviceCheckController {
...
@@ -613,7 +624,7 @@ public class DeviceCheckController {
int
statId
=
taskRepo
.
findBillId
(
fatherTaskId
,
CONFIRM_CHECK_STAT
.
id
);
int
statId
=
taskRepo
.
findBillId
(
fatherTaskId
,
CONFIRM_CHECK_STAT
.
id
);
// 如果是第一个区域(通过判断所有的child节点没有结束),替换掉父级的统计,如果不是第一个区域,则累加
// 如果是第一个区域(通过判断所有的child节点没有结束),替换掉父级的统计,如果不是第一个区域,则累加
boolean
firstArea
=
taskService
.
TaskTreeIsStart
(
fatherTaskId
,
false
);
boolean
firstArea
=
taskService
.
TaskTreeIsStart
(
fatherTaskId
,
false
);
List
<
CheckDeviceStatVo
>
addVos
=
parseStatString2Vo
(
currentTask
,
currentDetail
.
getCheckDetail
());
List
<
CheckDeviceStatVo
>
addVos
=
parseStatString2Vo
(
currentTask
,
currentDetail
.
getCheckDetail
());
CheckStatVo
cityStatVo
=
transUtil
.
checkStatDo2Vo
(
statRepo
.
findById
(
statId
).
get
());
CheckStatVo
cityStatVo
=
transUtil
.
checkStatDo2Vo
(
statRepo
.
findById
(
statId
).
get
());
//addVos在内部reduce一次
//addVos在内部reduce一次
...
@@ -623,13 +634,16 @@ public class DeviceCheckController {
...
@@ -623,13 +634,16 @@ public class DeviceCheckController {
.
stream
()
.
stream
()
.
map
(
v
->
v
.
stream
().
reduce
(
CheckDeviceStatVo:
:
reduce
).
get
())
.
map
(
v
->
v
.
stream
().
reduce
(
CheckDeviceStatVo:
:
reduce
).
get
())
.
collect
(
toList
());
.
collect
(
toList
());
//直接替换
cityStatVo
=
cityStatVo
.
cleanReduce
(
addVos
);
// 第一个区域替换,否则累加
// 第一个区域替换,否则累加
if
(
firstArea
)
{
//
if (firstArea) {
cityStatVo
.
setDeviceStatVoList
(
addVos
);
//
cityStatVo.setDeviceStatVoList(addVos);
}
else
{
//
} else {
// 获得当前城市的统计信息 以及 要汇总的地区信息 并累加保存
//
// 获得当前城市的统计信息 以及 要汇总的地区信息 并累加保存
cityStatVo
=
cityStatVo
.
cleanReduce
(
addVos
);
//
cityStatVo = cityStatVo.cleanReduce(addVos);
}
//
}
statRepo
.
save
(
cityStatVo
.
toDo
());
statRepo
.
save
(
cityStatVo
.
toDo
());
// 判断地区数据是否均汇总完毕
// 判断地区数据是否均汇总完毕
...
@@ -696,6 +710,41 @@ public class DeviceCheckController {
...
@@ -696,6 +710,41 @@ public class DeviceCheckController {
return
statVoList
;
return
statVoList
;
}
}
/**
* @param initUnitNames 初始化指定单位的数据
* @return
*/
private
DeviceCheckStat
initStatData
(
List
<
String
>
initUnitNames
,
String
title
,
String
remark
,
Integer
checkAId
,
Integer
checkBId
,
String
startUnitName
,
List
<
Units
>
unitsList
,
LocalDateTime
endTime
)
{
//获得要被统计的单位名列表
List
<
String
>
unitNameList
=
unitsList
.
stream
()
.
map
(
Units:
:
getName
)
.
collect
(
toList
());
List
<
AreaUnit
>
auList
=
unitsList
.
stream
()
.
map
(
units
->
auService
.
findOne
(
AuExample
.
UnitId
,
units
.
getUnitId
()))
.
collect
(
toList
());
Collection
<
CheckDeviceStatVo
>
statVos
=
deviceRepo
.
findAll
()
.
stream
()
.
filter
(
dev
->
unitNameList
.
contains
(
dev
.
getOwnUnit
()))
.
filter
(
dev
->
initUnitNames
.
contains
(
dev
.
getOwnUnit
()))
.
map
(
transUtil:
:
device2InitStatVo
)
.
collect
(
toMap
(
d
->
d
.
getDeviceModel
()
+
d
.
getDeviceName
(),
Function
.
identity
(),
CheckDeviceStatVo:
:
reduce
))
.
values
();
return
new
DeviceCheckStat
(
CheckType
.
MANUAL_CHECK
,
title
,
startUnitName
+
"待核查装备统计单"
,
JacksonUtil
.
toJSon
(
new
ArrayList
<>(
statVos
)),
checkAId
,
checkBId
,
remark
,
endTime
);
}
/**
/**
* 构建初始化核查统计数据
* 构建初始化核查统计数据
* 依据不同地区装备的在库情况构造出舒适化的统计数据出来
* 依据不同地区装备的在库情况构造出舒适化的统计数据出来
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论