郑永安
2023-06-19 7a6abd05683528032687c75e80e0bd2030a3e46c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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<IPage<ListExcepOrderByPageRespDTO>> 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<ListImagesByIdRespDTO> 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<String> 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<String> updateAcceptedStatusById(Authentication authentication, @RequestBody UpdateAcceptedStatusByIdReqDTO reqDTO){
        ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal();
        safeCheckTaskMobileManagerService.updateAcceptedStatusById(currentUser,reqDTO);
        ResultVO resultVO = new ResultVO<>("200","状态变更成功");
        return resultVO;
    }
}