| | |
| | | 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.statisticsVO.StatisticsBar; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsParams; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie; |
| | | import cn.gistack.sm.sjztmd.vo.AttResBaseGeneralInvestigationVO; |
| | | import cn.gistack.sm.sjztmd.vo.DyketionVO; |
| | | import cn.gistack.sm.sjztmd.vo.TbDykeInvestigationParam; |
| | | import cn.gistack.sm.sjztmd.vo.TbResDykeVO; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | public class TbDykeInvestigationController { |
| | | |
| | | private ITbDykeInvestigationService tbDykeInvestigationService; |
| | | private ITbDykeInvestigationStateService tbDykeInvestigationStateService; |
| | | private IAttResBaseService attResBaseService; |
| | | |
| | | @ApiOperation(value = "中台水库-分页列表查询", notes = "中台水库-分页列表查询") |
| | | @GetMapping(value = "/queryPageResList") |
| | | public R queryPageResList(AttResBaseGeneralInvestigationVO attResBase, Query query) { |
| | | IPage<AttResBaseGeneralInvestigationVO> pageList = attResBaseService.selectAttResBaseGeneralInvestigation(Condition.getPage(query), attResBase); |
| | | Object pageList = attResBaseService.selectAttResBaseGeneralInvestigation(Condition.getPage(query), attResBase); |
| | | return R.data(pageList); |
| | | } |
| | | |
| | |
| | | @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 = "白蚁普查-添加或者修改") |
| | | @PostMapping(value = "/submit") |
| | | public R submit(@RequestBody TbDykeInvestigation tbDykeInvestigation) { |
| | | if (tbDykeInvestigation.getGuid() == null) { |
| | | tbDykeInvestigation.setCreateTime(new Date()); |
| | | } |
| | | // if (tbDykeInvestigation.getGuid() == null) { |
| | | tbDykeInvestigation.setCreateTime(new Date()); |
| | | // } |
| | | |
| | | return tbDykeInvestigationService.saveOrUpdateBy(tbDykeInvestigation); |
| | | } |
| | | |
| | |
| | | |
| | | @PostMapping("/remove") |
| | | @ApiOperation(value = "物理删除", notes = "传入id") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String id) { |
| | | return R.status(tbDykeInvestigationService.removeById(id)); |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | |
| | | // return R.status(tbDykeInvestigationService.removeBatchByIds(Arrays.asList(ids.split(",")))); |
| | | return R.status(tbDykeInvestigationService.removeByIds(Arrays.asList(ids.split(",")))); |
| | | } |
| | | |
| | | @PostMapping("/getInvestigationListByStateId") |
| | |
| | | return R.data(list); |
| | | } |
| | | |
| | | @GetMapping("/downloadZip") |
| | | @ApiOperation(value = "批量导出白蚁普查的图片视频zip文件") |
| | | public R downloadZip(Query query,String type) throws IOException { |
| | | |
| | | List<String> msg = tbDykeInvestigationService.downZip(Condition.getPage(query),type); |
| | | |
| | | return R.data(msg); |
| | | } |
| | | |
| | | @GetMapping("/downloadZipCopy") |
| | | @ApiOperation(value = "批量导出白蚁普查的图片视频zip文件") |
| | | public R downloadZipCopy(Query query, String type,TbResDykeVO tbResDykeVO) { |
| | | |
| | | List<DyketionVO> msg = tbDykeInvestigationService.downloadZipCopy(Condition.getPage(query),type,tbResDykeVO); |
| | | |
| | | return R.data(msg); |
| | | } |
| | | |
| | | @GetMapping("/statisticsPie") |
| | | public R statisticsPie(StatisticsParams statisticsParams){ |
| | | StatisticsPie statisticsPie = tbDykeInvestigationService.statisticsPie(statisticsParams); |
| | | return R.data(statisticsPie); |
| | | } |
| | | |
| | | @GetMapping("/statisticsBar") |
| | | public R statisticsBar(StatisticsParams statisticsParams){ |
| | | List<StatisticsBar> list = tbDykeInvestigationService.statisticsBar(statisticsParams); |
| | | return R.data(list); |
| | | } |
| | | |
| | | |
| | | |
| | | } |