guoshilong
2024-03-18 3848ff83401d249c1caa5cb57658665b29afed95
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/controller/TbResGeneralInvestigationController.java
@@ -2,8 +2,10 @@
import cn.gistack.sm.sjztmd.entity.AttResBase;
import cn.gistack.sm.sjztmd.entity.TbResGeneralInvestigation;
import cn.gistack.sm.sjztmd.entity.TbResGeneralInvestigationState;
import cn.gistack.sm.sjztmd.service.IAttResBaseService;
import cn.gistack.sm.sjztmd.service.ITbResGeneralInvestigationService;
import cn.gistack.sm.sjztmd.service.ITbResGeneralInvestigationStateService;
import cn.gistack.sm.sjztmd.vo.AttResBaseGeneralInvestigationVO;
import cn.gistack.sm.sjztmd.vo.TbResGeneralInvestigationParam;
import cn.gistack.sm.sjztmd.wrapper.AttResBaseWrapper;
@@ -41,6 +43,7 @@
public class TbResGeneralInvestigationController {
   private ITbResGeneralInvestigationService tbResGeneralInvestigationService;
   private ITbResGeneralInvestigationStateService tbResGeneralInvestigationStateService;
   private IAttResBaseService attResBaseService;
   @ApiOperation(value = "中台水库-分页列表查询", notes = "中台水库-分页列表查询")
@@ -73,19 +76,25 @@
   @PostMapping("/checkInfoByResGuid")
   public R checkInfoByResGuid(@RequestBody TbResGeneralInvestigation tbResGeneralInvestigation) {
      if (tbResGeneralInvestigation.getResGuid() == null || tbResGeneralInvestigation.getCheckState() == null) {
      if (tbResGeneralInvestigation.getTbStateId() == null || tbResGeneralInvestigation.getCheckState() == null) {
         return R.fail(-1,"参数不对");
      }
      //查询根据状态id查询普查记录表
      QueryWrapper queryWrapper = new QueryWrapper();
      queryWrapper.eq("\"res_guid\"", tbResGeneralInvestigation.getResGuid());
      queryWrapper.eq("\"tb_state_id\"", tbResGeneralInvestigation.getTbStateId());
      List<TbResGeneralInvestigation> list = tbResGeneralInvestigationService.list(queryWrapper);
      List<TbResGeneralInvestigation> editList = list.stream().map(categoryEntity -> {
            categoryEntity.setCheckState(tbResGeneralInvestigation.getCheckState());  // 给每个categoryEntity对象的EvaluateTaskId属性设置新值
            return categoryEntity;  // 返回修改后的对象
         })
         .collect(Collectors.toList());
      return R.status(tbResGeneralInvestigationService.updateBatchById(editList));
      TbResGeneralInvestigationState tbResGeneralInvestigationState = new TbResGeneralInvestigationState();
      tbResGeneralInvestigationState.setGuid(tbResGeneralInvestigation.getTbStateId());
      tbResGeneralInvestigationState.setCheckState(tbResGeneralInvestigation.getCheckState());
      //更新普查记录表状态和状态表状态
      return R.status(tbResGeneralInvestigationService.updateBatchById(editList) && tbResGeneralInvestigationStateService.updateById(tbResGeneralInvestigationState));
   }
   @ApiOperation(value = "白蚁普查-添加或者修改", notes = "白蚁普查-添加或者修改")