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
7492dec9
Commit
7492dec9
authored
Jul 30, 2024
by
麻笑宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安全追溯大屏中间地图调整
parent
6f37533a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
341 additions
and
4 deletions
+341
-4
DPMapStatisticsItemEnum.java
...mos/boot/module/jg/api/enums/DPMapStatisticsItemEnum.java
+3
-0
AQZSDPStatisticsMapper.java
.../module/statistics/api/mapper/AQZSDPStatisticsMapper.java
+1
-0
AQZSDPStatisticsMapper.xml
...-api/src/main/resources/mapper/AQZSDPStatisticsMapper.xml
+12
-0
AQZSDPStatisticsController.java
.../statistcs/biz/controller/AQZSDPStatisticsController.java
+22
-0
DataInitAfterRuning.java
...s/boot/module/statistcs/biz/init/DataInitAfterRuning.java
+6
-1
AQZSDPStatisticsServiceImpl.java
...atistcs/biz/service/impl/AQZSDPStatisticsServiceImpl.java
+289
-1
EquipTechParamPipelineMapper.java
...t/module/ymt/api/mapper/EquipTechParamPipelineMapper.java
+2
-1
EquipmentCategoryMapper.java
...s/boot/module/ymt/api/mapper/EquipmentCategoryMapper.java
+2
-0
TzBaseEnterpriseInfoMapper.java
...oot/module/ymt/api/mapper/TzBaseEnterpriseInfoMapper.java
+2
-0
TzsUserInfoMapper.java
...in/amos/boot/module/ymt/api/mapper/TzsUserInfoMapper.java
+2
-1
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/enums/DPMapStatisticsItemEnum.java
View file @
7492dec9
...
...
@@ -30,6 +30,9 @@ public enum DPMapStatisticsItemEnum {
GAS_UNITS
(
"充装单位 (家)"
,
"gasUnits"
,
""
),
OPERATORS
(
"作业人员 (人)"
,
"operators"
,
""
),
DEVICE_COUNT
(
"已纳管设备数"
,
"deviceCount"
,
""
),
PERSON_ISSUES_COUNT
(
"个人问题数"
,
"个人"
,
""
),
COMPANY_ISSUES_COUNT
(
"企业问题数"
,
"企业"
,
""
),
EQU_ISSUES_COUNT
(
"设备数"
,
"设备"
,
""
),
CERTIFICATE_COUNT
(
"登记证总量"
,
"certificateCount"
,
""
);
private
String
label
;
private
String
code
;
...
...
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 @
7492dec9
...
...
@@ -62,4 +62,5 @@ public interface AQZSDPStatisticsMapper {
Map
<
String
,
Object
>
getInspectionResultRate
(
@Param
(
value
=
"orgCode"
)
String
orgCode
,
@Param
(
value
=
"appId"
)
String
appId
);
List
<
Map
<
String
,
Object
>>
selectByOrg
(
String
orgCode
);
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/resources/mapper/AQZSDPStatisticsMapper.xml
View file @
7492dec9
...
...
@@ -306,6 +306,18 @@
and cu.supervise_org_code like concat(#{orgCode}, '%')
GROUP BY strKey
</select>
<select
id=
"selectByOrg"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
source_type AS sourceType
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
GROUP BY
source_type
</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/controller/AQZSDPStatisticsController.java
View file @
7492dec9
...
...
@@ -243,4 +243,26 @@ public class AQZSDPStatisticsController {
List
<
Map
<
String
,
Object
>>
result
=
statisticsService
.
issueCountTopByProblemType
(
regionCode
.
toString
());
return
ResponseHelper
.
buildResponse
(
result
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-中间地图左右两侧8大类、单位、人员数量、问题数量全局统计"
,
notes
=
"大屏中间-地图左右两侧8大类、单位、人员数量、问题数量全局统计"
)
@PostMapping
(
value
=
"/center-map/legend"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
centerMapCountForGlobal
(
@Validated
@RequestBody
DPFilterParamDto
dpFilterParamDto
,
BindingResult
result
)
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getCenterMapCountDataForGlobal
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"安全追溯大屏-中间地图地市统计"
,
notes
=
"安全追溯大屏中间-地图地市统计"
)
@PostMapping
(
value
=
"/center-map/overview"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
centerMapCountForOverview
(
@Validated
@RequestBody
DPFilterParamDto
dpFilterParamDto
,
BindingResult
result
)
throws
Exception
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getCenterMapCountDataForOverview
(
dpFilterParamDto
));
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/init/DataInitAfterRuning.java
View file @
7492dec9
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
init
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.impl.AQZSDPStatisticsServiceImpl
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.impl.JGDPStatisticsServiceImpl
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
...
...
@@ -16,14 +17,17 @@ public class DataInitAfterRuning implements ApplicationRunner {
private
JGDPStatisticsServiceImpl
jgdpStatisticsService
;
private
AQZSDPStatisticsServiceImpl
aqzsdpStatisticsService
;
private
StCommonServiceImpl
stCommonService
;
private
AmosRequestContext
amosRequestContext
;
public
DataInitAfterRuning
(
JGDPStatisticsServiceImpl
jgdpStatisticsService
,
StCommonServiceImpl
stCommonService
,
AmosRequestContext
amosRequestContext
)
{
public
DataInitAfterRuning
(
JGDPStatisticsServiceImpl
jgdpStatisticsService
,
StCommonServiceImpl
stCommonService
,
AmosRequestContext
amosRequestContext
,
AQZSDPStatisticsServiceImpl
aqzsdpStatisticsService
)
{
this
.
jgdpStatisticsService
=
jgdpStatisticsService
;
this
.
stCommonService
=
stCommonService
;
this
.
amosRequestContext
=
amosRequestContext
;
this
.
aqzsdpStatisticsService
=
aqzsdpStatisticsService
;
}
@Override
...
...
@@ -34,5 +38,6 @@ public class DataInitAfterRuning implements ApplicationRunner {
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
jgdpStatisticsService
.
init
();
stCommonService
.
init
();
aqzsdpStatisticsService
.
init
();
}
}
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 @
7492dec9
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.biz.common.dto.KeyValueDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.common.api.enums.IssueMainBodyEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.IssueTypeEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.DPMapStatisticsItemEnum
;
import
com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto
;
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.ymt.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderStatisticsMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.EquipTechParamPipelineMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.TzBaseEnterpriseInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
joptsimple.internal.Strings
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.lucene.queryparser.classic.QueryParser
;
import
org.elasticsearch.action.search.SearchRequest
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.client.core.CountRequest
;
import
org.elasticsearch.client.core.CountResponse
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
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.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
...
@@ -33,8 +51,10 @@ import java.text.NumberFormat;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.function.Function
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -50,12 +70,91 @@ public class AQZSDPStatisticsServiceImpl {
private
final
static
String
NO_DATA_STR
=
"--"
;
/**
* 压力容器设备种类
*/
private
final
static
String
EQU_LIST_CYLINDER
=
"2000"
;
/**
* 气瓶设备类别
*/
private
final
static
String
EQU_CATEGORY_CYLINDER
=
"2300"
;
/**
* 单位类型-使用单位
*/
private
final
static
String
COMPANY_TYPE_USE
=
"使用单位"
;
/**
* 单位类型-安装改造维修单位
*/
private
final
static
String
COMPANY_TYPE_MAINTENANCE
=
"安装改造维修单位"
;
/**
* 单位类型-制造单位
*/
private
final
static
String
COMPANY_TYPE_MANUFACTURE
=
"制造单位"
;
/**
* 单位类型-充装单位
*/
private
final
static
String
COMPANY_TYPE_FILLING
=
"充装单位"
;
/**
* 监管-中屏-地图行政区划code
*/
private
final
static
String
REGION_CODE
=
"regionCode"
;
/**
* 监管-中屏-地图行政区划code
*/
private
final
static
String
REGION_NAME
=
"regionName"
;
private
static
List
<
EquipmentCategoryDto
>
equipmentCategoryDtos
;
private
static
List
<
RegionModel
>
regionModels
=
new
ArrayList
<>();
private
static
Map
<
String
,
String
>
regionCodeOrgCodeMap
=
new
ConcurrentHashMap
<>();
private
RestHighLevelClient
restHighLevelClient
;
private
AQZSDPStatisticsMapper
statisticsMapper
;
@Autowired
private
EquipmentCategoryMapper
equipmentCategoryMapper
;
@Autowired
private
EquipTechParamPipelineMapper
techParamsPipelineMapper
;
@Autowired
private
TzBaseEnterpriseInfoMapper
enterpriseInfoMapper
;
@Autowired
private
TzsUserInfoMapper
userInfoMapper
;
public
void
init
()
{
// 数据不变所以放到内存,提高响应时间
equipmentCategoryDtos
=
equipmentCategoryMapper
.
selectClassify
();
initReginCode
();
}
private
void
initReginCode
()
{
Collection
<
RegionModel
>
result
=
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
();
result
.
forEach
(
r
->
{
regionModels
.
add
(
r
);
this
.
loopSetChildRegin
(
regionModels
,
r
.
getChildren
());
});
}
private
void
loopSetChildRegin
(
List
<
RegionModel
>
regionModels
,
Collection
<
RegionModel
>
children
)
{
if
(
children
!=
null
&&
children
.
size
()
>
0
)
{
children
.
forEach
(
c
->
{
regionModels
.
add
(
c
);
this
.
loopSetChildRegin
(
regionModels
,
c
.
getChildren
());
});
}
}
private
CylinderStatisticsMapper
cylinderStatisticsMapper
;
...
...
@@ -317,7 +416,7 @@ public class AQZSDPStatisticsServiceImpl {
public
Map
<
String
,
Object
>
mainBodyCount
(
String
cityCode
)
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>();
String
startDate
=
LocalDate
.
now
().
minusDays
(
100
).
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
));
String
startDate
=
LocalDate
.
now
().
minusDays
(
29
).
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
));
List
<
String
>
mainBodyNameList
=
IssueMainBodyEnum
.
getEnumNameList
();
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
cityCode
);
List
<
Map
<
String
,
Object
>>
list
=
statisticsMapper
.
selectByOrgAndMainBody
(
orgCode
,
mainBodyNameList
,
startDate
,
null
);
...
...
@@ -800,5 +899,193 @@ public class AQZSDPStatisticsServiceImpl {
dpFilterParamDto
.
setEndDate
(
DateUtil
.
today
());
}
}
public
Map
<
String
,
Object
>
getCenterMapCountDataForGlobal
(
DPFilterParamDto
dpFilterParamDto
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
if
(
StringUtils
.
isEmpty
(
orgCode
))
{
return
new
HashMap
<>();
}
// 1.气瓶数量统计
long
cylinderNum
=
this
.
staticsCenterMapCountDataForCylinder
(
result
,
orgCode
);
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
this
.
staticsCenterMapCountDataForEquip
(
result
,
cylinderNum
,
orgCode
);
//2.压力管道长度统计
this
.
staticsCenterMapCountDataForPipeline
(
result
,
orgCode
);
//3.单位数量统计
this
.
staticsCenterMapCountDataForCompany
(
result
,
orgCode
);
//4.人员数量统计
this
.
staticsCenterMapCountDataForPerson
(
result
,
dpFilterParamDto
,
orgCode
);
//5.问题数统计
this
.
staticsCenterMapCountDataForIssue
(
result
,
orgCode
);
return
result
;
}
private
void
staticsCenterMapCountDataForIssue
(
Map
<
String
,
Object
>
result
,
String
orgCode
)
{
List
<
Map
<
String
,
Object
>>
list
=
statisticsMapper
.
selectByOrg
(
orgCode
);
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>();
AtomicReference
<
Long
>
issueCount
=
new
AtomicReference
<>(
0L
);
list
.
stream
().
forEach
(
t
->
{
dataMap
.
put
(
t
.
get
(
"sourceType"
).
toString
(),
t
.
get
(
"count"
));
issueCount
.
updateAndGet
(
v
->
v
+
Long
.
parseLong
(
t
.
get
(
"count"
).
toString
()));
});
result
.
put
(
"issueCount"
,
issueCount
.
get
());
result
.
put
(
"deviceIssueCount"
,
dataMap
.
getOrDefault
(
DPMapStatisticsItemEnum
.
EQU_ISSUES_COUNT
,
0L
));
result
.
put
(
"companyIssueCount"
,
dataMap
.
getOrDefault
(
DPMapStatisticsItemEnum
.
COMPANY_ISSUES_COUNT
,
0L
));
result
.
put
(
"personIssueCount"
,
dataMap
.
getOrDefault
(
DPMapStatisticsItemEnum
.
PERSON_ISSUES_COUNT
,
0L
));
}
private
long
staticsCenterMapCountDataForCylinder
(
Map
<
String
,
Object
>
result
,
String
orgCode
)
{
long
num
=
0
;
CountRequest
request
=
new
CountRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 按照管辖机构区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
// 设备类别精确查询气瓶
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_CATEGORY_CODE"
,
EQU_CATEGORY_CYLINDER
));
// 且在用状态设备
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"EQU_STATE"
,
EquimentEnum
.
ZAIYONG
.
getCode
()));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
num
=
response
.
getCount
();
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
result
.
put
(
DPMapStatisticsItemEnum
.
GAS
.
getCode
(),
num
);
return
num
;
}
private
void
staticsCenterMapCountDataForEquip
(
Map
<
String
,
Object
>
result
,
long
cylinderNum
,
String
orgCode
)
{
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 按照管辖机构区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgCode
)
+
"*"
));
// 且在用状态设备
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"EQU_STATE"
,
EquimentEnum
.
ZAIYONG
.
getCode
()));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"count_by_equ_list_code"
).
field
(
"EQU_LIST_CODE"
);
builder
.
aggregation
(
aggregationBuilder
);
request
.
source
(
builder
);
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
Terms
terms
=
response
.
getAggregations
().
get
(
"count_by_equ_list_code"
);
Map
<
String
,
Long
>
countMap
=
new
HashMap
<>();
for
(
Terms
.
Bucket
bucket
:
terms
.
getBuckets
())
{
// 压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
if
(
bucket
.
getKeyAsString
().
equals
(
EQU_LIST_CYLINDER
))
{
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
()
-
cylinderNum
);
}
else
{
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
}
}
// 按照8大类枚举,进行加工。目的:固定八大类防止没统计数据导致缺少分类、将设备种类的code换成前端定义的key
equipmentCategoryDtos
.
forEach
(
c
->
{
result
.
put
(
this
.
castCategoryCode2WebCode
(
c
.
getCode
()),
countMap
.
getOrDefault
(
c
.
getCode
(),
0L
));
});
result
.
put
(
DPMapStatisticsItemEnum
.
TOTAL
.
getCode
(),
countMap
.
values
().
stream
().
mapToLong
(
e
->
e
).
sum
()
+
cylinderNum
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
result
.
remove
(
DPMapStatisticsItemEnum
.
PRESSURE_PIPELINES
.
getCategory
());
}
private
String
castCategoryCode2WebCode
(
String
category
)
{
DPMapStatisticsItemEnum
itemEnum
=
DPMapStatisticsItemEnum
.
getInstanceByCategory
(
category
);
return
itemEnum
.
getCode
();
}
private
void
staticsCenterMapCountDataForPipeline
(
Map
<
String
,
Object
>
result
,
String
orgCode
)
{
String
length
=
techParamsPipelineMapper
.
sumPipeLengthByOrgCode
(
orgCode
);
BigDecimal
lengthDecimal
=
new
BigDecimal
(
length
);
if
(
lengthDecimal
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
length
=
lengthDecimal
.
divide
(
new
BigDecimal
(
"1000"
),
3
,
RoundingMode
.
HALF_UP
).
toPlainString
();
}
result
.
put
(
DPMapStatisticsItemEnum
.
PRESSURE_PIPELINES
.
getCode
(),
length
);
}
private
void
staticsCenterMapCountDataForCompany
(
Map
<
String
,
Object
>
result
,
String
orgCode
)
{
if
(
orgCode
==
null
)
{
setDefaultCompanyCountData
(
result
);
return
;
}
List
<
CountDto
>
countDtos
=
enterpriseInfoMapper
.
countByUnitTypeAndOrgCode
(
orgCode
);
result
.
put
(
DPMapStatisticsItemEnum
.
USERS_UNITS
.
getCode
(),
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
contains
(
COMPANY_TYPE_USE
)).
mapToInt
(
CountDto:
:
getIntValue
).
sum
());
result
.
put
(
DPMapStatisticsItemEnum
.
CONSTRUCTION_UNITS
.
getCode
(),
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
contains
(
COMPANY_TYPE_MAINTENANCE
)).
mapToInt
(
CountDto:
:
getIntValue
).
sum
());
result
.
put
(
DPMapStatisticsItemEnum
.
MANUFACTURING_UNITS
.
getCode
(),
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
contains
(
COMPANY_TYPE_MANUFACTURE
)).
mapToInt
(
CountDto:
:
getIntValue
).
sum
());
result
.
put
(
DPMapStatisticsItemEnum
.
GAS_UNITS
.
getCode
(),
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
contains
(
COMPANY_TYPE_FILLING
)).
mapToInt
(
CountDto:
:
getIntValue
).
sum
());
}
private
void
setDefaultCompanyCountData
(
Map
<
String
,
Object
>
m
)
{
m
.
put
(
DPMapStatisticsItemEnum
.
USERS_UNITS
.
getCode
(),
0
);
m
.
put
(
DPMapStatisticsItemEnum
.
CONSTRUCTION_UNITS
.
getCode
(),
0
);
m
.
put
(
DPMapStatisticsItemEnum
.
MANUFACTURING_UNITS
.
getCode
(),
0
);
m
.
put
(
DPMapStatisticsItemEnum
.
GAS_UNITS
.
getCode
(),
0
);
}
private
void
staticsCenterMapCountDataForPerson
(
Map
<
String
,
Object
>
result
,
DPFilterParamDto
dpFilterParamDto
,
String
orgCode
)
{
if
(
orgCode
==
null
)
{
result
.
put
(
DPMapStatisticsItemEnum
.
OPERATORS
.
getCode
(),
0
);
return
;
}
Long
num
=
userInfoMapper
.
countUserByPostAndAreaCode
(
orgCode
,
"6552"
,
dpFilterParamDto
.
getCityCode
());
result
.
put
(
DPMapStatisticsItemEnum
.
OPERATORS
.
getCode
(),
num
);
}
public
List
<
Map
<
String
,
Object
>>
getCenterMapCountDataForOverview
(
DPFilterParamDto
dpFilterParamDto
)
throws
Exception
{
List
<
RegionModel
>
regionModels
=
stCommonService
.
setRegionIfRootParent
(
dpFilterParamDto
.
getCityCode
());
List
<
Map
<
String
,
Object
>>
result
=
regionModels
.
parallelStream
().
map
(
r
->
{
DPFilterParamDto
filterParamDto
=
new
DPFilterParamDto
();
filterParamDto
.
setCityCode
(
r
.
getRegionCode
().
toString
());
Map
<
String
,
Object
>
itemResult
=
getCenterMapOverviewData
(
filterParamDto
);
itemResult
.
put
(
"regionCode"
,
r
.
getRegionCode
());
itemResult
.
put
(
"regionName"
,
r
.
getRegionName
());
return
itemResult
;
}).
collect
(
Collectors
.
toList
());
this
.
setCompanyDataBatch
(
result
);
return
result
;
}
private
void
setCompanyDataBatch
(
List
<
Map
<
String
,
Object
>>
result
)
{
List
<
CountDto
>
countDtos
=
enterpriseInfoMapper
.
countByUnitTypeAndOrgCodeNoParam
();
result
.
forEach
(
m
->
{
String
cityCode
=
m
.
get
(
"regionCode"
).
toString
();
String
orgCode
=
regionCodeOrgCodeMap
.
get
(
cityCode
);
if
(
orgCode
!=
null
)
{
m
.
put
(
DPMapStatisticsItemEnum
.
USERS_UNITS
.
getCode
(),
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
contains
(
COMPANY_TYPE_USE
)
&&
c
.
getLabel
().
contains
(
orgCode
)).
mapToInt
(
CountDto:
:
getIntValue
).
sum
());
m
.
put
(
DPMapStatisticsItemEnum
.
CONSTRUCTION_UNITS
.
getCode
(),
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
contains
(
COMPANY_TYPE_MAINTENANCE
)
&&
c
.
getLabel
().
contains
(
orgCode
)).
mapToInt
(
CountDto:
:
getIntValue
).
sum
());
m
.
put
(
DPMapStatisticsItemEnum
.
MANUFACTURING_UNITS
.
getCode
(),
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
contains
(
COMPANY_TYPE_MANUFACTURE
)
&&
c
.
getLabel
().
contains
(
orgCode
)).
mapToInt
(
CountDto:
:
getIntValue
).
sum
());
m
.
put
(
DPMapStatisticsItemEnum
.
GAS_UNITS
.
getCode
(),
countDtos
.
stream
().
filter
(
c
->
c
.
getKeyStr
().
contains
(
COMPANY_TYPE_FILLING
)
&&
c
.
getLabel
().
contains
(
orgCode
)).
mapToInt
(
CountDto:
:
getIntValue
).
sum
());
}
else
{
setDefaultCompanyCountData
(
m
);
}
});
}
private
Map
<
String
,
Object
>
getCenterMapOverviewData
(
DPFilterParamDto
dpFilterParamDto
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
if
(
StringUtils
.
isEmpty
(
orgCode
))
{
return
new
HashMap
<>();
}
// 0. 气瓶数量统计
long
cylinderNum
=
this
.
staticsCenterMapCountDataForCylinder
(
result
,
orgCode
);
// 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
this
.
staticsCenterMapCountDataForEquip
(
result
,
cylinderNum
,
orgCode
);
// 2. 压力管道长度统计
this
.
staticsCenterMapCountDataForPipeline
(
result
,
orgCode
);
// 3.单位数量统计
this
.
staticsCenterMapCountDataForCompany
(
result
,
orgCode
);
// 4. 人员数量统计
this
.
staticsCenterMapCountDataForPerson
(
result
,
dpFilterParamDto
,
orgCode
);
// 5.问题统计
this
.
staticsCenterMapCountDataForIssue
(
result
,
orgCode
);
return
result
;
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/mapper/EquipTechParamPipelineMapper.java
View file @
7492dec9
...
...
@@ -2,8 +2,9 @@ package com.yeejoin.amos.boot.module.ymt.api.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.EquipTechParamPipeline
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
EquipTechParamPipelineMapper
extends
BaseMapper
<
EquipTechParamPipeline
>
{
/**
* 在用的最新需求整理的技术参数--需求未出
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/mapper/EquipmentCategoryMapper.java
View file @
7492dec9
...
...
@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import
com.yeejoin.amos.boot.module.ymt.api.dto.UseUnitCreditCodeCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
...
...
@@ -19,6 +20,7 @@ import java.util.Map;
* @author system_generator
* @date 2021-10-20
*/
@Mapper
public
interface
EquipmentCategoryMapper
extends
BaseMapper
<
EquipmentCategory
>
{
@Select
(
"select * from tz_equipment_category where code in('1000','2000','3000','4000','5000','6000','8000','9000')"
)
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/mapper/TzBaseEnterpriseInfoMapper.java
View file @
7492dec9
...
...
@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquEnterDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -17,6 +18,7 @@ import java.util.List;
* @author duanwei
* @date 2022-08-10
*/
@Mapper
public
interface
TzBaseEnterpriseInfoMapper
extends
BaseMapper
<
TzBaseEnterpriseInfo
>
{
/**
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/mapper/TzsUserInfoMapper.java
View file @
7492dec9
...
...
@@ -4,8 +4,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.TzsUserInfoDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.TzsUserInfo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
TzsUserInfoMapper
extends
BaseMapper
<
TzsUserInfo
>
{
Page
<
TzsUserInfoDto
>
selectPageMessage
(
@Param
(
"page"
)
Page
<
TzsUserInfoDto
>
page
,
@Param
(
"dto"
)
TzsUserInfoDto
dto
);
...
...
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