浏览代码

提现账单详情

wujiefeng 1 年之前
父节点
当前提交
f7ae8804b3

+ 2 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/pay/WithdrawOrderModel.java

@@ -85,4 +85,6 @@ public class WithdrawOrderModel {
 
     @Schema(description = "排序")
     private Integer sort;
+
+    private List<WithdrawProcessModel> withdrawProcessModel;
 }

+ 24 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/pay/WithdrawProcessModel.java

@@ -0,0 +1,24 @@
+package com.zhongshu.card.client.model.pay;
+
+import com.zhongshu.card.client.type.AuditStatus;
+import com.zhongshu.card.client.type.ProcessStage;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+public class WithdrawProcessModel {
+
+    @Schema(description = "流程阶段")
+    private ProcessStage processStage;
+
+    @Schema(description = "状态")
+    private String status;
+
+    private Long time;
+
+    private String user;
+
+    private Boolean show;
+
+    private Integer sort;
+}

+ 17 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/type/ProcessStage.java

@@ -0,0 +1,17 @@
+package com.zhongshu.card.client.type;
+
+import lombok.Getter;
+
+public enum ProcessStage {
+
+    Apply("发起"),
+    Audit("审核"),
+    Transfer("到账");
+
+    @Getter
+    private String remark;
+
+    ProcessStage(String remark) {
+        this.remark = remark;
+    }
+}

+ 15 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/pay/withdraw/WithdrawController.java

@@ -1,5 +1,7 @@
 package com.zhongshu.card.server.core.controller.pay.withdraw;
 
+import com.github.microservice.auth.security.annotations.ResourceAuth;
+import com.github.microservice.auth.security.type.AuthType;
 import com.github.microservice.types.payment.PaymentType;
 import com.zhongshu.card.client.model.pay.ProcessWithdrawParam;
 import com.zhongshu.card.client.model.pay.WithdrawPageParam;
@@ -21,6 +23,7 @@ public class WithdrawController {
     @Autowired
     private WithdrawService withdrawService;
 
+    @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "查询账户可提案余额", description = "顶部数据及资金概况-折线图")
     @RequestMapping(value = "queryWithdrawAmount", method = RequestMethod.GET)
     public Object queryWithdrawAmount(@RequestParam(value = "projectId", required = false) String projectOid,
@@ -28,6 +31,7 @@ public class WithdrawController {
         return withdrawService.queryWithdrawAmount(projectOid, oid);
     }
 
+    @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "查询渠道可提案余额", description = "顶部数据及资金概况-折线图")
     @RequestMapping(value = "queryWithdrawAmountByPayment", method = RequestMethod.GET)
     public Object queryWithdrawAmountByPayment(@RequestParam(value = "projectId", required = false) String projectOid,
@@ -36,18 +40,21 @@ public class WithdrawController {
         return withdrawService.queryWithdrawAmount(projectOid, oid, paymentType);
     }
 
+    @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "发起提现", description = "发起提现")
     @RequestMapping(value = "withdrawApply", method = RequestMethod.POST)
     public Object withdrawApply(@RequestBody WithdrawParam param){
         return withdrawService.withdrawApply(param);
     }
 
+    @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "审核提现", description = "审核提现")
     @RequestMapping(value = "withdraw", method = RequestMethod.POST)
     public Object withdraw(@RequestBody ProcessWithdrawParam param){
         return withdrawService.withdraw(param);
     }
 
+    @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "分页查询-提现记录", description = "查询收入账单-年月日汇总")
     @RequestMapping(value = "page", method = RequestMethod.POST)
     public Object page(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10)Pageable pageable,
@@ -55,9 +62,17 @@ public class WithdrawController {
         return withdrawService.page(pageable, param);
     }
 
+    @ResourceAuth(value = "user", type = AuthType.User)
     @Operation(summary = "查询提现状态", description = "查询提现状态")
     @RequestMapping(value = "withdrawQuery", method = RequestMethod.GET)
     public Object withdrawQuery(@RequestParam("id") String id){
         return withdrawService.withdrawQuery(id);
     }
+
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @Operation(summary = "查询提现订单详情", description = "查询提现状态")
+    @RequestMapping(value = "queryDetailById", method = RequestMethod.GET)
+    public Object queryDetailById(@RequestParam("id") String id){
+        return withdrawService.queryDetailById(id);
+    }
 }

+ 42 - 5
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/pay/WithdrawService.java

@@ -21,12 +21,10 @@ import com.github.microservice.pay.client.type.ledger.TransactionStatus;
 import com.github.microservice.pay.client.type.ledger.TransactionType;
 import com.github.microservice.types.payment.PaymentChannelType;
 import com.github.microservice.types.payment.PaymentType;
-import com.zhongshu.card.client.model.pay.ProcessWithdrawParam;
-import com.zhongshu.card.client.model.pay.WithdrawOrderModel;
-import com.zhongshu.card.client.model.pay.WithdrawPageParam;
-import com.zhongshu.card.client.model.pay.WithdrawParam;
+import com.zhongshu.card.client.model.pay.*;
 import com.zhongshu.card.client.model.paySetting.paySetting.OrgPayConfigModel;
 import com.zhongshu.card.client.type.AuditStatus;
+import com.zhongshu.card.client.type.ProcessStage;
 import com.zhongshu.card.client.type.WithdrawStatus;
 import com.zhongshu.card.client.type.paySetting.WithdrawMethodType;
 import com.zhongshu.card.client.utils.DateUtils;
@@ -52,6 +50,8 @@ import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
@@ -584,7 +584,44 @@ public class WithdrawService extends SuperService {
      * 查询详情
      */
     public Object queryDetailById(String id){
-        return null;
+        WithdrawOrder withdrawOrder = withdrawOrderDao.findTop1ById(id);
+        WithdrawOrderModel model = toModel(withdrawOrder);
+
+        ProcessStage[] values = ProcessStage.values();
+        List<WithdrawProcessModel> list = Arrays.stream(values).map(it -> {
+            WithdrawProcessModel withdrawProcessModel = new WithdrawProcessModel();
+            withdrawProcessModel.setProcessStage(it);
+            withdrawProcessModel.setShow(false);
+            if (it.equals(ProcessStage.Apply)) {
+                withdrawProcessModel.setStatus(ProcessStage.Apply.name());
+                withdrawProcessModel.setTime(withdrawOrder.getCreateTime());
+                withdrawProcessModel.setUser(withdrawOrder.getWithdrawUser());
+                withdrawProcessModel.setSort(0);
+                withdrawProcessModel.setShow(true);
+            }
+            if (it.equals(ProcessStage.Audit)) {
+                withdrawProcessModel.setSort(1);
+                if (!withdrawOrder.getAuditStatus().equals(AuditStatus.Wait)) {
+                    withdrawProcessModel.setStatus(withdrawOrder.getAuditStatus().name());
+                    withdrawProcessModel.setTime(withdrawOrder.getProcessTime());
+                    withdrawProcessModel.setUser(withdrawOrder.getProcessUser());
+                    withdrawProcessModel.setShow(true);
+                }
+            }
+
+            if (it.equals(ProcessStage.Transfer)) {
+                withdrawProcessModel.setSort(2);
+                if (withdrawOrder.getAuditStatus().equals(AuditStatus.Success)) {
+                    withdrawProcessModel.setStatus(withdrawOrder.getWithdrawStatus().name());
+                    withdrawProcessModel.setTime(withdrawOrder.getUpdateTime());
+                    withdrawProcessModel.setShow(true);
+                }
+            }
+            return withdrawProcessModel;
+        }).toList();
+
+        model.setWithdrawProcessModel(list);
+        return model;
     }
 
     public Object queryDetailByOrderNo(String orderNo){