Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
f4ab6f96
Commit
f4ab6f96
authored
Aug 16, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.安全追溯详情接口开发
parent
50751d2c
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
444 additions
and
37 deletions
+444
-37
IssueMainBodyEnum.java
.../amos/boot/module/common/api/enums/IssueMainBodyEnum.java
+1
-1
SafetyProblemTracingDto.java
...ot/module/statistics/api/dto/SafetyProblemTracingDto.java
+140
-0
AQZSDPStatisticsMapper.java
.../module/statistics/api/mapper/AQZSDPStatisticsMapper.java
+6
-2
AQZSDPStatisticsMapper.xml
...-api/src/main/resources/mapper/AQZSDPStatisticsMapper.xml
+64
-3
AQZSDPStatisticsController.java
.../statistcs/biz/controller/AQZSDPStatisticsController.java
+54
-0
AQZSDPStatisticsServiceImpl.java
...atistcs/biz/service/impl/AQZSDPStatisticsServiceImpl.java
+179
-31
No files found.
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/enums/IssueMainBodyEnum.java
View file @
f4ab6f96
...
@@ -9,7 +9,7 @@ import java.util.List;
...
@@ -9,7 +9,7 @@ import java.util.List;
@Getter
@Getter
public
enum
IssueMainBodyEnum
{
public
enum
IssueMainBodyEnum
{
//个人
//个人
1
PERSON
(
"个人"
,
"1"
),
PERSON
(
"个人"
,
"1"
),
//企业
//企业
COMPANY
(
"企业"
,
"2"
),
COMPANY
(
"企业"
,
"2"
),
...
...
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/java/com/yeejoin/amos/boot/module/statistics/api/dto/SafetyProblemTracingDto.java
0 → 100644
View file @
f4ab6f96
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistics
.
api
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDateDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
import
java.util.Map
;
/**
* 安全追溯问题
*
* @author system_generator
* @date 2024-05-21
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"SafetyProblemTracingDto"
,
description
=
"安全追溯问题"
)
public
class
SafetyProblemTracingDto
extends
DPFilterParamForDetailDto
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"问题编号"
)
private
String
problemNum
;
@ApiModelProperty
(
value
=
"问题类型(维保超期、检验超期、资质超期等)"
)
private
String
problemType
;
@ApiModelProperty
(
value
=
"问题类型图片"
)
private
String
problemTypePic
;
@ApiModelProperty
(
value
=
"问题来源类型(1个人、2设备、3企业)"
)
private
String
sourceType
;
@ApiModelProperty
(
value
=
"问题来源ID(个人ID、设备ID、企业ID)"
)
private
String
sourceId
;
@ApiModelProperty
(
value
=
"问题描述"
)
private
String
problemDesc
;
@ApiModelProperty
(
value
=
"问题产生查询开始时间"
)
private
String
problemTimeStart
;
@ApiModelProperty
(
value
=
"问题产生时间"
)
private
Date
problemTime
;
@ApiModelProperty
(
value
=
"问题产生查询结束时间"
)
private
String
problemTimeEnd
;
@ApiModelProperty
(
value
=
"主体单位名称"
)
private
String
principalUnit
;
@ApiModelProperty
(
value
=
"主体单位统一代码"
)
private
String
principalUnitCode
;
@ApiModelProperty
(
value
=
"主体单位类型(使用、安改维、检验检测等)"
)
private
String
principalUnitType
;
@ApiModelProperty
(
value
=
"管辖机构名称"
)
private
String
governingBody
;
@ApiModelProperty
(
value
=
"管辖机构单位代码"
)
private
String
governingBodyCode
;
@ApiModelProperty
(
value
=
"管辖机构组织机构代码(例如50*60*70)"
)
private
String
governingBodyOrgCode
;
@ApiModelProperty
(
value
=
"主体单位所属区域名称(陕西省/西安市/莲湖区)"
)
private
String
regionName
;
@ApiModelProperty
(
value
=
"所属区域代码(6100000/6100010/6100011)"
)
private
String
regionCode
;
@ApiModelProperty
(
value
=
"问题状态(0未处理、1已处理)"
)
private
String
problemStatus
;
@ApiModelProperty
(
value
=
"问题状态代码(0未处理、1已处理)"
)
private
String
problemStatusCode
;
@ApiModelProperty
(
value
=
"问题状态对象"
)
private
Map
<
String
,
String
>
problemStatusObj
;
@ApiModelProperty
(
value
=
"更新人员"
)
private
String
recUser
;
@ApiModelProperty
(
value
=
"创建人ID"
)
private
String
createUserId
;
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createDate
;
@ApiModelProperty
(
value
=
"创建人"
)
private
String
createUser
;
@ApiModelProperty
(
value
=
"企业负责人"
)
private
String
unitCharger
;
@ApiModelProperty
(
value
=
"企业负责人联系电话"
)
private
String
unitChargerPhone
;
@ApiModelProperty
(
value
=
"设备监管码"
)
private
String
equipSuperviseCode
;
@ApiModelProperty
(
value
=
"设备种类"
)
private
String
equipList
;
@ApiModelProperty
(
value
=
"人员名称"
)
private
String
userName
;
@ApiModelProperty
(
value
=
"人员电话"
)
private
String
userPhone
;
@ApiModelProperty
(
value
=
"人员岗位"
)
private
String
userPost
;
@ApiModelProperty
(
value
=
"扩展信息"
)
private
String
extraInfo
;
@ApiModelProperty
(
value
=
"设备种类代码"
)
private
String
equipListCode
;
@ApiModelProperty
(
value
=
"问题类型代码(维保超期、检验超期、资质超期等)"
)
private
String
problemTypeCode
;
@ApiModelProperty
(
value
=
"问题来源类型code(1个人、2设备、3企业)"
)
private
String
sourceTypeCode
;
@ApiModelProperty
(
value
=
"问题等级(一级、二级、三级)"
)
private
String
problemLevel
;
@ApiModelProperty
(
value
=
"问题等级code"
)
private
String
problemLevelCode
;
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/java/com/yeejoin/amos/boot/module/statistics/api/mapper/AQZSDPStatisticsMapper.java
View file @
f4ab6f96
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistics
.
api
.
mapper
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistics
.
api
.
mapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.dto.CountDto
;
import
com.yeejoin.amos.boot.biz.common.dto.CountDto
;
import
com.yeejoin.amos.boot.biz.common.dto.KeyValueDto
;
import
com.yeejoin.amos.boot.biz.common.dto.KeyValueDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto
;
import
com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto
;
import
com.yeejoin.amos.boot.module.statistics.api.dto.SafetyProblemTracingDto
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
...
@@ -21,7 +23,7 @@ public interface AQZSDPStatisticsMapper {
...
@@ -21,7 +23,7 @@ public interface AQZSDPStatisticsMapper {
* @param filterParamDto 过滤日期
* @param filterParamDto 过滤日期
* @return List<CountDto>
* @return List<CountDto>
*/
*/
List
<
CountDto
>
selectByOrgAndMainBody
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"dto"
)
DPFilterParamDto
filterParamDto
);
List
<
CountDto
>
selectByOrgAndMainBody
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"dto"
)
DPFilterParamDto
filterParamDto
,
@Param
(
"sourceTypeCode"
)
String
sourceTypeCode
);
List
<
CountDto
>
selectByOrgAndProblemType
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"enumNameList"
)
List
<
String
>
enumNameList
,
List
<
CountDto
>
selectByOrgAndProblemType
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"enumNameList"
)
List
<
String
>
enumNameList
,
...
@@ -31,7 +33,7 @@ public interface AQZSDPStatisticsMapper {
...
@@ -31,7 +33,7 @@ public interface AQZSDPStatisticsMapper {
List
<
Map
<
String
,
Object
>>
getIssueCountByDate
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"year"
)
String
year
,
@Param
(
"status"
)
String
status
);
List
<
Map
<
String
,
Object
>>
getIssueCountByDate
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"year"
)
String
year
,
@Param
(
"status"
)
String
status
);
int
countByOrgCode
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"now"
)
String
now
);
int
countByOrgCode
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"now"
)
String
now
,
@Param
(
"sourceTypeCode"
)
String
sourceTypeCode
);
List
<
Map
<
String
,
String
>>
getOrgCodeAndCompanyCodesByCompanyCodes
(
@Param
(
"regionCodes"
)
List
<
Integer
>
regionCodes
);
List
<
Map
<
String
,
String
>>
getOrgCodeAndCompanyCodesByCompanyCodes
(
@Param
(
"regionCodes"
)
List
<
Integer
>
regionCodes
);
...
@@ -75,4 +77,6 @@ public interface AQZSDPStatisticsMapper {
...
@@ -75,4 +77,6 @@ public interface AQZSDPStatisticsMapper {
List
<
CountDto
>
selectByOrgAndProblemTypeForCy
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"dto"
)
DPFilterParamDto
dpFilterParamDto
);
List
<
CountDto
>
selectByOrgAndProblemTypeForCy
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"dto"
)
DPFilterParamDto
dpFilterParamDto
);
Page
<
SafetyProblemTracingDto
>
queryForSafetyProblemTracingPage
(
Page
<
SafetyProblemTracingDto
>
page
,
SafetyProblemTracingDto
problemModel
);
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/resources/mapper/AQZSDPStatisticsMapper.xml
View file @
f4ab6f96
...
@@ -15,13 +15,16 @@
...
@@ -15,13 +15,16 @@
tzs_safety_problem_tracing
tzs_safety_problem_tracing
WHERE
WHERE
governing_body_org_code LIKE concat (#{orgCode}, '%')
governing_body_org_code LIKE concat (#{orgCode}, '%')
<if
test=
"dto.beginDate !=null and dto.beginDate !=''"
>
<if
test=
"dto
!= null and dto
.beginDate !=null and dto.beginDate !=''"
>
and date_ge(CAST(problem_time as date),#{dto.beginDate})
and date_ge(CAST(problem_time as date),#{dto.beginDate})
</if>
</if>
<if
test=
"dto.endDate !=null and dto.endDate !=''"
>
<if
test=
"dto
!= null and dto
.endDate !=null and dto.endDate !=''"
>
and date_le(CAST(problem_time as date),#{dto.endDate})
and date_le(CAST(problem_time as date),#{dto.endDate})
</if>
</if>
GROUP BY source_type,problem_status_code
<if
test=
"sourceTypeCode !=null and sourceTypeCode !=''"
>
and source_type_code = #{sourceTypeCode}
</if>
GROUP BY source_type_code,problem_status_code
</select>
</select>
<select
id=
"selectByOrgAndProblemType"
resultType=
"com.yeejoin.amos.boot.biz.common.dto.CountDto"
>
<select
id=
"selectByOrgAndProblemType"
resultType=
"com.yeejoin.amos.boot.biz.common.dto.CountDto"
>
SELECT
SELECT
...
@@ -109,6 +112,9 @@
...
@@ -109,6 +112,9 @@
<if
test=
"now != null and now != ''"
>
<if
test=
"now != null and now != ''"
>
AND DATE_FORMAT(problem_time,'%Y-%m')
>
= #{now}
AND DATE_FORMAT(problem_time,'%Y-%m')
>
= #{now}
</if>
</if>
<if
test=
"sourceTypeCode !=null and sourceTypeCode !=''"
>
and source_type_code = #{sourceTypeCode}
</if>
</select>
</select>
<select
id=
"getOrgCodeAndCompanyCodesByCompanyCodes"
resultType=
"java.util.Map"
>
<select
id=
"getOrgCodeAndCompanyCodesByCompanyCodes"
resultType=
"java.util.Map"
>
select org_code AS orgCode,company_code AS companyCode from privilege_company where company_code in
select org_code AS orgCode,company_code AS companyCode from privilege_company where company_code in
...
@@ -358,6 +364,61 @@
...
@@ -358,6 +364,61 @@
GROUP BY
GROUP BY
source_type
source_type
</select>
</select>
<select
id=
"queryForSafetyProblemTracingPage"
resultType=
"com.yeejoin.amos.boot.module.statistics.api.dto.SafetyProblemTracingDto"
>
select
spt.*,
(select extend::json->>'pic' from cb_data_dictionary where type = 'ISSUE_TYPE' and code = spt.problem_type_code) problemTypePic
from tzs_safety_problem_tracing spt
<where>
spt.is_delete = false
<if
test=
"problemModel.problemNum != null and problemModel.problemNum != ''"
>
and spt.problem_num = LIKE CONCAT('%', #{problemModel.problemNum}, '%')
</if>
<if
test=
"problemModel.problemStatus != null and problemModel.problemStatus != ''"
>
and spt.problem_status = #{problemModel.problemStatus}
</if>
<if
test=
"problemModel.sourceTypeCode != null and problemModel.sourceTypeCode != ''"
>
and spt.source_type_code = #{problemModel.sourceTypeCode}
</if>
<if
test=
"problemModel.problemLevelCode != null and problemModel.problemLevelCode != ''"
>
and spt.problem_level_code = #{problemModel.problemLevelCode}
</if>
<if
test=
"problemModel.problemTypeCode != null and problemModel.problemTypeCode != ''"
>
and spt.problem_type_code = #{problemModel.problemTypeCode}
</if>
<if
test=
"problemModel.problemTimeStart != null "
>
and cast(spt.problem_time AS DATE) >= #{problemModel.problemTimeStart}
</if>
<if
test=
"problemModel.problemTimeEnd != null"
>
and cast(spt.problem_time AS DATE)
<![CDATA[<=]]>
#{problemModel.problemTimeEnd}
</if>
<if
test=
"problemModel.problemDesc != null and problemModel.problemDesc != ''"
>
and spt.problem_desc like CONCAT('%', #{problemModel.problemDesc}, '%')
</if>
<if
test=
"problemModel.sourceId != null and problemModel.sourceId != ''"
>
and spt.source_id = #{problemModel.sourceId}
</if>
<if
test=
"problemModel.governingBodyOrgCode != null and problemModel.governingBodyOrgCode != ''"
>
and spt.governing_body_org_code like CONCAT(#{problemModel.governingBodyOrgCode}, '%')
</if>
<if
test=
"problemModel.governingBodyCode != null and problemModel.governingBodyCode != ''"
>
and spt.governing_body_code = #{problemModel.governingBodyCode}
</if>
<if
test=
"problemModel.principalUnit != null and problemModel.principalUnit != ''"
>
and spt.principal_unit like CONCAT('%', #{problemModel.principalUnit}, '%')
</if>
<if
test=
"problemModel.principalUnitType != null and problemModel.principalUnitType != ''"
>
and spt.principal_unit_type = #{problemModel.principalUnitType}
</if>
<if
test=
"problemModel.regionCode != null and problemModel.regionCode != ''"
>
and spt.region_code like CONCAT(#{problemModel.regionCode}, '%')
</if>
<if
test=
"problemModel.problemStatusCode != null and problemModel.problemStatusCode != ''"
>
and spt.problem_status_code = #{problemModel.problemStatusCode}
</if>
</where>
order by spt.create_date desc
</select>
</mapper>
</mapper>
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/controller/AQZSDPStatisticsController.java
View file @
f4ab6f96
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
controller
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.impl.AQZSDPStatisticsServiceImpl
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.impl.AQZSDPStatisticsServiceImpl
;
import
com.yeejoin.amos.boot.module.statistics.api.dto.SafetyProblemTracingDto
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
...
@@ -263,4 +266,55 @@ public class AQZSDPStatisticsController {
...
@@ -263,4 +266,55 @@ public class AQZSDPStatisticsController {
}
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getCenterMapCountDataForOverview
(
dpFilterParamDto
));
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getCenterMapCountDataForOverview
(
dpFilterParamDto
));
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"安全追溯-详情-左侧分类"
,
notes
=
"安全追溯-详情-左侧分类"
)
@PostMapping
(
value
=
"/detail/tree"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
getDetailTree
(
@RequestBody
DPFilterParamDto
dpFilterParamDto
)
{
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getDetailTree
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"当年主体单位问题排名-详情-柱状统计图"
,
notes
=
"安全追溯-当年主体单位问题排名-详情-柱状统计图"
)
@PostMapping
(
value
=
"/companyTopDetail/bar"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
issueCompanyTopDetailBar
(
@Validated
@RequestBody
DPFilterParamForDetailDto
dpFilterParamDto
,
BindingResult
result
)
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
issueCompanyTopDetailBar
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"当年下级区域问题闭环率排名-详情-折线图"
,
notes
=
"安全追溯-当年下级区域问题闭环率排名-详情-柱状统计图"
)
@PostMapping
(
value
=
"/childrenCityCount/line"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
issueChildrenCityCountTopDetailLine
(
@Validated
@RequestBody
DPFilterParamForDetailDto
dpFilterParamDto
,
BindingResult
result
)
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
issueChildrenCityCountTopDetailLine
(
dpFilterParamDto
));
}
/**
* 列表分页查询-大屏使用
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/page/dp"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"分页查询安全追溯问题-大屏使用"
,
notes
=
"分页查询安全追溯问题-大屏使用"
)
public
ResponseModel
<
Page
<
SafetyProblemTracingDto
>>
getProblemRecords
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestBody
(
required
=
false
)
SafetyProblemTracingDto
problemModel
)
{
Page
<
SafetyProblemTracingDto
>
page
=
new
Page
<>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getProblemRecords
(
page
,
problemModel
));
}
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/service/impl/AQZSDPStatisticsServiceImpl.java
View file @
f4ab6f96
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
service
.
impl
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper
;
import
com.yeejoin.amos.boot.biz.common.dto.CountDto
;
import
com.yeejoin.amos.boot.biz.common.dto.CountDto
;
import
com.yeejoin.amos.boot.biz.common.dto.KeyValueDto
;
import
com.yeejoin.amos.boot.biz.common.dto.KeyValueDto
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.LegendDataDto
;
import
com.yeejoin.amos.boot.module.common.api.enums.IssueMainBodyEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.IssueMainBodyEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.IssueProblemLevelEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.IssueProblemLevelEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.IssueTypeEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.IssueTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum
;
import
com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto
;
import
com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto
;
import
com.yeejoin.amos.boot.module.statistics.api.dto.SafetyProblemTracingDto
;
import
com.yeejoin.amos.boot.module.statistics.api.dto.SecurityIndexCountItemDto
;
import
com.yeejoin.amos.boot.module.statistics.api.dto.SecurityIndexCountItemDto
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.AQZSDPStatisticsMapper
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.AQZSDPStatisticsMapper
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderStatisticsMapper
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderStatisticsMapper
;
...
@@ -26,6 +33,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
...
@@ -26,6 +33,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
...
@@ -90,14 +98,17 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -90,14 +98,17 @@ public class AQZSDPStatisticsServiceImpl {
private
StCommonServiceImpl
stCommonService
;
private
StCommonServiceImpl
stCommonService
;
private
DataDictionaryMapper
dataDictionaryMapper
;
public
AQZSDPStatisticsServiceImpl
(
RestHighLevelClient
restHighLevelClient
,
AQZSDPStatisticsMapper
statisticsMapper
,
TzBaseEnterpriseInfoMapper
enterpriseInfoMapper
,
TzsUserInfoMapper
userInfoMapper
,
CylinderStatisticsMapper
cylinderStatisticsMapper
,
StCommonServiceImpl
stCommonService
)
{
public
AQZSDPStatisticsServiceImpl
(
RestHighLevelClient
restHighLevelClient
,
AQZSDPStatisticsMapper
statisticsMapper
,
TzBaseEnterpriseInfoMapper
enterpriseInfoMapper
,
TzsUserInfoMapper
userInfoMapper
,
CylinderStatisticsMapper
cylinderStatisticsMapper
,
StCommonServiceImpl
stCommonService
,
DataDictionaryMapper
dataDictionaryMapper
)
{
this
.
restHighLevelClient
=
restHighLevelClient
;
this
.
restHighLevelClient
=
restHighLevelClient
;
this
.
statisticsMapper
=
statisticsMapper
;
this
.
statisticsMapper
=
statisticsMapper
;
this
.
enterpriseInfoMapper
=
enterpriseInfoMapper
;
this
.
enterpriseInfoMapper
=
enterpriseInfoMapper
;
this
.
userInfoMapper
=
userInfoMapper
;
this
.
userInfoMapper
=
userInfoMapper
;
this
.
cylinderStatisticsMapper
=
cylinderStatisticsMapper
;
this
.
cylinderStatisticsMapper
=
cylinderStatisticsMapper
;
this
.
stCommonService
=
stCommonService
;
this
.
stCommonService
=
stCommonService
;
this
.
dataDictionaryMapper
=
dataDictionaryMapper
;
}
}
...
@@ -110,7 +121,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -110,7 +121,7 @@ public class AQZSDPStatisticsServiceImpl {
}
}
BigDecimal
bigTotalUnitNumber
=
new
BigDecimal
(
String
.
valueOf
(
totalUnitNumber
));
BigDecimal
bigTotalUnitNumber
=
new
BigDecimal
(
String
.
valueOf
(
totalUnitNumber
));
BigDecimal
bigOkUnitNumberNumber
=
new
BigDecimal
(
String
.
valueOf
(
okUnitNumberNumber
));
BigDecimal
bigOkUnitNumberNumber
=
new
BigDecimal
(
String
.
valueOf
(
okUnitNumberNumber
));
BigDecimal
result
=
bigOkUnitNumberNumber
.
divide
(
bigTotalUnitNumber
,
4
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
"100"
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
BigDecimal
result
=
bigOkUnitNumberNumber
.
divide
(
bigTotalUnitNumber
,
4
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
"100"
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
return
result
.
toPlainString
();
return
result
.
toPlainString
();
}
}
...
@@ -157,7 +168,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -157,7 +168,7 @@ public class AQZSDPStatisticsServiceImpl {
public
Map
<
String
,
Object
>
getChildEarlyWarning
(
DPFilterParamDto
dpFilterParamDto
)
{
public
Map
<
String
,
Object
>
getChildEarlyWarning
(
DPFilterParamDto
dpFilterParamDto
)
{
List
<
RegionModel
>
regionModels
=
stCommonService
.
setRegionIfRootParentAndNoAccessIf3Level
(
dpFilterParamDto
.
getCityCode
());
List
<
RegionModel
>
regionModels
=
stCommonService
.
setRegionIfRootParentAndNoAccessIf3Level
(
dpFilterParamDto
.
getCityCode
());
Map
<
String
,
SecurityIndexCountItemDto
>
regionCodeSecurityIndexMap
=
getSecurityIndexCountItemDtoMap
(
regionModels
);
Map
<
String
,
SecurityIndexCountItemDto
>
regionCodeSecurityIndexMap
=
getSecurityIndexCountItemDtoMap
(
regionModels
);
Set
<
Map
<
String
,
String
>>
legendData
=
getLegendForCyArea
();
Set
<
Map
<
String
,
String
>>
legendData
=
getLegendForCyArea
();
List
<
String
>
xuke
=
new
ArrayList
<>();
List
<
String
>
xuke
=
new
ArrayList
<>();
List
<
String
>
shiyongdengji
=
new
ArrayList
<>();
List
<
String
>
shiyongdengji
=
new
ArrayList
<>();
List
<
String
>
jianyanchaoqi
=
new
ArrayList
<>();
List
<
String
>
jianyanchaoqi
=
new
ArrayList
<>();
...
@@ -195,12 +206,12 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -195,12 +206,12 @@ public class AQZSDPStatisticsServiceImpl {
private
String
castScore2Percent
(
String
score
)
{
private
String
castScore2Percent
(
String
score
)
{
BigDecimal
big
=
new
BigDecimal
(
score
);
BigDecimal
big
=
new
BigDecimal
(
score
);
BigDecimal
percent
=
big
.
divide
(
new
BigDecimal
(
"100"
),
2
,
RoundingMode
.
HALF_UP
);
BigDecimal
percent
=
big
.
divide
(
new
BigDecimal
(
"100"
),
2
,
RoundingMode
.
HALF_UP
);
return
percent
.
toPlainString
();
return
percent
.
toPlainString
();
}
}
private
Set
<
Map
<
String
,
String
>>
getLegendForCyArea
()
{
private
Set
<
Map
<
String
,
String
>>
getLegendForCyArea
()
{
Set
<
Map
<
String
,
String
>>
legendData
=
new
HashSet
<>();
Set
<
Map
<
String
,
String
>>
legendData
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
for
(
int
i
=
0
;
i
<
8
;
i
++)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
if
(
i
==
0
)
{
if
(
i
==
0
)
{
...
@@ -367,23 +378,17 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -367,23 +378,17 @@ public class AQZSDPStatisticsServiceImpl {
// 2.x轴设置
// 2.x轴设置
resultMap
.
put
(
"xdata"
,
mainBodyEnums
.
stream
().
map
(
IssueMainBodyEnum:
:
getName
).
collect
(
Collectors
.
toList
()));
resultMap
.
put
(
"xdata"
,
mainBodyEnums
.
stream
().
map
(
IssueMainBodyEnum:
:
getName
).
collect
(
Collectors
.
toList
()));
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
if
(
orgCode
==
null
)
{
if
(
orgCode
==
null
)
{
return
resultMap
;
return
resultMap
;
}
}
// 3.y轴数据设置
// 3.y轴数据设置
// 按照问题状态、问题类型分组统计问题数量
// 按照问题状态、问题类型分组统计问题数量
List
<
CountDto
>
countDtos
=
statisticsMapper
.
selectByOrgAndMainBody
(
orgCode
,
dpFilterParamDto
);
List
<
CountDto
>
countDtos
=
statisticsMapper
.
selectByOrgAndMainBody
(
orgCode
,
dpFilterParamDto
,
null
);
mainBodyEnums
.
forEach
(
e
->{
mainBodyEnums
.
forEach
(
e
->
{
Long
allProblemNum
=
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
equals
(
e
.
getCode
())).
mapToLong
(
CountDto:
:
getLongValue
).
sum
();
Long
allProblemNum
=
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
equals
(
e
.
getCode
())).
mapToLong
(
CountDto:
:
getLongValue
).
sum
();
long
handledProblemNum
=
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
equals
(
e
.
getCode
())
&&
c
.
getLabel
().
equals
(
SafetyProblemStatusEnum
.
HANDLED
.
getCode
())).
mapToLong
(
CountDto:
:
getLongValue
).
sum
();
long
handledProblemNum
=
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
equals
(
e
.
getCode
())
&&
c
.
getLabel
().
equals
(
SafetyProblemStatusEnum
.
HANDLED
.
getCode
())).
mapToLong
(
CountDto:
:
getLongValue
).
sum
();
BigDecimal
all
=
new
BigDecimal
(
allProblemNum
.
toString
());
BigDecimal
handled
=
new
BigDecimal
(
Long
.
toString
(
handledProblemNum
));
String
percent
=
"0"
;
if
(
all
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
){
percent
=
handled
.
divide
(
all
,
2
,
RoundingMode
.
HALF_UP
).
toPlainString
();
}
problemCount
.
add
(
allProblemNum
);
problemCount
.
add
(
allProblemNum
);
problemRate
.
add
(
percent
);
problemRate
.
add
(
calPercent
(
allProblemNum
,
handledProblemNum
)
);
});
});
resultMap
.
put
(
"problemCount"
,
problemCount
);
resultMap
.
put
(
"problemCount"
,
problemCount
);
resultMap
.
put
(
"problemRate"
,
problemRate
);
resultMap
.
put
(
"problemRate"
,
problemRate
);
...
@@ -415,7 +420,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -415,7 +420,7 @@ public class AQZSDPStatisticsServiceImpl {
List
<
Object
>
ydata
=
new
ArrayList
<>();
List
<
Object
>
ydata
=
new
ArrayList
<>();
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"3"
);
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"3"
);
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
if
(
orgCode
!=
null
)
{
if
(
orgCode
!=
null
)
{
List
<
CountDto
>
countDtos
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
dpFilterParamDto
,
IssueMainBodyEnum
.
EQUIPMENT
.
getCode
(),
null
);
List
<
CountDto
>
countDtos
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
dpFilterParamDto
,
IssueMainBodyEnum
.
EQUIPMENT
.
getCode
(),
null
);
countDtos
.
forEach
(
t
->
dataMap
.
put
(
t
.
getKeyStr
(),
t
.
getLongValue
()));
countDtos
.
forEach
(
t
->
dataMap
.
put
(
t
.
getKeyStr
(),
t
.
getLongValue
()));
}
}
...
@@ -434,7 +439,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -434,7 +439,7 @@ public class AQZSDPStatisticsServiceImpl {
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>();
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"2"
);
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"2"
);
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
if
(
orgCode
!=
null
)
{
if
(
orgCode
!=
null
)
{
List
<
CountDto
>
countDtos
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
dpFilterParamDto
,
IssueMainBodyEnum
.
COMPANY
.
getCode
(),
null
);
List
<
CountDto
>
countDtos
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
dpFilterParamDto
,
IssueMainBodyEnum
.
COMPANY
.
getCode
(),
null
);
countDtos
.
forEach
(
t
->
dataMap
.
put
(
t
.
getKeyStr
(),
t
.
getLongValue
()));
countDtos
.
forEach
(
t
->
dataMap
.
put
(
t
.
getKeyStr
(),
t
.
getLongValue
()));
}
}
...
@@ -472,7 +477,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -472,7 +477,7 @@ public class AQZSDPStatisticsServiceImpl {
List
<
Object
>
ydata
=
new
ArrayList
<>();
List
<
Object
>
ydata
=
new
ArrayList
<>();
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"1"
);
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"1"
);
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
if
(
orgCode
!=
null
)
{
if
(
orgCode
!=
null
)
{
List
<
CountDto
>
countDtos
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
dpFilterParamDto
,
IssueMainBodyEnum
.
PERSON
.
getCode
(),
null
);
List
<
CountDto
>
countDtos
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
dpFilterParamDto
,
IssueMainBodyEnum
.
PERSON
.
getCode
(),
null
);
countDtos
.
forEach
(
t
->
dataMap
.
put
(
t
.
getKeyStr
(),
t
.
getLongValue
()));
countDtos
.
forEach
(
t
->
dataMap
.
put
(
t
.
getKeyStr
(),
t
.
getLongValue
()));
}
}
...
@@ -493,7 +498,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -493,7 +498,7 @@ public class AQZSDPStatisticsServiceImpl {
List
<
Object
>
ydata
=
new
ArrayList
<>();
List
<
Object
>
ydata
=
new
ArrayList
<>();
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"4"
);
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"4"
);
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
if
(
orgCode
!=
null
)
{
if
(
orgCode
!=
null
)
{
List
<
CountDto
>
countDtos
=
statisticsMapper
.
selectByOrgAndProblemTypeForCy
(
orgCode
,
dpFilterParamDto
);
List
<
CountDto
>
countDtos
=
statisticsMapper
.
selectByOrgAndProblemTypeForCy
(
orgCode
,
dpFilterParamDto
);
countDtos
.
forEach
(
t
->
dataMap
.
put
(
t
.
getKeyStr
(),
t
.
getLongValue
()));
countDtos
.
forEach
(
t
->
dataMap
.
put
(
t
.
getKeyStr
(),
t
.
getLongValue
()));
}
}
...
@@ -524,7 +529,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -524,7 +529,7 @@ public class AQZSDPStatisticsServiceImpl {
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
Map
<
String
,
Object
>
allIssueMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
allIssueMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
endIssueMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
endIssueMap
=
new
HashMap
<>();
if
(
orgCode
!=
null
)
{
if
(
orgCode
!=
null
)
{
int
year
=
LocalDate
.
now
().
getYear
();
int
year
=
LocalDate
.
now
().
getYear
();
List
<
Map
<
String
,
Object
>>
allIssue
=
statisticsMapper
.
getIssueCountByMonth
(
orgCode
,
String
.
valueOf
(
year
),
null
);
List
<
Map
<
String
,
Object
>>
allIssue
=
statisticsMapper
.
getIssueCountByMonth
(
orgCode
,
String
.
valueOf
(
year
),
null
);
List
<
Map
<
String
,
Object
>>
endIssue
=
statisticsMapper
.
getIssueCountByMonth
(
orgCode
,
String
.
valueOf
(
year
),
"1"
);
List
<
Map
<
String
,
Object
>>
endIssue
=
statisticsMapper
.
getIssueCountByMonth
(
orgCode
,
String
.
valueOf
(
year
),
"1"
);
...
@@ -619,7 +624,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -619,7 +624,7 @@ public class AQZSDPStatisticsServiceImpl {
public
Map
<
String
,
Object
>
issueCountByCityCode
(
String
cityCode
)
{
public
Map
<
String
,
Object
>
issueCountByCityCode
(
String
cityCode
)
{
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
cityCode
);
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
cityCode
);
String
now
=
LocalDate
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM"
));
String
now
=
LocalDate
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM"
));
int
count
=
statisticsMapper
.
countByOrgCode
(
orgCode
,
now
);
int
count
=
statisticsMapper
.
countByOrgCode
(
orgCode
,
now
,
null
);
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"issueCount"
,
count
);
resultMap
.
put
(
"issueCount"
,
count
);
return
resultMap
;
return
resultMap
;
...
@@ -666,7 +671,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -666,7 +671,7 @@ public class AQZSDPStatisticsServiceImpl {
public
List
<
Map
<
String
,
Object
>>
issueMonthList
(
String
cityCode
)
{
public
List
<
Map
<
String
,
Object
>>
issueMonthList
(
String
cityCode
)
{
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
cityCode
);
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
cityCode
);
if
(
orgCode
==
null
)
{
if
(
orgCode
==
null
)
{
return
new
ArrayList
<>(
0
);
return
new
ArrayList
<>(
0
);
}
}
String
time
=
LocalDate
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM"
));
String
time
=
LocalDate
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM"
));
...
@@ -678,14 +683,14 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -678,14 +683,14 @@ public class AQZSDPStatisticsServiceImpl {
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
String
time
=
LocalDate
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy"
));
String
time
=
LocalDate
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy"
));
Map
<
String
,
Long
>
problemLevelNumMap
=
new
LinkedHashMap
<>();
Map
<
String
,
Long
>
problemLevelNumMap
=
new
LinkedHashMap
<>();
if
(
orgCode
!=
null
)
{
if
(
orgCode
!=
null
)
{
List
<
CountDto
>
list
=
statisticsMapper
.
issueProblemLevelCount
(
orgCode
,
time
);
List
<
CountDto
>
list
=
statisticsMapper
.
issueProblemLevelCount
(
orgCode
,
time
);
problemLevelNumMap
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
CountDto:
:
getKeyStr
,
CountDto:
:
getLongValue
));
problemLevelNumMap
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
CountDto:
:
getKeyStr
,
CountDto:
:
getLongValue
));
}
}
List
<
Object
>
xdata
=
new
ArrayList
<>();
List
<
Object
>
xdata
=
new
ArrayList
<>();
List
<
Object
>
ydata
=
new
ArrayList
<>();
List
<
Object
>
ydata
=
new
ArrayList
<>();
Map
<
String
,
Long
>
finalProblemLevelNumMap
=
problemLevelNumMap
;
Map
<
String
,
Long
>
finalProblemLevelNumMap
=
problemLevelNumMap
;
Arrays
.
stream
(
IssueProblemLevelEnum
.
values
()).
forEach
(
e
->
{
Arrays
.
stream
(
IssueProblemLevelEnum
.
values
()).
forEach
(
e
->
{
xdata
.
add
(
e
.
getName
());
xdata
.
add
(
e
.
getName
());
ydata
.
add
(
finalProblemLevelNumMap
.
getOrDefault
(
e
.
getCode
(),
0L
));
ydata
.
add
(
finalProblemLevelNumMap
.
getOrDefault
(
e
.
getCode
(),
0L
));
});
});
...
@@ -697,7 +702,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -697,7 +702,7 @@ public class AQZSDPStatisticsServiceImpl {
public
List
<
Map
<
String
,
Object
>>
issueCompanyTop
(
DPFilterParamDto
dpFilterParamDto
)
{
public
List
<
Map
<
String
,
Object
>>
issueCompanyTop
(
DPFilterParamDto
dpFilterParamDto
)
{
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
if
(
orgCode
==
null
)
{
if
(
orgCode
==
null
)
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
String
time
=
LocalDate
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy"
));
String
time
=
LocalDate
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy"
));
...
@@ -715,7 +720,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -715,7 +720,7 @@ public class AQZSDPStatisticsServiceImpl {
public
List
<
Map
<
String
,
Object
>>
issueChildrenCityCountTop
(
DPFilterParamDto
dpFilterParamDto
)
{
public
List
<
Map
<
String
,
Object
>>
issueChildrenCityCountTop
(
DPFilterParamDto
dpFilterParamDto
)
{
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
if
(
orgCode
==
null
)
{
if
(
orgCode
==
null
)
{
return
new
ArrayList
<>();
return
new
ArrayList
<>();
}
}
List
<
RegionModel
>
regionModels
=
stCommonService
.
setRegionIfRootParentAndNoAccessIf3Level
(
dpFilterParamDto
.
getCityCode
());
List
<
RegionModel
>
regionModels
=
stCommonService
.
setRegionIfRootParentAndNoAccessIf3Level
(
dpFilterParamDto
.
getCityCode
());
...
@@ -780,7 +785,7 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -780,7 +785,7 @@ public class AQZSDPStatisticsServiceImpl {
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
cityCode
);
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
cityCode
);
List
<
Map
<
String
,
Object
>>
allList
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
allList
=
new
ArrayList
<>();
Map
<
String
,
Object
>
endIssueDataMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
endIssueDataMap
=
new
HashMap
<>();
if
(
orgCode
!=
null
)
{
if
(
orgCode
!=
null
)
{
allList
=
statisticsMapper
.
issueCountTopByProblemType
(
orgCode
,
null
);
allList
=
statisticsMapper
.
issueCountTopByProblemType
(
orgCode
,
null
);
List
<
Map
<
String
,
Object
>>
endList
=
statisticsMapper
.
issueCountTopByProblemType
(
orgCode
,
"1"
);
List
<
Map
<
String
,
Object
>>
endList
=
statisticsMapper
.
issueCountTopByProblemType
(
orgCode
,
"1"
);
endList
.
forEach
(
t
->
{
endList
.
forEach
(
t
->
{
...
@@ -982,4 +987,146 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -982,4 +987,146 @@ public class AQZSDPStatisticsServiceImpl {
return
result
;
return
result
;
}
}
public
List
<
Map
<
String
,
Object
>>
getDetailTree
(
DPFilterParamDto
dpFilterParamDto
)
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
Map
<
String
,
Object
>
item1
=
new
HashMap
<>();
item1
.
put
(
"title"
,
"主体类型"
);
item1
.
put
(
"value"
,
""
);
item1
.
put
(
"children"
,
this
.
buildMainBodyChild
());
result
.
add
(
item1
);
return
result
;
}
private
List
<
Map
<
String
,
Object
>>
buildMainBodyChild
()
{
List
<
Map
<
String
,
Object
>>
child
=
Arrays
.
stream
(
IssueMainBodyEnum
.
values
()).
map
(
e
->
{
Map
<
String
,
Object
>
item1
=
new
HashMap
<>();
item1
.
put
(
"title"
,
e
.
getName
());
item1
.
put
(
"value"
,
e
.
getCode
());
item1
.
put
(
"children"
,
new
ArrayList
<>());
return
item1
;
}).
collect
(
Collectors
.
toList
());
Collections
.
reverse
(
child
);
return
child
;
}
public
Map
<
String
,
Object
>
issueCompanyTopDetailBar
(
DPFilterParamForDetailDto
dpFilterParamDto
)
{
// 1.查询区域信息
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
List
<
RegionModel
>
childRegion
=
stCommonService
.
setRegionIfRootParentAndNoAccessIf3Level
(
dpFilterParamDto
.
getCityCode
());
if
(
childRegion
.
isEmpty
())
{
return
new
HashMap
<>(
0
);
}
// 2.按照前端约定格式返回数据
List
<
LegendDataDto
>
legendDataDtos
=
this
.
buildLegendDataListForCompanyTopDetailBar
();
// 2.1 图列数据构造
result
.
put
(
"legendData"
,
legendDataDtos
);
// 2.2 x轴数据构造
result
.
put
(
"xdata"
,
stCommonService
.
buildXData
(
childRegion
));
// 2.3 y轴数据构造
result
.
put
(
"yhTotal"
,
this
.
buildYDataForIssueCompanyTopDetailBar
(
childRegion
,
dpFilterParamDto
.
getTreeValue
()));
return
result
;
}
private
List
<
LegendDataDto
>
buildLegendDataListForChildrenCityCountTopLine
()
{
List
<
LegendDataDto
>
legendDataDtos
=
new
ArrayList
<>();
legendDataDtos
.
add
(
LegendDataDto
.
builder
().
dataKey
(
"yhbhPercent"
).
value
(
"隐患闭环率"
).
chartType
(
"line"
).
build
());
return
legendDataDtos
;
}
private
List
<
LegendDataDto
>
buildLegendDataListForCompanyTopDetailBar
()
{
List
<
LegendDataDto
>
legendDataDtos
=
new
ArrayList
<>();
legendDataDtos
.
add
(
LegendDataDto
.
builder
().
dataKey
(
"yhTotal"
).
value
(
"隐患总数"
).
chartType
(
"bar"
).
build
());
return
legendDataDtos
;
}
private
List
<
Long
>
buildYDataForIssueCompanyTopDetailBar
(
List
<
RegionModel
>
regionModels
,
String
sourceTypeCode
)
{
// 多线程处理
List
<
CountDto
>
countDtos
=
regionModels
.
parallelStream
().
map
(
r
->
{
CountDto
dto
=
new
CountDto
();
dto
.
setKeyStr
(
r
.
getRegionCode
().
toString
());
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
r
.
getRegionCode
().
toString
());
if
(
orgCode
==
null
)
{
dto
.
setLongValue
(
0L
);
}
else
{
long
num
=
statisticsMapper
.
countByOrgCode
(
orgCode
,
null
,
sourceTypeCode
);
dto
.
setLongValue
(
num
);
}
return
dto
;
}).
collect
(
Collectors
.
toList
());
// 多线程处理后数据顺序与x轴不一致,进行顺序调整
return
regionModels
.
stream
().
map
(
r
->
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
equals
(
r
.
getRegionCode
().
toString
())).
mapToLong
(
CountDto:
:
getLongValue
).
sum
()).
collect
(
Collectors
.
toList
());
}
public
Map
<
String
,
Object
>
issueChildrenCityCountTopDetailLine
(
DPFilterParamForDetailDto
dpFilterParamDto
)
{
// 1.查询区域信息
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
List
<
RegionModel
>
childRegion
=
stCommonService
.
setRegionIfRootParentAndNoAccessIf3Level
(
dpFilterParamDto
.
getCityCode
());
if
(
childRegion
.
isEmpty
())
{
return
new
HashMap
<>(
0
);
}
// 2.按照前端约定格式返回数据
List
<
LegendDataDto
>
legendDataDtos
=
this
.
buildLegendDataListForChildrenCityCountTopLine
();
// 2.1 图列数据构造
result
.
put
(
"legendData"
,
legendDataDtos
);
// 2.2 x轴数据构造
result
.
put
(
"xdata"
,
stCommonService
.
buildXData
(
childRegion
));
// 2.3 y轴数据构造
result
.
put
(
"yhbhPercent"
,
this
.
buildYDataForChildrenCityCountDetailBar
(
childRegion
,
dpFilterParamDto
.
getTreeValue
()));
return
result
;
}
private
List
<
String
>
buildYDataForChildrenCityCountDetailBar
(
List
<
RegionModel
>
regionModels
,
String
sourceTypeCode
)
{
// 多线程处理
List
<
CountDto
>
countDtos
=
regionModels
.
parallelStream
().
map
(
r
->
{
CountDto
dto
=
new
CountDto
();
dto
.
setKeyStr
(
r
.
getRegionCode
().
toString
());
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
r
.
getRegionCode
().
toString
());
if
(
orgCode
==
null
)
{
dto
.
setStrValue
(
"0"
);
}
else
{
List
<
CountDto
>
dtoList
=
statisticsMapper
.
selectByOrgAndMainBody
(
orgCode
,
null
,
sourceTypeCode
);
Long
allProblemNum
=
dtoList
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
equals
(
sourceTypeCode
)).
mapToLong
(
CountDto:
:
getLongValue
).
sum
();
Long
handledProblemNum
=
dtoList
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
equals
(
sourceTypeCode
)
&&
c
.
getLabel
().
equals
(
SafetyProblemStatusEnum
.
HANDLED
.
getCode
())).
mapToLong
(
CountDto:
:
getLongValue
).
sum
();
dto
.
setStrValue
(
calPercent
(
allProblemNum
,
handledProblemNum
));
}
return
dto
;
}).
collect
(
Collectors
.
toList
());
// 多线程处理后数据顺序与x轴不一致,进行顺序调整
return
regionModels
.
stream
().
map
(
r
->
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
equals
(
r
.
getRegionCode
().
toString
())).
map
(
CountDto:
:
getStrValue
).
findFirst
().
orElse
(
"0"
)).
collect
(
Collectors
.
toList
());
}
private
String
calPercent
(
Long
allProblemNum
,
Long
handledProblemNum
)
{
BigDecimal
all
=
new
BigDecimal
(
allProblemNum
.
toString
());
BigDecimal
handled
=
new
BigDecimal
(
Long
.
toString
(
handledProblemNum
));
String
percent
=
"0"
;
if
(
all
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
percent
=
handled
.
divide
(
all
,
2
,
RoundingMode
.
HALF_UP
).
toPlainString
();
}
return
percent
;
}
public
Page
<
SafetyProblemTracingDto
>
getProblemRecords
(
Page
<
SafetyProblemTracingDto
>
page
,
SafetyProblemTracingDto
problemModel
)
{
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
problemModel
.
getRegionCode
());
if
(
orgCode
==
null
){
return
new
Page
<>();
}
problemModel
.
setGoverningBodyOrgCode
(
orgCode
);
// 使用orgCode过滤
problemModel
.
setRegionCode
(
null
);
// 将单位类型从code转化为value
if
(!
ValidationUtil
.
isEmpty
(
problemModel
.
getPrincipalUnitType
())){
Collection
<
DataDictionary
>
unitTypeList
=
dataDictionaryMapper
.
selectList
(
new
QueryWrapper
<
DataDictionary
>()
.
eq
(
"type"
,
"UNIT_TYPE_NEW"
)
.
eq
(
"is_delete"
,
false
)
.
orderByAsc
(
"sort_num"
));
Map
<
String
,
String
>
unitTypeMap
=
unitTypeList
.
stream
().
collect
(
Collectors
.
toMap
(
DataDictionary:
:
getCode
,
DataDictionary:
:
getName
));
problemModel
.
setPrincipalUnitType
(
unitTypeMap
.
getOrDefault
(
problemModel
.
getPrincipalUnitType
(),
null
));
}
if
(
problemModel
.
getTimeSearchOne
()
!=
null
){
problemModel
.
setProblemTimeStart
(
problemModel
.
getTimeSearchOne
().
getBeginDate
());
problemModel
.
setProblemTimeEnd
(
problemModel
.
getTimeSearchOne
().
getEndDate
());
}
return
statisticsMapper
.
queryForSafetyProblemTracingPage
(
page
,
problemModel
);
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment