shenyijian
2024-06-20 11cbff75d8b18ce599a05cbb4d84cec104583358
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/service/impl/TbDykeInvestigationServiceImpl.java
@@ -74,6 +74,18 @@
      entity.setTbStateId(state.getGuid());
//      return R.status(this.saveOrUpdate(entity));
      // 如果有危害,设置危害长度只留一个
      if (entity.getHazardRating().equals("有危害")) {
         QueryWrapper qw = new QueryWrapper();
         qw.eq("\"dyke_guid\"",entity.getDykeGuid());
         qw.eq("\"unit\"",entity.getUnit());
         long count = count(qw);
         if (count > 0) {
            entity.setDangerLength(0D);
         }
      }
      this.saveOrUpdate(entity);
      return R.data(entity);
   }
@@ -111,6 +123,7 @@
//      delete.eq("\"tb_state_id\"",state.getGuid());
//      boolean remove = remove(delete);
      String lengStr = "";//处理危害长度问题
      for (int i = 0; i < list.size(); i++) {
         TbDykeInvestigation tbDykeInvestigation = list.get(i);
         //id清空方便批量新增
@@ -126,6 +139,17 @@
         //设置状态表id
         tbDykeInvestigation.setTbStateId(state.getGuid());
         //处理危害长度
         if (tbDykeInvestigation.getHazardRating().equals("有危害")) {
            if (lengStr.indexOf(tbDykeInvestigation.getUnit()) > -1) {
               tbDykeInvestigation.setDangerLength(0D);
            }
         }
         lengStr = lengStr + tbDykeInvestigation.getUnit();
      }
      return R.status(saveOrUpdateBatch(list));