代码优化

v1.4.1
Parker 4 years ago
parent 5c68f4c998
commit 42103319e0

@ -64,7 +64,8 @@ public final class HumpUtil {
public static String humpToUnderline(String para) {
StringBuilder sb = new StringBuilder(para);
int temp = 0;//定位
//定位
int temp = 0;
if (!para.contains(UNDERLINE)) {
for (int i = 0; i < para.length(); i++) {
if (Character.isUpperCase(para.charAt(i))) {

@ -1,7 +1,5 @@
package org.opsli.common.utils;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.TimeInterval;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.Maps;

@ -15,6 +15,8 @@
*/
package org.opsli.core.cache.pushsub.handler;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.opsli.api.wrapper.system.dict.DictWrapper;
@ -29,6 +31,7 @@ import org.opsli.plugins.cache.EhCachePlugin;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Collection;
import java.util.List;
/**
* @BelongsProject: opsli-boot
@ -41,7 +44,7 @@ import java.util.Collection;
public class DictHandler implements RedisPushSubHandler{
@Autowired
EhCachePlugin ehCachePlugin;
private EhCachePlugin ehCachePlugin;
@Override
public PushSubType getType() {
@ -54,15 +57,12 @@ public class DictHandler implements RedisPushSubHandler{
CacheType type = CacheType.valueOf((String) msgJson.get(MsgArgsType.DICT_TYPE.toString()));
if(DictModelType.COLLECTION == dictModelType){
Collection<Object> dicts = (Collection<Object>) msgJson.get(MsgArgsType.DICT_MODELS.toString());
for (Object dictObj : dicts) {
JSONObject jsonObject = msgJson.getJSONObject(MsgArgsType.DICT_MODEL.toString());
if(jsonObject == null){
continue;
Object dictListObj = msgJson.get(MsgArgsType.DICT_MODELS.toString());
List<DictWrapper> dictWrappers = Convert.toList(DictWrapper.class, dictListObj);
if(CollUtil.isNotEmpty(dictWrappers)){
for (DictWrapper dictWrapper : dictWrappers) {
this.handler(dictWrapper, type);
}
DictWrapper dictWrapperModel = jsonObject.toJavaObject(DictWrapper.class);
this.handler(dictWrapperModel, type);
}
} else if(DictModelType.OBJECT == dictModelType){
JSONObject jsonObject = msgJson.getJSONObject(MsgArgsType.DICT_MODEL.toString());

@ -37,7 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public class EdenDataHandler implements RedisPushSubHandler{
@Autowired
EhCachePlugin ehCachePlugin;
private EhCachePlugin ehCachePlugin;
@Override
public PushSubType getType() {

@ -36,7 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public class HotDataHandler implements RedisPushSubHandler{
@Autowired
EhCachePlugin ehCachePlugin;
private EhCachePlugin ehCachePlugin;
@Override
public PushSubType getType() {

@ -37,7 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public class MenuHandler implements RedisPushSubHandler{
@Autowired
EhCachePlugin ehCachePlugin;
private EhCachePlugin ehCachePlugin;
@Override
public PushSubType getType() {

@ -38,7 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public class OrgHandler implements RedisPushSubHandler{
@Autowired
EhCachePlugin ehCachePlugin;
private EhCachePlugin ehCachePlugin;
@Override
public PushSubType getType() {

@ -38,7 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public class TenantHandler implements RedisPushSubHandler{
@Autowired
EhCachePlugin ehCachePlugin;
private EhCachePlugin ehCachePlugin;
@Override
public PushSubType getType() {

@ -39,7 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
public class UserHandler implements RedisPushSubHandler{
@Autowired
EhCachePlugin ehCachePlugin;
private EhCachePlugin ehCachePlugin;
@Override
public PushSubType getType() {

@ -214,9 +214,9 @@ public class GlobalExceptionHandler {
//log.error("数据异常:{}",e.getMessage(),e);
// 默认值异常
if(StringUtils.contains(e.getMessage(),SQL_EXCEPTION)){
String Field = e.getMessage().replaceAll("Field '","")
String field = e.getMessage().replaceAll("Field '","")
.replaceAll("' doesn't have a default value","");
String msg = StrFormatter.format(CoreMsg.SQL_EXCEPTION_NOT_HAVE_DEFAULT_VALUE.getMessage(), Field);
String msg = StrFormatter.format(CoreMsg.SQL_EXCEPTION_NOT_HAVE_DEFAULT_VALUE.getMessage(), field);
return ResultVo.error(CoreMsg.SQL_EXCEPTION_NOT_HAVE_DEFAULT_VALUE.getCode(), msg);
}
String msg = StrFormatter.format(CoreMsg.SQL_EXCEPTION_UNKNOWN.getMessage(), e.getMessage());

@ -38,7 +38,7 @@ public class WafFilter implements Filter {
@Override
public void init(FilterConfig config) throws ServletException {
public void init(FilterConfig config) {
}
@Override

@ -110,7 +110,7 @@ public class WafHttpServletRequestWrapper extends HttpServletRequestWrapper {
}
@Override
public int read() throws IOException {
public int read() {
return bis.read();
}
};

@ -16,6 +16,7 @@
package org.opsli.plugins.redis.lock;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.IdUtil;
import lombok.extern.slf4j.Slf4j;
import org.opsli.plugins.redis.RedisLockPlugins;
import org.opsli.plugins.redis.RedisPlugin;
@ -25,7 +26,6 @@ import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
/**
* @BelongsProject: opsli-boot
@ -66,7 +66,7 @@ public class RedisLockImpl implements RedisLockPlugins {
@Override
public RedisLock tryLock(RedisLock redisLock) {
// 锁凭证
String identifier = UUID.randomUUID().toString().replaceAll("-","");
String identifier = IdUtil.simpleUUID();
redisLock = this.tryLock(redisLock,identifier);
if(redisLock != null){
log.info(this.getInfo("分布式锁 - 开启",redisLock));

@ -1,7 +1,6 @@
package org.opsli.plugins.redis.pushsub.receiver;
import com.alibaba.fastjson.JSONObject;
/**
* @BelongsProject: opsli-boot
@ -13,7 +12,7 @@ import com.alibaba.fastjson.JSONObject;
public abstract class BaseReceiver {
public static final String BASE_CHANNEL = "listener:msg:";
private String channel;
private final String channel;
public BaseReceiver(String channel){
this.channel = BASE_CHANNEL+channel;

Loading…
Cancel
Save