Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
44e3e709
提交
44e3e709
authored
4月 29, 2021
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[核查模块] 增加了核查时对省本直,省直属,以及市的发起自查的功能
上级
2f07bee9
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
73 行增加
和
12 行删除
+73
-12
UnitAreaBean.java
...com/tykj/dev/device/confirmcheck/common/UnitAreaBean.java
+4
-2
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+64
-6
CheckCheckVo.java
.../tykj/dev/device/confirmcheck/entity/vo/CheckCheckVo.java
+2
-2
BaseTest.java
dev-union/src/test/java/com/tykj/dev/union/BaseTest.java
+2
-1
AuServiceImpl.java
...j/dev/device/user/subject/service/impl/AuServiceImpl.java
+1
-1
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/common/UnitAreaBean.java
浏览文件 @
44e3e709
...
@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.Arrays
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -30,10 +31,11 @@ public class UnitAreaBean {
...
@@ -30,10 +31,11 @@ public class UnitAreaBean {
@Bean
(
name
=
"unMap"
)
@Bean
(
name
=
"unMap"
)
public
Map
<
String
,
AreaUnit
>
unitNameMap
()
{
public
Map
<
String
,
AreaUnit
>
unitNameMap
()
{
return
unitsDao
.
findAll
().
stream
()
return
unitsDao
.
findAll
().
stream
()
.
filter
(
units
->
units
.
getType
()
==
1
)
//
.filter(units -> units.getType() == 1)
.
map
(
unit
->
{
.
map
(
unit
->
{
int
areaId
=
unitsDao
.
findAreaIdByName
(
unit
.
getName
());
int
areaId
=
unitsDao
.
findAreaIdByName
(
unit
.
getName
());
Area
area
=
areaDao
.
findById
(
areaId
).
get
();
Area
area
=
areaDao
.
findById
(
areaId
)
.
orElse
(
new
Area
(
0
,
"无地区归属"
,
9999
,
"9999"
,
0
,
""
));
return
new
AreaUnit
(
area
,
unit
);
return
new
AreaUnit
(
area
,
unit
);
}).
collect
(
Collectors
.
toMap
(
AreaUnit:
:
getUnitName
,
Function
.
identity
()));
}).
collect
(
Collectors
.
toMap
(
AreaUnit:
:
getUnitName
,
Function
.
identity
()));
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
44e3e709
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.confirmcheck.controller;
...
@@ -2,6 +2,7 @@ package com.tykj.dev.device.confirmcheck.controller;
import
com.github.wenhao.jpa.Specifications
;
import
com.github.wenhao.jpa.Specifications
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.Lists
;
import
com.tykj.dev.config.GlobalMap
;
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
;
...
@@ -52,6 +53,7 @@ import java.time.LocalDateTime;
...
@@ -52,6 +53,7 @@ import java.time.LocalDateTime;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
static
com
.
tykj
.
dev
.
misc
.
base
.
BusinessEnum
.
CONFIRM_CHECK_DETAIL
;
import
static
com
.
tykj
.
dev
.
misc
.
base
.
BusinessEnum
.
CONFIRM_CHECK_DETAIL
;
import
static
com
.
tykj
.
dev
.
misc
.
base
.
BusinessEnum
.
CONFIRM_CHECK_STAT
;
import
static
com
.
tykj
.
dev
.
misc
.
base
.
BusinessEnum
.
CONFIRM_CHECK_STAT
;
...
@@ -105,6 +107,16 @@ public class DeviceCheckController {
...
@@ -105,6 +107,16 @@ public class DeviceCheckController {
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
areaRepo
.
findByFatherId
(
fatherId
)));
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
areaRepo
.
findByFatherId
(
fatherId
)));
}
}
/**
* @return level = 0 ,1 ,2 的单位
*/
@GetMapping
(
"/unit"
)
@ApiOperation
(
value
=
"查询默认的可以被核查单位的清单(省本直,省直属,市局)"
)
public
ResponseEntity
findDefaultUnits
()
{
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
unitsRepo
.
findAllByLevelIn
(
Lists
.
newArrayList
(
0
,
1
,
2
))));
}
@ApiOperation
(
value
=
"根据id查询核查统计数据"
,
notes
=
"可以通过这个接口查询核查统计数据"
)
@ApiOperation
(
value
=
"根据id查询核查统计数据"
,
notes
=
"可以通过这个接口查询核查统计数据"
)
@GetMapping
(
"/stat/{id}"
)
@GetMapping
(
"/stat/{id}"
)
public
CheckStatVo
findStatById
(
@PathVariable
Integer
id
)
{
public
CheckStatVo
findStatById
(
@PathVariable
Integer
id
)
{
...
@@ -191,17 +203,19 @@ public class DeviceCheckController {
...
@@ -191,17 +203,19 @@ public class DeviceCheckController {
return
new
ResultObj
<>(
resultIds
,
"自动核查任务发起成功"
);
return
new
ResultObj
<>(
resultIds
,
"自动核查任务发起成功"
);
}
}
@ApiOperation
(
value
=
"发起核查"
,
notes
=
"对指定单位发起核查任务"
)
@ApiOperation
(
value
=
"发起核查"
,
notes
=
"对指定地区发起核查任务"
)
@PostMapping
(
"/startCheck"
)
@PostMapping
(
"/startCheck"
)
public
ResponseEntity
startCheck
(
@RequestBody
CheckCheckVo
ccVO
)
{
public
ResponseEntity
startCheck
(
@RequestBody
CheckCheckVo
ccVO
)
{
//构建省的统计账单
//
构建省的统计账单
Integer
startUnitId
=
ccVO
.
getUnitId
();
Integer
startUnitId
=
ccVO
.
getUnitId
();
Units
startUnit
=
unitsRepo
.
findById
(
startUnitId
).
get
();
Units
startUnit
=
unitsRepo
.
findById
(
startUnitId
).
get
();
List
<
Units
>
checkedUnits
=
unitsRepo
.
findByAreaIdIn
(
ccVO
.
getAreaRange
());
List
<
Units
>
checkedUnits
=
unitsRepo
.
findAllById
(
ccVO
.
getUnitRange
());
// 1.发起自己的自查 (市,tpy2=2,省 level = 0,1,2)
// 2.发起自己的检查(只是市级别的 level=2)
List
<
String
>
checkedUnitNames
=
checkedUnits
.
stream
().
map
(
Units:
:
getName
).
collect
(
toList
());
List
<
String
>
checkedUnitNames
=
checkedUnits
.
stream
().
map
(
Units:
:
getName
).
collect
(
toList
());
log
.
info
(
"[核查模块]发起核查,发起单位为{},被查单位为{}"
,
startUnit
.
getName
(),
checkedUnitNames
);
log
.
info
(
"[核查模块]发起核查,发起单位为{},被查单位为{}"
,
startUnit
.
getName
(),
checkedUnitNames
);
// 构建省的统计账单,所有的checkedUnits都要被包含到统计中去
DeviceCheckStat
provinceCheckStat
=
initStatData
(
ccVO
.
getTitle
(),
ccVO
.
getRemark
(),
0
,
0
,
startUnit
.
getName
(),
checkedUnits
,
ccVO
.
getEndTime
().
atStartOfDay
());
DeviceCheckStat
provinceCheckStat
=
initStatData
(
ccVO
.
getTitle
(),
ccVO
.
getRemark
(),
0
,
0
,
startUnit
.
getName
(),
checkedUnits
,
ccVO
.
getEndTime
().
atStartOfDay
());
Integer
statId
=
statRepo
.
save
(
provinceCheckStat
).
getId
();
Integer
statId
=
statRepo
.
save
(
provinceCheckStat
).
getId
();
List
<
CheckDeviceStatVo
>
deviceStatVos
=
Arrays
.
stream
(
List
<
CheckDeviceStatVo
>
deviceStatVos
=
Arrays
.
stream
(
...
@@ -217,8 +231,52 @@ public class DeviceCheckController {
...
@@ -217,8 +231,52 @@ public class DeviceCheckController {
provStatTask
.
setCustomInfo
(
"check"
);
provStatTask
.
setCustomInfo
(
"check"
);
provStatTask
=
taskService
.
start
(
provStatTask
);
provStatTask
=
taskService
.
start
(
provStatTask
);
//构建市的检查任务
// 构建自查任务(levl = 0,1,2)
for
(
Units
unit
:
checkedUnits
)
{
List
<
Units
>
selfCheckUnits
=
checkedUnits
.
stream
()
.
filter
(
units
->
Arrays
.
asList
(
0
,
1
,
2
).
contains
(
units
.
getLevel
()))
.
collect
(
toList
());
// 获取所有在库装备与不在库装备
Map
<
String
,
List
<
DeviceLibrary
>>
devInLib
=
deviceRepo
.
findAll
().
stream
()
.
filter
(
device
->
device
.
getOwnUnit
().
equals
(
device
.
getLocationUnit
()))
.
collect
(
groupingBy
(
DeviceLibrary:
:
getOwnUnit
));
Map
<
String
,
List
<
DeviceLibrary
>>
devNotInLib
=
deviceRepo
.
findAll
().
stream
()
.
filter
(
device
->
!
device
.
getOwnUnit
().
equals
(
device
.
getLocationUnit
()))
.
collect
(
groupingBy
(
DeviceLibrary:
:
getOwnUnit
));
User
loginUser
=
authenticationUtils
.
getAuthentication
().
getCurrentUserInfo
();
for
(
Units
unit
:
selfCheckUnits
)
{
//核查组成员名称用当前登录用户
String
names
=
loginUser
.
getName
();
// 3-1 构建被查单位的 自查账单
DeviceCheckDetail
unitDetailDoc
=
DeviceCheckDetail
.
EmptyWithChecker
(
names
+
"|"
+
"默认备注"
,
"默认标题"
,
0
,
0
,
0
,
0
,
unit
.
getName
(),
devInLib
.
getOrDefault
(
unit
.
getName
(),
new
ArrayList
<>()),
devNotInLib
.
getOrDefault
(
unit
.
getName
(),
new
ArrayList
<>()));
DeviceCheckDetail
detail
=
detailRepo
.
save
(
unitDetailDoc
);
// 将id放入统计中去 model -> areaName -> detailId
String
areaName
=
auService
.
findOne
(
AuExample
.
UnitId
,
unit
.
getUnitId
()).
getName
();
for
(
CheckDeviceStatVo
statVo
:
deviceStatVos
)
{
for
(
CheckAreaStatVo
asv
:
statVo
.
getAreaStatList
())
{
if
(
asv
.
getAreaName
().
equals
(
areaName
))
{
asv
.
setAreaStatId
(
statId
);
asv
.
setAreaDetailId
(
detail
.
getId
());
}
}
}
// 3-2 构建被查单位的 自查任务 (根据被查单位的级别来区分是县级状态是市级状态) 这里的父级任务应该是省统计
TaskBto
checkedTask
=
new
TaskBto
(
CHECK_EXAM_DETAIL_0
.
id
,
"自核查任务"
,
provStatTask
.
getId
(),
addNode
(
provStatTask
.
getNodeIdDetail
(),
provStatTask
.
getId
()),
CONFIRM_CHECK_DETAIL
.
id
,
detail
.
getId
(),
unit
.
getUnitId
(),
0
);
checkedTask
.
setCustomInfo
(
"manual"
);
taskService
.
start
(
checkedTask
);
}
//构建市的检查任务(level=2)
List
<
Units
>
examCheckUnits
=
checkedUnits
.
stream
()
.
filter
(
units
->
Arrays
.
asList
(
2
).
contains
(
units
.
getLevel
()))
.
collect
(
toList
());
for
(
Units
unit
:
examCheckUnits
)
{
//构建市的统计账单
//构建市的统计账单
String
cityTitle
=
unit
.
getName
()
+
"检查统计"
;
String
cityTitle
=
unit
.
getName
()
+
"检查统计"
;
DeviceCheckStat
cityCheckStat
=
initStatData
(
cityTitle
,
ccVO
.
getRemark
(),
0
,
0
,
unit
.
getName
(),
Collections
.
emptyList
(),
ccVO
.
getEndTime
().
atStartOfDay
());
DeviceCheckStat
cityCheckStat
=
initStatData
(
cityTitle
,
ccVO
.
getRemark
(),
0
,
0
,
unit
.
getName
(),
Collections
.
emptyList
(),
ccVO
.
getEndTime
().
atStartOfDay
());
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/CheckCheckVo.java
浏览文件 @
44e3e709
...
@@ -29,8 +29,8 @@ public class CheckCheckVo {
...
@@ -29,8 +29,8 @@ public class CheckCheckVo {
@ApiModelProperty
(
name
=
"发起单位id"
)
@ApiModelProperty
(
name
=
"发起单位id"
)
private
Integer
unitId
;
private
Integer
unitId
;
@ApiModelProperty
(
name
=
"被核查的
区域
id集合"
)
@ApiModelProperty
(
name
=
"被核查的
单位
id集合"
)
private
List
<
Integer
>
area
Range
;
private
List
<
Integer
>
unit
Range
;
@ApiModelProperty
(
name
=
"备注"
)
@ApiModelProperty
(
name
=
"备注"
)
private
String
remark
;
private
String
remark
;
...
...
dev-union/src/test/java/com/tykj/dev/union/BaseTest.java
浏览文件 @
44e3e709
...
@@ -14,5 +14,6 @@ import org.springframework.test.context.junit4.SpringRunner;
...
@@ -14,5 +14,6 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
classes
=
UnionApplication
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
@SpringBootTest
(
classes
=
UnionApplication
.
class
,
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
)
@AutoConfigureMockMvc
@AutoConfigureMockMvc
public
class
BaseTest
{
public
class
BaseTest
{
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/AuServiceImpl.java
浏览文件 @
44e3e709
...
@@ -78,7 +78,7 @@ public class AuServiceImpl implements AuService {
...
@@ -78,7 +78,7 @@ public class AuServiceImpl implements AuService {
.
eq
(
Objects
.
nonNull
(
value
),
example
.
getFieldName
(),
value
)
.
eq
(
Objects
.
nonNull
(
value
),
example
.
getFieldName
(),
value
)
.
build
();
.
build
();
Units
units
=
unitsRepo
.
findOne
(
pred
).
get
();
Units
units
=
unitsRepo
.
findOne
(
pred
).
get
();
Area
area
=
areaRepo
.
findById
(
units
.
getAreaId
()).
get
(
);
Area
area
=
areaRepo
.
findById
(
units
.
getAreaId
()).
orElse
(
new
Area
(
0
,
"无地区归属"
,
9999
,
"9999"
,
0
,
""
)
);
return
new
AreaUnit
(
area
,
units
);
return
new
AreaUnit
(
area
,
units
);
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论