Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
7ae59048
提交
7ae59048
authored
5月 16, 2021
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[核查模块] 重构了即时计算模块
上级
df1a6641
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
309 行增加
和
58 行删除
+309
-58
CheckType.java
...va/com/tykj/dev/device/confirmcheck/common/CheckType.java
+1
-0
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+224
-36
CheckAreaStatVo.java
...kj/dev/device/confirmcheck/entity/vo/CheckAreaStatVo.java
+1
-12
CheckDeviceStatVo.java
.../dev/device/confirmcheck/entity/vo/CheckDeviceStatVo.java
+8
-1
CheckStatVo.java
...m/tykj/dev/device/confirmcheck/entity/vo/CheckStatVo.java
+14
-1
LinkCheckDetail.java
...kj/dev/device/confirmcheck/entity/vo/LinkCheckDetail.java
+5
-0
LinkExamDetail.java
...ykj/dev/device/confirmcheck/entity/vo/LinkExamDetail.java
+5
-0
LinkVo.java
...va/com/tykj/dev/device/confirmcheck/entity/vo/LinkVo.java
+11
-0
UnitIds.java
...a/com/tykj/dev/device/confirmcheck/entity/vo/UnitIds.java
+21
-0
ObjTransUtil.java
.../com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
+12
-5
DeviceLibraryDao.java
.../tykj/dev/device/library/repository/DeviceLibraryDao.java
+4
-0
TaskServiceImpl.java
...om/tykj/dev/device/task/service/impl/TaskServiceImpl.java
+3
-3
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/common/CheckType.java
浏览文件 @
7ae59048
...
...
@@ -25,4 +25,5 @@ public enum CheckType {
private
final
Integer
id
;
private
final
String
name
;
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
7ae59048
...
...
@@ -41,6 +41,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.jpa.domain.Specification
;
...
...
@@ -153,6 +154,7 @@ public class DeviceCheckController {
if
(
type
.
equals
(
CONFIRM_CHECK_STAT
.
id
))
{
DeviceCheckStat
ct
=
statRepo
.
findById
(
billId
).
get
();
CheckStatVo
ctVo
=
transUtil
.
checkStatDo2Vo
(
ct
);
linkVo
.
setTitle
(
ctVo
.
getTitle
());
LocalDateTime
endTime
=
ctVo
.
getEndTime
();
linkVo
.
setEndTime
(
ctVo
.
getEndTime
().
toLocalDate
());
...
...
@@ -167,51 +169,100 @@ public class DeviceCheckController {
// 找到所有的子节点
List
<
Task
>
childTask
=
taskRepo
.
findAllByParentTaskId
(
rootTask
.
getId
());
long
startTime
=
System
.
currentTimeMillis
();
long
finalTime
=
System
.
currentTimeMillis
();
for
(
Task
child
:
childTask
)
{
Integer
childBusType
=
child
.
getBusinessType
();
Integer
childBusId
=
child
.
getBillId
();
// 处理子节点,子节点有两种类型 - 检查类统计与自查类数据
if
(
childBusType
.
equals
(
CONFIRM_CHECK_STAT
.
id
))
{
startTime
=
System
.
currentTimeMillis
();
//市检查
Integer
unitId
=
child
.
getOwnUnit
();
String
unitName
=
unitsRepo
.
findById
(
unitId
).
get
().
getName
();
DeviceCheckStat
cdc
=
statRepo
.
findById
(
child
.
getBillId
()).
get
();
CheckStatVo
cdcVo
=
transUtil
.
checkStatDo2Vo
(
cdc
);
//todo 这里更改从detail中去查看并求和
//找到chilid的子child detail 并求和
List
<
Task
>
cctask
=
taskRepo
.
findAllByParentTaskId
(
child
.
getId
());
if
(
cdcVo
.
getDeviceStatVoList
().
size
()
==
0
)
{
LinkCheckDetail
lcd
=
new
LinkCheckDetail
(
"默认"
,
"无误"
,
"未开始"
,
0
);
lcd
.
setCheckUnit
(
unitName
);
lcdList
.
add
(
lcd
);
}
else
{
CheckAreaStatVo
cas
=
cdcVo
.
getDeviceStatVoList
().
stream
()
List
<
CheckAreaStatVo
>
totalList
=
new
ArrayList
<>();
for
(
Task
cct
:
cctask
)
{
Integer
detailId
=
cct
.
getBillId
();
DeviceCheckDetail
childDetail
=
detailRepo
.
findById
(
detailId
).
get
();
List
<
CheckAreaStatVo
>
casList
=
parseStatString2Vo
(
child
.
parse2Bto
(),
childDetail
).
stream
()
.
map
(
CheckDeviceStatVo:
:
getAreaStatList
)
.
flatMap
(
checkAreaStatVos
->
checkAreaStatVos
.
stream
())
.
reduce
(
CheckAreaStatVo:
:
combine
)
.
get
();
.
collect
(
toList
());
totalList
.
addAll
(
casList
);
}
String
areaName
=
auService
.
findOne
(
AuExample
.
UnitId
,
child
.
getOwnUnit
()).
getName
();
CheckAreaStatVo
cas
=
combineCaList
(
totalList
,
areaName
);
LinkCheckDetail
lcd
=
rev2lcd
(
endTime
,
cas
.
reverse
());
LinkCheckDetail
lcd
=
rev2lcd
(
child
,
endTime
,
cas
.
reverse
());
lcd
.
setCheckUnit
(
unitName
);
lcdList
.
add
(
lcd
);
}
// if (cdcVo.getDeviceStatVoList().size() == 0) {
// LinkCheckDetail lcd = new LinkCheckDetail(child.getBillId(), "默认", "无", "未开始", 0);
// lcd.setCheckUnit(unitName);
// lcdList.add(lcd);
// } else {
// List<CheckAreaStatVo> casList = cdcVo.getDeviceStatVoList().stream()
// .map(CheckDeviceStatVo::getAreaStatList)
// .flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
// .collect(toList());
// String areaName = auService.findOne(AuExample.UnitId, child.getOwnUnit()).getName();
// CheckAreaStatVo cas = combineCaList(casList, areaName);
//
// LinkCheckDetail lcd = rev2lcd(child.getBillId(), endTime, cas.reverse());
// lcd.setCheckUnit(unitName);
// lcdList.add(lcd);
// }
finalTime
=
System
.
currentTimeMillis
();
log
.
info
(
"[TEST] child-BILL id = {}的检查任务 , COST {} MS"
,
child
.
getBillId
(),
finalTime
-
startTime
);
}
else
{
startTime
=
System
.
currentTimeMillis
();
// 省直属 ,省本级自查
// 直属自查 -> detail里面找
DeviceCheckDetail
childDetail
=
detailRepo
.
findById
(
childBusId
).
get
();
String
unitName
=
childDetail
.
getCheckUnit
();
CheckAreaStatVo
cas
=
parseStatString2Vo
(
child
.
parse2Bto
(),
childDetail
).
stream
()
List
<
CheckAreaStatVo
>
casList
=
parseStatString2Vo
(
child
.
parse2Bto
(),
childDetail
).
stream
()
.
map
(
CheckDeviceStatVo:
:
getAreaStatList
)
.
flatMap
(
checkAreaStatVos
->
checkAreaStatVos
.
stream
())
.
reduce
(
CheckAreaStatVo:
:
combine
)
.
get
();
.
collect
(
toList
());
//自查的areaName要从detail里找
CheckAreaStatVo
cas
;
if
(
casList
.
isEmpty
())
{
cas
=
new
CheckAreaStatVo
(
"默认地区"
,
0
,
0
,
0
,
0
,
0
,
0
);
}
else
{
cas
=
combineCaList
(
casList
,
unitName
);
}
LinkExamDetail
led
=
rev2led
(
endTime
,
cas
.
reverse
());
// 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
,
cas
.
reverse
());
led
.
setCheckUnit
(
unitName
);
ledList
.
add
(
led
);
finalTime
=
System
.
currentTimeMillis
();
log
.
info
(
"[TEST] CHILD BILL ID = {} 的自查任务COST {} MS"
,
child
.
getBillId
(),
finalTime
-
startTime
);
}
}
linkVo
.
setLcDetail
(
lcdList
);
linkVo
.
setLeDetail
(
ledList
);
finalTime
=
System
.
currentTimeMillis
();
log
.
info
(
"[TEST] COST {} MS"
,
finalTime
-
startTime
);
}
// check type = 1 检查页面 看见的是自查
if
(
ctVo
.
getCheckType
()
==
1
)
{
...
...
@@ -227,6 +278,9 @@ public class DeviceCheckController {
List
<
String
>
userNames
=
new
ArrayList
<>();
for
(
String
ca
:
checkArray
)
{
if
(!
ca
.
contains
(
","
))
{
continue
;
}
String
[]
carry
=
ca
.
split
(
","
);
groupNames
.
add
(
carry
[
0
]);
String
uname
=
""
;
...
...
@@ -245,13 +299,28 @@ public class DeviceCheckController {
DeviceCheckDetail
childDetail
=
detailRepo
.
findById
(
childBusId
).
get
();
String
unitName
=
childDetail
.
getCheckUnit
();
CheckAreaStatVo
cas
=
parseStatString2Vo
(
child
.
parse2Bto
(),
childDetail
).
stream
()
List
<
CheckAreaStatVo
>
casList
=
parseStatString2Vo
(
child
.
parse2Bto
(),
childDetail
).
stream
()
.
map
(
CheckDeviceStatVo:
:
getAreaStatList
)
.
flatMap
(
checkAreaStatVos
->
checkAreaStatVos
.
stream
())
.
reduce
(
CheckAreaStatVo:
:
combine
)
.
get
();
.
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
);
}
LinkExamDetail
led
=
rev2led
(
endTime
,
cas
.
reverse
());
//
// CheckAreaStatVo cas = parseStatString2Vo(child.parse2Bto(), childDetail).stream()
// .map(CheckDeviceStatVo::getAreaStatList)
// .flatMap(checkAreaStatVos -> checkAreaStatVos.stream())
// .reduce(CheckAreaStatVo::combine)
// .get();
LinkExamDetail
led
=
rev2led
(
child
,
endTime
,
cas
.
reverse
());
led
.
setCheckUnit
(
unitName
);
//设置名称
...
...
@@ -269,7 +338,7 @@ public class DeviceCheckController {
}
// type = 8 跳转
if
(
type
.
equals
(
CONFIRM_CHECK_DETAIL
.
id
)){
if
(
type
.
equals
(
CONFIRM_CHECK_DETAIL
.
id
))
{
linkVo
.
setType
(
3
);
linkVo
.
setDetailId
(
billId
);
}
...
...
@@ -278,23 +347,30 @@ public class DeviceCheckController {
}
private
LinkCheckDetail
rev2lcd
(
LocalDateTime
endTime
,
RevAreaStat
revAreaStat
)
{
private
LinkCheckDetail
rev2lcd
(
Task
task
,
LocalDateTime
endTime
,
RevAreaStat
revAreaStat
)
{
LinkCheckDetail
lcd
=
new
LinkCheckDetail
();
lcd
.
setId
(
task
.
getBillId
());
//核查情况 无误/有误/逾期
if
(
endTime
.
isBefore
(
LocalDateTime
.
now
()))
{
lcd
.
setCheckSituation
(
"逾期"
);
}
else
if
(
revAreaStat
.
getComSituation
()
==
1
)
{
lcd
.
setCheckSituation
(
"有误"
);
}
else
if
(
revAreaStat
.
getComSituation
()
==
0
)
{
lcd
.
setCheckSituation
(
"无
误
"
);
lcd
.
setCheckSituation
(
"无"
);
}
else
{
lcd
.
setCheckSituation
(
"异常"
);
}
//核查结果
if
(
revAreaStat
.
getComProgress
()
==
0
)
{
if
(
task
.
getBillStatus
()
==
9999
)
{
lcd
.
setCheckResult
(
"完成"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
0
)
{
lcd
.
setCheckResult
(
"未开始"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
1
)
{
lcd
.
setCheckResult
(
"进行中"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
2
&&
task
.
getBillStatus
()
%
10
==
0
)
{
lcd
.
setCheckResult
(
"进行中"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
2
&&
task
.
getBillStatus
()
%
10
==
1
)
{
lcd
.
setCheckResult
(
"进行中"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
2
)
{
lcd
.
setCheckResult
(
"完成"
);
}
...
...
@@ -308,23 +384,31 @@ public class DeviceCheckController {
return
lcd
;
}
private
LinkExamDetail
rev2led
(
LocalDateTime
endTime
,
RevAreaStat
revAreaStat
)
{
private
LinkExamDetail
rev2led
(
Task
task
,
LocalDateTime
endTime
,
RevAreaStat
revAreaStat
)
{
LinkExamDetail
led
=
new
LinkExamDetail
();
led
.
setId
(
task
.
getBillId
());
//核查情况 无误/有误/逾期
if
(
endTime
.
isBefore
(
LocalDateTime
.
now
()))
{
led
.
setCheckSituation
(
"逾期"
);
}
else
if
(
revAreaStat
.
getComSituation
()
==
1
)
{
led
.
setCheckSituation
(
"有误"
);
}
else
if
(
revAreaStat
.
getComSituation
()
==
0
)
{
led
.
setCheckSituation
(
"无
误
"
);
led
.
setCheckSituation
(
"无"
);
}
else
{
led
.
setCheckSituation
(
"异常"
);
}
//核查结果
if
(
revAreaStat
.
getComProgress
()
==
0
)
{
//核查结果 还需要检查任务的当前情况,以防止AB岗中途访问数据导致进度异常
if
(
task
.
getBillStatus
()
==
9999
)
{
led
.
setCheckResult
(
"完成"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
0
)
{
led
.
setCheckResult
(
"未开始"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
1
)
{
led
.
setCheckResult
(
"进行中"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
2
&&
task
.
getBillStatus
()
%
10
==
0
)
{
led
.
setCheckResult
(
"进行中"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
2
&&
task
.
getBillStatus
()
%
10
==
1
)
{
led
.
setCheckResult
(
"进行中"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
2
)
{
led
.
setCheckResult
(
"完成"
);
}
...
...
@@ -397,6 +481,31 @@ public class DeviceCheckController {
return
new
ResultObj
<>(
resultIds
,
"自动核查任务发起成功"
);
}
@ApiOperation
(
value
=
"检查地区是否发起核查"
,
notes
=
"检查地区是否发起核查"
)
@PostMapping
(
"/checkPossible"
)
public
ResponseEntity
checkPossible
(
@RequestBody
UnitIds
uuid
){
List
<
String
>
unitNames
=
uuid
.
getIds
().
stream
()
.
map
(
id
->
auService
.
findOne
(
AuExample
.
UnitId
,
id
))
.
map
(
AreaUnit:
:
getUnitName
)
.
collect
(
toList
());
boolean
findEmpty
=
false
;
String
alertString
=
"["
;
for
(
String
unitName
:
unitNames
)
{
List
<
DeviceLibrary
>
devices
=
deviceRepo
.
findAllByOwnUnit
(
unitName
);
if
(
devices
.
size
()
==
0
){
findEmpty
=
true
;
alertString
+=
unitName
+
" "
;
}
}
alertString
+=
"]"
;
alertString
+=
"单位没有装备数据,请重新勾选!"
;
return
ResponseEntity
.
ok
(
ImmutableMap
.
of
(
"empty"
,
findEmpty
,
"msg"
,
alertString
));
}
@ApiOperation
(
value
=
"发起核查"
,
notes
=
"对指定单位发起核查任务"
)
@PostMapping
(
"/startCheck"
)
public
ResponseEntity
startCheck
(
@RequestBody
CheckCheckVo
ccVO
)
{
...
...
@@ -407,6 +516,8 @@ public class DeviceCheckController {
// 1.发起自己的自查 (市,tpy2=2,省 level = 0,1,2)
// 2.发起自己的检查(只是市级别的 level=2)
List
<
String
>
checkedUnitNames
=
checkedUnits
.
stream
().
map
(
Units:
:
getName
).
collect
(
toList
());
log
.
info
(
"[核查模块]发起核查,发起单位为{},被查单位为{}"
,
startUnit
.
getName
(),
checkedUnitNames
);
// 构建省的统计账单,所有的checkedUnits都要被包含到统计中去
...
...
@@ -551,7 +662,6 @@ public class DeviceCheckController {
DeviceCheckStat
provinceCheckStat
;
//根据examStatId来判断是update还是create 此时初始化的为指定检查区域的数据
DeviceCheckStat
initCheckStat
=
initStatData
(
checkedUnitNames
,
ceVo
.
getTitle
(),
groupUserString
,
0
,
0
,
startUnit
.
getName
(),
checkedUnits
,
ceVo
.
getEndTime
().
atStartOfDay
());
initCheckStat
.
setCheckType
(
CheckType
.
CT_EXAM
);
if
(
ceVo
.
getExamStatId
()
!=
0
)
{
DeviceCheckStat
oriCheckStat
=
statRepo
.
findById
(
ceVo
.
getExamStatId
()).
get
();
oriCheckStat
.
setRemark
(
initCheckStat
.
getRemark
());
...
...
@@ -988,28 +1098,45 @@ public class DeviceCheckController {
// 根这里uuid可以从detail里拿,根据unitId 查到 areaId 根据 areaId 查询到 areaName
String
areaName
=
auService
.
findOne
(
AuExample
.
UnitName
,
detail
.
getCheckUnit
()).
getName
();
// detailId与statId只需要查询一次
int
detailId
=
Optional
.
ofNullable
(
taskRepo
.
findBillIdByTaskId
(
task
.
getId
())).
orElse
(
0
);
int
statId
=
Optional
.
ofNullable
(
taskRepo
.
findBillId
(
task
.
getParentTaskId
(),
CONFIRM_CHECK_STAT
.
id
))
.
orElse
(
0
);
// checkDevice 批量查询做一个MAP缓存
List
<
Integer
>
idList
=
Arrays
.
stream
(
statArray
)
.
filter
(
StringUtils:
:
isNotEmpty
)
.
map
(
s
->
s
.
split
(
"-"
)[
0
])
.
map
(
Integer:
:
parseInt
)
.
collect
(
toList
());
Map
<
Integer
,
DeviceLibrary
>
deviceMap
=
deviceRepo
.
findAllByIdIn
(
idList
)
.
stream
()
.
collect
(
toMap
(
DeviceLibrary:
:
getId
,
Function
.
identity
()));
for
(
String
s
:
statArray
)
{
if
(
StringUtils
.
isEmpty
(
s
))
{
continue
;
}
String
[]
device
=
s
.
split
(
"-"
);
int
deviceId
=
Integer
.
parseInt
(
device
[
0
]);
int
proofResult
=
Integer
.
parseInt
(
device
[
1
]);
DeviceLibrary
checkDevice
=
deviceRepo
.
findById
(
deviceId
).
get
();
// 查询出地区对应的统计账单与详情账单
// 查询出对应的detailId与statId(从fatherTask中获得)
int
detailId
=
Optional
.
ofNullable
(
taskRepo
.
findBillIdByTaskId
(
task
.
getId
())).
orElse
(
0
);
int
statId
=
Optional
.
ofNullable
(
taskRepo
.
findBillId
(
task
.
getParentTaskId
(),
CONFIRM_CHECK_STAT
.
id
))
.
orElse
(
0
);
DeviceLibrary
checkDevice
=
deviceMap
.
get
(
deviceId
);
CheckAreaStatVo
checkAreaStatVo
;
// proofResult 9=(1,1) 1=(2,0) other=(2,1)
// 0缺失1无误2新增3不在库9未检查
if
(
proofResult
==
9
)
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
1
,
1
,
statId
,
detailId
);
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
0
,
0
,
statId
,
detailId
);
}
else
if
(
proofResult
==
3
)
{
//跳过非在库的统计
continue
;
}
else
if
(
proofResult
==
1
)
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
2
,
0
,
statId
,
detailId
);
}
else
if
(
proofResult
==
0
)
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
0
,
1
,
2
,
1
,
statId
,
detailId
);
}
else
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
2
,
1
,
statId
,
detailId
);
}
...
...
@@ -1038,11 +1165,18 @@ public class DeviceCheckController {
.
map
(
units
->
auService
.
findOne
(
AuExample
.
UnitId
,
units
.
getUnitId
()))
.
collect
(
toList
());
Collection
<
CheckDeviceStatVo
>
statVos
=
deviceRepo
.
findAll
()
List
<
CheckDeviceStatVo
>
cdv
=
deviceRepo
.
findAll
()
.
stream
()
.
filter
(
dev
->
unitNameList
.
contains
(
dev
.
getOwnUnit
()))
.
filter
(
dev
->
initUnitNames
.
contains
(
dev
.
getOwnUnit
()))
.
map
(
transUtil:
:
device2InitStatVo
)
.
collect
(
toList
());
Map
<
String
,
List
<
CheckDeviceStatVo
>>
map
=
cdv
.
stream
()
.
collect
(
groupingBy
(
d
->
d
.
getDeviceModel
()
+
d
.
getDeviceName
()));
Collection
<
CheckDeviceStatVo
>
statVos
=
cdv
.
stream
()
.
collect
(
toMap
(
d
->
d
.
getDeviceModel
()
+
d
.
getDeviceName
(),
Function
.
identity
(),
CheckDeviceStatVo:
:
reduce
))
.
values
();
...
...
@@ -1080,10 +1214,14 @@ public class DeviceCheckController {
.
map
(
units
->
auService
.
findOne
(
AuExample
.
UnitId
,
units
.
getUnitId
()))
.
collect
(
toList
());
Collection
<
CheckDeviceStatVo
>
statVos
=
deviceRepo
.
findAll
()
Collection
<
CheckDeviceStatVo
>
statVos
;
List
<
CheckDeviceStatVo
>
cds
=
deviceRepo
.
findAll
()
.
stream
()
.
filter
(
dev
->
unitNameList
.
contains
(
dev
.
getOwnUnit
()))
.
map
(
transUtil:
:
device2InitStatVo
)
.
collect
(
toList
());
statVos
=
cds
.
stream
()
.
collect
(
toMap
(
d
->
d
.
getDeviceModel
()
+
d
.
getDeviceName
(),
Function
.
identity
(),
CheckDeviceStatVo:
:
reduce
))
.
values
();
...
...
@@ -1115,6 +1253,56 @@ public class DeviceCheckController {
private
String
addNode
(
String
originalNode
,
Integer
fatherId
)
{
return
originalNode
+
fatherId
+
"."
;
}
/**
* 合并CheckAreaStatVo对象
*
* @param casList
* @param finalCityName 最终合并用的城市名
* @return
*/
public
CheckAreaStatVo
combineCaList
(
List
<
CheckAreaStatVo
>
casList
,
String
finalCityName
)
{
int
supposeCount
=
0
;
int
actualCount
=
0
;
int
progressCount
=
0
;
int
comSituationCount
=
0
;
final
int
finalProgress
;
final
int
finalSituation
;
for
(
CheckAreaStatVo
v
:
casList
)
{
supposeCount
+=
v
.
getSupposeCount
();
actualCount
+=
v
.
getActualCount
();
progressCount
+=
v
.
getComProgress
();
comSituationCount
=
v
.
getComSituation
();
}
//comprogress合并逻辑 if all 0->0 2->2 else 1
boolean
isDone
=
casList
.
stream
()
.
mapToInt
(
CheckAreaStatVo:
:
getComProgress
)
.
allMatch
(
value
->
value
==
2
);
if
(
progressCount
==
0
)
{
finalProgress
=
0
;
}
else
if
(
isDone
)
{
finalProgress
=
2
;
}
else
{
finalProgress
=
1
;
}
// comsitution 合并逻辑 0->0 , 1->1 , 0,1->1
if
(
comSituationCount
==
0
)
{
finalSituation
=
0
;
}
else
{
finalSituation
=
1
;
}
return
new
CheckAreaStatVo
(
finalCityName
,
actualCount
,
supposeCount
,
finalProgress
,
finalSituation
,
0
,
0
);
}
}
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/CheckAreaStatVo.java
浏览文件 @
7ae59048
...
...
@@ -7,6 +7,7 @@ import lombok.experimental.Accessors;
import
org.springframework.objenesis.ObjenesisHelper
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
/**
* CheckAreaStatVo.
...
...
@@ -173,19 +174,7 @@ public class CheckAreaStatVo implements Cloneable {
return
this
;
}
public
CheckAreaStatVo
combine
(
CheckAreaStatVo
other
)
{
this
.
areaName
=
other
.
getAreaName
();
this
.
supposeCount
+=
other
.
getSupposeCount
();
this
.
actualCount
+=
other
.
getActualCount
();
if
(
other
.
comProgress
==
1
){
this
.
comProgress
=
1
;
}
if
(
other
.
comSituation
==
1
){
this
.
comSituation
=
1
;
}
return
this
;
}
public
RevAreaStat
reverse
(){
return
new
RevAreaStat
(
areaName
,
actualCount
,
supposeCount
,
comProgress
,
comSituation
);
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/CheckDeviceStatVo.java
浏览文件 @
7ae59048
...
...
@@ -113,14 +113,18 @@ public class CheckDeviceStatVo implements Cloneable {
return
mergeVo
;
}
//将目前已有的地区制作成map areaMap里是杭州市 other是西湖区
Map
<
String
,
CheckAreaStatVo
>
areaMap
=
mergeVo
.
areaStatList
.
stream
()
.
collect
(
toMap
(
CheckAreaStatVo:
:
getAreaName
,
Function
.
identity
()));
for
(
CheckAreaStatVo
otherArea
:
other
.
getAreaStatList
())
{
//如果原来的没有则添加,否则累加
if
(!
areaMap
.
containsKey
(
otherArea
.
getAreaName
()))
{
areaMap
.
putIfAbsent
(
otherArea
.
getAreaName
(),
otherArea
);
}
else
{
areaMap
.
computeIfPresent
(
otherArea
.
getAreaName
(),
(
k
,
v
)
->
v
.
reduce
(
otherArea
));
}
}
mergeVo
.
areaStatList
=
new
ArrayList
<>(
areaMap
.
values
());
return
mergeVo
;
...
...
@@ -153,8 +157,11 @@ public class CheckDeviceStatVo implements Cloneable {
for
(
CheckAreaStatVo
otherArea
:
other
.
getAreaStatList
())
{
//如果原来的没有则添加,否则累加
if
(!
areaMap
.
containsKey
(
otherArea
.
getAreaName
()))
{
areaMap
.
putIfAbsent
(
otherArea
.
getAreaName
(),
otherArea
);
areaMap
.
computeIfPresent
(
otherArea
.
getAreaName
(),
(
k
,
v
)
->
v
.
cleanReduce
(
otherArea
));
}
else
{
areaMap
.
computeIfPresent
(
otherArea
.
getAreaName
(),
(
k
,
v
)
->
v
.
reduce
(
otherArea
));
}
}
mergeVo
.
areaStatList
=
new
ArrayList
<>(
areaMap
.
values
());
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/CheckStatVo.java
浏览文件 @
7ae59048
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.tykj.dev.device.confirmcheck.common.CheckType
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat
;
import
com.tykj.dev.misc.base.BeanHelper
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
...
...
@@ -64,7 +65,7 @@ public class CheckStatVo {
private
LocalDateTime
updateTime
;
@ApiModelProperty
(
name
=
"检查类型(0
异常,1自动,2手动
)"
)
@ApiModelProperty
(
name
=
"检查类型(0
核查 1检查
)"
)
private
Integer
checkType
;
private
Integer
createUserId
;
...
...
@@ -134,6 +135,18 @@ public class CheckStatVo {
//数据转JSON并赋值
String
jsonString
=
JacksonUtil
.
toJSon
(
this
.
deviceStatVoList
);
initialStat
.
setStatInfo
(
jsonString
);
if
(
this
.
checkType
==
0
){
initialStat
.
setCheckType
(
CheckType
.
CT_CHECK
);
}
else
if
(
this
.
checkType
==
1
){
initialStat
.
setCheckType
(
CheckType
.
CT_EXAM
);
}
else
{
try
{
throw
new
Exception
(
"[核查模块] 见到异常的checktype类型!id= "
+
this
.
checkType
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
initialStat
;
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/LinkCheckDetail.java
浏览文件 @
7ae59048
...
...
@@ -15,6 +15,11 @@ import lombok.NoArgsConstructor;
@Data
public
class
LinkCheckDetail
{
/**
* 检查业务ID
*/
private
Integer
id
;
private
String
checkUnit
;
private
String
checkSituation
;
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/LinkExamDetail.java
浏览文件 @
7ae59048
...
...
@@ -15,6 +15,11 @@ import lombok.NoArgsConstructor;
@Data
public
class
LinkExamDetail
{
/**
* 自查业务ID
*/
private
Integer
id
;
/**
* 检查组名称
*/
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/LinkVo.java
浏览文件 @
7ae59048
...
...
@@ -25,10 +25,21 @@ public class LinkVo {
*/
private
int
type
;
/**
* 核查/检查总标题
*/
private
String
title
;
private
LocalDate
endTime
;
/**
* 里面装的都是检查数据
*/
private
List
<
LinkCheckDetail
>
lcDetail
;
/**
* 里面装的都是自查数据
*/
private
List
<
LinkExamDetail
>
leDetail
;
private
int
detailId
;
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/UnitIds.java
0 → 100644
浏览文件 @
7ae59048
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
* UnitIds.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/5/17 at 1:31 上午
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
UnitIds
{
private
List
<
Integer
>
ids
;
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/utils/ObjTransUtil.java
浏览文件 @
7ae59048
...
...
@@ -3,6 +3,7 @@ package com.tykj.dev.device.confirmcheck.utils;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.google.common.collect.Lists
;
import
com.tykj.dev.device.confirmcheck.common.CheckType
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckBill
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckStat
;
...
...
@@ -13,6 +14,7 @@ import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import
com.tykj.dev.device.packing.service.PackingLibraryService
;
import
com.tykj.dev.device.task.repository.TaskDao
;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.task.subject.domin.Task
;
import
com.tykj.dev.device.user.base.enums.AuExample
;
import
com.tykj.dev.device.user.subject.dao.AreaDao
;
...
...
@@ -125,8 +127,8 @@ public class ObjTransUtil {
// 构建完成情况参数 未完成数量/总数
// 获得当前节点的子节点总数 = 总数 其中状态为9999的为已完成
Integer
fatherTaskId
=
taskService
.
get
(
stat
.
getId
(),
BusinessEnum
.
CONFIRM_CHECK_STAT
.
id
)
.
getId
();
TaskBto
fatherTask
=
taskService
.
get
(
stat
.
getId
(),
BusinessEnum
.
CONFIRM_CHECK_STAT
.
id
);
Integer
fatherTaskId
=
fatherTask
.
getId
();
List
<
Task
>
childTasks
=
taskDao
.
findAllByParentTaskId
(
fatherTaskId
);
long
total
=
childTasks
.
size
();
...
...
@@ -135,10 +137,14 @@ public class ObjTransUtil {
.
filter
(
task
->
task
.
getBillStatus
().
equals
(
9999
))
.
count
();
//如果是检查统计的话那么还要看一下他的父节点是不是已经完成了
String
completion
;
if
(
done
==
total
)
{
if
(
stat
.
getCheckType
()
==
CheckType
.
CT_EXAM
&&
!
fatherTask
.
getBillStatus
().
equals
(
9999
))
{
completion
=
"核查完成待办结"
;
}
else
{
completion
=
"核查完成"
;
}
}
else
{
completion
=
done
+
"/"
+
total
;
}
...
...
@@ -191,6 +197,7 @@ public class ObjTransUtil {
initialStat
.
setDeviceStatVoList
(
Arrays
.
asList
(
checkDeviceStatVos
));
initialStat
.
setCheckUserAName
(
userAName
);
initialStat
.
setCheckUserBName
(
userBName
);
initialStat
.
setCheckType
(
statDo
.
getCheckType
().
getId
());
return
initialStat
;
}
...
...
@@ -219,8 +226,8 @@ public class ObjTransUtil {
}
/**
*
* 这里不考虑不在库的装备
*
* @param inLibrary
* @param notInLibrary
* @return
...
...
@@ -312,7 +319,7 @@ public class ObjTransUtil {
detailVo
.
setRemark
(
detailDo
.
getRemark
());
//核查签字单
if
(
detailDo
.
getCheckFiles
()
!=
null
)
{
if
(
detailDo
.
getCheckFiles
()
!=
null
)
{
detailVo
.
setCheckFileList
(
FilesUtil
.
stringFileToList
(
detailDo
.
getCheckFiles
()));
}
return
detailVo
;
...
...
dev-library/src/main/java/com/tykj/dev/device/library/repository/DeviceLibraryDao.java
浏览文件 @
7ae59048
...
...
@@ -17,6 +17,10 @@ import java.util.List;
@SuppressWarnings
(
"SqlResolve"
)
public
interface
DeviceLibraryDao
extends
JpaRepository
<
DeviceLibrary
,
Integer
>,
JpaSpecificationExecutor
<
DeviceLibrary
>
{
List
<
DeviceLibrary
>
findAllByOwnUnit
(
String
ownUnit
);
List
<
DeviceLibrary
>
findAllByIdIn
(
List
<
Integer
>
ids
);
List
<
DeviceLibrary
>
getAllByModel
(
String
model
);
List
<
DeviceLibrary
>
getAllByOwnUnit
(
String
unit
);
...
...
dev-task/src/main/java/com/tykj/dev/device/task/service/impl/TaskServiceImpl.java
浏览文件 @
7ae59048
...
...
@@ -1156,8 +1156,8 @@ public class TaskServiceImpl implements TaskService {
});
}
}
if
(!
ids
.
contains
(
userId
)){
throw
new
ApiException
(
ResponseEntity
.
status
(
50000
).
body
(
"当前用户不能操作此任务"
));
}
//
if (!ids.contains(userId)){
//
throw new ApiException(ResponseEntity.status(50000).body("当前用户不能操作此任务"));
//
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论