Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

ty130316261 лет назад: 3
Родитель
Сommit
63372e5be4

+ 27 - 0
zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/ActHxpapplyController.java

@@ -1,8 +1,10 @@
 package com.zd.chemical.controller;
 
+import java.util.Collections;
 import java.util.List;
 import java.io.IOException;
 import java.util.Map;
+import java.util.Optional;
 import javax.servlet.http.HttpServletResponse;
 
 import com.zd.chemical.domain.vo.*;
@@ -113,6 +115,31 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
     public void export(HttpServletResponse response, ActHxpapplySearch actHxpapplySearch) throws IOException
     {
         List<ActHxpapplyListVo> list = actHxpapplyService.selectActHxpapplyList(actHxpapplySearch);
+        Optional.ofNullable(list).orElseGet(Collections::emptyList)
+                .stream()
+                .forEach(a->{
+                    StringBuffer currentApprover = new StringBuffer();
+                    Optional.ofNullable(a.getCurrentUserList()).orElseGet(Collections::emptyList)
+                            .stream()
+                            .forEach(b->{
+                                currentApprover.append(",");
+                                currentApprover.append(b.get("name"));
+                            });
+                    if(currentApprover.length()>0){
+                        a.setCurrentApprover(currentApprover.substring(1));
+                    }
+
+                    StringBuffer historyApprover = new StringBuffer();
+                    Optional.ofNullable(a.getHistoryUserList()).orElseGet(Collections::emptyList)
+                            .stream()
+                            .forEach(b->{
+                                historyApprover.append(",");
+                                historyApprover.append(b.get("name"));
+                            });
+                    if(historyApprover.length()>0){
+                        a.setHistoryApprover(historyApprover.substring(1));
+                    }
+                });
         ExcelUtil<ActHxpapplyListVo> util = new ExcelUtil<ActHxpapplyListVo>(ActHxpapplyListVo.class);
         util.exportExcel(response, list, "化学品申购数据");
     }

+ 11 - 1
zd-modules/zd-chemical/src/main/resources/mapper/chemical/HxpChemicalJoinCabinetMapper.xml

@@ -47,7 +47,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
             <if test="chemicalId != null "> and cjc.chemical_id= #{chemicalId}</if>
             <if test="searchValue != null ">
-             and (ct.cabinet_name like concat('%',#{searchValue},'%') or cjc.join_num like concat('%',#{searchValue},'%') or st.name like concat('%',#{searchValue},'%'))
+             and (
+             cl.chemical_name like concat('%',#{searchValue},'%') or
+             cl.another_name like concat('%',#{searchValue},'%') or
+             cl.cas_num like concat('%',#{searchValue},'%') or
+             cjc.join_num like concat('%',#{searchValue},'%') or
+             st.name like concat('%',#{searchValue},'%')
+             )
+
             </if>
             <if test="status != null ">
                 <if test="status == 0 ">
@@ -59,6 +66,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 <if test="status == 2 ">
                   and (sk.status=2 OR sk.status=3)
                 </if>
+                <if test="status == 4">
+                    and sk.status= #{status}
+                </if>
             </if>
             <if test="userId != null">
                 and cjc.user_id = #{userId}

+ 20 - 15
zd-modules/zd-netty/src/main/java/com/zd/netty/sdk/DeJuRFIDListenerService.java

@@ -17,6 +17,9 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 
+/**
+ * @author Administrator
+ */
 @Slf4j
 @Service
 public class DeJuRFIDListenerService implements IService {
@@ -31,16 +34,20 @@ public class DeJuRFIDListenerService implements IService {
         GServer server;
         if (serverMap.containsKey(ipAddress)) {
             server = serverMap.get(ipAddress);
+            boolean listen = server.isListend();
+            if (listen){
+                server.close();
+            }
         } else {
             server = new GServer();
+            serverMap.put(ipAddress,server);
         }
         if (server.open(DeJuRFIDService.PORT)) {
             subscribeServerHandler(server, hardware);
             log.info("开始监听");
         } else {
             log.info("监听失败");
-            start(hardware);
-            throw new ServiceException("监听失败,请等待设备重连。。。");
+            throw new ServiceException("监听失败,请稍后进行设备重连。。。");
         }
     }
 
@@ -56,7 +63,11 @@ public class DeJuRFIDListenerService implements IService {
         serverMap.remove(ipAddress);
     }
 
-    //订阅监听上报
+    /**
+     * 订阅监听上报
+     * @param server 服务对象
+     * @param hardware 设备对象
+     */
     private void subscribeServerHandler(GServer server, RemoteLabHardware hardware) {
         server.onGClientConnected = (client, serialNumber) -> {
             log.info(client.getName() + "---监听成功");
@@ -70,24 +81,18 @@ public class DeJuRFIDListenerService implements IService {
         };
     }
 
-    //订阅TCP断开连接上报
+    /**
+     * 订阅TCP断开连接上报
+     * @param client 客户端对象
+     * @param hardware 设备对象
+     */
     private void subscribeTcpHandler(GClient client, RemoteLabHardware hardware) {
         client.onDisconnected = s -> {
             log.info("连接" + s + "已断开");
             client.close();//释放当前连接资源
             remoteLaboratoryService.update(HardwareOperate.CLOSE,hardware.getIpAddress());
-            start(hardware);
             log.info("连接" + s + "重连中。。。");
+            start(hardware);
         };
     }
-
-    private void stop(GClient client) {
-        MsgBaseStop msg = new MsgBaseStop();
-        client.sendSynMsg(msg);
-        if (0x00 == msg.getRtCode()) {
-            log.info("Stop success");
-        } else {
-            log.info(msg.getRtMsg());
-        }
-    }
 }