|
|
@@ -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
|
|
|
{
|
|
|
@@ -676,8 +675,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
@Override
|
|
|
public void passCancel(Long settlementId)
|
|
|
{
|
|
|
- //todo 删除申请记录
|
|
|
- LambdaQueryWrapper<Settlement> settlementLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
+
|
|
|
+ LambdaQueryWrapper<Settlement> settlementLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
settlementLambdaQueryWrapper
|
|
|
.eq(Settlement::getId,settlementId)
|
|
|
.eq(Settlement::getTenantId,AuthUtil.getTenantId());
|
|
|
@@ -686,7 +685,9 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
{
|
|
|
throw new SecurityException("审批取消失败");
|
|
|
}
|
|
|
-
|
|
|
+ settlement.setCheckStatus("未请核");
|
|
|
+ baseMapper.updateById(settlement);
|
|
|
+ /*
|
|
|
LambdaQueryWrapper<Items> itemsLambdaQueryWrapper=new LambdaQueryWrapper<>();
|
|
|
itemsLambdaQueryWrapper.eq(Items::getPid,settlementId);
|
|
|
List<Items> itemsList = itemsMapper.selectList(itemsLambdaQueryWrapper);
|
|
|
@@ -698,7 +699,7 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
|
|
|
});
|
|
|
}
|
|
|
//删除财务申请主表
|
|
|
- baseMapper.deleteById(settlementId);
|
|
|
+ baseMapper.deleteById(settlementId);*/
|
|
|
}
|
|
|
|
|
|
|