Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-fb
Overview
Overview
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
王衍超
cloud-fb
Commits
29abd00b
Commit
29abd00b
authored
Jun 17, 2021
by
高晓磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
砂石趋势图,循环错误,导致只新增了最后一条数据
parent
3b6788d0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
DischargingServiceImpl.java
...s/production/internal/service/DischargingServiceImpl.java
+16
-14
No files found.
backend/xyst.dinas.production/src/main/java/com/xyst/dinas/production/internal/service/DischargingServiceImpl.java
View file @
29abd00b
...
...
@@ -71,7 +71,7 @@ public class DischargingServiceImpl implements DischargingService {
@Override
public
List
<
HashMap
<
String
,
Object
>>
groupInfoByYear
(
List
<
UUID
>
regionalCompanyIds
,
Integer
year
,
Boolean
isGroupByMonth
,
Boolean
isGroupByRegionalCompany
,
Boolean
isGroupBySandMiningArea
)
{
return
dischargingDao
.
groupInfo
(
null
,
regionalCompanyIds
,
DateTimeUtils
.
getYearStart
(
year
),
DateTimeUtils
.
getYearEnd
(
year
),
null
,
isGroupByMonth
,
isGroupByRegionalCompany
,
isGroupBySandMiningArea
,
false
,
false
);
return
dischargingDao
.
groupInfo
(
null
,
regionalCompanyIds
,
DateTimeUtils
.
getYearStart
(
year
),
DateTimeUtils
.
getYearEnd
(
year
),
null
,
isGroupByMonth
,
isGroupByRegionalCompany
,
isGroupBySandMiningArea
,
false
,
false
);
}
@Override
...
...
@@ -92,7 +92,7 @@ public class DischargingServiceImpl implements DischargingService {
* @return
*/
@Override
public
List
<
TimeValueParentEntity
>
getDischargingGroup
(
Date
startDate
,
Date
endDate
,
List
<
UUID
>
stationIds
,
List
<
UUID
>
regionalCompanyIds
,
Boolean
isGroupByArea
,
Boolean
isGroupByRegionalCompany
,
Boolean
isGroupByStation
,
Integer
showType
)
{
public
List
<
TimeValueParentEntity
>
getDischargingGroup
(
Date
startDate
,
Date
endDate
,
List
<
UUID
>
stationIds
,
List
<
UUID
>
regionalCompanyIds
,
Boolean
isGroupByArea
,
Boolean
isGroupByRegionalCompany
,
Boolean
isGroupByStation
,
Integer
showType
)
{
Date
startDateTimeOfMonth
=
DateTimeUtils
.
getStartDateTimeOfMonth
(
startDate
);
...
...
@@ -102,9 +102,9 @@ public class DischargingServiceImpl implements DischargingService {
Map
<
UUID
,
TimeValueParentEntity
>
sandMiningAreaTimeValueEntityHashMap
=
new
HashMap
<>(
12
);
List
<
TimeValueParentEntity
>
timeValueParentEntities
=
new
ArrayList
<>();
//处理时间.首先获取时间范围内所有修正数据
groupByRevise
(
stationIds
,
regionalCompanyIds
,
startDateTimeOfMonth
,
endDateTimeOfMonth
,
sandMiningAreaTimeValueEntityHashMap
,
timeValueParentEntities
,
isGroupByArea
,
isGroupByRegionalCompany
,
isGroupByStation
);
groupByRevise
(
stationIds
,
regionalCompanyIds
,
startDateTimeOfMonth
,
endDateTimeOfMonth
,
sandMiningAreaTimeValueEntityHashMap
,
timeValueParentEntities
,
isGroupByArea
,
isGroupByRegionalCompany
,
isGroupByStation
);
//对非修正数据进行补充
groupByNormal
(
startDate
,
endDate
,
stationIds
,
regionalCompanyIds
,
sandMiningAreaTimeValueEntityHashMap
,
timeValueParentEntities
,
isGroupByArea
,
isGroupByRegionalCompany
,
isGroupByStation
);
groupByNormal
(
startDate
,
endDate
,
stationIds
,
regionalCompanyIds
,
sandMiningAreaTimeValueEntityHashMap
,
timeValueParentEntities
,
isGroupByArea
,
isGroupByRegionalCompany
,
isGroupByStation
);
//对数据做补充,没有的日期填充0
for
(
TimeValueParentEntity
miningAreaTimeValueEntity
:
timeValueParentEntities
)
{
...
...
@@ -119,12 +119,12 @@ public class DischargingServiceImpl implements DischargingService {
@Override
public
List
<
TimeValueParentEntity
>
replaceShowType
(
Integer
showType
,
List
<
TimeValueParentEntity
>
timeValueParentEntities
)
{
if
(
null
==
showType
||
0
==
showType
)
{
if
(
null
==
showType
||
0
==
showType
)
{
return
timeValueParentEntities
;
}
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyyMM"
);
if
(
2
==
showType
)
{
dateFormat
=
new
SimpleDateFormat
(
"yyyy"
);
if
(
2
==
showType
)
{
dateFormat
=
new
SimpleDateFormat
(
"yyyy"
);
}
SimpleDateFormat
finalDateFormat
=
dateFormat
;
for
(
TimeValueParentEntity
valueParentEntity
:
timeValueParentEntities
)
{
...
...
@@ -133,7 +133,7 @@ public class DischargingServiceImpl implements DischargingService {
Map
<
String
,
List
<
TimeValue
>>
collect
=
timeValues
.
stream
().
collect
(
Collectors
.
groupingBy
(
timeValue
->
finalDateFormat
.
format
(
timeValue
.
getTime
())));
collect
.
forEach
((
s
,
timeValues1
)
->
{
try
{
timeValues2
.
add
(
new
TimeValue
(
UUID
.
randomUUID
(),
finalDateFormat
.
parse
(
s
),
timeValues1
.
stream
().
mapToDouble
(
TimeValue:
:
getValue
).
summaryStatistics
().
getSum
()));
timeValues2
.
add
(
new
TimeValue
(
UUID
.
randomUUID
(),
finalDateFormat
.
parse
(
s
),
timeValues1
.
stream
().
mapToDouble
(
TimeValue:
:
getValue
).
summaryStatistics
().
getSum
()));
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -145,12 +145,12 @@ public class DischargingServiceImpl implements DischargingService {
return
timeValueParentEntities
;
}
private
void
groupByNormal
(
Date
startDate
,
Date
endDate
,
List
<
UUID
>
stationIds
,
List
<
UUID
>
regionalCompanyIds
,
private
void
groupByNormal
(
Date
startDate
,
Date
endDate
,
List
<
UUID
>
stationIds
,
List
<
UUID
>
regionalCompanyIds
,
Map
<
UUID
,
TimeValueParentEntity
>
sandMiningAreaTimeValueEntityHashMap
,
List
<
TimeValueParentEntity
>
timeValueParentEntityList
,
Boolean
isGroupByArea
,
Boolean
isGroupByRegionalCompany
,
Boolean
isGroupByStation
)
{
TimeValueParentEntity
timeValueParentEntity
;
//查询时间段内的非修正数据
List
<
HashMap
<
String
,
Object
>>
dischargingNormalDataList
=
dischargingDao
.
groupInfo
(
stationIds
,
regionalCompanyIds
,
startDate
,
endDate
,
List
<
HashMap
<
String
,
Object
>>
dischargingNormalDataList
=
dischargingDao
.
groupInfo
(
stationIds
,
regionalCompanyIds
,
startDate
,
endDate
,
DischargingTypeEnum
.
NORMAL_DATA
.
getValue
(),
true
,
isGroupByRegionalCompany
,
isGroupByArea
,
Boolean
.
TRUE
,
isGroupByStation
);
//将修正数据平均到每一天的数据与非修正数据相加
...
...
@@ -161,14 +161,16 @@ public class DischargingServiceImpl implements DischargingService {
timeValueParentEntity
=
sandMiningAreaTimeValueEntityHashMap
.
get
(
sandMiningAreaId
);
List
<
TimeValue
>
timeValues
=
timeValueParentEntity
.
getTimeValues
();
List
<
TimeValue
>
timeValueNew
=
new
ArrayList
<>();
if
(
timeValues
.
size
()
>
0
)
{
boolean
isAdd
=
false
;
for
(
TimeValue
timeValue
:
timeValues
)
{
//如果修正数据中有非修正数据的天数,加起来
if
(
DateUtils
.
isSameDay
(
timeValue
.
getTime
(),
dischargingTime
))
{
timeValue
.
setValue
(
timeValue
.
getValue
()
+
dischargingWeight
);
isAdd
=
true
;
}
}
}
else
{
//如果已经加和到了修正数据中,那就不新增该数据
if
(!
isAdd
)
{
timeValues
.
add
(
new
TimeValue
(
UUID
.
randomUUID
(),
dischargingTime
,
dischargingWeight
));
}
for
(
TimeValue
timeValue
:
timeValues
)
{
...
...
@@ -181,11 +183,11 @@ public class DischargingServiceImpl implements DischargingService {
}
}
private
void
groupByRevise
(
List
<
UUID
>
stationIds
,
List
<
UUID
>
regionalCompanyIds
,
Date
startDateTimeOfMonth
,
Date
endDateTimeOfMonth
,
private
void
groupByRevise
(
List
<
UUID
>
stationIds
,
List
<
UUID
>
regionalCompanyIds
,
Date
startDateTimeOfMonth
,
Date
endDateTimeOfMonth
,
Map
<
UUID
,
TimeValueParentEntity
>
sandMiningAreaTimeValueEntityHashMap
,
List
<
TimeValueParentEntity
>
timeValueParentEntityList
,
Boolean
isGroupByArea
,
Boolean
isGroupByRegionalCompany
,
Boolean
isGroupByStation
)
{
//查询修正数据
List
<
HashMap
<
String
,
Object
>>
dischargingReviseList
=
dischargingDao
.
groupInfo
(
stationIds
,
regionalCompanyIds
,
startDateTimeOfMonth
,
endDateTimeOfMonth
,
List
<
HashMap
<
String
,
Object
>>
dischargingReviseList
=
dischargingDao
.
groupInfo
(
stationIds
,
regionalCompanyIds
,
startDateTimeOfMonth
,
endDateTimeOfMonth
,
DischargingTypeEnum
.
REVISE_DATA
.
getValue
(),
true
,
isGroupByRegionalCompany
,
isGroupByArea
,
false
,
isGroupByStation
);
//组装数据 改成 采区-> {时间,值} 格式
...
...
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