diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/statistics/controller/IndexStatisticsManagerController.java b/ruoyi-mall/src/main/java/com/cyl/manager/statistics/controller/IndexStatisticsManagerController.java index 2b5a7b0..16ebd31 100644 --- a/ruoyi-mall/src/main/java/com/cyl/manager/statistics/controller/IndexStatisticsManagerController.java +++ b/ruoyi-mall/src/main/java/com/cyl/manager/statistics/controller/IndexStatisticsManagerController.java @@ -2,6 +2,7 @@ package com.cyl.manager.statistics.controller; import com.cyl.manager.statistics.pojo.GoodsStatisticsQueryParam; +import com.cyl.manager.statistics.pojo.OrderStatisticsQueryParam; import com.cyl.manager.statistics.pojo.vo.MemberAndCartStatisticsVO; import com.cyl.manager.statistics.pojo.vo.OrderAndAftersaleStatisticsVO; import com.cyl.manager.statistics.pojo.vo.OrderStatisticsVO; @@ -14,9 +15,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -46,10 +45,9 @@ public class IndexStatisticsManagerController { } @ApiOperation(value = "订单信息") - @GetMapping("/orderStatistics") - public ResponseEntity> orderStatistics() { - - return ResponseEntity.ok(indexStatisticsService.orderStatistics()); + @PostMapping("/orderStatistics") + public ResponseEntity> orderStatistics(@RequestBody OrderStatisticsQueryParam param) { + return ResponseEntity.ok(indexStatisticsService.orderStatistics(param)); } @ApiOperation(value = "会员数,加购数") diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/statistics/mapper/IndexStatisticsMapper.java b/ruoyi-mall/src/main/java/com/cyl/manager/statistics/mapper/IndexStatisticsMapper.java index 5fac288..e995b49 100644 --- a/ruoyi-mall/src/main/java/com/cyl/manager/statistics/mapper/IndexStatisticsMapper.java +++ b/ruoyi-mall/src/main/java/com/cyl/manager/statistics/mapper/IndexStatisticsMapper.java @@ -2,6 +2,7 @@ package com.cyl.manager.statistics.mapper; import com.cyl.manager.statistics.pojo.GoodsStatisticsQueryParam; +import com.cyl.manager.statistics.pojo.OrderStatisticsQueryParam; import com.cyl.manager.statistics.pojo.vo.OrderStatisticsVO; import com.cyl.manager.statistics.pojo.vo.ProductTopVO; @@ -11,6 +12,6 @@ public interface IndexStatisticsMapper { List goodsSkuStatistics(GoodsStatisticsQueryParam goodsStatisticsQueryParam); List goodsStatistics(GoodsStatisticsQueryParam goodsStatisticsQueryParam); - List orderStatistics(); + List orderStatistics(OrderStatisticsQueryParam param); } diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/statistics/pojo/OrderStatisticsQueryParam.java b/ruoyi-mall/src/main/java/com/cyl/manager/statistics/pojo/OrderStatisticsQueryParam.java new file mode 100644 index 0000000..97044ce --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/statistics/pojo/OrderStatisticsQueryParam.java @@ -0,0 +1,14 @@ +package com.cyl.manager.statistics.pojo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@ApiModel("订单统计查询条件对象") +@Data +public class OrderStatisticsQueryParam { + + @ApiModelProperty("查询范围类型 1:近一周 2:近一个月") + private Integer type; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/statistics/service/IndexStatisticsService.java b/ruoyi-mall/src/main/java/com/cyl/manager/statistics/service/IndexStatisticsService.java index 971a4d1..93017d6 100644 --- a/ruoyi-mall/src/main/java/com/cyl/manager/statistics/service/IndexStatisticsService.java +++ b/ruoyi-mall/src/main/java/com/cyl/manager/statistics/service/IndexStatisticsService.java @@ -7,6 +7,7 @@ import com.cyl.manager.oms.service.OrderDeliveryHistoryService; import com.cyl.manager.oms.service.OrderService; import com.cyl.manager.statistics.mapper.IndexStatisticsMapper; import com.cyl.manager.statistics.pojo.GoodsStatisticsQueryParam; +import com.cyl.manager.statistics.pojo.OrderStatisticsQueryParam; import com.cyl.manager.statistics.pojo.vo.MemberAndCartStatisticsVO; import com.cyl.manager.statistics.pojo.vo.OrderAndAftersaleStatisticsVO; import com.cyl.manager.statistics.pojo.vo.OrderStatisticsVO; @@ -51,8 +52,8 @@ public class IndexStatisticsService { } } - public List orderStatistics() { - return indexStatisticsMapper.orderStatistics(); + public List orderStatistics(OrderStatisticsQueryParam param) { + return indexStatisticsMapper.orderStatistics(param); } public MemberAndCartStatisticsVO statMemberAndCart() { diff --git a/ruoyi-mall/src/main/resources/mapper/statistics/IndexStatisticsMapper.xml b/ruoyi-mall/src/main/resources/mapper/statistics/IndexStatisticsMapper.xml index 3ed35a4..0acf28b 100644 --- a/ruoyi-mall/src/main/resources/mapper/statistics/IndexStatisticsMapper.xml +++ b/ruoyi-mall/src/main/resources/mapper/statistics/IndexStatisticsMapper.xml @@ -36,6 +36,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT date_sub( curdate( ), INTERVAL 28 DAY ) AS date UNION ALL SELECT date_sub( curdate( ), INTERVAL 29 DAY ) AS date + + SELECT + curdate( ) AS date UNION ALL + SELECT date_sub( curdate( ), INTERVAL 1 DAY ) AS date UNION ALL + SELECT date_sub( curdate( ), INTERVAL 2 DAY ) AS date UNION ALL + SELECT date_sub( curdate( ), INTERVAL 3 DAY ) AS date UNION ALL + SELECT date_sub( curdate( ), INTERVAL 4 DAY ) AS date UNION ALL + SELECT date_sub( curdate( ), INTERVAL 5 DAY ) AS date UNION ALL + SELECT date_sub( curdate( ), INTERVAL 6 DAY ) AS date + @@ -59,7 +69,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" IFNULL(b.order_amount,0) orderAmount from ( - + + + + + + + + ) a left join ( SELECT DATE_FORMAT(create_time, '%Y-%m-%d') as date,