Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
eea9b06b
提交
eea9b06b
authored
5月 13, 2021
作者:
Matrix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[核查模块] 重构了统一跳转的接口
上级
a93f8d7d
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
388 行增加
和
9 行删除
+388
-9
CheckType.java
...va/com/tykj/dev/device/confirmcheck/common/CheckType.java
+2
-2
DeviceCheckController.java
...device/confirmcheck/controller/DeviceCheckController.java
+198
-2
CheckAreaStatVo.java
...kj/dev/device/confirmcheck/entity/vo/CheckAreaStatVo.java
+46
-5
LinkCheckDetail.java
...kj/dev/device/confirmcheck/entity/vo/LinkCheckDetail.java
+25
-0
LinkExamDetail.java
...ykj/dev/device/confirmcheck/entity/vo/LinkExamDetail.java
+35
-0
LinkVo.java
...va/com/tykj/dev/device/confirmcheck/entity/vo/LinkVo.java
+40
-0
RevAreaStat.java
...m/tykj/dev/device/confirmcheck/entity/vo/RevAreaStat.java
+42
-0
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/common/CheckType.java
浏览文件 @
eea9b06b
...
...
@@ -16,11 +16,11 @@ public enum CheckType {
/**
* 自动核查
*/
CT_CHECK
(
1
,
"核查"
),
CT_CHECK
(
0
,
"核查"
),
/**
* 手动核查
*/
CT_EXAM
(
2
,
"检查"
);
CT_EXAM
(
1
,
"检查"
);
private
final
Integer
id
;
private
final
String
name
;
...
...
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/controller/DeviceCheckController.java
浏览文件 @
eea9b06b
...
...
@@ -33,6 +33,7 @@ import com.tykj.dev.device.user.subject.entity.User;
import
com.tykj.dev.device.user.subject.entity.bto.AreaUnit
;
import
com.tykj.dev.device.user.subject.service.AuService
;
import
com.tykj.dev.device.user.util.AuthenticationUtils
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.base.ResultObj
;
import
com.tykj.dev.misc.base.StatusEnum
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
...
...
@@ -144,6 +145,200 @@ public class DeviceCheckController {
return
ResponseEntity
.
ok
(
new
ResultObj
<>(
detailVoList
));
}
@ApiOperation
(
value
=
"统一跳转接口"
,
notes
=
"可以通过这个接口进行跳转"
)
@GetMapping
(
"/link"
)
public
ResponseEntity
unionLink
(
@RequestParam
Integer
type
,
@RequestParam
Integer
billId
)
{
LinkVo
linkVo
=
new
LinkVo
();
//type = 7 统计
if
(
type
.
equals
(
CONFIRM_CHECK_STAT
.
id
))
{
DeviceCheckStat
ct
=
statRepo
.
findById
(
billId
).
get
();
CheckStatVo
ctVo
=
transUtil
.
checkStatDo2Vo
(
ct
);
LocalDateTime
endTime
=
ctVo
.
getEndTime
();
linkVo
.
setEndTime
(
ctVo
.
getEndTime
().
toLocalDate
());
List
<
LinkCheckDetail
>
lcdList
=
new
ArrayList
<>();
List
<
LinkExamDetail
>
ledList
=
new
ArrayList
<>();
// check type = 0 核查页面 看见的是市检查与省直属自查
if
(
ctVo
.
getCheckType
()
==
0
)
{
linkVo
.
setType
(
1
);
// 根据tpye和billId找到父级节点
Task
rootTask
=
taskRepo
.
findAllByBillIdAndBusinessType
(
billId
,
type
).
get
(
0
);
// 找到所有的子节点
List
<
Task
>
childTask
=
taskRepo
.
findAllByParentTaskId
(
rootTask
.
getId
());
for
(
Task
child
:
childTask
)
{
Integer
childBusType
=
child
.
getBusinessType
();
Integer
childBusId
=
child
.
getBillId
();
if
(
childBusType
.
equals
(
CONFIRM_CHECK_STAT
.
id
))
{
//市检查
Integer
unitId
=
child
.
getOwnUnit
();
String
unitName
=
unitsRepo
.
findById
(
unitId
).
get
().
getName
();
DeviceCheckStat
cdc
=
statRepo
.
findById
(
child
.
getBillId
()).
get
();
CheckStatVo
cdcVo
=
transUtil
.
checkStatDo2Vo
(
cdc
);
if
(
cdcVo
.
getDeviceStatVoList
().
size
()
==
0
)
{
LinkCheckDetail
lcd
=
new
LinkCheckDetail
(
"默认"
,
"无误"
,
"未开始"
,
0
);
lcd
.
setCheckUnit
(
unitName
);
lcdList
.
add
(
lcd
);
}
else
{
CheckAreaStatVo
cas
=
cdcVo
.
getDeviceStatVoList
().
stream
()
.
map
(
CheckDeviceStatVo:
:
getAreaStatList
)
.
flatMap
(
checkAreaStatVos
->
checkAreaStatVos
.
stream
())
.
reduce
(
CheckAreaStatVo:
:
combine
)
.
get
();
LinkCheckDetail
lcd
=
rev2lcd
(
endTime
,
cas
.
reverse
());
lcd
.
setCheckUnit
(
unitName
);
lcdList
.
add
(
lcd
);
}
}
else
{
// 省直属 ,省本级自查
// 直属自查 -> detail里面找
DeviceCheckDetail
childDetail
=
detailRepo
.
findById
(
childBusId
).
get
();
String
unitName
=
childDetail
.
getCheckUnit
();
CheckAreaStatVo
cas
=
parseStatString2Vo
(
child
.
parse2Bto
(),
childDetail
).
stream
()
.
map
(
CheckDeviceStatVo:
:
getAreaStatList
)
.
flatMap
(
checkAreaStatVos
->
checkAreaStatVos
.
stream
())
.
reduce
(
CheckAreaStatVo:
:
combine
)
.
get
();
LinkExamDetail
led
=
rev2led
(
endTime
,
cas
.
reverse
());
led
.
setCheckUnit
(
unitName
);
ledList
.
add
(
led
);
}
}
linkVo
.
setLcDetail
(
lcdList
);
linkVo
.
setLeDetail
(
ledList
);
}
// check type = 1 检查页面 看见的是自查
if
(
ctVo
.
getCheckType
()
==
1
)
{
linkVo
.
setType
(
2
);
//看到的都是自查 根据tpye和billId找到父级节点
Task
rootTask
=
taskRepo
.
findAllByBillIdAndBusinessType
(
billId
,
type
).
get
(
0
);
// 找到所有的子节点
List
<
Task
>
childTask
=
taskRepo
.
findAllByParentTaskId
(
rootTask
.
getId
());
//核查组成员和名称 找到父亲级节点 然后找到父节点的统计节点
String
[]
checkArray
=
ctVo
.
getRemark
().
split
(
"|"
);
// x,a |x ,b
List
<
String
>
groupNames
=
new
ArrayList
<>();
List
<
String
>
userNames
=
new
ArrayList
<>();
for
(
String
ca
:
checkArray
)
{
String
[]
carry
=
ca
.
split
(
","
);
groupNames
.
add
(
carry
[
0
]);
String
uname
=
""
;
for
(
int
i
=
1
;
i
<
carry
.
length
;
i
++)
{
uname
+=
carry
[
i
]
+
" "
;
}
userNames
.
add
(
uname
);
}
// 检查的节点都是自查
int
i
=
0
;
for
(
Task
child
:
childTask
)
{
Integer
childBusType
=
child
.
getBusinessType
();
Integer
childBusId
=
child
.
getBillId
();
DeviceCheckDetail
childDetail
=
detailRepo
.
findById
(
childBusId
).
get
();
String
unitName
=
childDetail
.
getCheckUnit
();
CheckAreaStatVo
cas
=
parseStatString2Vo
(
child
.
parse2Bto
(),
childDetail
).
stream
()
.
map
(
CheckDeviceStatVo:
:
getAreaStatList
)
.
flatMap
(
checkAreaStatVos
->
checkAreaStatVos
.
stream
())
.
reduce
(
CheckAreaStatVo:
:
combine
)
.
get
();
LinkExamDetail
led
=
rev2led
(
endTime
,
cas
.
reverse
());
led
.
setCheckUnit
(
unitName
);
//设置名称
led
.
setExamName
(
groupNames
.
get
(
i
));
led
.
setExamUser
(
userNames
.
get
(
i
));
ledList
.
add
(
led
);
i
++;
}
i
=
0
;
linkVo
.
setLcDetail
(
lcdList
);
}
}
// type = 8 跳转
if
(
type
.
equals
(
CONFIRM_CHECK_DETAIL
.
id
)){
linkVo
.
setType
(
3
);
linkVo
.
setDetailId
(
billId
);
}
return
ResponseEntity
.
ok
(
linkVo
);
}
private
LinkCheckDetail
rev2lcd
(
LocalDateTime
endTime
,
RevAreaStat
revAreaStat
)
{
LinkCheckDetail
lcd
=
new
LinkCheckDetail
();
//核查情况 无误/有误/逾期
if
(
endTime
.
isBefore
(
LocalDateTime
.
now
()))
{
lcd
.
setCheckSituation
(
"逾期"
);
}
else
if
(
revAreaStat
.
getComSituation
()
==
1
)
{
lcd
.
setCheckSituation
(
"有误"
);
}
else
if
(
revAreaStat
.
getComSituation
()
==
0
)
{
lcd
.
setCheckSituation
(
"无误"
);
}
else
{
lcd
.
setCheckSituation
(
"异常"
);
}
//核查结果
if
(
revAreaStat
.
getComProgress
()
==
0
)
{
lcd
.
setCheckResult
(
"未开始"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
1
)
{
lcd
.
setCheckResult
(
"进行中"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
2
)
{
lcd
.
setCheckResult
(
"完成"
);
}
//核查单位名
lcd
.
setCheckUnit
(
revAreaStat
.
getAreaName
()
+
"局"
);
//备注判断 新增缺失
lcd
.
setRemark
(
revAreaStat
.
getActualCount
()
-
revAreaStat
.
getSupposeCount
());
return
lcd
;
}
private
LinkExamDetail
rev2led
(
LocalDateTime
endTime
,
RevAreaStat
revAreaStat
)
{
LinkExamDetail
led
=
new
LinkExamDetail
();
//核查情况 无误/有误/逾期
if
(
endTime
.
isBefore
(
LocalDateTime
.
now
()))
{
led
.
setCheckSituation
(
"逾期"
);
}
else
if
(
revAreaStat
.
getComSituation
()
==
1
)
{
led
.
setCheckSituation
(
"有误"
);
}
else
if
(
revAreaStat
.
getComSituation
()
==
0
)
{
led
.
setCheckSituation
(
"无误"
);
}
else
{
led
.
setCheckSituation
(
"异常"
);
}
//核查结果
if
(
revAreaStat
.
getComProgress
()
==
0
)
{
led
.
setCheckResult
(
"未开始"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
1
)
{
led
.
setCheckResult
(
"进行中"
);
}
else
if
(
revAreaStat
.
getComProgress
()
==
2
)
{
led
.
setCheckResult
(
"完成"
);
}
//核查单位名
led
.
setCheckUnit
(
revAreaStat
.
getAreaName
()
+
"局"
);
//备注判断 新增缺失
led
.
setRemark
(
revAreaStat
.
getActualCount
()
-
revAreaStat
.
getSupposeCount
());
return
led
;
}
/**
* @param periodId 1-月度 2-季度 3-年度
* @return
...
...
@@ -356,6 +551,7 @@ 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
());
...
...
@@ -809,10 +1005,10 @@ public class DeviceCheckController {
if
(
proofResult
==
9
)
{
checkAreaStatVo
=
new
CheckAreaStatVo
(
areaName
,
1
,
1
,
1
,
1
,
statId
,
detailId
);
}
else
if
(
proofResult
==
3
)
{
}
else
if
(
proofResult
==
3
)
{
//跳过非在库的统计
continue
;
}
else
if
(
proofResult
==
1
)
{
}
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/vo/CheckAreaStatVo.java
浏览文件 @
eea9b06b
...
...
@@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.experimental.Accessors
;
import
org.springframework.objenesis.ObjenesisHelper
;
import
javax.validation.constraints.NotNull
;
...
...
@@ -87,15 +88,26 @@ public class CheckAreaStatVo implements Cloneable {
* @throws IllegalArgumentException 在合并的地区名不同或者统计账单id不同时会抛出(初始账单合并除外,即this.detailId=0)
*/
public
CheckAreaStatVo
reduce
(
@NotNull
CheckAreaStatVo
other
)
{
// 合并的两个对象地区与账单id必须相同
if
(!
this
.
areaName
.
equals
(
other
.
areaName
)
||
this
.
areaStatId
!=
other
.
areaStatId
)
{
if
(!
this
.
areaName
.
equals
(
other
.
areaName
)
||
this
.
areaDetailId
!=
other
.
areaDetailId
)
{
//初始化账单的话则不用抛出异常,将other的detailId赋予即可
if
(
this
.
areaDetailId
==
0
)
{
this
.
areaDetailId
=
other
.
area
Stat
Id
;
this
.
areaDetailId
=
other
.
area
Detail
Id
;
}
else
{
throw
new
IllegalArgumentException
(
String
.
format
(
"要合并的两个地区统计数据的areaName与areaDetailId必须保持一致,"
+
"你提供的分别是areaName = %s 与 %s , areaDetailId = %d 与 %d %n"
,
this
.
areaName
,
other
.
areaName
,
this
.
areaDetailId
,
other
.
areaDetailId
));
}
}
if
(!
this
.
areaName
.
equals
(
other
.
areaName
)
||
this
.
areaStatId
!=
other
.
areaStatId
)
{
//初始化账单的话则不用抛出异常,将other的detailId赋予即可
if
(
this
.
areaStatId
==
0
)
{
this
.
areaStatId
=
other
.
areaStatId
;
}
else
{
throw
new
IllegalArgumentException
(
String
.
format
(
"要合并的两个地区统计数据的areaName与areaStatId必须保持一致,"
+
"你提供的分别是areaName = %s 与 %s , areaStatId = %d 与 %d %n"
,
this
.
areaName
,
other
.
areaName
,
this
.
areaStatId
,
other
.
areaStatId
));
}
}
...
...
@@ -119,11 +131,10 @@ public class CheckAreaStatVo implements Cloneable {
@SuppressWarnings
(
"DuplicatedCode"
)
public
CheckAreaStatVo
cleanReduce
(
@NotNull
CheckAreaStatVo
other
)
{
// 合并的两个对象地区与账单id必须相同
if
(!
this
.
areaName
.
equals
(
other
.
areaName
)
||
this
.
area
StatId
!=
other
.
areaStat
Id
)
{
if
(!
this
.
areaName
.
equals
(
other
.
areaName
)
||
this
.
area
DetailId
!=
other
.
areaDetail
Id
)
{
//初始化账单的话则不用抛出异常,将other的detailId赋予即可
if
(
this
.
areaDetailId
==
0
)
{
this
.
areaDetailId
=
other
.
areaDetailId
;
// this.areaStatId = other.areaStatId;
}
else
{
throw
new
IllegalArgumentException
(
String
.
format
(
"要合并的两个地区统计数据的areaName与areaDetailId必须保持一致,"
+
...
...
@@ -132,6 +143,18 @@ public class CheckAreaStatVo implements Cloneable {
}
}
if
(!
this
.
areaName
.
equals
(
other
.
areaName
)
||
this
.
areaStatId
!=
other
.
areaStatId
)
{
//初始化账单的话则不用抛出异常,将other的detailId赋予即可
if
(
this
.
areaStatId
==
0
)
{
this
.
areaStatId
=
other
.
areaStatId
;
}
else
{
throw
new
IllegalArgumentException
(
String
.
format
(
"要合并的两个地区统计数据的areaName与areaStatId必须保持一致,"
+
"你提供的分别是areaName = %s 与 %s , areaStatId = %d 与 %d %n"
,
this
.
areaName
,
other
.
areaName
,
this
.
areaStatId
,
other
.
areaStatId
));
}
}
CheckAreaStatVo
reducedVo
=
new
CheckAreaStatVo
(
this
);
reducedVo
.
actualCount
+=
other
.
actualCount
;
reducedVo
.
comProgress
=
other
.
comProgress
;
...
...
@@ -149,4 +172,22 @@ public class CheckAreaStatVo implements Cloneable {
this
.
comSituation
=
other
.
getComSituation
();
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/LinkCheckDetail.java
0 → 100644
浏览文件 @
eea9b06b
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* LinkCheckDetail.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/5/13 at 7:50 下午
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public
class
LinkCheckDetail
{
private
String
checkUnit
;
private
String
checkSituation
;
private
String
checkResult
;
private
int
remark
;
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/LinkExamDetail.java
0 → 100644
浏览文件 @
eea9b06b
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* LinkExamDetail.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/5/13 at 8:54 下午
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public
class
LinkExamDetail
{
/**
* 检查组名称
*/
private
String
examName
;
/**
* 检查组成员
*/
private
String
examUser
;
private
String
checkUnit
;
private
String
checkSituation
;
private
String
checkResult
;
private
int
remark
;
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/LinkVo.java
0 → 100644
浏览文件 @
eea9b06b
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.time.LocalDate
;
import
java.util.List
;
/**
* StatLinkVo.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/5/13 at 7:43 下午
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel
(
"统一跳转对象"
)
public
class
LinkVo
{
/**
* 1 省统计 2 市检查 3 详情跳转
*/
private
int
type
;
private
LocalDate
endTime
;
private
List
<
LinkCheckDetail
>
lcDetail
;
private
List
<
LinkExamDetail
>
leDetail
;
private
int
detailId
;
public
LinkVo
(
int
type
,
LocalDate
endTime
)
{
this
.
type
=
type
;
this
.
endTime
=
endTime
;
}
}
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/vo/RevAreaStat.java
0 → 100644
浏览文件 @
eea9b06b
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* RevAreaStat.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/5/13 at 8:00 下午
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public
class
RevAreaStat
{
/**
* 地区名称
*/
private
String
areaName
;
/**
* 实查数量
*/
private
int
actualCount
;
/**
* 应查数量
*/
private
int
supposeCount
;
/**
* 完成进度 0-待办 , 1-进行中, 2-已完成
*/
private
int
comProgress
;
/**
* 完成情况 0-无误 1-有异常
*/
private
int
comSituation
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论