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
4d49b6e3
Commit
4d49b6e3
authored
Jul 31, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.检验检测大屏接口中评增加统计项
parent
657fb729
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
21 deletions
+137
-21
JYJCStatisticsMapper.java
...ot/module/statistics/api/mapper/JYJCStatisticsMapper.java
+44
-0
JYJCStatisticsMapper.xml
...cs-api/src/main/resources/mapper/JYJCStatisticsMapper.xml
+39
-0
JYJCDPStatisticsServiceImpl.java
...atistcs/biz/service/impl/JYJCDPStatisticsServiceImpl.java
+54
-21
No files found.
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/java/com/yeejoin/amos/boot/module/statistics/api/mapper/JYJCStatisticsMapper.java
0 → 100644
View file @
4d49b6e3
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistics
.
api
.
mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-12-13
*/
@Mapper
public
interface
JYJCStatisticsMapper
{
/**
* 检验机构总量统计
*
* @param orgCode 区域对应的orgCode
* @param regionCode 区域行政区划编码
* @return 检验机构总量
*/
Long
countAllRegInspectCompany
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"regionCode"
)
String
regionCode
);
/**
* 第三方检验机构数量(除去法定名单就是第三方)
*
* @param orgCode 区域对应的orgCode
* @param legalCmc 法定的检验机构名单
* @param regionCode 区域行政区划编码
* @return 检验机构总量
*/
Long
countAllRegThirdInspectCompany
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"legalCmc"
)
String
legalCmc
,
@Param
(
"regionCode"
)
String
regionCode
);
/**
* 业务开通机构数量
*
* @param orgCode 区域对应的orgCode
* @param regionCode 区域行政区划编码
* @return 检验机构总量
*/
Long
countAllOpenBizInspectCompany
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"regionCode"
)
String
regionCode
);
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/resources/mapper/JYJCStatisticsMapper.xml
0 → 100644
View file @
4d49b6e3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.statistics.api.mapper.JYJCStatisticsMapper"
>
<select
id=
"countAllRegInspectCompany"
resultType=
"java.lang.Long"
>
SELECT
count(1)
from
tz_base_enterprise_info b
where
(b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%'))
or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{regionCode}, '%'))
</select>
<select
id=
"countAllRegThirdInspectCompany"
resultType=
"java.lang.Long"
>
SELECT
count(1)
from
tz_base_enterprise_info b
where
((b.supervise_org_code != '50' and b.supervise_org_code LIKE CONCAT (#{orgCode}, '%'))
or (b.supervise_org_code = '50' and b.office_region LIKE CONCAT ('%', #{regionCode}, '%')))
and b.use_unit_code not in (#{legalCmc})
</select>
<select
id=
"countAllOpenBizInspectCompany"
resultType=
"java.lang.Long"
>
SELECT
COUNT(distinct a.unit_code)
FROM
tz_jyjc_opening_application a,
tz_base_enterprise_info b
WHERE
a.unit_code = b.use_unit_code
AND a.status = 6616
and
(( b.supervise_org_code != '50' AND b.supervise_org_code LIKE CONCAT ( #{orgCode}, '%' ) )
OR ( b.supervise_org_code = '50' AND b.office_region LIKE CONCAT ( '%', #{regionCode}, '%' )))
</select>
</mapper>
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/JYJCDPStatisticsServiceImpl.java
View file @
4d49b6e3
...
...
@@ -2,20 +2,21 @@ package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import
cn.hutool.core.date.DateUtil
;
import
com.yeejoin.amos.boot.biz.common.dto.CountDto
;
import
com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum
;
import
com.yeejoin.amos.boot.module.jyjc.api.dto.InspectTimeCountDto
;
import
com.yeejoin.amos.boot.module.jyjc.api.dto.InspectionTimelinesDto
;
import
com.yeejoin.amos.boot.module.jyjc.api.dto.PublicityInspectOrgInfoDto
;
import
com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum
;
import
com.yeejoin.amos.boot.module.jyjc.api.enums.JYJCTypeEnum
;
import
com.yeejoin.amos.boot.module.jyjc.api.mapper.*
;
import
com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationEquipMapper
;
import
com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionApplicationMapper
;
import
com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcInspectionResultMapper
;
import
com.yeejoin.amos.boot.module.jyjc.api.mapper.JyjcOpeningApplicationMapper
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.JYJCStatisticsMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -32,8 +33,10 @@ import org.elasticsearch.search.aggregations.AggregationBuilders;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
javax.validation.constraints.NotBlank
;
import
java.io.IOException
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
...
...
@@ -77,7 +80,15 @@ public class JYJCDPStatisticsServiceImpl {
private
StCommonServiceImpl
stCommonService
;
public
JYJCDPStatisticsServiceImpl
(
EquipmentCategoryMapper
equipmentCategoryMapper
,
JyjcInspectionApplicationEquipMapper
inspectionApplicationEquipMapper
,
JyjcInspectionApplicationMapper
inspectionApplicationMapper
,
TzsUserInfoMapper
tzsUserInfoMapper
,
JyjcInspectionResultMapper
inspectionResultMapper
,
JyjcOpeningApplicationMapper
openingApplicationMapper
,
RestHighLevelClient
restHighLevelClient
,
StCommonServiceImpl
stCommonService
)
{
private
JYJCStatisticsMapper
jyjcStatisticsMapper
;
/**
* 法定检验机构名单
*/
@Value
(
"${jyjc.legal.companyCode:12610100750228848W,12610300MB2943942F,12610400435630992M,12610200435252143F,126105007326878566,12610600MB29845683,126108004366752362,12610700MB296441XY,12610900353680128G,126110004363154256,126100004352004822}"
)
private
String
legalCompanyCodes
;
public
JYJCDPStatisticsServiceImpl
(
EquipmentCategoryMapper
equipmentCategoryMapper
,
JyjcInspectionApplicationEquipMapper
inspectionApplicationEquipMapper
,
JyjcInspectionApplicationMapper
inspectionApplicationMapper
,
TzsUserInfoMapper
tzsUserInfoMapper
,
JyjcInspectionResultMapper
inspectionResultMapper
,
JyjcOpeningApplicationMapper
openingApplicationMapper
,
RestHighLevelClient
restHighLevelClient
,
StCommonServiceImpl
stCommonService
,
JYJCStatisticsMapper
jyjcStatisticsMapper
)
{
this
.
equipmentCategoryMapper
=
equipmentCategoryMapper
;
this
.
inspectionApplicationEquipMapper
=
inspectionApplicationEquipMapper
;
this
.
inspectionApplicationMapper
=
inspectionApplicationMapper
;
...
...
@@ -86,6 +97,7 @@ public class JYJCDPStatisticsServiceImpl {
this
.
openingApplicationMapper
=
openingApplicationMapper
;
this
.
restHighLevelClient
=
restHighLevelClient
;
this
.
stCommonService
=
stCommonService
;
this
.
jyjcStatisticsMapper
=
jyjcStatisticsMapper
;
}
...
...
@@ -109,7 +121,7 @@ public class JYJCDPStatisticsServiceImpl {
private
void
buildYData
(
Map
<
String
,
Object
>
result
,
List
<
BizTypeEnum
>
bizTypeEnums
,
DPFilterParamDto
dpFilterParamDto
,
List
<
EquipmentCategoryDto
>
equipmentCategoryDtos
)
{
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
// 待统计的数据本来sql可以单独统计,但是要求气瓶单独从压力容器里拎出来,与八大类同级,故java处理
List
<
InspectTimeCountDto
>
inspectTimeCountDtos
=
inspectionApplicationEquipMapper
.
countInspectTimeCountByTypeAndEquList
(
orgCode
,
dpFilterParamDto
);
List
<
InspectTimeCountDto
>
inspectTimeCountDtos
=
inspectionApplicationEquipMapper
.
countInspectTimeCountByTypeAndEquList
(
orgCode
,
dpFilterParamDto
);
bizTypeEnums
.
forEach
(
bizTypeEnum
->
{
result
.
put
(
bizTypeEnum
.
getCode
(),
this
.
countNumByBizTypeAndEquList
(
equipmentCategoryDtos
,
bizTypeEnum
.
getCode
(),
inspectTimeCountDtos
));
});
...
...
@@ -205,7 +217,7 @@ public class JYJCDPStatisticsServiceImpl {
if
(
StringUtils
.
isEmpty
(
orgCode
))
{
yData
.
add
(
0L
);
}
else
{
Long
num
=
tzsUserInfoMapper
.
countUserByPostAndAreaCode
(
orgCode
,
"6615"
,
regionModel
.
getRegionCode
()
+
""
);
Long
num
=
tzsUserInfoMapper
.
countUserByPostAndAreaCode
(
orgCode
,
"6615"
,
regionModel
.
getRegionCode
()
+
""
);
yData
.
add
(
num
);
}
});
...
...
@@ -330,15 +342,46 @@ public class JYJCDPStatisticsServiceImpl {
public
Map
<
String
,
Object
>
getCenterMapCountDataForGlobal
(
DPFilterParamDto
dpFilterParamDto
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 1.报检数量统计
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
if
(
StringUtils
.
isEmpty
(
orgCode
))
{
return
result
;
}
// 1.气瓶统计
long
cylinderNum
=
stCommonService
.
staticsCenterMapCountDataForCylinder
(
result
,
orgCode
);
// 2.8大类统计
stCommonService
.
staticsCenterMapCountDataForEquip
(
result
,
cylinderNum
,
orgCode
);
// 3.压力管道统计
stCommonService
.
staticsCenterMapCountDataForPipeline
(
result
,
orgCode
);
// 4.报检数量统计
this
.
staticsCenterMapCountDataReporting
(
result
,
dpFilterParamDto
);
//
2
.检验检测临期设备数数量统计
//
5
.检验检测临期设备数数量统计
this
.
staticsCenterMapCountDataTemporary
(
result
,
dpFilterParamDto
);
//
3
.检验检测超期设备数数量统计
//
6
.检验检测超期设备数数量统计
this
.
staticsCenterMapCountDataOverdue
(
result
,
dpFilterParamDto
);
// 7.检验机构总量 inspectionAgencyCount
this
.
countAllRegInspectCompany
(
result
,
orgCode
,
dpFilterParamDto
.
getCityCode
());
// 8.第三方检验机构数量 thirdInspectionAgencyCount
this
.
countAllRegThirdInspectCompany
(
result
,
orgCode
,
dpFilterParamDto
.
getCityCode
());
// 7.业务开通机构数量 bizKtCount
this
.
countAllOpenBizInspectCompany
(
result
,
orgCode
,
dpFilterParamDto
.
getCityCode
());
return
result
;
}
private
void
countAllRegInspectCompany
(
Map
<
String
,
Object
>
result
,
String
orgCode
,
String
regionCode
)
{
Long
num
=
jyjcStatisticsMapper
.
countAllRegInspectCompany
(
orgCode
,
regionCode
);
result
.
put
(
"inspectionAgencyCount"
,
num
);
}
private
void
countAllRegThirdInspectCompany
(
Map
<
String
,
Object
>
result
,
String
orgCode
,
String
regionCode
)
{
Long
num
=
jyjcStatisticsMapper
.
countAllRegThirdInspectCompany
(
orgCode
,
legalCompanyCodes
,
regionCode
);
result
.
put
(
"thirdInspectionAgencyCount"
,
num
);
}
private
void
countAllOpenBizInspectCompany
(
Map
<
String
,
Object
>
result
,
String
orgCode
,
String
regionCode
)
{
Long
num
=
jyjcStatisticsMapper
.
countAllOpenBizInspectCompany
(
orgCode
,
regionCode
);
result
.
put
(
"bizKtCount"
,
num
);
}
private
void
staticsCenterMapCountDataTemporary
(
Map
<
String
,
Object
>
result
,
DPFilterParamDto
dpFilterParamDto
)
{
long
num
=
0
;
CountRequest
request
=
new
CountRequest
();
...
...
@@ -400,23 +443,13 @@ public class JYJCDPStatisticsServiceImpl {
return
regionList
.
parallelStream
().
map
(
r
->
{
DPFilterParamDto
filterParamDto
=
new
DPFilterParamDto
();
filterParamDto
.
setCityCode
(
r
.
getRegionCode
().
toString
());
Map
<
String
,
Object
>
itemResult
=
getCenterMap
OverviewData
(
filterParamDto
);
Map
<
String
,
Object
>
itemResult
=
getCenterMap
CountDataForGlobal
(
filterParamDto
);
itemResult
.
put
(
"regionCode"
,
r
.
getRegionCode
());
itemResult
.
put
(
"regionName"
,
r
.
getRegionName
());
return
itemResult
;
}).
collect
(
Collectors
.
toList
());
}
private
Map
<
String
,
Object
>
getCenterMapOverviewData
(
DPFilterParamDto
filterParamDto
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 1.报检数量统计
this
.
staticsCenterMapCountDataReporting
(
result
,
filterParamDto
);
// 2.检验检测临期设备数数量统计
this
.
staticsCenterMapCountDataTemporary
(
result
,
filterParamDto
);
// 3.检验检测超期设备数数量统计
this
.
staticsCenterMapCountDataOverdue
(
result
,
filterParamDto
);
return
result
;
}
public
Map
<
String
,
Object
>
equipInspectTimeCountByEquList
(
DPFilterParamDto
dpFilterParamDto
)
{
// 1.按照前端约定格式返回数据
...
...
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