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.constant.Constants;
|
import com.mzl.flower.dto.request.payment.BillQueryDTO;
|
import com.mzl.flower.dto.response.payment.BillDTO;
|
import com.mzl.flower.dto.response.payment.BillListDTO;
|
import com.mzl.flower.service.payment.BillService;
|
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.*;
|
|
import java.time.LocalDate;
|
|
@RestController
|
@RequestMapping("/api/bill")
|
@Api(value = "账单管理", tags = "账单管理")
|
@Validated
|
@Slf4j
|
public class BillController extends BaseController {
|
|
@Autowired
|
private BillService billService;
|
|
@GetMapping("/statistics/partner")
|
@ApiOperation(value = "获取合伙人账单统计")
|
public ResponseEntity<ReturnDataDTO<Page<BillListDTO>>> getBillStatisticsPartner(BillQueryDTO dto){
|
dto.setType(Constants.BILL_TYPE.partner.name());
|
return returnData(R.SUCCESS.getCode(), billService.getBillStatistics(dto));
|
}
|
|
@GetMapping("/statistics/personal")
|
@ApiOperation(value = "获取散户账单统计")
|
public ResponseEntity<ReturnDataDTO<Page<BillListDTO>>> getBillStatisticsPersonal(BillQueryDTO dto){
|
dto.setType(Constants.BILL_TYPE.personal.name());
|
return returnData(R.SUCCESS.getCode(), billService.getBillStatistics(dto));
|
}
|
|
@GetMapping("/list/partner")
|
@ApiOperation(value = "获取合伙人账单列表")
|
public ResponseEntity<ReturnDataDTO<Page<BillListDTO>>> selectBillPartnerList(Page page, BillQueryDTO dto){
|
dto.setType(Constants.BILL_TYPE.partner.name());
|
return returnData(R.SUCCESS.getCode(), billService.selectBillList(page, dto));
|
}
|
|
@GetMapping("/list/personal")
|
@ApiOperation(value = "获取散户账单列表")
|
public ResponseEntity<ReturnDataDTO<Page<BillListDTO>>> selectBillPersonalList(Page page, BillQueryDTO dto){
|
dto.setType(Constants.BILL_TYPE.personal.name());
|
return returnData(R.SUCCESS.getCode(), billService.selectBillList(page, dto));
|
}
|
|
@GetMapping("/list/view")
|
@ApiOperation(value = "获取账单详情")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id", value = "账单id", required = true, dataType = "String", paramType = "query")
|
})
|
public ResponseEntity<ReturnDataDTO<BillDTO>> getBill(String id){
|
return returnData(R.SUCCESS.getCode(), billService.getBill(id));
|
}
|
|
@GetMapping("/generate")
|
@ApiOperation(value = "生成账单")
|
public ResponseEntity<ReturnDataDTO<?>> generateBill(String day){
|
LocalDate date = billService.parseLocalDate(day);
|
billService.generateBill(date);
|
return returnData(R.SUCCESS.getCode(), null);
|
}
|
|
}
|