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);
|
}
|
|
}
|