Przeglądaj źródła

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

chaiyunlong 3 lat temu
rodzic
commit
77d93a78d4
52 zmienionych plików z 681 dodań i 482 usunięć
  1. 21 0
      zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/fire/RemoteFireDeviceService.java
  2. 30 0
      zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/fire/feign/fallback/RemoteFireDeviceFallbackFactory.java
  3. 0 6
      zd-auth/pom.xml
  4. 24 42
      zd-auth/src/main/java/com/zd/auth/controller/TokenController.java
  5. 11 15
      zd-auth/src/main/java/com/zd/auth/service/SysLoginService.java
  6. 0 3
      zd-common/common-core/src/main/java/com/zd/common/core/annotation/DeviceID.java
  7. 0 2
      zd-common/common-core/src/main/java/com/zd/common/core/annotation/FunctionMapper.java
  8. 4 4
      zd-common/common-core/src/main/java/com/zd/common/core/annotation/Log.java
  9. 6 6
      zd-common/common-core/src/main/java/com/zd/common/core/annotation/PreAuthorize.java
  10. 0 1
      zd-common/common-core/src/main/java/com/zd/common/core/datascope/DataScopeAspect.java
  11. 9 9
      zd-common/common-core/src/main/java/com/zd/common/core/security/TokenService.java
  12. 0 2
      zd-common/common-core/src/main/java/com/zd/common/core/security/TokenServiceImpl.java
  13. 0 1
      zd-gateway/src/main/java/com/zd/gateway/ZdGatewayApplication.java
  14. 0 1
      zd-gateway/src/main/java/com/zd/gateway/filter/BlackListUrlFilter.java
  15. 0 5
      zd-gateway/src/main/java/com/zd/gateway/handler/GatewayExceptionHandler.java
  16. 2 2
      zd-gateway/src/main/java/com/zd/gateway/service/ValidateCodeService.java
  17. 0 4
      zd-gateway/src/main/java/com/zd/gateway/service/impl/ValidateCodeServiceImpl.java
  18. 20 0
      zd-model/src/main/java/com/zd/model/constant/CacheConstants.java
  19. 6 1
      zd-model/src/main/java/com/zd/model/constant/CacheDevice.java
  20. 4 4
      zd-model/src/main/java/com/zd/model/constant/MqttConstants.java
  21. 8 50
      zd-modules/zd-airbottle/pom.xml
  22. 131 61
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/controller/FireDeviceController.java
  23. 6 6
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/mapper/FireDeviceLogMapper.java
  24. 6 6
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/mapper/FireDeviceMapper.java
  25. 8 9
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/service/IFireDeviceLogService.java
  26. 7 8
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/service/IFireDeviceService.java
  27. 3 2
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/service/impl/FireDeviceLogServiceImpl.java
  28. 2 1
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/service/impl/FireDeviceServiceImpl.java
  29. 5 19
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/utils/FireDeviceStatusTask.java
  30. 0 3
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/mqtt/CommonSend.java
  31. 42 47
      zd-modules/zd-algorithm/src/main/java/com/zd/alg/mqtt/MqttConfig.java
  32. 1 0
      zd-modules/zd-algorithm/src/main/resources/mapper/fire/FireDeviceMapper.xml
  33. 0 15
      zd-modules/zd-chemical/pom.xml
  34. 75 54
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/ActHxpapplyController.java
  35. 37 0
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpAIOController.java
  36. 15 0
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpCabinetController.java
  37. 15 0
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpChemicalJoinCabinetController.java
  38. 7 1
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpHomePageStatisticsController.java
  39. 43 0
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpStockController.java
  40. 43 1
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpUserecordController.java
  41. 1 2
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/domain/vo/ActHxpapplyInfoVo.java
  42. 2 2
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/domain/vo/HxpUserecordDetailVo.java
  43. 9 4
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/ActHxpapplyServiceImpl.java
  44. 7 0
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/HxpStockServiceImpl.java
  45. 5 2
      zd-modules/zd-chemical/src/main/java/com/zd/chemical/util/ChemicalUtils.java
  46. 0 12
      zd-modules/zd-exam/pom.xml
  47. 0 25
      zd-modules/zd-modules-laboratory/pom.xml
  48. 46 3
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/config/MqttConfig.java
  49. 6 5
      zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/utils/FireLaborUtil.java
  50. 0 12
      zd-modules/zd-modules-system/pom.xml
  51. 14 22
      zd-modules/zd-modules-system/src/main/java/com/zd/system/controller/SysClassController.java
  52. 0 2
      zd-modules/zd-modules-system/src/main/java/com/zd/system/controller/SysConfigController.java

+ 21 - 0
zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/fire/RemoteFireDeviceService.java

@@ -0,0 +1,21 @@
+package com.zd.algorithm.api.fire;
+
+import com.zd.algorithm.api.speaker.feign.fallback.RemoteSpeakFallbackFactory;
+import com.zd.model.constant.ApplicationConstants;
+import com.zd.model.domain.R;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+
+/***
+ *
+ * 一键灭火远程调用
+ * @author xxf
+ */
+@FeignClient(contextId = "remoteFireDeviceService",value = ApplicationConstants.ALGORITHM_SERVICE,fallbackFactory = RemoteSpeakFallbackFactory.class)
+public interface RemoteFireDeviceService {
+
+    @GetMapping(value = "/firedevice/addFireLog")
+    public R addFireLog(@RequestParam(value = "code", required = true) String code);
+}

+ 30 - 0
zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/fire/feign/fallback/RemoteFireDeviceFallbackFactory.java

@@ -0,0 +1,30 @@
+package com.zd.algorithm.api.fire.feign.fallback;
+
+import com.zd.algorithm.api.fire.RemoteFireDeviceService;
+import com.zd.model.domain.R;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author xxf
+ */
+@Component
+public class RemoteFireDeviceFallbackFactory implements FallbackFactory<RemoteFireDeviceService> {
+
+    private static final Logger log = LoggerFactory.getLogger(RemoteFireDeviceFallbackFactory.class);
+
+
+    @Override
+    public RemoteFireDeviceService create(Throwable cause) {
+        return new RemoteFireDeviceService() {
+            @Override
+            public R addFireLog(String code) {
+                log.info("灭火日志添加失败:" + cause.getMessage());
+                return R.fail("灭火日志添加失败:"+ cause.getMessage());
+            }
+        };
+
+    }
+}

+ 0 - 6
zd-auth/pom.xml

@@ -24,12 +24,6 @@
             <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
         </dependency>
 
-        <!-- SpringCloud Alibaba Sentinel -->
-        <!--<dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
-        </dependency>-->
-
         <!-- zd Common Security-->
         <dependency>
             <groupId>com.zd.core</groupId>

+ 24 - 42
zd-auth/src/main/java/com/zd/auth/controller/TokenController.java

@@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
+
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
@@ -55,7 +56,7 @@ public class TokenController {
     @Autowired
     private RemoteStockService stockService;
     @Resource
-    private RedisTemplate<String,String> redisTemplate;
+    private RedisTemplate<String, String> redisTemplate;
 
     @PostMapping("login")
     public R<?> login(@RequestBody LoginBody form) {
@@ -63,19 +64,19 @@ public class TokenController {
         String authType = form.getAuthType() == null ? BaseConstants.GRANT_TYPE_PASSWORD : form.getAuthType();
         LoginUser userInfo;
         if (Objects.equals(authType, BaseConstants.GRANT_TYPE_MOBILE)) {
-            String key = BaseConstants.DEFAULT_CODE_KEY +  BaseConstants.GRANT_TYPE_MOBILE + "@" + form.getUsername();
+            String key = BaseConstants.DEFAULT_CODE_KEY + BaseConstants.GRANT_TYPE_MOBILE + "@" + form.getUsername();
             String code = redisTemplate.opsForValue().get(key);
-            if (form.getPassword().equals(code)){
+            if (form.getPassword().equals(code)) {
                 R<LoginUser> userR = remoteUserService.getUserInfo(form.getUsername(), SecurityConstants.INNER);
-                if (userR.getCode()== HttpStatus.SUCCESS &&userR.getData()!=null){
-                    userInfo=userR.getData();
-                }else {
+                if (userR.getCode() == HttpStatus.SUCCESS && userR.getData() != null) {
+                    userInfo = userR.getData();
+                } else {
                     throw new ServiceException("系统异常");
                 }
-            }else {
-                throw new ServiceException("验证码不正确",503);
+            } else {
+                throw new ServiceException("验证码不正确", 503);
             }
-        }else {
+        } else {
             userInfo = sysLoginService.login(form.getUsername(), UserConstants.USER_LOGIN_PC, form.getPassword());
         }
         userInfo.setLoginType(UserConstants.USER_LOGIN_PC);
@@ -93,10 +94,8 @@ public class TokenController {
         // 区分大屏用户
         // 查询大屏链接
         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) {
@@ -147,7 +146,6 @@ public class TokenController {
         LoginUser loginUser = new LoginUser();
         BeanUtils.copyProperties(userInfo, loginUser);
         loginUser.setToken(token);
-
         redisService.setCacheObject(CacheConstants.LOGIN_TOKEN_KEY + token, loginUser);
     }
 
@@ -171,25 +169,25 @@ public class TokenController {
     public R<?> send(@RequestBody LoginBody form) {
         String username = form.getUsername();
         R<LoginUser> userR = remoteUserService.getUserInfo(username, SecurityConstants.INNER);
-        if (userR.getCode()!=HttpStatus.SUCCESS || userR.getData()==null){
-            throw new ServiceException("登录用户:" + username + " 不存在",530);
+        if (userR.getCode() != HttpStatus.SUCCESS || userR.getData() == null) {
+            throw new ServiceException("登录用户:" + username + " 不存在", 530);
         }
-        String key = BaseConstants.DEFAULT_CODE_KEY +  BaseConstants.GRANT_TYPE_MOBILE + "@" + username;
+        String key = BaseConstants.DEFAULT_CODE_KEY + BaseConstants.GRANT_TYPE_MOBILE + "@" + username;
         String code = RandomUtil.randomNumbers(6);
-        redisTemplate.opsForValue().set(key,code,CODE_EXPIRATION,TimeUnit.MINUTES);
-        logger.info("========================>{}<=========================",code);
-        String countKey = BaseConstants.DEFAULT_CODE_KEY + "@" + username+"_COUNT";
+        redisTemplate.opsForValue().set(key, code, CODE_EXPIRATION, TimeUnit.MINUTES);
+        logger.info("========================>{}<=========================", code);
+        String countKey = BaseConstants.DEFAULT_CODE_KEY + "@" + username + "_COUNT";
         String count = redisTemplate.opsForValue().get(countKey);
-        if (StringUtils.isEmpty(count)){
-            redisTemplate.opsForValue().set(countKey,"1",60,TimeUnit.MINUTES);
-        }else {
-            if (count!=null){
-                int i=Integer.parseInt(count);
-                if (i>=5){
-                    throw new ServiceException("验证码发送超过限制,请一小时后再试",530);
+        if (StringUtils.isEmpty(count)) {
+            redisTemplate.opsForValue().set(countKey, "1", 60, TimeUnit.MINUTES);
+        } else {
+            if (count != null) {
+                int i = Integer.parseInt(count);
+                if (i >= 5) {
+                    throw new ServiceException("验证码发送超过限制,请一小时后再试", 530);
                 }
                 i++;
-                redisTemplate.opsForValue().set(countKey,i+"",60,TimeUnit.MINUTES);
+                redisTemplate.opsForValue().set(countKey, i + "", 60, TimeUnit.MINUTES);
             }
         }
         return stockService.sendSydSms(code, 2, null, form.getUsername());
@@ -203,13 +201,10 @@ 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;
-
         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") + "");
-
         logger.error("学习机登录,加密前:" + username + ",设备编码:" + machineCode);
         if (UserConstants.USER_LOGIN_HXP == aioType) {
             // TODO 终端传参数据有问题,暂临时后端处理
@@ -229,32 +224,24 @@ public class TokenController {
                 return R.fail("无效卡号或未绑定用户,请联系管理员!");
             }
         }
-
         R<SysUser> user = remoteUserService.getUserInfoByCardNum(username, SecurityConstants.INNER);
-
         if (R.FAIL == user.getCode()) {
             throw new ServiceException(user.getMsg());
         }
         if (StringUtils.isNull(user.getData())) {
             return R.fail("登录用户不存在!");
         }
-
-
         R<LoginUser> userResult = remoteUserService.getUserInfo(user.getData().getUserName(), aioType, SecurityConstants.INNER);
-
         if (R.FAIL == userResult.getCode() || 503 == userResult.getCode()) {
             return R.fail(userResult.getMsg());
         }
-
         if (userResult.getData() != null) {
-
             LoginUser userInfo = userResult.getData();
             userInfo.setLoginType(aioType);
             userInfo.setMachineCode(machineCode);
             if (userInfo.getSysUser() == null) {
                 return R.fail("登录用户不存在!");
             }
-
             Map<String, Object> map = null;
             if (type == 1) {
                 // 获取登录token
@@ -266,9 +253,7 @@ public class TokenController {
                     // 删除用户缓存记录
                     tokenService.delLoginUser(loginUser.getToken());
                 }
-
                 map = tokenService.createToken(userInfo);
-
                 if (UserConstants.USER_LOGIN_HXP == aioType) {
                     map.put("positionName", userInfo.getSysUser().getPositionName());
                     map.put("cabinetLock", userInfo.isCabinetLock());
@@ -284,12 +269,10 @@ public class TokenController {
                     redisService.setCacheObject(CacheConstants.LEARN_USER_KEY + userInfo.getSysUser().getUserId(), userInfo, BaseConstants.TOKEN_EXPIRE * 60, TimeUnit.SECONDS);
                 }
             }
-
             return R.ok(map);
         } else {
             return R.fail("登录用户不存在!");
         }
-
     }
 
     /**
@@ -297,7 +280,6 @@ public class TokenController {
      */
     @PostMapping("/learn/loginOut")
     public R<?> learnLoginOut(HttpServletRequest request) {
-
         LoginUser loginUser = tokenService.getLoginUser(request);
         if (StringUtils.isNotNull(loginUser)) {
             SysUser user = loginUser.getSysUser();

+ 11 - 15
zd-auth/src/main/java/com/zd/auth/service/SysLoginService.java

@@ -41,48 +41,45 @@ public class SysLoginService {
         // 用户名或密码为空 错误
         if (StringUtils.isAnyBlank(username, password)) {
 //            recordLogininfor(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
-            throw new ServiceException("用户/密码必须填写",530);
+            throw new ServiceException("用户/密码必须填写", 530);
         }
         // 密码如果不在指定范围内 错误
         if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
                 || password.length() > UserConstants.PASSWORD_MAX_LENGTH) {
 //            recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码不在指定范围");
-            throw new ServiceException("用户密码不在指定范围",530);
+            throw new ServiceException("用户密码不在指定范围", 530);
         }
         // 用户名不在指定范围内 错误
         if (username.length() < UserConstants.USERNAME_MIN_LENGTH
                 || username.length() > UserConstants.USERNAME_MAX_LENGTH) {
 //            recordLogininfor(username, Constants.LOGIN_FAIL, "用户名不在指定范围");
-            throw new ServiceException("用户名不在指定范围",530);
+            throw new ServiceException("用户名不在指定范围", 530);
         }
         // 查询用户信息
         R<LoginUser> userResult = remoteUserService.getUserInfo(username, loginType, SecurityConstants.INNER);
-
         if (R.FAIL == userResult.getCode()) {
             throw new ServiceException(userResult.getMsg());
         }
-
-        if(HttpStatus.FORBIDDEN == userResult.getCode()){
+        if (HttpStatus.FORBIDDEN == userResult.getCode()) {
             throw new PreAuthorizeException();
         }
-
         if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) {
 //            recordLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在");
-            throw new ServiceException("登录用户:" + username + " 不存在",530);
+            throw new ServiceException("登录用户:" + username + " 不存在", 530);
         }
         LoginUser userInfo = userResult.getData();
         SysUser user = userResult.getData().getSysUser();
         if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
 //            recordLogininfor(username, Constants.LOGIN_FAIL, "对不起,您的账号已被删除");
-            throw new ServiceException("对不起,您的账号:" + username + " 已被删除",530);
+            throw new ServiceException("对不起,您的账号:" + username + " 已被删除", 530);
         }
         if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
 //            recordLogininfor(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
-            throw new ServiceException("对不起,您的账号:" + username + " 已停用",530);
+            throw new ServiceException("对不起,您的账号:" + username + " 已停用", 530);
         }
         if (!SecurityUtils.matchesPassword(password, user.getPassword())) {
 //            recordLogininfor(username, Constants.LOGIN_FAIL, "用户密码错误");
-            throw new ServiceException("用户不存在/密码错误",530);
+            throw new ServiceException("用户不存在/密码错误", 530);
         }
         recordLogininfor(user, BaseConstants.LOGIN_SUCCESS, "登录成功");
         return userInfo;
@@ -115,7 +112,6 @@ public class SysLoginService {
         sysUser.setNickName(username);
         sysUser.setPassword(SecurityUtils.encryptPassword(password));
         R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER);
-
         if (R.FAIL == registerResult.getCode()) {
             throw new ServiceException(registerResult.getMsg());
         }
@@ -125,9 +121,9 @@ public class SysLoginService {
     /**
      * 记录登录信息
      *
-     * @param user 用户名
-     * @param status   状态
-     * @param message  消息内容
+     * @param user    用户名
+     * @param status  状态
+     * @param message 消息内容
      * @return
      */
     public void recordLogininfor(SysUser user, String status, String message) {

+ 0 - 3
zd-common/common-core/src/main/java/com/zd/common/core/annotation/DeviceID.java

@@ -13,7 +13,4 @@ import java.lang.annotation.Target;
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.FIELD)
 public @interface DeviceID {
-
-
-
 }

+ 0 - 2
zd-common/common-core/src/main/java/com/zd/common/core/annotation/FunctionMapper.java

@@ -37,6 +37,4 @@ public @interface FunctionMapper {
      */
     String unit()  default "";
 
-
-    
 }

+ 4 - 4
zd-common/common-core/src/main/java/com/zd/common/core/annotation/Log.java

@@ -17,20 +17,20 @@ public @interface Log {
     /**
      * 模块
      */
-    public String title() default "";
+    String title() default "";
 
     /**
      * 功能
      */
-    public BusinessType businessType() default BusinessType.OTHER;
+    BusinessType businessType() default BusinessType.OTHER;
 
     /**
      * 操作人类别
      */
-    public OperatorType operatorType() default OperatorType.MANAGE;
+    OperatorType operatorType() default OperatorType.MANAGE;
 
     /**
      * 是否保存请求的参数
      */
-    public boolean isSaveRequestData() default true;
+    boolean isSaveRequestData() default true;
 }

+ 6 - 6
zd-common/common-core/src/main/java/com/zd/common/core/annotation/PreAuthorize.java

@@ -16,30 +16,30 @@ public @interface PreAuthorize {
     /**
      * 验证用户是否具备某权限
      */
-    public String hasPermi() default "";
+    String hasPermi() default "";
 
     /**
      * 验证用户是否不具备某权限,与 hasPermi逻辑相反
      */
-    public String lacksPermi() default "";
+    String lacksPermi() default "";
 
     /**
      * 验证用户是否具有以下任意一个权限
      */
-    public String[] hasAnyPermi() default {};
+    String[] hasAnyPermi() default {};
 
     /**
      * 判断用户是否拥有某个角色
      */
-    public String hasRole() default "";
+    String hasRole() default "";
 
     /**
      * 验证用户是否不具备某角色,与 isRole逻辑相反
      */
-    public String lacksRole() default "";
+    String lacksRole() default "";
 
     /**
      * 验证用户是否具有以下任意一个角色
      */
-    public String[] hasAnyRoles() default {};
+    String[] hasAnyRoles() default {};
 }

+ 0 - 1
zd-common/common-core/src/main/java/com/zd/common/core/datascope/DataScopeAspect.java

@@ -242,6 +242,5 @@ public class DataScopeAspect {
                 baseEntity.getParams().put(DATA_SCOPE, "");
             }
         }
-
     }
 }

+ 9 - 9
zd-common/common-core/src/main/java/com/zd/common/core/security/TokenService.java

@@ -14,56 +14,56 @@ public interface TokenService {
     /**
      * 创建令牌
      */
-    public Map<String, Object> createToken(LoginUser loginUser);
+    Map<String, Object> createToken(LoginUser loginUser);
 
     /**
      * 创建令牌
      */
-    public Map<String, Object> createProgramToken(LoginUser loginUser);
+    Map<String, Object> createProgramToken(LoginUser loginUser);
 
     /**
      * 获取用户身份信息
      *
      * @return 用户信息
      */
-    public LoginUser getLoginUser();
+    LoginUser getLoginUser();
 
     /**
      * 获取用户身份信息
      *
      * @return 用户信息
      */
-    public LoginUser getLoginUser(HttpServletRequest request);
+    LoginUser getLoginUser(HttpServletRequest request);
 
     /**
      * 获取用户身份信息
      *
      * @return 用户信息
      */
-    public LoginUser getLoginUser(String token);
+    LoginUser getLoginUser(String token);
 
     /**
      * 设置用户身份信息
      */
-    public void setLoginUser(LoginUser loginUser);
+    void setLoginUser(LoginUser loginUser);
 
     /**
      * delLoginUser
      * @param token
      */
-    public void delLoginUser(String token);
+    void delLoginUser(String token);
 
     /**
      * 刷新令牌有效期
      *
      * @param loginUser 登录信息
      */
-    public void refreshToken(LoginUser loginUser);
+    void refreshToken(LoginUser loginUser);
 
     /**
      * 刷新令牌有效期
      *
      * @param token token
      */
-    public void refreshToken(String token);
+    void refreshToken(String token);
 }

+ 0 - 2
zd-common/common-core/src/main/java/com/zd/common/core/security/TokenServiceImpl.java

@@ -22,8 +22,6 @@ import java.util.concurrent.TimeUnit;
 @Component
 public class TokenServiceImpl implements TokenService {
 
-    //@Autowired
-    //private RedisService redisService;
     @Autowired
     private RedisTemplate redisTemplate;
 

+ 0 - 1
zd-gateway/src/main/java/com/zd/gateway/ZdGatewayApplication.java

@@ -43,6 +43,5 @@ public class ZdGatewayApplication {
         } catch (UnknownHostException e) {
             e.printStackTrace();
         }
-
     }
 }

+ 0 - 1
zd-gateway/src/main/java/com/zd/gateway/filter/BlackListUrlFilter.java

@@ -54,5 +54,4 @@ public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackListUr
             });
         }
     }
-
 }

+ 0 - 5
zd-gateway/src/main/java/com/zd/gateway/handler/GatewayExceptionHandler.java

@@ -25,13 +25,10 @@ public class GatewayExceptionHandler implements ErrorWebExceptionHandler {
     @Override
     public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) {
         ServerHttpResponse response = exchange.getResponse();
-
         if (exchange.getResponse().isCommitted()) {
             return Mono.error(ex);
         }
-
         String msg;
-
         if (ex instanceof NotFoundException) {
             msg = "服务未找到";
         } else if (ex instanceof ResponseStatusException) {
@@ -40,9 +37,7 @@ public class GatewayExceptionHandler implements ErrorWebExceptionHandler {
         } else {
             msg = "内部服务器错误";
         }
-
         log.error("[网关异常处理]请求路径:{},异常信息:{}", exchange.getRequest().getPath(), ex.getMessage());
-
         return ServletUtils.webFluxResponseWriter(response, msg);
     }
 }

+ 2 - 2
zd-gateway/src/main/java/com/zd/gateway/service/ValidateCodeService.java

@@ -13,10 +13,10 @@ public interface ValidateCodeService {
     /**
      * 生成验证码
      */
-    public AjaxResult createCapcha() throws IOException, CaptchaException;
+    AjaxResult createCapcha() throws IOException, CaptchaException;
 
     /**
      * 校验验证码
      */
-    public void checkCapcha(String key, String value) throws CaptchaException;
+    void checkCapcha(String key, String value) throws CaptchaException;
 }

+ 0 - 4
zd-gateway/src/main/java/com/zd/gateway/service/impl/ValidateCodeServiceImpl.java

@@ -55,14 +55,11 @@ public class ValidateCodeServiceImpl implements ValidateCodeService {
         if (!captchaOnOff) {
             return ajax;
         }
-
         // 保存验证码信息
         String uuid = IdUtils.simpleUUID();
         String verifyKey = BaseConstants.CAPTCHA_CODE_KEY + uuid;
-
         String capStr = null, code = null;
         BufferedImage image = null;
-
         String captchaType = captchaProperties.getType();
         // 生成验证码
         if ("math".equals(captchaType)) {
@@ -83,7 +80,6 @@ public class ValidateCodeServiceImpl implements ValidateCodeService {
         } catch (IOException e) {
             return AjaxResult.error(e.getMessage());
         }
-
         ajax.put("uuid", uuid);
         ajax.put("img", Base64.encode(os.toByteArray()));
         return ajax;

+ 20 - 0
zd-model/src/main/java/com/zd/model/constant/CacheConstants.java

@@ -57,4 +57,24 @@ public interface CacheConstants {
      * 计时timer
      */
     String SENSOR_TiMER = "timer:";
+
+    /**
+     * 灭火设备集合
+     */
+    String FIRE_DEVICE_LIST = "fire_device_list:";
+
+    /**
+     * 灭火设备详情
+     */
+    String FIRE_DEVICE_DETAILS = "fire_device_details:";
+
+    /**
+     * 灭火设备最后响应时间
+     */
+    String FIRE_DEVICE_RESPOND_TIME = "fire_device_respond_time:";
+
+    /**
+     * 灭火设备日志是否添加
+     */
+    String FIRE_LOG_IS_EXIST = "fire_log_is_exist:";
 }

+ 6 - 1
zd-model/src/main/java/com/zd/model/constant/CacheDevice.java

@@ -25,7 +25,12 @@ public enum CacheDevice {
     /**
      * 继电器失效周期
      */
-    RELAY_LIFE("relay_life:", 10 * 60 * 60L);
+    RELAY_LIFE("relay_life:", 10 * 60 * 60L),
+
+    /**
+     * 火灾摄像头前缀
+     */
+    FIRE_CAMERA_KEY("fire:camera:",72 * 60 * 60L);
 
     /**
      * redis 缓存

+ 4 - 4
zd-model/src/main/java/com/zd/model/constant/MqttConstants.java

@@ -85,10 +85,10 @@ public interface MqttConstants {
     String TOPIC_CABINET_LOCK = "lab/cabinetLock/";
 
     //灭火设备发送topic
-    String TOPIC_FIRE_DEVICE = "alarm/sendFire/";
+    String TOPIC_FIRE_DEVICE = "lab/sendFire/";
     //灭火设备接收topic
-    String TOPIC_FIRE_DEVICE_RECEIVE = "alarm/receiveFire/";
+    String TOPIC_FIRE_DEVICE_RECEIVE = "lab/receiveFire/";
 
-    //灭火设备异常通知预案topic
-    String TOPIC_FIRE_DEVICE_WARN = "alarm/fireDevice/Warn";
+    //灭火设备异常通知
+    String TOPIC_FIRE_DEVICE_WARN = "lab/fireDevice/Warn/";
 }

+ 8 - 50
zd-modules/zd-airbottle/pom.xml

@@ -33,96 +33,54 @@
             <version>0.2.3-RC1</version>
         </dependency>
 
-        <!-- SpringCloud Alibaba Sentinel -->
-        <!--<dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
-        </dependency>
-
-        &lt;!&ndash; SpringBoot Actuator &ndash;&gt;
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>-->
-
         <!-- Mysql Connector -->
         <dependency>
             <groupId>mysql</groupId>
             <artifactId>mysql-connector-java</artifactId>
         </dependency>
 
-        <!-- zd Common DataSource -->
-<!--        <dependency>-->
-<!--            <groupId>com.zd</groupId>-->
-<!--            <artifactId>zd-common-datasource</artifactId>-->
-<!--        </dependency>-->
-
-<!--        &lt;!&ndash; zd Common DataScope &ndash;&gt;-->
-<!--        <dependency>-->
-<!--            <groupId>com.zd</groupId>-->
-<!--            <artifactId>zd-common-datascope</artifactId>-->
-<!--        </dependency>-->
-
-        <!-- zd Common Log -->
-<!--        <dependency>-->
-<!--            <groupId>com.zd</groupId>-->
-<!--            <artifactId>zd-common-log</artifactId>-->
-<!--        </dependency>-->
-
-        <!-- zd Common Swagger -->
-<!--        <dependency>-->
-<!--            <groupId>com.zd</groupId>-->
-<!--            <artifactId>zd-common-swagger</artifactId>-->
-<!--        </dependency>-->
-<!--        <dependency>-->
-<!--            <groupId>org.springframework.boot</groupId>-->
-<!--            <artifactId>spring-boot-starter-test</artifactId>-->
-<!--            <scope>test</scope>-->
-<!--            <exclusions>-->
-<!--                <exclusion>-->
-<!--                    <groupId>org.junit.vintage</groupId>-->
-<!--                    <artifactId>junit-vintage-engine</artifactId>-->
-<!--                </exclusion>-->
-<!--            </exclusions>-->
-<!--        </dependency>-->
         <dependency>
             <groupId>com.zd.swagger</groupId>
             <artifactId>common-swagger</artifactId>
         </dependency>
+
         <dependency>
             <groupId>com.zd.core</groupId>
             <artifactId>common-core</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-        </dependency>
+
         <dependency>
             <groupId>com.google.code.gson</groupId>
             <artifactId>gson</artifactId>
         </dependency>
+
         <dependency>
             <groupId>com.google.zxing</groupId>
             <artifactId>core</artifactId>
             <version>3.2.0</version>
         </dependency>
+
         <dependency>
             <groupId>com.google.zxing</groupId>
             <artifactId>javase</artifactId>
             <version>3.2.0</version>
         </dependency>
+
         <dependency>
             <groupId>com.zd.algorithm</groupId>
             <artifactId>zd-algorithm-api</artifactId>
         </dependency>
+
         <dependency>
             <groupId>com.zd.laboratory</groupId>
             <artifactId>zd-laboratory-api</artifactId>
         </dependency>
+
         <dependency>
             <groupId>com.zd.base</groupId>
             <artifactId>zd-base-api</artifactId>
         </dependency>
+
         <dependency>
             <groupId>com.zd.airbottle</groupId>
             <artifactId>zd-airbottle-api</artifactId>

+ 131 - 61
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/controller/FireDeviceController.java

@@ -9,12 +9,13 @@ import com.zd.algorithm.api.fire.entity.HardwareFireDeviceLog;
 import com.zd.algorithm.api.fire.entity.vo.HardwareFireDeviceVO;
 import com.zd.common.core.annotation.Log;
 import com.zd.common.core.annotation.PreAuthorize;
-import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.log.BusinessType;
 import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.common.core.web.controller.BaseController;
 import com.zd.laboratory.api.feign.RemoteLaboratoryService;
+import com.zd.model.constant.CacheConstants;
+import com.zd.model.constant.CacheDevice;
 import com.zd.model.domain.ResultData;
 import com.zd.model.domain.per.PerFun;
 import com.zd.model.domain.per.PerPrefix;
@@ -27,6 +28,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 /**
  * 灭火装置
@@ -67,26 +69,23 @@ public class FireDeviceController extends BaseController {
     @GetMapping(value = "/getStatus")
     public ResultData getStatus(Long subjectId) {
         Map<String, Object> map = new HashMap<>();
-        boolean smoke = false;//烟雾
-        boolean temperature = false;//温度
-        boolean fire = false;//火焰
-        boolean online = false;//是否在线
-        boolean isexist = false;//是否配置灭火设备
+        //烟雾
+        boolean smoke = false;
+        //温度
+        boolean temperature = false;
+        //火焰
+        boolean fire = false;
+        //是否在线
+        boolean online = false;
+        //是否配置灭火设备
+        boolean isexist = false;
+        //是否灭火中
+        boolean outfireing =false;
 
         if (StringUtils.isNull(subjectId)) {
             return ResultData.fail("实验室id参数为空");
         }
 
-        //获取灭火主机最后一次响应时间,判断响应是否超时
-        Long timeJson = redisService.getCacheObject(FireDeviceStatusTask.TOPIC_FD_RESPOND_TIME);
-        if (StringUtils.isNotNull(timeJson)) {
-            Long timeDiff = (System.currentTimeMillis() - timeJson) / 1000;
-            //时间差 在设置时间内
-            if (timeDiff < onlineTime) {
-                online = true;
-            }
-        }
-
         //查询实验室是否配置灭火设备
         HardwareFireDeviceVO vo = new HardwareFireDeviceVO();
         vo.setSubjectId(subjectId);
@@ -99,33 +98,47 @@ public class FireDeviceController extends BaseController {
             return ResultData.success(map);
         } else {
             isexist = true;
-        }
+            //获取灭火主机最后一次响应时间,判断响应是否超时
+            Long timeJson = redisService.getCacheObject(CacheConstants.FIRE_DEVICE_RESPOND_TIME+list.get(0).getDeviceCode());
+            if (StringUtils.isNotNull(timeJson)) {
+                Long timeDiff = (System.currentTimeMillis() - timeJson) / 1000;
+                //时间差 在设置时间内
+                if (timeDiff < onlineTime) {
+                    online = true;
+                }
+            }
 
-        //根据编码从redis获取该设备状态
-        //String str = "{\"msg\":\"NO:5号设备故障 NO:10号设备火警 \",\"fireNumber\":1,\"fireStatus\":true,\"startSpray\":\"0\",\"gasSpray\":\"0\"}";
-        //JSONObject strJson = JSONObject.parseObject(str);
-        JSONObject strJson = redisService.getCacheObject(list.get(0).getDeviceCode());
-        if (StringUtils.isNotNull(strJson)) {
-            Integer fireNumber = (Integer) strJson.get("fireNumber");
-            if (fireNumber == 1) {
-                temperature = true;
-            } else if (fireNumber == 2) {
-                smoke = true;
-                temperature = true;
+            //根据编码从redis获取该设备状态
+            //String str = "{\"msg\":\"NO:5号设备故障 NO:10号设备火警 \",\"fireNumber\":1,\"fireStatus\":true,\"startSpray\":\"0\",\"gasSpray\":\"0\"}";
+            //JSONObject strJson = JSONObject.parseObject(str);
+            JSONObject strJson = redisService.getCacheObject(list.get(0).getDeviceCode());
+            if (StringUtils.isNotNull(strJson)) {
+                Integer fireNumber = (Integer) strJson.get("fireNumber");
+                if (fireNumber == 1) {
+                    temperature = true;
+                } else if (fireNumber == 2) {
+                    smoke = true;
+                    temperature = true;
+                }
+                //启动喷洒状态 :1是启动 0未启动
+                Integer startSpray = Integer.valueOf(strJson.get("startSpray").toString());
+                outfireing = startSpray==1?true:false;
             }
-        }
 
-        //查询该实验室是否存在火焰摄像头报警
-        JSONObject fireJson = redisService.getCacheObject("/lab/fire/85");
-        if (StringUtils.isNotNull(fireJson)) {
-            fire = true;
+
+            //查询该实验室是否存在火焰摄像头报警
+            JSONObject fireJson = redisService.getCacheObject(CacheDevice.FIRE_CAMERA_KEY.getRedisKey()+subjectId);
+            if (StringUtils.isNotNull(fireJson)) {
+                fire = true;
+            }
         }
         map.put("smoke", smoke);
         map.put("temperature", temperature);
         map.put("fire", fire);
         map.put("online", online);
         map.put("isexist", isexist);
-        map.put("deviceCode", list.get(0).getDeviceCode());
+        map.put("outfireing", outfireing);
+        map.put("fireDevice", list.get(0));
         return ResultData.success(map);
     }
 
@@ -138,17 +151,23 @@ public class FireDeviceController extends BaseController {
     @GetMapping(value = "/getStatusDetails")
     public ResultData getStatus(String deviceCode) {
         Map<String, Object> map = new HashMap<>();
-        boolean smoke = false;//烟雾
-        boolean temperature = false;//温度
-        boolean fire = false;//火焰
-        boolean online = false;//是否在线
+        //烟雾
+        boolean smoke = false;
+        //温度
+        boolean temperature = false;
+        //火焰
+        boolean fire = false;
+        //是否在线
+        boolean online = false;
+        //是否灭火中
+        boolean outfireing =false;
 
         if (StringUtils.isNull(deviceCode)) {
-            throw new ServiceException("设备编号参数为空");
+            ResultData.fail("设备编号参数为空");
         }
 
         //获取灭火主机最后一次响应时间,判断响应是否超时
-        Long timeJson = redisService.getCacheObject(FireDeviceStatusTask.TOPIC_FD_RESPOND_TIME);
+        Long timeJson = redisService.getCacheObject(CacheConstants.FIRE_DEVICE_RESPOND_TIME+deviceCode);
         if (StringUtils.isNotNull(timeJson)) {
             Long timeDiff = (System.currentTimeMillis() - timeJson) / 1000;
             //时间差 在设置时间内
@@ -169,10 +188,30 @@ public class FireDeviceController extends BaseController {
                 smoke = true;
                 temperature = true;
             }
+            //启动喷洒状态 :1是启动 0未启动
+            Integer startSpray = Integer.valueOf(strJson.get("startSpray").toString());
+            outfireing = startSpray==1?true:false;
+        }
+
+        //根据采集器编号获取灭火主机详情
+        HardwareFireDeviceVO fireDeviceVo = redisService.getCacheObject(CacheConstants.FIRE_DEVICE_DETAILS+deviceCode) ;
+        Long subjectId=0L;
+        if(StringUtils.isNull(fireDeviceVo)){
+            HardwareFireDeviceVO vo = new HardwareFireDeviceVO();
+            vo.setDeviceCode(deviceCode);
+            List<HardwareFireDeviceVO> list = fireDeviceService.selectHardwareFireDeviceList(vo);
+            if(list.size()>0){
+                subjectId = list.get(0).getSubjectId();
+                redisService.setCacheObject(CacheConstants.FIRE_DEVICE_DETAILS+list.get(0).getDeviceCode(),list.get(0),300L, TimeUnit.MINUTES);
+            }else{
+                logger.info("====定时请求状态时,根据code没有查询到灭火主机详情=====");
+            }
+        }else{
+            subjectId=fireDeviceVo.getSubjectId();
         }
 
         //查询该实验室是否存在火焰摄像头报警
-        JSONObject fireJson = redisService.getCacheObject("/lab/fire/85");
+        JSONObject fireJson = redisService.getCacheObject(CacheDevice.FIRE_CAMERA_KEY.getRedisKey()+subjectId);
         if (StringUtils.isNotNull(fireJson)) {
             fire = true;
         }
@@ -180,16 +219,49 @@ public class FireDeviceController extends BaseController {
         map.put("temperature", temperature);
         map.put("fire", fire);
         map.put("online", online);
+        map.put("outfireing", outfireing);
         return ResultData.success(map);
     }
 
     /***
-     * 发送灭火请求
+     * 发送灭火请求-小程序
      * @return
      */
-    @GetMapping(value = "/outfire")
+    @GetMapping(value = "/outfireapp")
     public ResultData outFire(Long subjectId) throws InterruptedException {
-        logger.info("=========开始一键灭火=======");
+        logger.info("=========小程序端开始一键灭火=======");
+        Map<String, Object> map = outFireCom(subjectId);
+        if(StringUtils.isNotNull(map.get("check"))){
+            return ResultData.fail(map.get("check").toString());
+        }
+        return ResultData.success(map);
+    }
+
+    /***
+     *发送灭火请求-PC
+     * @param subjectId
+     * @return
+     * @throws InterruptedException
+     */
+    @GetMapping(value = "/outfirepc")
+    public ResultData outFirePc(Long subjectId) throws InterruptedException {
+        logger.info("=========PC端开始一键灭火=======");
+        //执行灭火指令
+        Map<String, Object> map = outFireCom(subjectId);
+        if(StringUtils.isNotNull(map.get("check"))){
+            return ResultData.fail(map.get("check").toString());
+        }
+        return ResultData.success(map);
+    }
+
+    /***
+     *灭火指令发送方法
+     * @param subjectId
+     * @return
+     */
+    public Map<String,Object> outFireCom(Long subjectId) throws InterruptedException {
+        Map<String, Object> map = new HashMap<>();
+        map.put("check","");
         //查询实验室下的硬件
         RemoteLabHardware hd = new RemoteLabHardware();
         //实验室id
@@ -198,13 +270,15 @@ public class FireDeviceController extends BaseController {
         hd.setType(10);
         List<RemoteLabHardware> hdlist = remoteLaboratoryService.remoteList(hd).getData();
         if (hdlist.size() == 0) {
-            return ResultData.fail("该实验室尚未配置关联硬件!");
+            //return ResultData.fail("该实验室尚未配置关联硬件!");
+            map.put("check","该实验室尚未配置关联硬件!");
+            return  map;
         } else if (hdlist.size() != 2) {
-            return ResultData.fail("该实验室尚未配置2路控制器!");
+            //return ResultData.fail("该实验室尚未配置2路控制器!");
+            map.put("check","该实验室尚未配置2路控制器!");
+            return map;
         }
 
-
-        Map<String, Object> map = new HashMap<>();
         //获取当前实验室下灭火设备状态
         HardwareFireDeviceVO fireDeviceVO = new HardwareFireDeviceVO();
         fireDeviceVO.setSubjectId(subjectId);
@@ -238,7 +312,7 @@ public class FireDeviceController extends BaseController {
         fireDeviceLog.setRunResult(map.toString());
         fireDeviceLog.setCreateTime(new Date());
         fireDeviceLogService.insertFireDeviceLog(fireDeviceLog);
-        return ResultData.success(map);
+        return map;
     }
 
     /**
@@ -362,18 +436,14 @@ public class FireDeviceController extends BaseController {
         return ResultData.result(fireDeviceService.deleteHardwareFireDeviceByIds(ids));
     }
 
-    @GetMapping(value = "/test")
-    public ResultData test(Long subjectId) {
-        String str = fireDeviceLogService.insertFireAutomatic("28613608F0CA1");
-        String fireJson = redisService.getCacheObject("alarm/sendFire/28613608F0CA");
-        logger.info(waitTime + "");
-        return ResultData.success(str);
+    /***
+     * 一键灭火日志添加
+     * @param code
+     * @return
+     */
+    @GetMapping(value = "/addFireLog")
+    public ResultData addFireLog(String code) {
+        return ResultData.success(fireDeviceLogService.insertFireAutomatic(code));
     }
 
-    public static void main(String[] args) {
-        Map<String, Object> map = new HashMap<>();
-        map.put("flg", false);
-        map.put("str", "AAA,222,DFR");
-        System.out.println(map.toString());
-    }
 }

+ 6 - 6
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/mapper/FireDeviceLogMapper.java

@@ -20,7 +20,7 @@ public interface FireDeviceLogMapper
      * @param labFireDeviceLog 灭火设备日志
      * @return 灭火设备日志
      */
-    public List<HardwareFireDeviceLog> selectLabFireDeviceLogList(HardwareFireDeviceLog labFireDeviceLog);
+    List<HardwareFireDeviceLog> selectLabFireDeviceLogList(HardwareFireDeviceLog labFireDeviceLog);
 
 
     /****
@@ -28,7 +28,7 @@ public interface FireDeviceLogMapper
      * @param id
      * @return
      */
-    public HardwareFireDeviceLog selectLabFireDeviceLogById(Long id);
+    HardwareFireDeviceLog selectLabFireDeviceLogById(Long id);
 
     /**
      * 新增灭火设备日志
@@ -36,7 +36,7 @@ public interface FireDeviceLogMapper
      * @param labFireDeviceLog 灭火设备日志
      * @return 结果
      */
-    public int insertLabFireDeviceLog(HardwareFireDeviceLog labFireDeviceLog);
+    int insertLabFireDeviceLog(HardwareFireDeviceLog labFireDeviceLog);
 
     /**
      * 修改灭火设备日志
@@ -44,7 +44,7 @@ public interface FireDeviceLogMapper
      * @param labFireDeviceLog 灭火设备日志
      * @return 结果
      */
-    public int updateLabFireDeviceLog(HardwareFireDeviceLog labFireDeviceLog);
+    int updateLabFireDeviceLog(HardwareFireDeviceLog labFireDeviceLog);
 
     /**
      * 删除灭火设备日志
@@ -52,7 +52,7 @@ public interface FireDeviceLogMapper
      * @param id 灭火设备日志主键
      * @return 结果
      */
-    public int deleteLabFireDeviceLogById(Long id);
+    int deleteLabFireDeviceLogById(Long id);
 
     /**
      * 批量删除灭火设备日志
@@ -60,5 +60,5 @@ public interface FireDeviceLogMapper
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteLabFireDeviceLogByIds(Long[] ids);
+    int deleteLabFireDeviceLogByIds(Long[] ids);
 }

+ 6 - 6
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/mapper/FireDeviceMapper.java

@@ -20,7 +20,7 @@ public interface FireDeviceMapper
      * @param fireDeviceVO 灭火设备
      * @return 灭火设备
      */
-    public List<HardwareFireDeviceVO> selectHardwareFireDeviceList(HardwareFireDeviceVO fireDeviceVO);
+    List<HardwareFireDeviceVO> selectHardwareFireDeviceList(HardwareFireDeviceVO fireDeviceVO);
 
 
     /****
@@ -28,7 +28,7 @@ public interface FireDeviceMapper
      * @param id
      * @return
      */
-    public HardwareFireDeviceVO selectHardwareFireDeviceById(Long id);
+    HardwareFireDeviceVO selectHardwareFireDeviceById(Long id);
 
     /**
      * 新增灭火设备
@@ -36,7 +36,7 @@ public interface FireDeviceMapper
      * @param fireDevice 灭火设备
      * @return 结果
      */
-    public int insertHardwareFireDevice(HardwareFireDevice fireDevice);
+    int insertHardwareFireDevice(HardwareFireDevice fireDevice);
 
     /**
      * 修改灭火设备
@@ -44,7 +44,7 @@ public interface FireDeviceMapper
      * @param labFireDevice 灭火设备
      * @return 结果
      */
-    public int updateHardwareFireDevice(HardwareFireDevice labFireDevice);
+    int updateHardwareFireDevice(HardwareFireDevice labFireDevice);
 
     /**
      * 删除灭火设备
@@ -52,7 +52,7 @@ public interface FireDeviceMapper
      * @param id 灭火设备主键
      * @return 结果
      */
-    public int deleteHardwareFireDeviceById(Long id);
+    int deleteHardwareFireDeviceById(Long id);
 
     /**
      * 批量删除灭火设备
@@ -60,5 +60,5 @@ public interface FireDeviceMapper
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteHardwareFireDeviceByIds(Long[] ids);
+    int deleteHardwareFireDeviceByIds(Long[] ids);
 }

+ 8 - 9
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/service/IFireDeviceLogService.java

@@ -10,15 +10,14 @@ import java.util.List;
  * @author xxf
  * @date 2022-11-24
  */
-public interface IFireDeviceLogService
-{
+public interface IFireDeviceLogService {
     /**
      * 查询实验室灭火设备日志
      *
      * @param fireDeviceLog 灭火设备日志
      * @return 灭火设备日志
      */
-    public List<HardwareFireDeviceLog> selectFireDeviceLogList(HardwareFireDeviceLog fireDeviceLog);
+    List<HardwareFireDeviceLog> selectFireDeviceLogList(HardwareFireDeviceLog fireDeviceLog);
 
 
     /****
@@ -26,7 +25,7 @@ public interface IFireDeviceLogService
      * @param id
      * @return
      */
-    public HardwareFireDeviceLog selectFireDeviceLogById(Long id);
+    HardwareFireDeviceLog selectFireDeviceLogById(Long id);
 
     /**
      * 新增灭火设备日志
@@ -34,7 +33,7 @@ public interface IFireDeviceLogService
      * @param fireDeviceLog 灭火设备日志
      * @return 结果
      */
-    public int insertFireDeviceLog(HardwareFireDeviceLog fireDeviceLog);
+    int insertFireDeviceLog(HardwareFireDeviceLog fireDeviceLog);
 
     /**
      * 修改灭火设备日志
@@ -42,7 +41,7 @@ public interface IFireDeviceLogService
      * @param fireDeviceLog 灭火设备日志
      * @return 结果
      */
-    public int updateFireDeviceLog(HardwareFireDeviceLog fireDeviceLog);
+    int updateFireDeviceLog(HardwareFireDeviceLog fireDeviceLog);
 
     /**
      * 删除灭火设备日志
@@ -50,7 +49,7 @@ public interface IFireDeviceLogService
      * @param id 灭火设备日志主键
      * @return 结果
      */
-    public int deleteFireDeviceLogById(Long id);
+    int deleteFireDeviceLogById(Long id);
 
     /**
      * 批量删除灭火设备日志
@@ -58,12 +57,12 @@ public interface IFireDeviceLogService
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteFireDeviceLogByIds(Long[] ids);
+    int deleteFireDeviceLogByIds(Long[] ids);
 
     /***
      * 自动灭火日志添加
      * @param code 继电器编号
      * @return
      */
-    public String insertFireAutomatic(String code);
+    String insertFireAutomatic(String code);
 }

+ 7 - 8
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/service/IFireDeviceService.java

@@ -11,15 +11,14 @@ import java.util.List;
  * @author xxf
  * @date 2022-11-24
  */
-public interface IFireDeviceService
-{
+public interface IFireDeviceService {
     /**
      * 查询实验室灭火设备
      *
      * @param fireDeviceVO 灭火设备
      * @return 灭火设备
      */
-    public List<HardwareFireDeviceVO> selectHardwareFireDeviceList(HardwareFireDeviceVO fireDeviceVO);
+    List<HardwareFireDeviceVO> selectHardwareFireDeviceList(HardwareFireDeviceVO fireDeviceVO);
 
 
     /****
@@ -27,7 +26,7 @@ public interface IFireDeviceService
      * @param id
      * @return
      */
-    public HardwareFireDeviceVO selectHardwareFireDeviceById(Long id);
+    HardwareFireDeviceVO selectHardwareFireDeviceById(Long id);
 
     /**
      * 新增灭火设备
@@ -35,7 +34,7 @@ public interface IFireDeviceService
      * @param fireDevice 灭火设备
      * @return 结果
      */
-    public int insertHardwareFireDevice(HardwareFireDevice fireDevice);
+    int insertHardwareFireDevice(HardwareFireDevice fireDevice);
 
     /**
      * 修改灭火设备
@@ -43,7 +42,7 @@ public interface IFireDeviceService
      * @param fireDevice 灭火设备
      * @return 结果
      */
-    public int updateHardwareFireDevice(HardwareFireDevice fireDevice);
+    int updateHardwareFireDevice(HardwareFireDevice fireDevice);
 
     /**
      * 删除灭火设备
@@ -51,7 +50,7 @@ public interface IFireDeviceService
      * @param id 灭火设备主键
      * @return 结果
      */
-    public int deleteHardwareFireDeviceById(Long id);
+    int deleteHardwareFireDeviceById(Long id);
 
     /**
      * 批量删除灭火设备
@@ -59,5 +58,5 @@ public interface IFireDeviceService
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteHardwareFireDeviceByIds(Long[] ids);
+    int deleteHardwareFireDeviceByIds(Long[] ids);
 }

+ 3 - 2
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/service/impl/FireDeviceLogServiceImpl.java

@@ -10,6 +10,7 @@ import com.zd.algorithm.api.fire.entity.vo.HardwareFireDeviceVO;
 import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.utils.SaveUtil;
 import com.zd.common.core.utils.StringUtils;
+import com.zd.model.constant.CacheConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -114,8 +115,8 @@ public class FireDeviceLogServiceImpl implements IFireDeviceLogService {
         System.out.println(sdf.format(date));*/
 
         // redis取值,当天日志是否添加
-        String isExist = redisService.getCacheObject(FireDeviceStatusTask.TOPIC_OUTFIRE_ISEXIST);
-        if(StringUtils.isEmpty(isExist)){
+        String isExist = redisService.getCacheObject(CacheConstants.FIRE_LOG_IS_EXIST);
+        if(StringUtils.isNotNull(isExist)){
             str="当天首次自动灭火日志已添加";
         }else{
             //根据继电器编码查询灭火设备信息

+ 2 - 1
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/service/impl/FireDeviceServiceImpl.java

@@ -9,6 +9,7 @@ import com.zd.algorithm.api.fire.entity.vo.HardwareFireDeviceVO;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.utils.SaveUtil;
+import com.zd.model.constant.CacheConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -144,6 +145,6 @@ public class FireDeviceServiceImpl implements IFireDeviceService {
     private void setupRedis(){
         HardwareFireDeviceVO fireDeviceVO = new HardwareFireDeviceVO();
         List<HardwareFireDeviceVO> list = hardwareFireDeviceMapper.selectHardwareFireDeviceList(fireDeviceVO);
-        redisService.setCacheObject(FireDeviceStatusTask.REDIS_TASK_FIRE_DEVICE_LIST,list,1L, TimeUnit.MINUTES);
+        redisService.setCacheObject(CacheConstants.FIRE_DEVICE_LIST,list,1L, TimeUnit.MINUTES);
     }
 }

+ 5 - 19
zd-modules/zd-algorithm/src/main/java/com/zd/alg/fire/utils/FireDeviceStatusTask.java

@@ -5,10 +5,12 @@ import com.zd.alg.fire.service.IFireDeviceService;
 import com.zd.alg.mqtt.MqttSend;
 import com.zd.algorithm.api.fire.entity.vo.HardwareFireDeviceVO;
 import com.zd.common.core.redis.RedisService;
+import com.zd.model.constant.CacheConstants;
 import com.zd.model.constant.MqttConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -24,22 +26,6 @@ public class FireDeviceStatusTask {
 
     private static final Logger logger = LoggerFactory.getLogger(FireDeviceStatusTask.class);
 
-    /**
-     * redis键值(灭火设备集合)
-     */
-    public static final String REDIS_TASK_FIRE_DEVICE_LIST = "rdeisTaskFireDeviceList";
-
-
-    /**
-     * redis键值 灭火设备最后响应时间
-     */
-    public static final String TOPIC_FD_RESPOND_TIME = "topicFdRespondTime";
-
-    /**
-     * redis键值 灭火设备日志是否添加
-     */
-    public static final String TOPIC_OUTFIRE_ISEXIST = "topicOutfireIsExist";
-
     @Autowired
     private IFireDeviceService hardwareFireDeviceService;
     @Autowired
@@ -52,14 +38,14 @@ public class FireDeviceStatusTask {
      * 定时更新灭火装置状态
      *
      */
-    //@Scheduled(cron = "0/20 * * * * ?")
+    @Scheduled(cron = "0/20 * * * * ?")
     public void getFireDeviceStatus() {
         //redis取值
-        List<HardwareFireDeviceVO> list = JSON.parseArray(redisService.getCacheObject(REDIS_TASK_FIRE_DEVICE_LIST) + "", HardwareFireDeviceVO.class);
+        List<HardwareFireDeviceVO> list = JSON.parseArray(redisService.getCacheObject(CacheConstants.FIRE_DEVICE_LIST) + "", HardwareFireDeviceVO.class);
         if (list == null) {
             list = hardwareFireDeviceService.selectHardwareFireDeviceList(new HardwareFireDeviceVO());
             //redis存值,时效1分钟
-            redisService.setCacheObject(REDIS_TASK_FIRE_DEVICE_LIST, list, 1L, TimeUnit.MINUTES);
+            redisService.setCacheObject(CacheConstants.FIRE_DEVICE_LIST, list, 1L, TimeUnit.MINUTES);
         }
 
         if (list != null) {

+ 0 - 3
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/mqtt/CommonSend.java

@@ -40,7 +40,4 @@ public class CommonSend {
     {
         mqttProducer.sendToMqtt(topic, QOS, JSON.toJSONString(messageBody));
     }
-
-
-
 }

+ 42 - 47
zd-modules/zd-algorithm/src/main/java/com/zd/alg/mqtt/MqttConfig.java

@@ -1,10 +1,12 @@
 package com.zd.alg.mqtt;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.zd.alg.fire.service.IFireDeviceLogService;
 import com.zd.alg.fire.utils.FireDeviceStatusTask;
 import com.zd.alg.fire.utils.FireLaborUtil;
 import com.zd.common.core.redis.RedisService;
+import com.zd.model.constant.CacheConstants;
 import com.zd.model.constant.MqttConstants;
 import org.apache.commons.lang3.StringUtils;
 import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
@@ -25,6 +27,7 @@ import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter;
 import org.springframework.integration.mqtt.support.MqttHeaders;
 import org.springframework.messaging.*;
 
+import javax.annotation.Resource;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -36,18 +39,18 @@ import java.util.concurrent.TimeUnit;
 public class MqttConfig {
     static Logger logger = LoggerFactory.getLogger(MqttConfig.class);
 
-    @Autowired
+    @Resource
     private RedisService redisService;
 
-    @Autowired
+    @Resource
     private MqttSend mqttSend;
 
-    @Autowired
+    @Resource
     private IFireDeviceLogService deviceLogService;
 
     private static final byte[] WILL_DATA;
 
-    private static String WILL_TOPIC = "willTopic";
+    private static String WILL_TOPIC = "alert";
 
     static {
         WILL_DATA = "offline".getBytes();
@@ -56,7 +59,7 @@ public class MqttConfig {
     public static final String MQTT_INBOUND_CHANNEL = "mqttInboundChannel";
 
 
-    public static final String MQTT_OUTBOUND_CHANNEL = "mqttInboundChannel";
+    public static final String MQTT_OUTBOUND_CHANNEL = "mqttOutboundChannel";
 
     @Value("${mqtt.username}")
     private String username;
@@ -79,9 +82,6 @@ public class MqttConfig {
     @Value("${mqtt.consumer.maxInflight}")
     private Integer maxInflight;
 
-    private MqttPahoMessageDrivenChannelAdapter adapter;
-
-
     /**
      * 连接mqtt配置
      *
@@ -150,7 +150,7 @@ public class MqttConfig {
     @Bean
     public MessageProducer inbound() {
         // 可同时消费(订阅)多个Topic
-        adapter = new MqttPahoMessageDrivenChannelAdapter(consumerClientId, mqttClientFactory(), StringUtils.split(defaultTopic, ","));
+        MqttPahoMessageDrivenChannelAdapter adapter = new MqttPahoMessageDrivenChannelAdapter(consumerClientId, mqttClientFactory(), StringUtils.split(defaultTopic, ","));
         adapter.setCompletionTimeout(5000);
         adapter.setConverter(new DefaultPahoMessageConverter());
         adapter.setQos(2);
@@ -176,49 +176,44 @@ public class MqttConfig {
      *
      * @return
      */
-    @Bean
-    @ServiceActivator(inputChannel = MQTT_INBOUND_CHANNEL)
+    //@Bean
+    //@ServiceActivator(inputChannel = MQTT_INBOUND_CHANNEL)
     public MessageHandler mqttInbound() {
 
-        return new MessageHandler() {
-            @Override
-            public void handleMessage(Message<?> message) throws MessagingException {
-                MessageHeaders messageHeaders = message.getHeaders();
-                //String receivedTopic = (String) messageHeaders.get(MqttHeaders.RECEIVED_TOPIC);
-                String receivedTopic = (String) messageHeaders.get(MqttHeaders.TOPIC);
-//                logger.info("[通道] - [{}]",receivedTopic);
-//                logger.info("[消息] - [{}]",message.getPayload());
-                String messageStr = message.getPayload().toString();
-//                logger.info("======= receivedTopic:" + receivedTopic + " messageStr:" + messageStr);
-                if (receivedTopic.startsWith(MqttConstants.TOPIC_FIRE_DEVICE_RECEIVE)) {
-                    logger.info("灭火设备消息消费,receivedTopic:" + receivedTopic + " messageStr:" + messageStr);
-                    receivedTopic = receivedTopic.substring(receivedTopic.lastIndexOf("/") + 1, receivedTopic.length());
-                    //根据状态指令获取主机状态
-                    JSONObject jsonObject = FireLaborUtil.getFireStatus(messageStr);
-                    Integer fireNumber = Integer.valueOf(jsonObject.get("fireNumber").toString());
-                    //灭火主机发生预警
-                    if (fireNumber > 0) {
-                        logger.info("灭火设备传感器异常,通知预案,状态:" + jsonObject.toJSONString());
-                        mqttSend.send(MqttConstants.TOPIC_FIRE_DEVICE_WARN,jsonObject.toJSONString());
-                        //自动灭火
-                        if (fireNumber == 2) {
-                            //redis中是否已存在日志已添加标识
-                            String isExist = redisService.getCacheObject(FireDeviceStatusTask.TOPIC_OUTFIRE_ISEXIST);
-                            if(StringUtils.isEmpty(isExist)){
-                                //自动灭火日志添加
-                                String str = deviceLogService.insertFireAutomatic(receivedTopic);
-                                //redis存值,灭火日志已经添加标识
-                                redisService.setCacheObject(FireDeviceStatusTask.TOPIC_OUTFIRE_ISEXIST, str, 60L, TimeUnit.MINUTES);
-                                logger.info("自动灭火日志添加执行结果," + str);
-                            }
+        return message -> {
+            logger.info("=========>>> [消息头] - [{}]", message.getHeaders()+",[消息内容]: " + message.getPayload());
+            MessageHeaders messageHeaders = message.getHeaders();
+            String receivedTopic = (String) messageHeaders.get(MqttHeaders.TOPIC);
+            String messageStr = message.getPayload().toString();
+            /*if (receivedTopic.startsWith(MqttConstants.TOPIC_FIRE_DEVICE_RECEIVE)) {
+                logger.info("灭火设备消息消费,receivedTopic:" + receivedTopic + " messageStr:" + messageStr);
+                receivedTopic = receivedTopic.substring(receivedTopic.lastIndexOf("/") + 1, receivedTopic.length());
+                //根据状态指令获取主机状态
+                JSONObject jsonObject = FireLaborUtil.getFireStatus(messageStr);
+                Integer fireNumber = Integer.valueOf(jsonObject.get("fireNumber").toString());
+                //灭火主机发生预警
+                if (fireNumber > 0) {
+                    logger.info("灭火设备传感器异常,通知预案,状态:" + jsonObject.toJSONString());
+                    //发现灭火设备异常,发送消息通知
+                    mqttSend.send(MqttConstants.TOPIC_FIRE_DEVICE_WARN+receivedTopic,jsonObject.toJSONString());
+                    //自动灭火
+                    if (fireNumber == 2) {
+                        //redis中是否已存在日志已添加标识
+                        String isExist = redisService.getCacheObject(CacheConstants.FIRE_LOG_IS_EXIST);
+                        if(StringUtils.isEmpty(isExist)){
+                            //自动灭火日志添加
+                            String str = deviceLogService.insertFireAutomatic(receivedTopic);
+                            //redis存值,灭火日志已经添加标识
+                            redisService.setCacheObject(CacheConstants.FIRE_LOG_IS_EXIST, str, 60L, TimeUnit.MINUTES);
+                            logger.info("自动灭火日志添加执行结果," + str);
                         }
                     }
-                    //redis存值 采集器编号:主机状态json
-                    redisService.setCacheObject(receivedTopic, jsonObject, 1L, TimeUnit.MINUTES);
-                    //redis存值 灭火主机响应时间
-                    redisService.setCacheObject(FireDeviceStatusTask.TOPIC_FD_RESPOND_TIME, System.currentTimeMillis(), 1L, TimeUnit.MINUTES);
                 }
-            }
+                //redis存值 采集器编号:主机状态json
+                redisService.setCacheObject(receivedTopic, jsonObject, 1L, TimeUnit.MINUTES);
+                //redis存值 灭火主机响应时间
+                redisService.setCacheObject(CacheConstants.FIRE_DEVICE_RESPOND_TIME, System.currentTimeMillis(), 1L, TimeUnit.MINUTES);
+            }*/
         };
     }
 

+ 1 - 0
zd-modules/zd-algorithm/src/main/resources/mapper/fire/FireDeviceMapper.xml

@@ -58,6 +58,7 @@
             <if test="deviceUrl != null and deviceUrl != ''">and fd.device_url = #{deviceUrl}</if>
             <if test="deviceCountDown != null ">and fd.device_count_down =#{deviceCountDown}</if>
             <if test="deviceStatus != null ">and fd.device_status = #{deviceStatus}</if>
+            <if test="subjectId != null ">and fd.subject_id = #{subjectId}</if>
             ${params.dataScope}
         </where>
         order by fd.create_time desc

+ 0 - 15
zd-modules/zd-chemical/pom.xml

@@ -25,18 +25,6 @@
             <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
         </dependency>
 
-        <!-- SpringCloud Alibaba Sentinel -->
-        <!--<dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
-        </dependency>
-
-        &lt;!&ndash; SpringBoot Actuator &ndash;&gt;
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>-->
-
         <!-- Mysql Connector -->
         <dependency>
             <groupId>mysql</groupId>
@@ -129,9 +117,6 @@
         <dependency>
             <groupId>com.thoughtworks.xstream</groupId>
             <artifactId>com.springsource.com.thoughtworks.xstream</artifactId>
-            <!--<groupId>com.thoughtworks.xstream</groupId>
-            <artifactId>com.springsource.com.thoughtworks.xstream</artifactId>-->
-
             <version>1.3.1</version>
             <scope>system</scope>
             <systemPath>${pom.basedir}/src/main/resources/libs/sms-syd/xstream-1.3.1.jar</systemPath>

+ 75 - 54
zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/ActHxpapplyController.java

@@ -3,6 +3,7 @@ package com.zd.chemical.controller;
 import com.zd.chemical.domain.ActHxpapply;
 import com.zd.chemical.domain.vo.*;
 import com.zd.chemical.service.IActHxpapplyService;
+import com.zd.chemical.util.ChemicalUtils;
 import com.zd.common.core.annotation.Log;
 import com.zd.common.core.annotation.PreAuthorize;
 import com.zd.common.core.log.BusinessType;
@@ -34,22 +35,26 @@ import java.util.Optional;
 @RestController
 @Api(tags = "【化学品申购】")
 @RequestMapping("/hxpapply")
-public class ActHxpapplyController extends BaseController<ActHxpapply>
-{
+public class ActHxpapplyController extends BaseController<ActHxpapply> {
     @Autowired
     private IActHxpapplyService actHxpapplyService;
 
     /**
      * 查询化学品申购列表
      */
-    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY+ PerFun.LIST)
+    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY + PerFun.LIST)
     @GetMapping("/list")
     @ApiOperation(value = "查询化学品申购列表")
-    public TableDataInfo<ActHxpapplyListVo> list(ActHxpapplySearch actHxpapplySearch)
-    {
+    public TableDataInfo<ActHxpapplyListVo> list(ActHxpapplySearch actHxpapplySearch) {
         startPage();
         List<ActHxpapplyListVo> list = actHxpapplyService.selectActHxpapplyList(actHxpapplySearch);
-        TableDataInfo<ActHxpapplyListVo> info=new TableDataInfo<>();
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalNames(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalNames()));
+            });
+        }
+        TableDataInfo<ActHxpapplyListVo> info = new TableDataInfo<>();
         info.getDataTable(list);
         return info;
     }
@@ -58,15 +63,20 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
     /**
      * 查询化学品申购列表(草稿箱)
      */
-    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY+ PerFun.DRAFTSLIST)
+    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY + PerFun.DRAFTSLIST)
     @GetMapping("/draftsList")
     @ApiOperation(value = "查询化学品申购列表(草稿箱)")
-    public TableDataInfo<ActHxpapplyDraftsListVo> draftsList(ActHxpapplySearch actHxpapplySearch)
-    {
+    public TableDataInfo<ActHxpapplyDraftsListVo> draftsList(ActHxpapplySearch actHxpapplySearch) {
         actHxpapplySearch.setUserId(SecurityUtils.getUserId());
         startPage();
         List<ActHxpapplyDraftsListVo> list = actHxpapplyService.draftsList(actHxpapplySearch);
-        TableDataInfo<ActHxpapplyDraftsListVo> info=new TableDataInfo<>();
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalNames(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalNames()));
+            });
+        }
+        TableDataInfo<ActHxpapplyDraftsListVo> info = new TableDataInfo<>();
         info.getDataTable(list);
         return info;
     }
@@ -77,12 +87,17 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
      */
     @GetMapping("/myList")
     @ApiOperation(value = "查询化学品申购列表")
-    public TableDataInfo<ActHxpapplyListVo> mylist(ActHxpapplySearch actHxpapplySearch)
-    {
+    public TableDataInfo<ActHxpapplyListVo> mylist(ActHxpapplySearch actHxpapplySearch) {
         startPage();
         actHxpapplySearch.setUserId(SecurityUtils.getUserId());
         List<ActHxpapplyListVo> list = actHxpapplyService.selectActHxpapplyList(actHxpapplySearch);
-        TableDataInfo<ActHxpapplyListVo> info=new TableDataInfo<>();
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalNames(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalNames()));
+            });
+        }
+        TableDataInfo<ActHxpapplyListVo> info = new TableDataInfo<>();
         info.getDataTable(list);
         return info;
     }
@@ -93,12 +108,11 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
      */
     @GetMapping("/myDraftsList")
     @ApiOperation(value = "查询化学品申购列表(草稿箱)")
-    public TableDataInfo<ActHxpapplyDraftsListVo> myDraftsList(ActHxpapplySearch actHxpapplySearch)
-    {
+    public TableDataInfo<ActHxpapplyDraftsListVo> myDraftsList(ActHxpapplySearch actHxpapplySearch) {
         startPage();
         actHxpapplySearch.setUserId(SecurityUtils.getUserId());
         List<ActHxpapplyDraftsListVo> list = actHxpapplyService.draftsList(actHxpapplySearch);
-        TableDataInfo<ActHxpapplyDraftsListVo> info=new TableDataInfo<>();
+        TableDataInfo<ActHxpapplyDraftsListVo> info = new TableDataInfo<>();
         info.getDataTable(list);
         return info;
     }
@@ -107,34 +121,33 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
      * 导出化学品申购列表
      */
     @ApiOperation(value = "导出化学品申购列表")
-    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY+ PerFun.EXPORT)
+    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY + PerFun.EXPORT)
     @Log(title = "化学品申购", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, ActHxpapplySearch actHxpapplySearch) throws IOException
-    {
+    public void export(HttpServletResponse response, ActHxpapplySearch actHxpapplySearch) throws IOException {
         List<ActHxpapplyListVo> list = actHxpapplyService.selectActHxpapplyList(actHxpapplySearch);
         Optional.ofNullable(list).orElseGet(Collections::emptyList)
                 .stream()
-                .forEach(a->{
+                .forEach(a -> {
                     StringBuffer currentApprover = new StringBuffer();
                     Optional.ofNullable(a.getCurrentUserList()).orElseGet(Collections::emptyList)
                             .stream()
-                            .forEach(b->{
+                            .forEach(b -> {
                                 currentApprover.append(",");
                                 currentApprover.append(b.get("name"));
                             });
-                    if(currentApprover.length()>0){
+                    if (currentApprover.length() > 0) {
                         a.setCurrentApprover(currentApprover.substring(1));
                     }
 
                     StringBuffer historyApprover = new StringBuffer();
                     Optional.ofNullable(a.getHistoryUserList()).orElseGet(Collections::emptyList)
                             .stream()
-                            .forEach(b->{
+                            .forEach(b -> {
                                 historyApprover.append(",");
                                 historyApprover.append(b.get("name"));
                             });
-                    if(historyApprover.length()>0){
+                    if (historyApprover.length() > 0) {
                         a.setHistoryApprover(historyApprover.substring(1));
                     }
                 });
@@ -146,22 +159,31 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
      * 获取化学品申购详细信息
      */
     @ApiOperation(value = "获取化学品申购详细信息")
-    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY+ PerFun.QUERY)
+    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY + PerFun.QUERY)
     @GetMapping(value = "/{id}")
-    public ResultData<ActHxpapplyInfoVo> getInfo(@PathVariable("id") Long id)
-    {
-        return ResultData.success(actHxpapplyService.selectActHxpapplyById(id,2));
+    public ResultData<ActHxpapplyInfoVo> getInfo(@PathVariable("id") Long id) {
+        ActHxpapplyInfoVo vo = actHxpapplyService.selectActHxpapplyById(id, 2);
+        //去除无效小数点
+        if (vo != null) {
+            List <ActHxpapplyDetailVo> list = vo.getActHxpapplyDetailList();
+            if (list != null && list.size() > 0) {
+                list.stream().forEach(detailVo -> {
+                    detailVo.setApplyNum(ChemicalUtils.removeZeroForAfterPoint(detailVo.getApplyNum()));
+                    detailVo.setRemainingStorage(ChemicalUtils.removeZeroForAfterPoint(detailVo.getRemainingStorage()));
+                });
+            }
+        }
+        return ResultData.success(vo);
     }
 
     /**
      * 获取化学品申购详细信息(审批记录调用)
      */
     @ApiOperation(value = "获取化学品申购详细信息")
-    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLYAUDIT+ PerFun.QUERY)
+    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLYAUDIT + PerFun.QUERY)
     @GetMapping(value = "/audit/{id}")
-    public ResultData<ActHxpapplyInfoVo> auditByGetInfo(@PathVariable("id") Long id)
-    {
-        return ResultData.success(actHxpapplyService.selectActHxpapplyById(id,1));
+    public ResultData<ActHxpapplyInfoVo> auditByGetInfo(@PathVariable("id") Long id) {
+        return ResultData.success(actHxpapplyService.selectActHxpapplyById(id, 1));
     }
 
     /**
@@ -169,9 +191,8 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
      */
     @ApiOperation(value = "获取化学品申购详细信息(学生端接口)")
     @GetMapping(value = "/myInfo/{id}")
-    public ResultData<ActHxpapplyInfoVo> getMyInfo(@PathVariable("id") Long id)
-    {
-        return ResultData.success(actHxpapplyService.selectActHxpapplyById(id,2));
+    public ResultData<ActHxpapplyInfoVo> getMyInfo(@PathVariable("id") Long id) {
+        return ResultData.success(actHxpapplyService.selectActHxpapplyById(id, 2));
     }
 
 
@@ -179,11 +200,10 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
      * 新增化学品申购
      */
     @ApiOperation(value = "新增化学品申购")
-    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY+ PerFun.ADD)
+    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY + PerFun.ADD)
     @Log(title = "化学品申购", businessType = BusinessType.INSERT)
     @PostMapping
-    public ResultData add(@RequestBody ActHxpapplyVo actHxpapplyVo)
-    {
+    public ResultData add(@RequestBody ActHxpapplyVo actHxpapplyVo) {
         return ResultData.result(actHxpapplyService.insertActHxpapply(actHxpapplyVo));
     }
 
@@ -193,8 +213,7 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
     @ApiOperation(value = "新增化学品申购(学生端接口)")
     @Log(title = "化学品申购", businessType = BusinessType.INSERT)
     @PostMapping("/myadd")
-    public ResultData myadd(@RequestBody ActHxpapplyVo actHxpapplyVo)
-    {
+    public ResultData myadd(@RequestBody ActHxpapplyVo actHxpapplyVo) {
         return ResultData.result(actHxpapplyService.insertActHxpapply(actHxpapplyVo));
     }
 
@@ -205,20 +224,18 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
 //    @PreAuthorize(hasPermi = "laboratory:hxpapply:edit")
     @Log(title = "化学品申购", businessType = BusinessType.UPDATE)
     @PutMapping
-    public ResultData edit(@RequestBody ActHxpapply actHxpapply)
-    {
-        return  ResultData.result(actHxpapplyService.updateActHxpapply(actHxpapply));
+    public ResultData edit(@RequestBody ActHxpapply actHxpapply) {
+        return ResultData.result(actHxpapplyService.updateActHxpapply(actHxpapply));
     }
 
     /**
      * 删除化学品申购
      */
     @ApiOperation(value = "删除化学品申购")
-    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY+ PerFun.REMOVE)
+    @PreAuthorize(hasPermi = PerPrefix.ACT_HXP_APPLY + PerFun.REMOVE)
     @Log(title = "化学品申购", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public ResultData remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public ResultData remove(@PathVariable Long[] ids) {
         return ResultData.result(actHxpapplyService.deleteActHxpapplyByIds(ids));
     }
 
@@ -229,8 +246,7 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
     @ApiOperation(value = "删除化学品申购(学生端接口)")
     @Log(title = "化学品申购", businessType = BusinessType.DELETE)
     @DeleteMapping("/myDel/{ids}")
-    public ResultData myDel(@PathVariable Long[] ids)
-    {
+    public ResultData myDel(@PathVariable Long[] ids) {
         return ResultData.result(actHxpapplyService.deleteActHxpapplyByIds(ids));
     }
 
@@ -240,8 +256,7 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
      */
     @ApiOperation(value = "获取化学品剩余可存放量")
     @GetMapping(value = "/getRestStock")
-    public ResultData<Map <String, String>> getRestStock(ActRestStockVo actRestStockVo)
-    {
+    public ResultData<Map<String, String>> getRestStock(ActRestStockVo actRestStockVo) {
         return ResultData.success(actHxpapplyService.getRestStock(actRestStockVo));
     }
 
@@ -251,8 +266,14 @@ public class ActHxpapplyController extends BaseController<ActHxpapply>
      */
     @ApiOperation(value = "获取化学品剩余可存放量")
     @GetMapping(value = "/getRestStockByManyCabinet")
-    public ResultData<List<ActRestStockManyVo>> getRestStockByManyCabinet(ActRestStockManySearch actRestStockVo)
-    {
-        return ResultData.success(actHxpapplyService.getRestStockByManyCabinet(actRestStockVo));
+    public ResultData<List<ActRestStockManyVo>> getRestStockByManyCabinet(ActRestStockManySearch actRestStockVo) {
+        List<ActRestStockManyVo> list = actHxpapplyService.getRestStockByManyCabinet(actRestStockVo);
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setRestStock(ChemicalUtils.removeZeroForAfterPoint(vo.getRestStock()));
+            });
+        }
+        return ResultData.success(list);
     }
 }

+ 37 - 0
zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpAIOController.java

@@ -5,6 +5,7 @@ import com.zd.chemical.domain.HxpStock;
 import com.zd.chemical.domain.HxpUserecord;
 import com.zd.chemical.domain.vo.*;
 import com.zd.chemical.service.*;
+import com.zd.chemical.util.ChemicalUtils;
 import com.zd.common.core.annotation.Log;
 import com.zd.common.core.exception.ServiceException;
 import com.zd.common.core.log.BusinessType;
@@ -189,6 +190,13 @@ public class HxpAIOController extends BaseController {
     @ApiOperation(value = "领用化学品")
     public R<HxpUserecord> addUserecord(@RequestBody @Valid HxpUserecord hxpUserecord) {
         hxpUserecord = hxpUserecordService.insertHxpUserecord(hxpUserecord);
+        //小数点末尾去0处理
+        if (hxpUserecord != null) {
+            hxpUserecord.setLossAmount(ChemicalUtils.removeZeroForAfterPoint(hxpUserecord.getLossAmount()));
+            hxpUserecord.setCollectNowNum(ChemicalUtils.removeZeroForAfterPoint(hxpUserecord.getCollectNowNum()));
+            hxpUserecord.setCollectStockNum(ChemicalUtils.removeZeroForAfterPoint(hxpUserecord.getCollectStockNum()));
+            hxpUserecord.setReturnStockNum(ChemicalUtils.removeZeroForAfterPoint(hxpUserecord.getReturnStockNum()));
+        }
         return R.ok(hxpUserecord);
     }
 
@@ -223,6 +231,20 @@ public class HxpAIOController extends BaseController {
             }
             hxpStock.setHxpUserecord(userecordList.get(0));
 
+            //新加:去除末尾多余的0
+            hxpStock.setSuttle(ChemicalUtils.removeZeroForAfterPoint(hxpStock.getSuttle()));
+            hxpStock.setChemicalAmount(ChemicalUtils.removeZeroForAfterPoint(hxpStock.getChemicalAmount()));
+            hxpStock.setUsages(ChemicalUtils.removeZeroForAfterPoint(hxpStock.getUsages()));
+            hxpStock.setOutUsages(ChemicalUtils.removeZeroForAfterPoint(hxpStock.getOutUsages()));
+            hxpStock.setTare(ChemicalUtils.removeZeroForAfterPoint(hxpStock.getTare()));
+            //领用信息
+            HxpUserecord userecord = hxpStock.getHxpUserecord();
+            if (userecord != null) {
+                userecord.setLossAmount(ChemicalUtils.removeZeroForAfterPoint(userecord.getLossAmount()));
+                userecord.setCollectNowNum(ChemicalUtils.removeZeroForAfterPoint(userecord.getCollectNowNum()));
+                userecord.setCollectStockNum(ChemicalUtils.removeZeroForAfterPoint(userecord.getCollectStockNum()));
+                userecord.setReturnStockNum(ChemicalUtils.removeZeroForAfterPoint(userecord.getReturnStockNum()));
+            }
         }else {
             return R.fail("当前化学品已过期或不存在!");
         }
@@ -260,6 +282,14 @@ public class HxpAIOController extends BaseController {
         aioUserecordVo.setUserId(SecurityUtils.getUserId());
         startPage();
         List<AioUserecordVo> list = hxpUserecordService.queryRecordList(aioUserecordVo);
+        //小数点后去0处理
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setUseStockNum(ChemicalUtils.removeZeroForAfterPoint(vo.getUseStockNum()));
+                vo.setCollectStockNum(ChemicalUtils.removeZeroForAfterPoint(vo.getCollectStockNum()));
+                vo.setReturnStockNum(ChemicalUtils.removeZeroForAfterPoint(vo.getReturnStockNum()));
+            });
+        }
         return getDataTable(list);
     }
 
@@ -324,6 +354,13 @@ public class HxpAIOController extends BaseController {
         aioChemicalVo.setSubId(getSubIdByTerminalNum());
         startPage();
         List<AioChemicalVo> list = hxpCabinetJoinCabinetService.selectChemicalVoList(aioChemicalVo);
+        //小数点后去0 处理
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalAmount(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalAmount()));
+                vo.setTare(ChemicalUtils.removeZeroForAfterPoint(vo.getTare()));
+            });
+        }
         return getDataTable(list);
     }
 

+ 15 - 0
zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpCabinetController.java

@@ -1,10 +1,12 @@
 package com.zd.chemical.controller;
 
 import com.zd.chemical.domain.HxpCabinet;
+import com.zd.chemical.domain.vo.HxpCabinetInclusionChemicalSon;
 import com.zd.chemical.domain.vo.HxpCabinetInclusionChemicalVo;
 import com.zd.chemical.domain.vo.HxpCabinetSearch;
 import com.zd.chemical.domain.vo.HxpCabinetVo;
 import com.zd.chemical.service.IHxpCabinetService;
+import com.zd.chemical.util.ChemicalUtils;
 import com.zd.common.core.annotation.Log;
 import com.zd.common.core.annotation.PreAuthorize;
 import com.zd.common.core.exception.ServiceException;
@@ -136,6 +138,19 @@ public class HxpCabinetController extends BaseController {
     public TableDataInfo<HxpCabinetInclusionChemicalVo> getCabinetByChemical(HxpCabinetSearch hxpCabinetSearch) {
         startPage();
         List<HxpCabinetInclusionChemicalVo> list = hxpCabinetService.getCabinetByChemical(hxpCabinetSearch);
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setTotalStock(ChemicalUtils.removeZeroForAfterPoint(vo.getTotalStock()));
+                List <HxpCabinetInclusionChemicalSon> voList = vo.getHxpCabinetInclusionChemicalSonList();
+                if (voList != null && voList.size() > 0) {
+                    voList.stream().forEach(son -> {
+                        son.setChemicalAmountUnit(ChemicalUtils.removeZeroForAfterPoint(son.getChemicalAmountUnit()));
+                        son.setOutUsages(ChemicalUtils.removeZeroForAfterPoint(son.getOutUsages()));
+                    });
+                }
+            });
+        }
         return getDataTable(list);
     }
 

+ 15 - 0
zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpChemicalJoinCabinetController.java

@@ -7,6 +7,7 @@ import javax.servlet.http.HttpServletResponse;
 import com.zd.chemical.domain.vo.HxpChemicalJoinCabinetListVo;
 import com.zd.chemical.domain.vo.HxpChemicalJoinCabinetSearch;
 import com.zd.chemical.domain.vo.HxpChemicalJoinCabinetVo;
+import com.zd.chemical.util.ChemicalUtils;
 import com.zd.model.domain.per.PerFun;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.common.core.utils.SecurityUtils;
@@ -54,6 +55,13 @@ public class HxpChemicalJoinCabinetController extends BaseController {
     public TableDataInfo<HxpChemicalJoinCabinetListVo> list(HxpChemicalJoinCabinetSearch hxpChemicalJoinCabinetSearch) {
         startPage();
         List<HxpChemicalJoinCabinetListVo> list = hxpChemicalJoinCabinetService.selectHxpChemicalJoinCabinetList(hxpChemicalJoinCabinetSearch);
+        //去除多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalAmountUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalAmountUnit()));
+                vo.setTare(ChemicalUtils.removeZeroForAfterPoint(vo.getTare()));
+            });
+        }
         return getDataTable(list);
     }
 
@@ -63,6 +71,13 @@ public class HxpChemicalJoinCabinetController extends BaseController {
         startPage();
         hxpChemicalJoinCabinetSearch.setUserId(SecurityUtils.getUserId());
         List<HxpChemicalJoinCabinetListVo> list = hxpChemicalJoinCabinetService.selectHxpChemicalJoinCabinetList(hxpChemicalJoinCabinetSearch);
+        //去除多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalAmountUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalAmountUnit()));
+                vo.setTare(ChemicalUtils.removeZeroForAfterPoint(vo.getTare()));
+            });
+        }
         return getDataTable(list);
     }
 

+ 7 - 1
zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpHomePageStatisticsController.java

@@ -5,6 +5,7 @@ import com.zd.chemical.domain.HxpStock;
 import com.zd.chemical.domain.vo.*;
 import com.zd.chemical.service.IHxpAlarmRecordService;
 import com.zd.chemical.service.IHxpChemicalService;
+import com.zd.chemical.util.ChemicalUtils;
 import com.zd.model.domain.per.PerFun;
 import com.zd.model.domain.per.PerPrefix;
 import com.zd.common.core.web.controller.BaseController;
@@ -58,7 +59,6 @@ public class HxpHomePageStatisticsController extends BaseController {
         return ResultData.success(hxpHomeChemicalVo);
     }
 
-
     /**
      * 化学品使用量top6
      */
@@ -67,6 +67,12 @@ public class HxpHomePageStatisticsController extends BaseController {
     @ApiOperation(value = "查询化学品信息列表")
     public ResultData chemicalUsagesCount(HxpChemical hxpChemical) {
         List<HxpHomeChemicalUsagesVo> hxpHomeChemicalVo = hxpChemicalService.chemicalUsagesCount(hxpChemical);
+        //去除小数点后多余的0
+        if (hxpHomeChemicalVo != null && hxpHomeChemicalVo.size() > 0) {
+            hxpHomeChemicalVo.stream().forEach(vo -> {
+                vo.setChemicalUsages(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalUsages()));
+            });
+        }
         return ResultData.success(hxpHomeChemicalVo);
     }
 

+ 43 - 0
zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpStockController.java

@@ -6,6 +6,7 @@ import com.zd.chemical.domain.vo.HxpStockJoinVO;
 import com.zd.chemical.domain.vo.HxpStockOutVO;
 import com.zd.chemical.domain.vo.HxpStockSearch;
 import com.zd.chemical.service.IHxpStockService;
+import com.zd.chemical.util.ChemicalUtils;
 import com.zd.chemical.util.SmsSydUtil;
 import com.zd.common.core.annotation.Log;
 import com.zd.common.core.annotation.PreAuthorize;
@@ -85,6 +86,15 @@ public class HxpStockController extends BaseController {
     public TableDataInfo<HxpStockDetailVO> listDetail(HxpStockSearch hxpStockSearch) {
         startPage();
         List<HxpStockDetailVO> list = hxpStockService.selectHxpStockListDetail(hxpStockSearch);
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalAmountUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalAmountUnit()));
+                vo.setTareUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getTareUnit()));
+                vo.setOutUsages(ChemicalUtils.removeZeroForAfterPoint(vo.getOutUsages()));
+                vo.setUsages(ChemicalUtils.removeZeroForAfterPoint(vo.getUsages()));
+            });
+        }
         return getDataTable(list);
     }
 
@@ -117,6 +127,15 @@ public class HxpStockController extends BaseController {
     public TableDataInfo<HxpStockJoinVO> listJoin(HxpStockSearch hxpStockSearch) {
         startPage();
         List<HxpStockJoinVO> list = hxpStockService.selectHxpStockListJoin(hxpStockSearch);
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalAmountUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalAmountUnit()));
+                vo.setTareUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getTareUnit()));
+                vo.setOutUsages(ChemicalUtils.removeZeroForAfterPoint(vo.getOutUsages()));
+                vo.setUsages(ChemicalUtils.removeZeroForAfterPoint(vo.getUsages()));
+            });
+        }
         return getDataTable(list);
     }
 
@@ -126,6 +145,14 @@ public class HxpStockController extends BaseController {
         startPage();
         hxpStockSearch.setLoginUserId(SecurityUtils.getUserId());
         List<HxpStockJoinVO> list = hxpStockService.selectHxpStockListJoin(hxpStockSearch);
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalAmountUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalAmountUnit()));
+                vo.setTareUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getTareUnit()));
+                vo.setUsages(ChemicalUtils.removeZeroForAfterPoint(vo.getUsages()));
+            });
+        }
         return getDataTable(list);
     }
 
@@ -165,6 +192,14 @@ public class HxpStockController extends BaseController {
         }else{
             list = hxpStockService.selectHxpStockListOut(hxpStockSearch);
         }
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalAmountUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalAmountUnit()));
+                vo.setTareUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getTareUnit()));
+                vo.setOutUsages(ChemicalUtils.removeZeroForAfterPoint(vo.getOutUsages()));
+            });
+        }
         return getDataTable(list);
     }
 
@@ -175,6 +210,14 @@ public class HxpStockController extends BaseController {
         startPage();
         hxpStockSearch.setLoginUserId(SecurityUtils.getUserId());
         List<HxpStockOutVO> list = hxpStockService.selectHxpStockListOut(hxpStockSearch);
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalAmountUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalAmountUnit()));
+                vo.setTareUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getTareUnit()));
+                vo.setOutUsages(ChemicalUtils.removeZeroForAfterPoint(vo.getOutUsages()));
+            });
+        }
         return getDataTable(list);
     }
 

+ 43 - 1
zd-modules/zd-chemical/src/main/java/com/zd/chemical/controller/HxpUserecordController.java

@@ -3,6 +3,7 @@ package com.zd.chemical.controller;
 import com.zd.chemical.domain.HxpUserecord;
 import com.zd.chemical.domain.vo.*;
 import com.zd.chemical.service.IHxpUserecordService;
+import com.zd.chemical.util.ChemicalUtils;
 import com.zd.chemical.util.SmsSydUtil;
 import com.zd.model.domain.R;
 import com.zd.model.domain.per.PerFun;
@@ -65,6 +66,17 @@ public class HxpUserecordController extends BaseController {
     public TableDataInfo<HxpUserecordVo> getHxpUserecordList(HxpUserecordSearch hxpUserecordSearch) {
         startPage();
         List<HxpUserecordVo> list = hxpUserecordService.getHxpUserecordList(hxpUserecordSearch);
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalAmountUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalAmountUnit()));
+                vo.setCollectStockNum(ChemicalUtils.removeZeroForAfterPoint(vo.getCollectStockNum()));
+                vo.setCollectWeigh(ChemicalUtils.removeZeroForAfterPoint(vo.getCollectWeigh()));
+                vo.setLossAmount(ChemicalUtils.removeZeroForAfterPoint(vo.getLossAmount()));
+                vo.setReturnStockNum(ChemicalUtils.removeZeroForAfterPoint(vo.getReturnStockNum()));
+                vo.setUseStockNum(ChemicalUtils.removeZeroForAfterPoint(vo.getUseStockNum()));
+            });
+        }
         return getDataTable(list);
     }
 
@@ -74,6 +86,17 @@ public class HxpUserecordController extends BaseController {
         startPage();
         hxpUserecordSearch.setLoginUserId(tokenService.getLoginUser().getUserid());
         List<HxpUserecordVo> list = hxpUserecordService.getHxpUserecordList(hxpUserecordSearch);
+        //去除小数点后多余的0
+        if (list != null && list.size() > 0) {
+            list.stream().forEach(vo -> {
+                vo.setChemicalAmountUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalAmountUnit()));
+                vo.setCollectStockNum(ChemicalUtils.removeZeroForAfterPoint(vo.getCollectStockNum()));
+                vo.setCollectWeigh(ChemicalUtils.removeZeroForAfterPoint(vo.getCollectWeigh()));
+                vo.setLossAmount(ChemicalUtils.removeZeroForAfterPoint(vo.getLossAmount()));
+                vo.setUseStockNum(ChemicalUtils.removeZeroForAfterPoint(vo.getUseStockNum()));
+                vo.setReturnStockNum(ChemicalUtils.removeZeroForAfterPoint(vo.getReturnStockNum()));
+            });
+        }
         return getDataTable(list);
     }
 
@@ -83,7 +106,26 @@ public class HxpUserecordController extends BaseController {
     @ApiOperation(value = "获取化学品使用记录详细信息")
     @GetMapping(value = "/queryDetail/{id}")
     public R<HxpUserecordDetailVo> queryDetailById(@PathVariable("id") Long id) {
-        return R.ok(hxpUserecordService.queryDetailById(id));
+        HxpUserecordDetailVo vo = hxpUserecordService.queryDetailById(id);
+        //小数点后多余0处理
+        if (vo != null) {
+            vo.setChemicalAmountUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getChemicalAmountUnit()));
+            vo.setTareUnit(ChemicalUtils.removeZeroForAfterPoint(vo.getTareUnit()));
+            //领用
+            HxpUserecordDetailVo.OutDetail outDetail = vo.getOutDetail();
+            if (outDetail != null) {
+                outDetail.setStockSuttle(ChemicalUtils.removeZeroForAfterPoint(outDetail.getStockSuttle()));
+                outDetail.setLossAmount(ChemicalUtils.removeZeroForAfterPoint(outDetail.getLossAmount()));
+                outDetail.setCollectSuttle(ChemicalUtils.removeZeroForAfterPoint(outDetail.getCollectSuttle()));
+            }
+            //归还
+            HxpUserecordDetailVo.ReturnDetail returnDetail = vo.getReturnDetail();
+            if (returnDetail != null) {
+                returnDetail.setUseStockNum(ChemicalUtils.removeZeroForAfterPoint(returnDetail.getUseStockNum()));
+                returnDetail.setReturnSuttle(ChemicalUtils.removeZeroForAfterPoint(returnDetail.getReturnSuttle()));
+            }
+        }
+        return R.ok(vo);
     }
 
     /**

+ 1 - 2
zd-modules/zd-chemical/src/main/java/com/zd/chemical/domain/vo/ActHxpapplyInfoVo.java

@@ -23,8 +23,7 @@ import java.util.List;
  */
 @ApiModel("化学品申请单")
 @Data
-public class ActHxpapplyInfoVo extends BaseEntity
-{
+public class ActHxpapplyInfoVo extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
     /** 主键id */

+ 2 - 2
zd-modules/zd-chemical/src/main/java/com/zd/chemical/domain/vo/HxpUserecordDetailVo.java

@@ -67,7 +67,7 @@ public class HxpUserecordDetailVo {
     @ApiModelProperty(value = "归还信息")
     private ReturnDetail  returnDetail;
 
-    static class OutDetail {
+    public static class OutDetail {
         @ApiModelProperty(value = "领用时库存净重")
         private String stockSuttle;
 
@@ -149,7 +149,7 @@ public class HxpUserecordDetailVo {
         }
     }
 
-    static class ReturnDetail {
+    public static class ReturnDetail {
         @ApiModelProperty(value = "本次使用量")
         private String useStockNum;
 

+ 9 - 4
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/ActHxpapplyServiceImpl.java

@@ -6,6 +6,7 @@ import com.zd.chemical.domain.vo.*;
 import com.zd.chemical.mapper.*;
 import com.zd.chemical.service.IActAuditconfigService;
 import com.zd.chemical.service.IActHxpapplyService;
+import com.zd.chemical.util.ChemicalUtils;
 import com.zd.common.core.annotation.DataScope;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SaveUtil;
@@ -65,8 +66,7 @@ public class ActHxpapplyServiceImpl implements IActHxpapplyService
      * @return 化学品申购
      */
     @Override
-    public ActHxpapplyInfoVo selectActHxpapplyById(Long id,Integer tickStatus)
-    {
+    public ActHxpapplyInfoVo selectActHxpapplyById(Long id,Integer tickStatus) {
         // 利用申请的id,查询出工作流对应的配置节点
         ActApplytask actApplytask = new ActApplytask();
         actApplytask.setTaskId(id);
@@ -86,8 +86,6 @@ public class ActHxpapplyServiceImpl implements IActHxpapplyService
                     actRestStockVo.setSubId(actHxpapplyInfoVo.getSubId());
                     actRestStockVo.setCabinetId(b.getCabinetId());
                     actRestStockVo.setChemicalId(b.getChemicalId());
-//                    Map <String, String> restStock = iActHxpapplyService.getRestStock(actRestStockVo);
-//                    b.setRemainingStorage(restStock.get("restStock"));
                     if(pre.test(actApplytasks)){
                         getRestStockClassif(actRestStockVo,b,actHxpapplyInfoVo.getUserId(),apply.getApprovalStatus().intValue());
                     }else{
@@ -96,6 +94,13 @@ public class ActHxpapplyServiceImpl implements IActHxpapplyService
                 });
         List <ActHxpapplyDetailVo> actHxpapplyDetailVos = actHxpapplyDetailMapper.selectApplyDetailList(actHxpapplyDetail);
         consumer.accept(actHxpapplyDetailVos);
+        //小数点后无效0去除
+        if (actHxpapplyDetailVos != null && actHxpapplyDetailVos.size() > 0) {
+            actHxpapplyDetailVos.stream().forEach(vo -> {
+                vo.setApplyNum(ChemicalUtils.removeZeroForAfterPoint(vo.getApplyNum()));
+                vo.setRemainingStorage(ChemicalUtils.removeZeroForAfterPoint(vo.getRemainingStorage()));
+            });
+        }
         actHxpapplyInfoVo.setActHxpapplyDetailList(actHxpapplyDetailVos);
 
         // 查出工作流子节点

+ 7 - 0
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/HxpStockServiceImpl.java

@@ -16,6 +16,7 @@ import com.zd.chemical.service.IHxpChemicalJoinCabinetService;
 import com.zd.chemical.service.IHxpClassifyConfigService;
 import com.zd.chemical.service.IHxpStockService;
 import com.zd.chemical.service.IHxpUserecordService;
+import com.zd.chemical.util.ChemicalUtils;
 import com.zd.chemical.util.SmsSydUtil;
 import com.zd.common.core.annotation.DataScope;
 import com.zd.common.core.exception.ServiceException;
@@ -149,6 +150,12 @@ public class HxpStockServiceImpl implements IHxpStockService {
             }
             // 计算库存净重
             a.setSuttle(a.getOutUsages().subtract(Optional.ofNullable(a.getTare()).orElse(BigDecimal.ZERO)));
+            //新加:去除末尾多余的0
+            a.setSuttle(ChemicalUtils.removeZeroForAfterPoint(a.getSuttle()));
+            a.setChemicalAmount(ChemicalUtils.removeZeroForAfterPoint(a.getChemicalAmount()));
+            a.setUsages(ChemicalUtils.removeZeroForAfterPoint(a.getUsages()));
+            a.setOutUsages(ChemicalUtils.removeZeroForAfterPoint(a.getOutUsages()));
+            a.setTare(ChemicalUtils.removeZeroForAfterPoint(a.getTare()));
         });
         return list;
     }

+ 5 - 2
zd-modules/zd-chemical/src/main/java/com/zd/chemical/util/ChemicalUtils.java

@@ -50,8 +50,11 @@ public class ChemicalUtils {
      * @return
      */
     public static BigDecimal removeZeroForAfterPoint(BigDecimal unit) {
-        String str = unit.stripTrailingZeros().toPlainString();
-        return new BigDecimal(str);
+        if (unit != null) {
+            String str = unit.stripTrailingZeros().toPlainString();
+            return new BigDecimal(str);
+        }
+        return unit;
     }
 
     /**

+ 0 - 12
zd-modules/zd-exam/pom.xml

@@ -25,18 +25,6 @@
             <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
         </dependency>
 
-        <!-- SpringCloud Alibaba Sentinel -->
-        <!--<dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
-        </dependency>
-
-        &lt;!&ndash; SpringBoot Actuator &ndash;&gt;
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>-->
-
         <!-- Mysql Connector -->
         <dependency>
             <groupId>mysql</groupId>

+ 0 - 25
zd-modules/zd-modules-laboratory/pom.xml

@@ -25,31 +25,6 @@
             <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
         </dependency>
 
-       <!-- <dependency>
-            <groupId>com.alibaba.nacos</groupId>
-            <artifactId>nacos-spring-context</artifactId>
-            <version>0.2.3-RC1</version>
-        </dependency>-->
-
-        <!-- SpringCloud Alibaba Sentinel -->
-        <!--<dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
-        </dependency>
-
-        &lt;!&ndash; SpringBoot Actuator &ndash;&gt;
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>-->
-
-        <!-- Swagger UI -->
-<!--        <dependency>-->
-<!--            <groupId>io.springfox</groupId>-->
-<!--            <artifactId>springfox-swagger-ui</artifactId>-->
-<!--            <version>${swagger.fox.version}</version>-->
-<!--        </dependency>-->
-
         <!-- Mysql Connector -->
         <dependency>
             <groupId>mysql</groupId>

+ 46 - 3
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mqtt/config/MqttConfig.java

@@ -2,12 +2,18 @@ package com.zd.laboratory.mqtt.config;
 
 import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.zd.algorithm.api.fire.RemoteFireDeviceService;
+import com.zd.common.core.redis.RedisService;
 import com.zd.common.core.utils.SpringUtils;
 import com.zd.laboratory.event.LabMessageEvent;
 import com.zd.laboratory.event.SensorNewStatusEvent;
 import com.zd.laboratory.mqtt.service.TerminalRouter;
+import com.zd.laboratory.mqtt.service.impl.CommonSend;
+import com.zd.laboratory.utils.FireLaborUtil;
 import com.zd.laboratory.utils.HexUtils;
+import com.zd.model.constant.CacheConstants;
 import com.zd.model.constant.MqttConstants;
+import com.zd.model.domain.R;
 import org.apache.commons.lang3.StringUtils;
 import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
 import org.slf4j.Logger;
@@ -26,7 +32,9 @@ import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter;
 import org.springframework.integration.mqtt.support.MqttHeaders;
 import org.springframework.messaging.*;
 
+import javax.annotation.Resource;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 /**
@@ -51,6 +59,15 @@ public class MqttConfig {
 
     public static final String MQTT_OUTBOUND_CHANNEL = "mqttOutboundChannel";
 
+    @Resource
+    CommonSend commonSend;
+
+    @Resource
+    RedisService redisService;
+
+    @Resource
+    RemoteFireDeviceService remoteFireDeviceService;
+
     @Value("${mqtt.username:}")
     private String username;
 
@@ -198,8 +215,8 @@ public class MqttConfig {
             public void handleMessage(Message<?> message) throws MessagingException {
                 MessageHeaders messageHeaders = message.getHeaders();
                 String receivedTopic = (String) messageHeaders.get(MqttHeaders.RECEIVED_TOPIC);
-//                logger.info("[通道] - [{}]",receivedTopic);
-//                logger.info("[消息] - [{}]",message.getPayload());
+                logger.info("[通道] - [{}]",receivedTopic);
+                logger.info("[消息] - [{}]",message.getPayload());
                 String messageStr = message.getPayload().toString();
                 if (receivedTopic.startsWith(devicePrefix)) {
                     if (receivedTopic.contains("788D4C6C6187ABC")) {
@@ -250,8 +267,34 @@ public class MqttConfig {
                             String relayCode = prefix[prefix.length - 1];
                             TerminalRouter.routerMap.get("HxpLockService").offLine(relayCode);
                         }
-
+                }}else if(receivedTopic.startsWith(MqttConstants.TOPIC_FIRE_DEVICE_RECEIVE)){
+                    logger.info("灭火消息消费,receivedTopic:" + receivedTopic + " messageStr:" + messageStr);
+                    receivedTopic = receivedTopic.substring(receivedTopic.lastIndexOf("/") + 1, receivedTopic.length());
+                    //根据状态指令获取主机状态
+                    JSONObject jsonObject = FireLaborUtil.getFireStatus(messageStr);
+                    Integer fireNumber = Integer.valueOf(jsonObject.get("fireNumber").toString());
+                    //灭火主机发生预警
+                    if (fireNumber > 0) {
+                        logger.info("灭火设备传感器异常,通知预案,状态:" + jsonObject.toJSONString());
+                        //发现灭火设备异常,发送消息通知
+                        commonSend.send(MqttConstants.TOPIC_FIRE_DEVICE_WARN+receivedTopic,jsonObject.toJSONString());
+                        if (fireNumber == 2) {
+                            logger.info("=====>>>>>>发现自动灭火");
+                            String isExist = redisService.getCacheObject(CacheConstants.FIRE_LOG_IS_EXIST);
+                            //redis中是否已存在日志已添加标识
+                            if(StringUtils.isEmpty(isExist)){
+                                //自动灭火日志添加
+                                R r = remoteFireDeviceService.addFireLog(receivedTopic);
+                                //redis存值,灭火日志已经添加标识
+                                redisService.setCacheObject(CacheConstants.FIRE_LOG_IS_EXIST, r.getData(), 60L, TimeUnit.MINUTES);
+                                logger.info("灭火日志添加执行结果," + r.getData());
+                            }
+                        }
                     }
+                    //redis存值 采集器编号:主机状态json
+                    redisService.setCacheObject(receivedTopic, jsonObject, 1L, TimeUnit.MINUTES);
+                    //redis存值 灭火主机响应时间
+                    redisService.setCacheObject(CacheConstants.FIRE_DEVICE_RESPOND_TIME, System.currentTimeMillis(), 1L, TimeUnit.MINUTES);
                 }
 
                 // TODO

+ 6 - 5
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/utils/FireLaborUtil.java

@@ -89,17 +89,17 @@ public class FireLaborUtil {
     }
 
 
-    public static JSONObject getFireStatus(String returnCode){
+    public static JSONObject getFireStatus(String returnCodes){
         boolean fireStatus=false;
         String msg="";
         int fireNumber=0;
-        String returnCodes="02 03 48 00 00 00 00 02 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 40 3D ";
+        //String returnCodes="02 03 48 00 00 00 00 02 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0A 00 00 00 40 3D ";
         returnCodes=returnCodes.replace(" ","");
-        System.out.println("returnCodes length:"+returnCodes.length());
+        //System.out.println("returnCodes length:"+returnCodes.length());
         String registerCode=returnCodes.substring(6,returnCodes.length()-20);
-        System.out.println("registerCode:"+registerCode);
+        //System.out.println("registerCode:"+registerCode);
         String mainCode=returnCodes.substring(134,returnCodes.length()-4);
-        System.out.println("mainCode:"+mainCode);
+        //System.out.println("mainCode:"+mainCode);
         List<String> registerCodeList=parseArrayList(registerCode);
         Set<String> statusSet=statusMap.keySet();
         if(registerCodeList.contains("01")){
@@ -131,6 +131,7 @@ public class FireLaborUtil {
         jsonObject.put("fireNumber",fireNumber);
         jsonObject.put("fireStatus",fireStatus);
         jsonObject.put("msg",msg);
+        jsonObject.put("createTime",System.currentTimeMillis());
         return jsonObject;
     }
 

+ 0 - 12
zd-modules/zd-modules-system/pom.xml

@@ -25,18 +25,6 @@
             <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
         </dependency>
 
-    	<!-- SpringCloud Alibaba Sentinel -->
-        <!--<dependency>
-            <groupId>com.alibaba.cloud</groupId>
-            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
-        </dependency>
-
-    	&lt;!&ndash; SpringBoot Actuator &ndash;&gt;
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-actuator</artifactId>
-        </dependency>-->
-
         <!-- Mysql Connector -->
         <dependency>
             <groupId>mysql</groupId>

+ 14 - 22
zd-modules/zd-modules-system/src/main/java/com/zd/system/controller/SysClassController.java

@@ -40,19 +40,17 @@ import io.swagger.annotations.ApiOperation;
 //作者手动加入 ,在接口上加作者@ApiOperationSupport(author = "XXX")
 @ApiSupport(author = Knife4jConfiguration.Author.CYL)
 @RequestMapping("/class")
-public class SysClassController extends BaseController
-{
+public class SysClassController extends BaseController {
     @Autowired
     private ISysClassService sysClassService;
 
     /**
      * 查询班级字典列表
      */
-    @PreAuthorize(hasPermi = PerPrefix.SYSTEM_CLASS+ PerFun.LIST)
+    @PreAuthorize(hasPermi = PerPrefix.SYSTEM_CLASS + PerFun.LIST)
     @GetMapping("/list")
     @ApiOperation(value = "查询班级字典列表")
-    public TableDataInfo<SysClass> list(SysClass sysClass)
-    {
+    public TableDataInfo<SysClass> list(SysClass sysClass) {
         startPage();
         List<SysClass> list = sysClassService.selectSysClassList(sysClass);
         return getDataTable(list);
@@ -63,8 +61,7 @@ public class SysClassController extends BaseController
      */
     @GetMapping("/listAll")
     @ApiOperation(value = "查询班级字典列表")
-    public ResultData<List<SysClass>> listAll(SysClass sysClass)
-    {
+    public ResultData<List<SysClass>> listAll(SysClass sysClass) {
         List<SysClass> list = sysClassService.selectSysClassList(sysClass);
         return ResultData.success(list);
     }
@@ -73,11 +70,10 @@ public class SysClassController extends BaseController
      * 导出班级字典列表
      */
     @ApiOperation(value = "导出班级字典列表")
-    @PreAuthorize(hasPermi = PerPrefix.SYSTEM_CLASS+ PerFun.EXPORT)
+    @PreAuthorize(hasPermi = PerPrefix.SYSTEM_CLASS + PerFun.EXPORT)
     @Log(title = "班级字典", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, SysClass sysClass) throws IOException
-    {
+    public void export(HttpServletResponse response, SysClass sysClass) throws IOException {
         List<SysClass> list = sysClassService.selectSysClassList(sysClass);
         ExcelUtil<SysClass> util = new ExcelUtil<SysClass>(SysClass.class);
         util.exportExcel(response, list, "班级字典数据");
@@ -87,10 +83,9 @@ public class SysClassController extends BaseController
      * 获取班级字典详细信息
      */
     @ApiOperation(value = "获取班级字典详细信息")
-    @PreAuthorize(hasPermi = PerPrefix.SYSTEM_CLASS+ PerFun.QUERY)
+    @PreAuthorize(hasPermi = PerPrefix.SYSTEM_CLASS + PerFun.QUERY)
     @GetMapping(value = "/{id}")
-    public ResultData<SysClass> getInfo(@PathVariable("id") Long id)
-    {
+    public ResultData<SysClass> getInfo(@PathVariable("id") Long id) {
         return ResultData.success(sysClassService.selectSysClassById(id));
     }
 
@@ -101,8 +96,7 @@ public class SysClassController extends BaseController
 //    @PreAuthorize(hasPermi = PerPrefix.SYSTEM_CLASS+ PerFun.ADD)
     @Log(title = "班级字典", businessType = BusinessType.INSERT)
     @PostMapping
-    public ResultData add(@RequestBody SysClass sysClass)
-    {
+    public ResultData add(@RequestBody SysClass sysClass) {
         return ResultData.success(sysClassService.insertSysClass(sysClass));
     }
 
@@ -113,20 +107,18 @@ public class SysClassController extends BaseController
 //    @PreAuthorize(hasPermi = PerPrefix.SYSTEM_CLASS+ PerFun.EDIT)
     @Log(title = "班级字典", businessType = BusinessType.UPDATE)
     @PutMapping
-    public ResultData edit(@RequestBody SysClass sysClass)
-    {
-        return  ResultData.result(sysClassService.updateSysClass(sysClass));
+    public ResultData edit(@RequestBody SysClass sysClass) {
+        return ResultData.result(sysClassService.updateSysClass(sysClass));
     }
 
     /**
      * 删除班级字典
      */
     @ApiOperation(value = "删除班级字典")
-    @PreAuthorize(hasPermi = PerPrefix.SYSTEM_CLASS+ PerFun.REMOVE)
+    @PreAuthorize(hasPermi = PerPrefix.SYSTEM_CLASS + PerFun.REMOVE)
     @Log(title = "班级字典", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public ResultData remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public ResultData remove(@PathVariable Long[] ids) {
         return ResultData.result(sysClassService.deleteSysClassByIds(ids));
     }
 }

+ 0 - 2
zd-modules/zd-modules-system/src/main/java/com/zd/system/controller/SysConfigController.java

@@ -131,8 +131,6 @@ public class SysConfigController extends BaseController {
         return AjaxResult.success();
     }
 
-
-
     /**
      * 获取系统首页开关。
      */