|
|
@@ -0,0 +1,206 @@
|
|
|
+package com.sckw.payment.controller;
|
|
|
+
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import com.sckw.contract.api.model.dto.res.TradeEntInfoResVo;
|
|
|
+import com.sckw.core.model.enums.EntTypeEnum;
|
|
|
+import com.sckw.core.web.context.LoginEntHolder;
|
|
|
+import com.sckw.core.web.response.BaseResult;
|
|
|
+import com.sckw.core.web.response.result.PageDataResult;
|
|
|
+import com.sckw.payment.entity.WalletPrepaid;
|
|
|
+import com.sckw.payment.pojo.vo.req.*;
|
|
|
+import com.sckw.payment.pojo.vo.res.*;
|
|
|
+import com.sckw.payment.service.IWalletPrepaidService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * 待履约/预付清单Controller
|
|
|
+ *
|
|
|
+ * @author tangys
|
|
|
+ * @since 2026-01-06 11:03:35
|
|
|
+ */
|
|
|
+@Tag(name = "待履约/预付清单")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/walletPrepaid")
|
|
|
+public class WalletPrepaidController {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IWalletPrepaidService walletPrepaidService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询财务报表数据
|
|
|
+ */
|
|
|
+ @Operation(summary = "查询财务报表数据")
|
|
|
+ @PostMapping("/queryFinancialReport")
|
|
|
+ public BaseResult<List<FinancialReportRes>> queryFinancialReport(@RequestBody @Validated WalletPrepaidBalanceQuery query) {
|
|
|
+ List<FinancialReportRes> reportList = walletPrepaidService.queryFinancialReport(query);
|
|
|
+ return BaseResult.success(reportList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出财务报表
|
|
|
+ */
|
|
|
+ @Operation(summary = "导出财务报表")
|
|
|
+ @PostMapping("/exportFinancialReport")
|
|
|
+ public void exportFinancialReport(@RequestBody @Validated WalletPrepaidBalanceQuery query, HttpServletResponse response) {
|
|
|
+ walletPrepaidService.exportFinancialReport(query, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询待履约或预付的汇总接口
|
|
|
+ @Operation(summary = "查询待履约或预付的汇总接口")
|
|
|
+ @GetMapping("/queryPrepaidSummary")
|
|
|
+ public BaseResult<WalletPrepaidSummary> queryPrepaidSummary() {
|
|
|
+ WalletPrepaidSummary summary = new WalletPrepaidSummary();
|
|
|
+ String entTypes = LoginEntHolder.get().getEntTypes();
|
|
|
+ WalletPrepaidQuery query = new WalletPrepaidQuery();
|
|
|
+ query.setCurEntId(LoginEntHolder.getEntId());
|
|
|
+ if (entTypes.contains(String.valueOf(EntTypeEnum.SUPPLIER.getCode()))) {
|
|
|
+ query.setEntType(EntTypeEnum.SUPPLIER.getCode());
|
|
|
+ } else if (entTypes.contains(String.valueOf(EntTypeEnum.PURCHASER.getCode()))) {
|
|
|
+ query.setEntType(EntTypeEnum.PURCHASER.getCode());
|
|
|
+ } else {
|
|
|
+ return BaseResult.success(summary);
|
|
|
+ }
|
|
|
+ summary = walletPrepaidService.selectWalletPrepaidSummary(query);
|
|
|
+ return BaseResult.success(summary);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询待履约/预付清单列表
|
|
|
+ */
|
|
|
+
|
|
|
+ @Operation(summary = "分页查询待履约/预付清单列表")
|
|
|
+ @PostMapping("/prepaidList")
|
|
|
+ public BaseResult<PageDataResult<WalletPrepaidRes>> prepaidList(@RequestBody @Validated WalletPrepaidQuery query) {
|
|
|
+ PageInfo<WalletPrepaidRes> list = new PageInfo<>(Collections.emptyList());
|
|
|
+ String entTypes = LoginEntHolder.get().getEntTypes();
|
|
|
+ if (entTypes.contains(String.valueOf(EntTypeEnum.SUPPLIER.getCode()))) {
|
|
|
+ query.setEntType(EntTypeEnum.SUPPLIER.getCode());
|
|
|
+ } else if (entTypes.contains(String.valueOf(EntTypeEnum.PURCHASER.getCode()))) {
|
|
|
+ query.setEntType(EntTypeEnum.PURCHASER.getCode());
|
|
|
+ } else {
|
|
|
+ return BaseResult.success(PageDataResult.of(list));
|
|
|
+ }
|
|
|
+
|
|
|
+ list = walletPrepaidService.selectWalletPrepaidList(query);
|
|
|
+ return BaseResult.success(PageDataResult.of(list));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询采购企业在对应供应企业的预付余额
|
|
|
+ */
|
|
|
+
|
|
|
+ @Operation(summary = "查询采购企业在对应供应企业的预付余额")
|
|
|
+ @GetMapping("/queryPrepaidBalance")
|
|
|
+ public BaseResult<BigDecimal> queryPrepaidBalance(@RequestParam("supEntId") Long supEntId) {
|
|
|
+ WalletPrepaid prepaid = walletPrepaidService.queryPrepaidBalance(supEntId);
|
|
|
+ BigDecimal preBalance = BigDecimal.ZERO;
|
|
|
+ if (prepaid != null) {
|
|
|
+ preBalance = prepaid.getPreBalance();
|
|
|
+ }
|
|
|
+ return BaseResult.success(preBalance);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Operation(summary = "贸易合同创建成功,初始化预付清单")
|
|
|
+ @PostMapping("/initPrepaidBalance")
|
|
|
+ public BaseResult<Object> initPrepaidBalance(@RequestBody @Validated WalletPrepaidDto prepaidDto) {
|
|
|
+ walletPrepaidService.initPrepaidBalance(prepaidDto);
|
|
|
+ return BaseResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预付清单冻结、解冻、消费接口
|
|
|
+ *
|
|
|
+ * @param prepaidDto
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Operation(summary = "预付清单冻结、解冻、消费接口")
|
|
|
+ @PostMapping("/updatePrepaidBalance")
|
|
|
+ BaseResult<Boolean> updatePrepaidBalance(@RequestBody WalletPrepaidDto prepaidDto) {
|
|
|
+ walletPrepaidService.updatePrepaidBalance(prepaidDto);
|
|
|
+ return BaseResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据当前企业id查询采购合同对方企业id列表
|
|
|
+ */
|
|
|
+ @Operation(summary = "查询交易对方企业列表")
|
|
|
+ @GetMapping("/queryTradeEntList")
|
|
|
+ public BaseResult<List<TradeEntInfoResVo>> queryTradeEntIds() {
|
|
|
+ return BaseResult.success(walletPrepaidService.queryPrepaidTradeEntIds());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 人工录入
|
|
|
+ *
|
|
|
+ * @return ModelAndView
|
|
|
+ */
|
|
|
+
|
|
|
+ @Operation(summary = "人工录入")
|
|
|
+ @PostMapping("/manualEntry")
|
|
|
+ public BaseResult<Object> manualEntry(@RequestBody @Validated WalletPrepaidManualDto performanceAddDto) {
|
|
|
+ String entTypes = LoginEntHolder.get().getEntTypes();
|
|
|
+ if (!entTypes.contains(String.valueOf(EntTypeEnum.SUPPLIER.getCode()))) {
|
|
|
+ return BaseResult.failed("当前用户非供应商,无法进行此操作");
|
|
|
+ }
|
|
|
+ return BaseResult.success(walletPrepaidService.manualEntry(performanceAddDto));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预付
|
|
|
+ *
|
|
|
+ * @return ModelAndView
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+ @Operation(summary = "预付")
|
|
|
+ @PostMapping("/prepay")
|
|
|
+ public BaseResult<WalletPayAddRes> prepay(@RequestBody @Validated WalletPrepaidAddDto prepaidAddDto) {
|
|
|
+ return walletPrepaidService.insertWalletPrepaidRecord(prepaidAddDto);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Operation(summary = "分页查询预付支付记录列表")
|
|
|
+ @PostMapping("/prepayList")
|
|
|
+ public BaseResult<PageDataResult<WalletPrepaidRecordRes>> list(@RequestBody @Validated WalletPrepaidRecordQuery query) {
|
|
|
+ PageInfo<WalletPrepaidRecordRes> list = walletPrepaidService.selectWalletPrepaidRecordList(query);
|
|
|
+ return BaseResult.success(PageDataResult.of(list));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "付款")
|
|
|
+ @GetMapping("/getPayInfo")
|
|
|
+ public BaseResult<WalletPayAddRes> getPayInfo(@RequestParam("id") Long id) {
|
|
|
+ return walletPrepaidService.getPayInfo(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预付到账回调接口
|
|
|
+ */
|
|
|
+ @Operation(summary = "预付到账回调接口")
|
|
|
+ @PostMapping("/receivedCallback")
|
|
|
+ public BaseResult<Object> receivedCallback(@RequestBody @Validated ReceivedCallbackDto receivedCallbackDto) {
|
|
|
+ walletPrepaidService.receivedCallback(receivedCallbackDto);
|
|
|
+ return BaseResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * BI大屏预付余额:系统内所有供应商的待履约金额汇总
|
|
|
+ */
|
|
|
+ @Operation(summary = "BI大屏预付余额")
|
|
|
+ @GetMapping("/queryAllSupplierPrepaidSummary")
|
|
|
+ public BaseResult<BigDecimal> queryAllSupplierPrepaidSummary() {
|
|
|
+ BigDecimal summary = walletPrepaidService.selectAllSupplierPrepaidSummary();
|
|
|
+ return BaseResult.success(summary);
|
|
|
+ }
|
|
|
+}
|