package com.gkhy.safePlatform.safeCheck.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.gkhy.safePlatform.commons.co.ContextCacheUser; import com.gkhy.safePlatform.commons.enums.E; import com.gkhy.safePlatform.commons.enums.ResultCodes; import com.gkhy.safePlatform.commons.exception.AusinessException; import com.gkhy.safePlatform.commons.vo.ResultVO; import com.gkhy.safePlatform.safeCheck.model.dto.req.*; import com.gkhy.safePlatform.safeCheck.model.dto.resp.ListExcepOrderByPageRespDTO; import com.gkhy.safePlatform.safeCheck.model.dto.resp.ListUserExcepOrderByPageRespDTO; import com.gkhy.safePlatform.safeCheck.service.SafeCheckTaskMobileManagerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping(value = "/SafeCheck/abnormalWorkOrder") public class AbnormalWorkOrderController { @Autowired private SafeCheckTaskMobileManagerService safeCheckTaskMobileManagerService; /** * @description 查询巡检异常清单 */ @PostMapping("/select/listExcepOrderByPage") public ResultVO> listExcepOrderByPage(Authentication authentication, @RequestBody ListExcepOrderByPageReqDTO reqDTO){ ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); Integer pageIndex = reqDTO.getPageIndex(); Integer pageSize = reqDTO.getPageSize(); if (pageIndex == 0 || pageSize == 0){ throw new AusinessException(E.DATA_PARAM_NULL,"当前页码或当前页显示数不能为0"); } Page pageInfo = new Page(pageIndex, pageSize); IPage iPage = safeCheckTaskMobileManagerService.listExcepOrderByPage(currentUser,pageInfo); return new ResultVO<>(ResultCodes.OK,iPage); } /** * @description 根据工单id查询现场照片 */ @PostMapping("/select/listImagesById") public ResultVO listImagesById(@RequestBody ListImagesByIdReqDTO reqDTO){ Long id = reqDTO.getId(); ListImagesByIdRespDTO images = safeCheckTaskMobileManagerService.listImagesById(id); return new ResultVO<>(ResultCodes.OK,images); } /** * @description 将状态改为标记误报 */ @PostMapping("/update/falseAlarmStatusById") public ResultVO updateFalseAlarmStatusById(Authentication authentication, @RequestBody FalseAlarmStatusByIdReqDTO reqDTO){ ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); safeCheckTaskMobileManagerService.updateFalseAlarmStatusById(currentUser,reqDTO); ResultVO resultVO = new ResultVO<>("200","状态变更成功"); return resultVO; } /** * @description 将状态改为已验收 */ @PostMapping("/update/acceptedStatusById") public ResultVO updateAcceptedStatusById(Authentication authentication, @RequestBody UpdateAcceptedStatusByIdReqDTO reqDTO){ ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); safeCheckTaskMobileManagerService.updateAcceptedStatusById(currentUser,reqDTO); ResultVO resultVO = new ResultVO<>("200","状态变更成功"); return resultVO; } }