日志查询Bug 修复

yun-zuoyi
wei.peng 5 years ago
parent 1bd9fe9e06
commit e5c31e3531

@ -46,4 +46,7 @@ public interface ISystemInitService {
*/ */
@ApiOperation(value = "获取缓存中的数据",notes = "获取缓存中的数据") @ApiOperation(value = "获取缓存中的数据",notes = "获取缓存中的数据")
Object getDataFromCache(String key,Class dataType); Object getDataFromCache(String key,Class dataType);
@ApiOperation(value = "重新加载Elasticsearch 客户端信息")
void reloadElasticSearchClient();
} }

@ -15,7 +15,6 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -40,8 +39,6 @@ public class AppStartSystemInit implements CommandLineRunner {
@Autowired @Autowired
private Environment environment; private Environment environment;
@Value("${spring.profiles.active}")
private String SPRING_PROFILES_ACTIVE;
// 限制组织数量 // 限制组织数量
private static final int organizeCount = 5; private static final int organizeCount = 5;
// 限制账号数量 // 限制账号数量
@ -75,10 +72,6 @@ public class AppStartSystemInit implements CommandLineRunner {
systemConfig.loadSystemConfig(CommonEnumUtil.SOFT_TYPE.CORE.getCode()); systemConfig.loadSystemConfig(CommonEnumUtil.SOFT_TYPE.CORE.getCode());
LOGGER.info("【IMPP-Core 加载系统配置文件到缓存完成】"); LOGGER.info("【IMPP-Core 加载系统配置文件到缓存完成】");
LOGGER.info("【IMPP-Core 加载 ElasticSearch中 ...】");
initImppElasticSearch();
LOGGER.info("【IMPP-Core 加载 ElasticSearch完成】");
LOGGER.info("【IMPP-License 加载 License ...】"); LOGGER.info("【IMPP-License 加载 License ...】");
ImppLicenseTool.getLicense(); ImppLicenseTool.getLicense();
LOGGER.info("【IMPP-License 加载 License完成】"); LOGGER.info("【IMPP-License 加载 License完成】");

@ -11,7 +11,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.SysMessage; import cn.estsh.i3plus.pojo.platform.bean.SysMessage;
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserMessage; import cn.estsh.i3plus.pojo.platform.bean.SysRefUserMessage;
import cn.estsh.i3plus.pojo.platform.bean.SysUser; import cn.estsh.i3plus.pojo.platform.bean.SysUser;
import cn.estsh.impp.framework.boot.util.RedisUtilTool; import cn.estsh.impp.framework.boot.util.RedisCacheTool;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -71,7 +71,7 @@ public class MessageMailQueueReceiver {
if (msg.getMessageReceiverType() != null) { if (msg.getMessageReceiverType() != null) {
if (msg.getMessageReceiverType().intValue() == ImppEnumUtil.MESSAGE_RECEIVER_TYPE.URGENT.getValue()) { if (msg.getMessageReceiverType().intValue() == ImppEnumUtil.MESSAGE_RECEIVER_TYPE.URGENT.getValue()) {
// 判断是否为系统紧急提示 微服注册状态提示 // 判断是否为系统紧急提示 微服注册状态提示
mailUtil.setTo(RedisUtilTool.getSysConfigStrVal(PlatformConstWords.CONTACT_MAIL)); mailUtil.setTo(RedisCacheTool.getSysConfigStrVal(PlatformConstWords.CONTACT_MAIL));
// 次数过于频繁 // 次数过于频繁
mailUtil.send(); mailUtil.send();

@ -11,7 +11,7 @@ import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem;
import cn.estsh.i3plus.pojo.platform.platbean.SysLogTaskTime; import cn.estsh.i3plus.pojo.platform.platbean.SysLogTaskTime;
import cn.estsh.impp.framework.base.schedule.BaseImppScheduleJob; import cn.estsh.impp.framework.base.schedule.BaseImppScheduleJob;
import cn.estsh.impp.framework.boot.init.ApplicationProperties; import cn.estsh.impp.framework.boot.init.ApplicationProperties;
import cn.estsh.impp.framework.boot.util.RedisUtilTool; import cn.estsh.impp.framework.boot.util.RedisCacheTool;
import org.quartz.DisallowConcurrentExecution; import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext; import org.quartz.JobExecutionContext;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -47,7 +47,7 @@ public class CoreLogClearJob extends BaseImppScheduleJob {
@Override @Override
public void executeImppJob(JobExecutionContext context, ApplicationProperties applicationProperties) { public void executeImppJob(JobExecutionContext context, ApplicationProperties applicationProperties) {
int to = RedisUtilTool.getSysConfigIntVal(CommonConstWords.LOG_STORAGE_DAYS, CommonConstWords.LOG_STORAGE_DAYS_DEFAULT); int to = RedisCacheTool.getSysConfigIntVal(CommonConstWords.LOG_STORAGE_DAYS, CommonConstWords.LOG_STORAGE_DAYS_DEFAULT);
Date thisTime = new Date(); Date thisTime = new Date();
String startTime = TimeTool.getToday(TimeTool.getDateBefore(thisTime, to)) + " 00:00:00"; String startTime = TimeTool.getToday(TimeTool.getDateBefore(thisTime, to)) + " 00:00:00";
String endTime = TimeTool.getToday(TimeTool.getDateBefore(thisTime, to)) + " 23:59:59"; String endTime = TimeTool.getToday(TimeTool.getDateBefore(thisTime, to)) + " 23:59:59";

@ -7,6 +7,7 @@ import cn.estsh.i3plus.core.api.iservice.busi.ISystemResourceService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.util.CommonConstWords; import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.platform.common.util.PlatformConstWords; import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
import cn.estsh.i3plus.platform.plugin.elasticsearch.ElasticSearchTool;
import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
@ -16,7 +17,8 @@ import cn.estsh.i3plus.pojo.platform.repository.SysConfigRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysDictionaryRepository; import cn.estsh.i3plus.pojo.platform.repository.SysDictionaryRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysLocaleLanguageRepository; import cn.estsh.i3plus.pojo.platform.repository.SysLocaleLanguageRepository;
import cn.estsh.impp.framework.boot.util.ImppRedis; import cn.estsh.impp.framework.boot.util.ImppRedis;
import cn.estsh.impp.framework.boot.util.RedisUtilTool; import cn.estsh.impp.framework.boot.util.ImppSystemTool;
import cn.estsh.impp.framework.boot.util.RedisCacheTool;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -25,10 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.estsh.i3plus.platform.common.util.CommonConstWords.RESOURCE_PREFIX_MENU; import static cn.estsh.i3plus.platform.common.util.CommonConstWords.RESOURCE_PREFIX_MENU;
@ -75,6 +74,7 @@ public class SystemInitService implements ISystemInitService {
putAndLoadSysConfig(); putAndLoadSysConfig();
putAndLoadSysDictionary(); putAndLoadSysDictionary();
putAndLoadSysLocaleLanguage(); putAndLoadSysLocaleLanguage();
reloadElasticSearchClient();
} }
@Override @Override
@ -83,7 +83,7 @@ public class SystemInitService implements ISystemInitService {
List<SysConfig> list = configRDao.findAll(); List<SysConfig> list = configRDao.findAll();
if(list != null && list.size() > 0){ if(list != null && list.size() > 0){
list.forEach(config -> { list.forEach(config -> {
RedisUtilTool.setSysConfigByConfigCode(config); RedisCacheTool.setSysConfigByConfigCode(config);
}); });
LOGGER.info("加载系统配置数量:【{}】",list.size()); LOGGER.info("加载系统配置数量:【{}】",list.size());
} }
@ -96,17 +96,16 @@ public class SystemInitService implements ISystemInitService {
List<SysDictionary> list = dictionaryRDao.findAll(); List<SysDictionary> list = dictionaryRDao.findAll();
if(list != null && list.size() > 0){ if(list != null && list.size() > 0){
list.stream().filter(sysDictionary-> sysDictionary.getParentCodeRdd() != null).forEach(System.out :: print); list.stream().filter(sysDictionary-> sysDictionary.getParentCodeRdd() != null).forEach(System.out :: print);
Map<String, List<SysDictionary>> parentCodeMap = list.stream().filter(sysDictionary-> sysDictionary.getParentCodeRdd() != null).collect(Collectors.groupingBy(SysDictionary::getParentCodeRdd)); Map<String, List<SysDictionary>> parentCodeMap = list.stream().filter(sysDictionary-> StringUtils.isNotBlank(sysDictionary.getParentCodeRdd())).collect(Collectors.groupingBy(SysDictionary::getParentCodeRdd));
Map<Long, List<SysDictionary>> parentIdMap = list.stream().collect(Collectors.groupingBy(SysDictionary::getParentId)); Map<Long, List<SysDictionary>> parentIdMap = list.stream().collect(Collectors.groupingBy(SysDictionary::getParentId));
for (String key : parentCodeMap.keySet()) { for (String key : parentCodeMap.keySet()) {
//存放于缓存 //存放于缓存
RedisUtilTool.setSysDictionaryListByCode(key, parentCodeMap.get(key)); RedisCacheTool.setSysDictionaryListByCode(key, parentCodeMap.get(key));
} }
for (long key : parentIdMap.keySet()) { for (long key : parentIdMap.keySet()) {
putDataToCache(CommonConstWords.REDIS_PREFIX_CACHE_DICTIONARY + ":" + key, parentIdMap.get(key),Object.class); RedisCacheTool.setSysDictionaryListByParentId(key,parentIdMap.get(key));
RedisUtilTool.setSysDictionaryListByParentId(key,parentIdMap.get(key));
} }
} }
}catch (Exception e){ }catch (Exception e){
@ -347,4 +346,23 @@ public class SystemInitService implements ISystemInitService {
} }
return null; return null;
} }
@Override
public void reloadElasticSearchClient() {
LOGGER.info("加载ElasticSearch Client Url 信息");
String url = RedisCacheTool.getSysConfigStrVal(CommonConstWords.PROP_IMPP_ELASTICSEARCH_CONFIG_URL);
if(StringUtils.isBlank(url)){
if(Objects.nonNull(ImppSystemTool.getEnvironment())){
url = ImppSystemTool.getEnvironment().getProperty(CommonConstWords.PROP_IMPP_ELASTICSEARCH_URL);
}
}
if(StringUtils.isBlank(url)){
url = CommonConstWords.PROP_IMPP_ELASTICSEARCH_DEFAULT_URL;
}
LOGGER.info("加载ElasticSearch Client Url:{}",url);
ElasticSearchTool.init(url);
LOGGER.info("加载ElasticSearch Client Url 信息完成");
}
} }

@ -28,7 +28,7 @@ import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum; import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
import cn.estsh.impp.framework.boot.util.ImppRedis; import cn.estsh.impp.framework.boot.util.ImppRedis;
import cn.estsh.impp.framework.boot.util.RedisUtilTool; import cn.estsh.impp.framework.boot.util.RedisCacheTool;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationException;
@ -609,7 +609,7 @@ public class SysUserService implements ISysUserService {
@Override @Override
public SessionUser packPageSessionUser(SessionUser sessionUser, SysUser user) { public SessionUser packPageSessionUser(SessionUser sessionUser, SysUser user) {
SysConfig configPageList = RedisUtilTool.getSysConfigByConfigCode(CommonConstWords.CONFIG_PAGE_SIZE_LIST); SysConfig configPageList = RedisCacheTool.getSysConfigByConfigCode(CommonConstWords.CONFIG_PAGE_SIZE_LIST);
try { try {
if(configPageList != null && StringUtils.isNotBlank(configPageList.getConfigValue())){ if(configPageList != null && StringUtils.isNotBlank(configPageList.getConfigValue())){
String[] split = configPageList.getConfigValue().split(","); String[] split = configPageList.getConfigValue().split(",");
@ -623,7 +623,7 @@ public class SysUserService implements ISysUserService {
sessionUser.setPageSizeArray(CommonConstWords.CONFIG_PAGE_SIZE_LIST_DEFAULT); sessionUser.setPageSizeArray(CommonConstWords.CONFIG_PAGE_SIZE_LIST_DEFAULT);
} }
SysConfig configPageSize = RedisUtilTool.getSysConfigByConfigCode(CommonConstWords.CONFIG_PAGE_DEFAULT_SIZE); SysConfig configPageSize = RedisCacheTool.getSysConfigByConfigCode(CommonConstWords.CONFIG_PAGE_DEFAULT_SIZE);
try { try {
if(configPageSize != null && StringUtils.isNotBlank(configPageSize.getConfigValue())){ if(configPageSize != null && StringUtils.isNotBlank(configPageSize.getConfigValue())){
sessionUser.setPageDefaultSize(Integer.parseInt(configPageSize.getConfigValue())); sessionUser.setPageDefaultSize(Integer.parseInt(configPageSize.getConfigValue()));
@ -641,7 +641,7 @@ public class SysUserService implements ISysUserService {
@Override @Override
public SessionUser packConfigSessionUser(SessionUser sessionUser, SysUser user) { public SessionUser packConfigSessionUser(SessionUser sessionUser, SysUser user) {
packPageSessionUser(sessionUser, user); packPageSessionUser(sessionUser, user);
String fileViewUrl = RedisUtilTool.getSysConfigStrVal(CommonConstWords.CONFIG_FILE_VIEW_URL, String fileViewUrl = RedisCacheTool.getSysConfigStrVal(CommonConstWords.CONFIG_FILE_VIEW_URL,
CommonConstWords.CONFIG_FILE_VIEW_URL_DEFAULT); CommonConstWords.CONFIG_FILE_VIEW_URL_DEFAULT);
sessionUser.setFileViewUrl(fileViewUrl); sessionUser.setFileViewUrl(fileViewUrl);
return sessionUser; return sessionUser;

@ -7,7 +7,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.MailConfig; import cn.estsh.i3plus.pojo.platform.bean.MailConfig;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.util.ImppRedis; import cn.estsh.impp.framework.boot.util.ImppRedis;
import cn.estsh.impp.framework.boot.util.RedisUtilTool; import cn.estsh.impp.framework.boot.util.RedisCacheTool;
import com.sun.mail.smtp.SMTPAddressFailedException; import com.sun.mail.smtp.SMTPAddressFailedException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -64,14 +64,14 @@ public class MailUtil {
public MailUtil init() { public MailUtil init() {
try { try {
// 查询是否开启邮件服务器 // 查询是否开启邮件服务器
this.mailSwitch = RedisUtilTool.getSysConfigIntVal(PlatformConstWords.MAIL_SWITCH, this.mailSwitch = RedisCacheTool.getSysConfigIntVal(PlatformConstWords.MAIL_SWITCH,
CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
this.smtpHost = RedisUtilTool.getSysConfigStrVal(PlatformConstWords.MAIL_HOST); this.smtpHost = RedisCacheTool.getSysConfigStrVal(PlatformConstWords.MAIL_HOST);
this.smtpPort = RedisUtilTool.getSysConfigIntVal(PlatformConstWords.MAIL_PORT); this.smtpPort = RedisCacheTool.getSysConfigIntVal(PlatformConstWords.MAIL_PORT);
this.from = RedisUtilTool.getSysConfigStrVal(PlatformConstWords.MAIL_USER); this.from = RedisCacheTool.getSysConfigStrVal(PlatformConstWords.MAIL_USER);
this.nick = RedisUtilTool.getSysConfigStrVal(PlatformConstWords.MAIL_NICK); this.nick = RedisCacheTool.getSysConfigStrVal(PlatformConstWords.MAIL_NICK);
this.smtpUser =RedisUtilTool.getSysConfigStrVal(PlatformConstWords.MAIL_USER); this.smtpUser = RedisCacheTool.getSysConfigStrVal(PlatformConstWords.MAIL_USER);
this.smtpPassword = RedisUtilTool.getSysConfigStrVal(PlatformConstWords.MAIL_PASSWORD); this.smtpPassword = RedisCacheTool.getSysConfigStrVal(PlatformConstWords.MAIL_PASSWORD);
this.isAuthenticationSMTP = true; this.isAuthenticationSMTP = true;
return this; return this;
} catch (Exception e) { } catch (Exception e) {

Loading…
Cancel
Save