Procházet zdrojové kódy

【优化】多余常量类删除

linfutong před 3 roky
rodič
revize
d565fae71e

+ 3 - 3
zd-api/zd-algorithm-api/src/main/java/com/zd/algorithm/api/alarm/entity/AlarmEntrty.java

@@ -1,10 +1,10 @@
 package com.zd.algorithm.api.alarm.entity;
 
 import cn.hutool.json.JSONUtil;
-import com.zd.model.constant.Constants;
-
+import com.zd.model.constant.BaseConstants;
 import javax.validation.constraints.NotNull;
 
+
 public class AlarmEntrty {
 
     private Routes route;
@@ -25,7 +25,7 @@ public class AlarmEntrty {
     /**
      * 编码方式 默认UTF-8
      */
-    private String Encoding = Constants.UTF8;
+    private String Encoding = BaseConstants.UTF8;
 
     /**
      * 邮件主题

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

@@ -25,8 +25,6 @@ public class ZdGatewayApplication {
 
     public static void main(String[] args) {
         ConfigurableApplicationContext run = ZdStartApplication.run(ApplicationConstants.GATEWAY_SERVICE, ZdGatewayApplication.class, args);
-        System.out.println("(♥◠‿◠)ノ゙  网关启动成功   ლ(´ڡ`ლ)゙");
-
         Environment env = run.getEnvironment();
         try {
             logger.info("\n----------------------------------------------------------\n\t" +

+ 0 - 185
zd-model/src/main/java/com/zd/model/constant/Constants.java

@@ -1,185 +0,0 @@
-package com.zd.model.constant;
-
-/**
- * 通用常量信息
- *
- * @author zd
- */
-public class Constants {
-    /**
-     * UTF-8 字符集
-     */
-    public static final String UTF8 = "UTF-8";
-
-    /**
-     * GBK 字符集
-     */
-    public static final String GBK = "GBK";
-
-    /**
-     * RMI 远程方法调用
-     */
-    public static final String LOOKUP_RMI = "rmi://";
-
-    /**
-     * LDAP 远程方法调用
-     */
-    public static final String LOOKUP_LDAP = "ldap://";
-
-    /**
-     * http请求
-     */
-    public static final String HTTP = "http://";
-
-    /**
-     * https请求
-     */
-    public static final String HTTPS = "https://";
-
-    /**
-     * 成功标记
-     */
-    public static final Integer SUCCESS = 200;
-
-    /**
-     * 失败标记
-     */
-    public static final Integer FAIL = 500;
-
-    /**
-     * 登录成功
-     */
-    public static final String LOGIN_SUCCESS = "Success";
-
-    /**
-     * 注销
-     */
-    public static final String LOGOUT = "Logout";
-
-    /**
-     * 注册
-     */
-    public static final String REGISTER = "Register";
-
-    /**
-     * 登录失败
-     */
-    public static final String LOGIN_FAIL = "Error";
-
-    /**
-     * 当前记录起始索引
-     */
-    public static final String PAGE_NUM = "pageNum";
-
-    /**
-     * 每页显示记录数
-     */
-    public static final String PAGE_SIZE = "pageSize";
-
-    /**
-     * 排序列
-     */
-    public static final String ORDER_BY_COLUMN = "orderByColumn";
-
-    /**
-     * 排序的方向 "desc" 或者 "asc".
-     */
-    public static final String IS_ASC = "isAsc";
-
-    /**
-     * 验证码 redis key
-     */
-    public static final String CAPTCHA_CODE_KEY = "captcha_codes:";
-
-    /**
-     * 签到验证码 redis key
-     */
-    public static final String SINGIN_CAPTCHA_CODE_KEY = "captcha_signin_codes:";
-
-    /**
-     * 签到记录ID
-     */
-    public static final String SINGIN_id_KEY = "signin_id:";
-
-    public static final long SINGIN_OUT_TIME = 120;
-    /**
-     * 检查跳过
-     */
-    public static final String SINGIN_CHECK_JUMP_KEY = "signin_check_jump:";
-
-    /**
-     * 验证码有效期(分钟)
-     */
-    public static final long CAPTCHA_EXPIRATION = 2;
-
-    /**
-     * 令牌有效期(分钟)
-     */
-    public static final long TOKEN_EXPIRE = 720;
-
-    /**
-     * 参数管理 cache key
-     */
-    public static final String SYS_CONFIG_KEY = "sys_config:";
-
-    /**
-     * 字典管理 cache key
-     */
-    public static final String SYS_DICT_KEY = "sys_dict:";
-
-
-    /**
-     * 字典管理 cache key
-     */
-    public static final String WRAN_KEY = "wran_key:";
-
-    /**
-     * 资源映射路径 前缀
-     */
-    public static final String RESOURCE_PREFIX = "/profile";
-
-    /**
-     * 删除状态标记
-     */
-    public static final String DEL = "2";
-
-    /**
-     * baskPackage
-     */
-    public static final String BASE_PACKAGE = "com.zd";
-    /**
-     * 正常状态标记
-     */
-    public static final String NORMAL = "0";
-    /**
-     * MAP集合的初始化大小
-     */
-    public static final Integer MAP_INIT_SIZE = 16;
-
-
-    /**
-     * 密码类型
-     */
-    public static final String GRANT_TYPE_PASSWORD = "password";
-
-    /**
-     * 手机号类型
-     */
-    public static final String GRANT_TYPE_MOBILE = "mobile";
-
-    /**
-     * 手机号类型
-     */
-    public static final String UPDATE_TYPE_MOBILE = "update";
-
-    /**
-     * redis验证码前缀
-     */
-
-    public static final String DEFAULT_CODE_KEY = "DEFAULT_CODE_KEY_";
-
-    /**
-     * 手机登录验证码有效期(分钟)
-     */
-    public static final long CODE_EXPIRATION = 5;
-}

+ 2 - 3
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/service/impl/QpSupplierServiceImpl.java

@@ -17,7 +17,7 @@ import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SaveUtil;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.core.utils.TransferUtils;
-import com.zd.model.constant.Constants;
+import com.zd.model.constant.BaseConstants;
 import com.zd.model.constant.HttpStatus;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.domain.R;
@@ -29,7 +29,6 @@ import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -232,7 +231,7 @@ public class QpSupplierServiceImpl implements IQpSupplierService {
         sysUser.setPhonenumber(qpSupplierDto.getPhone());
         sysUser.setPassword(SecurityUtils.encryptPassword(sysUserDto.getPassword()));
         sysUser.setUserType(USER_TYPE);
-        sysUser.setStatus(Constants.NORMAL);
+        sysUser.setStatus(BaseConstants.NORMAL);
         sysUser.setCreateTime(DateUtils.getNowDate());
         sysUser.setCreateBy(SecurityUtils.getUsername());
         R<Boolean> userInfo = userService.registerUserInfo(sysUser, SecurityConstants.INNER);

+ 2 - 2
zd-modules/zd-algorithm/src/main/java/com/zd/alg/AlgorithmApplication.java

@@ -8,7 +8,7 @@ import com.zd.common.core.annotation.EnableRyFeignClients;
 import com.zd.common.core.launch.ZdStartApplication;
 import com.zd.common.mqtt.model.MqttProperties;
 import com.zd.model.constant.ApplicationConstants;
-import com.zd.model.constant.Constants;
+import com.zd.model.constant.BaseConstants;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -18,7 +18,7 @@ import org.springframework.context.ConfigurableApplicationContext;
 @ServletComponentScan("com.zd.alg.iot.vmp.conf")
 @EnableCustomConfig
 @EnableRyFeignClients
-@SpringBootApplication(scanBasePackages = Constants.BASE_PACKAGE)
+@SpringBootApplication(scanBasePackages = BaseConstants.BASE_PACKAGE)
 @EnableConfigurationProperties({MqttProperties.class, AlgorithmYml.class, FireProperties.class})
 public class AlgorithmApplication {
 

+ 9 - 11
zd-modules/zd-algorithm/src/main/java/com/zd/alg/forward/serivce/CheckService.java

@@ -24,7 +24,7 @@ import com.zd.common.core.utils.ServletUtils;
 import com.zd.common.core.utils.StringUtils;
 import com.zd.common.mqtt.model.MessageBody;
 import com.zd.laboratory.api.feign.RemoteLaboratoryService;
-import com.zd.model.constant.Constants;
+import com.zd.model.constant.BaseConstants;
 import com.zd.model.constant.SecurityConstants;
 import com.zd.model.domain.R;
 import com.zd.model.entity.Algorithm;
@@ -44,14 +44,12 @@ import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.multipart.MultipartFile;
 import sun.misc.BASE64Decoder;
-
 import javax.annotation.Resource;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.*;
-
 import static com.zd.alg.forward.utils.HttpUtils.*;
 
 @Service
@@ -160,9 +158,9 @@ public class CheckService {
                     if (StringUtils.isNotEmpty(labSkipped) && labSkipped.equals("1")) {
                         //如果没有通过则次数加一
                         //键为前缀+签到id +下划线+验证类型
-                        String key = Constants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
+                        String key = BaseConstants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
                         Long increment = redisTemplate.opsForValue().increment(key);
-                        redisService.expire(key, Constants.SINGIN_OUT_TIME);
+                        redisService.expire(key, BaseConstants.SINGIN_OUT_TIME);
                         if (increment != null && increment >= Integer.parseInt(labCheckCount)) {
                             //黎晨这里让把跳过时状态码改为700,所以700的含义为检查失败并且跳过
                             return R.fail(700, "符合跳过条件执行跳过");
@@ -228,9 +226,9 @@ public class CheckService {
             if (!f && algorithmYml.getJumpThreshold() != -1) {
                 //如果没有通过则次数加一
                 //键为前缀+签到id +下划线+验证类型
-                String key = Constants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
+                String key = BaseConstants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
                 Long increment = redisTemplate.opsForValue().increment(key);
-                redisService.expire(key, Constants.SINGIN_OUT_TIME);
+                redisService.expire(key, BaseConstants.SINGIN_OUT_TIME);
                 if (increment >= algorithmYml.getJumpThreshold()) {
                     //黎晨这里让把跳过时状态码改为700,所以700的含义为检查失败并且跳过
                     apply.setCode(700);
@@ -374,12 +372,12 @@ public class CheckService {
 
 
     private R<Long> getObjectR(Long id) {
-        Long subId = redisService.getCacheObject(Constants.SINGIN_id_KEY + id);
+        Long subId = redisService.getCacheObject(BaseConstants.SINGIN_id_KEY + id);
         if (subId == null) {
             return R.fail(600, "签到&签出已超时,请重新刷卡重试!");
         }
         //刷新key
-        boolean expire = redisService.expire(Constants.SINGIN_id_KEY + id, 120);
+        boolean expire = redisService.expire(BaseConstants.SINGIN_id_KEY + id, 120);
         if (!expire) {
             return R.fail(600, "签到&签出已超时,请重新刷卡重试!");
         }
@@ -402,9 +400,9 @@ public class CheckService {
         //如果没有通过则次数加一
         Map<String, Boolean> map = new HashMap(1);
         //键为前缀+签到id +下划线+验证类型
-        String key = Constants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
+        String key = BaseConstants.SINGIN_CHECK_JUMP_KEY + id + "_" + code;
         Long increment = redisTemplate.opsForValue().increment(key);
-        redisService.expire(key, Constants.SINGIN_OUT_TIME);
+        redisService.expire(key, BaseConstants.SINGIN_OUT_TIME);
         Boolean isJump = increment >= algorithmYml.getJumpThreshold();
         map.put("jump", isJump);
         R<Object> fail = R.fail();

+ 8 - 0
zd-modules/zd-algorithm/src/main/resources/bootstrap.yml

@@ -1,6 +1,14 @@
 server:
   port: ${service.port.algorithm}
 
+#文件大小
+spring:
+  servlet:
+    multipart:
+      enabled: true
+      max-file-size: 20MB
+      max-request-size: 50MB
+      
 # mybatis配置
 mybatis:
   # 搜索指定包别名

+ 2 - 3
zd-modules/zd-bottle-parent/zd-bottle/src/main/java/com/zd/bottle/ZdBottleApplication.java

@@ -4,9 +4,8 @@ import com.zd.common.core.annotation.EnableCustomConfig;
 import com.zd.common.core.annotation.EnableRyFeignClients;
 import com.zd.common.core.launch.ZdStartApplication;
 import com.zd.model.constant.ApplicationConstants;
-import com.zd.model.constant.Constants;
+import com.zd.model.constant.BaseConstants;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
@@ -18,7 +17,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
  */
 @EnableCustomConfig
 @EnableRyFeignClients
-@SpringBootApplication(scanBasePackages = Constants.BASE_PACKAGE)
+@SpringBootApplication(scanBasePackages = BaseConstants.BASE_PACKAGE)
 @EnableScheduling
 //@NacosPropertySource(dataId = "zd-bottle", autoRefreshed = true)
 @Slf4j