ke
2024-05-15 ab5c1c6cbcdeb98d84bdde3c111fe871466d3a5c
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/controller/TbResGeneralInvestigationController.java
@@ -2,8 +2,14 @@
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.statisticsVO.StatisticsBar;
import cn.gistack.sm.sjztmd.statisticsVO.StatisticsParams;
import cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie;
import cn.gistack.sm.sjztmd.statisticsVO.StatisticsTable;
import cn.gistack.sm.sjztmd.vo.AttResBaseGeneralInvestigationVO;
import cn.gistack.sm.sjztmd.vo.TbResGeneralInvestigationParam;
import cn.gistack.sm.sjztmd.wrapper.AttResBaseWrapper;
@@ -41,6 +47,7 @@
public class TbResGeneralInvestigationController {
   private ITbResGeneralInvestigationService tbResGeneralInvestigationService;
   private ITbResGeneralInvestigationStateService tbResGeneralInvestigationStateService;
   private IAttResBaseService attResBaseService;
   @ApiOperation(value = "中台水库-分页列表查询", notes = "中台水库-分页列表查询")
@@ -73,27 +80,33 @@
   @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 = "白蚁普查-添加或者修改")
   @PostMapping(value = "/submit")
   public R submit(@RequestBody TbResGeneralInvestigation tbResGeneralInvestigation) {
      if (tbResGeneralInvestigation.getGuid() == null) {
         tbResGeneralInvestigation.setCreateTime(new Date());
      }
//      if (tbResGeneralInvestigation.getGuid() == null) {
      tbResGeneralInvestigation.setCreateTime(new Date());
//      }
      return tbResGeneralInvestigationService.saveOrUpdateBy(tbResGeneralInvestigation);
   }
@@ -121,4 +134,25 @@
      return R.data(list);
   }
   @GetMapping("/statisticsPie")
   public R statisticsPie(StatisticsParams statisticsParams){
      StatisticsPie statisticsPie = tbResGeneralInvestigationService.statisticsPie(statisticsParams);
      return R.data(statisticsPie);
   }
   @GetMapping("/statisticsBar")
   public R statisticsBarProvince(StatisticsParams statisticsParams){
      List<StatisticsBar> list = tbResGeneralInvestigationService.statisticsBar(statisticsParams);
      return R.data(list);
   }
   @GetMapping("/statisticsTable")
   public R statisticsTable(StatisticsParams statisticsParams){
      List<StatisticsTable> list = tbResGeneralInvestigationService.statisticsTable(statisticsParams);
      return R.data(list);
   }
}