Explorar el Código

Merge branch 'dev' of http://192.168.1.43:3000/v2/zd-parents into dev

chaiyunlong hace 3 años
padre
commit
c46988a944

+ 6 - 17
zd-modules/zd-base/src/main/java/com/zd/base/files/ueditor/ConfigManager.java

@@ -2,21 +2,24 @@ package com.zd.base.files.ueditor;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import org.springframework.core.io.ClassPathResource;
 
 import java.io.*;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 public class ConfigManager {
-    private String rootPath;
     private String localPath;
     private JSONObject jsonConfig;
 
     private ConfigManager(String localPath) throws IOException {
-        this.rootPath = this.getClass().getClassLoader().getResource("ueditor").getPath();
+
+        String result = new BufferedReader(new InputStreamReader(new ClassPathResource("ueditor/config.json").getInputStream()))
+                .lines().collect(Collectors.joining(System.lineSeparator()));
+        jsonConfig = JSONObject.parseObject(result);
 
         this.localPath = localPath;
-        this.initEnv();
     }
 
     public static ConfigManager getInstance(String realPath) {
@@ -97,20 +100,6 @@ public class ConfigManager {
         return conf;
     }
 
-    private void initEnv() throws IOException {
-        String configContent = this.readFile(this.getConfigPath());
-        try {
-            JSONObject jsonConfig = JSONObject.parseObject(configContent);
-            this.jsonConfig = jsonConfig;
-        } catch (Exception e) {
-            this.jsonConfig = null;
-        }
-    }
-
-    private String getConfigPath() {
-        return this.rootPath + File.separator + "config.json";
-    }
-
     private String[] getArray(String key) {
         JSONArray jsonArray = this.jsonConfig.getJSONArray(key);
         String[] result = new String[jsonArray.size()];

+ 8 - 9
zd-modules/zd-exam/src/main/java/com/zd/exam/service/impl/ElResourcesServiceImpl.java

@@ -21,16 +21,15 @@ import org.apache.commons.collections4.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 import ws.schild.jave.EncoderException;
 import ws.schild.jave.MultimediaObject;
 import ws.schild.jave.info.MultimediaInfo;
 
-import java.net.*;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.ArrayList;
-import java.util.Base64;
 import java.util.List;
 
 /**
@@ -158,11 +157,11 @@ public class ElResourcesServiceImpl implements IElResourcesService {
             SaveUtil.setCommonAttr(elResources);
             int num = elResourcesMapper.insertElResources(elResources);
 
-            try {
+            /*try {
                 previewKkFile(elResources.getPath());
             } catch (URISyntaxException e) {
                 e.printStackTrace();
-            }
+            }*/
             if(num == 0){
                 throw new ServiceException("添加失败!");
             }
@@ -172,14 +171,14 @@ public class ElResourcesServiceImpl implements IElResourcesService {
         return elResources;
     }
 
-    @Async
+    /*@Async
     public void previewKkFile(String filePath) throws URISyntaxException {
         logger.info("****调用kkFileService开始****");
         String kkFilePath=remoteKkFileService.getKkFilePath(new URI("http://127.0.0.1:8012"), URLEncoder.encode(Base64.getEncoder().encodeToString(filePath.getBytes())));
         if(StringUtils.isNotBlank(kkFilePath) && StringUtils.isNotNull(kkFilePath)){
             logger.info("!!!!调用kkFileService成功!!!!");
         }
-    }
+    }*/
 
 
     private void saveResources(ElResources elResources, MultipartFile file){
@@ -261,9 +260,9 @@ public class ElResourcesServiceImpl implements IElResourcesService {
         try {
             elResourcesMapper.updateElResources(elResources);
             if(type == 1){
-                previewKkFile(elResources.getPath());
+//                previewKkFile(elResources.getPath());
             }
-        } catch (URISyntaxException e) {
+        } catch (Exception e) {
             e.printStackTrace();
         }
         return 1;

+ 5 - 4
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/socket/runner/TCPServer.java

@@ -8,16 +8,17 @@ import com.zd.laboratory.socket.constant.SocketTypes;
 import com.zd.laboratory.socket.service.BaseRouter;
 import com.zd.laboratory.socket.service.SocketService;
 import com.zd.laboratory.socket.vo.TransmissionVo;
-import com.zd.laboratory.utils.CRCCHECK;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
 import java.net.Socket;
 import java.net.SocketException;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicReference;
 
 /**
  * @author dgs
@@ -113,7 +114,7 @@ public class TCPServer implements Runnable {
         try {
             data = data.replace(" ", "").toUpperCase();
             cacheMap.put(data, socket.getOutputStream());
-            log.warn("化学品智能柜锁连接,采集器编号:" + data);
+            log.info("化学品智能柜锁连接,采集器编号:" + data);
         }catch (Exception e){
             log.error(e.toString());
         }