liurunyu
2025-02-10 a2d5f396dcee51917d333e42a977a544091e5389
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package com.dy.pipIrrStatistics.special;
 
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.common.webUtil.ResultCodeMsg;
import com.dy.pipIrrGlobal.voSpecial.VoAbnormalCloseValve;
import com.dy.pipIrrGlobal.voSpecial.VoSteal;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
import java.util.Objects;
 
/**
 * @Author: liurunyu
 * @Date: 2025/2/7 13:52
 * @Description 专题统计
 */
@Slf4j
@Tag(name = "专题统计", description = "专题统计")
@RestController
@RequestMapping(path = "special")
@SuppressWarnings("unchecked")//java版本越高,对泛型约束越严,所以配置SuppressWarnings("unchecked")
public class SpecialCtrl {
 
    private SpecialSv sv;
 
    @Autowired
    private void setSv(SpecialSv sv) {
        this.sv = sv;
    }
 
 
    /**
     * 涉嫌偷水
     * @return 数据集合
     */
    @Operation(summary = "涉嫌偷水", description = "涉嫌偷水统计")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "涉嫌偷水统计(BaseResponse.content:QueryResultVo{[VoSteal{}]})",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = VoSteal.class))}
            )
    })
    @GetMapping(path = "steal")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoSteal>>> steal(@Valid QoSteal qo, BindingResult bindingResult) throws Exception {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        QueryResultVo<List<VoSteal>> res = this.sv.steal(qo);
        return BaseResponseUtils.buildSuccess(res);
    }
 
    /**
     * 异常关阀
     * @return 数据集合
     */
    @Operation(summary = "异常关阀", description = "异常关阀统计")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "异常关阀统计(BaseResponse.content:QueryResultVo{[VoSteal{}]})",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = VoAbnormalCloseValve.class))}
            )
    })
    @GetMapping(path = "abnormalCloseValve")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoAbnormalCloseValve>>> abnormalCloseValve(@Valid QoAbnormalCloseValve qo, BindingResult bindingResult) throws Exception {
        if(bindingResult != null && bindingResult.hasErrors()){
            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
        }
        QueryResultVo<List<VoAbnormalCloseValve>> res = this.sv.abnormalCloseValve(qo);
        return BaseResponseUtils.buildSuccess(res);
    }
 
 
 
}