@@ -10,6 +10,7 @@ import com.tuoheng.common.common.OperationEnum; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import springfox.documentation.spring.web.json.Json; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
@@ -68,8 +69,8 @@ public class ReportController { | |||
* @return | |||
*/ | |||
@GetMapping(value = "{reportId}/word") | |||
public void exportReportWord(@PathVariable("reportId") Integer reportId, HttpServletRequest request, HttpServletResponse response) throws Exception{ | |||
reportService.exportReportWord(reportId, request, response); | |||
public JsonResult<String> exportReportWord(@PathVariable("reportId") Integer reportId, HttpServletRequest request, HttpServletResponse response) throws Exception{ | |||
return JsonResult.success(reportService.exportReportWord(reportId, request, response)); | |||
} | |||
} |
@@ -51,5 +51,5 @@ public interface IReportService extends IBaseService<Report> { | |||
* @param reportId 报告ID | |||
* @return | |||
*/ | |||
void exportReportWord(Integer reportId, HttpServletRequest request, HttpServletResponse response) throws Exception; | |||
String exportReportWord(Integer reportId, HttpServletRequest request, HttpServletResponse response) throws Exception; | |||
} |
@@ -222,7 +222,7 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp | |||
} | |||
@Override | |||
public void exportReportWord(Integer reportId, HttpServletRequest request, HttpServletResponse response) throws Exception { | |||
public String exportReportWord(Integer reportId, HttpServletRequest request, HttpServletResponse response) throws Exception { | |||
ReportInfoVO reportInfoVO = detail(reportId); | |||
//创建word | |||
@@ -502,8 +502,11 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp | |||
wordUtils.closeDocument(); | |||
log.info("问题清单写入完成"); | |||
return "/lc/doc/"+fileName; | |||
//清空缓存 | |||
response.reset(); | |||
/*response.reset(); | |||
// 定义浏览器响应表头,并定义下载名 | |||
String urlFileName = URLEncoder.encode("汤山林场无人机巡检报告【"+ reportInfoVO.getReportNo() + "】.doc", "UTF-8"); | |||
//String urlFileName =new String(("汤山林场无人机巡检报告【"+ reportInfoVO.getReportNo() + "】.doc").getBytes(), StandardCharsets.UTF_8); | |||
@@ -529,7 +532,9 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp | |||
} | |||
inputStream.close(); | |||
out.close(); | |||
out.flush(); | |||
out.flush();*/ | |||
System.out.println("结束。。。。。。"); | |||
}catch (Exception e){ | |||
log.info("异常信息:{}",e.getMessage()); |
@@ -157,7 +157,7 @@ file: | |||
#静态资源对外暴露的访问路径 | |||
staticAccessPath: /** | |||
#静态资源实际存储路径 | |||
uploadFolder: /data/java/tuoheng_lc/uploads/ | |||
uploadFolder: /data/java/tuoheng_lc/tuoheng_lc_web/dist/lc/ | |||
# Shiro | |||
shiro: |
@@ -156,7 +156,7 @@ file: | |||
#静态资源对外暴露的访问路径 | |||
staticAccessPath: /** | |||
#静态资源实际存储路径 | |||
uploadFolder: /data/java/tuoheng_lc/uploads/ | |||
uploadFolder: /data/java/tuoheng_lc/tuoheng_lc_web/dist/lc/ | |||
# Shiro | |||
shiro: |
@@ -156,7 +156,7 @@ file: | |||
#静态资源对外暴露的访问路径 | |||
staticAccessPath: /** | |||
#静态资源实际存储路径 | |||
uploadFolder: /data/java/tuoheng_lc/uploads/ | |||
uploadFolder: /data/java/tuoheng_lc/tuoheng_lc_web/dist/lc/ | |||
# Shiro | |||
shiro: |
@@ -156,7 +156,7 @@ file: | |||
#静态资源对外暴露的访问路径 | |||
staticAccessPath: /** | |||
#静态资源实际存储路径 | |||
uploadFolder: /data/java/tuoheng_lc/uploads/ | |||
uploadFolder: /data/java/tuoheng_lc/tuoheng_lc_web/dist/lc/ | |||
# Shiro | |||
shiro: |