guoshilong
2024-03-18 3848ff83401d249c1caa5cb57658665b29afed95
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/controller/TbDykeInvestigationController.java
@@ -1,8 +1,10 @@
package cn.gistack.sm.sjztmd.controller;
import cn.gistack.sm.sjztmd.entity.TbDykeInvestigation;
import cn.gistack.sm.sjztmd.entity.TbDykeInvestigationState;
import cn.gistack.sm.sjztmd.service.IAttResBaseService;
import cn.gistack.sm.sjztmd.service.ITbDykeInvestigationService;
import cn.gistack.sm.sjztmd.service.ITbDykeInvestigationStateService;
import cn.gistack.sm.sjztmd.vo.AttResBaseGeneralInvestigationVO;
import cn.gistack.sm.sjztmd.vo.TbDykeInvestigationParam;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -38,6 +40,7 @@
public class TbDykeInvestigationController {
   private ITbDykeInvestigationService tbDykeInvestigationService;
   private ITbDykeInvestigationStateService tbDykeInvestigationStateService;
   private IAttResBaseService attResBaseService;
   @ApiOperation(value = "中台水库-分页列表查询", notes = "中台水库-分页列表查询")
@@ -70,19 +73,27 @@
   @PostMapping("/checkInfoByDykeGuid")
   public R checkInfoByResGuid(@RequestBody TbDykeInvestigation tbDykeInvestigation) {
      if (tbDykeInvestigation.getDykeGuid() == null || tbDykeInvestigation.getCheckState() == null) {
      if (tbDykeInvestigation.getTbStateId() == null || tbDykeInvestigation.getCheckState() == null) {
         return R.fail(-1,"参数不对");
      }
      //查询根据状态id查询普查记录表
      QueryWrapper queryWrapper = new QueryWrapper();
      queryWrapper.eq("\"dyke_guid\"", tbDykeInvestigation.getDykeGuid());
      queryWrapper.eq("\"tb_state_id\"", tbDykeInvestigation.getTbStateId());
      List<TbDykeInvestigation> list = tbDykeInvestigationService.list(queryWrapper);
      List<TbDykeInvestigation> editList = list.stream().map(categoryEntity -> {
            categoryEntity.setCheckState(tbDykeInvestigation.getCheckState());  // 给每个categoryEntity对象的EvaluateTaskId属性设置新值
            return categoryEntity;  // 返回修改后的对象
         })
         .collect(Collectors.toList());
      return R.status(tbDykeInvestigationService.updateBatchById(editList));
      TbDykeInvestigationState tbDykeInvestigationState = new TbDykeInvestigationState();
      tbDykeInvestigationState.setGuid(tbDykeInvestigation.getTbStateId());
      tbDykeInvestigationState.setCheckState(tbDykeInvestigation.getCheckState());
      //更新普查记录表状态和状态表状态
      return R.status(tbDykeInvestigationService.updateBatchById(editList) && tbDykeInvestigationStateService.updateById(tbDykeInvestigationState) );
   }
   @ApiOperation(value = "白蚁普查-添加或者修改", notes = "白蚁普查-添加或者修改")