xieb
2023-11-28 a196fc3cf85ac2bb993a4d185ae9c3a255e9fa6a
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/service/impl/TbAttResPowerStationServiceImpl.java
@@ -66,9 +66,9 @@
      // 创建或更新数据
      boolean flag = addOrUpdate(oldList,newList);
      if (flag){
         if (!edit) {
            tbAttResBaseService.updateFinalState(newList.get(0).getResGuid(), 0);
         }
//         if (!edit) {
//            tbAttResBaseService.updateFinalState(newList.get(0).getResGuid(), 0);
//         }
         return true;
      }
      // 返回
@@ -97,12 +97,15 @@
      boolean updateFlag = true;
      boolean removeFlag = true;
      if (addList.size()>0){
         //如果是中途管理员编辑新增了一个,将状态设置为和原有的状态一致
         // 批量新增
         addFlag = saveBatch(addList);
         tbAttResBaseService.updateFinalState(addList.get(0).getResGuid(),addList.get(0).getCheckState());
      }
      if (updateList.size()>0){
         // 批量更新
         addFlag = updateBatchById(updateList);
         tbAttResBaseService.updateFinalState(updateList.get(0).getResGuid(),updateList.get(0).getCheckState());
      }
      if (removeList.size()>0){
         // 批量删除
@@ -133,8 +136,13 @@
      setUpdateLog(oldList,newList);
      // 更新审核日志
      setUpdateCheckLog(oldList,newList);
      // 取旧数据和新提交数据交集--更新
      List<TbAttResPowerStation> updateList = newList.stream().filter(vo -> oldList.stream().map(e ->
         e.getGuid()).collect(Collectors.toList()).contains(vo.getGuid())).collect(Collectors.toList());
      // 更新数据
      boolean batch = updateBatchById(newList);
      boolean batch = updateBatchById(updateList);
      if (batch){
         if (!edit) {
            tbAttResBaseService.updateFinalState(newList.get(0).getResGuid(), newList.get(0).getCheckState());
@@ -222,10 +230,8 @@
         if (newTbAttResPowerStation.getCheckState()==4){
            fillName = "编辑";
            // 找到相关的 guid 数据
            for (TbAttResPowerStation tbAttResPowerStation : oldList) {
               if (tbAttResPowerStation.getGuid().equals(newTbAttResPowerStation.getGuid())){
                  newTbAttResPowerStation.setCheckState(tbAttResPowerStation.getCheckState());
               }
            if (oldList.size()>0) {
               newTbAttResPowerStation.setCheckState(oldList.get(0).getCheckState());
            }
         }