guoshilong
2023-12-09 e039f5e9a3063eeec2c6c51f83e08beda0d1b5ca
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
package cn.gistack.sm.sjztmd.controller;
 
import cn.gistack.sm.sjztmd.vo.StationExport;
import cn.gistack.sm.sjztmd.vo.StationParams;
import cn.gistack.sm.sjztmd.word.service.ISjztmdService;
import cn.gistack.sm.sjztmd.word.util.ExcelUtil;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
@Slf4j
@Api(tags = "站点管理导出")
@RestController
@RequestMapping("/station/excel")
@AllArgsConstructor
public class StationExcelController {
 
    private final ISjztmdService sjztmdService;
 
    /**
     * 水位站导出
     * @param response
     * @throws Exception
     */
    @GetMapping("/export/waterLevel")
    public void exportWaterLevel(HttpServletResponse response, StationParams params,String exportFunc) throws Exception {
        List< StationExport> list = sjztmdService.getWaterLevelInfo(response, params,exportFunc);
 
        String title = StringUtil.format("水位站数据({}~{})",params.getStart_tm(),params.getEnd_tm());
        String fileName ="水位站数据导出.xlsx";
        String templatePath = "excel/xlsx/stationTemplate1.xlsx";
 
        ExcelUtil.createStationExcel(response,title,fileName,list,templatePath);
    }
 
    /**
     * 雨量站导出
     * @param response
     * @throws Exception
     */
    @GetMapping("/export/rainfall")
    public void exportRainfall(HttpServletResponse response, StationParams params,String exportFunc) throws Exception {
        List< StationExport> list = sjztmdService.getRainfallInfo(response, params,exportFunc);
 
        String title = StringUtil.format("雨量站数据({}~{})",params.getStart_dt(),params.getEnd_dt());
        String fileName ="雨量站数据导出.xlsx";
        String templatePath = "excel/xlsx/stationTemplate1.xlsx";
 
        ExcelUtil.createStationExcel(response,title,fileName,list,templatePath);
    }
 
    /**
     * 视频站导出
     * @param response
     * @throws Exception
     */
    @GetMapping("/export/videoStation")
    public void exportVideoStation(HttpServletResponse response, StationParams params,String exportFunc) throws Exception {
        List< StationExport> list = sjztmdService.getVideoStationInfo(response, params,exportFunc);
 
        String title = StringUtil.format("视频站数据");
        String fileName ="视频站数据导出.xlsx";
        String templatePath = "excel/xlsx/stationTemplate2.xlsx";
 
        ExcelUtil.createStationExcel(response,title,fileName,list,templatePath);
    }
 
    /**
     * 图像站导出
     * @param response
     * @throws Exception
     */
    @GetMapping("/export/imageStation")
    public void exportImageStation(HttpServletResponse response, StationParams params,String exportFunc) throws Exception {
        List< StationExport> list = sjztmdService.getImageStation(response, params,exportFunc);
 
        String title = StringUtil.format("图像站数据({}~{})",params.getStart_dt(),params.getEnd_dt());
        String fileName ="图像站数据导出.xlsx";
        String templatePath = "excel/xlsx/stationTemplate1.xlsx";
 
        ExcelUtil.createStationExcel(response,title,fileName,list,templatePath);
    }
 
    /**
     * 渗压站导出
     * @param response
     * @throws Exception
     */
    @GetMapping("/export/osmotic")
    public void exportOsmotic(HttpServletResponse response, StationParams params,String exportFunc) throws Exception {
        List< StationExport> list = sjztmdService.getOsmotic(response, params,exportFunc);
 
        String title = StringUtil.format("渗压站数据({}~{})",params.getStart_dt(),params.getEnd_dt());
        String fileName ="渗压站数据导出.xlsx";
        String templatePath = "excel/xlsx/stationTemplate1.xlsx";
 
        ExcelUtil.createStationExcel(response,title,fileName,list,templatePath);
    }
 
}