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
b98d2ad5
Commit
b98d2ad5
authored
Jul 30, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.大屏-气瓶-区域安全指数统计接口新写
parent
6f37533a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
73 deletions
+39
-73
AQZSDPStatisticsController.java
.../statistcs/biz/controller/AQZSDPStatisticsController.java
+6
-8
AQZSDPStatisticsServiceImpl.java
...atistcs/biz/service/impl/AQZSDPStatisticsServiceImpl.java
+27
-65
StCommonServiceImpl.java
...odule/statistcs/biz/service/impl/StCommonServiceImpl.java
+6
-0
No files found.
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 @
b98d2ad5
...
...
@@ -41,18 +41,16 @@ public class AQZSDPStatisticsController {
Map
<
String
,
Object
>
result
=
statisticsService
.
getSecurityIndex
(
dpFilterParamDto
);
return
ResponseHelper
.
buildResponse
(
result
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-气瓶-区域安全指数统计"
)
@RequestMapping
(
value
=
"/earlyWarning/child"
,
method
=
RequestMethod
.
POST
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getChildEarlyWarning
(
@
RequestBody
Map
<
String
,
Object
>
map
)
throws
Exception
{
Object
regionCode
=
map
.
get
(
"cityCode"
);
if
(
ObjectUtils
.
isEmpty
(
regionCode
))
{
regionCode
=
"610000"
;
public
ResponseModel
<
Map
<
String
,
Object
>>
getChildEarlyWarning
(
@
Validated
@RequestBody
DPFilterParamDto
dpFilterParamDto
,
BindingResult
bindingResult
)
throws
Exception
{
List
<
FieldError
>
fieldErrors
=
bindingResult
.
getFieldErrors
(
);
if
(
!
fieldErrors
.
isEmpty
(
))
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
())
;
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getChildEarlyWarning
(
regionCode
.
toString
()));
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getChildEarlyWarning
(
dpFilterParamDto
));
}
...
...
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 @
b98d2ad5
...
...
@@ -10,10 +10,7 @@ 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.CylinderStatisticsMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
joptsimple.internal.Strings
;
import
org.apache.commons.lang3.StringUtils
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RestHighLevelClient
;
...
...
@@ -23,7 +20,6 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
...
...
@@ -123,73 +119,28 @@ public class AQZSDPStatisticsServiceImpl {
}
}
public
Map
<
String
,
Object
>
getChildEarlyWarning
(
String
regionCode
)
throws
Exception
{
List
<
RegionModel
>
regionModels
=
stCommonService
.
setRegionIfRootParent
(
regionCode
);
List
<
String
>
collect
=
regionModels
.
stream
().
map
(
c
->
c
.
getRegionCode
().
toString
()).
collect
(
Collectors
.
toList
());
List
<
CompanyModel
>
companyModelList
=
Privilege
.
companyClient
.
queryListByCompanyCode
(
Strings
.
join
(
collect
,
","
)).
getResult
();
Map
<
String
,
CompanyModel
>
companyMap
=
companyModelList
.
stream
().
collect
(
Collectors
.
toMap
(
CompanyModel:
:
getCompanyCode
,
c
->
c
));
Set
<
String
>
legendData
=
new
HashSet
<>();
List
<
String
>
xdata
=
new
ArrayList
<>();
public
Map
<
String
,
Object
>
getChildEarlyWarning
(
DPFilterParamDto
dpFilterParamDto
)
throws
Exception
{
List
<
RegionModel
>
regionModels
=
stCommonService
.
setRegionIfRootParent
(
dpFilterParamDto
.
getCityCode
());
Map
<
String
,
SecurityIndexCountItemDto
>
regionCodeSecurityIndexMap
=
getSecurityIndexCountItemDtoMap
(
regionModels
);
Set
<
String
>
legendData
=
getLegendForCyArea
();
List
<
String
>
xuke
=
new
ArrayList
<>();
List
<
String
>
shiyongdengji
=
new
ArrayList
<>();
List
<
String
>
jianyanchaoqi
=
new
ArrayList
<>();
List
<
String
>
jianyanhege
=
new
ArrayList
<>();
List
<
String
>
czjc
=
new
ArrayList
<>();
List
<
String
>
czjchege
=
new
ArrayList
<>();
// List<String> renyuan = new ArrayList<>();
legendData
.
add
(
"许可有效率"
);
legendData
.
add
(
"使用登记办理率"
);
legendData
.
add
(
"检验超期率"
);
legendData
.
add
(
"检验合格率"
);
legendData
.
add
(
"充装检查率"
);
legendData
.
add
(
"充装检查合格率"
);
for
(
RegionModel
region
:
regionModels
)
{
CompanyModel
companyModel
=
companyMap
.
get
(
region
.
getRegionCode
().
toString
());
if
(
ObjectUtils
.
isEmpty
(
companyModel
))
{
continue
;
}
// 是否有充装企业在指定区域下
Boolean
isHavingUnitInRegion
=
true
;
String
orgCode
=
companyModel
.
getOrgCode
();
xdata
.
add
(
region
.
getRegionName
());
// 1.许可有效率
if
(!
ValidationUtil
.
isEmpty
(
companyModel
))
{
String
value
=
this
.
getLicenseEfficiencyByRegion
(
orgCode
);
if
(
NO_DATA_STR
.
equals
(
value
))
{
xuke
.
add
(
"0"
);
}
else
{
xuke
.
add
(
String
.
format
(
"%.4f"
,
Double
.
parseDouble
(
value
)
/
100.0000
));
}
}
// 2.使用登记办理率
shiyongdengji
.
add
(
"1"
);
// 3.检验超期率
jianyanchaoqi
.
add
(
String
.
format
(
"%.4f"
,
Double
.
parseDouble
(
statisticsMapper
.
getInspectionExpiredRate
(
orgCode
,
null
).
get
(
"expiredRate"
).
toString
())
/
100.0000
));
// 4.检验合格率
jianyanhege
.
add
(
String
.
format
(
"%.4f"
,
Double
.
parseDouble
(
statisticsMapper
.
getInspectionResultRate
(
orgCode
,
null
).
get
(
"resultRate"
).
toString
())
/
100.0000
));
// 5.充装检查率
long
totalAll
=
searchEsCount
(
false
,
false
,
orgCode
,
null
);
long
totalCheck
=
searchEsCount
(
true
,
false
,
orgCode
,
null
);
long
totalResult
=
searchEsCount
(
false
,
true
,
orgCode
,
null
);
if
(
totalAll
!=
0
)
{
czjc
.
add
(
new
DecimalFormat
(
"#.0000"
).
format
(((
double
)
totalCheck
/
totalAll
)));
}
else
{
czjc
.
add
(
"0"
);
}
// 6.充装检查合格率
if
(
totalAll
!=
0
)
{
czjchege
.
add
(
new
DecimalFormat
(
"#.0000"
).
format
(((
double
)
totalResult
/
totalAll
)));
}
else
{
czjchege
.
add
(
"0"
);
}
}
//TODO 多线程处理后,regionCodeSecurityIndexMap顺序与regionModels的顺序不一致,需让数据和x轴的顺序保存一致
List
<
String
>
xdata
=
stCommonService
.
buildXData
(
regionModels
);
regionModels
.
forEach
(
r
->
{
SecurityIndexCountItemDto
countItemDto
=
regionCodeSecurityIndexMap
.
get
(
r
.
getRegionCode
().
toString
());
xuke
.
add
(
countItemDto
.
getXuke
());
shiyongdengji
.
add
(
countItemDto
.
getShiyongdengji
());
jianyanchaoqi
.
add
(
countItemDto
.
getJianyanchaoqi
());
jianyanhege
.
add
(
countItemDto
.
getJianyanhege
());
czjc
.
add
(
countItemDto
.
getCzjc
());
czjchege
.
add
(
countItemDto
.
getCzjchege
());
});
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"xdata"
,
xdata
);
result
.
put
(
"legendData"
,
legendData
);
result
.
put
(
"xuke"
,
xuke
);
...
...
@@ -198,10 +149,20 @@ public class AQZSDPStatisticsServiceImpl {
result
.
put
(
"jianyanhege"
,
jianyanhege
);
result
.
put
(
"czjc"
,
czjc
);
result
.
put
(
"czjchege"
,
czjchege
);
return
result
;
}
private
Set
<
String
>
getLegendForCyArea
()
{
Set
<
String
>
legendData
=
new
HashSet
<>();
legendData
.
add
(
"许可有效率"
);
legendData
.
add
(
"使用登记办理率"
);
legendData
.
add
(
"检验超期率"
);
legendData
.
add
(
"检验合格率"
);
legendData
.
add
(
"充装检查率"
);
legendData
.
add
(
"充装检查合格率"
);
return
legendData
;
}
public
Map
<
String
,
Object
>
getSecurityIndex
(
DPFilterParamDto
dpFilterParamDto
)
throws
Exception
{
List
<
RegionModel
>
regionModels
=
stCommonService
.
setRegionIfRootParent
(
dpFilterParamDto
.
getCityCode
());
...
...
@@ -249,6 +210,7 @@ public class AQZSDPStatisticsServiceImpl {
}
private
Map
<
String
,
SecurityIndexCountItemDto
>
getSecurityIndexCountItemDtoMap
(
List
<
RegionModel
>
regionModels
)
{
// 多线程处理后,顺序与regionModels的顺序不一致,故生成list
List
<
SecurityIndexCountItemDto
>
countItemDtoList
=
getSecurityIndexCountDtoList
(
regionModels
);
return
countItemDtoList
.
stream
().
collect
(
Collectors
.
toMap
(
SecurityIndexCountItemDto:
:
getRegionCode
,
Function
.
identity
(),
(
k1
,
k2
)
->
k2
));
}
...
...
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/StCommonServiceImpl.java
View file @
b98d2ad5
...
...
@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
/**
* @author Administrator
...
...
@@ -78,4 +79,9 @@ public class StCommonServiceImpl {
}
return
regionList
;
}
public
List
<
String
>
buildXData
(
List
<
RegionModel
>
regionList
)
{
return
regionList
.
stream
().
map
(
RegionModel:
:
getRegionName
).
collect
(
Collectors
.
toList
());
}
}
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