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
ae0d3b3f
Commit
ae0d3b3f
authored
Jul 29, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.气瓶大屏-气瓶-区域统计接口统计接口增加单位换算,数据大于10万时图列为万并进行单位换算
parent
4f467c0e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
3 deletions
+33
-3
CylinderDPStatisticsServiceImpl.java
...tcs/biz/service/impl/CylinderDPStatisticsServiceImpl.java
+33
-3
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/service/impl/CylinderDPStatisticsServiceImpl.java
View file @
ae0d3b3f
...
...
@@ -30,6 +30,8 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import
org.springframework.stereotype.Service
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
...
...
@@ -51,12 +53,16 @@ public class CylinderDPStatisticsServiceImpl {
private
TzBaseEnterpriseInfoMapper
baseEnterpriseInfoMapper
;
private
CylinderAreaDataMapper
cylinderAreaDataMapper
;
;
private
CylinderStatisticsMapper
cylinderStatisticsMapper
;
private
CylinderInfoMapper
cylinderInfoMapper
;
/**
* 气瓶图列换算单位上限
*/
private
final
static
Long
CYLINDER_LEGEND_UPPER_LIMIT
=
100000L
;
public
CylinderDPStatisticsServiceImpl
(
StCommonServiceImpl
stCommonService
,
RestHighLevelClient
restHighLevelClient
,
TzBaseEnterpriseInfoMapper
baseEnterpriseInfoMapper
,
CylinderAreaDataMapper
cylinderAreaDataMapper
,
CylinderStatisticsMapper
cylinderStatisticsMapper
,
CylinderInfoMapper
cylinderInfoMapper
)
{
this
.
stCommonService
=
stCommonService
;
this
.
restHighLevelClient
=
restHighLevelClient
;
...
...
@@ -128,19 +134,43 @@ public class CylinderDPStatisticsServiceImpl {
List
<
Map
<
String
,
Object
>>
legendData
=
new
ArrayList
<>();
List
<
String
>
xdata
=
this
.
buildXData
(
regionList
);
List
<
Long
>
qiping
=
getYDataForQP
(
regionList
);
Long
totalCyNum
=
qiping
.
stream
().
mapToLong
(
e
->
e
).
sum
();
List
<
Long
>
qizhan
=
getYDataForQZ
(
regionList
);
Map
<
String
,
Object
>
qiLegend
=
getQ
ZLegend
(
"气瓶数量"
,
"qiping"
);
Map
<
String
,
Object
>
qiLegend
=
getQ
PLegend
(
totalCyNum
);
Map
<
String
,
Object
>
zhanLegend
=
getQZLegend
(
"气站数量"
,
"qizhan"
);
legendData
.
add
(
qiLegend
);
legendData
.
add
(
zhanLegend
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"qizhan"
,
qizhan
);
result
.
put
(
"qiping"
,
qiping
);
result
.
put
(
"qiping"
,
this
.
changeNum2Million
(
totalCyNum
,
qiping
)
);
result
.
put
(
"xdata"
,
xdata
);
result
.
put
(
"legendData"
,
legendData
);
return
result
;
}
private
List
changeNum2Million
(
Long
totalCyNum
,
List
<
Long
>
qiping
)
{
if
(
totalCyNum
>
CYLINDER_LEGEND_UPPER_LIMIT
)
{
return
qiping
.
stream
().
map
(
num
->
{
BigDecimal
numDecimal
=
new
BigDecimal
(
num
.
toString
());
BigDecimal
millionNum
=
numDecimal
.
divide
(
new
BigDecimal
(
"10000"
),
4
,
RoundingMode
.
HALF_UP
);
return
millionNum
.
toPlainString
();
}).
collect
(
Collectors
.
toList
());
}
else
{
return
qiping
;
}
}
private
Map
<
String
,
Object
>
getQPLegend
(
Long
totalCyNum
)
{
Map
<
String
,
Object
>
qiLegend
=
new
HashMap
<>();
if
(
totalCyNum
>
CYLINDER_LEGEND_UPPER_LIMIT
)
{
qiLegend
.
put
(
"value"
,
"气瓶数量(万)"
);
}
else
{
qiLegend
.
put
(
"value"
,
"气瓶数量"
);
}
qiLegend
.
put
(
"dataKey"
,
"qiping"
);
return
qiLegend
;
}
private
Map
<
String
,
Object
>
getQZLegend
(
String
label
,
String
key
)
{
Map
<
String
,
Object
>
qiLegend
=
new
HashMap
<>();
qiLegend
.
put
(
"value"
,
label
);
...
...
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