Browse Source

合同计量单元,允许清单支付比例为空

qianxb 8 months ago
parent
commit
6f17c3d9f6

+ 1 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/MeterTreeController.java

@@ -650,7 +650,7 @@ public class MeterTreeController extends BladeController {
                 transactionManager.commit(status);
             }catch (Exception e){
                 transactionManager.rollback(status);
-                return R.fail("b1,b2错误:"+e.getMessage());
+                return R.fail("修改失败:"+e.getMessage());
             }
             if (b1 && b2) {
                 return R.success("操作成功");

+ 11 - 17
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/InventoryFormMeterServiceImpl.java

@@ -65,11 +65,6 @@ public class InventoryFormMeterServiceImpl extends BaseServiceImpl<InventoryForm
     @Override
     public R inventoryFormMeterService(String meterId, String formIds) {
         List<Long> longList = Func.toLongList(formIds);
-        //查询节点最大支付比例
-        MeterTreeContract meter = meterTreeContractService.getById(meterId);
-        if (meter == null){
-            throw new ServiceException("未找到当前合同计量节点");
-        }
         for(Long forid:longList){
             InventoryFormMeter inventoryFormMeter = baseMapper.selectOne(Wrappers.<InventoryFormMeter>query().lambda()
                     .eq(InventoryFormMeter::getContractMeterId, meterId)
@@ -85,7 +80,6 @@ public class InventoryFormMeterServiceImpl extends BaseServiceImpl<InventoryForm
                 data.setChangeBuildPictureTotal(BigDecimal.ZERO);
                 data.setBuildPictureMoney(BigDecimal.ZERO);
                 data.setChangeBuildPictureMoney(BigDecimal.ZERO);
-                data.setUpPayRatio(meter.getUpPayRatio());
                 baseMapper.insert(data);
             }
         }
@@ -106,20 +100,20 @@ public class InventoryFormMeterServiceImpl extends BaseServiceImpl<InventoryForm
                 throw new ServiceException("清单["+vo.getFormName()+"]已经变更或计量,请刷新页面");
             }
             //校验比例是否在范围之内
-            if (vo.getUpPayRatio() == null){
-                vo.setUpPayRatio(upPayRatio);
-            }else if (vo.getUpPayRatio().compareTo(BigDecimal.ZERO) < 0 || vo.getUpPayRatio().compareTo(new BigDecimal("100")) > 0){
-                throw new ServiceException("修改失败,请检查支付比例是否在规定范围");
-            }
-            if (vo.getCiteStatus() == 0){
-               if (upPayRatio.compareTo(vo.getUpPayRatio()) == -1){
-                   throw new ServiceException("修改失败,未引用的清单支付比例大于合同计量单元");
-               }
+            if (vo.getUpPayRatio() != null){
+                if (vo.getUpPayRatio().compareTo(BigDecimal.ZERO) < 0 || vo.getUpPayRatio().compareTo(new BigDecimal("100")) > 0) {
+                    throw new ServiceException("请检查支付比例是否在规定范围");
+                }
+                if (vo.getCiteStatus() == 0){
+                    if (upPayRatio.compareTo(vo.getUpPayRatio()) == -1){
+                        throw new ServiceException("未引用的清单支付比例大于合同计量单元");
+                    }
+                }
             }
             //统计
             vo.setBuildPictureMoney(vo.getCurrentPrice().multiply(vo.getBuildPictureTotal()));
             vo.setChangeBuildPictureMoney(vo.getCurrentPrice().multiply(vo.getChangeBuildPictureTotal()));
-            vo.setUpPayMoney(vo.getChangeBuildPictureMoney().multiply(vo.getUpPayRatio().divide(new BigDecimal(100))));
+//            vo.setUpPayMoney(vo.getChangeBuildPictureMoney().multiply(vo.getUpPayRatio().divide(new BigDecimal(100))));
             b1 = b1.add(vo.getBuildPictureMoney());
             b2 = b2.add(vo.getChangeBuildPictureMoney());
             //修改,如果是已经被引用则跳过
@@ -131,7 +125,7 @@ public class InventoryFormMeterServiceImpl extends BaseServiceImpl<InventoryForm
                        .set(InventoryFormMeter::getBuildPictureMoney,vo.getBuildPictureMoney())
                        .set(InventoryFormMeter::getChangeBuildPictureMoney,vo.getChangeBuildPictureMoney())
                        .set(InventoryFormMeter::getUpPayRatio,vo.getUpPayRatio())
-                       .set(InventoryFormMeter::getUpPayMoney,vo.getUpPayMoney())
+//                       .set(InventoryFormMeter::getUpPayMoney,vo.getUpPayMoney())
                );
             }
         }