|
|
|
@ -17,6 +17,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFDocument; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springblade.core.log.annotation.ApiLog; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
@ -29,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import javax.validation.constraints.NotNull; |
|
|
|
|
import javax.xml.ws.WebServiceException; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.text.ParseException; |
|
|
|
@ -156,16 +158,16 @@ public class AreaMonthReportController extends BladeController {
|
|
|
|
|
@ApiOperationSupport(order = 3) |
|
|
|
|
@ApiOperation("导出水电站月报") |
|
|
|
|
@GetMapping("/exportHydropowerStationMonthReport") |
|
|
|
|
public R exportHydropowerStationMonthReport(HttpServletResponse response, @ApiParam(value = "日期-年", required = true) Integer year,@ApiParam(value = "日期-月", required = true) Integer month, |
|
|
|
|
public void exportHydropowerStationMonthReport(HttpServletResponse response, @ApiParam(value = "日期-年", required = true) Integer year,@ApiParam(value = "日期-月", required = true) Integer month, |
|
|
|
|
@ApiParam(value = "站点Id", required = true) Long deptId,@ApiParam(value = "月报类型", required = true) Long type) throws ParseException { |
|
|
|
|
|
|
|
|
|
HashMap<String, Object> map = new HashMap<>(); |
|
|
|
|
if (Func.isEmpty(year)||Func.isEmpty(deptId)||Func.isEmpty(month)||year==0||deptId==0||month==0){ |
|
|
|
|
return R.fail("传入格式不对,请重新导出"); |
|
|
|
|
throw new ServiceException("传入格式不对,请重新导出"); |
|
|
|
|
} |
|
|
|
|
R<String> deptNameR = sysClient.getDeptName(deptId); |
|
|
|
|
if (!deptNameR.isSuccess()) { |
|
|
|
|
return R.fail("暂无该机构"); |
|
|
|
|
throw new ServiceException("暂无该机构"); |
|
|
|
|
} |
|
|
|
|
String deptName = deptNameR.getData(); |
|
|
|
|
if (type==1){ |
|
|
|
@ -191,8 +193,8 @@ public class AreaMonthReportController extends BladeController {
|
|
|
|
|
outputStream.close(); |
|
|
|
|
xwpfDocument.close(); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
log.error("统计月报数据报错:接口:/exportHydropowerStationMonthReport,错误原因"+e); |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
return R.data("导出成功"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|