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
0327b460
Commit
0327b460
authored
Jul 30, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.大屏-区域安全指数接口优重写初稿
parent
197716b4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
147 additions
and
119 deletions
+147
-119
SecurityIndexCountItemDto.java
.../module/statistics/api/dto/SecurityIndexCountItemDto.java
+45
-0
AQZSDPStatisticsMapper.java
.../module/statistics/api/mapper/AQZSDPStatisticsMapper.java
+4
-4
AQZSDPStatisticsMapper.xml
...-api/src/main/resources/mapper/AQZSDPStatisticsMapper.xml
+5
-5
AQZSDPStatisticsController.java
.../statistcs/biz/controller/AQZSDPStatisticsController.java
+7
-8
AQZSDPStatisticsServiceImpl.java
...atistcs/biz/service/impl/AQZSDPStatisticsServiceImpl.java
+86
-102
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/dto/SecurityIndexCountItemDto.java
0 → 100644
View file @
0327b460
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistics
.
api
.
dto
;
import
lombok.Data
;
/**
* @author Administrator
*/
@Data
public
class
SecurityIndexCountItemDto
{
private
String
regionCode
;
private
String
regionName
;
/**
* 充装检查率
*/
private
String
czjc
;
/**
* 许可有效率
*/
String
xuke
;
/**
* 使用登记办理率
*/
String
shiyongdengji
;
/**
* 检验超期率
*/
String
jianyanchaoqi
;
/**
* 检验合格率
*/
String
jianyanhege
;
/**
* 充装检查率
*/
String
czjchege
;
}
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 @
0327b460
...
@@ -46,10 +46,10 @@ public interface AQZSDPStatisticsMapper {
...
@@ -46,10 +46,10 @@ public interface AQZSDPStatisticsMapper {
/**
/**
* 单位按照资质状态分组下的统计数量
* 单位按照资质状态分组下的统计数量
*
*
* @param
region
Code 区域
* @param
org
Code 区域
* @return List<KeyValueDto>
* @return List<KeyValueDto>
*/
*/
List
<
KeyValueDto
>
queryLicenseEfficiencyOfRegion
(
@Param
(
value
=
"
regionCode"
)
String
region
Code
);
List
<
KeyValueDto
>
queryLicenseEfficiencyOfRegion
(
@Param
(
value
=
"
orgCode"
)
String
org
Code
);
/**
/**
* 查询单个单位的有效期信息
* 查询单个单位的有效期信息
*
*
...
@@ -58,8 +58,8 @@ public interface AQZSDPStatisticsMapper {
...
@@ -58,8 +58,8 @@ public interface AQZSDPStatisticsMapper {
*/
*/
KeyValueDto
queryLicenseEfficiencyOneCompany
(
@Param
(
value
=
"appId"
)
String
appId
);
KeyValueDto
queryLicenseEfficiencyOneCompany
(
@Param
(
value
=
"appId"
)
String
appId
);
Map
<
String
,
Object
>
getInspectionExpiredRate
(
@Param
(
value
=
"
regionCode"
)
String
region
Code
,
@Param
(
value
=
"appId"
)
String
appId
);
Map
<
String
,
Object
>
getInspectionExpiredRate
(
@Param
(
value
=
"
orgCode"
)
String
org
Code
,
@Param
(
value
=
"appId"
)
String
appId
);
Map
<
String
,
Object
>
getInspectionResultRate
(
@Param
(
value
=
"
regionCode"
)
String
region
Code
,
@Param
(
value
=
"appId"
)
String
appId
);
Map
<
String
,
Object
>
getInspectionResultRate
(
@Param
(
value
=
"
orgCode"
)
String
org
Code
,
@Param
(
value
=
"appId"
)
String
appId
);
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/resources/mapper/AQZSDPStatisticsMapper.xml
View file @
0327b460
...
@@ -246,8 +246,8 @@
...
@@ -246,8 +246,8 @@
<where>
<where>
cu.data_sources = '陕西省内企业'
cu.data_sources = '陕西省内企业'
AND cu.unit_type LIKE '%充装单位%'
AND cu.unit_type LIKE '%充装单位%'
<if
test=
"
regionCode != null and region
Code != ''"
>
<if
test=
"
orgCode != null and org
Code != ''"
>
and cu.
org_code like concat(#{region
Code}, '%')
and cu.
supervise_org_code like concat(#{org
Code}, '%')
</if>
</if>
<if
test=
"appId != null and appId != ''"
>
<if
test=
"appId != null and appId != ''"
>
and cu.app_id = #{appId}
and cu.app_id = #{appId}
...
@@ -264,8 +264,8 @@
...
@@ -264,8 +264,8 @@
<where>
<where>
cu.data_sources = '陕西省内企业'
cu.data_sources = '陕西省内企业'
AND cu.unit_type LIKE '%充装单位%'
AND cu.unit_type LIKE '%充装单位%'
<if
test=
"
regionCode != null and region
Code != ''"
>
<if
test=
"
orgCode != null and org
Code != ''"
>
and cu.
org_code like concat( #{region
Code}, '%')
and cu.
supervise_org_code like concat( #{org
Code}, '%')
</if>
</if>
<if
test=
"appId != null and appId != ''"
>
<if
test=
"appId != null and appId != ''"
>
and cu.app_id = #{appId}
and cu.app_id = #{appId}
...
@@ -303,7 +303,7 @@
...
@@ -303,7 +303,7 @@
where
where
cu.data_sources = '陕西省内企业'
cu.data_sources = '陕西省内企业'
AND cu.unit_type LIKE '%充装单位%'
AND cu.unit_type LIKE '%充装单位%'
and cu.
org_code like concat('%', #{region
Code}, '%')
and cu.
supervise_org_code like concat(#{org
Code}, '%')
GROUP BY strKey
GROUP BY strKey
</select>
</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 @
0327b460
...
@@ -20,7 +20,7 @@ import java.util.List;
...
@@ -20,7 +20,7 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
@RestController
@RestController
@Api
(
tags
=
"大屏-安全追溯统计Api"
)
@Api
(
tags
=
"大屏-安全追溯
及气瓶
统计Api"
)
@RequestMapping
(
value
=
"/dp/aqzs"
)
@RequestMapping
(
value
=
"/dp/aqzs"
)
public
class
AQZSDPStatisticsController
{
public
class
AQZSDPStatisticsController
{
...
@@ -33,20 +33,19 @@ public class AQZSDPStatisticsController {
...
@@ -33,20 +33,19 @@ public class AQZSDPStatisticsController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"大屏-气瓶-区域安全指数"
)
@ApiOperation
(
value
=
"大屏-气瓶-区域安全指数"
)
@PostMapping
(
value
=
"/security-index"
)
@PostMapping
(
value
=
"/security-index"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getSecurityIndex
(
@
RequestBody
Map
<
String
,
Object
>
map
)
throws
Exception
{
public
ResponseModel
<
Map
<
String
,
Object
>>
getSecurityIndex
(
@
Validated
@RequestBody
DPFilterParamDto
dpFilterParamDto
,
BindingResult
bindingResult
)
throws
Exception
{
Object
regionCode
=
map
.
get
(
"cityCode"
);
List
<
FieldError
>
fieldErrors
=
bindingResult
.
getFieldErrors
(
);
if
(
ObjectUtils
.
isEmpty
(
regionCode
))
{
if
(
!
fieldErrors
.
isEmpty
(
))
{
regionCode
=
"610000"
;
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
())
;
}
}
Map
<
String
,
Object
>
result
=
statisticsService
.
getSecurityIndex
(
dpFilterParamDto
);
Map
<
String
,
Object
>
result
=
statisticsService
.
getSecurityIndex
(
regionCode
.
toString
());
return
ResponseHelper
.
buildResponse
(
result
);
return
ResponseHelper
.
buildResponse
(
result
);
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/earlyWarning/child"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-气瓶-区域安全指数统计"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-气瓶-区域安全指数统计"
)
@RequestMapping
(
value
=
"/earlyWarning/child"
,
method
=
RequestMethod
.
POST
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getChildEarlyWarning
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
Exception
{
public
ResponseModel
<
Map
<
String
,
Object
>>
getChildEarlyWarning
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
Exception
{
Object
regionCode
=
map
.
get
(
"cityCode"
);
Object
regionCode
=
map
.
get
(
"cityCode"
);
if
(
ObjectUtils
.
isEmpty
(
regionCode
))
{
if
(
ObjectUtils
.
isEmpty
(
regionCode
))
{
...
...
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 @
0327b460
...
@@ -8,9 +8,9 @@ import com.yeejoin.amos.boot.module.common.api.enums.IssueMainBodyEnum;
...
@@ -8,9 +8,9 @@ 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.IssueTypeEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum
;
import
com.yeejoin.amos.boot.module.common.api.enums.ReginStepEnum
;
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.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.ymt.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.service.ITzBaseEnterpriseInfoService
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
...
@@ -39,6 +39,7 @@ import java.time.format.DateTimeFormatter;
...
@@ -39,6 +39,7 @@ import java.time.format.DateTimeFormatter;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -64,8 +65,8 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -64,8 +65,8 @@ public class AQZSDPStatisticsServiceImpl {
private
AQZSDPStatisticsMapper
statisticsMapper
;
private
AQZSDPStatisticsMapper
statisticsMapper
;
private
String
getLicenseEfficiencyByRegion
(
String
region
Code
)
{
private
String
getLicenseEfficiencyByRegion
(
String
org
Code
)
{
List
<
KeyValueDto
>
keyValueDtos
=
statisticsMapper
.
queryLicenseEfficiencyOfRegion
(
region
Code
);
List
<
KeyValueDto
>
keyValueDtos
=
statisticsMapper
.
queryLicenseEfficiencyOfRegion
(
org
Code
);
int
totalUnitNumber
=
keyValueDtos
.
stream
().
mapToInt
(
KeyValueDto:
:
getIValue
).
sum
();
int
totalUnitNumber
=
keyValueDtos
.
stream
().
mapToInt
(
KeyValueDto:
:
getIValue
).
sum
();
int
okUnitNumberNumber
=
keyValueDtos
.
stream
().
filter
(
k
->
k
.
getStrKey
().
equals
(
LICENSE_IS_OK
)).
mapToInt
(
KeyValueDto:
:
getIValue
).
sum
();
int
okUnitNumberNumber
=
keyValueDtos
.
stream
().
filter
(
k
->
k
.
getStrKey
().
equals
(
LICENSE_IS_OK
)).
mapToInt
(
KeyValueDto:
:
getIValue
).
sum
();
if
(
totalUnitNumber
==
0
)
{
if
(
totalUnitNumber
==
0
)
{
...
@@ -79,7 +80,6 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -79,7 +80,6 @@ public class AQZSDPStatisticsServiceImpl {
private
long
searchEsCount
(
Boolean
checkOk
,
Boolean
resultOk
,
String
regionCode
,
String
appId
)
{
private
long
searchEsCount
(
Boolean
checkOk
,
Boolean
resultOk
,
String
regionCode
,
String
appId
)
{
CountRequest
countRequest
=
new
CountRequest
(
"cylinder_filling"
);
CountRequest
countRequest
=
new
CountRequest
(
"cylinder_filling"
);
// countRequest.indices("cylinder_filling");
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
if
(
checkOk
)
{
if
(
checkOk
)
{
//匹配充装前检查和充装后检查都有数据
//匹配充装前检查和充装后检查都有数据
...
@@ -161,15 +161,6 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -161,15 +161,6 @@ public class AQZSDPStatisticsServiceImpl {
xuke
.
add
(
String
.
format
(
"%.4f"
,
Double
.
parseDouble
(
value
)
/
100.0000
));
xuke
.
add
(
String
.
format
(
"%.4f"
,
Double
.
parseDouble
(
value
)
/
100.0000
));
}
}
}
}
if
(!
ValidationUtil
.
isEmpty
(
orgCode
)
&&
!
isHavingUnitInRegion
)
{
shiyongdengji
.
add
(
"0"
);
jianyanchaoqi
.
add
(
"0"
);
jianyanhege
.
add
(
"0"
);
shiyongdengji
.
add
(
"0"
);
czjc
.
add
(
"0"
);
czjchege
.
add
(
"0"
);
continue
;
}
// 2.使用登记办理率
// 2.使用登记办理率
shiyongdengji
.
add
(
"1"
);
shiyongdengji
.
add
(
"1"
);
// 3.检验超期率
// 3.检验超期率
...
@@ -216,122 +207,115 @@ public class AQZSDPStatisticsServiceImpl {
...
@@ -216,122 +207,115 @@ public class AQZSDPStatisticsServiceImpl {
return
regionList
;
return
regionList
;
}
}
public
Map
<
String
,
Object
>
getSecurityIndex
(
DPFilterParamDto
dpFilterParamDto
)
throws
Exception
{
List
<
RegionModel
>
regionModels
=
this
.
setRegionIfRootParent
(
dpFilterParamDto
.
getCityCode
());
Map
<
String
,
SecurityIndexCountItemDto
>
regionCodeSecurityIndexMap
=
getSecurityIndexCountItemDtoMap
(
regionModels
);
List
<
Map
<
String
,
String
>>
data
=
new
ArrayList
<>();
List
<
Map
<
String
,
String
>>
finalData
=
data
;
regionCodeSecurityIndexMap
.
forEach
((
k
,
v
)
->
{
Map
<
String
,
String
>
item
=
new
HashMap
<>();
item
.
put
(
"name"
,
v
.
getRegionName
());
// 计算xuke的加权值
double
xukeWeighted
=
Double
.
parseDouble
(
v
.
getXuke
())
*
0.10
;
// 剩余权重平均分配给四个因素,每个因素大约22.5%(但为了简化,我们这里用25%的剩余权重)
double
remainingWeightPerFactor
=
0.90
/
4
;
// 计算其他四个因素的加权值
double
jianyanchaoqiWeighted
=
Double
.
parseDouble
(
v
.
getJianyanchaoqi
())
*
remainingWeightPerFactor
;
double
jianyanhegeWeighted
=
Double
.
parseDouble
(
v
.
getJianyanhege
())
*
remainingWeightPerFactor
;
double
czjcWeighted
=
Double
.
parseDouble
(
v
.
getCzjc
())
*
remainingWeightPerFactor
;
double
czjchegeWeighted
=
Double
.
parseDouble
(
v
.
getCzjchege
())
*
remainingWeightPerFactor
;
// 计算总指数
double
totalIndex
=
xukeWeighted
+
jianyanchaoqiWeighted
+
jianyanhegeWeighted
+
czjcWeighted
+
czjchegeWeighted
;
item
.
put
(
"value"
,
String
.
format
(
"%.2f"
,
totalIndex
));
finalData
.
add
(
item
);
});
data
=
finalData
.
stream
()
.
filter
(
map
->
map
.
containsKey
(
"value"
))
.
sorted
(
Comparator
.
comparingDouble
(
map
->
{
// 检查并解析值,如果失败则返回Double.MIN_VALUE(或根据需要处理)
try
{
return
Double
.
parseDouble
(
map
.
get
(
"value"
));
}
catch
(
NumberFormatException
e
)
{
// 处理无法解析为double的情况,这里返回Double.MIN_VALUE表示最小
// 或者可以抛出自定义异常,记录日志等
return
Double
.
MIN_VALUE
;
}
}))
.
collect
(
Collectors
.
toList
());
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
List
<
String
>
name
=
data
.
stream
().
map
(
map
->
map
.
get
(
"name"
)).
collect
(
Collectors
.
toList
());
Collections
.
reverse
(
name
);
result
.
put
(
"xdata"
,
name
);
List
<
String
>
value
=
data
.
stream
().
map
(
map
->
map
.
get
(
"value"
)).
collect
(
Collectors
.
toList
());
Collections
.
reverse
(
value
);
result
.
put
(
"ydata"
,
value
);
return
result
;
}
public
Map
<
String
,
Object
>
getSecurityIndex
(
String
regionCode
)
throws
Exception
{
private
Map
<
String
,
SecurityIndexCountItemDto
>
getSecurityIndexCountItemDtoMap
(
List
<
RegionModel
>
regionModels
)
{
List
<
RegionModel
>
regionModels
=
this
.
setRegionIfRootParent
(
regionCode
);
List
<
SecurityIndexCountItemDto
>
countItemDtoList
=
getSecurityIndexCountDtoList
(
regionModels
);
List
<
String
>
collect
=
regionModels
.
stream
().
map
(
c
->
c
.
getRegionCode
().
toString
()).
collect
(
Collectors
.
toList
());
return
countItemDtoList
.
stream
().
collect
(
Collectors
.
toMap
(
SecurityIndexCountItemDto:
:
getRegionCode
,
Function
.
identity
(),
(
k1
,
k2
)
->
k2
));
List
<
CompanyModel
>
companyModelList
=
Privilege
.
companyClient
.
queryListByCompanyCode
(
Strings
.
join
(
collect
,
","
)).
getResult
();
Map
<
String
,
CompanyModel
>
companyMap
=
companyModelList
.
stream
().
collect
(
Collectors
.
toMap
(
CompanyModel:
:
getCompanyCode
,
c
->
c
));
List
<
String
>
xdata
=
new
ArrayList
<>();
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
<>();
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
());
private
List
<
SecurityIndexCountItemDto
>
getSecurityIndexCountDtoList
(
List
<
RegionModel
>
regionModels
)
{
return
regionModels
.
parallelStream
().
map
(
r
->
{
String
orgCode
=
this
.
getAndSetOrgCode
(
r
.
getRegionCode
().
toString
());
SecurityIndexCountItemDto
countItemDto
=
new
SecurityIndexCountItemDto
();
countItemDto
.
setRegionCode
(
r
.
getRegionCode
().
toString
());
countItemDto
.
setRegionName
(
r
.
getRegionName
());
if
(
ObjectUtils
.
isEmpty
(
orgCode
))
{
this
.
setDefaultZeroData
(
countItemDto
);
}
else
{
// 1.许可有效率
// 1.许可有效率
if
(!
ValidationUtil
.
isEmpty
(
companyModel
))
{
String
value
=
this
.
getLicenseEfficiencyByRegion
(
orgCode
);
String
value
=
this
.
getLicenseEfficiencyByRegion
(
orgCode
);
if
(
NO_DATA_STR
.
equals
(
value
))
{
if
(
NO_DATA_STR
.
equals
(
value
))
{
value
=
"0"
;
value
=
"0"
;
xuke
.
add
(
value
);
countItemDto
.
setXuke
(
value
);
}
else
{
}
else
{
xuke
.
add
(
value
);
countItemDto
.
setXuke
(
value
);
}
}
if
(!
ValidationUtil
.
isEmpty
(
orgCode
)
&&
!
isHavingUnitInRegion
)
{
shiyongdengji
.
add
(
"0"
);
jianyanchaoqi
.
add
(
"0"
);
jianyanhege
.
add
(
"0"
);
shiyongdengji
.
add
(
"0"
);
czjc
.
add
(
"0"
);
czjchege
.
add
(
"0"
);
continue
;
}
}
// 2.使用登记办理率
// 2.使用登记办理率 TODO
shiyongdengji
.
add
(
"100"
);
countItemDto
.
setShiyongdengji
(
"100"
);
// 3.检验超期率
// 3.检验超期率
jianyanchaoqi
.
add
(
statisticsMapper
.
getInspectionExpiredRate
(
orgCode
,
null
).
get
(
"expiredRate"
).
toString
());
countItemDto
.
setJianyanchaoqi
(
statisticsMapper
.
getInspectionExpiredRate
(
orgCode
,
null
).
get
(
"expiredRate"
).
toString
());
// 4.检验合格率
// 4.检验合格率
jianyanhege
.
add
(
statisticsMapper
.
getInspectionResultRate
(
orgCode
,
null
).
get
(
"resultRate"
).
toString
());
countItemDto
.
setJianyanhege
(
statisticsMapper
.
getInspectionResultRate
(
orgCode
,
null
).
get
(
"resultRate"
).
toString
());
// 5.充装检查率
// 5.充装检查率
long
totalAll
=
searchEsCount
(
false
,
false
,
orgCode
,
null
);
long
totalAll
=
searchEsCount
(
false
,
false
,
orgCode
,
null
);
long
totalCheck
=
searchEsCount
(
true
,
false
,
orgCode
,
null
);
long
totalCheck
=
searchEsCount
(
true
,
false
,
orgCode
,
null
);
long
totalResult
=
searchEsCount
(
false
,
true
,
orgCode
,
null
);
long
totalResult
=
searchEsCount
(
false
,
true
,
orgCode
,
null
);
if
(
totalAll
!=
0
)
{
if
(
totalAll
!=
0
)
{
czjc
.
add
(
new
DecimalFormat
(
"#.00"
).
format
(((
double
)
totalCheck
/
totalAll
)
*
100
));
countItemDto
.
setCzjc
(
new
DecimalFormat
(
"#.00"
).
format
(((
double
)
totalCheck
/
totalAll
)
*
100
));
}
else
{
}
else
{
czjc
.
add
(
"0"
);
countItemDto
.
setCzjc
(
"0"
);
}
}
// 6.充装检查合格率
// 6.充装检查合格率
if
(
totalAll
!=
0
)
{
if
(
totalAll
!=
0
)
{
czjchege
.
add
(
new
DecimalFormat
(
"#.00"
).
format
(((
double
)
totalResult
/
totalAll
)
*
100
));
countItemDto
.
setCzjchege
(
new
DecimalFormat
(
"#.00"
).
format
(((
double
)
totalResult
/
totalAll
)
*
100
));
}
else
{
}
else
{
czjchege
.
add
(
"0"
);
countItemDto
.
setCzjchege
(
"0"
);
}
}
}
}
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
return
countItemDto
;
}).
collect
(
Collectors
.
toList
());
List
<
Map
<
String
,
String
>>
data
=
new
ArrayList
<>();
// List<String> ydata = new ArrayList<>();
for
(
int
i
=
0
;
i
<
xdata
.
size
();
i
++)
{
Map
<
String
,
String
>
item
=
new
HashMap
<>();
item
.
put
(
"name"
,
xdata
.
get
(
i
));
// 计算xuke的加权值
double
xukeWeighted
=
Double
.
parseDouble
(
xuke
.
get
(
i
))
*
0.10
;
// 10%
// 剩余权重平均分配给四个因素,每个因素大约22.5%(但为了简化,我们这里用25%的剩余权重)
double
remainingWeightPerFactor
=
0.90
/
4
;
// 简化为每个因素25%的剩余权重
// 计算其他四个因素的加权值
double
jianyanchaoqiWeighted
=
Double
.
parseDouble
(
jianyanchaoqi
.
get
(
i
))
*
remainingWeightPerFactor
;
double
jianyanhegeWeighted
=
Double
.
parseDouble
(
jianyanhege
.
get
(
i
))
*
remainingWeightPerFactor
;
double
czjcWeighted
=
Double
.
parseDouble
(
czjc
.
get
(
i
))
*
remainingWeightPerFactor
;
double
czjchegeWeighted
=
Double
.
parseDouble
(
czjchege
.
get
(
i
))
*
remainingWeightPerFactor
;
// 计算总指数
double
totalIndex
=
xukeWeighted
+
jianyanchaoqiWeighted
+
jianyanhegeWeighted
+
czjcWeighted
+
czjchegeWeighted
;
item
.
put
(
"value"
,
String
.
format
(
"%.2f"
,
totalIndex
));
data
.
add
(
item
);
// ydata.add(String.format("%.2f", totalIndex));
}
}
data
=
data
.
stream
()
private
void
setDefaultZeroData
(
SecurityIndexCountItemDto
countItemDto
)
{
.
filter
(
map
->
map
.
containsKey
(
"value"
))
// 确保每个Map都包含指定的键
countItemDto
.
setXuke
(
"0"
);
.
sorted
(
Comparator
.
comparingDouble
(
map
->
{
countItemDto
.
setShiyongdengji
(
"0"
);
// 检查并解析值,如果失败则返回Double.MIN_VALUE(或根据需要处理)
countItemDto
.
setJianyanhege
(
"0"
);
try
{
countItemDto
.
setCzjc
(
"0"
);
return
Double
.
parseDouble
(
map
.
get
(
"value"
));
countItemDto
.
setCzjchege
(
"0"
);
}
catch
(
NumberFormatException
e
)
{
countItemDto
.
setJianyanchaoqi
(
"0"
);
// 处理无法解析为double的情况,这里返回Double.MIN_VALUE表示最小
// 或者可以抛出自定义异常,记录日志等
return
Double
.
MIN_VALUE
;
}
}
}))
.
collect
(
Collectors
.
toList
());
List
<
String
>
name
=
data
.
stream
().
map
(
map
->
map
.
get
(
"name"
)).
collect
(
Collectors
.
toList
());
Collections
.
reverse
(
name
);
result
.
put
(
"xdata"
,
name
);
List
<
String
>
value
=
data
.
stream
().
map
(
map
->
map
.
get
(
"value"
)).
collect
(
Collectors
.
toList
());
Collections
.
reverse
(
value
);
result
.
put
(
"ydata"
,
value
);
return
result
;
private
void
setDefaultZeroData
(
List
<
String
>
xuke
,
List
<
String
>
shiyongdengji
,
List
<
String
>
jianyanchaoqi
,
List
<
String
>
jianyanhege
,
List
<
String
>
czjc
,
List
<
String
>
czjchege
)
{
xuke
.
add
(
"0"
);
shiyongdengji
.
add
(
"0"
);
jianyanchaoqi
.
add
(
"0"
);
jianyanhege
.
add
(
"0"
);
czjc
.
add
(
"0"
);
czjchege
.
add
(
"0"
);
}
}
public
Map
<
String
,
Object
>
mainBodyCount
(
String
cityCode
)
{
public
Map
<
String
,
Object
>
mainBodyCount
(
String
cityCode
)
{
...
...
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