guoshilong
2024-03-18 2b9cd5d7c0cf41bb1996079eb62bd4c390a27e12
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/controller/TbResGeneralInvestigationController.java
@@ -4,6 +4,8 @@
import cn.gistack.sm.sjztmd.entity.TbResGeneralInvestigation;
import cn.gistack.sm.sjztmd.service.IAttResBaseService;
import cn.gistack.sm.sjztmd.service.ITbResGeneralInvestigationService;
import cn.gistack.sm.sjztmd.vo.AttResBaseGeneralInvestigationVO;
import cn.gistack.sm.sjztmd.vo.TbResGeneralInvestigationParam;
import cn.gistack.sm.sjztmd.wrapper.AttResBaseWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -19,8 +21,11 @@
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @PROJECT_NAME: skjcmanager
@@ -39,10 +44,10 @@
   private IAttResBaseService attResBaseService;
   @ApiOperation(value = "中台水库-分页列表查询", notes = "中台水库-分页列表查询")
   @GetMapping(value = "/resList")
   public R queryPageList(AttResBase attResBase, Query query) {
      IPage<AttResBase> pageList = attResBaseService.selectAttResBasePage(Condition.getPage(query), attResBase);
      return R.data(AttResBaseWrapper.build().pageVO(pageList));
   @GetMapping(value = "/queryPageResList")
   public R queryPageResList(AttResBaseGeneralInvestigationVO attResBase, Query query) {
      Object pageList = attResBaseService.selectAttResBaseGeneralInvestigation(Condition.getPage(query), attResBase);
      return R.data(pageList);
   }
   @GetMapping("/list")
@@ -53,7 +58,34 @@
         queryWrapper.eq("\"check_state\"", param.getCheckState());
      if (!StringUtil.isBlank(param.getResName()))
         queryWrapper.like("\"res_name\"", param.getResName());
      if (!StringUtil.isBlank(param.getResGuid()))
         queryWrapper.like("\"res_guid\"", param.getResGuid());
      if (!StringUtil.isBlank(param.getCreateUser()))
         queryWrapper.like("\"create_user\"", param.getCreateUser());
      if (null != param.getTbYear())
         queryWrapper.like("\"tb_year\"", param.getTbYear());
      if (!StringUtil.isBlank(param.getTbQuarter()))
         queryWrapper.like("\"tb_quarter\"", param.getTbQuarter());
      return R.data(tbResGeneralInvestigationService.page(Condition.getPage(query), queryWrapper));
   }
   @ApiOperation(value = "白蚁普查-校核接口", notes = "白蚁普查-添加或者修改")
   @PostMapping("/checkInfoByResGuid")
   public R checkInfoByResGuid(@RequestBody TbResGeneralInvestigation tbResGeneralInvestigation) {
      if (tbResGeneralInvestigation.getResGuid() == null || tbResGeneralInvestigation.getCheckState() == null) {
         return R.fail(-1,"参数不对");
      }
      QueryWrapper queryWrapper = new QueryWrapper();
      queryWrapper.eq("\"res_guid\"", tbResGeneralInvestigation.getResGuid());
      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));
   }
   @ApiOperation(value = "白蚁普查-添加或者修改", notes = "白蚁普查-添加或者修改")
@@ -62,14 +94,31 @@
      if (tbResGeneralInvestigation.getGuid() == null) {
         tbResGeneralInvestigation.setCreateTime(new Date());
      }
      return R.status(tbResGeneralInvestigationService.saveOrUpdate(tbResGeneralInvestigation));
      return tbResGeneralInvestigationService.saveOrUpdateBy(tbResGeneralInvestigation);
   }
   @ApiOperation(value = "白蚁普查-添加或者修改", notes = "白蚁普查-添加或者修改")
   @PostMapping(value = "/submitBatch")
   public R submit(@RequestBody TbResGeneralInvestigationParam tbResGeneralInvestigationParam) {
      return tbResGeneralInvestigationService.saveOrUpdateByBatch(tbResGeneralInvestigationParam);
   }
   @PostMapping("/remove")
   @ApiOperation(value = "物理删除", notes = "传入id")
   public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String id) {
      return R.status(tbResGeneralInvestigationService.removeById(id));
   public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
//      return R.status(tbResGeneralInvestigationService.removeBatchByIds(Arrays.asList(ids.split(","))));
      return R.status(tbResGeneralInvestigationService.removeByIds(Arrays.asList(ids.split(","))));
   }
   @PostMapping("/getInvestigationListByStateId")
   @ApiOperation(value = "根据状态id获取普查集合", notes = "传入id")
   public R getInvestigationListByStateId(String stateId){
      QueryWrapper queryWrapper = new QueryWrapper();
      queryWrapper.eq("\"tb_state_id\"",stateId);
      List<TbResGeneralInvestigation> list = tbResGeneralInvestigationService.list(queryWrapper);
      return R.data(list);
   }
}