xieb
2024-06-19 408406dff8f428e1439dbf909bc4f5d317cdaf5b
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
package cn.gistack.sm.sjztmd.controller;
 
import cn.gistack.sm.exam.vo.ExamPlanVO;
import cn.gistack.sm.sjztmd.entity.AttAdBase;
import cn.gistack.sm.sjztmd.entity.AttResBase;
import cn.gistack.sm.sjztmd.entity.AttResStagChar;
import cn.gistack.sm.sjztmd.excel.AttResBaseUserExcel;
import cn.gistack.sm.sjztmd.service.IAttAdBaseService;
import cn.gistack.sm.sjztmd.service.IAttResBaseService;
import cn.gistack.sm.sjztmd.vo.AttAdBaseVO;
import cn.gistack.sm.sjztmd.vo.AttResBaseVO;
import cn.gistack.sm.sjztmd.vo.AttResWithRainfall;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import io.swagger.annotations.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
 
/**
 * @ClassName AttResBaseController
 * @Description TODO
 * @Author aix
 * @Date 2023/4/21 20:09
 * @Version 1.0
 */
@Slf4j
@Api(tags = "中台水库")
@RestController
@RequestMapping("/sjztmd/attRes")
@AllArgsConstructor
public class AttResBaseController extends BladeController {
 
    private final IAttResBaseService attResBaseService;
 
    @ApiOperation(value = "中台水库-分页列表查询", notes = "中台水库-分页列表查询")
    @GetMapping(value = "/list")
    public R queryPageList(AttResBase attResBase, Query query) {
//        IPage<AttResBase> pageList = attResBaseService.page(Condition.getPage(query), Condition.getQueryWrapper(attResBase));
        IPage<AttResBase> pageList = attResBaseService.selectAttResBasePage(Condition.getPage(query), attResBase);
        return R.data(pageList);
    }
 
    @ApiOperation(value = "中台水库-查询该行政区下的水库", notes = "中台水库-查询该行政区下的水库")
    @GetMapping(value = "/getListByRegion")
    public R getListByRegion(@ApiIgnore @RequestParam Map<String, Object> obj,Query query) {
        IPage<AttResBaseVO> pageList = attResBaseService.getListByRegion(Condition.getPage(query),obj);
        return R.data(pageList);
    }
 
    @ApiOperation(value = "中台水库-获取水库详情", notes = "中台水库-获取水库详情")
    @GetMapping(value = "/getDetailByCode")
    public R getDetailByCode(String code) {
        AttResBase attResBase = attResBaseService.getDetailByCode(code);
        return R.data(attResBase);
    }
 
    /**
     * 获取水库对应责任人分页数据
     * @param params 条件查询参数对象
     * @param query 分页查询参数对象
     * @return
     */
    @ApiOperation(value = "中台水库-获取水库对应责任人分页数据", notes = "中台水库-获取水库对应责任人分页数据")
    @GetMapping(value = "/getAttResBaseUserPage")
    public R getAttResBaseUserPage(@RequestParam Map<String, Object> params,Query query) {
        return R.data(attResBaseService.getAttResBaseUserPage(Condition.getPage(query),params));
    }
 
 
    /**
     * 导出责任人数据
     * @param params 条件查询参数对象
     * @return
     */
    @ApiOperation(value = "中台水库-导出责任人数据", notes = "中台水库-导出责任人数据")
    @GetMapping(value = "/exportAttResBaseUser")
    public void exportAttResBaseUser(@RequestParam Map<String, Object> params, HttpServletResponse response) {
 
        List<AttResBaseUserExcel> list = attResBaseService.exportAttResBaseUser(params);
        ExcelUtil.export(response, "水库责任人数据数据" + DateUtil.time(), "水库责任人数据表", list, AttResBaseUserExcel.class);
    }
 
 
 
    /**
     * 编辑
     *
     * @param attResBase
     * @return
     */
    @ApiOperation(value = "水库信息-编辑", notes = "水库信息-编辑")
    @PostMapping(value = "/edit")
    public R edit(@RequestBody AttResBase attResBase) {
        if (StringUtil.isBlank(attResBase.getGuid())) {
            return R.fail("参数不正确");
        }
        return R.data(attResBaseService.updateResBaseByGuid(attResBase));
    }
 
    /**
     * 根据水库编码获取行政区数据
     * @param guid
     * @return
     */
    @GetMapping(value = "/getWaterRegionInfoByResGuid")
    public R getWaterRegionInfoByResGuid(String guid) {
        return R.data(attResBaseService.getWaterRegionInfoByResGuid(guid));
    }
 
    /**
     * 更新报汛状态
     * @param ids
     * @param status
     * @return
     */
    @PostMapping(value = "/updateIsShowStatus")
    public R updateIsShowStatus(String ids,Integer status){
        return R.status(attResBaseService.updateIsShowStatus(ids,status));
    }
 
 
    /**
     * 根据预报降雨等值面图,识别出雨量范围内的水库清单
     * @param minRainfall 最小降雨量
     * @param maxRainfall 最大降雨量
     * @param dayIndex 预报的时段,0-2代表未来3天
     * @return 水库对象列表
     */
    @ApiOperation(value = "根据预报降雨等值面图,识别出雨量范围内的水库清单", notes = "根据预报降雨等值面图,识别出雨量范围内的水库清单")
    @PostMapping(value = "/getAttResByRainfall")
    public R<List<AttResWithRainfall>> getAttResByRainfall(
            @ApiParam(value = "最小降雨量") @RequestParam String minRainfall,
            @ApiParam(value = "最大降雨量") @RequestParam String maxRainfall,
            @ApiParam(value = "预报的时段,0-2代表未来3天") @RequestParam String dayIndex) {
        return R.data(attResBaseService.getAttResByRainfall(minRainfall, maxRainfall, dayIndex));
    }
 
    /**
     * 统计不同日降水量范围下的站点个数
     * @param dayIndex 预报的时段,0-2代表未来3天
     * @return 站点个数列表
     */
    @ApiOperation(value = "统计不同日降水量范围的站点个数", notes = "统计不同日降水量范围的站点个数")
    @PostMapping(value = "/getAttResNumByRainfall")
    public R<int[]> getAttResNumByRainfall(@ApiParam(value = "预报的时段,0-2代表未来3天") @RequestParam String dayIndex) {
        return R.data(attResBaseService.getAttResNumByRainfall(dayIndex));
    }
}