|
|
@@ -295,22 +295,24 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
{
|
|
|
throw new SecurityException("撤销账单失败,未获取到原业务信息");
|
|
|
}
|
|
|
- OrderFees orderFees=new OrderFees();
|
|
|
- orderFees.setId(srcFeesId);
|
|
|
- orderFees.setTenantId(AuthUtil.getTenantId());
|
|
|
- R<OrderFees> detail = orderFeesClient.detail(orderFees);
|
|
|
- if(detail==null)
|
|
|
+
|
|
|
+ OrderFees orderFees = orderFeesClient.getById(srcFeesId);
|
|
|
+ if(orderFees==null)
|
|
|
{
|
|
|
throw new SecurityException("修改原单据失败");
|
|
|
}
|
|
|
- OrderFees fees = detail.getData();
|
|
|
//回退原业务表数据
|
|
|
- if(fees.getSettlmentAmount() == null)
|
|
|
+ if(orderFees.getSettlmentAmount() == null)
|
|
|
{
|
|
|
throw new SecurityException("撤销账单失败,原业务表已收金额为空");
|
|
|
}
|
|
|
- fees.setSettlmentAmount(fees.getSettlmentAmount().subtract(items.getThisAmount()));
|
|
|
- orderFeesClient.submit(fees);
|
|
|
+ BigDecimal decimal = orderFees.getSettlmentAmount().subtract(items.getThisAmount());
|
|
|
+ if(decimal.compareTo(BigDecimal.ZERO)==-1)
|
|
|
+ {
|
|
|
+ throw new SecurityException("撤销账单失败,剩余已收金额不够本次扣款");
|
|
|
+ }
|
|
|
+ orderFees.setSettlmentAmount(decimal);
|
|
|
+ orderFeesClient.submit(orderFees);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -372,17 +374,14 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
{
|
|
|
throw new SecurityException("操作失败,未获取到原业务信息");
|
|
|
}
|
|
|
- OrderFees orderFees=new OrderFees();
|
|
|
- orderFees.setId(srcFeesId);
|
|
|
- orderFees.setTenantId(AuthUtil.getTenantId());
|
|
|
- R<OrderFees> detail = orderFeesClient.detail(orderFees);
|
|
|
- if(detail==null)
|
|
|
+
|
|
|
+ OrderFees orderFees = orderFeesClient.getById(srcFeesId);
|
|
|
+ if(orderFees==null)
|
|
|
{
|
|
|
throw new SecurityException("修改原单据失败");
|
|
|
}
|
|
|
- OrderFees fees = detail.getData();
|
|
|
- fees.setSettlmentAmount(fees.getSettlmentAmount()!=null?fees.getSettlmentAmount().add(items.getThisAmount()):new BigDecimal("0").add(items.getThisAmount()));
|
|
|
- orderFeesClient.submit(fees);
|
|
|
+ orderFees.setSettlmentAmount(orderFees.getSettlmentAmount()!=null?orderFees.getSettlmentAmount().add(items.getThisAmount()):new BigDecimal("0").add(items.getThisAmount()));
|
|
|
+ orderFeesClient.submit(orderFees);
|
|
|
}
|
|
|
else
|
|
|
{
|