|
@@ -569,8 +569,40 @@ public class DistributorRechargeServiceImpl implements DistributorRechargeServic
|
|
|
beforeBalance = distributor.getBalance();
|
|
|
afterBalance = beforeBalance.subtract(money);
|
|
|
tradeMode = 2;
|
|
|
- isShareBalance = new AtomicBoolean(false);
|
|
|
+ isShareBalance = new AtomicBoolean(true);
|
|
|
+ storeRespDTO = new AtomicReference<>();
|
|
|
+ if (rechargeReqDTO.getStoreId() != null){
|
|
|
+// StoreReqDTO reqDTO = this.convertStorePlatBalance(rechargeReqDTO.getStoreId(), tradeMode, money, Long.parseLong(rechargeReqDTO.getOrderId()), tradeType, null);
|
|
|
+// TenantUtils.execute(distributor.getAccountTenantId(), () -> {
|
|
|
+// StoreInfoReqDTO storeData = storeApi.getStoreById(rechargeReqDTO.getStoreId()).getCheckedData();
|
|
|
+// Asserts.isTrue(!ObjectUtil.equals(storeData.getBalanceType(), StoreBalanceTypeEnum.FORBIDDEN.getType()), "当前门店禁止使用预付款");
|
|
|
+// if(ObjectUtil.equals(storeData.getBalanceType(), StoreBalanceTypeEnum.FIXED.getType())){
|
|
|
+// //只能使用门店自己的预付款
|
|
|
+// CommonResult<StoreRespDTO> storeResult = storeApi.storePlatTrade(reqDTO);
|
|
|
+// Asserts.isTrue(storeResult.isSuccess(), storeResult.getMsg());
|
|
|
+// storeRespDTO.set(storeResult.getCheckedData());
|
|
|
+// }else if(ObjectUtil.equals(storeData.getBalanceType(), StoreBalanceTypeEnum.SHARE.getType())){
|
|
|
+// isShareBalance.set(true);
|
|
|
+// }else {
|
|
|
+// Asserts.isTrue(true,"门店禁用预付款");
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }else {
|
|
|
+ isShareBalance.set(true);
|
|
|
+ }
|
|
|
|
|
|
+ if(isShareBalance.get()){
|
|
|
+ Asserts.isTrue(isUseBalance,"分销商无预付款交易权限");
|
|
|
+ Asserts.isTrue(afterBalance.compareTo(BigDecimal.ZERO)>=0,"平台余额不足额");
|
|
|
+ tradeName = "预付款支付授信账单金额:" + money + "元,支付后剩余余额" + afterBalance + "元";
|
|
|
+ flag = distributorService.subBalance(distributor.getId(), money);
|
|
|
+ }else if(storeRespDTO.get()!=null){
|
|
|
+ StoreRespDTO storeRsp = storeRespDTO.get();
|
|
|
+ beforeBalance = storeRsp.getBeforeAmount();
|
|
|
+ afterBalance = storeRsp.getAfterAmount();
|
|
|
+ tradeName = "门店预付款支付授信账单金额:" + money + "元,支付后剩余余额" + storeRsp.getAfterAmount() + "元;";
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
break;
|
|
|
case 17:
|
|
|
//给门店分配预付款
|