Commit e900ce25 authored by yanzg's avatar yanzg

修复bug

parent 89d894df
......@@ -10,7 +10,7 @@ import com.yanzuoguang.util.exception.RuntimeCodeException;
*/
public class YzgError {
private static YzgErrorData error = new YzgErrorData("999.");
private static final YzgErrorData error = new YzgErrorData("999.");
private static void init() {
error.add("000", "%s");
......
......@@ -22,7 +22,7 @@ public class YzgErrorData {
/**
* 错误缓存消息
*/
private Map<String, String> ErrorCode = new HashMap<>();
private final Map<String, String> ErrorCode = new HashMap<>();
public YzgErrorData(String TAG) {
this.TAG = TAG;
......
......@@ -20,7 +20,7 @@ public class ObjectHelper {
/**
* 缓存的类型
*/
private static Map<Class<?>, HashMap<String, MethodField>> mapCache = new HashMap<>();
private static final Map<Class<?>, HashMap<String, MethodField>> mapCache = new HashMap<>();
// --------------------------------------------- 类型判断 ---------------------------------------------------------
......@@ -198,7 +198,7 @@ public class ObjectHelper {
try {
setByType(vType, target, field, value);
} catch (Exception ex) {
throw new RuntimeException(ex);
throw new RuntimeException("字段" + field + "设置错误", ex);
}
}
}
......@@ -219,7 +219,8 @@ public class ObjectHelper {
try {
setByType(target, item, value);
} catch (Exception ex) {
ExceptionHelper.handleException(ObjectHelper.class, ex, item.getName());
System.err.println("字段" + field + "设置错误");
ExceptionHelper.handleException(ObjectHelper.class, ex, field);
}
}
......@@ -254,7 +255,7 @@ public class ObjectHelper {
writeWithFromClass(to, from);
return (T) to;
} catch (Exception e) {
throw YzgError.getRuntimeException(e,"006",cls.getName());
throw YzgError.getRuntimeException(e, "006", cls.getName());
}
}
......
......@@ -16,7 +16,7 @@ public class MemoryCache<T> {
/**
* 缓存的对象
*/
private Map<String, MemoryCacheItem<T>> cache = new ConcurrentHashMap<>();
private final Map<String, MemoryCacheItem<T>> cache = new ConcurrentHashMap<>();
/**
* 清除时间
......@@ -26,7 +26,7 @@ public class MemoryCache<T> {
/**
* 是否自动清除缓存
*/
private boolean isAutoClear;
private final boolean isAutoClear;
/**
* 读取时是否激活
......
......@@ -14,12 +14,12 @@ public abstract class MemoryCacheNullUtil<T, M> {
* 缓存的公司和数据中心Id
* 缓存一个小时
*/
private MemoryCache<M> cache = new MemoryCache<>(60 * 60);
private final MemoryCache<M> cache = new MemoryCache<>(60 * 60);
/**
* 缓存的公司和数据中心Id
* 缓存一分钟
*/
private MemoryCache<Boolean> cacheIsNull = new MemoryCache<>(60);
private final MemoryCache<Boolean> cacheIsNull = new MemoryCache<>(60);
public MemoryCacheNullUtil() {
}
......
......@@ -2,6 +2,7 @@ package com.yanzuoguang.util.exception;
import com.yanzuoguang.util.contants.ResultConstants;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.log.Log;
import com.yanzuoguang.util.vo.ResponseResult;
/**
......@@ -29,8 +30,6 @@ public class ExceptionHelper {
*/
public static void handleException(Class<?> cls, Throwable ex, Object from) {
ex.printStackTrace();
// todo: 需要修改
// Log.error(ExceptionHelper.class, ex, StringHelper.toString(from));
}
/**
......
......@@ -60,7 +60,7 @@ public final class CheckerHelper {
public static final String DATE_CHECK_TYPE_MONTH = "month";
public static final String DATE_CHECK_TYPE_MONTH_CH = "月份";
private static YzgLanguage language = YzgLanguage.get();
private static final YzgLanguage language = YzgLanguage.get();
static {
language.setEnglishChinese(PARAM_NOT_NULL_TIPS, PARAM_NOT_NULL_TIPS_CH)
......
......@@ -56,7 +56,7 @@ public class DateAutoHelper {
/**
* 缓存的自动识别的格式正则表达式
*/
private static List<DateReplace> autoDateCache = new ArrayList<>();
private static final List<DateReplace> autoDateCache = new ArrayList<>();
static {
registerAutoFormat(DATE_FORMAT_NO_SPLIT_REGEX, DATE_FORMAT_COMMON_REPLACE);
......@@ -133,7 +133,7 @@ public class DateAutoHelper {
}
}
// 将正常格式的时间字符串转换为时间
return new SimpleDateFormat(DATETIME_FULL_FORMAT).parse(String.valueOf(date));
return new SimpleDateFormat(DATETIME_FULL_FORMAT).parse(date);
}
}
......@@ -48,10 +48,7 @@ public class DateHelper {
if (StringHelper.isEmpty(time)) {
return true;
}
if (StringHelper.compare(time, INIT_TIME.substring(0, time.length()))) {
return true;
}
return false;
return StringHelper.compare(time, INIT_TIME.substring(0, time.length()));
}
/**
......@@ -864,10 +861,7 @@ public class DateHelper {
if (fromDate != null && date.getTime() < fromDate.getTime()) {
return false;
}
if (toDate != null && date.getTime() > toDate.getTime()) {
return false;
}
return true;
return toDate == null || date.getTime() <= toDate.getTime();
}
/**
......
......@@ -11,7 +11,7 @@ import java.util.HashMap;
*/
public class EnumHelper {
private static HashMap<Class, Method> CacheMethod = new HashMap<>();
private static final HashMap<Class, Method> CacheMethod = new HashMap<>();
public static <T extends Enum<T>> T toEnum(String vStr, T vDefault) {
......
......@@ -13,7 +13,7 @@ public class Event<T> {
/**
* 事件列表
*/
private List<T> list = new ArrayList<>();
private final List<T> list = new ArrayList<>();
/**
* 添加处理对象
......
......@@ -320,10 +320,6 @@ public class FileHelper {
return false;
}
//删除当前目录
if (dirFile.delete()) {
return true;
} else {
return false;
}
return dirFile.delete();
}
}
......@@ -24,7 +24,7 @@ public class FormulaHelper {
private static final String EMPTY_CHAR = " ";
private static final String TEMP_VAR_NAME = "@temp";
private static FormulaHelper calcInstance = new FormulaHelper();
private static final FormulaHelper calcInstance = new FormulaHelper();
/**
* 公式参数获取
......
......@@ -23,7 +23,7 @@ public class SfzhUtil {
/**
* 省、直辖市代码表
*/
public static final String cityCode[] = {
public static final 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"
......@@ -32,14 +32,14 @@ public class SfzhUtil {
/**
* 每位加权因子
*/
public static final int power[] = {
public static final int[] power = {
7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2
};
/**
* 第18位校检码
*/
public static final String verifyCode[] = {
public static final String[] verifyCode = {
"1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"
};
/**
......@@ -186,16 +186,13 @@ public class SfzhUtil {
if (validateIdCard18(card)) {
return true;
}
if (validateIdCard15(card)) {
return true;
}
return validateIdCard15(card);
// String[] cardval = validateIdCard10(card);
// if (cardval != null) {
// if (cardval[2].equals("true")) {
// return true;
// }
// }
return false;
}
/**
......@@ -252,14 +249,11 @@ public class SfzhUtil {
Calendar cal = Calendar.getInstance();
if (birthDate != null)
cal.setTime(birthDate);
if (!valiDate(cal.get(Calendar.YEAR), Integer.valueOf(birthCode.substring(2, 4)),
Integer.valueOf(birthCode.substring(4, 6)))) {
return false;
}
return valiDate(cal.get(Calendar.YEAR), Integer.valueOf(birthCode.substring(2, 4)),
Integer.valueOf(birthCode.substring(4, 6)));
} else {
return false;
}
return true;
}
/**
......@@ -268,10 +262,7 @@ public class SfzhUtil {
public static boolean validateCardOther(String idCard) {
String card = idCard.trim();
String[] cardval = validateIdCard10(card);
if (cardval != null && cardval[2].equals("true")) {
return true;
}
return false;
return cardval != null && cardval[2].equals("true");
}
/**
......@@ -339,7 +330,7 @@ public class SfzhUtil {
sum = sum + Integer.valueOf(c + "") * iflag;
iflag--;
}
return (sum % 10 == 0 ? 0 : (10 - sum % 10)) == Integer.valueOf(end) ? true : false;
return (sum % 10 == 0 ? 0 : (10 - sum % 10)) == Integer.valueOf(end);
}
/**
......@@ -373,12 +364,12 @@ public class SfzhUtil {
sum = sum + Integer.valueOf(c + "") * iflag;
iflag--;
}
if (end.toUpperCase().equals("A")) {
if (end.equalsIgnoreCase("A")) {
sum = sum + 10;
} else {
sum = sum + Integer.valueOf(end);
}
return (sum % 11 == 0) ? true : false;
return sum % 11 == 0;
}
/**
......@@ -595,7 +586,7 @@ public class SfzhUtil {
* @return 提取的数字。
*/
public static boolean isNum(String val) {
return val == null || "".equals(val) ? false : val.matches("^[0-9]*$");
return val != null && !"".equals(val) && val.matches("^[0-9]*$");
}
/**
......
......@@ -6,6 +6,7 @@ import com.yanzuoguang.util.exception.ExceptionHelper;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
......@@ -38,13 +39,10 @@ public class StringHelper {
* @return 检测结果
*/
public static boolean isEmptyChar(char p) {
if (p == '\r'
return p == '\r'
|| p == '\n'
|| p == '\t'
|| p == ' ') {
return true;
}
return false;
|| p == ' ';
}
/**
......@@ -898,7 +896,7 @@ public class StringHelper {
*/
public static String md5(String string) {
try {
byte[] hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8"));
byte[] hash = MessageDigest.getInstance("MD5").digest(string.getBytes(StandardCharsets.UTF_8));
StringBuilder hex = new StringBuilder(hash.length * 2);
for (byte b : hash) {
if ((b & 0xFF) < 0x10) {
......@@ -909,8 +907,6 @@ public class StringHelper {
return hex.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return StringHelper.EMPTY;
}
......@@ -927,7 +923,7 @@ public class StringHelper {
// 生成实现指定摘要算法的 MessageDigest 对象。
MessageDigest md = MessageDigest.getInstance("MD5");
// 使用指定的字节数组更新摘要。
md.update(from.getBytes(Charset.forName("utf-8")));
md.update(from.getBytes(StandardCharsets.UTF_8));
// 通过执行诸如填充之类的最终操作完成哈希计算。
byte[] b = md.digest();
// 生成具体的md5密码到buf数组
......@@ -1148,7 +1144,7 @@ public class StringHelper {
});
}
private static Pattern reg = Pattern.compile("\\{(.+?)\\}");
private static final Pattern reg = Pattern.compile("\\{(.+?)\\}");
/**
* 进行字段格式化处理
......@@ -1165,7 +1161,7 @@ public class StringHelper {
while (matches.find()) {
int len = matches.start() - start;
if (len > 0) {
sb.append(format.substring(start, matches.start()));
sb.append(format, start, matches.start());
}
String group = matches.group(0);
String fieldFull = matches.group(1);
......
......@@ -59,10 +59,7 @@ public class TypeHelper {
* @return
*/
public static boolean isClass(Class from, Class to) {
if (from.equals(to)) {
return true;
}
return false;
return from.equals(to);
}
/**
......
......@@ -40,16 +40,16 @@ public class YzgLanguage {
/**
* 当前线程默认语言
*/
private ThreadLocal<String> threadLanguage = new ThreadLocal<>();
private final ThreadLocal<String> threadLanguage = new ThreadLocal<>();
/**
* 当前线程默认场景
*/
private ThreadLocal<String> threadScene = new ThreadLocal<>();
private final ThreadLocal<String> threadScene = new ThreadLocal<>();
/**
* 场景语言
*/
private Map<String, Map<String, Map<String, String>>> mapScene = new HashMap<>();
private final Map<String, Map<String, Map<String, String>>> mapScene = new HashMap<>();
/**
* 设置默认语言,默认为英语(en)
......
......@@ -5,6 +5,7 @@ import com.yanzuoguang.util.YzgError;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
......@@ -45,7 +46,7 @@ public class ZipHelper {
dirName = dirFile.getName() + File.separator;
}
// 创建zip输出流
ZipOutputStream zipOutStream = new ZipOutputStream(new FileOutputStream(zipFile), Charset.forName("UTF-8"));
ZipOutputStream zipOutStream = new ZipOutputStream(new FileOutputStream(zipFile), StandardCharsets.UTF_8);
try {
// 创建缓冲输出流
BufferedOutputStream bufferOutStream = new BufferedOutputStream(zipOutStream);
......@@ -84,7 +85,7 @@ public class ZipHelper {
*/
public static void zipTo(File zipTo, File zipFrom, String sourcePath, File... sourceFiles) throws IOException {
// 创建zip输出流
ZipOutputStream zipOutStream = new ZipOutputStream(new FileOutputStream(zipTo), Charset.forName("UTF-8"));
ZipOutputStream zipOutStream = new ZipOutputStream(new FileOutputStream(zipTo), StandardCharsets.UTF_8);
try {
// 创建缓冲输出流
BufferedOutputStream bufferOutStream = new BufferedOutputStream(zipOutStream);
......@@ -121,10 +122,10 @@ public class ZipHelper {
ZipOutputStream zipOutStream;
if (exints) {
// 创建临时压缩文件
zipOutStream = new ZipOutputStream(new FileOutputStream(tempFile), Charset.forName("UTF-8"));
zipOutStream = new ZipOutputStream(new FileOutputStream(tempFile), StandardCharsets.UTF_8);
} else {
// 新创建压缩文件
zipOutStream = new ZipOutputStream(new FileOutputStream(zipTo), Charset.forName("UTF-8"));
zipOutStream = new ZipOutputStream(new FileOutputStream(zipTo), StandardCharsets.UTF_8);
}
try {
// 创建缓冲输出流
......
......@@ -15,12 +15,12 @@ public class Log {
/**
* 当前线程缓存的对象
*/
private static HashMap<String, LogDate> threadCache = new HashMap<>();
private static final HashMap<String, LogDate> threadCache = new HashMap<>();
/**
* 缓存的日志处理对象
*/
private static RunnableLog writeLogDefault = new LogDefault();
private static final RunnableLog writeLogDefault = new LogDefault();
/**
* 写入错误消息
......
......@@ -64,11 +64,11 @@ public class LogDefault implements RunnableLog {
sb.append(ex.getClass().getName());
sb.append(ex.getMessage());
sb.append(System.getProperty("line.separator"));
System.err.print(sb.toString());
System.err.print(sb);
ex.printStackTrace();
} else {
sb.append(System.getProperty("line.separator"));
System.out.print(sb.toString());
System.out.print(sb);
}
if (!StringHelper.isEmpty(pathFormat)) {
......
......@@ -13,7 +13,7 @@ import java.util.concurrent.TimeUnit;
* @author 颜佐光
*/
public abstract class AbstractThreadList<T extends Object> implements ThreadWaitExecute {
private long threadID;
private final long threadID;
/**
* 线程等待间隔
*/
......@@ -27,32 +27,32 @@ public abstract class AbstractThreadList<T extends Object> implements ThreadWait
/**
* 线程记录数量
*/
private int logSize = 1000;
private final int logSize = 1000;
/**
* 线程人数
*/
private volatile ThreadListNum threadListNum = new ThreadListNum();
private final ThreadListNum threadListNum = new ThreadListNum();
/**
* 缓存队列
*/
private volatile LinkedBlockingQueue<T> cache = new LinkedBlockingQueue<T>();
private final LinkedBlockingQueue<T> cache = new LinkedBlockingQueue<T>();
/**
* 缓存的线程
*/
private Map<Thread, ThreadListData<T>> cacheThread = new Hashtable<Thread, ThreadListData<T>>();
private final Map<Thread, ThreadListData<T>> cacheThread = new Hashtable<Thread, ThreadListData<T>>();
/**
* 缓存的异常数据
*/
private List<RuntimeException> exceptions = new ArrayList<>();
private final List<RuntimeException> exceptions = new ArrayList<>();
/**
* 等待对象
*/
private ThreadWait threadWait = new ThreadWait(this);
private final ThreadWait threadWait = new ThreadWait(this);
/**
* 线程开启数量
......@@ -214,10 +214,7 @@ public abstract class AbstractThreadList<T extends Object> implements ThreadWait
if (this.isWait()) {
return false;
}
if (cacheThread.size() == 0) {
return true;
}
return false;
return cacheThread.size() == 0;
}
/**
......
......@@ -17,27 +17,27 @@ public class RunPlan {
/**
* 任务锁
*/
private Object lock = new Object();
private final Object lock = new Object();
/**
* 任务队列
*/
private List<RunPlanData> list = new ArrayList<>();
private final List<RunPlanData> list = new ArrayList<>();
/**
* 增加时触发的事件队列
*/
private Event<Runnable> onAdd = new Event<>();
private final Event<Runnable> onAdd = new Event<>();
/**
* 增加时触发的事件队列
*/
private Event<Runnable> onRemove = new Event<>();
private final Event<Runnable> onRemove = new Event<>();
/**
* 单项成功执行时的事件队列
*/
private Event<Runnable> onItemExecuted = new Event<>();
private final Event<Runnable> onItemExecuted = new Event<>();
/**
* 全部执行完时触发的事件队列
*/
private Event<Runnable> onExecuted = new Event<>();
private final Event<Runnable> onExecuted = new Event<>();
/**
* 增加时触发的事件队列
......
......@@ -22,7 +22,7 @@ public final class RunnableListAuto {
/**
* 缓存的执行对象的数据大小
*/
private static Map<String, RunnableListAutoItem> cache = new Hashtable<String, RunnableListAutoItem>();
private static final Map<String, RunnableListAutoItem> cache = new Hashtable<String, RunnableListAutoItem>();
/**
* 自动开启线程去执行代码,并根据执行时间调整先后顺序
......
......@@ -12,7 +12,7 @@ import java.util.concurrent.Executors;
* @author 颜佐光
*/
public class ThreadHelper {
private static Object threadLock = new Object();
private static final Object threadLock = new Object();
private static boolean threadIsRun = false;
private static Date threadDate = null;
private static RunPlan timeout;
......@@ -22,7 +22,7 @@ public class ThreadHelper {
/**
* 线程对象
*/
private static ExecutorService executeService = Executors.newCachedThreadPool();
private static final ExecutorService executeService = Executors.newCachedThreadPool();
/**
* 初始化线程对象,需要调用该函数之后才能使用
......
......@@ -17,7 +17,7 @@ public class ThreadWait {
/**
* 需要判断的任务
*/
private ThreadWaitExecute execute;
private final ThreadWaitExecute execute;
/**
* 取消定时任务
......
......@@ -12,10 +12,10 @@ import java.util.Map;
* @author 颜佐光
*/
public class DataDaoVo<T> {
private List<T> creates = new ArrayList<>();
private List<T> updates = new ArrayList<>();
private List<T> removes = new ArrayList<>();
private Map<String, T> mapNow = new HashMap<>();
private final List<T> creates = new ArrayList<>();
private final List<T> updates = new ArrayList<>();
private final List<T> removes = new ArrayList<>();
private final Map<String, T> mapNow = new HashMap<>();
/**
* 将历史数据映射为HashMap
......
......@@ -97,7 +97,7 @@ public class TestSfzUtil {
* @return 提取的数字。
*/
public static boolean isNum(String val) {
return val == null || "".equals(val) ? false : val.matches("^[0-9]*$");
return val != null && !"".equals(val) && val.matches("^[0-9]*$");
}
......@@ -195,7 +195,7 @@ public class TestSfzUtil {
/**
* 每位加权因子
*/
public static final int power[] = {
public static final int[] power = {
7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2
};
}
......@@ -32,7 +32,7 @@ public class ChineseHelper {
* ^[\u4E00-\u9FFF]+$ 匹配简体和繁体
* ^[\u4E00-\u9FA5]+$ 匹配简体
*/
private static Pattern pattern = Pattern.compile("^[\u4E00-\u9FFF]+$");
private static final Pattern pattern = Pattern.compile("^[\u4E00-\u9FFF]+$");
/**
* 获取汉字全拼
......
......@@ -43,7 +43,7 @@ public class BaseRequestAspect {
@Autowired
protected CloudConfig cloudConfig;
private ResponseResult responseDefault = new ResponseResult();
private final ResponseResult responseDefault = new ResponseResult();
/**
* 开始记录日志对象
......
......@@ -20,7 +20,7 @@ public class RequestCacheResult {
/**
* 请求编号
*/
private String reqID;
private final String reqID;
/**
* 结果
......
......@@ -11,7 +11,7 @@ public class Timeout<T extends Object> {
/**
* 开始时间
*/
private long start;
private final long start;
/**
* 上次通知时间
......@@ -21,7 +21,7 @@ public class Timeout<T extends Object> {
/**
* 结束时间
*/
private T data;
private final T data;
/**
* 构造函数
......
......@@ -40,8 +40,8 @@ public class YzgFileProcedure implements InitializingBean {
/**
* 缓存24小时
*/
private MemoryCache<Boolean> folderCache = new MemoryCache<>(24 * 60 * 60);
private Map<String, Boolean> mapCallbackMQ = new HashMap<>();
private final MemoryCache<Boolean> folderCache = new MemoryCache<>(24 * 60 * 60);
private final Map<String, Boolean> mapCallbackMQ = new HashMap<>();
@Autowired
private MqService mqService;
......
......@@ -22,7 +22,7 @@ public class TokenServiceCall implements TokenLoad, ApplicationContextAware {
private TokenService tokenService = null;
private MemoryCache<Integer> countCache = new MemoryCache<>();
private final MemoryCache<Integer> countCache = new MemoryCache<>();
public TokenServiceCall() {
TokenHelper.setTokenLoad(this);
......
......@@ -22,7 +22,7 @@ public class SqlCondEquals extends SqlCondBase<SqlCondEquals> {
private boolean valIsInteger = false;
private Map<Object, Boolean> mapValue = new HashMap<>();
private final Map<Object, Boolean> mapValue = new HashMap<>();
public SqlCondEquals(String field, Object... vals) {
this(Arrays.asList(field), vals);
......
......@@ -35,7 +35,7 @@ public class TableSqlCache {
/**
* 根据Sql语句类型进行缓存,按照类型进行缓存
*/
private MemoryCache<List<SqlData>> typeCache = new MemoryCache<>();
private final MemoryCache<List<SqlData>> typeCache = new MemoryCache<>();
/**
* 构造函数
......
......@@ -30,7 +30,7 @@ public class TableStruct {
/**
* 缓存的字段,根据字段的类型进行缓存,同一个字段可能会属于多个类型。
*/
private Map<Integer, List<TableFieldVo>> typeFieldCache = new HashMap<>();
private final Map<Integer, List<TableFieldVo>> typeFieldCache = new HashMap<>();
/**
* 构造函数
......
......@@ -47,7 +47,7 @@ public class AllBeanRowMapper<T> implements RowMapper<T> {
/**
* 配置信息
*/
private ConfigDb configDb;
private final ConfigDb configDb;
/**
* 构造函数
......@@ -228,7 +228,7 @@ public class AllBeanRowMapper<T> implements RowMapper<T> {
/**
* 缓存的处理类
*/
private static Map<Class, Object> Cache = new HashMap<Class, Object>();
private static final Map<Class, Object> Cache = new HashMap<Class, Object>();
/**
* 获取可以转化实体
......
......@@ -30,7 +30,7 @@ import java.util.regex.Pattern;
* @author 颜佐光
*/
public class ExcelConsole<T extends Object> implements DbRow<T> {
private Pattern chinese = Pattern.compile("[^x00-xff]");
private final Pattern chinese = Pattern.compile("[^x00-xff]");
/**
* 配置信息
*/
......
......@@ -21,7 +21,7 @@ public class ExcelRowDefault implements ExcelRow<Object> {
return ObjectHelper.getString(row, field);
}
private static ExcelRowDefault my = new ExcelRowDefault();
private static final ExcelRowDefault my = new ExcelRowDefault();
/**
* 获取默认实例
......
......@@ -44,7 +44,7 @@ public class YzgFileServiceImpl implements YzgFileService, ApplicationContextAwa
private YzgFileProcedure procedure;
private MemoryCache<Boolean> cacheRemoveTempFolder = new MemoryCache<>(10 * 60);
private final MemoryCache<Boolean> cacheRemoveTempFolder = new MemoryCache<>(10 * 60);
/**
* Set the ApplicationContext that this object runs in.
......
......@@ -7,6 +7,7 @@ import com.yanzuoguang.util.thread.ThreadHelper;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -22,7 +23,7 @@ public class HlsDownloader {
/**
* 匹配ts文件
*/
private static Pattern pattern = Pattern.compile(".*ts");
private static final Pattern pattern = Pattern.compile(".*ts");
/**
* 源地址
*/
......@@ -160,7 +161,7 @@ public class HlsDownloader {
StringBuilder content = new StringBuilder();
URL url = new URL(this.serverUrl);
//下载资源
try (BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"))) {
try (BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) {
String line;
while ((line = in.readLine()) != null) {
content.append(line);
......
......@@ -12,7 +12,7 @@ import java.util.Map;
*/
public class MediaCacheLocal implements MediaCacheBase {
private Map<String, MapLock> mapLock = new HashMap<String, MapLock>();
private final Map<String, MapLock> mapLock = new HashMap<String, MapLock>();
/**
* 获取缓存是否正在执行
......
......@@ -24,7 +24,7 @@ public class MediaFirst {
@Autowired(required = false)
private MediaCache cache;
private MediaCacheBase cacheLocal = new MediaCacheLocal();
private final MediaCacheBase cacheLocal = new MediaCacheLocal();
public MediaFirst() {
......
......@@ -38,7 +38,7 @@ public class MessageLogServiceImpl implements MessageLogService {
@Autowired
private YzgMqProcedure yzgMqProcedure;
private ThreadLocal<Message> localMessage = new ThreadLocal<>();
private final ThreadLocal<Message> localMessage = new ThreadLocal<>();
/**
* 写入当前对象
......
......@@ -12,8 +12,8 @@ import java.util.Map;
* @author 颜佐光
*/
public class FormatCenter {
private static FormatCenter formatCenter = new FormatCenter();
private Map<String, FormatHandle> cache = new HashMap<>();
private static final FormatCenter formatCenter = new FormatCenter();
private final Map<String, FormatHandle> cache = new HashMap<>();
private boolean init = false;
private FormatCenter() {
......
......@@ -45,7 +45,7 @@ public class FormatHandleDefault implements FormatHandle {
}
StringBuilder sb = new StringBuilder();
sb.append(formatValue.substring(0, start));
sb.append(formatValue, 0, start);
for (int i = 0; i < size; i++) {
sb.append("*");
}
......
......@@ -20,25 +20,25 @@ public class CacheLock implements Runnable {
/**
* 缓存对象
*/
private Cache cache;
private final Cache cache;
/**
* Redis 锁定时间(豪秒)
*/
private int lockTime;
private final int lockTime;
/**
* 每次等待时间(毫秒)
*/
private int waitUnitTime;
private final int waitUnitTime;
/**
* 关键字
*/
private String key;
private final String key;
/**
* 执行函数
*/
private Runnable funcWait;
private final Runnable funcWait;
/**
* 执行函数
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment