Explorar el Código

添加支付记录接口

xucaiqin hace 1 año
padre
commit
0491afce5b

+ 66 - 0
sckw-modules-api/sckw-payment-api/src/main/java/com/sckw/payment/api/model/dto/WalletVo.java

@@ -0,0 +1,66 @@
+package com.sckw.payment.api.model.dto;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 钱包清单
+ */
+@Data
+public class WalletVo implements Serializable {
+    /**
+     * 钱包名称
+     */
+    private String name;
+    /**
+     * uid对应的企业名称
+     */
+    @JSONField(name = "member_name")
+    private String memberName;
+
+    private String uid;
+    /**
+     * 渠道 huifu
+     */
+    private String channel;
+
+    @JSONField(name = "create_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime createTime;
+
+    private String filter;
+    /**
+     * 冻结金额(分)
+     * note:冻结金额为预付金额
+     */
+    private BigDecimal freeze;
+    /**
+     * 预付金额(分)
+     */
+    @JSONField(name = "ap_money")
+    private BigDecimal apMoney;
+    /**
+     * 总金额(分)
+     */
+    @JSONField(name = "total_money")
+    private BigDecimal totalMoney;
+    /**
+     * 线上可用余额(分)
+     */
+    private BigDecimal money;
+    /**
+     * 充值中金额
+     */
+    @JSONField(name = "charging_money")
+    private BigDecimal chargingMoney;
+    /**
+     * 提现中金额
+     */
+    @JSONField(name = "withdrawing_money")
+    private BigDecimal withdrawingMoney;
+}

+ 10 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/WalletController.java

@@ -233,6 +233,16 @@ public class WalletController {
         return HttpResult.ok(walletService.addPrePay(prePay));
     }
 
+    /**
+     *
+     * @param operateReq
+     * @return
+     */
+    @PostMapping("dealQuery")
+    public HttpResult dealQuery(@RequestBody @Valid OperateReq operateReq) {
+        return HttpResult.ok(walletService.dealQuery(operateReq));
+    }
+
     /**
      * 预付追加校验
      *

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dubbo/PayCenterServiceImpl.java

@@ -45,7 +45,7 @@ public class PayCenterServiceImpl implements PayCenterDubboService {
         payCenterService.record("kll_0001", "kll_0002", 1, 5);
 
 //        payCenterService.payAgentPay("kll_0001");
-        return payCenterService.memberDetail("kll_0001", ChannelEnum.HF);
+        return R.ok();
     }
 
     @Override

+ 4 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dubbo/PaymentDubboServiceImpl.java

@@ -68,7 +68,7 @@ public class PaymentDubboServiceImpl implements PaymentDubboService {
             return HttpResult.error("支付企业不能为空");
         }
         if (Objects.isNull(channel)) {
-            return HttpResult.error("支付企业不能为空");
+            return HttpResult.error("支付渠道不能为空");
         }
         if (Objects.isNull(receiveEntId)) {
             return HttpResult.error("收款企业不能为空");
@@ -124,10 +124,10 @@ public class PaymentDubboServiceImpl implements PaymentDubboService {
     }
 
     @Override
-    public LedgerCount countLedger(Long entId,List<Long> enterpriseIds) {
+    public LedgerCount countLedger(Long entId, List<Long> enterpriseIds) {
         enterpriseIds = enterpriseIds.stream().distinct().collect(Collectors.toList());
-        LedgerSize count = ledgerLogisticsService.count(entId,enterpriseIds);
-        LedgerSize ledgerSize = kwpLedgerTradeService.count(entId,enterpriseIds);
+        LedgerSize count = ledgerLogisticsService.count(entId, enterpriseIds);
+        LedgerSize ledgerSize = kwpLedgerTradeService.count(entId, enterpriseIds);
         return new LedgerCount(ledgerSize.send(), ledgerSize.receive(), count.send(), count.receive());
     }
 

+ 61 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/OperateVo.java

@@ -0,0 +1,61 @@
+package com.sckw.payment.model.dto;
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.sckw.payment.model.dto.wallet.Filter;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class OperateVo {
+    @JSONField(name = "create_time")
+    private String createTime;
+    @JSONField(name = "wd_money")
+    private BigDecimal wdMoney;
+    /**
+     * 类型对应文案
+     */
+    @JSONField(name = "type_text")
+    private String typeText;
+    /**
+     * 类型
+     */
+    private String type;
+    /**
+     * 预付金额
+     */
+    @JSONField(name = "ap_money")
+    private BigDecimal apMoney;
+    /**
+     * 对方
+     */
+    private Filter filter;
+    /**
+     * 自身uid
+     */
+    private String uid;
+    /**
+     * 下载文件
+     */
+    private List<String> file;
+    private BigDecimal money;
+    /**
+     * 操作金额
+     */
+    @JSONField(name = "operate_money")
+    private BigDecimal operateMoney;
+    /**
+     * 总冻结金额
+     */
+    @JSONField(name = "freeze_money")
+    private BigDecimal freezeMoney;
+    /**
+     * 备注
+     */
+    private String remarks;
+    /**
+     * 当前状态:0:关闭,1:已完成,2:进行中
+     */
+    private int status;
+}

+ 15 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/page/OperatePage.java

@@ -0,0 +1,15 @@
+package com.sckw.payment.model.dto.page;
+
+import com.sckw.payment.model.dto.common.Page;
+import com.sckw.payment.model.dto.wallet.Operate;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author xucaiqin
+ * @date 2024-03-27 17:11:00
+ */
+@Getter
+@Setter
+public class OperatePage extends Page<Operate> {
+}

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/wallet/Operate.java

@@ -56,4 +56,4 @@ public class Operate {
      * 当前状态:0:关闭,1:已完成,2:进行中
      */
     private int status;
-}
+}

+ 31 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/OperateReq.java

@@ -0,0 +1,31 @@
+package com.sckw.payment.model.vo.req;
+
+import com.sckw.core.model.vo.BasePara;
+import jakarta.validation.constraints.NotBlank;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 新增预付参数
+ *
+ * @author xucaiqin
+ * @date 2023-08-29 09:14:04
+ */
+@Getter
+@Setter
+public class OperateReq extends BasePara {
+    /**
+     * uid
+     */
+    @NotBlank(message = "uid不能为空")
+    private String uid;
+    /**
+     * 支付通道 字典值
+     */
+    @NotBlank(message = "支付通道不能为空")
+    private String channel;
+
+    private String type;
+    private String startTime;
+    private String endTime;
+}

+ 22 - 6
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementWalletService.java

@@ -1,12 +1,13 @@
 package com.sckw.payment.service;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.alibaba.fastjson2.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
-import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.common.enums.enums.DictEnum;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.model.enums.LogisticsOrderEnum;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.utils.IdWorker;
@@ -19,8 +20,12 @@ import com.sckw.order.api.dubbo.TradeOrderInfoService;
 import com.sckw.order.api.model.UpdateOrderStatusParam;
 import com.sckw.payment.api.model.constant.ChannelEnum;
 import com.sckw.payment.api.model.dto.WalletDto;
+import com.sckw.payment.api.model.dto.WalletVo;
 import com.sckw.payment.api.model.dto.common.R;
-import com.sckw.payment.dao.*;
+import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
+import com.sckw.payment.dao.KwpSettlementLogisticsMapper;
+import com.sckw.payment.dao.KwpSettlementLogisticsTrackMapper;
+import com.sckw.payment.dao.KwpSettlementWalletMapper;
 import com.sckw.payment.model.*;
 import com.sckw.payment.model.constant.*;
 import com.sckw.payment.model.dto.LedgerUnitDto;
@@ -594,7 +599,7 @@ public class KwpSettlementWalletService {
      * @param id
      * @return
      */
-    public WalletDto getConfirmLogisticsPayment(Long id) {
+    public Object getConfirmLogisticsPayment(Long id) {
         SettlementLogisticsDto byId = kwpSettlementLogisticsService.detail(id, LogisticsUnitType.CARRIER, LogisticsUnitType.SHIPPER);
         if (Objects.isNull(byId)) {
             throw new BusinessException("结算单不存在");
@@ -616,7 +621,7 @@ public class KwpSettlementWalletService {
      * @param id 结算单id
      * @return
      */
-    public WalletDto getConfirmTradePayment(Long id) {
+    public Object getConfirmTradePayment(Long id) {
         SettlementTradeDto byId = kwpSettlementTradeService.getById(id, TradeUnitType.SELL);
         if (Objects.isNull(byId)) {
             throw new BusinessException("结算单不存在");
@@ -638,7 +643,7 @@ public class KwpSettlementWalletService {
      * @param trading  交易方式
      * @return
      */
-    private WalletDto getWalletBalance(List<LedgerUnitDto> listById, String trading) {
+    private WalletVo getWalletBalance(List<LedgerUnitDto> listById, String trading) {
         Long uid = null;
         Long filter = null;
         for (LedgerUnitDto ledgerUnitDto : listById) {
@@ -661,7 +666,18 @@ public class KwpSettlementWalletService {
             throw new BusinessException("交易双方暂未开通电子钱包");
         }
         List<WalletDto> data = wallet.getData();
-        return data.get(NumberConstant.ZERO);
+        WalletDto walletDto = data.get(NumberConstant.ZERO);
+        if (Objects.isNull(walletDto)) {
+            return null;
+        }
+        WalletVo walletVo = BeanUtil.toBean(walletDto, WalletVo.class);
+        walletVo.setFreeze(Objects.nonNull(walletDto.getFreeze()) ? BigDecimal.valueOf(walletDto.getFreeze() / 100D) : new BigDecimal("0"));
+        walletVo.setApMoney(Objects.nonNull(walletDto.getApMoney()) ? BigDecimal.valueOf(walletDto.getApMoney() / 100D) : new BigDecimal("0"));
+        walletVo.setTotalMoney(Objects.nonNull(walletDto.getTotalMoney()) ? BigDecimal.valueOf(walletDto.getTotalMoney() / 100D) : new BigDecimal("0"));
+        walletVo.setMoney(Objects.nonNull(walletDto.getMoney()) ? BigDecimal.valueOf(walletDto.getMoney() / 100D) : new BigDecimal("0"));
+        walletVo.setChargingMoney(Objects.nonNull(walletDto.getChargingMoney()) ? BigDecimal.valueOf(walletDto.getChargingMoney() / 100D) : new BigDecimal("0"));
+        walletVo.setWithdrawingMoney(Objects.nonNull(walletDto.getWithdrawingMoney()) ? BigDecimal.valueOf(walletDto.getWithdrawingMoney() / 100D) : new BigDecimal("0"));
+        return walletVo;
     }
 
     /**

+ 3 - 9
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/PayCenterService.java

@@ -473,13 +473,7 @@ public class PayCenterService {
      * @param pageSize
      * @return
      */
-    public R<Operate> operateIndex(String uid, ChannelEnum channel, Integer page, Integer pageSize, String[] createTime, String[] money) {
-        if (StringUtils.isBlank(uid)) {
-            throw new BusinessException("用户不能为空");
-        }
-        if (Objects.isNull(channel)) {
-            throw new BusinessException("支付渠道不能为空");
-        }
+    public R<OperatePage> operateIndex(String uid, String channel, Integer page, Integer pageSize,String type, String[] createTime) {
         if (Objects.isNull(page)) {
             page = 1;
         }
@@ -493,8 +487,8 @@ public class PayCenterService {
             put("channel", channel);
             put("page", finalPage);
             put("pageSize", finalPageSize);
-            put("createTime", createTime);
-            put("money", money);
+            put("create_time", createTime);
+            put("type", type);
         }});
         return JSONObject.parseObject(sync, new TypeReference<>() {
         });

+ 37 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/WalletService.java

@@ -3,9 +3,9 @@ package com.sckw.payment.service;
 import com.alibaba.fastjson2.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
-import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.constant.Global;
+import com.sckw.core.model.constant.NumberConstant;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.utils.*;
 import com.sckw.core.web.context.LoginUserHolder;
@@ -21,11 +21,13 @@ import com.sckw.payment.dao.KwpWalletTransferMapper;
 import com.sckw.payment.job.AsyncPool;
 import com.sckw.payment.model.*;
 import com.sckw.payment.model.constant.*;
+import com.sckw.payment.model.dto.OperateVo;
 import com.sckw.payment.model.dto.WalletInfoDto;
 import com.sckw.payment.model.dto.WalletRelationDto;
 import com.sckw.payment.model.dto.common.BusinessNo;
 import com.sckw.payment.model.dto.common.Page;
 import com.sckw.payment.model.dto.page.CashPage;
+import com.sckw.payment.model.dto.page.OperatePage;
 import com.sckw.payment.model.dto.page.PrePayLogsPage;
 import com.sckw.payment.model.dto.page.PrePayWalletPage;
 import com.sckw.payment.model.dto.wallet.*;
@@ -1413,6 +1415,40 @@ public class WalletService {
         kwpWalletService.saveTime(uid, filter, channelEnum.getChannel());
         return orderR.getData();
     }
+    public Object dealQuery(OperateReq operateReq) {
+        String[] strings = new String[0];
+        if (StringUtils.isNotBlank(operateReq.getStartTime()) && StringUtils.isNotBlank(operateReq.getEndTime())) {
+            strings = new String[]{operateReq.getStartTime(), operateReq.getEndTime()};
+        }
+        R<OperatePage> operateR = payCenterService.operateIndex(operateReq.getUid(), operateReq.getChannel(), operateReq.getPage(), operateReq.getPageSize(), operateReq.getType(), strings);
+        if (operateR.getStatus()) {
+            OperatePage data = operateR.getData();
+            List<Operate> rows = data.getRows();
+            List<OperateVo> list = new ArrayList<>();
+            if (!CollectionUtils.isEmpty(rows)) {
+                OperateVo operateVo;
+                for (Operate row : rows) {
+                    operateVo = new OperateVo();
+                    operateVo.setCreateTime(row.getCreateTime());
+                    operateVo.setWdMoney(BigDecimal.valueOf(row.getWdMoney().getValue() / 100D));
+                    operateVo.setTypeText(row.getTypeText());
+                    operateVo.setType(row.getType());
+                    operateVo.setApMoney(BigDecimal.valueOf(row.getApMoney().getValue() / 100D));
+                    operateVo.setFilter(row.getFilter());
+                    operateVo.setUid(row.getUid());
+                    operateVo.setFile(row.getFile());
+                    operateVo.setMoney(BigDecimal.valueOf(row.getMoney().getValue() / 100D));
+                    operateVo.setOperateMoney(BigDecimal.valueOf(row.getOperateMoney() / 100D));
+                    operateVo.setFreezeMoney(BigDecimal.valueOf(row.getFreezeMoney().getValue() / 100D));
+                    operateVo.setRemarks(row.getRemarks());
+                    operateVo.setStatus(row.getStatus());
+                    list.add(operateVo);
+                }
+            }
+            return new PageRes<>(operateReq.getPage(), operateReq.getPageSize(), data.getTotal(), (int) (data.getTotal() / data.getPageSize() + 1), list);
+        }
+        return new PageRes<>(operateReq.getPage(), operateReq.getPageSize(), 0, 0, new ArrayList<>());
+    }
 
     /**
      * 预付追加