Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-java
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
huluobin
dc-java
Commits
5b8989ee
Commit
5b8989ee
authored
Apr 03, 2019
by
wutong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加销量接口支持多SKU
parent
af57ef81
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
SalesController.java
...c/main/java/com/bailuntec/controller/SalesController.java
+6
-1
DcDailySalesVO.java
...c/main/java/com/bailuntec/domain/pojo/DcDailySalesVO.java
+13
-0
SalesServiceImpl.java
...main/java/com/bailuntec/serviceImpl/SalesServiceImpl.java
+4
-0
No files found.
data-api/src/main/java/com/bailuntec/controller/SalesController.java
View file @
5b8989ee
...
...
@@ -9,7 +9,9 @@ import com.github.pagehelper.PageInfo;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -22,7 +24,10 @@ public class SalesController {
@Autowired
private
SalesService
salesService
;
@RequestMapping
(
"/sales/daily"
)
public
ResponseResult
getDailySales
(
String
skus
,
HttpServletRequest
request
)
{
public
ResponseResult
getDailySales
(
@RequestParam
(
"skus"
)
String
skus
,
HttpServletRequest
request
)
{
if
(
StringUtils
.
isEmpty
(
skus
))
{
return
new
ResponseResult
<>(
LocalDateTime
.
now
(),
HttpStatus
.
MULTIPLE_CHOICES
.
value
(),
null
,
"SKU不能为null"
,
request
.
getServletPath
(),
null
);
}
try
{
List
<
DcDailySalesVO
>
dcSkuListInfo
=
salesService
.
listSkus
(
skus
);
return
new
ResponseResult
<>(
LocalDateTime
.
now
(),
HttpStatus
.
OK
.
value
(),
null
,
null
,
request
.
getServletPath
(),
dcSkuListInfo
);
...
...
data-api/src/main/java/com/bailuntec/domain/pojo/DcDailySalesVO.java
View file @
5b8989ee
...
...
@@ -72,6 +72,19 @@ public class DcDailySalesVO {
*/
private
LocalDate
recordDate
;
public
DcDailySalesVO
()
{
}
public
DcDailySalesVO
(
String
bailunSku
,
Integer
bailunCategoryId
,
Integer
onedayTotalSales
,
Integer
sevendayTotalSales
,
Integer
fourteendayTotalSales
,
Integer
thirtydayTotalSales
,
LocalDate
recordDate
)
{
this
.
bailunSku
=
bailunSku
;
this
.
bailunCategoryId
=
bailunCategoryId
;
this
.
onedayTotalSales
=
onedayTotalSales
;
this
.
sevendayTotalSales
=
sevendayTotalSales
;
this
.
fourteendayTotalSales
=
fourteendayTotalSales
;
this
.
thirtydayTotalSales
=
thirtydayTotalSales
;
this
.
recordDate
=
recordDate
;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_daily_sales
...
...
data-api/src/main/java/com/bailuntec/serviceImpl/SalesServiceImpl.java
View file @
5b8989ee
...
...
@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.util.StringUtil
;
import
java.time.LocalDate
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
...
...
@@ -21,6 +22,9 @@ public class SalesServiceImpl implements SalesService {
String
[]
split
=
skus
.
split
(
","
);
for
(
String
s
:
split
)
{
DcDailySalesVO
dcDailySalesVO
=
dailySalesMapper
.
listSkuInfo
(
s
);
if
(
dcDailySalesVO
==
null
)
{
dcDailySalesVO
=
new
DcDailySalesVO
(
s
,
0
,
0
,
0
,
0
,
0
,
LocalDate
.
now
().
minusDays
(
1
));
}
dcBaseSkus
.
add
(
dcDailySalesVO
);
}
}
...
...
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