Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
b19ffe92
提交
b19ffe92
authored
8月 16, 2021
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[核查模块] 回退了DeviceCheckController
上级
a784f862
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
128 行增加
和
286 行删除
+128
-286
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+128
-286
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
b19ffe92
...
...
@@ -18,7 +18,6 @@ import com.tykj.dev.device.confirmcheck.utils.ObjTransUtil;
import
com.tykj.dev.device.file.entity.FileRet
;
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.selfcheck.controller.SelfCheckController
;
import
com.tykj.dev.device.task.repository.TaskDao
;
...
...
@@ -45,7 +44,6 @@ import io.swagger.annotations.ApiOperation;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.jetbrains.annotations.NotNull
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.jpa.domain.Specification
;
...
...
@@ -72,7 +70,7 @@ import static java.util.stream.Collectors.*;
@RestController
@RequestMapping
(
value
=
"/check/confirm"
)
@AutoDocument
//
@Transactional(rollbackFor = Exception.class)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Slf4j
@Api
(
tags
=
"核查模块"
,
description
=
"核查模块"
,
position
=
1
)
public
class
DeviceCheckController
{
...
...
@@ -94,8 +92,6 @@ public class DeviceCheckController {
@Autowired
private
DeviceCheckDetailDao
detailRepo
;
@Autowired
private
DeviceLibraryCacheService
dcService
;
@Autowired
private
ObjTransUtil
transUtil
;
@Autowired
private
TaskDao
taskRepo
;
...
...
@@ -111,8 +107,6 @@ public class DeviceCheckController {
private
ConfirmCheckService
ccService
;
@Autowired
private
MyWebSocket
myWebSocket
;
@Autowired
private
SelfCheckController
selfCheckController
;
@GetMapping
(
"/area/{fatherId}"
)
@ApiOperation
(
value
=
"查询指定区域下的所有区域信息"
)
...
...
@@ -140,6 +134,7 @@ public class DeviceCheckController {
return
statVoList
;
}
@ApiOperation
(
value
=
"根据关键字分页查询核查统计数据"
)
@PostMapping
(
"/stat"
)
public
Page
<
CheckStatTableVo
>
findStatByKeyword
(
...
...
@@ -195,6 +190,7 @@ public class DeviceCheckController {
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
cdVo
));
}
/**
* 该接口负责处理以下跳转情况
* 1 - 统计跳转
...
...
@@ -269,13 +265,11 @@ public class DeviceCheckController {
.
collect
(
toList
());
totalList
.
addAll
(
casList
);
}
//
String
areaName
=
auService
.
findOne
(
AuExample
.
UnitId
,
child
.
getOwnUnit
()).
getName
();
// CheckAreaStatVo cas = combineCaList(totalList, areaName);
//
// LinkCheckDetail lcd = rev2lcd(child, endTime, updateTime, cas.reverse());
LinkCheckDetail
lcd
=
cas2lcd
(
totalList
,
child
,
areaName
);
CheckAreaStatVo
cas
=
combineCaList
(
totalList
,
areaName
);
LinkCheckDetail
lcd
=
rev2lcd
(
child
,
endTime
,
updateTime
,
cas
.
reverse
());
lcd
.
setCheckUnit
(
unitName
);
if
(
child
.
getTitle
().
contains
(
"统计确认待办任务"
))
{
lcd
.
setCheckSituation
(
"统计确认待办任务"
);
...
...
@@ -305,13 +299,16 @@ public class DeviceCheckController {
if
(
casList
.
isEmpty
())
{
cas
=
new
CheckAreaStatVo
(
"默认地区"
,
0
,
0
,
0
,
0
,
0
,
0
);
}
else
{
// cas = combineCaList(casList, unitName);
cas
=
casList
.
get
(
0
);
cas
=
combineCaList
(
casList
,
unitName
);
}
// LinkExamDetail led = rev2led(child, endTime, updateTime, cas.reverse());
LinkExamDetail
led
=
cas2led
(
cas
,
child
,
endTime
,
updateTime
);
// CheckAreaStatVo cas = parseStatString2Vo(child.parse2Bto(), childDetail).stream()
// .map(CheckDeviceStatVo::getAreaStatList)
// .flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
// .reduce(CheckAreaStatVo::combine)
// .orElse(new CheckAreaStatVo("默认地区", 0, 0, 0, 0, 0, 0));
LinkExamDetail
led
=
rev2led
(
child
,
endTime
,
updateTime
,
cas
.
reverse
());
led
.
setCheckUnit
(
unitName
);
ledList
.
add
(
led
);
...
...
@@ -358,7 +355,34 @@ public class DeviceCheckController {
int
i
=
0
;
for
(
Task
child
:
childTask
)
{
LinkExamDetail
led
=
getLed
(
endTime
,
updateTime
,
child
);
Integer
childBusType
=
child
.
getBusinessType
();
Integer
childBusId
=
child
.
getBillId
();
DeviceCheckDetail
childDetail
=
detailRepo
.
findById
(
childBusId
).
get
();
String
unitName
=
childDetail
.
getCheckUnit
();
List
<
CheckAreaStatVo
>
casList
=
parseStatString2Vo
(
child
.
parse2Bto
(),
childDetail
).
stream
()
.
map
(
CheckDeviceStatVo:
:
getAreaStatList
)
.
flatMap
(
checkAreaStatVos
->
checkAreaStatVos
.
stream
())
.
collect
(
toList
());
//自查的areaName要从detail里找
String
areaName
=
childDetail
.
getCheckUnit
();
CheckAreaStatVo
cas
;
if
(
casList
.
isEmpty
())
{
cas
=
new
CheckAreaStatVo
(
"默认地区"
,
0
,
0
,
0
,
0
,
0
,
0
);
}
else
{
cas
=
combineCaList
(
casList
,
areaName
);
}
//
// CheckAreaStatVo cas = parseStatString2Vo(child.parse2Bto(), childDetail).stream()
// .map(CheckDeviceStatVo::getAreaStatList)
// .flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
// .reduce(CheckAreaStatVo::combine)
// .get();
LinkExamDetail
led
=
rev2led
(
child
,
endTime
,
updateTime
,
cas
.
reverse
());
led
.
setCheckUnit
(
unitName
);
//设置名称
led
.
setExamName
(
groupNames
.
get
(
i
));
...
...
@@ -384,37 +408,8 @@ public class DeviceCheckController {
}
@NotNull
private
LinkExamDetail
getLed
(
LocalDateTime
endTime
,
LocalDateTime
updateTime
,
Task
child
)
{
Integer
childBusType
=
child
.
getBusinessType
();
Integer
childBusId
=
child
.
getBillId
();
DeviceCheckDetail
childDetail
=
detailRepo
.
findById
(
childBusId
).
get
();
String
unitName
=
childDetail
.
getCheckUnit
();
List
<
CheckAreaStatVo
>
casList
=
parseStatString2Vo
(
child
.
parse2Bto
(),
childDetail
).
stream
()
.
map
(
CheckDeviceStatVo:
:
getAreaStatList
)
.
flatMap
(
checkAreaStatVos
->
checkAreaStatVos
.
stream
())
.
collect
(
toList
());
//自查的areaName要从detail里找
String
areaName
=
childDetail
.
getCheckUnit
();
CheckAreaStatVo
cas
;
if
(
casList
.
isEmpty
())
{
cas
=
new
CheckAreaStatVo
(
"默认地区"
,
0
,
0
,
0
,
0
,
0
,
0
);
}
else
{
cas
=
casList
.
get
(
0
);
}
LinkExamDetail
led
=
cas2led
(
cas
,
child
,
endTime
,
updateTime
);
led
.
setCheckUnit
(
unitName
);
return
led
;
}
//进行了更新 使用修改时间去做是否逾期判断
private
LinkCheckDetail
rev2lcd
(
Task
task
,
LocalDateTime
endTime
,
LocalDateTime
updateTime
,
RevAreaStat
revAreaStat
)
{
private
LinkCheckDetail
rev2lcd
(
Task
task
,
LocalDateTime
endTime
,
LocalDateTime
updateTime
,
RevAreaStat
revAreaStat
)
{
LinkCheckDetail
lcd
=
new
LinkCheckDetail
();
lcd
.
setId
(
task
.
getBillId
());
...
...
@@ -481,100 +476,8 @@ public class DeviceCheckController {
return
lcd
;
}
/**
* lcd 里的列表都为检查,因此是集合对
*
* @return
*/
private
LinkCheckDetail
cas2lcd
(
List
<
CheckAreaStatVo
>
casList
,
Task
task
,
String
finalCityName
)
{
LinkCheckDetail
lcd
=
new
LinkCheckDetail
();
lcd
.
setId
(
task
.
getBillId
());
//全部为0->0,全部为2->2,否则1
boolean
waitStart
=
casList
.
stream
()
.
allMatch
(
cas
->
cas
.
getComProgress
()
==
0
);
boolean
isFinished
=
casList
.
stream
()
.
allMatch
(
cas
->
cas
.
getComProgress
()
==
2
)
||
task
.
getBillStatus
().
equals
(
END
);
if
(
waitStart
)
{
lcd
.
setCheckSituation
(
"等待核查"
);
}
else
if
(
isFinished
)
{
lcd
.
setCheckSituation
(
"已完成"
);
}
else
{
lcd
.
setCheckSituation
(
"核查中"
);
}
boolean
waitAudit
=
casList
.
stream
()
.
allMatch
(
cas
->
cas
.
getComSituation
()
==
10
);
// 需要每一个城市都有无误(即12) 才算无误
long
cityCount
=
casList
.
stream
().
count
();
long
okCount
=
casList
.
stream
()
.
filter
(
cas
->
cas
.
getComSituation
()
==
12
)
.
count
();
boolean
allOk
=
okCount
>=
cityCount
;
if
(
isFinished
)
{
if
(
waitAudit
)
{
lcd
.
setCheckResult
(
"待审核"
);
}
else
if
(
allOk
)
{
lcd
.
setCheckResult
(
"无误"
);
}
else
{
lcd
.
setCheckResult
(
"审核中"
);
}
}
lcd
.
setCheckUnit
(
finalCityName
+
"局"
);
return
lcd
;
}
/**
* led 里的列表都为自查,因此都是单个对象
*
* @return
*/
private
LinkExamDetail
cas2led
(
CheckAreaStatVo
cas
,
Task
task
,
LocalDateTime
endTime
,
LocalDateTime
updateTime
)
{
LinkExamDetail
led
=
new
LinkExamDetail
();
led
.
setId
(
task
.
getBillId
());
int
comProgress
=
cas
.
getComProgress
();
int
comSituation
=
cas
.
getComSituation
();
if
(
comProgress
==
0
)
{
led
.
setCheckSituation
(
"准备核查"
);
}
else
if
(
comProgress
==
1
)
{
led
.
setCheckSituation
(
"核查中"
);
}
else
if
(
comProgress
==
2
)
{
if
(
endTime
.
isBefore
(
updateTime
))
{
led
.
setCheckSituation
(
"逾期完成"
);
}
else
{
led
.
setCheckSituation
(
"完成"
);
}
}
if
(
comProgress
==
0
||
comProgress
==
1
)
{
led
.
setCheckResult
(
"无"
);
}
else
{
if
(
comSituation
==
10
)
{
led
.
setCheckResult
(
"待审核"
);
}
else
if
(
comSituation
==
12
)
{
led
.
setCheckResult
(
"无误"
);
}
else
if
(
comSituation
==
13
)
{
led
.
setCheckResult
(
"未通过"
);
}
else
{
led
.
setCheckResult
(
"缺省"
);
}
}
led
.
setCheckUnit
(
cas
.
getAreaName
()
+
"局"
);
return
led
;
}
//修改
private
LinkExamDetail
rev2led
(
Task
task
,
LocalDateTime
endTime
,
LocalDateTime
updateTime
,
RevAreaStat
revAreaStat
)
{
private
LinkExamDetail
rev2led
(
Task
task
,
LocalDateTime
endTime
,
LocalDateTime
updateTime
,
RevAreaStat
revAreaStat
)
{
LinkExamDetail
led
=
new
LinkExamDetail
();
led
.
setId
(
task
.
getBillId
());
...
...
@@ -683,7 +586,7 @@ public class DeviceCheckController {
Integer
provId
=
taskService
.
get
(
examJobId
).
getParentTaskId
();
// 检查的job id 找到 father 进而找到 father的billid 进而找到title Id
Integer
statId
=
taskService
.
get
(
provId
).
getBillId
();
DeviceCheckStat
deviceCheckStat
=
statRepo
.
findById
(
statId
).
get
(
);
DeviceCheckStat
deviceCheckStat
=
statRepo
.
getOne
(
statId
);
String
title
=
deviceCheckStat
.
getTitle
();
String
remark
=
deviceCheckStat
.
getRemark
();
return
ResponseEntity
.
ok
(
new
CheckTitleAndTimeVo
(
title
,
deviceCheckStat
.
getEndTime
(),
remark
));
...
...
@@ -713,8 +616,8 @@ public class DeviceCheckController {
@ApiOperation
(
value
=
"检查地区是否发起核查"
,
notes
=
"检查地区是否发起核查"
)
@PostMapping
(
"/checkPossible"
)
public
ResponseEntity
checkPossible
(
@RequestBody
UnitIds
u
nitIds
)
{
List
<
String
>
unitNames
=
u
nitIds
.
getIds
().
stream
()
public
ResponseEntity
checkPossible
(
@RequestBody
UnitIds
u
uid
)
{
List
<
String
>
unitNames
=
u
uid
.
getIds
().
stream
()
.
map
(
id
->
auService
.
findOne
(
AuExample
.
UnitId
,
id
))
.
map
(
AreaUnit:
:
getUnitName
)
.
collect
(
toList
());
...
...
@@ -882,15 +785,12 @@ public class DeviceCheckController {
}
List
<
String
>
tmpString
=
new
ArrayList
<>();
// 拼接检查组和检查组成员
for
(
CheckExamDetailVo
vo
:
examDetailVos
)
{
for
(
Integer
u
:
vo
.
getUnitIds
())
{
tmpString
.
add
(
vo
.
getGroupName
()
+
","
+
vo
.
getUserNames
().
stream
().
collect
(
joining
(
","
)));
}
}
String
groupUserString
=
tmpString
.
stream
().
collect
(
joining
(
"|"
));
List
<
Integer
>
unitIds
=
examDetailVos
.
stream
().
flatMap
(
cv
->
cv
.
getUnitIds
().
stream
()
).
collect
(
toList
());
List
<
Integer
>
unitIds
=
examDetailVos
.
stream
().
map
(
CheckExamDetailVo:
:
getUnitId
).
collect
(
toList
());
List
<
Units
>
checkedUnits
=
unitsRepo
.
findAllById
(
unitIds
);
List
<
String
>
checkedUnitNames
=
checkedUnits
.
stream
().
map
(
Units:
:
getName
).
collect
(
toList
());
...
...
@@ -959,12 +859,8 @@ public class DeviceCheckController {
// 3. 构建被核查单位的详情账单与Task
// 对每个需要核查的单位构建其detail账单与task
for
(
CheckExamDetailVo
ed
:
examDetailVos
)
{
List
<
Integer
>
uid
=
ed
.
getUnitIds
();
for
(
Integer
u
:
uid
)
{
Units
unit
=
unitsRepo
.
findById
(
u
).
get
();
Units
unit
=
unitsRepo
.
findById
(
ed
.
getUnitId
()).
get
();
String
names
=
ed
.
getUserNames
().
stream
().
collect
(
joining
(
","
));
// 3-1 构建被查单位的 自查账单
DeviceCheckDetail
unitDetailDoc
=
DeviceCheckDetail
.
EmptyWithChecker
(
names
+
"|"
+
ed
.
getRemark
(),
ceVo
.
getTitle
()
+
"%^&"
+
ed
.
getRemark
(),
0
,
0
,
0
,
0
,
unit
.
getName
(),
devInLib
.
getOrDefault
(
unit
.
getName
(),
new
ArrayList
<>()),
devNotInLib
.
getOrDefault
(
unit
.
getName
(),
new
ArrayList
<>()));
DeviceCheckDetail
detail
=
detailRepo
.
save
(
unitDetailDoc
);
...
...
@@ -989,9 +885,6 @@ public class DeviceCheckController {
desMap
.
put
(
checkedTask
.
getId
(),
ed
.
getRemark
());
}
}
// 4. 重新设置并保存统计账单
provinceCheckStat
.
setStatInfo
(
JacksonUtil
.
toJSon
(
deviceStatVos
));
statRepo
.
save
(
provinceCheckStat
);
...
...
@@ -1023,6 +916,7 @@ public class DeviceCheckController {
}
/**
* 根据taskId查询Remark
*/
...
...
@@ -1033,6 +927,7 @@ public class DeviceCheckController {
return
ResponseEntity
.
ok
(
desBillMap
.
get
(
billId
));
}
private
TaskBto
selectProvTask
(
Integer
taskId
)
{
TaskBto
taskBto
=
taskService
.
get
(
taskId
);
if
(
taskBto
.
getParentTaskId
()
==
0
)
{
...
...
@@ -1041,6 +936,7 @@ public class DeviceCheckController {
return
selectProvTask
(
taskBto
.
getParentTaskId
());
}
/**
* 对于专员A来说的逻辑
* 1. 修改detailString
...
...
@@ -1203,126 +1099,84 @@ public class DeviceCheckController {
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
"专管B操作成功"
));
}
@ApiOperation
(
value
=
"自查的回退接口"
)
@PutMapping
(
"/audit/rollback/{id}"
)
public
ResponseEntity
rollBack
(
@PathVariable
Integer
id
)
{
//1. bill单的自查将百位数变为3
DeviceCheckDetail
detail
=
detailRepo
.
findById
(
id
).
get
();
String
detailString
=
detail
.
getCheckDetail
();
String
initalDetail
=
Arrays
.
stream
(
detailString
.
split
(
","
))
.
map
(
s
->
s
.
split
(
"-"
)[
0
]
+
"-"
+
119
)
.
collect
(
joining
(
","
));
String
updateDetail
=
changeHunds
(
detailString
,
3
);
detailRepo
.
updateCheckDetail
(
id
,
updateDetail
,
""
,
0
,
0
,
0
);
//2. 当前任务结束,开启一个新的 退回任务(连带一个新的detail)
TaskBto
currentTask
=
taskService
.
get
(
id
,
CONFIRM_CHECK_DETAIL
.
id
);
TaskBto
newTask
=
currentTask
.
toDo
().
copy
().
parse2Bto
();
currentTask
.
setCustomInfo
(
currentTask
.
getCustomInfo
());
taskService
.
moveToEnd
(
currentTask
);
// 创建新的detail 新的detail会在B的时候加入,所以老的stat要去除掉
DeviceCheckDetail
cDetail
=
detail
.
copyWithoutId
();
cDetail
.
setId
(
null
);
cDetail
.
setCheckDetail
(
initalDetail
);
cDetail
=
detailRepo
.
save
(
cDetail
);
// 创建新的任务
newTask
.
setBillStatus
(
CHECK_EXAM_DETAIL_0
.
id
);
newTask
.
setBillId
(
cDetail
.
getId
());
newTask
.
setId
(
0
);
newTask
.
setCustomInfo
(
newTask
.
getCustomInfo
());
newTask
.
getInvolveUserIdList
().
add
(
0
);
newTask
.
setCurrentPoint
(
newTask
.
getInvolveUserIdList
().
size
()-
1
);
taskService
.
start
(
newTask
);
//3. 在stat的remark中追加信息 - 找到currentTask在其中的顺位
TaskBto
fatherTask
=
taskService
.
get
(
currentTask
.
getParentTaskId
());
List
<
Task
>
childTask
=
taskRepo
.
findAllByParentTaskId
(
fatherTask
.
getId
());
int
pos
=
0
;
for
(
int
i
=
0
;
i
<
childTask
.
size
();
i
++)
{
if
(
childTask
.
get
(
i
).
getId
().
equals
(
currentTask
.
getId
()))
{
log
.
info
(
"[核查模块] 记录remark的pos位置 = {}"
,
i
);
}
}
DeviceCheckStat
dcs
=
statRepo
.
findById
(
fatherTask
.
getBillId
()).
get
();
String
[]
groups
=
dcs
.
getRemark
().
split
(
"\\|"
);
String
pading
=
groups
[
pos
];
dcs
.
setRemark
(
dcs
.
getRemark
()
+
"|"
+
pading
);
log
.
info
(
"[核查模块] 补充remark = {}"
,
pading
);
// 老的stat要去除掉对应areaName的数据
String
areaName
=
auService
.
findOne
(
AuExample
.
UnitName
,
detail
.
getCheckUnit
()).
getName
();
CheckStatVo
csv
=
transUtil
.
checkStatDo2Vo
(
dcs
);
for
(
CheckDeviceStatVo
vo
:
csv
.
getDeviceStatVoList
())
{
List
<
CheckAreaStatVo
>
filterList
=
vo
.
getAreaStatList
().
stream
()
.
filter
(
casv
->
!
casv
.
getAreaName
().
equals
(
areaName
)).
collect
(
toList
());
if
(
filterList
.
size
()
!=
vo
.
getAreaStatList
().
size
()){
log
.
info
(
"[核查模块] 回退操作-将退回的数据从统计中去除了."
);
vo
.
setAreaStatList
(
filterList
);
}
}
statRepo
.
save
(
csv
.
toDo
());
/**
* 用于核查的回退接口
*
* @param id 办结的done接口id
* @return
*/
@ApiOperation
(
value
=
"核查回退"
)
@PutMapping
(
"/check/rollback/{id}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
checkRollback
(
@PathVariable
Integer
id
)
{
log
.
info
(
"[核查模块] 将id = {} 的检查任务进行回退"
,
id
);
Specification
<
Task
>
donePred
=
Specifications
.<
Task
>
and
()
.
eq
(
"billStatus"
,
CONFIRM_STAT_0
.
id
)
.
eq
(
"billId"
,
id
)
.
eq
(
"businessType"
,
CONFIRM_CHECK_STAT
.
id
)
.
build
();
TaskBto
doneTask
=
taskRepo
.
findOne
(
donePred
).
get
().
parse2Bto
();
//4.父级任务变为进行中
fatherTask
.
setBillStatus
(
CHECK_EXAM_STAT_1
.
id
);
taskRepo
.
save
(
fatherTask
.
toDo
());
Specification
<
Task
>
checkPred
=
Specifications
.<
Task
>
and
()
.
eq
(
"customInfo"
,
"exam"
)
.
eq
(
"billId"
,
id
)
.
eq
(
"businessType"
,
CONFIRM_CHECK_STAT
.
id
)
.
build
();
Task
checkTask
=
taskRepo
.
findOne
(
checkPred
).
get
();
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
"回退操作成功!"
));
//1.将市检查的任务节点回退到等待办结的状态
taskService
.
moveToSpecial
(
checkTask
.
parse2Bto
(),
CHECK_EXAM_STAT_1
);
//2.删除掉省的办结任务
if
(
Objects
.
isNull
(
doneTask
))
{
log
.
info
(
"[核查模块] 没有找到对应的办结任务"
);
}
else
{
log
.
info
(
"[核查模块] 删除id = {}的办结任务"
,
doneTask
.
getId
());
taskRepo
.
deleteById
(
doneTask
.
getId
());
}
@PutMapping
(
"/audit/verify/{id}"
)
@ApiOperation
(
value
=
"自查的通过接口"
)
public
ResponseEntity
verify
(
@PathVariable
Integer
id
){
//将自查的情况的百位数全部替换成2
DeviceCheckDetail
detail
=
detailRepo
.
findById
(
id
).
get
();
String
updatedString
=
changeHunds
(
detail
.
getCheckDetail
(),
2
);
detail
.
setCheckDetail
(
updatedString
);
log
.
info
(
"[核查模块] 审核通过 - 更新后的detailString形如 {}"
,
updatedString
.
split
(
","
)[
0
]);
detailRepo
.
save
(
detail
);
//将对应stat中地区的comProgress 改为 2 comsitution 改为12
String
areaName
=
auService
.
findOne
(
AuExample
.
UnitName
,
detail
.
getCheckUnit
()).
getName
();
TaskBto
currentTask
=
taskService
.
get
(
id
,
CONFIRM_CHECK_DETAIL
.
id
);
TaskBto
fatherTask
=
taskService
.
get
(
currentTask
.
getParentTaskId
());
DeviceCheckStat
dcs
=
statRepo
.
findById
(
fatherTask
.
getBillId
()).
get
();
CheckStatVo
csv
=
transUtil
.
checkStatDo2Vo
(
dcs
);
for
(
CheckDeviceStatVo
vo
:
csv
.
getDeviceStatVoList
())
{
for
(
CheckAreaStatVo
av
:
vo
.
getAreaStatList
())
{
if
(
av
.
getAreaName
().
equals
(
areaName
)){
log
.
info
(
"[核查模块] 审核通过 - 地区 = {} 的统计数据在统计信息中被成功修改了"
,
areaName
);
av
.
auditPassed
();
}
}
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
"核查回退操作成功!"
));
}
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
"审核通过!"
));
}
/**
*
将detailString里的百位数改为指定数字
*
@param detailString 要更改的自查详情字符串
* @param
value 想要改成的数字
*
用于检查页面的回退接口
*
* @param
id 自查的detail id
* @return
*/
private
String
changeHunds
(
String
detailString
,
Integer
value
)
{
String
updateDetail
=
Arrays
.
stream
(
detailString
.
split
(
","
))
.
map
(
s
->
{
Integer
number
=
Integer
.
valueOf
(
s
.
split
(
"-"
)[
1
]);
int
digit
=
number
%
10
;
int
tens
=
number
/
10
%
10
;
number
=
value
*
100
+
tens
*
10
+
digit
;
return
s
.
split
(
"-"
)[
0
]
+
"-"
+
number
;
})
@ApiOperation
(
value
=
" "
)
@PutMapping
(
"/exam/rollback/{id}"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseEntity
examRollback
(
@PathVariable
Integer
id
)
{
log
.
info
(
"[核查模块] 进行检查回退操作,要回退的检查detail id为 {}"
,
id
);
//1. 回退device-detail数据 包括 detail String,checkResult,userAId,userBid,checkedCount
// 将原来的checkDetail 的检查状态统一更改为 8 - 已退回
String
detail
=
detailRepo
.
getOne
(
id
).
getCheckDetail
();
String
updateDetail
=
Arrays
.
stream
(
detail
.
split
(
","
))
.
map
(
s
->
s
.
split
(
"-"
)[
0
]
+
"-"
+
"8"
)
.
collect
(
joining
(
","
));
return
updateDetail
;
}
detailRepo
.
updateCheckDetail
(
id
,
updateDetail
,
""
,
0
,
0
,
0
);
//2. 回退任务Task
TaskBto
currentTask
=
taskService
.
get
(
id
,
CONFIRM_CHECK_DETAIL
.
id
);
StatusEnum
firstStatus
=
GlobalMap
.
getStatusEnumMap
().
get
(
Integer
.
valueOf
(
currentTask
.
getRemark
()));
taskService
.
moveToSpecial
(
currentTask
,
firstStatus
,
currentTask
.
getFirstUserId
());
//3.如果父级任务状态已经到确认阶段,则同样回退一个阶段
TaskBto
fatherTask
=
taskService
.
get
(
currentTask
.
getParentTaskId
());
// log.info("[核查模块] 父级统计节点的task id = {} , bill id = {}", fatherTask.getId(), fatherTask.getBillId());
// if (fatherTask.getBillStatus().equals(CHECK_EXAM_STAT_1.id)) {
// log.info("[核查模块] 检测到父级节点已经进入确认阶段,回滚父级节点");
// taskService.moveToSpecial(fatherTask, CHECK_EXAM_STAT_0, fatherTask.getFirstUserId());
// }
//3. 回退合并上去的数据
String
unitName
=
detailRepo
.
findById
(
id
).
get
().
getCheckUnit
();
AreaUnit
areaUnit
=
auService
.
findOne
(
AuExample
.
UnitName
,
unitName
);
String
cityName
=
areaUnit
.
getName
();
resetStatByCity
(
fatherTask
.
getBillId
(),
cityName
);
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
"检查回退操作成功!"
));
}
/**
* 将统计数据中指定城市的统计数据重置
...
...
@@ -1449,7 +1303,8 @@ public class DeviceCheckController {
log
.
info
(
"[核查模块] 办结统计待办操作成功"
);
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
"办结统计待办确认完毕"
));
}
@Autowired
private
SelfCheckController
selfCheckController
;
/**
* @param statId 统计账单主键id
*/
...
...
@@ -1585,10 +1440,8 @@ public class DeviceCheckController {
.
collect
(
toList
());
long
start
=
System
.
currentTimeMillis
();
List
<
DeviceLibrary
>
allDevice
=
dcService
.
getAllDeviceLibraryList
();
Map
<
Integer
,
DeviceLibrary
>
deviceMap
=
allDevice
.
stream
()
.
filter
(
d
->
idList
.
contains
(
d
.
getId
()))
Map
<
Integer
,
DeviceLibrary
>
deviceMap
=
deviceRepo
.
findAllByIdIn
(
idList
)
.
stream
()
.
collect
(
toMap
(
DeviceLibrary:
:
getId
,
Function
.
identity
()));
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"[核查TEST] 批量查询id集合耗时 {} ms "
,
end
-
start
);
...
...
@@ -1604,34 +1457,23 @@ public class DeviceCheckController {
DeviceLibrary
checkDevice
=
deviceMap
.
get
(
deviceId
);
CheckAreaStatVo
checkAreaStatVo
;
// 百位数 0/1 待审核 2 无误 3未通过
// 十位数 1 人工 2 自动
// 0缺失1无误2新增3不在库 8已退回 9未检查
int
digits
=
proofResult
%
10
;
int
tens
=
proofResult
/
10
%
10
;
int
huns
=
proofResult
/
100
%
10
;
// 个位数判断自查结果
if
(
digits
==
9
)
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
0
,
10
,
statId
,
detailId
);
if
(
digits
==
8
)
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
3
,
-
1
,
statId
,
detailId
);
}
else
if
(
digits
==
9
)
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
0
,
0
,
statId
,
detailId
);
}
else
if
(
digits
==
3
)
{
//跳过非在库的统计
continue
;
}
else
if
(
digits
==
1
)
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
2
,
1
0
,
statId
,
detailId
);
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
2
,
0
,
statId
,
detailId
);
}
else
if
(
digits
==
0
)
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
0
,
1
,
2
,
1
0
,
statId
,
detailId
);
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
0
,
1
,
2
,
1
,
statId
,
detailId
);
}
else
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
2
,
10
,
statId
,
detailId
);
}
// 百位数判断审核情况 0,1未检查 2是无误 3是未通过
if
(
huns
==
0
||
huns
==
1
)
{
checkAreaStatVo
.
setComSituation
(
10
);
}
else
if
(
huns
==
2
)
{
checkAreaStatVo
.
setComSituation
(
12
);
}
else
if
(
huns
==
3
)
{
checkAreaStatVo
.
setComSituation
(
13
);
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
2
,
1
,
statId
,
detailId
);
}
List
<
CheckAreaStatVo
>
areaStatVoList
=
new
ArrayList
<>();
...
...
@@ -1814,7 +1656,7 @@ public class DeviceCheckController {
return
new
CheckAreaStatVo
(
finalCityName
,
actualCount
,
supposeCount
,
finalProgress
,
finalSituation
,
0
,
0
);
}
private
void
findBySystem
()
{
private
void
findBySystem
(){
selfCheckController
.
findBySystem1
();
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论