소스 검색

公式相关

yangyj 3 년 전
부모
커밋
948777de75
23개의 변경된 파일181개의 추가작업 그리고 2881개의 파일을 삭제
  1. 1 0
      blade-common/src/main/java/org/springblade/common/utils/BaseUtils.java
  2. 0 111
      blade-service/blade-manager/src/main/java/com/mixsmart/config/AbstractConfig.java
  3. 0 156
      blade-service/blade-manager/src/main/java/com/mixsmart/config/SystemConfig.java
  4. 0 157
      blade-service/blade-manager/src/main/java/com/mixsmart/config/bean/ProjectInfo.java
  5. 0 175
      blade-service/blade-manager/src/main/java/com/mixsmart/enums/YesNoType.java
  6. 0 111
      blade-service/blade-manager/src/main/java/com/mixsmart/security/Coder.java
  7. 0 184
      blade-service/blade-manager/src/main/java/com/mixsmart/security/DESCoder.java
  8. 0 91
      blade-service/blade-manager/src/main/java/com/mixsmart/security/PBECoder.java
  9. 0 243
      blade-service/blade-manager/src/main/java/com/mixsmart/security/RSACoder.java
  10. 0 128
      blade-service/blade-manager/src/main/java/com/mixsmart/security/SecurityUtils.java
  11. 0 71
      blade-service/blade-manager/src/main/java/com/mixsmart/sort/ChinaNumSort.java
  12. 0 5
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java
  13. 0 117
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/FileClassifyUtils.java
  14. 0 238
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/FileUtils.java
  15. 0 214
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/IdCardInfoExtractor.java
  16. 0 401
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/IdCardValidator.java
  17. 0 149
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/LoggerUtils.java
  18. 0 105
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/NetUtils.java
  19. 172 0
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/ReflectionUtil.java
  20. 0 55
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/SQLUtils.java
  21. 0 155
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/ShortTimeFormat.java
  22. 2 13
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/StringUtils.java
  23. 6 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

+ 1 - 0
blade-common/src/main/java/org/springblade/common/utils/BaseUtils.java

@@ -35,4 +35,5 @@ public class BaseUtils {
 
 
 
+
 }

+ 0 - 111
blade-service/blade-manager/src/main/java/com/mixsmart/config/AbstractConfig.java

@@ -1,111 +0,0 @@
-package com.mixsmart.config;
-
-import com.mixsmart.utils.LoggerUtils;
-import com.mixsmart.utils.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * 配置抽象类
- * @author lmq
- * @version 1.0
- * @since JDK版本大于等于1.6
- * 2016年1月21日
- */
-public abstract class AbstractConfig {
-
-	protected final Logger logger;
-
-	public AbstractConfig() {
-	    logger = LoggerFactory.getLogger(getClass());
-    }
-
-    /**
-	 * 变量处理
-	 * @param value 变量名称
-	 * @return 返回变量值
-	 */
-	protected String handleVar(String value) {
-		if(StringUtils.isNotEmpty(value)) {
-			String regex = "(?<=\\$\\{)[^\\{\\}]+(?=\\})";
-			Pattern pattern = Pattern.compile(regex);
-			Matcher matcher = pattern.matcher(value);
-			while(matcher.find()) {
-				String varName = matcher.group();
-				if(StringUtils.isNotEmpty(varName)) {
-					String val = null;
-					try {
-						val = getValue(varName);
-					} catch (Exception e) {
-						LoggerUtils.info(logger, "变量【"+val+"】没定义");
-						e.printStackTrace();
-						val = null;
-					}
-					if(StringUtils.isEmpty(val)) {
-					    LoggerUtils.info(logger, "变量【"+val+"】没定义");
-					}
-					value = value.replace("${"+varName+"}", StringUtils.handleNull(val));
-				}
-			}
-			matcher = pattern.matcher(value);
-			if(matcher.find()) {
-				handleVar(value);
-			}
-			pattern = null;
-			matcher = null;
-			return value;
-		}
-		return value;
-	}
-
-	/**
-	 * 处理值中含有的系统变量
-	 * @param value 变量名称
-	 * @return 返回系统变量值
-	 */
-	protected String handleSysVar(String value) {
-		String regex = "(?<=#\\{)[^\\{\\}]+(?=\\})";
-		Pattern pattern = Pattern.compile(regex);
-		Matcher matcher = pattern.matcher(value);
-		while(matcher.find()) {
-			String varName = matcher.group();
-			if(StringUtils.isNotEmpty(varName)) {
-				String val = null;
-				try {
-				   val = System.getProperty(varName);
-				} catch (Exception e) {
-				    LoggerUtils.info(logger, "系统属性【"+val+"】没有找到");
-					e.printStackTrace();
-					val = null;
-				}
-				value = value.replace("#{"+varName+"}", StringUtils.handleNull(val));
-			}
-		}
-		matcher = pattern.matcher(value);
-		if(matcher.find()) {
-			handleSysVar(value);
-		}
-		pattern = null;
-		matcher = null;
-		return value;
-	}
-	
-	/**
-	 * 获取变量值
-	 * @param key 名称
-	 * @return 获取名称对应的值
-	 */
-	public abstract String getValue(String key);
-	
-	/**
-	 * 获取变量值
-	 * @param key 名称
-	 * @param defaultValue 如果获取到的值为空(null),则使用该值
-	 * @return 获取名称对应的值,如果获取到的值为空(null),则返回默认值
-	 */
-	public abstract String getValue(String key, String defaultValue);
-	
-}

+ 0 - 156
blade-service/blade-manager/src/main/java/com/mixsmart/config/SystemConfig.java

@@ -1,156 +0,0 @@
-package com.mixsmart.config;
-
-import com.mixsmart.config.bean.ProjectInfo;
-import com.mixsmart.constant.IMixConstant;
-import com.mixsmart.utils.LoggerUtils;
-import com.mixsmart.utils.StringUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Properties;
-
-/**
- * 初始化系统配置文件
- * @author lmq
- * @version 1.0
- * @since JDK版本大于等于1.6
- * 2016年1月21日
- */
-public class SystemConfig extends AbstractConfig {
-
-	/**
-	 * 系统配置文件
-	 */
-	public static final String SYS_CONFIG_FILE = "/sysconfig.properties";
-	
-	private static SystemConfig instance;
-	
-	private String sysConfigPath;
-	
-	private long lastModifyTime = 0;
-	
-	private Properties prop = null;
-	
-	private SystemConfig(String sysConfigPath) {
-		if(StringUtils.isNotEmpty(sysConfigPath)) {
-			this.sysConfigPath = sysConfigPath;
-		} else {
-			this.sysConfigPath = SYS_CONFIG_FILE;
-		}
-		init();
-	}
-	
-	private SystemConfig() {
-		this.sysConfigPath = SYS_CONFIG_FILE;
-		init();
-	}
-	
-	/**
-	 * 重新加载配置文件
-	 */
-	private void reloadConfig() {
-		String devModel = instance.getValue("project.devModel");
-		if(StringUtils.isNotEmpty(devModel) && IMixConstant.PROJECT_DEV_MODEL.equals(devModel)) {
-			URL path = this.getClass().getResource(this.sysConfigPath);
-			File file = new File(path.getFile());
-			path = null;
-			if(file.exists()) {
-				//判断文件是否被修改过,如果文件已修改,则重新初始化文件
-				if(file.lastModified()>lastModifyTime) {
-					reInit();
-				}
-			}
-			file = null;
-		}
-	}
-	
-	/**
-	 * 获取实例
-	 * @return SystemConfig
-	 */
-	public synchronized static SystemConfig getInstance() {
-		if(null == instance) {
-			instance = new SystemConfig();
-		}
-		instance.reloadConfig();
-		return instance;
-	}
-	
-	/**
-	 * 初始化配置文件
-	 */
-	protected void init() {
-	    LoggerUtils.info(logger, "初始化配置文件-------");
-		InputStream in = null;
-		try {
-		  URL url = this.getClass().getResource(this.sysConfigPath);
-		  in = url.openStream();
-		  if(null != in) {
-			  prop = new Properties();
-			  prop.load(in);
-		  }
-		  File file = new File(url.getFile());
-		  lastModifyTime  = file.lastModified();
-		  file = null;
-		  LoggerUtils.info(logger, "初始化配置文件[结束]-------");
-		} catch (Exception e) {
-			e.printStackTrace();
-		} finally {
-			if(null != in) {
-				try {
-					in.close();
-				} catch (IOException e) {
-					e.printStackTrace();
-				}
-			}
-		}
-	}
-	
-	@Override
-	public String getValue(String key) {
-		String value = null;
-		if(null != prop && StringUtils.isNotEmpty(key)){
-			try {
-				value = StringUtils.handleNull(prop.get(key));
-				value = handleSysVar(value);
-				value = handleVar(value);
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-		return value;
-	}
-	
-	/**
-	 * 获取项目信息
-	 * @return 获取项目信息对象
-	 */
-	public ProjectInfo getProjectInfo() {
-		ProjectInfo projectInfo = null;
-		if(null != prop){
-			projectInfo = new ProjectInfo();
-			projectInfo.initParam("project", this);
-		}
-		return projectInfo;
-	}
-	
-	/**
-	 * 重新初始化配置文件
-	 */
-	public void reInit() {
-		init();
-	}
-
-    @Override
-    public String getValue(String key, String defaultValue) {
-        String value = getValue(key);
-        if(StringUtils.isEmpty(value)) {
-            value = defaultValue;
-        }
-        return value;
-    }
-	
-	
-}

+ 0 - 157
blade-service/blade-manager/src/main/java/com/mixsmart/config/bean/ProjectInfo.java

@@ -1,157 +0,0 @@
-package com.mixsmart.config.bean;
-
-import com.mixsmart.config.SystemConfig;
-import com.mixsmart.enums.YesNoType;
-import com.mixsmart.utils.StringUtils;
-
-
-/**
- * 项目信息
- * @author lmq
- * @version 1.0
- * @since JDK版本大于等于1.6
- * 2016年1月21日
- */
-public class ProjectInfo {
-
-	/**
-	 * 项目名称
-	 */
-	private String name;
-	
-	/**
-	 * 开发模式
-	 */
-	private String devModel;
-	
-	/**
-	 * 版权
-	 */
-	private String copyright;
-	
-	/**
-	 * 联系方式
-	 */
-	private String contactInfo;
-	
-	/**
-	 * 版本
-	 */
-	private String version;
-
-	/**
-	 * 是否多租户模式
-	 */
-	private Boolean isMultitenancy;
-
-	/**
-	 * 获取项目名称
-	 * @return 项目名称
-	 */
-	public String getName() {
-		return name;
-	}
-
-	/**
-	 * 设置项目名称
-	 * @param name
-	 */
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	/**
-	 * 开发模式
-	 * @return 返回值为1或0 <br />
-	 * 1--表示开发模式;0--表示产品模式
-	 */
-	public String getDevModel() {
-		return devModel;
-	}
-
-	/**
-	 * 设置开发模式
-	 * @param devModel
-	 */
-	public void setDevModel(String devModel) {
-		this.devModel = devModel;
-	}
-
-	/**
-	 * 版权
-	 * @return 返回版权信息
-	 */
-	public String getCopyright() {
-		return copyright;
-	}
-
-	/**
-	 * 设置版权
-	 * @param copyright
-	 */
-	public void setCopyright(String copyright) {
-		this.copyright = copyright;
-	}
-
-	/**
-	 * 获取联系信息
-	 * @return 返回系统的联系信息
-	 */
-	public String getContactInfo() {
-		return contactInfo;
-	}
-
-	/**
-	 * 设置联系信息
-	 * @param contactInfo
-	 */
-	public void setContactInfo(String contactInfo) {
-		this.contactInfo = contactInfo;
-	}
-
-	/**
-	 * 版本信息
-	 * @return 系统版本号
-	 */
-	public String getVersion() {
-		return version;
-	}
-
-	/**
-	 * 设置版本信息
-	 * @param version
-	 */
-	public void setVersion(String version) {
-		this.version = version;
-	}
-
-	public Boolean getIsMultitenancy() {
-		return isMultitenancy;
-	}
-
-	public void setIsMultitenancy(Boolean isMultitenancy) {
-		this.isMultitenancy = isMultitenancy;
-	}
-
-	/**
-	 * 初始化参数值
-	 * @param prefix 项目信息在配置文件中的前缀
-	 * @param config 系统配置对象
-	 */
-	public void initParam(String prefix,SystemConfig config) {
-		if(StringUtils.isNotEmpty(prefix)) {
-			prefix += ".";
-		}
-		this.name = StringUtils.handleNull(config.getValue(prefix+"name"));
-		
-		this.devModel = StringUtils.handleNull(config.getValue(prefix+"devModel"));
-		this.copyright = StringUtils.handleNull(config.getValue(prefix+"copyright"));
-			
-		this.contactInfo = StringUtils.handleNull(config.getValue(prefix+"contactInfo"));
-		this.version = StringUtils.handleNull(config.getValue(prefix+"version"));
-
-		String isSaaSStr = StringUtils.handleNull(config.getValue(prefix+"isMultitenancy", YesNoType.YES.getStrValue()));
-		YesNoType isMultitenancyType = YesNoType.getObjByStrValue(isSaaSStr);
-		this.isMultitenancy = isMultitenancyType.getValue();
-	}
-}

+ 0 - 175
blade-service/blade-manager/src/main/java/com/mixsmart/enums/YesNoType.java

@@ -1,175 +0,0 @@
-package com.mixsmart.enums;
-
-import com.mixsmart.utils.StringUtils;
-
-/**
- * 是否类型
- * @version 1.0
- * @since JDK1.6以上
- * @author lmq 
- * 2016年2月1日
- */
-public enum YesNoType {
-    
-    /**
-     * 0 -- 否
-     */
-    NO(0, false, "0", "否"),
-    /**
-     * 1 -- 是
-     */
-    YES(1, true, "1", "是");
-    
-    private int index;
-    private Boolean value;
-    private String strValue;
-    private String text;
-    
-    private YesNoType(int index,boolean value, String strValue,String text) {
-        this.index = index;
-        this.value = value;
-        this.strValue = strValue;
-        this.text = text;
-    }
-    
-    /**
-     * 通过INDEX值获取是否类型对象
-     * @param index 值
-     * @return 返回index对应的类型对象
-     */
-    public static YesNoType getObj(int index) {
-        YesNoType yesNoType = null;
-        for (YesNoType yesNo : YesNoType.values()) {
-            if(yesNo.getIndex() == index) {
-                yesNoType = yesNo;
-                break;
-            }
-        }
-        return yesNoType;
-    }
-    
-    /**
-     * 通过value值获取是否类型对象;如果没有获取对象,则返回默认对象;
-     * 默认值为: {@link #NO}
-     * @param value 值
-     * @return 返回value对应的类型对象
-     */
-    public static YesNoType getSupportDefaultObj(int index) {
-        YesNoType yesNoType = getObj(index);
-        if(null == yesNoType) {
-            yesNoType = NO;
-        }
-        return yesNoType;
-    }
-    
-    /**
-     * 通过value值获取是否类型对象
-     * @param value 值
-     * @return 返回value对应的类型对象
-     */
-    public static YesNoType getObj(boolean value) {
-        YesNoType yesNoType = null;
-        for (YesNoType yesNo : YesNoType.values()) {
-            if(yesNo.getValue() == value) {
-                yesNoType = yesNo;
-                break;
-            }
-        }
-        return yesNoType;
-    }
-    
-    /**
-     * 通过value值获取是否类型对象;如果没有获取对象,则返回默认对象;
-     * 默认值为: {@link #NO}
-     * @param value 值
-     * @return 返回value对应的类型对象
-     */
-    public static YesNoType getSupportDefaultObj(boolean value) {
-        YesNoType yesNoType = getObj(value);
-        if(null == yesNoType) {
-            yesNoType = NO;
-        }
-        return yesNoType;
-    }
-    
-    /**
-     * 通过value值获取是否类型对象
-     * @param strValue 字符串值
-     * @return 返回value对应的类型对象
-     */
-    public static YesNoType getObjByStrValue(String strValue) {
-        YesNoType yesNoType = null;
-        if(StringUtils.isEmpty(strValue)) {
-            return yesNoType;
-        }
-        for (YesNoType yesNo : YesNoType.values()) {
-            if(yesNo.getStrValue().equals(strValue)) {
-                yesNoType = yesNo;
-                break;
-            }
-        }
-        return yesNoType;
-    }
-    
-    /**
-     * 通过 <code>value</code> 值获取是否类型对象;如果没有获取对象,则返回默认对象;
-     * 默认值为: {@link #NO}
-     * @param strValue 字符串值
-     * @return 返回是否类型对象
-     */
-    public static YesNoType getSupportDefaultObj(String strValue) {
-        YesNoType yesNoType = getObjByStrValue(strValue);
-        if(null == yesNoType) {
-            yesNoType = NO;
-        }
-        return yesNoType;
-    }
-    
-    /**
-     * 通过text值获取是否类型对象
-     * @param text 显示内容
-     * @return 返回是否类型对象
-     */
-    public static YesNoType getObj(String text) {
-        YesNoType yesNoType = null;
-        if(StringUtils.isEmpty(text)) {
-            return yesNoType;
-        }
-        for (YesNoType yesNo : YesNoType.values()) {
-            if(yesNo.getText().equals(text)) {
-                yesNoType = yesNo;
-                break;
-            }
-        }
-        return yesNoType;
-    }
-    
-    public int getIndex() {
-        return index;
-    }
-    
-    public void setIndex(int index) {
-        this.index = index;
-    }
-    
-    public boolean getValue() {
-        return value;
-    }
-    
-    public void setValue(boolean value) {
-        this.value = value;
-    }
-    
-    public String getText() {
-        return text;
-    }
-    
-    public void setText(String text) {
-        this.text = text;
-    }
-
-    public String getStrValue() {
-        return strValue;
-    }
-    
-}

+ 0 - 111
blade-service/blade-manager/src/main/java/com/mixsmart/security/Coder.java

@@ -1,111 +0,0 @@
-package com.mixsmart.security;
-
-import org.apache.commons.codec.binary.Base64;
-
-import javax.crypto.KeyGenerator;
-import javax.crypto.Mac;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.SecretKeySpec;
-import java.security.MessageDigest;
-
-/**
- * 算法定义
- * @author lmq
- *
- */
-public abstract class Coder {
-	public static final String KEY_SHA = "SHA";
-    public static final String KEY_MD5 = "MD5";
- 
-    /**
-     * MAC算法可选以下多种算法
-     * 
-     * <pre>
-     * HmacMD5 
-     * HmacSHA1 
-     * HmacSHA256 
-     * HmacSHA384 
-     * HmacSHA512
-     * </pre>
-     */
-    public static final String KEY_MAC = "HmacMD5";
- 
-    /**
-     * BASE64解密
-     * 
-     * @param key
-     * @return 返回字节数组
-     * @throws Exception
-     */
-    public static byte[] decryptBASE64(String key) throws Exception {
-       // return new BASE64Decoder().decodeBuffer(key);
-    	return Base64.decodeBase64(key);
-    }
- 
-    /**
-     * BASE64加密
-     * 
-     * @param key
-     * @return 返回加密后的值
-     * @throws Exception
-     */
-    public static String encryptBASE64(byte[] key) throws Exception {
-       // return new BASE64Encoder().encodeBuffer(key);
-    	return Base64.encodeBase64String(key);
-    }
- 
-    /**
-     * MD5加密
-     * @param data
-     * @return 返回加密后的值
-     * @throws Exception
-     */
-    public static byte[] encryptMD5(byte[] data) throws Exception {
-        MessageDigest md5 = MessageDigest.getInstance(KEY_MD5);
-        md5.update(data);
-        return md5.digest();
- 
-    }
- 
-    /**
-     * SHA加密
-     * 
-     * @param data
-     * @return 返回加密后的值
-     * @throws Exception
-     */
-    public static byte[] encryptSHA(byte[] data) throws Exception {
-        MessageDigest sha = MessageDigest.getInstance(KEY_SHA);
-        sha.update(data);
-        return sha.digest();
- 
-    }
- 
-    /**
-     * 初始化HMAC密钥
-     * 
-     * @return 返回初始化Key
-     * @throws Exception
-     */
-    public static String initMacKey() throws Exception {
-        KeyGenerator keyGenerator = KeyGenerator.getInstance(KEY_MAC);
-        SecretKey secretKey = keyGenerator.generateKey();
-        return encryptBASE64(secretKey.getEncoded());
-    }
- 
-    /**
-     * HMAC加密
-     * 
-     * @param data
-     * @param key
-     * @return 返回加密后的值
-     * @throws Exception
-     */
-    public static byte[] encryptHMAC(byte[] data, String key) throws Exception {
-        SecretKey secretKey = new SecretKeySpec(decryptBASE64(key), KEY_MAC);
-        Mac mac = Mac.getInstance(secretKey.getAlgorithm());
-        mac.init(secretKey);
-        return mac.doFinal(data);
- 
-    }
-}

+ 0 - 184
blade-service/blade-manager/src/main/java/com/mixsmart/security/DESCoder.java

@@ -1,184 +0,0 @@
-package com.mixsmart.security;
-
-import org.apache.commons.codec.binary.Base64;
-
-import javax.crypto.Cipher;
-import javax.crypto.KeyGenerator;
-import javax.crypto.SecretKey;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.DESKeySpec;
-import java.security.Key;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-
-/**
- * DES安全编码组件
- * 
- * <pre>
- * 支持 DES、DESede(TripleDES,就是3DES)、AES、Blowfish、RC2、RC4(ARCFOUR)
- * DES                  key size must be equal to 56
- * DESede(TripleDES)     key size must be equal to 112 or 168
- * AES                  key size must be equal to 128, 192 or 256,but 192 and 256 bits may not be available
- * Blowfish          key size must be multiple of 8, and can only range from 32 to 448 (inclusive)
- * RC2                  key size must be between 40 and 1024 bits
- * RC4(ARCFOUR)      key size must be between 40 and 1024 bits
- * 具体内容 需要关注 JDK Document http://.../docs/technotes/guides/security/SunProviders.html
- * </pre>
- * @version 1.0
- * @since 1.0
- */
-public abstract class DESCoder extends Coder{
-
-	/**
-     * ALGORITHM 算法 <br>
-     * 可替换为以下任意一种算法,同时key值的size相应改变。
-     * 
-     * <pre>
-     * DES                  key size must be equal to 56
-     * DESede(TripleDES)     key size must be equal to 112 or 168
-     * AES                  key size must be equal to 128, 192 or 256,but 192 and 256 bits may not be available
-     * Blowfish          key size must be multiple of 8, and can only range from 32 to 448 (inclusive)
-     * RC2                  key size must be between 40 and 1024 bits
-     * RC4(ARCFOUR)      key size must be between 40 and 1024 bits
-     * </pre>
-     * 
-     * 在Key toKey(byte[] key)方法中使用下述代码
-     * <code>SecretKey secretKey = new SecretKeySpec(key, ALGORITHM);</code> 替换
-     * <code>
-     * DESKeySpec dks = new DESKeySpec(key);
-     * SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
-     * SecretKey secretKey = keyFactory.generateSecret(dks);
-     * </code>
-     */
-    public static final String ALGORITHM = "DES";
- 
-    /**
-     * 转换密钥<br>
-     * 
-     * @param key
-     * @return 返回key对象
-     * @throws Exception
-     */
-    private static Key toKey(byte[] key) throws Exception {
-        DESKeySpec dks = new DESKeySpec(key);
-        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
-        SecretKey secretKey = keyFactory.generateSecret(dks);
-        // 当使用其他对称加密算法时,如AES、Blowfish等算法时,用下述代码替换上述三行代码
-        // SecretKey secretKey = new SecretKeySpec(key, ALGORITHM);
-        return secretKey;
-    }
- 
-    /**
-     * 解密
-     * 
-     * @param data
-     * @param key
-     * @return 返回解码字节数组
-     * @throws Exception
-     */
-    public static byte[] decrypt(byte[] data, String key) throws Exception {
-        Key k = toKey(encryptBASE64(key.getBytes()).getBytes());
-    	//Key k = generateKey(key);
-        Cipher cipher = Cipher.getInstance(ALGORITHM);
-        cipher.init(Cipher.DECRYPT_MODE, k);
-        return cipher.doFinal(data);
-    }
- 
-    /**
-     * 加密
-     * 
-     * @param data
-     * @param key
-     * @return 返回加密后的字节数组
-     * @throws Exception
-     */
-    public static byte[] encrypt(byte[] data, String key) throws Exception {
-        //Key k = toKey(Base64.encodeBase64(key.getBytes()));
-    	Key k = toKey(encryptBASE64(key.getBytes()).getBytes());
-    	//Key k = generateKey(key);
-        Cipher cipher = Cipher.getInstance(ALGORITHM);
-        cipher.init(Cipher.ENCRYPT_MODE, k);
-        return cipher.doFinal(data);
-    }
- 
-    /**
-     * 生成密钥
-     * 
-     * @return 返回初始化密钥
-     * @throws Exception
-     */
-    public static String initKey() throws Exception {
-        return initKey(null);
-    }
- 
-    /**
-     * 生成密钥
-     * 
-     * @param seed
-     * @return 返回初始化密钥
-     * @throws Exception
-     */
-    public static String initKey(String seed) throws Exception {
-        SecureRandom secureRandom = null;
-        if (seed != null) {
-            secureRandom = new SecureRandom(decryptBASE64(seed));
-        } else {
-            secureRandom = new SecureRandom();
-        }
-        KeyGenerator kg = KeyGenerator.getInstance(ALGORITHM);
-        kg.init(secureRandom);
-        SecretKey secretKey = kg.generateKey();
-        return encryptBASE64(secretKey.getEncoded());
-    }
-	
-    
-    /** 
-     * 获得秘密密钥 
-     *  
-     * @param secretKey 
-     * @return 返回秘密密钥
-     * @throws NoSuchAlgorithmException  
-     */  
-    @SuppressWarnings("unused")
-	private static SecretKey generateKey(String secretKey) throws NoSuchAlgorithmException{  
-        SecureRandom secureRandom = new SecureRandom(secretKey.getBytes());  
-        // 为我们选择的DES算法生成一个KeyGenerator对象  
-        KeyGenerator kg = null;  
-        try {  
-            kg = KeyGenerator.getInstance(ALGORITHM);  
-        } catch (NoSuchAlgorithmException e) {  
-        }  
-        kg.init(secureRandom);  
-        //kg.init(56, secureRandom);  
-          
-        // 生成密钥  
-        return kg.generateKey();  
-    }
-
-
-//    public static void main(String[] args) throws Exception{
-//        String phone="18683951945";
-//        final String  key="sajsajsajdjsdsaj";
-//        byte[] keyBytes= Base64.encodeBase64String(key.getBytes("UTF8")).getBytes();
-//
-//        DESKeySpec dks = new DESKeySpec(keyBytes);
-//        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
-//        SecretKey secretKey = keyFactory.generateSecret(dks);
-//
-//        //加密
-//        Cipher cipherEncode = Cipher.getInstance("DES");
-//        cipherEncode.init(Cipher.ENCRYPT_MODE, secretKey);
-//        byte[] desEncodebytes = cipherEncode.doFinal(phone.getBytes("UTF8"));
-//        String desEncode =Base64.encodeBase64URLSafeString(desEncodebytes);
-//        System.out.println(desEncode);
-//
-//        //解密
-//        Cipher cipherDecode = Cipher.getInstance("DES");
-//        cipherDecode.init(Cipher.DECRYPT_MODE, secretKey);
-//        byte[] desEncodebyte = Base64.decodeBase64(desEncode);
-//        byte[] desDecodebytes= cipherDecode.doFinal(desEncodebyte);
-//        String desDecode =new String(desDecodebytes,"UTF8");
-//        System.out.println(desDecode);
-//
-//    }
-}

+ 0 - 91
blade-service/blade-manager/src/main/java/com/mixsmart/security/PBECoder.java

@@ -1,91 +0,0 @@
-package com.mixsmart.security;
-
-import javax.crypto.Cipher;
-import javax.crypto.SecretKey;
-import javax.crypto.SecretKeyFactory;
-import javax.crypto.spec.PBEKeySpec;
-import javax.crypto.spec.PBEParameterSpec;
-import java.security.Key;
-import java.util.Random;
-
-/**
- * PBE安全编码组件
- * @version 1.0
- * @since 1.0
- */
-public class PBECoder extends Coder {
-	/**
-     * 支持以下任意一种算法
-     * 
-     * <pre>
-     * PBEWithMD5AndDES 
-     * PBEWithMD5AndTripleDES 
-     * PBEWithSHA1AndDESede
-     * PBEWithSHA1AndRC2_40
-     * </pre>
-     */
-    public static final String ALGORITHM = "PBEWITHMD5andDES";
-  
-    /**
-     * 盐初始化
-     * 
-     * @return 返回字节数组
-     * @throws Exception
-     */
-    public static byte[] initSalt() throws Exception {
-        byte[] salt = new byte[8];
-        Random random = new Random();
-        random.nextBytes(salt);
-        return salt;
-    }
-  
-    /**
-     * 转换密钥<br>
-     * 
-     * @param password
-     * @return 返回key
-     * @throws Exception
-     */
-    private static Key toKey(String password) throws Exception {
-        PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
-        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
-        SecretKey secretKey = keyFactory.generateSecret(keySpec);
-  
-        return secretKey;
-    }
-  
-    /**
-     * 加密
-     * 
-     * @param data 数据
-     * @param password 密码
-     * @param salt  盐
-     * @return 返回字节数组
-     * @throws Exception
-     */
-    public static byte[] encrypt(byte[] data, String password, byte[] salt) throws Exception {
-        Key key = toKey(password);
-        PBEParameterSpec paramSpec = new PBEParameterSpec(salt, 100);
-        Cipher cipher = Cipher.getInstance(ALGORITHM);
-        cipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
-        return cipher.doFinal(data);
-    }
-  
-    /**
-     * 解密
-     * 
-     * @param data  数据
-     * @param password 密码
-     * @param salt  盐
-     * @return 返回字节数组
-     * @throws Exception
-     */
-    public static byte[] decrypt(byte[] data, String password, byte[] salt) throws Exception {
-        Key key = toKey(password);
-        PBEParameterSpec paramSpec = new PBEParameterSpec(salt, 100);
-        Cipher cipher = Cipher.getInstance(ALGORITHM);
-        cipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
-        return cipher.doFinal(data);
-  
-    }
-}

+ 0 - 243
blade-service/blade-manager/src/main/java/com/mixsmart/security/RSACoder.java

@@ -1,243 +0,0 @@
-package com.mixsmart.security;
-
-import javax.crypto.Cipher;
-import java.security.*;
-import java.security.interfaces.RSAPrivateKey;
-import java.security.interfaces.RSAPublicKey;
-import java.security.spec.PKCS8EncodedKeySpec;
-import java.security.spec.X509EncodedKeySpec;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * RSA安全编码组件
- *
- * @version 1.0
- * @since 1.0
- */
-public abstract class RSACoder extends Coder{
-
-	public static final String KEY_ALGORITHM = "RSA";
-    public static final String SIGNATURE_ALGORITHM = "MD5withRSA";
- 
-    private static final String PUBLIC_KEY = "RSAPublicKey";
-    private static final String PRIVATE_KEY = "RSAPrivateKey";
- 
-    /**
-     * 用私钥对信息生成数字签名
-     * 
-     * @param data
-     *            加密数据
-     * @param privateKey
-     *            私钥
-     * 
-     * @return 返回数字签名
-     * @throws Exception
-     */
-    public static String sign(byte[] data, String privateKey) throws Exception {
-        // 解密由base64编码的私钥
-        byte[] keyBytes = decryptBASE64(privateKey);
-        // 构造PKCS8EncodedKeySpec对象
-        PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
-        // KEY_ALGORITHM 指定的加密算法
-        KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
-        // 取私钥匙对象
-        PrivateKey priKey = keyFactory.generatePrivate(pkcs8KeySpec);
-        // 用私钥对信息生成数字签名
-        Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
-        signature.initSign(priKey);
-        signature.update(data);
-        return encryptBASE64(signature.sign());
-    }
- 
-    /**
-     * 校验数字签名
-     * 
-     * @param data
-     *            加密数据
-     * @param publicKey
-     *            公钥
-     * @param sign
-     *            数字签名
-     * 
-     * @return 校验成功返回true 失败返回false
-     * @throws Exception
-     * 
-     */
-    public static boolean verify(byte[] data, String publicKey, String sign)
-            throws Exception {
- 
-        // 解密由base64编码的公钥
-        byte[] keyBytes = decryptBASE64(publicKey);
- 
-        // 构造X509EncodedKeySpec对象
-        X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
- 
-        // KEY_ALGORITHM 指定的加密算法
-        KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
- 
-        // 取公钥匙对象
-        PublicKey pubKey = keyFactory.generatePublic(keySpec);
- 
-        Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
-        signature.initVerify(pubKey);
-        signature.update(data);
- 
-        // 验证签名是否正常
-        return signature.verify(decryptBASE64(sign));
-    }
- 
-   /**
-    * 解密<br>
-    * 用私钥解密
-    * @param data
-    * @param key
-    * @return 返回字节数组
-    * @throws Exception
-    */
-    public static byte[] decryptByPrivateKey(byte[] data, String key)
-            throws Exception {
-        // 对密钥解密
-        byte[] keyBytes = decryptBASE64(key);
- 
-        // 取得私钥
-        PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
-        KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
-        Key privateKey = keyFactory.generatePrivate(pkcs8KeySpec);
- 
-        // 对数据解密
-        Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
-        cipher.init(Cipher.DECRYPT_MODE, privateKey);
- 
-        return cipher.doFinal(data);
-    }
- 
-    /**
-     * 解密<br>
-     * 用私钥解密
-     * 
-     * @param data
-     * @param key
-     * @return 返回字节数组
-     * @throws Exception
-     */
-    public static byte[] decryptByPublicKey(byte[] data, String key)
-            throws Exception {
-        // 对密钥解密
-        byte[] keyBytes = decryptBASE64(key);
- 
-        // 取得公钥
-        X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
-        KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
-        Key publicKey = keyFactory.generatePublic(x509KeySpec);
- 
-        // 对数据解密
-        Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
-        cipher.init(Cipher.DECRYPT_MODE, publicKey);
- 
-        return cipher.doFinal(data);
-    }
- 
-    /**
-     * 加密<br>
-     * 用公钥加密
-     * 
-     * @param data
-     * @param key
-     * @return 返回字节数组
-     * @throws Exception
-     */
-    public static byte[] encryptByPublicKey(byte[] data, String key)
-            throws Exception {
-        // 对公钥解密
-        byte[] keyBytes = decryptBASE64(key);
- 
-        // 取得公钥
-        X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes);
-        KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
-        Key publicKey = keyFactory.generatePublic(x509KeySpec);
- 
-        // 对数据加密
-        Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
-        cipher.init(Cipher.ENCRYPT_MODE, publicKey);
- 
-        return cipher.doFinal(data);
-    }
- 
-    /**
-     * 加密<br>
-     * 用私钥加密
-     * 
-     * @param data
-     * @param key
-     * @return 返回字节数组
-     * @throws Exception
-     */
-    public static byte[] encryptByPrivateKey(byte[] data, String key)
-            throws Exception {
-        // 对密钥解密
-        byte[] keyBytes = decryptBASE64(key);
- 
-        // 取得私钥
-        PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
-        KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
-        Key privateKey = keyFactory.generatePrivate(pkcs8KeySpec);
- 
-        // 对数据加密
-        Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
-        cipher.init(Cipher.ENCRYPT_MODE, privateKey);
- 
-        return cipher.doFinal(data);
-    }
- 
-    /**
-     * 取得私钥
-     * 
-     * @param keyMap
-     * @return 返回私钥
-     * @throws Exception
-     */
-    public static String getPrivateKey(Map<String, Object> keyMap)
-            throws Exception {
-        Key key = (Key) keyMap.get(PRIVATE_KEY);
- 
-        return encryptBASE64(key.getEncoded());
-    }
- 
-    /**
-     * 取得公钥
-     * 
-     * @param keyMap
-     * @return 返回公钥
-     * @throws Exception
-     */
-    public static String getPublicKey(Map<String, Object> keyMap)
-            throws Exception {
-        Key key = (Key) keyMap.get(PUBLIC_KEY);
- 
-        return encryptBASE64(key.getEncoded());
-    }
- 
-    /**
-     * 初始化密钥
-     * 
-     * @return 返回初始化密钥
-     * @throws Exception
-     */
-    public static Map<String, Object> initKey() throws Exception {
-        KeyPairGenerator keyPairGen = KeyPairGenerator
-                .getInstance(KEY_ALGORITHM);
-        keyPairGen.initialize(1024);
-        KeyPair keyPair = keyPairGen.generateKeyPair();
-        // 公钥
-        RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
-        // 私钥
-        RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
- 
-        Map<String, Object> keyMap = new HashMap<String, Object>(2);
- 
-        keyMap.put(PUBLIC_KEY, publicKey);
-        keyMap.put(PRIVATE_KEY, privateKey);
-        return keyMap;
-    }
-}

+ 0 - 128
blade-service/blade-manager/src/main/java/com/mixsmart/security/SecurityUtils.java

@@ -1,128 +0,0 @@
-package com.mixsmart.security;
-
-import com.mixsmart.utils.StringUtils;
-import org.apache.commons.codec.binary.Base64;
-
-import java.io.UnsupportedEncodingException;
-
-/**
- * 加密算法
- * @author lmq
- *
- */
-public class SecurityUtils {
-
-	/**
-	 * MD5加密
-	 * @param value
-	 * @return 返回MD5加密后的值
-	 */
-	public static String md5(String value) {
-		if(StringUtils.isNotEmpty(value)) {
-			byte[] bytes;
-			try {
-				bytes = value.getBytes("UTF-8");
-				bytes = Coder.encryptMD5(bytes);
-				StringBuffer md5StrBuff = new StringBuffer();
-				for (int i = 0; i < bytes.length; i++) {
-					if (Integer.toHexString(0xFF & bytes[i]).length() == 1)
-						md5StrBuff.append("0").append(Integer.toHexString(0xFF & bytes[i]));
-					else
-						md5StrBuff.append(Integer.toHexString(0xFF & bytes[i]));
-				}
-				value = md5StrBuff.toString();
-			} catch (UnsupportedEncodingException e) {
-				value = null;
-				e.printStackTrace();
-			} catch (Exception e) {
-				value = null;
-				e.printStackTrace();
-			}
-		}
-		return value;
-	}
-	
-	/**
-	 * SHA加密
-	 * @param value
-	 * @return 返回加密后的值
-	 */
-	public static String sha(String value) {
-		if(StringUtils.isNotEmpty(value)) {
-			byte[] bytes;
-			try {
-				bytes = value.getBytes("UTF-8");
-				bytes = Coder.encryptSHA(bytes);
-				value = byteArrayToHex(bytes);
-			} catch (UnsupportedEncodingException e) {
-				value = null;
-				e.printStackTrace();
-			} catch (Exception e) {
-				value = null;
-				e.printStackTrace();
-			}
-		}
-		return value;
-	}
-	
-	/**
-	 * 字符数组转化为十六进制
-	 * @param byteArray
-	 * @return 返回十六进制字符串
-	 */
-	private static String byteArrayToHex(byte[] byteArray) {
-		char[] hexDigits = {'0','1','2','3','4','5','6','7','8','9', 'A','B','C','D','E','F' };
-		char[] resultCharArray =new char[byteArray.length * 2];
-		int index = 0;
-		for(byte b :byteArray){
-			resultCharArray[index++] = hexDigits[b>>>4 & 0xf];
-			resultCharArray[index++] = hexDigits[b & 0xf];
-		}
-		return new String(resultCharArray);
-	}
-	
-	/**
-	 * DES加密
-	 * @param value
-	 * @param key
-	 * @return 返回加密后的值
-	 */
-	public static String desEncode(String value,String key) {
-		if(StringUtils.isNotEmpty(value) && StringUtils.isNotEmpty(key)) {
-			try {
-				byte[] bytes = value.getBytes("UTF-8");
-				bytes = DESCoder.encrypt(bytes,key);
-				value = Base64.encodeBase64String(bytes);
-			} catch (UnsupportedEncodingException e) {
-				e.printStackTrace();
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		}
-		return value;
-	}
-	
-	
-	/**
-	 * DES解密
-	 * @param value
-	 * @param key
-	 * @return 返回解密后的值
-	 */
-	public static String desDecode(String value,String key) {
-		try {
-			value = value.replace(" ", "+");
-			byte[] bytes = Base64.decodeBase64(value);
-			bytes = DESCoder.decrypt(bytes,key);
-			value = new String(bytes,"UTF8");
-		} catch (UnsupportedEncodingException e) {
-			value = null;
-			e.printStackTrace();
-		} catch (Exception e) {
-			value = null;
-			e.printStackTrace();
-		}
-		return value;
-	}
-	
-}

+ 0 - 71
blade-service/blade-manager/src/main/java/com/mixsmart/sort/ChinaNumSort.java

@@ -1,71 +0,0 @@
-package com.mixsmart.sort;
-
-import com.mixsmart.utils.StringUtils;
-
-/**
- * 简单的中文数字排序;应用于字符中含有中文数字时的排序
- * @author lmq  2017年4月28日
- * @version 1.0
- * @since 1.0
- */
-public class ChinaNumSort {
-
-	private final String[] CHINA_NUM = new String[]{"一","二","三","四","五","六","七","八","九","十"};
-	private static ChinaNumSort instance = new ChinaNumSort();
-
-	private ChinaNumSort() {
-
-	}
-
-	public static ChinaNumSort getIntance() {
-		return instance;
-	}
-
-	/**
-	 * 比较排序
-	 * @param value 值
-	 * @param otherValue 另外一个值
-	 * @return 返回比较结果;
-	 * 返回值请参考{@link Comparable#compareTo(Object)}的说明
-	 */
-	public int sort(String value, String otherValue) {
-		int result = 1;
-		if(StringUtils.isEmpty(value) || StringUtils.isEmpty(otherValue)) {
-			return result;
-		}
-		int[] posArray = getPosition(value);
-		if(posArray[0] == -1) {
-			return value.compareTo(otherValue);
-		}
-		int[] otherPosArray = getPosition(otherValue);
-		if(otherPosArray[0] == -1) {
-			return value.compareTo(otherValue);
-		}
-		if(posArray[0] == otherPosArray[0]) {
-			value = value.replace(CHINA_NUM[posArray[1]], String.valueOf(posArray[1]+1));
-			otherValue = otherValue.replace(CHINA_NUM[otherPosArray[1]], String.valueOf(otherPosArray[1]+1));
-			result = value.compareTo(otherValue);
-		} else {
-			result = value.compareTo(otherValue);
-		}
-		return result;
-	}
-
-	/**
-	 * 获取位置
-	 * @param value 获取value在<code>CHINA_NUM</code>数组中的位置
-	 * @return 返回所在位置
-	 */
-	private int[] getPosition(String value) {
-		int[] posArray = {-1,-1};
-		for (int i = 0; i < CHINA_NUM.length; i++) {
-			int pos = value.indexOf(CHINA_NUM[i]);
-			if(pos > -1) {
-				posArray[0] = pos;
-				posArray[1] = i;
-				break;
-			}
-		}
-		return posArray;
-	}
-}

+ 0 - 5
blade-service/blade-manager/src/main/java/com/mixsmart/utils/CustomFunction.java

@@ -2,7 +2,6 @@ package com.mixsmart.utils;
 
 
 import com.jfireel.expression.Expression;
-import com.mixsmart.security.SecurityUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.springblade.core.tool.utils.CollectionUtil;
 import org.springblade.core.tool.utils.Func;
@@ -1151,10 +1150,6 @@ public class CustomFunction {
 
 
 
-	private static Object crack(String password){
-//		return  SecurityUtils.desDecode(password, SSOUtils.getSecretKey());
-		return  SecurityUtils.desDecode(password, "qazwertyuioptgb");
-	}
 	/**
 	 * @Description 计算t1~t2,t3~t4 两个时间段的合计时间,unit 输入数值的单位
 	 * @Param [t1, t2, t3, t4, unit]

+ 0 - 117
blade-service/blade-manager/src/main/java/com/mixsmart/utils/FileClassifyUtils.java

@@ -1,117 +0,0 @@
-package com.mixsmart.utils;
-
-import com.mixsmart.config.SystemConfig;
-import com.mixsmart.constant.IMixConstant;
-
-/**
- * 文件分类工具类
- * @author lmq
- * @version 1.0
- * @since JDK1.6以上  2016年7月22日
- */
-public class FileClassifyUtils {
-
-    /**
-     * 获取目录 
-     * @param typeProp 配置类型属性名称
-     * @param dirProp 配置类型所在目录名称
-     * @param ext 文件扩展名
-     * @return 返回扩展名所在目录;
-     * 如果没有配置该扩展名对应的目录,则返回null
-     */
-    private static String getDir(String typeProp, String dirProp, String ext) {
-        if(StringUtils.isNotEmpty(typeProp) && StringUtils.isNotEmpty(dirProp)) {
-            String dirStr = null;
-            String configExt = SystemConfig.getInstance().getValue(typeProp);
-            String[] configExts = configExt.split(IMixConstant.MULTI_VALUE_SPLIT);
-            if(ArrayUtils.isArrayContainsIgnoreCase(configExts, ext)) {
-                dirStr = SystemConfig.getInstance().getValue(dirProp);
-            }
-            return dirStr;
-        } else {
-            return null;
-        }
-    }
-    
-    /**
-     * 获取图片存放路径
-     * @param ext 文件扩展名
-     * @return 返回该扩展名所在目录;
-     */
-    private static String getImagesDir(String ext) {
-        return getDir("upload.image.type", "upload.images.dir", ext);
-    }
-    
-    /**
-     * 获取图片存放路径
-     * @param ext 文件扩展名
-     * @return 返回该扩展名所在目录;
-     */
-    private static String getVideoDir(String ext) {
-        return getDir("upload.video.type", "upload.video.dir", ext);
-    }
-    
-    /**
-     * 获取图片存放路径
-     * @param ext 文件扩展名
-     * @return 返回该扩展名所在目录;
-     */
-    private static String getDocDir(String ext) {
-        return getDir("upload.doc.dir", "upload.doc.type", ext);
-    }
-    
-    /**
-     * 获取图片存放路径
-     * @param ext 文件扩展名
-     * @return 返回该扩展名所在目录;
-     */
-    private static String getAudioDir(String ext) {
-        return getDir("upload.audio.type", "upload.audio.dir", ext);
-    }
-    
-    /**
-     * 获取图片存放路径
-     * @param ext 文件扩展名
-     * @return 返回该扩展名所在目录;
-     */
-    private static String getOtherDir(String ext) {
-        return SystemConfig.getInstance().getValue("upload.other.dir");
-    }
-    
-    /**
-     * 获取归类目录
-     * @param ext 文件扩展名
-     * @return 返回该扩展名所在目录;
-     */
-    public static String getClassifyDir(String ext) {
-        String dir = getImagesDir(ext);
-        if(StringUtils.isEmpty(dir)) {
-            dir = getDocDir(ext);
-        }
-        if(StringUtils.isEmpty(dir)) {
-            dir = getVideoDir(ext);
-        }
-        if(StringUtils.isEmpty(dir)) {
-            dir = getAudioDir(ext);
-        }
-        if(StringUtils.isEmpty(dir)) {
-            dir = getOtherDir(ext);
-        }
-        return dir;
-    }
-    
-    /**
-     * 获取归类目录(返回的是相对路径;如:images,video,other等)
-     * @param ext 文件扩展名
-     * @return 返回该扩展名所在目录;
-     */
-    public static String getClassifyRelativeDir(String ext) {
-        String dir = getClassifyDir(ext);
-        if(StringUtils.isNotEmpty(dir)) {
-            dir = dir.substring(dir.lastIndexOf("/") + 1, dir.length());
-        }
-        return dir;
-    }
-	
-	
-}

+ 0 - 238
blade-service/blade-manager/src/main/java/com/mixsmart/utils/FileUtils.java

@@ -1,238 +0,0 @@
-package com.mixsmart.utils;
-
-import com.mixsmart.exception.FileNotExistException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.*;
-
-/**
- * 文件工具类
- * @author lmq
- * @since 1.0
- */
-public class FileUtils {
-
-	private static final Logger log = LoggerFactory.getLogger(FileUtils.class);
-	
-	/**
-	 * 获取文件分隔符
-	 * @return 返回系统对应的分隔符
-	 */
-	public static String getFileSeparator() {
-		return System.getProperty("file.separator");
-	}
-	
-	/**
-	 * 删除文件
-	 * @param filePath 文件路径
-	 * @return 成功返回:true;否则返回:false
-	 */
-	public static boolean deleteFile(String filePath) {
-		boolean is = false;
-		LoggerUtils.info(log, "删除文件...");
-		if(StringUtils.isNotEmpty(filePath)) {
-			File file = new File(filePath);
-			if(file.exists()) {
-				is = file.delete();
-				if(is) {
-					LoggerUtils.info(log, "["+filePath+"]文件删除[成功]..");
-				} else {
-					LoggerUtils.error(log, "["+filePath+"]文件删除[失败]..");
-				}
-			} else {
-				LoggerUtils.error(log, "文件不存在["+filePath+"]");
-			}
-		} else {
-			LoggerUtils.error(log, "文件路径为空");
-		}
-		return is;
-	}
-	
-	
-	/**
-	 * 读取文件内容
-	 * @param filePath 文件路径
-	 * @param isLine 是否换行符;返回内容中是否需要加回车;true表示加回车(即:\n);false表示不加回车
-	 * @return 返回读取到的字符串
-	 */
-	public static String readFile(String filePath, boolean isLine) {
-		StringBuilder content = null;
-		if(StringUtils.isNotEmpty(filePath)) {
-			File file = new File(filePath);
-			if(!file.exists()) {
-				LoggerUtils.error(log, "文件不存在["+filePath+"]");
-			} else {
-				try {
-					BufferedReader buffReader = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8"));
-					String line = null;
-					content = new StringBuilder();
-					while((line = buffReader.readLine()) != null) {
-						if(isLine) {
-							line = line+"\n";
-						}
-						content.append(line);
-					}
-					buffReader.close();
-					buffReader = null;
-				} catch (FileNotFoundException e) {
-					e.printStackTrace();
-				} catch (Exception e) {
-					e.printStackTrace();
-				}
-				
-			}
-		} else {
-			LoggerUtils.error(log, "文件路径为空");
-		}
-		return (null == content)?null:content.toString();
-	}
-	
-	
-	/**
-	 * 内容写入到文件
-	 * @param contents 内容
-	 * @param filePath 文件路径
-	 * @param cover 如果文件存在,是否覆盖;true--表示覆盖;false -- 表示不覆盖
-	 * @return 写入成功返回:true;否则返回:false
-	 */
-	public static boolean writeFile(String contents, String filePath, boolean cover) {
-		boolean is = false;
-		if(StringUtils.isNotEmpty(filePath) && StringUtils.isNotEmpty(contents)) {
-			File file = new File(filePath);
-			if(file.exists()) {
-				LoggerUtils.error(log, "文件已存在["+filePath+"]");
-				if(cover)
-					file.delete();
-				else 
-					return is;
-			}
-			File dir = file.getParentFile();
-			if(!dir.exists()) {
-				dir.mkdirs();
-			}
-			try {
-				BufferedWriter buffWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file,true),"UTF-8"));
-				buffWriter.write(contents);
-				buffWriter.flush();
-				buffWriter.close();
-				is = true;
-			} catch (FileNotFoundException e) {
-				e.printStackTrace();
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
-		} else {
-			LoggerUtils.error(log, "文件路径或内容为空");
-		}
-		return is;
-	}
-	
-	
-	
-	/**
-	 * 内容写入到文件中
-	 * @param filePath 文件路径
-	 * @param contents 写入文件的内容
-	 * @return 写入成功返回:true;否则返回:false
-	 */
-	public static boolean writeFile(String filePath, String contents) {
-		boolean is = false;
-		if(StringUtils.isNotEmpty(filePath)) {
-			is = writeFile(new File(filePath), contents);
-		}
-		return is;
-	}
-	
-	
-	
-	/**
-	 * 内容写入到文件中
-	 * @param file 文件对象
-	 * @param contents 写入文件的内容
-	 * @return 写入成功返回:true;否则返回:false
-	 */
-	public static boolean writeFile(File file, String contents) {
-		boolean is = false;
-		if(isExist(file)) {
-			try {
-				BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),"UTF-8"));
-				writer.write(contents);
-				writer.flush();
-				writer.close();
-				is = true;
-			} catch (FileNotFoundException e) {
-				e.printStackTrace();
-			}  catch (IOException e) {
-				e.printStackTrace();
-			}
-		} else {
-			LoggerUtils.error(log, "文件不存在["+file.getAbsolutePath()+"]");
-		}
-		return is;
-	}
-
-	/**
-	 * 判断文件是否存在
-	 * @param filePath 文件路径
-	 * @return 如果文件存在返回:true;否则返回:false
-	 * @since 2.0.8
-	 */
-	public static boolean isExist(String filePath) {
-		if(StringUtils.isEmpty(filePath)) {
-			return false;
-		}
-		return isExist(new File(filePath));
-	}
-
-	/**
-	 * 判断文件是否存在
-	 * @param file 文件对象
-	 * @return 如果文件存在返回:true;否则返回:false
-	 * @since 2.0.8
-	 */
-	public static boolean isExist(File file) {
-		return (null != file && file.exists());
-	}
-
-    /**
-     * 判断文是否不存在
-     * @param filePath 文件路径
-     * @return 如果不文件存在返回:true;否则返回:false
-     */
-	public static boolean isNotExist(String filePath) {
-	    return !isExist(filePath);
-    }
-
-    /**
-     *
-     * 判断文是否不存在
-     * @param file 文件对象
-     * @return 如果不文件存在返回:true;否则返回:false
-     */
-    public static boolean isNotExist(File file) {
-        return !isExist(file);
-    }
-
-    /**
-     * 判断文是否不存在的断言;如果文件不存在会抛异常
-     * @param filePath 文件路径
-     * @return 如果不文件存在返回:true;否则返回:false
-     */
-    public static void isNotExistAssert(String filePath) {
-        if(isNotExist(filePath)) {
-            throw new FileNotExistException(filePath, true);
-        }
-    }
-
-    /**
-     * 判断文是否不存在的断言;如果文件不存在会抛异常
-     * @param file 文件对象
-     * @return 如果不文件存在返回:true;否则返回:false
-     */
-    public static void isNotExistAssert(File file) {
-        if(isNotExist(file)) {
-            throw new FileNotExistException(file.getAbsolutePath(), true);
-        }
-    }
-}

+ 0 - 214
blade-service/blade-manager/src/main/java/com/mixsmart/utils/IdCardInfoExtractor.java

@@ -1,214 +0,0 @@
-package com.mixsmart.utils;
-
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-/**
- * 提取身份证相关信息 
- * @author lmq
- * @version 1.0
- * @since 1.0
- * 2015年8月22日
- */
-public class IdCardInfoExtractor {
-
-	// 省份
-	private String province;
-	// 城市
-	private String city;
-	// 区县
-	private String region;
-	// 年份
-	private int year;
-	// 月份
-	private int month;
-	// 日期
-	private int day;
-	// 性别
-	private String gender;
-	// 出生日期
-	private Date birthday;
-
-	@SuppressWarnings("serial")
-	private Map<String, String> cityCodeMap = new HashMap<String, String>() {
-		{
-			this.put("11", "北京");
-			this.put("12", "天津");
-			this.put("13", "河北");
-			this.put("14", "山西");
-			this.put("15", "内蒙古");
-			this.put("21", "辽宁");
-			this.put("22", "吉林");
-			this.put("23", "黑龙江");
-			this.put("31", "上海");
-			this.put("32", "江苏");
-			this.put("33", "浙江");
-			this.put("34", "安徽");
-			this.put("35", "福建");
-			this.put("36", "江西");
-			this.put("37", "山东");
-			this.put("41", "河南");
-			this.put("42", "湖北");
-			this.put("43", "湖南");
-			this.put("44", "广东");
-			this.put("45", "广西");
-			this.put("46", "海南");
-			this.put("50", "重庆");
-			this.put("51", "四川");
-			this.put("52", "贵州");
-			this.put("53", "云南");
-			this.put("54", "西藏");
-			this.put("61", "陕西");
-			this.put("62", "甘肃");
-			this.put("63", "青海");
-			this.put("64", "宁夏");
-			this.put("65", "新疆");
-			this.put("71", "台湾");
-			this.put("81", "香港");
-			this.put("82", "澳门");
-			this.put("91", "国外");
-		}
-	};
-
-	private IdCardValidator validator = null;
-
-	/**
-	 * 通过构造方法初始化各个成员属性
-	 * @param idcard
-	 */
-	public IdCardInfoExtractor(String idcard) {
-		try {
-			validator = new IdCardValidator();
-			if (validator.isValidatedAllIdcard(idcard)) {
-				if (idcard.length() == 15) {
-					idcard = validator.convertIdcarBy15bit(idcard);
-				}
-				// 获取省份
-				String provinceId = idcard.substring(0, 2);
-				Set<String> key = this.cityCodeMap.keySet();
-				for (String id : key) {
-					if (id.equals(provinceId)) {
-						this.province = this.cityCodeMap.get(id);
-						break;
-					}
-				}
-
-				// 获取性别
-				String id17 = idcard.substring(16, 17);
-				if (Integer.parseInt(id17) % 2 != 0) {
-					this.gender = "男";
-				} else {
-					this.gender = "女";
-				}
-
-				// 获取出生日期
-				String birthday = idcard.substring(6, 14);
-				Date birthdate = new SimpleDateFormat("yyyyMMdd").parse(birthday);
-				this.birthday = birthdate;
-				GregorianCalendar currentDay = new GregorianCalendar();
-				currentDay.setTime(birthdate);
-				this.year = currentDay.get(Calendar.YEAR);
-				this.month = currentDay.get(Calendar.MONTH) + 1;
-				this.day = currentDay.get(Calendar.DAY_OF_MONTH);
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-	
-	/**
-	 * 返回身份证号码解析结果
-	 */
-	public String toString() {   
-        return "省份:" + this.province + ",性别:" + this.gender + ",出生日期:"  
-                + this.birthday;   
-    }   
-  
-	
-    /*public static void main(String[] args) {
-        String idcard = "";   
-        IdCardInfoExtractor ie = new IdCardInfoExtractor(idcard);   
-        System.out.println(ie.toString());   
-    }*/
-
-    /**
-     * 获取省份
-     * @return 返回身份证号码解析出来的省份
-     */
-	public String getProvince() {
-		return province;
-	}
-
-	/**
-	 * 获取城市
-	 * @return 返回身份证号码解析出来的城市
-	 */
-	public String getCity() {
-		return city;
-	}
-
-	/**
-	 * 获取区县
-	 * @return 返回身份证号码解析出来的区县
-	 */
-	public String getRegion() {
-		return region;
-	}
-
-	/**
-	 * 获取出生年
-	 * @return 返回身份证号码解析出来的出生年
-	 */
-	public int getYear() {
-		return year;
-	}
-
-	/**
-	 * 获取出生月
-	 * @return 返回身份证号码解析出来的出生月
-	 */
-	public int getMonth() {
-		return month;
-	}
-
-	/**
-	 * 获取出生日
-	 * @return 返回身份证号码解析出来的出生日
-	 */
-	public int getDay() {
-		return day;
-	}
-
-	/**
-	 * 获取性别
-	 * @return 返回身份证号码解析出来的性别
-	 */
-	public String getGender() {
-		return gender;
-	}
-
-	/**
-	 * 获取生日
-	 * @return 返回身份证号码解析出来的生日
-	 */
-	public Date getBirthday() {
-		return birthday;
-	}
-
-	/**
-	 * 获取省市编号
-	 * @return 返回省市编号
-	 */
-	public Map<String, String> getCityCodeMap() {
-		return cityCodeMap;
-	}
-
-	/**
-	 * 身份证验证实例
-	 * @return 返回身份证验证实例
-	 */
-	public IdCardValidator getValidator() {
-		return validator;
-	}   
-
-}

+ 0 - 401
blade-service/blade-manager/src/main/java/com/mixsmart/utils/IdCardValidator.java

@@ -1,401 +0,0 @@
-package com.mixsmart.utils;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.regex.Pattern;
-
-/**
- * 身份证合法性校验
- * @author lmq
- * 15位身份证号码:第7、8位为出生年份(两位数),第9、10位为出生月份,第11、12位代表出生日期,第15位代表性别,奇数为男,偶数为女。  <br />
- * 18位身份证号码:第7、8、9、10位为出生年份(四位数),第11、第12位为出生月份,第13、14位代表出生日期,第17位代表性别,奇数为男,偶数为女。
- */
-public class IdCardValidator {
-
-	protected String codeAndCity[][] = { { "11", "北京" }, { "12", "天津" },
-			{ "13", "河北" }, { "14", "山西" }, { "15", "内蒙古" }, { "21", "辽宁" },
-			{ "22", "吉林" }, { "23", "黑龙江" }, { "31", "上海" }, { "32", "江苏" },
-			{ "33", "浙江" }, { "34", "安徽" }, { "35", "福建" }, { "36", "江西" },
-			{ "37", "山东" }, { "41", "河南" }, { "42", "湖北" }, { "43", "湖南" },
-			{ "44", "广东" }, { "45", "广西" }, { "46", "海南" }, { "50", "重庆" },
-			{ "51", "四川" }, { "52", "贵州" }, { "53", "云南" }, { "54", "西藏" },
-			{ "61", "陕西" }, { "62", "甘肃" }, { "63", "青海" }, { "64", "宁夏" },
-			{ "65", "新疆" }, { "71", "台湾" }, { "81", "香港" }, { "82", "澳门" },
-			{ "91", "国外" } };
-
-	private String cityCode[] = { "11", "12", "13", "14", "15", "21", "22",
-			"23", "31", "32", "33", "34", "35", "36", "37", "41", "42", "43",
-			"44", "45", "46", "50", "51", "52", "53", "54", "61", "62", "63",
-			"64", "65", "71", "81", "82", "91" };
-
-	// 每位加权因子
-	private int power[] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
-
-	// 第18位校检码
-	@SuppressWarnings("unused")
-	private String verifyCode[] = { "1", "0", "X", "9", "8", "7", "6", "5",
-			"4", "3", "2" };
-
-	/**
-	 * 验证所有的身份证的合法性
-	 * @param idcard
-	 * @return 验证成功返回:true;否则返回:false
-	 */
-	public boolean isValidatedAllIdcard(String idcard) {
-		if (idcard.length() == 15) {
-			idcard = this.convertIdcarBy15bit(idcard);
-		}
-		return this.isValidate18Idcard(idcard);
-	}
-
-	/**
-	 * <p>
-	 * 判断18位身份证的合法性
-	 * </p>
-	 * 根据〖中华人民共和国国家标准GB11643-1999〗中有关公民身份号码的规定,公民身份号码是特征组合码,由十七位数字本体码和一位数字校验码组成。
-	 * 排列顺序从左至右依次为:六位数字地址码,八位数字出生日期码,三位数字顺序码和一位数字校验码。
-	 * <p>
-	 * 顺序码: 表示在同一地址码所标识的区域范围内,对同年、同月、同 日出生的人编定的顺序号,顺序码的奇数分配给男性,偶数分配 给女性。
-	 * </p>
-	 * <p>
-	 * 1.前1、2位数字表示:所在省份的代码; 2.第3、4位数字表示:所在城市的代码; 3.第5、6位数字表示:所在区县的代码;
-	 * 4.第7~14位数字表示:出生年、月、日; 5.第15、16位数字表示:所在地的派出所的代码;
-	 * 6.第17位数字表示性别:奇数表示男性,偶数表示女性;
-	 * 7.第18位数字是校检码:也有的说是个人信息码,一般是随计算机的随机产生,用来检验身份证的正确性。校检码可以是0~9的数字,有时也用x表示。
-	 * </p>
-	 * <p>
-	 * 第十八位数字(校验码)的计算方法为: 1.将前面的身份证号码17位数分别乘以不同的系数。从第一位到第十七位的系数分别为:7 9 10 5 8 4
-	 * 2 1 6 3 7 9 10 5 8 4 2
-	 * </p>
-	 * <p>
-	 * 2.将这17位数字和系数相乘的结果相加。
-	 * </p>
-	 * <p>
-	 * 3.用加出来和除以11,看余数是多少?
-	 * </p>
-	 * 4.余数只可能有0 1 2 3 4 5 6 7 8 9 10这11个数字。其分别对应的最后一位身份证的号码为1 0 X 9 8 7 6 5 4 3
-	 * 2。
-	 * <p>
-	 * 5.通过上面得知如果余数是2,就会在身份证的第18位数字上出现罗马数字的Ⅹ。如果余数是10,身份证的最后一位号码就是2。
-	 * </p>
-	 * 
-	 * @param idcard
-	 * @return 验证成功返回:true;否则返回:false
-	 */
-	public boolean isValidate18Idcard(String idcard) {
-		// 非18位为假
-		if (idcard.length() != 18) {
-			return false;
-		}
-		// 获取前17位
-		String idcard17 = idcard.substring(0, 17);
-		// 获取第18位
-		String idcard18Code = idcard.substring(17, 18);
-		char c[] = null;
-		String checkCode = "";
-		// 是否都为数字
-		if (isDigital(idcard17)) {
-			c = idcard17.toCharArray();
-		} else {
-			return false;
-		}
-
-		if (null != c) {
-			int bit[] = new int[idcard17.length()];
-
-			bit = converCharToInt(c);
-
-			int sum17 = 0;
-
-			sum17 = getPowerSum(bit);
-
-			// 将和值与11取模得到余数进行校验码判断
-			checkCode = getCheckCodeBySum(sum17);
-			if (null == checkCode) {
-				return false;
-			}
-			// 将身份证的第18位与算出来的校码进行匹配,不相等就为假
-			if (!idcard18Code.equalsIgnoreCase(checkCode)) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * 验证15位身份证的合法性,该方法验证不准确,最好是将15转为18位后再判断,该类中已提供。
-	 * 
-	 * @param idcard
-	 * @return 验证成功返回:true;否则返回:false
-	 */
-	public boolean isValidate15Idcard(String idcard) {
-		// 非15位为假
-		if (idcard.length() != 15) {
-			return false;
-		}
-		// 是否全都为数字
-		if (isDigital(idcard)) {
-			String provinceid = idcard.substring(0, 2);
-			String birthday = idcard.substring(6, 12);
-			int year = Integer.parseInt(idcard.substring(6, 8));
-			int month = Integer.parseInt(idcard.substring(8, 10));
-			int day = Integer.parseInt(idcard.substring(10, 12));
-			// 判断是否为合法的省份
-			boolean flag = false;
-			for (String id : cityCode) {
-				if (id.equals(provinceid)) {
-					flag = true;
-					break;
-				}
-			}
-			if (!flag) {
-				return false;
-			}
-			// 该身份证生出日期在当前日期之后时为假
-			Date birthdate = null;
-			try {
-				birthdate = new SimpleDateFormat("yyMMdd").parse(birthday);
-			} catch (ParseException e) {
-				e.printStackTrace();
-			}
-			if (birthdate == null || new Date().before(birthdate)) {
-				return false;
-			}
-			// 判断是否为合法的年份
-			GregorianCalendar curDay = new GregorianCalendar();
-			int curYear = curDay.get(Calendar.YEAR);
-			int year2bit = Integer.parseInt(String.valueOf(curYear).substring(2));
-			// 判断该年份的两位表示法,小于50的和大于当前年份的,为假
-			if ((year < 50 && year > year2bit)) {
-				return false;
-			}
-			// 判断是否为合法的月份
-			if (month < 1 || month > 12) {
-				return false;
-			}
-			// 判断是否为合法的日期
-			boolean mflag = false;
-			curDay.setTime(birthdate); // 将该身份证的出生日期赋于对象curDay
-			switch (month) {
-			case 1:
-			case 3:
-			case 5:
-			case 7:
-			case 8:
-			case 10:
-			case 12:
-				mflag = (day >= 1 && day <= 31);
-				break;
-			case 2: // 公历的2月非闰年有28天,闰年的2月是29天。
-				if (curDay.isLeapYear(curDay.get(Calendar.YEAR))) {
-					mflag = (day >= 1 && day <= 29);
-				} else {
-					mflag = (day >= 1 && day <= 28);
-				}
-				break;
-			case 4:
-			case 6:
-			case 9:
-			case 11:
-				mflag = (day >= 1 && day <= 30);
-				break;
-			}
-			if (!mflag) {
-				return false;
-			}
-		} else {
-			return false;
-		}
-		return true;
-	}
-
-	/**
-	 * 将15位的身份证转成18位身份证
-	 * @param idcard 15位身份证号码
-	 * @return 返回转换后的18位身份证号码
-	 */
-	public String convertIdcarBy15bit(String idcard) {
-		String idcard17 = null;
-		// 非15位身份证
-		if (idcard.length() != 15) {
-			return null;
-		}
-		if (isDigital(idcard)) {
-			// 获取出生年月日
-			String birthday = idcard.substring(6, 12);
-			Date birthdate = null;
-			try {
-				birthdate = new SimpleDateFormat("yyMMdd").parse(birthday);
-			} catch (ParseException e) {
-				e.printStackTrace();
-			}
-			Calendar cday = Calendar.getInstance();
-			cday.setTime(birthdate);
-			String year = String.valueOf(cday.get(Calendar.YEAR));
-			idcard17 = idcard.substring(0, 6) + year + idcard.substring(8);
-			char c[] = idcard17.toCharArray();
-			String checkCode = "";
-			if (null != c) {
-				int bit[] = new int[idcard17.length()];
-				// 将字符数组转为整型数组
-				bit = converCharToInt(c);
-				int sum17 = 0;
-				sum17 = getPowerSum(bit);
-				// 获取和值与11取模得到余数进行校验码
-				checkCode = getCheckCodeBySum(sum17);
-				// 获取不到校验位
-				if (null == checkCode) {
-					return null;
-				}
-				// 将前17位与第18位校验码拼接
-				idcard17 += checkCode;
-			}
-		} else { // 身份证包含数字
-			return null;
-		}
-		return idcard17;
-	}
-
-	/**
-	 * 15位和18位身份证号码的基本数字和位数验校
-	 * 
-	 * @param idcard
-	 * @return 验证成功返回:true;否则返回:false
-	 */
-	public boolean isIdcard(String idcard) {
-		return idcard == null || "".equals(idcard) ? false : Pattern.matches(
-				"(^\\d{15}$)|(\\d{17}(?:\\d|x|X)$)", idcard);
-	}
-
-	/**
-	 * 15位身份证号码的基本数字和位数验校
-	 * @param idcard
-	 * @return 验证成功返回:true;否则返回:false
-	 */
-	public boolean is15Idcard(String idcard) {
-		return idcard == null || "".equals(idcard) ? false : Pattern.matches(
-				"^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$",
-				idcard);
-	}
-
-	/**
-	 * 18位身份证号码的基本数字和位数验校
-	 * @param idcard
-	 * @return 验证成功返回:true;否则返回:false
-	 */
-	public boolean is18Idcard(String idcard) {
-		return Pattern
-				.matches(
-						"^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([\\d|x|X]{1})$",
-						idcard);
-	}
-
-	/**
-	 * 数字验证
-	 * @param str
-	 * @return 验证成功返回:true;否则返回:false
-	 */
-	public boolean isDigital(String str) {
-		return str == null || "".equals(str) ? false : str.matches("^[0-9]*$");
-	}
-
-	/**
-	 * 将身份证的每位和对应位的加权因子相乘之后,再得到和值
-	 * @param bit
-	 * @return int
-	 */
-	public int getPowerSum(int[] bit) {
-		int sum = 0;
-		if (power.length != bit.length) {
-			return sum;
-		}
-		for (int i = 0; i < bit.length; i++) {
-			for (int j = 0; j < power.length; j++) {
-				if (i == j) {
-					sum = sum + bit[i] * power[j];
-				}
-			}
-		}
-		return sum;
-	}
-
-	/**
-	 * 将和值与11取模得到余数进行校验码判断
-	 * @param sum17
-	 * @return 校验位
-	 */
-	public String getCheckCodeBySum(int sum17) {
-		String checkCode = null;
-		switch (sum17 % 11) {
-		case 10:
-			checkCode = "2";
-			break;
-		case 9:
-			checkCode = "3";
-			break;
-		case 8:
-			checkCode = "4";
-			break;
-		case 7:
-			checkCode = "5";
-			break;
-		case 6:
-			checkCode = "6";
-			break;
-		case 5:
-			checkCode = "7";
-			break;
-		case 4:
-			checkCode = "8";
-			break;
-		case 3:
-			checkCode = "9";
-			break;
-		case 2:
-			checkCode = "x";
-			break;
-		case 1:
-			checkCode = "0";
-			break;
-		case 0:
-			checkCode = "1";
-			break;
-		}
-		return checkCode;
-	}
-
-	/**
-	 * 将字符数组转为整型数组
-	 * @param c
-	 * @return 整型数组
-	 * @throws NumberFormatException
-	 */
-	public int[] converCharToInt(char[] c) throws NumberFormatException {
-		int[] a = new int[c.length];
-		int k = 0;
-		for (char temp : c) {
-			a[k++] = Integer.parseInt(String.valueOf(temp));
-		}
-		return a;
-	}
-
-	/*public static void main(String[] args) throws Exception {
-		//String idcard15 = "";
-		String idcard18 = "";
-		IdCardValidator iv = new IdCardValidator();
-		*//*boolean flag = false;
-		flag = iv.isValidate18Idcard(idcard18);
-		System.out.println(flag);
-
-		flag = iv.isValidate15Idcard(idcard15);
-		System.out.println(flag);
-
-		System.out.println(iv.convertIdcarBy15bit(idcard15));
-		flag = iv.isValidate18Idcard(iv.convertIdcarBy15bit(idcard15));
-		System.out.println(flag);*//*
-		System.out.println(iv.isValidatedAllIdcard(idcard18));
-	}*/
-}

+ 0 - 149
blade-service/blade-manager/src/main/java/com/mixsmart/utils/LoggerUtils.java

@@ -1,149 +0,0 @@
-package com.mixsmart.utils;
-
-import org.slf4j.Logger;
-
-/**
- * 日志工具类
- * @author lmq
- *
- */
-public class LoggerUtils {
-
-	/**
-	 * 记录INFO日志;如果 <code>msg</code> 参数需要拼接字符串,请使用{@link #info(Logger, String, Object...)} 方法
-	 * @param logger log4j实现类
-	 * @param msg 日志内容
-	 */
-	public static void info(Logger logger, String msg) {
-		if(logger.isInfoEnabled() && StringUtils.isNotEmpty(msg)) {
-			logger.info(msg);
-		}
-	}
-	
-	/**
-	 * 记录INFO日志;拼接例子,如:info("你好啊,{}","张三")
-	 * @param logger log4j实现类
-	 * @param msg 日志内容
-	 * @param args 日志参数
-	 */
-	public static void info(Logger logger, String msg, Object...args ) {
-		if(logger.isInfoEnabled() && StringUtils.isNotEmpty(msg)) {
-			logger.info(msg, args);
-		}
-	}
-	
-	/**
-	 * 记录DEBUG日志;如果 <code>msg</code> 参数需要拼接字符串,请使用{@link #debug(Logger, String, Object...)} 方法
-	 * @param logger log4j实现类
-	 * @param msg 日志内容
-	 */
-	public static void debug(Logger logger, String msg) {
-		if(logger.isDebugEnabled() && StringUtils.isNotEmpty(msg)) {
-			logger.debug(msg);
-		}
-	}
-	
-	/**
-	 * 记录DEBUG日志;拼接例子,如:info("你好啊,{}",new String[]{"张三"})
-	 * @param logger log4j实现类
-	 * @param msg 日志内容
-	 * @param args 日志参数
-	 */
-	public static void debug(Logger logger, String msg, Object...args ) {
-		if(logger.isDebugEnabled() && StringUtils.isNotEmpty(msg)) {
-			logger.debug(msg, args);
-		}
-	}
-	
-	/**
-	 * 记录ERROR日志
-	 * @param logger log4j实现类
-	 * @param msg 日志内容
-	 */
-	public static void error(Logger logger, String msg) {
-		if(logger.isErrorEnabled() && StringUtils.isNotEmpty(msg)) {
-			logger.error(msg);
-		}
-	}
-	
-	/**
-	 * 记录ERROR日志
-	 * @param logger log4j实现类
-	 * @param msg 日志内容
-	 * @param args 日志参数
-	 */
-	public static void error(Logger logger, String msg, Object...args ) {
-		if(logger.isErrorEnabled() && StringUtils.isNotEmpty(msg)) {
-			logger.error(msg, args);
-		}
-	}
-	
-	/**
-     * 记录ERROR日志
-     * @param logger log4j实现类
-     * @param msg 日志内容
-     * @param t 异常对象
-     */
-    public static void error(Logger logger, String msg, Throwable t) {
-        if(logger.isErrorEnabled() && StringUtils.isNotEmpty(msg)) {
-            logger.error(msg, t);
-        }
-    }
-    
-    /**
-     * 记录ERROR日志
-     * @param logger log4j实现类
-     * @param t 异常对象
-     */
-    public static void error(Logger logger, Throwable t) {
-        if(logger.isErrorEnabled()) {
-            logger.error("异常信息", t);
-        }
-    }
-	
-	/**
-	 * 记录WARN日志
-	 * @param logger log4j实现类
-	 * @param msg 日志内容
-	 */
-	public static void warn(Logger logger, String msg) {
-		if(logger.isWarnEnabled() && StringUtils.isNotEmpty(msg)) {
-			logger.warn(msg);
-		}
-	}
-	
-	/**
-	 * 记录WARN日志
-	 * @param logger log4j实现类
-	 * @param msg 日志内容
-	 * @param args 日志参数
-	 */
-	public static void warn(Logger logger, String msg, Object...args ) {
-		if(logger.isWarnEnabled() && StringUtils.isNotEmpty(msg)) {
-			logger.warn(msg, args);
-		}
-	}
-	
-	/**
-	 * 记录TRACE日志
-	 * @param logger log4j实现类
-	 * @param msg 日志内容
-	 */
-	public static void trace(Logger logger, String msg) {
-		if(logger.isTraceEnabled() && StringUtils.isNotEmpty(msg)) {
-			logger.trace(msg);
-		}
-	}
-	
-	/**
-	 * 记录TRACE日志
-	 * @param logger log4j实现类
-	 * @param msg 日志内容
-	 * @param args 日志参数
-	 */
-	public static void trace(Logger logger, String msg, Object...args ) {
-		if(logger.isTraceEnabled() && StringUtils.isNotEmpty(msg)) {
-			logger.trace(msg, args);
-		}
-	}
-}

+ 0 - 105
blade-service/blade-manager/src/main/java/com/mixsmart/utils/NetUtils.java

@@ -1,105 +0,0 @@
-package com.mixsmart.utils;
-
-import java.net.*;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-/**
- * 网络相关工具类;
- * 如获取本地IP地址;MAC地址等
- * @author lmq <br />
- * 2016年12月20日
- * @version 1.0
- * @since 1.0
- */
-public class NetUtils {
-
-	/*private NetUtils() {
-		throw new UnsupportedOperationException("NetUtils类无法实例化");
-	}
-	*//**
-	 * 获取本地IP地址
-	 * @return 返回获取到的IP地址
-	 *//*
-	public static String getLocalIPv4() {
-		String ip = null;
-		try {
-			ip = InetAddress.getLocalHost().getHostAddress();
-		} catch (UnknownHostException e) {
-			e.printStackTrace();
-		}
-		return ip;
-	}
-
-	*//**
-	 * 获取本地所有激活了的IP地址(不包含127.0.0.1地址)
-	 * @return 返回IP数组
-	 *//*
-	public static String[] getLocalAllIPv4() {
-		String[] ipArray = null;
-		List<String> ips = new ArrayList<String>();
-		try {
-			Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
-			while(nets.hasMoreElements()) {
-				NetworkInterface net = nets.nextElement();
-				if(net.isUp() && !net.isLoopback() && !net.isVirtual()) {
-					List<InterfaceAddress> list = net.getInterfaceAddresses();
-					for(InterfaceAddress interfaceAddr : list) {
-						String ip = interfaceAddr.getAddress().getHostAddress();
-						if(StringUtils.isNotEmpty(ip) && (ip.split("\\.")).length == 4) {
-							ips.add(ip);
-						}
-					}
-				}//if
-			}//while
-		} catch (SocketException e) {
-			e.printStackTrace();
-		}
-		if(ips.size()>0) {
-			ipArray = new String[ips.size()];
-			ips.toArray(ipArray);
-		}
-		return ipArray;
-	}
-
-	*//**
-	 * 获取本地所有MAC
-	 * @return 返回MAC数组
-	 *//*
-	public static String[] getLocalAllMac() {
-		String[] macArray = null;
-		List<String> macList = new ArrayList<String>();
-		try {
-			Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
-			while(nets.hasMoreElements()) {
-				NetworkInterface net = nets.nextElement();
-				if(net.isUp() && !net.isLoopback() && !net.isVirtual()) {
-					byte[] macBytes = net.getHardwareAddress();
-					StringBuilder sb = new StringBuilder();
-					for(int i= 0; i<macBytes.length; i++) {
-						if(i != 0 ) {
-							sb.append("-");
-						}
-						//字节转换为整数
-						int temp = macBytes[i] & 0xff;
-						String str = Integer.toHexString(temp);
-						if(str.length() == 1) {
-							sb.append("0" + str);
-						} else {
-							sb.append(str);
-						}
-					}//for
-					macList.add(sb.toString().toUpperCase());
-				}//if
-			}//while
-		} catch (SocketException e) {
-			e.printStackTrace();
-		}
-		if(macList.size()>0) {
-			macArray = new String[macList.size()];
-			macList.toArray(macArray);
-		}
-		return macArray;
-	}*/
-}

+ 172 - 0
blade-service/blade-manager/src/main/java/com/mixsmart/utils/ReflectionUtil.java

@@ -0,0 +1,172 @@
+package com.mixsmart.utils;
+
+import com.alibaba.cloud.commons.lang.StringUtils;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.lang.annotation.Annotation;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * @author yangyj
+ * @Date 2022/7/11 17:17
+ * @description TODO
+ */
+public class ReflectionUtil {
+    /**
+     * 定义类集合(用于存放所有加载的类)
+     */
+    private static final Set<Class<?>> CLASS_SET;
+
+    static {
+        //指定加载包路径
+        CLASS_SET = getClassSet("org.springblade.manager.formula");
+    }
+
+    /**
+     * 获取类加载器
+     * @return
+     */
+    public static ClassLoader getClassLoader(){
+        return Thread.currentThread().getContextClassLoader();
+    }
+
+    /**
+     * 加载类
+     * @param className 类全限定名称
+     * @param isInitialized 是否在加载完成后执行静态代码块
+     * @return
+     */
+    public static Class<?> loadClass(String className,boolean isInitialized) {
+        Class<?> cls;
+        try {
+            cls = Class.forName(className,isInitialized,getClassLoader());
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException(e);
+        }
+        return cls;
+    }
+
+    public static Class<?> loadClass(String className) {
+        return loadClass(className,true);
+    }
+
+    /**
+     * 获取指定包下所有类
+     * @param packageName
+     * @return
+     */
+    public static Set<Class<?>> getClassSet(String packageName) {
+        Set<Class<?>> classSet = new HashSet<>();
+        try {
+            Enumeration<URL> urls = getClassLoader().getResources(packageName.replace(".","/"));
+            while (urls.hasMoreElements()) {
+                URL url = urls.nextElement();
+                if (url != null) {
+                    String protocol = url.getProtocol();
+                    if (protocol.equals("file")) {
+                        String packagePath = url.getPath().replace("%20","");
+                        addClass(classSet,packagePath,packageName);
+                    } else if (protocol.equals("jar")) {
+                        JarURLConnection jarURLConnection = (JarURLConnection) url.openConnection();
+                        if (jarURLConnection != null) {
+                            JarFile jarFile = jarURLConnection.getJarFile();
+                            if (jarFile != null) {
+                                Enumeration<JarEntry> jarEntries = jarFile.entries();
+                                while (jarEntries.hasMoreElements()) {
+                                    JarEntry jarEntry = jarEntries.nextElement();
+                                    String jarEntryName = jarEntry.getName();
+                                    if (jarEntryName.endsWith(".class")) {
+                                        String className = jarEntryName.substring(0, jarEntryName.lastIndexOf(".")).replaceAll("/", ".");
+                                        doAddClass(classSet,className);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+
+
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        return classSet;
+    }
+
+    private static void doAddClass(Set<Class<?>> classSet, String className) {
+        Class<?> cls = loadClass(className,false);
+        classSet.add(cls);
+    }
+
+    private static void addClass(Set<Class<?>> classSet, String packagePath, String packageName) {
+        final File[] files = new File(packagePath).listFiles(new FileFilter() {
+            @Override
+            public boolean accept(File file) {
+                return (file.isFile() && file.getName().endsWith(".class")) || file.isDirectory();
+            }
+        });
+        for (File file : files) {
+            String fileName = file.getName();
+            if (file.isFile()) {
+                String className = fileName.substring(0, fileName.lastIndexOf("."));
+                if (StringUtils.isNotEmpty(packageName)) {
+                    className = packageName + "." + className;
+                }
+                doAddClass(classSet,className);
+            } else {
+                String subPackagePath = fileName;
+                if (StringUtils.isNotEmpty(packagePath)) {
+                    subPackagePath = packagePath + "/" + subPackagePath;
+                }
+                String subPackageName = fileName;
+                if (StringUtils.isNotEmpty(packageName)) {
+                    subPackageName = packageName + "." + subPackageName;
+                }
+                addClass(classSet,subPackagePath,subPackageName);
+            }
+        }
+    }
+
+
+    public static Set<Class<?>> getClassSet() {
+        return CLASS_SET;
+    }
+
+    /**
+     * 获取应用包名下某父类(或接口)的所有子类(或实现类)
+     * @param superClass
+     * @return
+     */
+    public static Set<Class<?>> getClassSetBySuper(Class<?> superClass) {
+        Set<Class<?>> classSet = new HashSet<>();
+        for (Class<?> cls : CLASS_SET) {
+            if (superClass.isAssignableFrom(cls) && !superClass.equals(cls)) {
+                classSet.add(cls);
+            }
+        }
+        return classSet;
+    }
+
+    /**
+     * 获取应用包名下带有某注解的类
+     * @param annotationClass
+     * @return
+     */
+    public static Set<Class<?>> getClassSetByAnnotation(Class<? extends Annotation> annotationClass) {
+        Set<Class<?>> classSet = new HashSet<>();
+        for (Class<?> cls : CLASS_SET) {
+            if (cls.isAnnotationPresent(annotationClass)) {
+                classSet.add(cls);
+            }
+        }
+        return classSet;
+    }
+}

+ 0 - 55
blade-service/blade-manager/src/main/java/com/mixsmart/utils/SQLUtils.java

@@ -1,55 +0,0 @@
-package com.mixsmart.utils;
-
-/**
- * SQL语句工具类
- * @author lmq
- * @version 1.0
- * @since JDK版本大于等于1.6
- * 2016年1月17日
- */
-public class SQLUtils {
-
-	private SQLUtils() {
-		throw new UnsupportedOperationException("SQLUtils类无法实例化"); 
-	}
-	
-	/**
-	 * 判断语句是否为查询语句
-	 * @param statement 语句
-	 * @return 如果是查询语句;返回:true;否则返回:false
-	 */
-	public static boolean isSelect(String statement) {
-		boolean is = StringUtils.isNotEmpty(statement)?(statement.trim().startsWith("select ")?true:false):false;
-		//为HQL语句时
-		is = is || StringUtils.isNotEmpty(statement)?(statement.trim().startsWith("from ")?true:false):false;
-		return is;
-	}
-	
-	/**
-	 * 判断语句是否为插入语句
-	 * @param statement 语句
-	 * @return 如果是插入语句;返回:true;否则返回:false
-	 */
-	public static boolean isInsert(String statement) {
-		return StringUtils.isNotEmpty(statement)?(statement.trim().startsWith("insert ")?true:false):false;
-	}
-	
-	/**
-	 * 判断语句是否为更新语句
-	 * @param statement 语句
-	 * @return 如果是更新语句;返回:true;否则返回:false
-	 */
-	public static boolean isUpdate(String statement) {
-		return StringUtils.isNotEmpty(statement)?(statement.trim().startsWith("update ")?true:false):false;
-	}
-	
-	/**
-	 * 判断语句是否为删除语句
-	 * @param statement 语句
-	 * @return 如果是删除语句;返回:true;否则返回:false
-	 */
-	public static boolean isDelete(String statement) {
-		return StringUtils.isNotEmpty(statement)?(statement.trim().startsWith("delete ")?true:false):false;
-	}
-	
-}

+ 0 - 155
blade-service/blade-manager/src/main/java/com/mixsmart/utils/ShortTimeFormat.java

@@ -1,155 +0,0 @@
-package com.mixsmart.utils;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * 短时间格式
- * @author lmq
- * @version 1.0
- * @since JDK版本大于等于1.6
- * 2016年1月25日
- */
-public class ShortTimeFormat {
-
-	private Date pDate;
-	
-	private Date currentDate;
-	
-	private String dateFormatter = "yyyy-MM-dd HH:mm:ss";
-	
-	
-	private final static long SECONDS = 1000;
-	
-	private final static long MINUTE = 60*SECONDS;
-	
-	private final static long HOURS = 60*MINUTE;
-	
-	private final static long DAY = 24*HOURS; 
-	
-	private final static long MONTH = 30*DAY;
-	
-	private final static long YEAR = 12*MONTH;
-	
-	
-	/**
-	 * 参数为时间类型的构造函数
-	 * @param pDate 时间
-	 */
-	public ShortTimeFormat(Date pDate) {
-		this.pDate = pDate;
-		this.currentDate = new Date();
-	}
-	
-	/**
-	 * 参数为时间格式字符串的构造函数
-	 * @param dateStr 时间类型
-	 * @throws Exception
-	 */
-	public ShortTimeFormat(String dateStr) throws Exception {
-		SimpleDateFormat dateFormate = new SimpleDateFormat(dateFormatter);
-		try {
-			this.pDate = dateFormate.parse(dateStr);
-			this.currentDate = new Date();
-		}catch (Exception e) {
-			throw new Exception("传入的时间格式错误");
-		}
-	}
-	
-	/**
-	 * 转化为短时间格式
-	 * @return 转化后的结果
-	 */
-	public String toShortTime() {
-		long pTime = pDate.getTime();
-		long cTime = currentDate.getTime();
-		long intervalTime = cTime-pTime;
-		String value = toShortHMS(intervalTime);
-		return value;
-	}
-	
-	/**
-	 * 转换为时分秒
-	 * @param intervalTime 间隔时间
-	 * @return 转化后的结果
-	 */
-	protected String toShortHMS(long intervalTime) {
-		String value = null;
-		if(intervalTime < DAY) {
-			int tNum = 0;
-			String unit = null;
-			if(intervalTime<MINUTE) {
-				tNum = (int) (intervalTime/SECONDS);
-				unit = "秒";
-			} else if(intervalTime<HOURS) {
-				tNum = (int)(intervalTime/MINUTE);
-				unit = "分钟";
-			} else {
-				tNum = (int)(intervalTime/HOURS);
-				unit = "小时";
-			}
-			if(tNum==0) {
-				tNum = 1;
-			}
-			value = tNum+unit+"前";
-		} else {
-			value = toShortDay(intervalTime);
-		}
-		return value;
-	}
-	
-	/**
-	 * 转换为天
-	 * @param intervalTime 间隔时间
-	 * @return 转化后的结果
-	 */
-	protected String toShortDay(long intervalTime) {
-		String value = null;
-		if(intervalTime<MONTH) {
-			int tNum = (int) (intervalTime/DAY);
-			if(tNum==0) {
-				tNum = 1;
-			}
-			value = tNum+"天前";
-		} else {
-			value = toShortMonth(intervalTime);
-		}
-		return value;
-	}
-	
-	/**
-	 * 转化为月
-	 * @param intervalTime 间隔时间
-	 * @return 转化后的结果
-	 */
-	protected String toShortMonth(long intervalTime) {
-		String value = null;
-		if(intervalTime<YEAR) {
-			int tNum = (int) (intervalTime/MONTH);
-			if(tNum==0) {
-				tNum = 1;
-			}
-			value = tNum+"月前";
-		} else {
-			value = toShortYear(intervalTime);
-		}
-		return value;
-		
-	}
-	
-	/**
-	 * 转化为年
-	 * @param intervalTime 间隔时间
-	 * @return 转化后的结果
-	 */
-	protected String toShortYear(long intervalTime) {
-		String value = null;
-		int tNum = (int) (intervalTime/YEAR);
-		if(tNum==0) {
-			tNum = 1;
-		}
-		value = tNum+"年前";
-		return value;
-	}
-	
-}

+ 2 - 13
blade-service/blade-manager/src/main/java/com/mixsmart/utils/StringUtils.java

@@ -1,12 +1,10 @@
 package com.mixsmart.utils;
 
 
-import com.jfireel.expression.Expression;
+
 import com.jfirer.baseutil.encrypt.Md5Util;
 import com.mixsmart.constant.IMixConstant;
 import com.mixsmart.exception.NullArgumentException;
-import com.mixsmart.sort.ChinaNumSort;
-
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
@@ -834,16 +832,7 @@ public class StringUtils {
         return sets;
     }
 	
-	/**
-	 * 含有中文数字的排序(比较两值)
-	 * @param value1
-	 * @param value2
-	 * @return 返回比较结果
-	 */
-	public static int chinaNumSort(String value1, String value2) {
-		//判断同一个位置是否含有中文数字
-		return ChinaNumSort.getIntance().sort(value1, value2);
-	}
+
 	
 	/**
 	 * 处理URL参数;

+ 6 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -22,6 +22,7 @@ import org.springblade.manager.entity.WbsTree;
 import org.springblade.manager.formula.IFcHandler;
 import org.springblade.manager.mapper.FormulaMapper;
 import org.springblade.manager.service.IFormulaService;
+import org.springblade.manager.service.IWbsTreeContractService;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
@@ -41,6 +42,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
 
     private final WbsParamServiceImpl wpService;
     private final MileageClient mileageClient;
+    private final IWbsTreeContractService treeContractService;
 
 
     public final static String WP="WP";
@@ -341,19 +343,21 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                    String tmp =m.group();
                    tmp=tmp.replace("E[","").replace("]","");
                    List<String> cp = Arrays.asList(tmp.split(","));
-                   Map<String,FormData> map = new HashMap<>();
+                   Map<String,FormData> map = new LinkedHashMap<>();
                    fds.forEach(e->{
                        if(cp.contains(e.getCode())){
                            map.put(e.getCode(),fd);
                        }
                    });
+                   /*测点名称*/
                    List<ElementData> a = map.get(cp.get(0)).getValues();
+                   /*编号*/
                    List<ElementData> b = map.get(cp.get(2)).getValues();
                    int size=Math.min(a.size(),b.size());
                    for(int i=0;i<size;i++){
                         String k =a.get(i).getValue().toString();
                         String jz=b.get(i).getValue().toString();
-                       String[] coordinate = mileages.get(k+"@"+jz);
+                        String[] coordinate = mileages.get(k+"@"+jz);
                    }
                }
            }