Commit 9470d64f authored by jichao's avatar jichao

设备维护--设备报表--下载文件,改bug

parent 2d925f71
...@@ -45,9 +45,9 @@ public class ReportServiceImpl implements ReportService { ...@@ -45,9 +45,9 @@ public class ReportServiceImpl implements ReportService {
//如果有文件 //如果有文件
String fileName = filePath + proId + File.separator + year + File.separator + month + File.separator + day + ".xls"; String fileName = filePath + proId + File.separator + year + File.separator + month + File.separator + day + ".xls";
File file = new File(fileName); File file = new File(fileName);
if (!file.getParentFile().exists()) file.getParentFile().mkdirs();
try(OutputStream outputStream = response.getOutputStream()) { try(OutputStream outputStream = response.getOutputStream()) {
//如果不存在 file = this.createExcel(proId, year, month, day, file);
if (!file.exists()) file = this.createExcel(proId, year, month, day, file);
//转成字节 //转成字节
bytes = FileUtils.readFileToByteArray(file); bytes = FileUtils.readFileToByteArray(file);
//设置下载头 //设置下载头
......
...@@ -32,7 +32,7 @@ public class SysCityController { ...@@ -32,7 +32,7 @@ public class SysCityController {
@ApiOperation(value="查询城市", notes="查询城市") @ApiOperation(value="查询城市", notes="查询城市")
@ApiImplicitParams({@ApiImplicitParam(name = "pid", value = "城市主键", required = true, dataType = "字符串")}) @ApiImplicitParams({@ApiImplicitParam(name = "pid", value = "城市主键", required = true, dataType = "字符串")})
@RequestMapping("/city") @RequestMapping("/city/{pid:\\w+}")
public Result city(@PathVariable String pid) { public Result city(@PathVariable String pid) {
return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, sysCityServiceImpl.city(pid)); return Result.builder(new PersistModel(1), MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_ERROR, sysCityServiceImpl.city(pid));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment