gongfuzhu 1 year ago
parent
commit
50c98250b5

+ 11 - 6
SpringBatchServiceServer/src/main/java/com/zswl/cloud/springBtach/server/core/controller/PaymentController.java

@@ -4,23 +4,22 @@ import com.github.microservice.auth.client.constant.AuthConstant;
 import com.github.microservice.auth.client.content.ResultContent;
 import com.github.microservice.auth.security.annotations.ResourceAuth;
 import com.github.microservice.auth.security.type.AuthType;
-import com.zhongshu.payment.client.model.Pages;
 import com.zhongshu.payment.client.model.order.AdminSeachOrderModel;
 import com.zhongshu.payment.client.model.order.ApplicantRefundParamModel;
 import com.zhongshu.payment.client.model.order.v2.ApplicantRefundParam2Model;
 import com.zhongshu.payment.client.model.order.v2.RefundParam2Model;
 import com.zhongshu.payment.client.model.order.v2.TransferModel;
+import com.zhongshu.payment.client.model.order.v2.WithdrawRequestModel;
 import com.zhongshu.payment.client.model.payment.CloseResponsetModel;
 import com.zhongshu.payment.client.model.payment.CreateResponseModel;
 import com.zhongshu.payment.client.model.payment.QueryRequestModel;
 import com.zhongshu.payment.client.model.payment.zswl.CreatePaymentModel;
+import com.zswl.cloud.springBtach.server.core.model.SubOrderModel;
 import com.zswl.cloud.springBtach.server.core.service.PaymentService;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.log4j.Log4j2;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -130,9 +129,15 @@ public class PaymentController {
     @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform)
     @ResourceAuth(value = "admin", type = AuthType.Enterprise)
     @ResourceAuth(value = "admin", type = AuthType.Project)
-    @RequestMapping(value = "account/withdrawals/list", method = RequestMethod.GET)
-    public ResultContent withdrawalsList() {
-        return paymentServer.withdrawalsList();
+    @RequestMapping(value = "account/withdrawals/list", method = RequestMethod.POST)
+    public ResultContent withdrawalsList(@RequestBody WithdrawRequestModel withdrawRequestModel) {
+        return paymentServer.withdrawalsList(withdrawRequestModel);
+    }
+    @ApiOperation("确认分账")
+    @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform)
+    @RequestMapping(value = "subOrdersConfirm", method = RequestMethod.POST )
+    public ResultContent subOrdersConfirm(SubOrderModel subOrderModel) {
+        return paymentServer.subOrdersConfirm(subOrderModel.getGoodId(),subOrderModel.getUseShop());
     }
 
 

+ 8 - 1
SpringBatchServiceServer/src/main/java/com/zswl/cloud/springBtach/server/core/job/standard/StandarVerificationJob.java

@@ -1,8 +1,10 @@
 package com.zswl.cloud.springBtach.server.core.job.standard;
 
 import com.github.microservice.auth.client.content.ResultContent;
+import com.github.microservice.auth.client.content.ResultState;
 import com.zhongshu.payment.client.model.order.v2.CreateOrder2Model;
 import com.zhongshu.payment.client.model.order.v2.VerificationModel;
+import com.zhongshu.payment.client.model.payment.SubOrdersConfirmResponseModel;
 import com.zhongshu.payment.client.service.v2.OrderService2;
 import com.zhongshu.payment.client.service.v2.PaymentService2;
 import lombok.Data;
@@ -44,8 +46,13 @@ public class StandarVerificationJob {
         return stepBuilderFactory.get("standardVerificationStep")
                 .tasklet((contribution, chunkContext) -> {
                     VerificationModel verificationModel = getParameter().get();
+
+                    ResultContent<SubOrdersConfirmResponseModel> resultContent = paymentService2.subOrdersConfirm(verificationModel.getId(), verificationModel.getShopId());
+                    if (!resultContent.getState().equals(ResultState.Success)) {
+                        getResultContent().set(resultContent);
+                        return RepeatStatus.FINISHED;
+                    }
                     getResultContent().set(orderService2.verification(verificationModel));
-                    paymentService2.subOrdersConfirm(verificationModel.getId(),verificationModel.getShopId());
                     return RepeatStatus.FINISHED;
                 })
                 .build();

+ 15 - 0
SpringBatchServiceServer/src/main/java/com/zswl/cloud/springBtach/server/core/model/SubOrderModel.java

@@ -0,0 +1,15 @@
+package com.zswl.cloud.springBtach.server.core.model;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class SubOrderModel {
+
+    private String goodId;
+
+    private String useShop;
+}

+ 12 - 3
SpringBatchServiceServer/src/main/java/com/zswl/cloud/springBtach/server/core/service/PaymentService.java

@@ -6,6 +6,7 @@ import com.github.microservice.auth.security.helper.AuthHelper;
 import com.zhongshu.payment.client.model.order.AdminSeachOrderModel;
 import com.zhongshu.payment.client.model.order.v2.ApplicantRefundParam2Model;
 import com.zhongshu.payment.client.model.order.v2.RefundParam2Model;
+import com.zhongshu.payment.client.model.order.v2.WithdrawRequestModel;
 import com.zhongshu.payment.client.model.payment.QueryResponseModel;
 import com.zhongshu.payment.client.model.payment.zswl.CreatePayment2Model;
 import com.zhongshu.payment.client.model.payment.zswl.CreatePaymentModel;
@@ -13,7 +14,6 @@ import com.zhongshu.payment.client.service.v2.PaymentService2;
 import com.zswl.cloud.shop.client.service.GoodsService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Pageable;
 import org.springframework.stereotype.Service;
 
 @Service
@@ -79,6 +79,8 @@ public class PaymentService {
     }
 
     public ResultContent transferList(AdminSeachOrderModel seachOrderModel) {
+        String enterPriseId = authHelper.getEnterPriseId();
+        seachOrderModel.setShopId(enterPriseId);
         return paymentService2.transferList(seachOrderModel);
     }
 
@@ -89,8 +91,15 @@ public class PaymentService {
     public ResultContent withdrawals() {
         return paymentService2.withdrawals(authHelper.getEnterPriseId());
     }
-    public ResultContent withdrawalsList() {
-        return paymentService2.withdrawalsList(authHelper.getEnterPriseId());
+
+    public ResultContent withdrawalsList(WithdrawRequestModel withdrawRequestModel) {
+        String enterPriseId = authHelper.getEnterPriseId();
+        withdrawRequestModel.setShopId(enterPriseId);
+        return paymentService2.withdrawalsList(withdrawRequestModel);
+    }
+
+    public ResultContent subOrdersConfirm(String goodsId, String useShopId) {
+        return paymentService2.subOrdersConfirm(goodsId, useShopId);
     }