|
@@ -165,18 +165,17 @@ public class KxsMachineAdvanceServiceImpl extends ServiceImpl<KxsMachineAdvanceM
|
|
|
//查询主订单预发机
|
|
//查询主订单预发机
|
|
|
KxsMachineAdvance kxsMachineAdvance = baseMapper.selectById(machineAdvanceInfo.getOrderId());
|
|
KxsMachineAdvance kxsMachineAdvance = baseMapper.selectById(machineAdvanceInfo.getOrderId());
|
|
|
|
|
|
|
|
- if(Objects.equals(machineAdvanceInfo.getIsUseAmount(), CommonConstants.SUCCESS)){
|
|
|
|
|
-
|
|
|
|
|
- //查询品牌
|
|
|
|
|
- R<KxsBrand> kxsBrandR = remoteKxsProductService.loadByBrand(kxsMachineAdvance.getBrandId(), SecurityConstants.FROM_IN);
|
|
|
|
|
- KxsBrand brand = RetOps.of(kxsBrandR)
|
|
|
|
|
- .getData()
|
|
|
|
|
- .orElseThrow(() -> new GlobalCustomerException(StoreErrorTypeEnum.DATA_ERROR.getDescription()));
|
|
|
|
|
|
|
+ //查询品牌
|
|
|
|
|
+ R<KxsBrand> kxsBrandR = remoteKxsProductService.loadByBrand(kxsMachineAdvance.getBrandId(), SecurityConstants.FROM_IN);
|
|
|
|
|
+ KxsBrand brand = RetOps.of(kxsBrandR)
|
|
|
|
|
+ .getData()
|
|
|
|
|
+ .orElseThrow(() -> new GlobalCustomerException(StoreErrorTypeEnum.DATA_ERROR.getDescription()));
|
|
|
|
|
|
|
|
- //小分仓减少已用额度 刷新可用额度
|
|
|
|
|
- Integer price = EnumUtil.getFieldBy(BrandTypeEnum::getType, BrandTypeEnum::getDescription, String.valueOf(brand.getBrandType()));
|
|
|
|
|
|
|
+ Integer price = EnumUtil.getFieldBy(BrandTypeEnum::getType, BrandTypeEnum::getDescription, String.valueOf(brand.getBrandType()));
|
|
|
|
|
+ if(Objects.equals(machineAdvanceInfo.getIsUseAmount(), CommonConstants.SUCCESS)){
|
|
|
|
|
+ //小分仓增加可用额度
|
|
|
kxsWarehouseLimitService.refreshUserAmount(kxsMachineAdvance.getToUserId(), price, KindTypeEnum.SUB.getType());
|
|
kxsWarehouseLimitService.refreshUserAmount(kxsMachineAdvance.getToUserId(), price, KindTypeEnum.SUB.getType());
|
|
|
- //增加仓库已用额度减少仓库可用额度
|
|
|
|
|
|
|
+ //减少仓库可用额度
|
|
|
kxsWarehouseLimitService.refreshWarehouseAmount(kxsMachineAdvance.getSendUserId(), price, KindTypeEnum.ADD.getType());
|
|
kxsWarehouseLimitService.refreshWarehouseAmount(kxsMachineAdvance.getSendUserId(), price, KindTypeEnum.ADD.getType());
|
|
|
}
|
|
}
|
|
|
//直接删除记录
|
|
//直接删除记录
|
|
@@ -350,19 +349,15 @@ public class KxsMachineAdvanceServiceImpl extends ServiceImpl<KxsMachineAdvanceM
|
|
|
}
|
|
}
|
|
|
//额度充足
|
|
//额度充足
|
|
|
if (userLimit.getValidAmount().compareTo(BigDecimal.valueOf(amount)) >= 0) {
|
|
if (userLimit.getValidAmount().compareTo(BigDecimal.valueOf(amount)) >= 0) {
|
|
|
|
|
+ //修改为占用预发额度标签
|
|
|
|
|
+ machineAdvanceInfo.setIsUseAmount(CommonConstants.SUCCESS);
|
|
|
|
|
|
|
|
- //小分仓增加已用额度 刷新可用额度
|
|
|
|
|
- userLimit.setUsedAmount(NumberUtil.add(userLimit.getUsedAmount(), amount));
|
|
|
|
|
- userLimit.setValidAmount(NumberUtil.sub(userLimit.getValidAmount(), amount));
|
|
|
|
|
- kxsWarehouseLimitMapper.updateById(userLimit);
|
|
|
|
|
-
|
|
|
|
|
- //减少仓库已用额度增加仓库可用额度
|
|
|
|
|
|
|
+ //小分仓减少可用额度
|
|
|
|
|
+ kxsWarehouseLimitService.refreshUserAmount(userLimit.getUserId(), amount, KindTypeEnum.SUB.getType());
|
|
|
|
|
+ //增加仓库可用额度
|
|
|
kxsWarehouseLimitService.refreshWarehouseAmount(warehouse.getUserId(), amount, KindTypeEnum.SUB.getType());
|
|
kxsWarehouseLimitService.refreshWarehouseAmount(warehouse.getUserId(), amount, KindTypeEnum.SUB.getType());
|
|
|
}
|
|
}
|
|
|
- //修改为占用预发额度标签
|
|
|
|
|
- if (userLimit.getValidAmount().compareTo(BigDecimal.valueOf(amount)) >= 0) {
|
|
|
|
|
- machineAdvanceInfo.setIsUseAmount(CommonConstants.SUCCESS);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
machineAdvanceInfo.setIsConfirm(CommonConstants.SUCCESS);
|
|
machineAdvanceInfo.setIsConfirm(CommonConstants.SUCCESS);
|
|
|
kxsMachineAdvanceInfoMapper.updateById(machineAdvanceInfo);
|
|
kxsMachineAdvanceInfoMapper.updateById(machineAdvanceInfo);
|
|
|
//给预发对象发送通知
|
|
//给预发对象发送通知
|