|
@@ -0,0 +1,95 @@
|
|
|
+package cn.iocoder.yudao.module.cash.controller.admin.paymentinfo;
|
|
|
+
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+
|
|
|
+import javax.validation.constraints.*;
|
|
|
+import javax.validation.*;
|
|
|
+import javax.servlet.http.*;
|
|
|
+import java.util.*;
|
|
|
+import java.io.IOException;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.module.cash.controller.admin.paymentinfo.vo.*;
|
|
|
+import cn.iocoder.yudao.module.cash.dal.dataobject.paymentinfo.PaymentInfoDO;
|
|
|
+import cn.iocoder.yudao.module.cash.service.paymentinfo.PaymentInfoService;
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - 付款信息")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/cash/payment-info")
|
|
|
+@Validated
|
|
|
+public class PaymentInfoController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private PaymentInfoService paymentInfoService;
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建付款信息")
|
|
|
+ @PreAuthorize("@ss.hasPermission('cash:payment-info:create')")
|
|
|
+ public CommonResult<Long> createPaymentInfo(@Valid @RequestBody PaymentInfoSaveReqVO createReqVO) {
|
|
|
+ return success(paymentInfoService.createPaymentInfo(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/update")
|
|
|
+ @Operation(summary = "更新付款信息")
|
|
|
+ @PreAuthorize("@ss.hasPermission('cash:payment-info:update')")
|
|
|
+ public CommonResult<Boolean> updatePaymentInfo(@Valid @RequestBody PaymentInfoSaveReqVO updateReqVO) {
|
|
|
+ paymentInfoService.updatePaymentInfo(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/delete")
|
|
|
+ @Operation(summary = "删除付款信息")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthorize("@ss.hasPermission('cash:payment-info:delete')")
|
|
|
+ public CommonResult<Boolean> deletePaymentInfo(@RequestParam("id") Long id) {
|
|
|
+ paymentInfoService.deletePaymentInfo(id);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得付款信息")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('cash:payment-info:query')")
|
|
|
+ public CommonResult<PaymentInfoRespVO> getPaymentInfo(@RequestParam("id") Long id) {
|
|
|
+ PaymentInfoDO paymentInfo = paymentInfoService.getPaymentInfo(id);
|
|
|
+ return success(BeanUtils.toBean(paymentInfo, PaymentInfoRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得付款信息分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('cash:payment-info:query')")
|
|
|
+ public CommonResult<PageResult<PaymentInfoRespVO>> getPaymentInfoPage(@Valid PaymentInfoPageReqVO pageReqVO) {
|
|
|
+ PageResult<PaymentInfoDO> pageResult = paymentInfoService.getPaymentInfoPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, PaymentInfoRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出付款信息 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('cash:payment-info:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportPaymentInfoExcel(@Valid PaymentInfoPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<PaymentInfoDO> list = paymentInfoService.getPaymentInfoPage(pageReqVO).getList();
|
|
|
+
|
|
|
+ ExcelUtils.write(response, "付款信息.xls", "数据", PaymentInfoRespVO.class,
|
|
|
+ BeanUtils.toBean(list, PaymentInfoRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|