hecheng 3 anni fa
parent
commit
e65404a38d

+ 2 - 1
zd-api/zd-api-system/src/main/java/com/zd/system/api/chemical/RemoteStockService.java

@@ -1,6 +1,7 @@
 package com.zd.system.api.chemical;
 
 import com.zd.common.core.constant.ServiceNameConstants;
+import com.zd.common.core.domain.R;
 import com.zd.system.api.chemical.factory.RemoteStockFallbackFactory;
 import com.zd.system.api.domain.InventoryTag;
 import org.springframework.cloud.openfeign.FeignClient;
@@ -16,7 +17,7 @@ public interface RemoteStockService {
 
 
     @PostMapping(value = "/hxpStock/RFIDCheck")
-    public boolean rfidCheck(@RequestBody InventoryTag tag);
+    public R<Boolean> rfidCheck(@RequestBody InventoryTag tag);
 
     @GetMapping(value = "/hxpStock/expireCheck")
     public void expireCheck();

+ 6 - 2
zd-api/zd-api-system/src/main/java/com/zd/system/api/chemical/factory/RemoteStockFallbackFactory.java

@@ -1,6 +1,7 @@
 package com.zd.system.api.chemical.factory;
 
 
+import com.zd.common.core.domain.R;
 import com.zd.system.api.chemical.RemoteStockService;
 import com.zd.system.api.domain.InventoryTag;
 import org.slf4j.Logger;
@@ -8,6 +9,9 @@ import org.slf4j.LoggerFactory;
 import org.springframework.cloud.openfeign.FallbackFactory;
 import org.springframework.stereotype.Component;
 
+/**
+ * @author Administrator
+ */
 @Component
 public class RemoteStockFallbackFactory implements FallbackFactory<RemoteStockService> {
     private static final Logger logger = LoggerFactory.getLogger(RemoteStockFallbackFactory.class);
@@ -17,9 +21,9 @@ public class RemoteStockFallbackFactory implements FallbackFactory<RemoteStockSe
         logger.error("化学品服务调用失败:{}", throwable.getMessage());
         return new RemoteStockService() {
             @Override
-            public boolean rfidCheck(InventoryTag tag) {
+            public R<Boolean> rfidCheck(InventoryTag tag) {
                 logger.error("保存调用失败:{}" ,throwable.getMessage());
-                return false;
+                return R.fail("保存调用失败:" + throwable.getMessage());
             }
 
             @Override

+ 69 - 61
zd-auth/src/main/java/com/zd/auth/controller/TokenController.java

@@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -55,75 +56,82 @@ public class TokenController {
     @PostMapping("login")
     public R<?> login(@RequestBody LoginBody form) {
         // 用户登录
-        LoginUser userInfo = sysLoginService.login(form.getUsername(), UserConstants.USER_LOGIN_PC, form.getPassword());
+        String authType = form.getAuthType() == null ? Constants.GRANT_TYPE_PASSWORD : form.getAuthType();
+        LoginUser userInfo;
+        if (Objects.equals(authType, Constants.GRANT_TYPE_MOBILE)) {
+            //TODO 验证码校验过程,用户信息查询
+            userInfo = sysLoginService.login(form.getUsername(), UserConstants.USER_LOGIN_PC, form.getPassword());
+        }else {
+            userInfo = sysLoginService.login(form.getUsername(), UserConstants.USER_LOGIN_PC, form.getPassword());
+        }
         userInfo.setLoginType(UserConstants.USER_LOGIN_PC);
         Map<String, Object> data = tokenService.createToken(userInfo);
         //这里判断输入的密码,是否和默认配置密码一样,如果一样,需要提示跳转设置密码
         AjaxResult resultPassword = remoteUserService.getConfigKey("sys.user.initPassword");
-        if((resultPassword.get("code")+"").equals("200")){
+        if ((resultPassword.get("code") + "").equals("200")) {
             String defaultPassword = (String) resultPassword.get("msg");
-            if(defaultPassword!=null && defaultPassword.equals(form.getPassword())){
+            if (defaultPassword != null && defaultPassword.equals(form.getPassword())) {
                 data.put("reset_password", true);
-            }else{
+            } else {
                 data.put("reset_password", false);
             }
         }
         // 区分大屏用户
-            // 查询大屏链接
-            AjaxResult result = remoteUserService.getRouters(userInfo.getUserid());
-
-            try {
-                List<Map<String, Object>> routers = (List<Map<String, Object>>)result.get("data");
-
-                Map<String,Object> dataMenu = routers.stream().filter(
-                        a -> "https://www.sxitdlc.com".equals(a.get("path")+"")).findFirst().orElse(null);
-                if(dataMenu != null){
-                    String tokenKey = "login_screen:";
-
-                    Integer type;
-                    if(userInfo.getSysUser().isAdmin()){
-                        type = 1;
-                    }else {
-                        result = remoteUserService.selectAuthUserPower(userInfo.getUserid());
-                        Map<String, Object> map = (Map<String, Object>) result.get("data");
-                        type = Integer.parseInt(map.get("type") + "");
-                    }
-
-                    if(type == null){
-                        // 没有大屏权限
-                        type = 3;
-                        data.put("screen_token", "");
-                    }else if(redisService.hasKey(tokenKey + userInfo.getUserid())){
-                        String token=redisService.getCacheObject(tokenKey + userInfo.getUserid());
-                        commLogin(userInfo,token);
-                        data.put("screen_token", token);
-                    }else {
-                        String token = IdUtils.fastUUID();
-                        commLogin(userInfo,token);
-                        redisService.setCacheObject(tokenKey + userInfo.getUserid(), token);
-                        // 获取大屏TOKEN
-                        data.put("screen_token", token);
-                    }
+        // 查询大屏链接
+        AjaxResult result = remoteUserService.getRouters(userInfo.getUserid());
+
+        try {
+            List<Map<String, Object>> routers = (List<Map<String, Object>>) result.get("data");
+
+            Map<String, Object> dataMenu = routers.stream().filter(
+                    a -> "https://www.sxitdlc.com".equals(a.get("path") + "")).findFirst().orElse(null);
+            if (dataMenu != null) {
+                String tokenKey = "login_screen:";
+
+                Integer type;
+                if (userInfo.getSysUser().isAdmin()) {
+                    type = 1;
+                } else {
+                    result = remoteUserService.selectAuthUserPower(userInfo.getUserid());
+                    Map<String, Object> map = (Map<String, Object>) result.get("data");
+                    type = Integer.parseInt(map.get("type") + "");
+                }
 
-                    data.put("screen_type", type);
-                }else {
+                if (type == null) {
                     // 没有大屏权限
-                    data.put("screen_type", 3);
+                    type = 3;
                     data.put("screen_token", "");
+                } else if (redisService.hasKey(tokenKey + userInfo.getUserid())) {
+                    String token = redisService.getCacheObject(tokenKey + userInfo.getUserid());
+                    commLogin(userInfo, token);
+                    data.put("screen_token", token);
+                } else {
+                    String token = IdUtils.fastUUID();
+                    commLogin(userInfo, token);
+                    redisService.setCacheObject(tokenKey + userInfo.getUserid(), token);
+                    // 获取大屏TOKEN
+                    data.put("screen_token", token);
                 }
-            }catch (Exception e){
+
+                data.put("screen_type", type);
+            } else {
                 // 没有大屏权限
                 data.put("screen_type", 3);
                 data.put("screen_token", "");
             }
+        } catch (Exception e) {
+            // 没有大屏权限
+            data.put("screen_type", 3);
+            data.put("screen_token", "");
+        }
         // 获取登录token
         return R.ok(data);
     }
 
     //公共登录方法
-    private void commLogin(LoginUser userInfo,String token){
+    private void commLogin(LoginUser userInfo, String token) {
         LoginUser loginUser = new LoginUser();
-        BeanUtils.copyProperties(userInfo,loginUser);
+        BeanUtils.copyProperties(userInfo, loginUser);
         loginUser.setToken(token);
 
         redisService.setCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token, loginUser);
@@ -149,16 +157,16 @@ public class TokenController {
      */
     @PostMapping("/learn/login")
     public R<?> learnLogin(HttpServletRequest request, @RequestBody Map<String, Object> params) {
-        int type = org.apache.commons.lang3.StringUtils.isNotBlank((String)params.get("type")) ? Integer.parseInt((String)params.get("type")) : 1;
+        int type = org.apache.commons.lang3.StringUtils.isNotBlank((String) params.get("type")) ? Integer.parseInt((String) params.get("type")) : 1;
 
         String machineCode = params.get("machineCode") == null ? "" : (String) params.get("machineCode");
         // 用户登录
         String username = (String) params.get("userName");
 
-        int aioType = params.get("aioType") == null ?UserConstants.USER_LOGIN_AIO : Integer.parseInt(params.get("aioType")+"");
+        int aioType = params.get("aioType") == null ? UserConstants.USER_LOGIN_AIO : Integer.parseInt(params.get("aioType") + "");
 
         logger.error("学习机登录,加密前:" + username + ",设备编码:" + machineCode);
-        if(UserConstants.USER_LOGIN_HXP == aioType){
+        if (UserConstants.USER_LOGIN_HXP == aioType) {
             // TODO 终端传参数据有问题,暂临时后端处理
 //            username = username.replaceAll("%00", "")
 //                    .replaceAll("%02", "")
@@ -166,12 +174,12 @@ public class TokenController {
 //                    .replaceAll("%0A", "")
 //                    .replaceAll("%0D", "")
 //                    .trim();
-        }else {
+        } else {
             // 查询用户信息
-            if(StringUtils.isNumeric(username)) {
+            if (StringUtils.isNumeric(username)) {
                 username = Long.toHexString(Long.parseLong(username)).toUpperCase();
                 logger.error("学习机登录,加密后:" + username);
-            }else {
+            } else {
                 logger.error("通过卡号未找到用户");
                 return R.fail("无效卡号或未绑定用户,请联系管理员!");
             }
@@ -203,10 +211,10 @@ public class TokenController {
             }
 
             Map<String, Object> map = null;
-            if(type == 1){
+            if (type == 1) {
                 // 获取登录token
                 map = tokenService.createToken(userInfo);
-            }else if(type == 2){
+            } else if (type == 2) {
                 // 资源删除
                 LoginUser loginUser = tokenService.getLoginUser(request);
                 if (StringUtils.isNotNull(loginUser)) {
@@ -216,24 +224,24 @@ public class TokenController {
 
                 map = tokenService.createToken(userInfo);
 
-                if(UserConstants.USER_LOGIN_HXP == aioType){
+                if (UserConstants.USER_LOGIN_HXP == aioType) {
                     map.put("positionName", userInfo.getSysUser().getPositionName());
                     map.put("cabinetLock", userInfo.isCabinetLock());
                     map.put("airBottle", userInfo.isAirBottle());
-                }else if(UserConstants.USER_LOGIN_AIO == aioType){
-                    if(redisService.hasKey(CacheConstants.LEARN_USER_KEY+userInfo.getSysUser().getUserId())){
-                        LoginUser userCache = redisService.getCacheObject(CacheConstants.LEARN_USER_KEY+userInfo.getSysUser().getUserId());
-                        if(!machineCode.equals(userCache.getMachineCode())){
+                } else if (UserConstants.USER_LOGIN_AIO == aioType) {
+                    if (redisService.hasKey(CacheConstants.LEARN_USER_KEY + userInfo.getSysUser().getUserId())) {
+                        LoginUser userCache = redisService.getCacheObject(CacheConstants.LEARN_USER_KEY + userInfo.getSysUser().getUserId());
+                        if (!machineCode.equals(userCache.getMachineCode())) {
                             return R.fail("签到失败,不能重复签到!");
                         }
                     }
                     // 记录学习一体机用户登录状态
-                    redisService.setCacheObject(CacheConstants.LEARN_USER_KEY+userInfo.getSysUser().getUserId(), userInfo, Constants.TOKEN_EXPIRE * 60, TimeUnit.SECONDS);
+                    redisService.setCacheObject(CacheConstants.LEARN_USER_KEY + userInfo.getSysUser().getUserId(), userInfo, Constants.TOKEN_EXPIRE * 60, TimeUnit.SECONDS);
                 }
             }
 
             return R.ok(map);
-        }else {
+        } else {
             return R.fail("登录用户不存在!");
         }
 
@@ -253,7 +261,7 @@ public class TokenController {
             // 记录用户退出日志
             sysLoginService.logout(user);
             // 删除一体机登录状态
-            redisService.deleteObject(CacheConstants.LEARN_USER_KEY+loginUser.getUserid());
+            redisService.deleteObject(CacheConstants.LEARN_USER_KEY + loginUser.getUserid());
         }
         return R.ok();
     }

+ 14 - 0
zd-auth/src/main/java/com/zd/auth/form/LoginBody.java

@@ -21,6 +21,12 @@ public class LoginBody {
      */
     private String userType;
 
+    /**
+     * 登录类型 password,mobile
+     */
+    private String authType;
+
+
     public String getUsername() {
         return username;
     }
@@ -44,4 +50,12 @@ public class LoginBody {
     public void setUserType(String userType) {
         this.userType = userType;
     }
+
+    public String getAuthType() {
+        return authType;
+    }
+
+    public void setAuthType(String authType) {
+        this.authType = authType;
+    }
 }

+ 11 - 0
zd-common/zd-common-core/src/main/java/com/zd/common/core/constant/Constants.java

@@ -157,5 +157,16 @@ public class Constants {
     public static final Integer MAP_INIT_SIZE = 16;
 
 
+    /**
+     * 密码类型
+     */
+    public static final String GRANT_TYPE_PASSWORD = "password";
+
+    /**
+     * 手机号类型
+     */
+    public static final String GRANT_TYPE_MOBILE = "mobile";
+
+
 
 }

+ 3 - 2
zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpStockController.java

@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import com.github.pagehelper.PageHelper;
 import com.zd.chemical.domain.vo.*;
+import com.zd.common.core.domain.R;
 import com.zd.common.core.domain.per.PerFun;
 import com.zd.common.core.domain.per.PerPrefix;
 import com.zd.common.core.utils.SecurityUtils;
@@ -208,8 +209,8 @@ public class HxpStockController extends BaseController {
 
     @ApiOperation(value = "RFID违规检测")
     @PostMapping(value = "/RFIDCheck")
-    public boolean RFIDCheck(@RequestBody InventoryTag tag) {
-        return hxpStockService.RFIDCheck(tag);
+    public R<Boolean> RFIDCheck(@RequestBody InventoryTag tag) {
+        return R.ok(hxpStockService.RFIDCheck(tag));
     }
 
     /**

+ 4 - 1
zd-modules/zd-netty/src/main/java/com/zd/netty/base/FridConsumer.java

@@ -9,6 +9,9 @@ import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+/**
+ * @author Administrator
+ */
 @Slf4j
 @Component
 public class FridConsumer implements Consumer<InventoryTag> {
@@ -22,7 +25,7 @@ public class FridConsumer implements Consumer<InventoryTag> {
             tag.setEpc(tag.getEpc().replace(" ", ""));
             com.zd.system.api.domain.InventoryTag  inventoryTag = new com.zd.system.api.domain.InventoryTag ();
             BeanUtils.copyProperties(tag,inventoryTag);
-            sendService.send(inventoryTag, null);
+            sendService.send(inventoryTag);
         } catch (BeansException e) {
             log.error(e.getMessage());
         }

+ 20 - 22
zd-modules/zd-netty/src/main/java/com/zd/netty/sdk/DeJuRFIDServerImpl.java

@@ -13,12 +13,10 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
-import java.io.File;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
 /**
@@ -32,7 +30,7 @@ public class DeJuRFIDServerImpl implements IService {
 
     private static final Map<String, GClient> CLIENT_MAP = new ConcurrentHashMap<>();
 
-    static AtomicBoolean isAlarm = new AtomicBoolean();
+    private static final Map<String, Boolean> ALARM_MAP = new ConcurrentHashMap<>();
     static AtomicInteger stopCount = new AtomicInteger();
 
     public static final Integer PORT = 8160;
@@ -200,19 +198,15 @@ public class DeJuRFIDServerImpl implements IService {
         String ipAddress = hardware.getIpAddress();
         if (CLIENT_MAP.containsKey(ipAddress)) {
             GClient client = CLIENT_MAP.get(ipAddress);
-            log.info("报警状态:==============》{},设备IP:{}", isAlarm.get(),ipAddress);
-            if (!isAlarm.get()) {
-                isAlarm.set(true);
-                changeGpo(1, client, 10);
-            }
+            alarm(hardware,client);
         }
     }
 
-    public static void alarm(GClient client){
-        log.info("报警状态:==============》{},设备:{} 触发报警", isAlarm.get(),client.getName());
-        if (!isAlarm.get()) {
-            isAlarm.set(true);
-            changeGpo(1, client, 10);
+    public static void alarm(RemoteLabHardware hardware, GClient client) {
+        String ipAddress = hardware.getIpAddress();
+        if (!ALARM_MAP.containsKey(ipAddress)) {
+            log.info("报警状态:==============》{},设备IP:{}", false, ipAddress);
+            changeGpo(ipAddress,1, client, 10);
         }
     }
 
@@ -220,7 +214,7 @@ public class DeJuRFIDServerImpl implements IService {
         String ipAddress = hardware.getIpAddress();
         if (CLIENT_MAP.containsKey(ipAddress)) {
             GClient client = CLIENT_MAP.get(ipAddress);
-            changeGpo(0, client, 0);
+            changeGpo(ipAddress, 0, client, 0);
             stopMsg(client);
             client.close();
             CLIENT_MAP.remove(ipAddress);
@@ -235,7 +229,7 @@ public class DeJuRFIDServerImpl implements IService {
         log.info("客户端停止读卡{}", result);
     }
 
-    private static void changeGpo(int state, GClient client, int delayTime) {
+    private static void changeGpo(String ipAddress, int state, GClient client, int delayTime) {
         MsgAppSetGpo msgAppSetGpo = new MsgAppSetGpo();
         msgAppSetGpo.setGpo1(state);
         msgAppSetGpo.setGpo2(state);
@@ -246,23 +240,24 @@ public class DeJuRFIDServerImpl implements IService {
         if (0 == msgAppSetGpo.getRtCode()) {
             log.info("============》灯带{}成功.", status);
             if (state == 1) {
-                stopGpo(client, delayTime);
-            } else {
-                isAlarm.set(false);
+                ALARM_MAP.put(ipAddress,true);
+                stopGpo(ipAddress,client, delayTime);
+            }else {
+                ALARM_MAP.remove(ipAddress);
             }
         } else {
             log.error("Gpo epc {} error.", status);
             if (stopCount.getAndIncrement() < MAX_RETRY) {
-                stopGpo(client, delayTime);
+                stopGpo(ipAddress,client, delayTime);
             }
         }
     }
 
-    public static void stopGpo(GClient client, int delayTime) {
+    public static void stopGpo(String ipAddress,GClient client, int delayTime) {
         scheduledExecutorService.schedule(new TimerTask() {
             @Override
             public void run() {
-                changeGpo(0, client, 0);
+                changeGpo(ipAddress, 0, client, 0);
             }
         }, delayTime, TimeUnit.SECONDS);
     }
@@ -282,7 +277,10 @@ public class DeJuRFIDServerImpl implements IService {
                 InventoryTag tag = new InventoryTag();
                 BeanUtils.copyProperties(logBaseEpcInfo, tag);
                 tag.setRemoteLabHardware(hardware);
-                sendService.send(tag,client);
+                boolean send = sendService.send(tag);
+                if (send){
+                    alarm(hardware,client);
+                }
             }
         };
         client.onTagEpcOver = (s, logBaseEpcOver) -> log.info("HandlerTagEpcOver");

+ 5 - 3
zd-modules/zd-netty/src/main/java/com/zd/netty/service/ISendService.java

@@ -1,17 +1,19 @@
 package com.zd.netty.service;
 
-import com.gg.reader.api.dal.GClient;
 import com.zd.system.api.domain.InventoryTag;
 
+/**
+ * @author Administrator
+ */
 public interface ISendService {
 
     /**
      * 发送读取到的编码
      *
      * @param tag    frid数据
-     * @param client
+     * @return boolean
      */
-    void send(InventoryTag tag, GClient client);
+    boolean send(InventoryTag tag);
 
     /**
      * 发送异常信息

+ 39 - 32
zd-modules/zd-netty/src/main/java/com/zd/netty/service/impl/SendServiceImpl.java

@@ -4,7 +4,6 @@ import com.gg.reader.api.dal.GClient;
 import com.zd.bottle.feign.service.RemoteBottleService;
 import com.zd.common.core.constant.HttpStatus;
 import com.zd.common.core.domain.R;
-import com.zd.netty.sdk.DeJuRFIDServerImpl;
 import com.zd.netty.service.ISendService;
 import com.zd.system.api.airbottle.RemoteAirBottleService;
 import com.zd.system.api.chemical.RemoteStockService;
@@ -35,21 +34,20 @@ public class SendServiceImpl implements ISendService {
 
 
     @Override
-    public void send(InventoryTag tag, GClient client) {
+    public boolean send(InventoryTag tag) {
 
         RemoteLabHardware hardware = tag.getRemoteLabHardware();
         if (hardware != null) {
             int antId = tag.getAntId();
             String uniformPower = hardware.getUniformPower();
             String[] uniformPowers = uniformPower.split(",");
-            handleTag(tag, antId, uniformPowers, client);
+            return handleTag(tag, antId, uniformPowers);
         } else {
-            sendBottle(tag, client);
-            sendStock(tag,client);
+            return sendTag(tag,null);
         }
     }
 
-    private void handleTag(InventoryTag tag, int antId, String[] uniformPowers, GClient client) {
+    private boolean handleTag(InventoryTag tag, int antId, String[] uniformPowers) {
         // 判断有设备配置和触发的天线编码等与配置天线编号
         if (uniformPowers.length > 0) {
             String tempUniformPower = uniformPowers[antId - 1];
@@ -57,61 +55,70 @@ public class SendServiceImpl implements ISendService {
                 String[] tempUniformPowers = tempUniformPower.split(":");
                 if (tempUniformPowers.length > 1) {
                     String temp = tempUniformPowers[1];
-                    sendTag(tag, temp, client);
-                }else {
-                    sendTag(tag, null, client);
+                    return sendTag(tag, temp);
+                } else {
+                    return sendTag(tag, null);
                 }
             }
         }
+        return false;
     }
 
-    private void sendTag(InventoryTag tag, String temp, GClient client) {
-        if (temp==null){
-            sendBottle(tag, client);
-            sendStock(tag, client);
-            return;
+    private boolean sendTag(InventoryTag tag, String temp) {
+        if (temp == null) {
+            boolean b = sendBottle(tag);
+            if (b){
+                return true;
+            }
+            return sendStock(tag);
+        }
+        if (ALL_TYPE.equals(temp)) {
+            boolean b = sendBottle(tag);
+            if (b){
+                return true;
+            }
+            return sendStock(tag);
         }
-        if (ALL_TYPE.equals(temp) || BOTTLE_TYPE.equals(temp)) {
-            sendBottle(tag, client);
+        if (BOTTLE_TYPE.equals(temp)) {
+            return sendBottle(tag);
         }
-        if (ALL_TYPE.equals(temp) || CHEMICAL_TYPE.equals(temp)) {
-            sendStock(tag, client);
+        if (CHEMICAL_TYPE.equals(temp)) {
+            return sendStock(tag);
         }
+        return false;
     }
 
-    private void sendStock(InventoryTag tag, GClient client) {
+    private boolean sendStock(InventoryTag tag) {
         try {
-            boolean result = remoteStockService.rfidCheck(tag);
-            alarm(client, result);
+            R<Boolean> result = remoteStockService.rfidCheck(tag);
+            if (result.getCode() == HttpStatus.SUCCESS) {
+                return result.getData();
+            }
         } catch (Exception e) {
             log.info("化学品服务异常:" + e.getMessage());
         }
+        return false;
     }
 
-    private void sendBottle(InventoryTag tag, GClient client) {
+    private boolean sendBottle(InventoryTag tag) {
         R<Boolean> result;
         try {
             result = bottleService.remoteAdd(tag);
-            if (result.getCode()==HttpStatus.SUCCESS){
-                alarm(client, result.getData());
+            if (result.getCode() == HttpStatus.SUCCESS) {
+               return result.getData();
             }
         } catch (Exception e) {
             log.info("气瓶服务异常:" + e.getMessage());
         }
         try {
             result = remoteBottleService.remoteAdd(tag);
-            if (result.getCode()==HttpStatus.SUCCESS){
-                alarm(client, result.getData());
+            if (result.getCode() == HttpStatus.SUCCESS) {
+                return result.getData();
             }
         } catch (Exception e) {
             log.info("新气瓶服务异常:" + e.getMessage());
         }
-    }
-
-    private void alarm(GClient client, Boolean result) {
-        if (client != null && Boolean.TRUE.equals(result)) {
-            DeJuRFIDServerImpl.alarm(client);
-        }
+        return false;
     }
 
     @Override