Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
patzn-cloud-service-hmhj
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
wangweidong
patzn-cloud-service-hmhj
Commits
f0a28110
Commit
f0a28110
authored
Sep 27, 2022
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整统计业务处理逻辑;
parent
eba5d3bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
10 deletions
+25
-10
StatisticsServiceImpl.java
...service/lims/hmhj/service/impl/StatisticsServiceImpl.java
+22
-7
StatisticsMapper.xml
src/main/resources/mapper/hmhj/StatisticsMapper.xml
+3
-3
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/StatisticsServiceImpl.java
View file @
f0a28110
...
...
@@ -3,6 +3,7 @@ package com.patzn.cloud.service.lims.hmhj.service.impl;
import
com.baomidou.mybatisplus.toolkit.CollectionUtils
;
import
com.patzn.cloud.commons.api.RestAssert
;
import
com.patzn.cloud.commons.service.impl.BaseServiceImpl
;
import
com.patzn.cloud.commons.toolkit.MapMergeUtils
;
import
com.patzn.cloud.service.hmhj.dto.LedgerQueryDTO
;
import
com.patzn.cloud.service.hmhj.dto.QueryDTO
;
import
com.patzn.cloud.service.hmhj.dto.RangeStatsQueryDTO
;
...
...
@@ -338,10 +339,23 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
isNumber
=
null
!=
isNumber
&&
isNumber
;
// 查询出传递月份所有日期
List
<
String
>
dateList
=
DateKit
.
dateInMonth
(
yearMonth
);
// 查询出所有label值
List
<
String
>
labels
=
list
.
stream
().
map
(
DailyStatsLedgerVO:
:
getLabel
).
distinct
().
collect
(
Collectors
.
toList
());
// 查询出主名称
List
<
String
>
names
=
list
.
stream
().
map
(
DailyStatsLedgerVO:
:
getName
).
distinct
().
collect
(
Collectors
.
toList
());
// 查询出所有label值,查询出主名称
List
<
String
>
labels
=
new
ArrayList
<>(),
names
=
new
ArrayList
<>();
// 定义label list map
Map
<
String
,
List
<
DailyStatsLedgerVO
>>
labelMap
=
new
HashMap
<>(
16
);
for
(
DailyStatsLedgerVO
vo
:
list
)
{
if
(!
labels
.
contains
(
vo
.
getLabel
()))
{
labels
.
add
(
vo
.
getLabel
());
}
if
(!
names
.
contains
(
vo
.
getName
()))
{
names
.
add
(
vo
.
getName
());
}
// label map
MapMergeUtils
.
getorCreateMapArrayList
(
vo
.
getLabel
(),
labelMap
,
vo
);
}
// 是否包含主类别
boolean
isIncName
=
CollectionUtils
.
isNotEmpty
(
names
);
...
...
@@ -350,8 +364,9 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
Boolean
finalIsNumber
=
isNumber
;
return
labels
.
stream
().
map
(
l
->
{
// 此处过滤一边所有值中对应label的数据
List
<
DailyStatsLedgerVO
>
values
=
list
.
stream
().
filter
(
t
->
t
.
getLabel
().
equals
(
l
)).
collect
(
Collectors
.
toList
());
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>();
// 原逻辑:values = list.stream().filter(t -> t.getLabel().equals(l)).collect(Collectors.toList())
List
<
DailyStatsLedgerVO
>
values
=
labelMap
.
get
(
l
);
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>(
4
);
dataMap
.
put
(
"label"
,
getDataLabel
(
l
,
names
));
if
(
isIncName
)
{
dataMap
.
put
(
"name"
,
getDataName
(
l
,
names
));
...
...
@@ -359,7 +374,7 @@ public class StatisticsServiceImpl extends BaseServiceImpl<StatisticsMapper, Sta
dataMap
.
put
(
"data"
,
dateList
.
stream
().
map
(
d
->
{
String
value
=
finalIsNumber
?
"0"
:
""
;
// 根据日期过滤对应的值
Optional
<
DailyStatsLedgerVO
>
optional
=
values
.
stream
().
filter
(
f
->
f
.
getDay
().
equals
(
d
)).
findFirst
();
Optional
<
DailyStatsLedgerVO
>
optional
=
values
.
stream
().
filter
(
f
->
Objects
.
equals
(
f
.
getDay
(),
d
)).
findFirst
();
if
(
optional
.
isPresent
())
{
value
=
optional
.
get
().
getValue
();
}
...
...
src/main/resources/mapper/hmhj/StatisticsMapper.xml
View file @
f0a28110
...
...
@@ -709,7 +709,7 @@
AND s.NAME = '原铝'
AND s.sample_grading IS NOT NULL
AND to_char(i.test_time,'yyyy-mm') = #{vo.yearMonth}
AND TRIM(ii.test_value) ~ '^([
-]?[0-9]+[.]?[0-9]*|[.]
[0-9]+)$'
AND TRIM(ii.test_value) ~ '^([
0-9]+[.]?
[0-9]+)$'
<include
refid=
"ledger_where"
/>
GROUP BY s.id
ORDER BY s.slot_no, "day"
...
...
@@ -759,7 +759,7 @@
i.deleted = 0
AND i.NAME IN ( '原铝Fe', '原铝Ni')
AND to_char(i.test_time,'yyyy-mm') = #{vo.yearMonth}
AND (TRIM(ii.test_value) ~ '^([
-]?[
0-9]+[.]?[0-9]*|[.][0-9]+)$')
AND (TRIM(ii.test_value) ~ '^([0-9]+[.]?[0-9]*|[.][0-9]+)$')
GROUP BY
i.entrust_sample_id
) i ON i.entrust_sample_id = s.ID
...
...
@@ -799,7 +799,7 @@
i.deleted = 0
AND s.NAME in ('原铝','原铝散样','原铝重取')
AND to_char( i.test_time, 'yyyy-mm') = #{vo.yearMonth}
AND (TRIM(ii.test_value) ~ '^([
-]?[
0-9]+[.]?[0-9]+)$')
AND (TRIM(ii.test_value) ~ '^([0-9]+[.]?[0-9]+)$')
<include
refid=
"ledger_where"
/>
GROUP BY
i.NAME, "test_time"
...
...
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