lin 3 years ago
parent
commit
78959a67bd

+ 1 - 1
zoniot-common/zoniot-core-oauth2/src/main/java/com/zcxk/core/oauth2/util/UserUtil.java

@@ -71,7 +71,7 @@ public class UserUtil {
 
     public static String getUsername() {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        if (loginUser != null) {
+        if (loginUser != null && loginUser.getUsername() != null) {
             return loginUser.getUsername();
         }
         return "system";

+ 2 - 2
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/excel/download/AbstractDownloadExcelAdapter.java

@@ -1,7 +1,7 @@
 package com.zcxk.rmcp.web.excel.download;
 
 
-import com.zcxk.core.common.util.FileUtil;
+import cn.hutool.core.io.FileUtil;
 import com.zcxk.rmcp.web.excel.model.DownloadExcelData;
 import com.zcxk.rmcp.web.service.CommonService;
 import org.apache.commons.io.IOUtils;
@@ -54,7 +54,7 @@ public abstract class AbstractDownloadExcelAdapter {
         }catch (Exception e) {
             e.printStackTrace();
         } finally {
-            FileUtil.deleteFile(data.getFilePath());
+            FileUtil.del(data.getFilePath());
         }
 
     }

+ 3 - 0
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/excel/resolver/ResolverExcelTemplate.java

@@ -1,5 +1,6 @@
 package com.zcxk.rmcp.web.excel.resolver;
 
+import cn.hutool.core.io.FileUtil;
 import com.alibaba.fastjson.JSON;
 import com.zcxk.rmcp.core.entity.ImportFile;
 import com.zcxk.rmcp.web.excel.model.ExcelData;
@@ -33,6 +34,8 @@ public class ResolverExcelTemplate {
         } catch (Exception e) {
             e.printStackTrace();
             log.error("read excel error = {} {}" , e.getMessage(), JSON.toJSON(e));
+        }finally {
+            FileUtil.del(importFile.getImportFilePath());
         }
     }
 

+ 1 - 1
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/excel/resolver/service/InstallHandleExcelServiceImpl.java

@@ -98,7 +98,7 @@ public class InstallHandleExcelServiceImpl implements HandleExcelService {
         message.setMessageId(UUID.randomUUID().toString());
         message.setMessageType(9);
         if(data.getFailNum().get() > 0) {
-            message.setUrl("/import/downloadFailFile?objId="+data.getImportFile().getId());
+            message.setUrl("/zoniot-rmcp-web/import/downloadFailFile?objId="+data.getImportFile().getId());
         }
         message.setMessageTemplateId(9);
         message.setChannel(0);

+ 1 - 1
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/excel/resolver/service/InstallPlanHandleExcelService.java

@@ -112,7 +112,7 @@ public class InstallPlanHandleExcelService implements HandleExcelService {
         message.setMessageContent(JSONObject.toJSONString(variables));
         message.setMessageId(UUID.randomUUID().toString());
         message.setMessageType(9);
-        if(data.getFailNum().get() > 0) message.setUrl("/import/downloadFailFile?objId="+data.getImportFile().getId());
+        if(data.getFailNum().get() > 0) message.setUrl("/zoniot-rmcp-web/import/downloadFailFile?objId="+data.getImportFile().getId());
         message.setMessageTemplateId(9);
         message.setChannel(0);
         message.setUserId(data.getImportFile().getUserId());

+ 6 - 1
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/CommonService.java

@@ -5,6 +5,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
+import java.time.LocalDate;
 import java.util.UUID;
 
 /**
@@ -17,6 +18,10 @@ public class CommonService {
     private String filesPath;
 
     public String getExcelFilePath(String filename) {
-        return filesPath + "/" + ToolUtil.encodingExcelFilename(filename);
+        return filesPath + "/excel/"+ ToolUtil.encodingExcelFilename(filename);
+    }
+
+    private String getPath() {
+        return "/" + LocalDate.now().toString().replace("-", "/") + "/";
     }
 }

+ 1 - 1
zoniot-rmcp/zoniot-rmcp-web/src/main/java/com/zcxk/rmcp/web/service/impl/DeviceServiceImpl.java

@@ -140,7 +140,7 @@ public class DeviceServiceImpl implements DeviceService{
 
     @Override
     public void add(DeviceInputDto dto) {
-        log.info("begin DeviceServiceImpl add dto = {}", JSON.toJSON(dto));
+        log.info("begin DeviceServiceImpl add dto = {}", JSON.toJSONString(dto));
         LoginUser user = UserUtil.getCurrentUser();
 
         if (deviceMapper.findByDeviceNoUnique(null, dto.getDeviceNo()) > 0) {