|
@@ -18,11 +18,10 @@ import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
import thyyxxk.webserver.utils.SnowFlakeId;
|
|
|
|
|
|
import javax.naming.Context;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.*;
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -176,7 +175,59 @@ public class PublicController {
|
|
|
@GetMapping("/getOperationGuide")
|
|
|
@PassToken
|
|
|
public ResultVo<String> getOperationGuide() {
|
|
|
- return service.getOperationGuide();
|
|
|
+ String path = "D:\\a.snapshot\\download\\操作指南";
|
|
|
+ File folder = new File(path);
|
|
|
+ String[] docFiles = folder.list(new MyExtFilter("docx"));
|
|
|
+ if (docFiles == null) {
|
|
|
+ return ResultVoUtil.success("v1.1.0");
|
|
|
+ }
|
|
|
+ for (String item : docFiles) {
|
|
|
+ int start = item.indexOf("v");
|
|
|
+ int end = item.indexOf(".docx");
|
|
|
+ return ResultVoUtil.success(item.substring(start, end));
|
|
|
+ }
|
|
|
+ return ResultVoUtil.success("v1.1.0");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 线上预览 pdf
|
|
|
+ * @param response
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ @PostMapping("/getOperationGuidePdf")
|
|
|
+ @PassToken
|
|
|
+ @Deprecated
|
|
|
+ public void getOperationGuidePdf(HttpServletResponse response) throws IOException {
|
|
|
+ String path = "D:\\a.snapshot\\download\\操作指南";
|
|
|
+ File folder = new File(path);
|
|
|
+ String[] docFiles = folder.list(new MyExtFilter("pdf"));
|
|
|
+ if (docFiles != null) {
|
|
|
+ FileInputStream inputStream = new FileInputStream(path + "\\" + docFiles[0]);
|
|
|
+ byte[] data = new byte[inputStream.available()];
|
|
|
+ inputStream.read(data);
|
|
|
+ response.setContentType("application/pdf");
|
|
|
+ response.setContentLength(data.length);
|
|
|
+ OutputStream os = response.getOutputStream();
|
|
|
+ os.write(data);
|
|
|
+ //先声明的流后关掉!
|
|
|
+ os.flush();
|
|
|
+ os.close();
|
|
|
+ inputStream.close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ static class MyExtFilter implements FilenameFilter {
|
|
|
+ private final String ext;
|
|
|
+
|
|
|
+ MyExtFilter(String ext) {
|
|
|
+ this.ext = ext;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean accept(File dir, String name) {
|
|
|
+ return name.endsWith(ext);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|