|
@@ -236,20 +236,22 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
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;
|
|
|
}).collect(Collectors.toList());
|
|
|
for (InventoryFormApply formApply : formApplies) {
|
|
@@ -409,20 +411,22 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
|
|
|
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;
|
|
|
}).collect(Collectors.toList());
|
|
|
for (InventoryFormApply formApply : formApplies) {
|