gongzuming
2024-10-24 3db677d8ad84f04b84ba2c74f7fc0dd7e5df239d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.mzl.flower.web.statistics;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mzl.flower.base.BaseController;
import com.mzl.flower.base.R;
import com.mzl.flower.base.ReturnDataDTO;
import com.mzl.flower.dto.response.statistics.FlowerStatisticsDTO;
import com.mzl.flower.dto.response.statistics.OrderStatisticsDTO;
import com.mzl.flower.dto.response.statistics.RateStatisticsDTO;
import com.mzl.flower.dto.response.statistics.SaleStatisticsDTO;
import com.mzl.flower.service.statistics.StatisticsService;
import com.mzl.flower.utils.HttpUtil;
import com.wechat.pay.java.core.http.HttpMethod;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
 
@RestController
@RequestMapping("/api/statistics")
@Api(value = "统计", tags = "统计")
@Validated
@Slf4j
public class StatisticsController extends BaseController {
 
    @Autowired
    private StatisticsService statisticsService;
 
    @GetMapping("/sale/date")
    @ApiOperation(value = "当日销售统计")
    public ResponseEntity<ReturnDataDTO<SaleStatisticsDTO>> getSaleStatistics(String date){
        return returnData(R.SUCCESS.getCode(), statisticsService.getSaleStatistics(date));
    }
 
    @GetMapping("/flower/count")
    @ApiOperation(value = "商品商户统计")
    public ResponseEntity<ReturnDataDTO<FlowerStatisticsDTO>> getFlowerStatistics(){
        return returnData(R.SUCCESS.getCode(), statisticsService.getFlowerStatistics());
    }
 
    @GetMapping("/order/amount")
    @ApiOperation(value = "订单金额统计")
    public ResponseEntity<ReturnDataDTO<OrderStatisticsDTO>> getOrderStatistics(){
        return returnData(R.SUCCESS.getCode(), statisticsService.getOrderStatistics());
    }
 
    @GetMapping("/order/rate")
    @ApiOperation(value = "订单环比统计")
    public ResponseEntity<ReturnDataDTO<RateStatisticsDTO>> getOrderRateStatistics(String date){
        return returnData(R.SUCCESS.getCode(), statisticsService.getOrderRateStatistics(date));
    }
 
    @GetMapping("/supplier/rate")
    @ApiOperation(value = "商户环比统计")
    public ResponseEntity<ReturnDataDTO<RateStatisticsDTO>> getSupplierRateStatistics(String date){
        return returnData(R.SUCCESS.getCode(), statisticsService.getSupplierRateStatistics(date));
    }
 
    @GetMapping("/customer/rate")
    @ApiOperation(value = "花店环比统计")
    public ResponseEntity<ReturnDataDTO<RateStatisticsDTO>> getCustomerRateStatistics(String date){
        return returnData(R.SUCCESS.getCode(), statisticsService.getCustomerRateStatistics(date));
    }
 
    @GetMapping("/customer/visit/rate")
    @ApiOperation(value = "花店访问环比统计")
    public ResponseEntity<ReturnDataDTO<RateStatisticsDTO>> getCustomerVisitRateStatistics(String date){
        return returnData(R.SUCCESS.getCode(), statisticsService.getCustomerVisitRateStatistics(date));
    }
 
    @GetMapping("/sales/rate")
    @ApiOperation(value = "售后环比统计")
    public ResponseEntity<ReturnDataDTO<RateStatisticsDTO>> getSalesRateStatistics(String date){
        return returnData(R.SUCCESS.getCode(), statisticsService.getSalesRateStatistics(date));
    }
 
 
}