陶杰
2024-08-22 ee9032d9baf5f33e376d2d2699136e0a7b26bec7
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.payment;
 
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.config.security.SecurityUtils;
import com.mzl.flower.constant.Constants;
import com.mzl.flower.dto.request.payment.OrderSettlementQueryDTO;
import com.mzl.flower.dto.response.payment.OrderSettlementDTO;
import com.mzl.flower.dto.response.payment.OrderSettlementListDTO;
import com.mzl.flower.schedule.ScheduleService;
import com.mzl.flower.service.payment.OrderSettlementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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;
 
@RestController
@RequestMapping("/api/settlement")
@Api(value = "结算-运营平台", tags = "结算-运营平台")
@Validated
@Slf4j
public class SettlementController extends BaseController {
 
    @Autowired
    private OrderSettlementService settlementService;
 
    @Autowired
    private ScheduleService scheduleService;
 
    @GetMapping("/list")
    @ApiOperation(value = "查询结算列表")
    public ResponseEntity<ReturnDataDTO<Page<OrderSettlementListDTO>>> selectSettlementList(Page page
            , OrderSettlementQueryDTO dto){
        return returnData(R.SUCCESS.getCode(), settlementService.selectSettlementList(page, dto));
    }
 
    @GetMapping("/list/view")
    @ApiOperation(value = "结算详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "结算id", required = true, dataType = "String", paramType = "query")
    })
    public ResponseEntity<ReturnDataDTO<OrderSettlementDTO>> getSettlement(String id){
        return returnData(R.SUCCESS.getCode(), settlementService.getSettlement(id));
    }
 
    @GetMapping("/list/transfer")
    @ApiOperation(value = "结算转账")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "结算id", required = true, dataType = "String", paramType = "query")
    })
    public ResponseEntity<ReturnDataDTO<?>> doSettlementTransfer(String id){
        settlementService.doSettlementTransfer(id);
        return returnData(R.SUCCESS.getCode(), null);
    }
 
    @GetMapping("/do")
    @ApiOperation(value = "手动结算")
    public ResponseEntity<ReturnDataDTO<?>> doSettlement(){
        scheduleService.doSettlement();
        return returnData(R.SUCCESS.getCode(), null);
    }
}