Browse Source

团长提现

qin 1 year ago
parent
commit
58ec01a3b0

+ 1 - 0
src/main/java/com/poteviohealth/ym/ipos/YmIposApplication.java

@@ -13,6 +13,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
  */
 @EnableDiscoveryClient
 @EnableFeignClients(basePackages = {"com.poteviohealth.cgp.common.integrated.partner",
+		"com.poteviohealth.cgp.common.integrated.customer",
 		"com.poteviohealth.cgp.common.integrated.customer","com.poteviohealth.cgp.common.integrated.order"})
 @EnableConfigurationProperties
 @SpringBootApplication(exclude={DataSourceAutoConfiguration.class})

+ 16 - 0
src/main/java/com/poteviohealth/ym/ipos/controller/app/SettlementAppController.java

@@ -5,6 +5,9 @@ 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.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.ym.ipos.model.split.SplitWithdraw;
@@ -25,6 +28,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
 
 /**
  * 结算管理app
@@ -40,6 +45,8 @@ public class SettlementAppController extends BaseWebController {
     @Resource
     private ISplitWithdrawService splitWithdrawService;
 
+    private CustomerFeignClient customerFeignClient;
+
 
     @PostMapping("/merchantQuery")
     @ApiOperation(value = "结算查询")
@@ -64,6 +71,15 @@ public class SettlementAppController extends BaseWebController {
     @ApiOperation(value = "取现")
     @OperationLog(type = OperateType.SELECT, description ="取现")
     public VaultsResponse<WithdrawBack> withdraw(@RequestBody WithdrawDto 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();
+        if(groupLeaderDTO.getRemainedAmt()<dto.getAmount()){
+            DecimalFormat df = new DecimalFormat("#0.00");
+            return VaultsResponse.failed("留存保证金为:"+new BigDecimal(df.format(groupLeaderDTO.getRemainedAmt() / 100.0))+"元,可提现金额不足");
+        }
         if(StringUtils.isEmpty(dto.getMerchantId())){
             dto.setMerchantId(TokenContext.cureMiniUser().getIposMerchantId());
         }