Explorar o código

代码异味处理

linft %!s(int64=2) %!d(string=hai) anos
pai
achega
4e3185c7e2

+ 1 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabExitLineServiceImpl.java

@@ -353,7 +353,7 @@ public class LabExitLineServiceImpl implements ILabExitLineService
                     Thread.sleep(500);
                 } catch (InterruptedException e) {
                     Thread.currentThread().interrupt();
-                    //e.printStackTrace();
+                    logger.error("异常信息:", e);
                 }
             }
         }
@@ -463,7 +463,6 @@ public class LabExitLineServiceImpl implements ILabExitLineService
                     Thread.sleep(500);
                 } catch (InterruptedException e) {
                     Thread.currentThread().interrupt();
-                    //e.printStackTrace();
                 }
             }
         }

+ 2 - 5
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabExitLineVertexServiceImpl.java

@@ -228,12 +228,11 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
                         String commandStr = RelayConstants.AT_STACH + relay.getRelayBit() + "=" + RelayConstants.AT_CLOSE + RelayConstants.SPACE_WRAP;
                         NettyPushMsgService.push(relayCode, commandStr.getBytes());
                     } catch (IOException e) {
-                        //e.printStackTrace();
+                        logger.error("异常信息:", e);
                     }
                 }
             } catch (InterruptedException e) {
                 Thread.currentThread().interrupt();
-                //e.printStackTrace();
             }
         }
         // 关闭喇叭
@@ -321,7 +320,6 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
                         }
                     } catch (InterruptedException | ExecutionException e) {
                         Thread.currentThread().interrupt();
-                        //e.printStackTrace();
                     }
                 });
 
@@ -371,12 +369,11 @@ public class LabExitLineVertexServiceImpl implements ILabExitLineVertexService {
                                 String commandStr = RelayConstants.AT_STACH + a.getRelayBit() + "=" + RelayConstants.AT_OPEN + RelayConstants.SPACE_WRAP;
                                 NettyPushMsgService.push(relayCode, commandStr.getBytes());
                             } catch (IOException e) {
-                                //e.printStackTrace();
+                                logger.error("异常信息:", e);
                             }
                         }
                     } catch (InterruptedException e) {
                         Thread.currentThread().interrupt();
-                        //e.printStackTrace();
                     }
                 });
         Optional.ofNullable(labExitPointRelays).orElseGet(Collections::emptyList)

+ 6 - 4
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabExitPointRelayServiceImpl.java

@@ -15,6 +15,7 @@ import com.zd.laboratory.netty.NettyPushMsgService;
 import com.zd.laboratory.service.ILabExitPointRelayService;
 import com.zd.laboratory.socket.command.Symbol;
 import com.zd.laboratory.socket.service.SocketService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -28,6 +29,7 @@ import java.util.concurrent.TimeUnit;
  * @author cyl
  * @date 2022/11/11
  */
+@Slf4j
 @Service
 public class LabExitPointRelayServiceImpl implements ILabExitPointRelayService {
 
@@ -99,7 +101,7 @@ public class LabExitPointRelayServiceImpl implements ILabExitPointRelayService {
                         String commandStr = RelayConstants.AT_STACH + relay.getRelayBit() + "=" + RelayConstants.AT_OPEN + RelayConstants.SPACE_WRAP;
                         NettyPushMsgService.push(relayCode, commandStr.getBytes());
                     } catch (IOException e) {
-                        //e.printStackTrace();
+
                     }
                 }
                 boolean flag = true;
@@ -120,7 +122,7 @@ public class LabExitPointRelayServiceImpl implements ILabExitPointRelayService {
                     lightPointSet.add(lineJoinPointVO);
                 }
             } catch (InterruptedException e) {
-                //e.printStackTrace();
+                log.error("异常信息:", e);
             }
         }
         relayListMap.put("lightPointSet",lightPointSet);
@@ -162,7 +164,7 @@ public class LabExitPointRelayServiceImpl implements ILabExitPointRelayService {
                         String commandStr = RelayConstants.AT_STACH + relay.getRelayBit() + "=" + RelayConstants.AT_CLOSE + RelayConstants.SPACE_WRAP;
                         NettyPushMsgService.push(relayCode, commandStr.getBytes());
                     } catch (IOException e) {
-                        //e.printStackTrace();
+                        log.error("异常信息:", e);
                     }
                 }
                 if(lightPointSet!=null && lightPointSet.size()>0){
@@ -174,7 +176,7 @@ public class LabExitPointRelayServiceImpl implements ILabExitPointRelayService {
                 }
 
             } catch (InterruptedException e) {
-                //e.printStackTrace();
+                log.error("异常信息:", e);
             }
         }
         relayListMap.put("lightPointSet",newLightPointSet);

+ 0 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabNotifyplanServiceImpl.java

@@ -92,10 +92,8 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
                     intstream.close();
                 }
             } catch (IOException e) {
-                //e.printStackTrace();
                 throw new ServiceException("文件解析异常!");
             }catch (Exception e) {
-                //e.printStackTrace();
                 throw new ServiceException("文件解析异常!");
             }
         }
@@ -332,7 +330,6 @@ public class LabNotifyplanServiceImpl implements ILabNotifyplanService
                     }
             }
         } catch (IOException e) {
-            //e.printStackTrace();
             if(intstream!=null){
                 try {
                     intstream.close();

+ 0 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabSecurityApplyServiceImpl.java

@@ -448,7 +448,6 @@ public class LabSecurityApplyServiceImpl implements ILabSecurityApplyService
             }
             bos.close();
         }catch(Exception e){
-            //e.printStackTrace();
             log.error("批量下载异常", e);
         }finally {
             try {
@@ -456,7 +455,6 @@ public class LabSecurityApplyServiceImpl implements ILabSecurityApplyService
                 bis.close();
                 bos.close();
             } catch (IOException e) {
-                //e.printStackTrace();
                 log.error("批量下载关闭流异常", e);
             }
         }

+ 0 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/WordService.java

@@ -340,7 +340,6 @@ public class WordService {
 
             WordUtils.getWord3(word3, list, descs, response);
         } catch (IOException e) {
-            //e.printStackTrace();
             throw new ServiceException(e.getMessage());
         }
     }

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/socket/service/SocketService.java

@@ -146,7 +146,7 @@ public class SocketService {
                 }
             }
         }catch (Exception e){
-
+            log.error("异常信息:",e);
         }
         return null;
     }

+ 0 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/socket/service/impl/MutexResult.java

@@ -26,8 +26,6 @@ public class MutexResult implements BaseRouter {
         //指令1字节
         String command = tracketPacket.body.substring(0, 2);
         if ("00".equals(command) || "01".equals(command)) {// 互斥配置指令返回
-//            互斥条序号,1字节,(0-11,12代表保存的所有互斥关系)
-            String position = tracketPacket.body.substring(4, 6);
             //配置互斥反馈的标志,1字节,(0-操作成功,1-操作失败)
             String result = tracketPacket.body.substring(6, 8);
             log.info(tracketPacket.deviceNumber + "互斥配置指令结果:" + result);