guoshilong
2023-09-11 b6a42ed2c7bb93651a9a026afb3ee83449ed8256
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/service/impl/TbAttResPowerStationServiceImpl.java
@@ -3,6 +3,7 @@
import cn.gistack.sm.intelligentCall.entity.Scene;
import cn.gistack.sm.sjztmd.entity.TbAttResPowerStation;
import cn.gistack.sm.sjztmd.mapper.TbAttResPowerStationMapper;
import cn.gistack.sm.sjztmd.service.ITbAttResBaseService;
import cn.gistack.sm.sjztmd.service.ITbAttResPowerStationService;
import cn.gistack.system.user.feign.IUserClient;
import com.baomidou.dynamic.datasource.annotation.DS;
@@ -33,6 +34,9 @@
   @Autowired
   private IUserClient userClient;
   @Autowired
   private ITbAttResBaseService tbAttResBaseService;
   /**
    * 查询水库填报详情信息
    * @param guid
@@ -50,14 +54,25 @@
    */
   @Override
   public boolean updateByGuid(List<TbAttResPowerStation> newList) {
      boolean edit = false;
      // 编辑标记
      if (newList.get(0).getCheckState()==4){
         edit = true;
      }
      // 查询是否存在
      List<TbAttResPowerStation> oldList = baseMapper.getDetailByResGuid(newList.get(0).getResGuid());
      // 更新日志
      setUpdateLog(oldList,newList);
      // 创建或更新数据
      boolean flag = addOrUpdate(oldList,newList);
      if (flag){
         if (!edit) {
            tbAttResBaseService.updateFinalState(newList.get(0).getResGuid(), 0);
         }
         return true;
      }
      // 返回
      return flag;
      return false;
   }
   /**
@@ -82,6 +97,7 @@
      boolean updateFlag = true;
      boolean removeFlag = true;
      if (addList.size()>0){
         //如果是中途管理员编辑新增了一个,将状态设置为和原有的状态一致
         // 批量新增
         addFlag = saveBatch(addList);
      }
@@ -107,6 +123,11 @@
    */
   @Override
   public boolean auditByGuid(List<TbAttResPowerStation> newList) {
      boolean edit = false;
      // 编辑标记
      if (newList.get(0).getCheckState()==4){
         edit = true;
      }
      // 查询是否存在
      List<TbAttResPowerStation> oldList = baseMapper.getDetailByResGuid(newList.get(0).getResGuid());
      // 更新操作日志
@@ -115,8 +136,14 @@
      setUpdateCheckLog(oldList,newList);
      // 更新数据
      boolean batch = updateBatchById(newList);
      if (batch){
         if (!edit) {
            tbAttResBaseService.updateFinalState(newList.get(0).getResGuid(), newList.get(0).getCheckState());
         }
         return true;
      }
      // 返回
      return batch;
      return false;
   }
   /**
@@ -196,10 +223,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());
            }
         }