Browse Source

暂时去掉三方支付

qin 1 year ago
parent
commit
49fc93af86

+ 29 - 1
src/main/java/com/poteviohealth/ym/ipos/controller/SettlementController.java

@@ -4,6 +4,7 @@ import com.poteviohealth.cgp.common.controller.BaseWebController;
 import com.poteviohealth.cgp.common.facade.log.OperateType;
 import com.poteviohealth.cgp.common.facade.log.OperationLog;
 import com.poteviohealth.cgp.common.filter.TokenContext;
+import com.poteviohealth.cgp.common.integrated.IntegerParams;
 import com.poteviohealth.cgp.common.integrated.StringParams;
 import com.poteviohealth.cgp.common.model.CommonPage;
 import com.poteviohealth.cgp.common.model.VaultsResponse;
@@ -41,6 +42,8 @@ public class SettlementController extends BaseWebController {
     private ISplitWithdrawService splitWithdrawService;
 
 
+
+
     @PostMapping("/merchantQuery")
     @ApiOperation(value = "结算查询")
     @OperationLog(type = OperateType.SELECT, description ="结算查询")
@@ -70,7 +73,6 @@ public class SettlementController extends BaseWebController {
         return splitService.withdraw(dto);
     }
 
-
     @PostMapping("/withdrawQuery")
     @ApiOperation(value = "取现查询")
     @OperationLog(type = OperateType.SELECT, description ="取现查询")
@@ -84,4 +86,30 @@ public class SettlementController extends BaseWebController {
         dto.setIposMerchantId(TokenContext.cureWebUser().getIposMerchantId());
         return VaultsResponse.success(splitWithdrawService.pageList(dto));
     }
+
+    @PostMapping("/withdrawSuccess")
+    @ApiOperation(value = "提现申请通过")
+    @OperationLog(type = OperateType.SELECT, description ="提现申请通过")
+    public VaultsResponse withdrawSuccess(@RequestBody IntegerParams params) {
+
+        SplitWithdraw splitWithdraw = splitWithdrawService.getById(params.getId());
+        splitWithdraw.setTransStatus("s");
+        splitWithdrawService.withdrawSuccess(TokenContext.cureOperatorId(),splitWithdraw.getId());
+        splitWithdrawService.updateById(splitWithdraw);
+        return VaultsResponse.success();
+    }
+
+
+    @PostMapping("/withdrawFail")
+    @ApiOperation(value = "提现申请驳回")
+    @OperationLog(type = OperateType.SELECT, description ="提现申请驳回")
+    public VaultsResponse withdrawFail(@RequestBody IntegerParams params) {
+
+        SplitWithdraw splitWithdraw = splitWithdrawService.getById(params.getId());
+        splitWithdraw.setTransStatus("f");
+        splitWithdraw.setErrorMsg(params.getName());
+        splitWithdrawService.withdrawFail(TokenContext.cureOperatorId(),splitWithdraw.getId());
+        splitWithdrawService.updateById(splitWithdraw);
+        return VaultsResponse.success();
+    }
 }

+ 11 - 6
src/main/java/com/poteviohealth/ym/ipos/controller/app/SettlementAppController.java

@@ -7,6 +7,8 @@ import com.poteviohealth.cgp.common.facade.log.OperationLog;
 import com.poteviohealth.cgp.common.filter.TokenContext;
 import com.poteviohealth.cgp.common.integrated.StringParams;
 import com.poteviohealth.cgp.common.integrated.customer.CustomerFeignClient;
+import com.poteviohealth.cgp.common.integrated.customer.model.GroupLeaderDTO;
+import com.poteviohealth.cgp.common.integrated.customer.model.GroupLeaderParams;
 import com.poteviohealth.cgp.common.model.CommonPage;
 import com.poteviohealth.cgp.common.model.VaultsResponse;
 import com.poteviohealth.cgp.common.utils.CgpTool;
@@ -23,7 +25,6 @@ import com.poteviohealth.ym.ipos.service.ISplitWithdrawService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang.StringUtils;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -48,8 +49,6 @@ public class SettlementAppController extends BaseWebController {
     private ISplitWithdrawService splitWithdrawService;
     @Resource
     private CustomerFeignClient customerFeignClient;
-    @Value("${sync.dbName}")
-    private String dbName;
 
     @PostMapping("/merchantQuery")
     @ApiOperation(value = "结算查询")
@@ -78,7 +77,7 @@ public class SettlementAppController extends BaseWebController {
 
         return splitService.accountBalanceQuery(params.getId());*/
 
-        Integer money = splitWithdrawService.getGroupLeaderWithdrawSumPrice(TokenContext.cureOperatorId(),dbName, TokenContext.cureMiniUser().getGroupLeaderId());
+        Integer money = splitWithdrawService.getGroupLeaderWithdrawSumPrice(TokenContext.cureOperatorId(), TokenContext.cureMiniUser().getGroupLeaderId());
         AccountBalanceBack balanceBack = new AccountBalanceBack();
         List<AccountBalanceList> list = Lists.newArrayList();
         AccountBalanceList abList = new AccountBalanceList();
@@ -95,7 +94,7 @@ public class SettlementAppController extends BaseWebController {
     public VaultsResponse<Long> accountBalanceUse() {
 
         //TODO 暂时去掉三方支付
-        Long money = splitWithdrawService.getGroupLeaderWithdrawPrice(TokenContext.cureOperatorId(),dbName, TokenContext.cureMiniUser().getGroupLeaderId());
+        Long money = splitWithdrawService.getGroupLeaderWithdrawPrice(TokenContext.cureOperatorId(), TokenContext.cureMiniUser().getGroupLeaderId());
         return VaultsResponse.success(money<0L?0L:money);
         /*if(StringUtils.isEmpty(TokenContext.cureMiniUser().getIposMerchantId())){
             return VaultsResponse.success(0L);
@@ -143,7 +142,11 @@ public class SettlementAppController extends BaseWebController {
         }*//*
         dto.setAmount(dto.getAmount());
         return splitService.withdraw(dto);*/
-
+        GroupLeaderParams groupLeaderParams = new GroupLeaderParams();
+        groupLeaderParams.setOperatorId(TokenContext.cureOperatorId());
+        groupLeaderParams.setGroupLeaderId(Integer.parseInt(TokenContext.cureMiniUser().getGroupLeaderId().toString()));
+        VaultsResponse<GroupLeaderDTO>  vaultsResponse = customerFeignClient.getGroupLeaderById(groupLeaderParams);
+        GroupLeaderDTO groupLeaderDTO = vaultsResponse.getData();
         SplitWithdraw splitWithdraw = new SplitWithdraw();
         splitWithdraw.setOperatorId(TokenContext.cureOperatorId());
         splitWithdraw.setWithdrawId(CgpTool.generateKey());
@@ -153,7 +156,9 @@ public class SettlementAppController extends BaseWebController {
         splitWithdraw.setTransDate(new Date());
         splitWithdraw.setTransStatus("p");
         splitWithdraw.setAcctStatus("p");
+        splitWithdraw.setName(groupLeaderDTO.getName());
         splitWithdrawService.save(splitWithdraw);
+        splitWithdrawService.updateOrderGroupLeaderWithdraw(TokenContext.cureOperatorId(), TokenContext.cureMiniUser().getGroupLeaderId(),splitWithdraw.getId());
         return VaultsResponse.success();
     }
 

+ 9 - 0
src/main/java/com/poteviohealth/ym/ipos/mapper/SplitWithdrawMapper.java

@@ -17,4 +17,13 @@ public interface SplitWithdrawMapper extends BaseMapper<SplitWithdraw> {
 
     @SqlParser(filter = true)
     Integer getGroupLeaderWithdrawSumPrice(@Param("operatorId")Integer operatorId,@Param("dbName")String dbName,@Param("groupLeaderId")Long groupLeaderId);
+
+    @SqlParser(filter = true)
+    void updateOrderGroupLeaderWithdraw(@Param("operatorId")Integer operatorId,@Param("dbName")String dbName,@Param("groupLeaderId")Long groupLeaderId,@Param("withdrawId")Integer withdrawId);
+
+    @SqlParser(filter = true)
+    void updateWithdrawSuccess(@Param("operatorId")Integer operatorId,@Param("dbName")String dbName,@Param("withdrawId")Integer withdrawId);
+
+    @SqlParser(filter = true)
+    void updateWithdrawFail(@Param("operatorId")Integer operatorId,@Param("dbName")String dbName,@Param("withdrawId")Integer withdrawId);
 }

+ 3 - 0
src/main/java/com/poteviohealth/ym/ipos/model/split/SplitWithdraw.java

@@ -48,4 +48,7 @@ public class SplitWithdraw extends BaseEntity {
 
     @ApiModelProperty(value = "失败原因")
     private String errorMsg;
+
+    @ApiModelProperty(value = "申请人")
+    private String name;
 }

+ 6 - 3
src/main/java/com/poteviohealth/ym/ipos/service/ISplitWithdrawService.java

@@ -11,7 +11,6 @@ import com.poteviohealth.ym.ipos.model.split.dto.SplitWithdrawDto;
  */
 public interface ISplitWithdrawService extends IService<SplitWithdraw>{
 
-
     /**
      * 取现列表
      * @param dto
@@ -19,8 +18,12 @@ public interface ISplitWithdrawService extends IService<SplitWithdraw>{
      */
     CommonPage<SplitWithdraw> pageList(SplitWithdrawDto dto);
 
-    Long getGroupLeaderWithdrawPrice(Integer operatorId,String dbName,Long groupLeaderId);
+    Long getGroupLeaderWithdrawPrice(Integer operatorId,Long groupLeaderId);
+
+    Integer getGroupLeaderWithdrawSumPrice(Integer operatorId,Long groupLeaderId);
 
-    Integer getGroupLeaderWithdrawSumPrice(Integer operatorId,String dbName,Long groupLeaderId);
+    void updateOrderGroupLeaderWithdraw(Integer operatorId,Long groupLeaderId,Integer withdrawId);
 
+    void withdrawSuccess(Integer operatorId,Integer withdrawId);
+    void withdrawFail(Integer operatorId,Integer withdrawId);
 }

+ 20 - 3
src/main/java/com/poteviohealth/ym/ipos/service/impl/SplitWithdrawServiceImpl.java

@@ -10,6 +10,7 @@ import com.poteviohealth.ym.ipos.model.split.SplitWithdraw;
 import com.poteviohealth.ym.ipos.model.split.dto.SplitWithdrawDto;
 import com.poteviohealth.ym.ipos.service.ISplitWithdrawService;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 /**
@@ -19,7 +20,8 @@ import org.springframework.stereotype.Service;
 @Service
 public class SplitWithdrawServiceImpl extends ServiceImpl<SplitWithdrawMapper, SplitWithdraw> implements ISplitWithdrawService {
 
-
+    @Value("${sync.dbName}")
+    private String dbName;
     @Override
     public CommonPage<SplitWithdraw> pageList(SplitWithdrawDto dto) {
         Page<SplitWithdraw> page = MyBatisConvertUtils.convert2Page(dto);
@@ -36,13 +38,28 @@ public class SplitWithdrawServiceImpl extends ServiceImpl<SplitWithdrawMapper, S
     }
 
     @Override
-    public Long getGroupLeaderWithdrawPrice(Integer operatorId, String dbName, Long groupLeaderId) {
+    public Long getGroupLeaderWithdrawPrice(Integer operatorId, Long groupLeaderId) {
 
         return baseMapper.getGroupLeaderWithdrawPrice(operatorId,dbName,groupLeaderId);
     }
 
     @Override
-    public Integer getGroupLeaderWithdrawSumPrice(Integer operatorId, String dbName, Long groupLeaderId) {
+    public Integer getGroupLeaderWithdrawSumPrice(Integer operatorId,  Long groupLeaderId) {
         return baseMapper.getGroupLeaderWithdrawSumPrice(operatorId,dbName,groupLeaderId);
     }
+
+    @Override
+    public void updateOrderGroupLeaderWithdraw(Integer operatorId, Long groupLeaderId, Integer withdrawId) {
+        baseMapper.updateOrderGroupLeaderWithdraw(operatorId,dbName,groupLeaderId,withdrawId);
+    }
+
+    @Override
+    public void withdrawSuccess(Integer operatorId, Integer withdrawId) {
+        baseMapper.updateWithdrawSuccess(operatorId,dbName,withdrawId);
+    }
+
+    @Override
+    public void withdrawFail(Integer operatorId, Integer withdrawId) {
+        baseMapper.updateWithdrawFail(operatorId,dbName,withdrawId);
+    }
 }

+ 23 - 0
src/main/resources/mapper/ipos/SplitWithdrawMapper.xml

@@ -1,6 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.poteviohealth.ym.ipos.mapper.SplitWithdrawMapper">
+    <update id="updateOrderGroupLeaderWithdraw">
+        update ${dbName}_order.o_order_detail_${operatorId} od,
+            ${dbName}_order.o_order_${operatorId} o
+        set od.with_draw_id = #{withdrawId}
+        where o.order_id=od.order_id
+          and od.with_draw_id is null
+          and od.split_status = 2
+          and o.group_leader_id=#{groupLeaderId}
+    </update>
+    <update id="updateWithdrawSuccess">
+        update ${dbName}_order.o_order_detail_${operatorId} od,
+            ${dbName}_order.o_order_${operatorId} o
+        set od.split_status = 3
+        where o.order_id=od.order_id
+          and od.with_draw_id = #{withdrawId}
+    </update>
+    <update id="updateWithdrawFail">
+        update ${dbName}_order.o_order_detail_${operatorId} od,
+            ${dbName}_order.o_order_${operatorId} o
+        set od.with_draw_id = NULL
+        where o.order_id=od.order_id
+          and od.with_draw_id = #{withdrawId}
+    </update>
 
     <select id="getGroupLeaderWithdrawPrice" resultType="java.lang.Long">
         SELECT