|
@@ -115,6 +115,8 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
return vos;
|
|
return vos;
|
|
}
|
|
}
|
|
vos = baseMapper.getFormList(contractId, nodeId, list);
|
|
vos = baseMapper.getFormList(contractId, nodeId, list);
|
|
|
|
+ vos = vos.stream().filter(l-> !l.getAllMeterTotal().equals(l.getChangeTotal2()) && l.getChangeTotal2().compareTo(BigDecimal.ZERO) != 0)
|
|
|
|
+ .collect(Collectors.toList());
|
|
return vos;
|
|
return vos;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -133,8 +135,10 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
vos = vos.stream().filter(l-> !l.getAllMeterTotal().equals(l.getChangeTotal()) && l.getChangeTotal().compareTo(BigDecimal.ZERO) != 0)
|
|
vos = vos.stream().filter(l-> !l.getAllMeterTotal().equals(l.getChangeTotal()) && l.getChangeTotal().compareTo(BigDecimal.ZERO) != 0)
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
for (MeterInventoryVO vo : vos) {
|
|
for (MeterInventoryVO vo : vos) {
|
|
- //默认分解清单的比例为0
|
|
|
|
- vo.setPayRatio(new BigDecimal(0));
|
|
|
|
|
|
+ //如果合同计量单元填写了比例,则默认分解清单的比例为0
|
|
|
|
+ if (vo.getUpPayRatio() != null) {
|
|
|
|
+ vo.setPayRatio(new BigDecimal(0));
|
|
|
|
+ }
|
|
//设置其他计量总数
|
|
//设置其他计量总数
|
|
vo.setOtherMeterTotal(vo.getAllMeterTotal().subtract(vo.getCurrentMeterTotal()));
|
|
vo.setOtherMeterTotal(vo.getAllMeterTotal().subtract(vo.getCurrentMeterTotal()));
|
|
vo.setOtherPayRatio(vo.getOtherMeterTotal().divide(vo.getChangeTotal(), 4, RoundingMode.DOWN).multiply(new BigDecimal(100)).setScale(2));
|
|
vo.setOtherPayRatio(vo.getOtherMeterTotal().divide(vo.getChangeTotal(), 4, RoundingMode.DOWN).multiply(new BigDecimal(100)).setScale(2));
|
|
@@ -232,20 +236,22 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
throw new ServiceException("单价和计量数量不能为空");
|
|
throw new ServiceException("单价和计量数量不能为空");
|
|
}
|
|
}
|
|
//校验比例是否在范围之内
|
|
//校验比例是否在范围之内
|
|
- if (l.getUpPayRatio() == null || l.getPayRatio() == null){
|
|
|
|
- throw new ServiceException("新增失败,支付比例不能为空");
|
|
|
|
- }
|
|
|
|
- if (apply.getIsLinkData() == 0) {
|
|
|
|
- if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(l.getUpPayRatio()) > 0) {
|
|
|
|
- throw new ServiceException("新增失败,累计支付比例大于计量单元,计量单元比例:"+l.getUpPayRatio()+",其他期计量比例:"+l.getOtherPayRatio());
|
|
|
|
|
|
+ if (l.getUpPayRatio() != null){
|
|
|
|
+ if (l.getPayRatio() == null) {
|
|
|
|
+ throw new ServiceException("新增失败,支付比例不能为空");
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
- if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(new BigDecimal(100)) > 0) {
|
|
|
|
- throw new ServiceException("新增失败,累计支付比例不能小于0大于100,其他期计量比例:"+l.getOtherPayRatio());
|
|
|
|
|
|
+ if (apply.getIsLinkData() == 0) {
|
|
|
|
+ if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(l.getUpPayRatio()) > 0) {
|
|
|
|
+ throw new ServiceException("新增失败,累计支付比例大于计量单元,计量单元比例:"+l.getUpPayRatio()+",其他期计量比例:"+l.getOtherPayRatio());
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(new BigDecimal(100)) > 0) {
|
|
|
|
+ throw new ServiceException("新增失败,累计支付比例不能小于0大于100,其他期计量比例:"+l.getOtherPayRatio());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ formApply.setPayMoney(formApply.getCurrentMeterMoney().multiply(l.getUpPayRatio().divide(new BigDecimal(100))));
|
|
|
|
+ formApply.setPayRatio(l.getPayRatio());
|
|
}
|
|
}
|
|
- formApply.setPayMoney(formApply.getCurrentMeterMoney().multiply(l.getUpPayRatio().divide(new BigDecimal(100))));
|
|
|
|
- formApply.setPayRatio(l.getPayRatio());
|
|
|
|
return formApply;
|
|
return formApply;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
for (InventoryFormApply formApply : formApplies) {
|
|
for (InventoryFormApply formApply : formApplies) {
|
|
@@ -405,20 +411,22 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
throw new ServiceException("单价和计量数量和支付比例不能为空");
|
|
throw new ServiceException("单价和计量数量和支付比例不能为空");
|
|
}
|
|
}
|
|
//校验比例是否在范围之内
|
|
//校验比例是否在范围之内
|
|
- if (l.getUpPayRatio() == null || l.getPayRatio() == null){
|
|
|
|
- throw new ServiceException("新增失败,支付比例不能为空");
|
|
|
|
- }
|
|
|
|
- if (apply.getIsLinkData() == 0) {
|
|
|
|
- if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(l.getUpPayRatio()) > 0) {
|
|
|
|
- throw new ServiceException("新增失败,累计支付比例大于计量单元,计量单元比例:"+l.getUpPayRatio()+",其他期计量比例:"+l.getOtherPayRatio());
|
|
|
|
|
|
+ if (l.getUpPayRatio() != null ){
|
|
|
|
+ if (l.getPayRatio() == null) {
|
|
|
|
+ throw new ServiceException("修改失败,支付比例不能为空");
|
|
}
|
|
}
|
|
- }else {
|
|
|
|
- if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(new BigDecimal(100)) > 0) {
|
|
|
|
- throw new ServiceException("新增失败,累计支付比例不能小于0大于100,其他期计量比例:"+l.getOtherPayRatio());
|
|
|
|
|
|
+ if (apply.getIsLinkData() == 0) {
|
|
|
|
+ if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(l.getUpPayRatio()) > 0) {
|
|
|
|
+ throw new ServiceException("修改失败,累计支付比例大于计量单元,计量单元比例:"+l.getUpPayRatio()+",其他期计量比例:"+l.getOtherPayRatio());
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(new BigDecimal(100)) > 0) {
|
|
|
|
+ throw new ServiceException("修改失败,累计支付比例不能小于0大于100,其他期计量比例:"+l.getOtherPayRatio());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ formApply.setPayMoney(formApply.getCurrentMeterMoney().multiply(l.getUpPayRatio().divide(new BigDecimal(100))));
|
|
|
|
+ formApply.setPayRatio(l.getPayRatio());
|
|
}
|
|
}
|
|
- formApply.setPayMoney(formApply.getCurrentMeterMoney().multiply(l.getUpPayRatio().divide(new BigDecimal(100))));
|
|
|
|
- formApply.setPayRatio(l.getPayRatio());
|
|
|
|
return formApply;
|
|
return formApply;
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
for (InventoryFormApply formApply : formApplies) {
|
|
for (InventoryFormApply formApply : formApplies) {
|