|
@@ -43,7 +43,6 @@ public class KxsForAmountWithdrawServiceImpl extends ServiceImpl<KxsForAmountWit
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
@GlobalTransactional
|
|
@GlobalTransactional
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public R forAmountWithdraw(ForAmountWithdrawDTO param, Integer withdrawType) {
|
|
public R forAmountWithdraw(ForAmountWithdrawDTO param, Integer withdrawType) {
|
|
|
|
|
|
|
|
Long userId = SecurityUtils.getUser().getId();
|
|
Long userId = SecurityUtils.getUser().getId();
|
|
@@ -104,19 +103,19 @@ public class KxsForAmountWithdrawServiceImpl extends ServiceImpl<KxsForAmountWit
|
|
|
* @param userLimit 用户限制
|
|
* @param userLimit 用户限制
|
|
|
*/
|
|
*/
|
|
|
private void bankWithdrawAmount(KxsForAmountWithdraw kxsForAmountWithdraw, ForAmountWithdrawDTO param, KxsWarehouseLimit userLimit) {
|
|
private void bankWithdrawAmount(KxsForAmountWithdraw kxsForAmountWithdraw, ForAmountWithdrawDTO param, KxsWarehouseLimit userLimit) {
|
|
|
-// //银行卡最大提现金额
|
|
|
|
|
-// BigDecimal bankCashAmount = NumberUtil.sub(userLimit.getBankRechargeAmount(), userLimit.getBankWithdrawAmount());
|
|
|
|
|
-// //银行卡提现
|
|
|
|
|
-// if(param.getBankAmount() > bankCashAmount.intValue()){
|
|
|
|
|
-// throw new GlobalCustomerException("提现到银行卡超出限额");
|
|
|
|
|
-// }
|
|
|
|
|
-// kxsForAmountWithdraw.setAmount(BigDecimal.valueOf(param.getBankAmount()));
|
|
|
|
|
-// baseMapper.insert(kxsForAmountWithdraw);
|
|
|
|
|
-//
|
|
|
|
|
-// //扣减可用余额,扣减临额
|
|
|
|
|
-// userLimit.setForAmount(NumberUtil.sub(userLimit.getForAmount(),param.getBankAmount()));
|
|
|
|
|
-// userLimit.setValidAmount(NumberUtil.sub(userLimit.getValidAmount(),param.getBankAmount()));
|
|
|
|
|
-// kxsWarehouseLimitMapper.updateById(userLimit);
|
|
|
|
|
|
|
+ //银行卡最大提现金额
|
|
|
|
|
+ BigDecimal bankCashAmount = userLimit.getForAmount();
|
|
|
|
|
+ //银行卡提现
|
|
|
|
|
+ if(param.getBankAmount() > bankCashAmount.intValue()){
|
|
|
|
|
+ throw new GlobalCustomerException("提现到银行卡超出限额");
|
|
|
|
|
+ }
|
|
|
|
|
+ kxsForAmountWithdraw.setAmount(BigDecimal.valueOf(param.getBankAmount()));
|
|
|
|
|
+ baseMapper.insert(kxsForAmountWithdraw);
|
|
|
|
|
+
|
|
|
|
|
+ //扣减可用余额,扣减临额
|
|
|
|
|
+ userLimit.setForAmount(NumberUtil.sub(userLimit.getForAmount(),param.getBankAmount()));
|
|
|
|
|
+ userLimit.setValidAmount(NumberUtil.sub(userLimit.getValidAmount(),param.getBankAmount()));
|
|
|
|
|
+ kxsWarehouseLimitMapper.updateById(userLimit);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -129,38 +128,38 @@ public class KxsForAmountWithdrawServiceImpl extends ServiceImpl<KxsForAmountWit
|
|
|
*/
|
|
*/
|
|
|
public void yueWithdrawAmount(KxsForAmountWithdraw kxsForAmountWithdraw, ForAmountWithdrawDTO param, KxsWarehouseLimit userLimit){
|
|
public void yueWithdrawAmount(KxsForAmountWithdraw kxsForAmountWithdraw, ForAmountWithdrawDTO param, KxsWarehouseLimit userLimit){
|
|
|
|
|
|
|
|
-// //余额最大提现金额
|
|
|
|
|
-// BigDecimal yueCashAmount = NumberUtil.sub(userLimit.getYueRechargeAmount(), userLimit.getYueWithdrawAmount());
|
|
|
|
|
-// //余额提现
|
|
|
|
|
-// if(param.getYueAmount() > yueCashAmount.intValue()){
|
|
|
|
|
-// throw new GlobalCustomerException("提现到余额超出限额");
|
|
|
|
|
-// }
|
|
|
|
|
-// kxsForAmountWithdraw.setAmount(BigDecimal.valueOf(param.getYueAmount()));
|
|
|
|
|
-// kxsForAmountWithdraw.setStatus(1);
|
|
|
|
|
-// baseMapper.insert(kxsForAmountWithdraw);
|
|
|
|
|
-//
|
|
|
|
|
-// //扣减可用余额,扣减临额
|
|
|
|
|
-// userLimit.setForAmount(NumberUtil.sub(userLimit.getForAmount(),param.getYueAmount()));
|
|
|
|
|
-// userLimit.setValidAmount(NumberUtil.sub(userLimit.getValidAmount(),param.getYueAmount()));
|
|
|
|
|
-// kxsWarehouseLimitMapper.updateById(userLimit);
|
|
|
|
|
-//
|
|
|
|
|
-// KxsUserAmountLog userAmountLog = new KxsUserAmountLog();
|
|
|
|
|
-// userAmountLog.setUserId(kxsForAmountWithdraw.getUserId());
|
|
|
|
|
-// userAmountLog.setKind(KindTypeEnum.ADD.getType());
|
|
|
|
|
-// //分仓临时额度提现
|
|
|
|
|
-// if(kxsForAmountWithdraw.getWithdrawType() == 0){
|
|
|
|
|
-// userAmountLog.setVariationType(AmountLogChangeTypesEnum.FOR_WILL_BE_REFUNDED.getType());
|
|
|
|
|
-// userAmountLog.setVariationCause(AmountLogChangeTypesEnum.FOR_WILL_BE_REFUNDED.getDescription());
|
|
|
|
|
-// }else{
|
|
|
|
|
-// userAmountLog.setVariationType(AmountLogChangeTypesEnum.ADVANCE_ISSUANCE_TEMPORARY_QUOTA_REFUND.getType());
|
|
|
|
|
-// userAmountLog.setVariationCause(AmountLogChangeTypesEnum.ADVANCE_ISSUANCE_TEMPORARY_QUOTA_REFUND.getDescription());
|
|
|
|
|
-// }
|
|
|
|
|
-// userAmountLog.setAmount(BigDecimal.valueOf(param.getYueAmount()));
|
|
|
|
|
-//
|
|
|
|
|
-// R<Boolean> booleanR = remoteKxsUserService.userAmountChange(userAmountLog, SecurityConstants.FROM_IN);
|
|
|
|
|
-// if(!booleanR.getData()){
|
|
|
|
|
-// throw new GlobalCustomerException("提现申请失败");
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ //余额最大提现金额
|
|
|
|
|
+ BigDecimal yueCashAmount = userLimit.getYueForAmount();
|
|
|
|
|
+ //余额提现
|
|
|
|
|
+ if(param.getYueAmount() > yueCashAmount.intValue()){
|
|
|
|
|
+ throw new GlobalCustomerException("提现到余额超出限额");
|
|
|
|
|
+ }
|
|
|
|
|
+ kxsForAmountWithdraw.setAmount(BigDecimal.valueOf(param.getYueAmount()));
|
|
|
|
|
+ kxsForAmountWithdraw.setStatus(1);
|
|
|
|
|
+ baseMapper.insert(kxsForAmountWithdraw);
|
|
|
|
|
+
|
|
|
|
|
+ //扣减可用余额,扣减临额
|
|
|
|
|
+ userLimit.setYueForAmount(NumberUtil.sub(userLimit.getForAmount(),param.getYueAmount()));
|
|
|
|
|
+ userLimit.setValidAmount(NumberUtil.sub(userLimit.getValidAmount(),param.getYueAmount()));
|
|
|
|
|
+ kxsWarehouseLimitMapper.updateById(userLimit);
|
|
|
|
|
+
|
|
|
|
|
+ KxsUserAmountLog userAmountLog = new KxsUserAmountLog();
|
|
|
|
|
+ userAmountLog.setUserId(kxsForAmountWithdraw.getUserId());
|
|
|
|
|
+ userAmountLog.setKind(KindTypeEnum.ADD.getType());
|
|
|
|
|
+ //分仓临时额度提现
|
|
|
|
|
+ if(kxsForAmountWithdraw.getWithdrawType() == 0){
|
|
|
|
|
+ userAmountLog.setVariationType(AmountLogChangeTypesEnum.FOR_WILL_BE_REFUNDED.getType());
|
|
|
|
|
+ userAmountLog.setVariationCause(AmountLogChangeTypesEnum.FOR_WILL_BE_REFUNDED.getDescription());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ userAmountLog.setVariationType(AmountLogChangeTypesEnum.ADVANCE_ISSUANCE_TEMPORARY_QUOTA_REFUND.getType());
|
|
|
|
|
+ userAmountLog.setVariationCause(AmountLogChangeTypesEnum.ADVANCE_ISSUANCE_TEMPORARY_QUOTA_REFUND.getDescription());
|
|
|
|
|
+ }
|
|
|
|
|
+ userAmountLog.setAmount(BigDecimal.valueOf(param.getYueAmount()));
|
|
|
|
|
+
|
|
|
|
|
+ R<Boolean> booleanR = remoteKxsUserService.userAmountChange(userAmountLog, SecurityConstants.FROM_IN);
|
|
|
|
|
+ if(booleanR.getStatus() == 1 && !booleanR.getData()){
|
|
|
|
|
+ throw new GlobalCustomerException("提现申请失败");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|