|
@@ -1,33 +1,34 @@
|
|
|
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.apilog.core.annotation.ApiAccessLog;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
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.controller.admin.paymentinfo.vo.PaymentInfoPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.cash.controller.admin.paymentinfo.vo.PaymentInfoRespVO;
|
|
|
+import cn.iocoder.yudao.module.cash.controller.admin.paymentinfo.vo.PaymentInfoSaveReqVO;
|
|
|
import cn.iocoder.yudao.module.cash.dal.dataobject.paymentinfo.PaymentInfoDO;
|
|
|
import cn.iocoder.yudao.module.cash.service.paymentinfo.PaymentInfoService;
|
|
|
+import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
|
|
+import cn.iocoder.yudao.module.infra.api.file.dto.FileDTO;
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springdoc.api.annotations.ParameterObject;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
|
@Tag(name = "管理后台 - 付款信息")
|
|
|
@RestController
|
|
@@ -38,16 +39,21 @@ public class PaymentInfoController {
|
|
|
@Resource
|
|
|
private PaymentInfoService paymentInfoService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private FileApi fileApi;
|
|
|
+
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建付款信息")
|
|
|
- @PreAuthorize("@ss.hasPermission('cash:payment-info:create')")
|
|
|
+ @ApiOperationSupport(order = 1)
|
|
|
+
|
|
|
public CommonResult<Long> createPaymentInfo(@Valid @RequestBody PaymentInfoSaveReqVO createReqVO) {
|
|
|
return success(paymentInfoService.createPaymentInfo(createReqVO));
|
|
|
}
|
|
|
|
|
|
@PutMapping("/update")
|
|
|
@Operation(summary = "更新付款信息")
|
|
|
- @PreAuthorize("@ss.hasPermission('cash:payment-info:update')")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+
|
|
|
public CommonResult<Boolean> updatePaymentInfo(@Valid @RequestBody PaymentInfoSaveReqVO updateReqVO) {
|
|
|
paymentInfoService.updatePaymentInfo(updateReqVO);
|
|
|
return success(true);
|
|
@@ -55,8 +61,9 @@ public class PaymentInfoController {
|
|
|
|
|
|
@DeleteMapping("/delete")
|
|
|
@Operation(summary = "删除付款信息")
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
@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);
|
|
@@ -64,32 +71,50 @@ public class PaymentInfoController {
|
|
|
|
|
|
@GetMapping("/get")
|
|
|
@Operation(summary = "获得付款信息")
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
@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));
|
|
|
+ PaymentInfoRespVO paymentInfoRespVO = BeanUtils.toBean(paymentInfo, PaymentInfoRespVO.class);
|
|
|
+
|
|
|
+ String status = paymentInfoRespVO.getStatus();
|
|
|
+ if ("0".equals(status)) {
|
|
|
+ paymentInfoRespVO.setStatusDesc("已完成");
|
|
|
+ } else if ("1".equals(status)) {
|
|
|
+ paymentInfoRespVO.setStatusDesc("作废");
|
|
|
+ } else {
|
|
|
+ paymentInfoRespVO.setStatusDesc("未知");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<FileDTO> fileDTOList = fileApi.getFileDTOListByBiz(paymentInfo.getPaymentInfoUuid());
|
|
|
+ paymentInfoRespVO.setFileList(fileDTOList);
|
|
|
+
|
|
|
+ return success(paymentInfoRespVO);
|
|
|
}
|
|
|
|
|
|
@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));
|
|
|
+ @ApiOperationSupport(order = 5)
|
|
|
+
|
|
|
+ public CommonResult<PageResult<PaymentInfoRespVO>> getPaymentInfoPage(@Valid @ParameterObject PaymentInfoPageReqVO pageReqVO) {
|
|
|
+ PageResult<PaymentInfoRespVO> pageResult = paymentInfoService.getPaymentInfoPage(pageReqVO);
|
|
|
+ return success(pageResult);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/export-excel")
|
|
|
@Operation(summary = "导出付款信息 Excel")
|
|
|
- @PreAuthorize("@ss.hasPermission('cash:payment-info:export')")
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
+
|
|
|
@ApiAccessLog(operateType = EXPORT)
|
|
|
- public void exportPaymentInfoExcel(@Valid PaymentInfoPageReqVO pageReqVO,
|
|
|
+ public void exportPaymentInfoExcel(@Valid @ParameterObject PaymentInfoPageReqVO pageReqVO,
|
|
|
HttpServletResponse response) throws IOException {
|
|
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
- List<PaymentInfoDO> list = paymentInfoService.getPaymentInfoPage(pageReqVO).getList();
|
|
|
+ List<PaymentInfoRespVO> list = paymentInfoService.getPaymentInfoPage(pageReqVO).getList();
|
|
|
|
|
|
ExcelUtils.write(response, "付款信息.xls", "数据", PaymentInfoRespVO.class,
|
|
|
- BeanUtils.toBean(list, PaymentInfoRespVO.class));
|
|
|
+ list);
|
|
|
}
|
|
|
|
|
|
}
|