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
f2a92fa0
Commit
f2a92fa0
authored
Nov 05, 2024
by
麻笑宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标管理代码提交
parent
f2ef1d83
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
447 additions
and
0 deletions
+447
-0
ZBGLEnum.java
...m/yeejoin/amos/boot/module/common/api/enums/ZBGLEnum.java
+54
-0
ZBGLStatisticsMapper.java
...ot/module/statistics/api/mapper/ZBGLStatisticsMapper.java
+26
-0
ZBGLStatisticsMapper.xml
...cs-api/src/main/resources/mapper/ZBGLStatisticsMapper.xml
+45
-0
ZBGLConstants.java
...mos/boot/module/statistcs/biz/constant/ZBGLConstants.java
+49
-0
ZBGLDPStatisticsController.java
.../statistcs/biz/controller/ZBGLDPStatisticsController.java
+81
-0
IZBGLService.java
.../amos/boot/module/statistcs/biz/service/IZBGLService.java
+13
-0
ZBGLDPStatisticsServiceImpl.java
...atistcs/biz/service/impl/ZBGLDPStatisticsServiceImpl.java
+31
-0
DtgzyyzbfxServiceImpl.java
...stcs/biz/service/impl/ZBGLImpl/DtgzyyzbfxServiceImpl.java
+118
-0
ZBGLFactory.java
...ejoin/amos/boot/module/statistcs/factory/ZBGLFactory.java
+30
-0
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/ZBGLEnum.java
0 → 100644
View file @
f2a92fa0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.*
;
@Getter
@AllArgsConstructor
public
enum
ZBGLEnum
{
YJCZ
(
"应急处置"
,
"yjcz"
,
true
,
null
,
""
),
DTGZYYZBFX
(
"电梯故障原因占比分析"
,
"dtgzyyzbfx"
,
false
,
"yjcz"
,
"dtgzyyzbfxServiceImpl"
),
DTKRSJCSFX
(
"电梯困人事件场所分布"
,
"dtkrsjcsfx"
,
false
,
"yjcz"
,
""
),
KRJYYDQK
(
"困人救援月度情况"
,
"krjyydqk"
,
false
,
"yjcz"
,
""
),
JDGL
(
"监督管理"
,
"jdgl"
,
true
,
null
,
""
),
YWBLPJSXTJ
(
"业务办理平均时效统计"
,
"ywblpjsxtj"
,
false
,
"jdgl"
,
""
),
AQZS
(
"安全追溯"
,
"aqzs"
,
true
,
null
,
""
),
YHSLQS
(
"隐患数量趋势(近12个月)"
,
"yhslqs"
,
false
,
"aqzs"
,
""
),
AYHLXYHSLPM
(
"按隐患类型隐患数量排名(Top10)"
,
"ayhlxyhslpm"
,
false
,
"aqzs"
,
""
),
DNZTDWYHPM
(
"当年主体单位隐患排名(Top10)"
,
"dnztdwyhpm"
,
false
,
"aqzs"
,
""
),
QP
(
"气瓶"
,
"qp"
,
true
,
null
,
""
),
QYAQZSTJ
(
"区域安全指数统计"
,
"qyaqzstj"
,
false
,
"qp"
,
""
),
;
String
name
;
String
code
;
Boolean
isMainBody
;
String
mainBody
;
String
className
;
public
static
List
<
Map
<
String
,
Object
>>
getEnumList
()
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
for
(
ZBGLEnum
zbglEnum
:
EnumSet
.
allOf
(
ZBGLEnum
.
class
))
{
if
(
zbglEnum
.
isMainBody
){
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"title"
,
zbglEnum
.
name
);
map
.
put
(
"value"
,
zbglEnum
.
code
);
List
<
Map
<
String
,
Object
>>
childrenList
=
new
ArrayList
<>();
for
(
ZBGLEnum
childrenEnum
:
EnumSet
.
allOf
(
ZBGLEnum
.
class
))
{
if
(!
childrenEnum
.
isMainBody
&&
childrenEnum
.
mainBody
.
equals
(
zbglEnum
.
code
)){
HashMap
<
String
,
Object
>
childrenMap
=
new
HashMap
<>();
childrenMap
.
put
(
"title"
,
childrenEnum
.
name
);
childrenMap
.
put
(
"value"
,
childrenEnum
.
code
);
childrenList
.
add
(
childrenMap
);
}
}
map
.
put
(
"children"
,
childrenList
);
result
.
add
(
map
);
}
}
return
result
;
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/java/com/yeejoin/amos/boot/module/statistics/api/mapper/ZBGLStatisticsMapper.java
0 → 100644
View file @
f2a92fa0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistics
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
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.DPFilterParamForDetailDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 大屏指标管理下钻Mapper 接口
*
* @author maxy
* @date 2024-11-05
*/
@Mapper
public
interface
ZBGLStatisticsMapper
{
List
<
Map
<
String
,
String
>>
getTypeList
(
@Param
(
"type"
)
String
type
);
Long
getDTGZYYZBFXChartData
(
@Param
(
"dpFilterParamForDetailDto"
)
DPFilterParamForDetailDto
dpFilterParamForDetailDto
);
List
<
Map
<
String
,
Object
>>
getPageData
(
@Param
(
"dpFilterParamForDetailDto"
)
DPFilterParamForDetailDto
dpFilterParamForDetailDto
);
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/resources/mapper/ZBGLStatisticsMapper.xml
0 → 100644
View file @
f2a92fa0
<?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.ZBGLStatisticsMapper"
>
<select
id=
"getTypeList"
resultType=
"java.util.Map"
>
SELECT
code,
NAME
FROM
cb_data_dictionary
WHERE
TYPE = #{type}
AND is_delete = 0
</select>
<select
id=
"getDTGZYYZBFXChartData"
resultType=
"java.lang.Long"
>
SELECT
count(1)
FROM
tz_alert_form_value tafv
LEFT JOIN tz_dispatch_paper dp on dp.sequence_nbr = tafv.alert_called_id
LEFT JOIN tz_alert_called tac on dp.alert_id = tac.sequence_nbr
WHERE
tac.biz_org_code LIKE concat(#{dpFilterParamForDetailDto.orgCode}, '%')
AND tafv.field_code = 'error_result'
AND tafv.field_value IS NOT NULL
</select>
<select
id=
"getPageData"
resultType=
"java.util.Map"
>
SELECT
tafv.field_value AS keyStr,
ifnull (SUM (CASE WHEN tac.father_alert IS NULL THEN 1 ELSE 0 END ), 0 ) AS longValue,
tafv.field_value_code AS fieldValueCode
FROM
tz_alert_form_value tafv
LEFT JOIN tz_dispatch_paper dp on dp.sequence_nbr = tafv.alert_called_id
LEFT JOIN tz_alert_called tac on dp.alert_id = tac.sequence_nbr
WHERE
tac.biz_org_code LIKE concat(#{dpFilterParamForDetailDto.orgCode}, '%')
AND tafv.field_code = 'error_result'
AND tafv.field_value IS NOT NULL
GROUP BY
tafv.field_value
</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/constant/ZBGLConstants.java
0 → 100644
View file @
f2a92fa0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
constant
;
import
com.alibaba.excel.util.StringUtils
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.IZBGLService
;
import
com.yeejoin.amos.boot.module.statistcs.factory.ZBGLFactory
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
ZBGLConstants
{
public
static
Map
<
String
,
Object
>
getChart
(
DPFilterParamForDetailDto
dpFilterParamForDetailDto
)
{
if
(
StringUtils
.
isEmpty
(
dpFilterParamForDetailDto
.
getTreeValue
())){
throw
new
BadRequest
(
"类型不能为空"
);
}
IZBGLService
izbglService
=
ZBGLFactory
.
getZBGL
(
dpFilterParamForDetailDto
.
getTreeValue
());
if
(
izbglService
==
null
){
throw
new
RuntimeException
(
"未找到实现类"
);
}
return
izbglService
.
getChart
(
dpFilterParamForDetailDto
);
}
public
static
List
<
Map
<
String
,
String
>>
getTitle
(
DPFilterParamForDetailDto
dpFilterParamForDetailDto
)
{
if
(
StringUtils
.
isEmpty
(
dpFilterParamForDetailDto
.
getTreeValue
())){
throw
new
BadRequest
(
"类型不能为空"
);
}
IZBGLService
izbglService
=
ZBGLFactory
.
getZBGL
(
dpFilterParamForDetailDto
.
getTreeValue
());
if
(
izbglService
==
null
){
throw
new
RuntimeException
(
"未找到实现类"
);
}
return
izbglService
.
getTitle
(
dpFilterParamForDetailDto
);
}
public
static
Page
<
Map
<
String
,
Object
>>
getPage
(
Page
page
,
DPFilterParamForDetailDto
dpFilterParamForDetailDto
)
{
if
(
StringUtils
.
isEmpty
(
dpFilterParamForDetailDto
.
getTreeValue
())){
throw
new
BadRequest
(
"类型不能为空"
);
}
IZBGLService
izbglService
=
ZBGLFactory
.
getZBGL
(
dpFilterParamForDetailDto
.
getTreeValue
());
if
(
izbglService
==
null
){
throw
new
RuntimeException
(
"未找到实现类"
);
}
return
izbglService
.
getPage
(
page
,
dpFilterParamForDetailDto
);
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/controller/ZBGLDPStatisticsController.java
0 → 100644
View file @
f2a92fa0
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.DPFilterParamForDetailDto
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.impl.ZBGLDPStatisticsServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.AlertPaperInfoDto
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.FieldError
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.List
;
import
java.util.Map
;
/**
* 大屏统计controller
*
* @author maxy
*/
@RestController
@Api
(
tags
=
"大屏-指标-统计API"
)
@RequestMapping
(
"/dp/zb"
)
public
class
ZBGLDPStatisticsController
{
@Autowired
private
ZBGLDPStatisticsServiceImpl
statisticsService
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-指标管理下钻左侧树结构"
,
notes
=
"大屏-指标管理下钻左侧树结构"
)
@PostMapping
(
value
=
"/getType"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
getType
(
@Validated
@RequestBody
DPFilterParamForDetailDto
dpFilterParamForDetailDto
,
BindingResult
result
)
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getType
(
dpFilterParamForDetailDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-指标管理下钻图表"
,
notes
=
"大屏-指标管理下钻图表"
)
@PostMapping
(
value
=
"/getChart"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
getChart
(
@Validated
@RequestBody
DPFilterParamForDetailDto
dpFilterParamForDetailDto
,
BindingResult
result
)
throws
Exception
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getChart
(
dpFilterParamForDetailDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-指标管理下钻表头"
,
notes
=
"大屏-指标管理下钻表头"
)
@PostMapping
(
value
=
"/getTitle"
)
public
ResponseModel
<
List
<
Map
<
String
,
String
>>>
getTitle
(
@Validated
@RequestBody
DPFilterParamForDetailDto
dpFilterParamForDetailDto
,
BindingResult
result
)
throws
Exception
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getTitle
(
dpFilterParamForDetailDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-指标管理下钻分页"
,
notes
=
"大屏-指标管理下钻分页"
)
@PostMapping
(
value
=
"/getPage"
)
public
ResponseModel
<
Page
<
Map
<
String
,
Object
>>>
getPage
(
@Validated
@RequestBody
DPFilterParamForDetailDto
dpFilterParamForDetailDto
,
BindingResult
result
,
@RequestParam
(
value
=
"current"
,
defaultValue
=
"1"
)
Integer
current
,
@RequestParam
(
value
=
"size"
,
defaultValue
=
"20"
)
Integer
size
)
throws
Exception
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
Page
<
Map
<
String
,
Object
>>
page
=
new
Page
<>(
current
,
size
);
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getPage
(
page
,
dpFilterParamForDetailDto
));
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/service/IZBGLService.java
0 → 100644
View file @
f2a92fa0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto
;
import
java.util.List
;
import
java.util.Map
;
public
interface
IZBGLService
{
public
Map
<
String
,
Object
>
getChart
(
DPFilterParamForDetailDto
dpFilterParamForDetailDto
);
public
Page
<
Map
<
String
,
Object
>>
getPage
(
Page
page
,
DPFilterParamForDetailDto
dpFilterParamForDetailDto
);
public
List
<
Map
<
String
,
String
>>
getTitle
(
DPFilterParamForDetailDto
dpFilterParamForDetailDto
);
}
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/ZBGLDPStatisticsServiceImpl.java
0 → 100644
View file @
f2a92fa0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto
;
import
com.yeejoin.amos.boot.module.common.api.enums.ZBGLEnum
;
import
com.yeejoin.amos.boot.module.statistcs.biz.constant.ZBGLConstants
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
@Service
@Slf4j
public
class
ZBGLDPStatisticsServiceImpl
{
public
List
<
Map
<
String
,
Object
>>
getType
(
DPFilterParamForDetailDto
dpFilterParamForDetailDto
)
{
return
ZBGLEnum
.
getEnumList
();
}
public
Map
<
String
,
Object
>
getChart
(
DPFilterParamForDetailDto
dpFilterParamForDetailDto
)
{
return
ZBGLConstants
.
getChart
(
dpFilterParamForDetailDto
);
}
public
List
<
Map
<
String
,
String
>>
getTitle
(
DPFilterParamForDetailDto
dpFilterParamForDetailDto
)
{
return
ZBGLConstants
.
getTitle
(
dpFilterParamForDetailDto
);
}
public
Page
<
Map
<
String
,
Object
>>
getPage
(
Page
<
Map
<
String
,
Object
>>
page
,
DPFilterParamForDetailDto
dpFilterParamForDetailDto
)
{
return
ZBGLConstants
.
getPage
(
page
,
dpFilterParamForDetailDto
);
}
}
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/ZBGLImpl/DtgzyyzbfxServiceImpl.java
0 → 100644
View file @
f2a92fa0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
biz
.
service
.
impl
.
ZBGLImpl
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.IZBGLService
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.impl.StCommonServiceImpl
;
import
com.yeejoin.amos.boot.module.statistics.api.mapper.ZBGLStatisticsMapper
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Component
public
class
DtgzyyzbfxServiceImpl
implements
IZBGLService
{
@Resource
private
StCommonServiceImpl
stCommonService
;
@Resource
private
ZBGLStatisticsMapper
zbglStatisticsMapper
;
@Override
public
Map
<
String
,
Object
>
getChart
(
DPFilterParamForDetailDto
dpFilterParamForDetailDto
)
{
List
<
RegionModel
>
regionModels
=
stCommonService
.
setRegionIfRootParent
(
dpFilterParamForDetailDto
.
getCityCode
());
List
<
Map
<
String
,
Object
>>
result
=
regionModels
.
parallelStream
().
map
(
r
->
{
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
r
.
getRegionCode
()+
""
);
DPFilterParamForDetailDto
dpFilterParamForDetailDtoNew
=
new
DPFilterParamForDetailDto
();
dpFilterParamForDetailDtoNew
.
setOrgCode
(
orgCode
);
Map
<
String
,
Object
>
itemResult
=
new
HashMap
<>();
Long
count
=
zbglStatisticsMapper
.
getDTGZYYZBFXChartData
(
dpFilterParamForDetailDtoNew
);
itemResult
.
put
(
"count"
,
count
);
itemResult
.
put
(
"xdata"
,
r
.
getRegionName
());
return
itemResult
;
}).
collect
(
Collectors
.
toList
());
Map
<
String
,
Object
>
returnMap
=
new
HashMap
<>();
List
<
Map
<
String
,
Object
>>
legendData
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
1
;
i
++){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
i
==
0
){
map
.
put
(
"dataKey"
,
"count"
);
map
.
put
(
"value"
,
"事件总数"
);
map
.
put
(
"chartType"
,
"bar"
);
}
else
{
map
.
put
(
"dataKey"
,
"rate"
);
map
.
put
(
"value"
,
"占比"
);
map
.
put
(
"chartType"
,
"line"
);
}
legendData
.
add
(
map
);
}
returnMap
.
put
(
"legendData"
,
legendData
);
List
xdata
=
new
ArrayList
();
List
count
=
new
ArrayList
();
List
rate
=
new
ArrayList
();
Long
sum
=
0L
;
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++){
sum
=
sum
+
(
Long
)
result
.
get
(
i
).
get
(
"count"
);
}
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"0.00"
);
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++){
xdata
.
add
(
result
.
get
(
i
).
get
(
"xdata"
));
count
.
add
(
result
.
get
(
i
).
get
(
"count"
)
==
null
?
"0"
:
result
.
get
(
i
).
get
(
"count"
)+
""
);
if
(
sum
!=
0
&&
(
Long
)
result
.
get
(
i
).
get
(
"count"
)
!=
0
){
rate
.
add
(
decimalFormat
.
format
(
new
BigDecimal
(
result
.
get
(
i
).
get
(
"count"
)+
""
).
divide
(
BigDecimal
.
valueOf
(
sum
))));
}
else
{
rate
.
add
(
"0"
);
}
}
returnMap
.
put
(
"xdata"
,
xdata
);
returnMap
.
put
(
"count"
,
count
);
returnMap
.
put
(
"rate"
,
rate
);
return
returnMap
;
}
@Override
public
Page
<
Map
<
String
,
Object
>>
getPage
(
Page
page
,
DPFilterParamForDetailDto
dpFilterParamForDetailDto
)
{
List
<
RegionModel
>
regionModels
=
stCommonService
.
setRegionIfRootParent
(
dpFilterParamForDetailDto
.
getCityCode
());
List
<
Map
<
String
,
Object
>>
result
=
regionModels
.
parallelStream
().
map
(
r
->
{
String
orgCode
=
stCommonService
.
getAndSetOrgCode
(
r
.
getRegionCode
()+
""
);
DPFilterParamForDetailDto
dpFilterParamForDetailDtoNew
=
new
DPFilterParamForDetailDto
();
dpFilterParamForDetailDtoNew
.
setOrgCode
(
orgCode
);
Map
<
String
,
Object
>
itemResult
=
new
HashMap
<>();
List
<
Map
<
String
,
Object
>>
list
=
zbglStatisticsMapper
.
getPageData
(
dpFilterParamForDetailDtoNew
);
Long
sum
=
0L
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
sum
=
sum
+
(
Long
)
list
.
get
(
i
).
get
(
"longValue"
);
}
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
if
(
sum
!=
0
&&
(
Long
)
list
.
get
(
i
).
get
(
"longValue"
)
!=
0
){
itemResult
.
put
(
list
.
get
(
i
).
get
(
"fieldValueCode"
)+
""
,
list
.
get
(
i
).
get
(
"longValue"
)+
" / "
+
new
BigDecimal
(
list
.
get
(
i
).
get
(
"longValue"
)+
""
).
divide
(
BigDecimal
.
valueOf
(
sum
),
2
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)).
stripTrailingZeros
().
toPlainString
()+
"%"
);
}
}
itemResult
.
put
(
"area"
,
r
.
getRegionName
());
return
itemResult
;
}).
collect
(
Collectors
.
toList
());
page
.
setRecords
(
result
);
page
.
setTotal
(
result
.
size
());
return
page
;
}
@Override
public
List
<
Map
<
String
,
String
>>
getTitle
(
DPFilterParamForDetailDto
dpFilterParamForDetailDto
)
{
List
<
Map
<
String
,
String
>>
list
=
zbglStatisticsMapper
.
getTypeList
(
"GZYY"
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"code"
,
"area"
);
map
.
put
(
"name"
,
"区域"
);
list
.
add
(
0
,
map
);
return
list
;
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/factory/ZBGLFactory.java
0 → 100644
View file @
f2a92fa0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
statistcs
.
factory
;
import
com.yeejoin.amos.boot.module.common.api.enums.ZBGLEnum
;
import
com.yeejoin.amos.boot.module.statistcs.biz.service.IZBGLService
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
@Component
public
class
ZBGLFactory
implements
ApplicationContextAware
{
@Autowired
private
static
final
Map
<
String
,
IZBGLService
>
strategyMap
=
new
ConcurrentHashMap
<>(
16
);
public
static
IZBGLService
getZBGL
(
String
type
)
{
return
strategyMap
.
get
(
type
);
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
for
(
ZBGLEnum
zbglEnum
:
ZBGLEnum
.
values
()){
if
(!
ValidationUtil
.
isEmpty
(
zbglEnum
.
getClassName
()))
{
strategyMap
.
put
(
zbglEnum
.
getCode
(),
(
IZBGLService
)
applicationContext
.
getBean
(
zbglEnum
.
getClassName
()));
}
}
}
}
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