Browse Source

3.2.0-bug

xiaof 2 years ago
parent
commit
0f6dd1aded

+ 10 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicTemplateServiceImpl.java

@@ -101,14 +101,16 @@ public class BasicTemplateServiceImpl extends ServiceImpl<BasicTemplateMapper, B
         }
         // 修改
         else {
-            if (basicTemplate != null && basicTemplate.getId().longValue() != template.getId().longValue()) {
-                throw ExceptionResultEnum.ERROR.exception("模板名称已存在");
-            }
-            if (StringUtils.isNotBlank((basicTemplate.getPreviewPath()))) {
-                JSONObject jsonObject = JSONObject.parseObject(basicTemplate.getPreviewPath());
-                String type = jsonObject.getString(SystemConstant.TYPE);
-                if (Objects.nonNull(type) && type.equalsIgnoreCase(SystemConstant.LOCAL)) {
-                    FileUtils.forceDelete(new File(jsonObject.getString(SystemConstant.PATH)));
+            if (basicTemplate != null) {
+                if (basicTemplate.getId().longValue() != template.getId().longValue()) {
+                    throw ExceptionResultEnum.ERROR.exception("模板名称已存在");
+                }
+                if (StringUtils.isNotBlank((basicTemplate.getPreviewPath()))) {
+                    JSONObject jsonObject = JSON.parseObject(basicTemplate.getPreviewPath());
+                    String type = jsonObject.getString(SystemConstant.TYPE);
+                    if (Objects.nonNull(type) && type.equalsIgnoreCase(SystemConstant.LOCAL)) {
+                        FileUtils.forceDelete(new File(jsonObject.getString(SystemConstant.PATH)));
+                    }
                 }
             }