陶杰
2024-09-30 65516d3f4fd7fee2c3f6c72ba634584223151e77
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
package com.mzl.flower.web.v2.report;
 
 
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.request.report.QueryOrderDTO;
import com.mzl.flower.dto.response.report.OrderDetailReportResultVO;
import com.mzl.flower.dto.response.report.OrderReportResultVO;
import com.mzl.flower.service.report.OrderReportService;
import com.mzl.flower.utils.ConverterUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
 
 
/**
* @author @TaoJie
* @since 2024-09-25
*/
@RestController
@RequestMapping("/v2/report/order")
@Api(value = "报表-订单", tags = "报表-订单")
@Validated
public class OrderReportController extends BaseController {
 
 
    @Autowired
    private OrderReportService orderReportService;
 
    @GetMapping("/sale/page")
    @ApiOperation(value = "查询-分页", notes = "查询-分页")
    public ResponseEntity<ReturnDataDTO<Page<OrderReportResultVO>>> page(
            Page page,@Validated QueryOrderDTO dto
    ) {
        return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(orderReportService.getSalePage(page,dto), OrderReportResultVO.class));
    }
 
    @GetMapping("/sale/statis")
    @ApiOperation(value = "统计", notes = "统计")
    public ResponseEntity<ReturnDataDTO<OrderReportResultVO>> statis(@Validated QueryOrderDTO dto
    ) {
        return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(orderReportService.getSaleStatis(dto), OrderReportResultVO.class));
    }
 
 
    @GetMapping({"/sale/export"})
    @ApiOperation(value = "报告列表导出")
    public void exportSales(HttpServletResponse response,@Validated QueryOrderDTO dto){
        orderReportService.exportSalesList(response, dto);
    }
 
    @GetMapping("/detail/page")
    @ApiOperation(value = "查询-分页", notes = "查询-分页")
    public ResponseEntity<ReturnDataDTO<Page<OrderDetailReportResultVO>>> detail(Page page, QueryOrderDTO dto) {
        return returnData(R.SUCCESS.getCode(), orderReportService.getOrderDetailPage(page, dto));
    }
 
    @GetMapping("/detail/export")
    @ApiOperation(value = "订单结算明细导出")
    public void exportOrderDetail(HttpServletResponse response, QueryOrderDTO queryOrderDTO) {
        orderReportService.exportOrderDetail(response, queryOrderDTO);
    }
 
}