Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
91c07744
Commit
91c07744
authored
Sep 12, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
折线图
parent
bdc0bbcb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/QueryPriceServiceImpl.java
.../main/java/com/wwdz/ch/wx/impl/QueryPriceServiceImpl.java
+12
-7
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/QueryPriceServiceImpl.java
View file @
91c07744
...
@@ -22,6 +22,7 @@ import org.slf4j.Logger;
...
@@ -22,6 +22,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
java.time.*
;
import
java.time.*
;
...
@@ -68,6 +69,9 @@ public class QueryPriceServiceImpl implements QueryPriceService {
...
@@ -68,6 +69,9 @@ public class QueryPriceServiceImpl implements QueryPriceService {
List
<
String
>
xData
=
new
ArrayList
<>();
List
<
String
>
xData
=
new
ArrayList
<>();
List
<
Object
>
valueList
=
new
ArrayList
<>();
List
<
Object
>
valueList
=
new
ArrayList
<>();
double
totalPrice
=
0
;
double
totalPrice
=
0
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"details"
,
CategoryVo
.
of
(
category
));
for
(
BidRecord
bidRecord
:
bidRecordList
)
{
for
(
BidRecord
bidRecord
:
bidRecordList
)
{
int
bidTime
=
bidRecord
.
getBidTime
();
int
bidTime
=
bidRecord
.
getBidTime
();
Instant
instant
=
Instant
.
ofEpochSecond
(
bidTime
);
Instant
instant
=
Instant
.
ofEpochSecond
(
bidTime
);
...
@@ -78,18 +82,19 @@ public class QueryPriceServiceImpl implements QueryPriceService {
...
@@ -78,18 +82,19 @@ public class QueryPriceServiceImpl implements QueryPriceService {
totalPrice
+=
(
bidRecord
.
getPrice
()
/
(
double
)
100
);
totalPrice
+=
(
bidRecord
.
getPrice
()
/
(
double
)
100
);
valueList
.
add
(
bidRecord
.
getPrice
()
/
(
double
)
100
/
(
double
)
10000
);
valueList
.
add
(
bidRecord
.
getPrice
()
/
(
double
)
100
/
(
double
)
10000
);
}
}
double
averagePrice
=
totalPrice
/
bidRecordList
.
size
();
double
averagePrice
=
0
;
if
(!
CollectionUtils
.
isEmpty
(
bidRecordList
))
{
averagePrice
=
totalPrice
/
bidRecordList
.
size
();
Instant
instant
=
Instant
.
ofEpochSecond
(
bidRecordList
.
get
(
bidRecordList
.
size
()
-
1
).
getBidTime
());
LocalDateTime
date
=
LocalDateTime
.
ofInstant
(
instant
,
ZoneId
.
systemDefault
());
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy年MM月dd日"
);
map
.
put
(
"priceUpdateTime"
,
date
.
format
(
formatter
));
}
Chart
chart
=
new
Chart
();
Chart
chart
=
new
Chart
();
chart
.
setXData
(
xData
);
chart
.
setXData
(
xData
);
chart
.
setValues
(
valueList
);
chart
.
setValues
(
valueList
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"details"
,
CategoryVo
.
of
(
category
));
map
.
put
(
"chart"
,
chart
);
map
.
put
(
"chart"
,
chart
);
map
.
put
(
"averagePrice"
,
averagePrice
);
map
.
put
(
"averagePrice"
,
averagePrice
);
Instant
instant
=
Instant
.
ofEpochSecond
(
bidRecordList
.
get
(
bidRecordList
.
size
()
-
1
).
getBidTime
());
LocalDateTime
date
=
LocalDateTime
.
ofInstant
(
instant
,
ZoneId
.
systemDefault
());
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy年MM月dd日"
);
map
.
put
(
"priceUpdateTime"
,
date
.
format
(
formatter
));
return
Result
.
success
(
map
);
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询类目价格详情失败:{}"
,
e
);
logger
.
error
(
"查询类目价格详情失败:{}"
,
e
);
...
...
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