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
8c7f659b
Commit
8c7f659b
authored
Jun 08, 2021
by
高晓磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设置为2位小数(四舍五入)
parent
a716a1ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
+3
-1
PriceAdjustmentServiceImpl.java
...as/price/internal/service/PriceAdjustmentServiceImpl.java
+3
-1
No files found.
backend/xyst.dinas.price/src/main/java/com/xyst/dinas/price/internal/service/PriceAdjustmentServiceImpl.java
View file @
8c7f659b
...
@@ -15,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -15,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
...
@@ -89,7 +91,7 @@ public class PriceAdjustmentServiceImpl implements PriceAdjustmentService {
...
@@ -89,7 +91,7 @@ public class PriceAdjustmentServiceImpl implements PriceAdjustmentService {
Map
<
String
,
List
<
TimeValue
>>
collect
=
timeValues
.
stream
().
collect
(
Collectors
.
groupingBy
(
timeValue
->
finalDateFormat
.
format
(
timeValue
.
getTime
())));
Map
<
String
,
List
<
TimeValue
>>
collect
=
timeValues
.
stream
().
collect
(
Collectors
.
groupingBy
(
timeValue
->
finalDateFormat
.
format
(
timeValue
.
getTime
())));
collect
.
forEach
((
s
,
timeValues1
)
->
{
collect
.
forEach
((
s
,
timeValues1
)
->
{
try
{
try
{
timeValues2
.
add
(
new
TimeValue
(
UUID
.
randomUUID
(),
finalDateFormat
.
parse
(
s
),
timeValues1
.
stream
().
mapToDouble
(
TimeValue:
:
getValue
).
summaryStatistics
().
getAverag
e
()));
timeValues2
.
add
(
new
TimeValue
(
UUID
.
randomUUID
(),
finalDateFormat
.
parse
(
s
),
BigDecimal
.
valueOf
(
timeValues1
.
stream
().
mapToDouble
(
TimeValue:
:
getValue
).
summaryStatistics
().
getAverage
()).
setScale
(
2
,
RoundingMode
.
HALF_UP
).
doubleValu
e
()));
}
catch
(
ParseException
e
)
{
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
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