소스 검색

3.0.1-bug

xiaof 3 년 전
부모
커밋
d097628327
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/FreemarkerUtil.java

+ 3 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/FreemarkerUtil.java

@@ -92,8 +92,9 @@ public class FreemarkerUtil {
             ClassifyEnum classifyEnum = (ClassifyEnum) dataMap.get("printType");
             JSONObject jsonObject = JSONObject.parseObject(basicAttachment.getPath());
             String path = (String) jsonObject.get(SystemConstant.PATH);
-            String ftlPath = path.substring(0, path.lastIndexOf("/"));
-            String ftlName = path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf("."));
+            int last = path.lastIndexOf("/") == -1 ? path.lastIndexOf("\\") : path.lastIndexOf("/");
+            String ftlPath = path.substring(0, last);
+            String ftlName = path.substring(last + 1, path.lastIndexOf("."));
 
             Configuration configuration = new Configuration(Configuration.VERSION_2_3_29);
             File templates = null;