Merge remote-tracking branch 'remotes/origin/dev' into test

yun-zuoyi
汪云昊 5 years ago
commit de7b481831

@ -55,4 +55,7 @@ public interface ISystemInitService {
@ApiOperation(value = "定时任务日志等级")
void reloadTaskPlanLogLevel();
@ApiOperation(value = "定时任务日志等级")
void reloadBarcodeRule();
}

@ -127,8 +127,12 @@ public class AuthController extends CoreBaseController {
@GetMapping(value = "/menu/find-home-list")
@ApiOperation(value = "获取登录用户功能权限信息", notes = "获取首页权限信息")
public ResultBean findHomeList() {
Long startTime = System.currentTimeMillis();
List<SysMenu> menuList = memTreeService.packTreeSysMenuByUserId(getSessionUser().getUser().getId());
Long menuSelectTime = System.currentTimeMillis();
LOGGER.info("第一段耗时:{}",menuSelectTime-startTime);
List<SysMenu> list = memTreeService.packTreeSysMenuByParentIdAndMenuType(menuList, CommonConstWords.SYSTEM_MENU_ROOT_ID, CommonEnumUtil.METHOD_LEVEL.PLUGIN.getValue());
LOGGER.info("第二段耗时:{}", System.currentTimeMillis() - menuSelectTime);
if (list != null && list.size() > 0) {
// 内存排序 Sort 降序 code 升序

@ -3,7 +3,6 @@ package cn.estsh.i3plus.core.apiservice.controller.base;
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.impp.framework.base.controller.BaseCommonController;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
@ -19,8 +18,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @Description :
@ -46,7 +43,7 @@ public class CoreCommonController extends BaseCommonController {
ValidatorBean.checkNotNull(softType,"不存在的产品信息");
String redisKey = CommonConstWords.REDIS_PREFIX_BEAN_INFO + ":" + softType.getCode();
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode())
.setResultList(redisRes.scan(redisKey + "*",Integer.MAX_VALUE));
.setResultList(redisRes.findObject(redisKey + "*",Integer.MAX_VALUE));
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);
} catch (Exception e) {

@ -127,6 +127,21 @@ public class PressureTestController extends CoreBaseController {
}
}
@GetMapping("/redis-get")
@ApiOperation(value = "redisGet", notes = "redisGet")
public ResultBean redisGet(){
try {
for (int i = 0; i < 1000; i++) {
imppRedis.getObject(i + "");
}
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
}catch(Exception e){
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
@GetMapping("/redis-put-test")
@ApiOperation(value = "redisPutTest", notes = "redisPutTest")
public ResultBean redisPutTest(){

@ -2,6 +2,7 @@ package cn.estsh.i3plus.core.apiservice.controller.busi;
import cn.estsh.i3plus.core.api.iservice.busi.ISysBarcodeRuleService;
import cn.estsh.i3plus.core.apiservice.util.BarcodeParseUtil;
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
@ -12,6 +13,7 @@ import cn.estsh.impp.framework.base.controller.CoreBaseController;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
import cn.estsh.impp.framework.boot.util.ImppRedis;
import cn.estsh.impp.framework.boot.util.ResultBean;
import cn.estsh.impp.framework.boot.util.ValidatorBean;
import io.swagger.annotations.Api;
@ -21,6 +23,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
/**
@ -40,6 +43,9 @@ public class SysBarcodeRuleController extends CoreBaseController {
@Autowired
private ISysBarcodeRuleService sysBarcodeRuleService;
@Resource(name= CommonConstWords.IMPP_REDIS_RES)
private ImppRedis redisRes;
/**
*
* @param sysBarcodeRule
@ -55,7 +61,10 @@ public class SysBarcodeRuleController extends CoreBaseController {
.notNull("barcodeRuleCode",sysBarcodeRule.getBarcodeRuleCode())
.notNull("barcodeRule",sysBarcodeRule.getBarcodeRule());
sysBarcodeRuleService.insertSysBarcodeRule(sysBarcodeRule);
sysBarcodeRule = sysBarcodeRuleService.insertSysBarcodeRule(sysBarcodeRule);
saveRedis(sysBarcodeRule);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
@ -80,6 +89,9 @@ public class SysBarcodeRuleController extends CoreBaseController {
.notNull("barcodeRule",sysBarcodeRule.getBarcodeRule());
sysBarcodeRuleService.updateSysBarcodeRule(sysBarcodeRule);
saveRedis(sysBarcodeRule);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
@ -112,6 +124,9 @@ public class SysBarcodeRuleController extends CoreBaseController {
}
sysBarcodeRuleService.deleteSysBarcodeRuleById(Long.parseLong(idStr));
removeRedis(sysBarcodeRule);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
@ -171,4 +186,14 @@ public class SysBarcodeRuleController extends CoreBaseController {
}
}
private void saveRedis(SysBarcodeRule barcodeRule){
String redisKey = CommonConstWords.REDIS_PREFIX_BARCODE_RULE + ":" + barcodeRule.getBarcodeRuleCode();
redisRes.putObject(redisKey, barcodeRule, -1);
}
private void removeRedis(SysBarcodeRule barcodeRule){
String redisKey = CommonConstWords.REDIS_PREFIX_BARCODE_RULE + ":" + barcodeRule.getBarcodeRuleCode();
redisRes.deleteKey(redisKey);
}
}

@ -16,7 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -45,18 +44,19 @@ public class SysLogFactory implements ISysLogService {
private ISysLogService getSysLogService(){
ImppEnumUtil.LOG_STORAGE storage = imppLog.getLogStorageCase();
if(ImppEnumUtil.LOG_STORAGE.MONGO.equals(storage)){
if(ImppSwitchUtil.isSwitchMongo() && mongoService != null){
return mongoService;
}else{
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.IMPP.getCode())
.setErrorCode(ImppExceptionEnum.LOG_SAVE_STORAGE_ERROR.getCode())
.setErrorDetail("没有开启Mongo储存技术,请联系管理员")
.setErrorSolution("请检查配置文件")
.build();
}
}else if(ImppEnumUtil.LOG_STORAGE.ELASTICSEARCH.equals(storage)){
// if(ImppEnumUtil.LOG_STORAGE.MONGO.equals(storage)){
// if(ImppSwitchUtil.isSwitchMongo() && mongoService != null){
// return mongoService;
// }else{
// throw ImppExceptionBuilder.newInstance()
// .setSystemID(CommonEnumUtil.SOFT_TYPE.IMPP.getCode())
// .setErrorCode(ImppExceptionEnum.LOG_SAVE_STORAGE_ERROR.getCode())
// .setErrorDetail("没有开启Mongo储存技术,请联系管理员")
// .setErrorSolution("请检查配置文件")
// .build();
// }
// }else
if(ImppEnumUtil.LOG_STORAGE.ELASTICSEARCH.equals(storage)){
if(ImppSwitchUtil.isElasticSearchSwitch() && elasticSearchService != null){
return elasticSearchService;
}else{

@ -69,6 +69,9 @@ public class SystemInitService implements ISystemInitService {
@Autowired
private ISysTaskPlanService sysTaskPlanService;
@Autowired
private ISysBarcodeRuleService sysBarcodeRuleService;
@Resource(name= CommonConstWords.IMPP_REDIS_RES)
private ImppRedis redisRes;
@ -104,6 +107,10 @@ public class SystemInitService implements ISystemInitService {
LOGGER.info("加载 定时任务日志等级");
reloadTaskPlanLogLevel();
LOGGER.info("加载 定时任务日志等级 信息完成");
LOGGER.info("加载 条码规则");
reloadBarcodeRule();
LOGGER.info("加载 条码规则 信息完成");
}catch (Exception e){
e.printStackTrace();
}
@ -114,9 +121,7 @@ public class SystemInitService implements ISystemInitService {
public void putAndLoadSysConfig() {
List<SysConfig> list = configRDao.findAll();
if(list != null && list.size() > 0){
list.forEach(config -> {
RedisCacheTool.setSysConfigByConfigCode(config);
});
list.forEach(RedisCacheTool::setSysConfigByConfigCode);
LOGGER.info("加载系统配置数量:【{}】",list.size());
}
}
@ -430,4 +435,15 @@ public class SystemInitService implements ISystemInitService {
}
}
}
@Override
public void reloadBarcodeRule() {
List<SysBarcodeRule> sysBarcodeRuleList = sysBarcodeRuleService.listSysBarcodeRule();
if (CollectionUtils.isNotEmpty(sysBarcodeRuleList)) {
for (SysBarcodeRule barcodeRule : sysBarcodeRuleList) {
String redisKey = CommonConstWords.REDIS_PREFIX_BARCODE_RULE + ":" + barcodeRule.getBarcodeRuleCode();
redisRes.putObject(redisKey, barcodeRule, -1);
}
}
}
}

@ -233,7 +233,7 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
@Override
public List<MissResourceModel> findMissResourceModelByTop(int num) {
List<Object> listStr = redisRes.scan(CommonConstWords.REDIS_PREFIX_CACHE_NO_RES + "*",num);
List<Object> listStr = redisRes.findObject(CommonConstWords.REDIS_PREFIX_CACHE_NO_RES + "*",num);
MissResourceModel missResourceModel = null;
List<MissResourceModel> missResourceModelList = new ArrayList<>(listStr.size());

@ -172,7 +172,7 @@ public class SysUserService implements ISysUserService {
return;
}
List<Object> ds = redisSession.scan(redisKey);
List<Object> ds = redisSession.findObject(redisKey);
if (CollectionUtils.isNotEmpty(ds)) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())

@ -23,7 +23,7 @@
<RollingRandomAccessFile name="log_file"
fileName="${logFileRootPath}/${project.name}.log"
append="false" immediateFlush="true" bufferedIO="true" bufferSize="8192"
filePattern="${logFileRootPath}/$${date:yyyy-MM}/${project.name}-%d{yyyy-MM-dd}-%i.log">
filePattern="${logFileRootPath}/$${date:yyyy-MM}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="${file_pattern}"/>
<Filters>
@ -39,6 +39,11 @@
<!-- 定时删除 -->
<DefaultRolloverStrategy>
<Delete basePath="${logFileRootPath}" maxDepth="2">
<IfFileName glob="**/${project.name}**.log.gz">
<IfLastModified age="7d"/>
</IfFileName>
<!-- 兼容未压缩日志的版本,后期可移除 -->
<IfFileName glob="**/${project.name}**.log">
<IfLastModified age="7d"/>
</IfFileName>
@ -46,11 +51,41 @@
</DefaultRolloverStrategy>
</RollingRandomAccessFile>
<!-- 应用异常日志文件-->
<RollingRandomAccessFile name="log_error_file"
fileName="${logFileRootPath}/${project.name}-error.log"
append="false" immediateFlush="true" bufferedIO="true" bufferSize="8192"
filePattern="${logFileRootPath}/$${date:yyyy-MM}/${project.name}-error-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="${file_pattern}"/>
<ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/>
<!-- 滚动策略 -->
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="1024 MB"/>
</Policies>
<!-- 定时删除 -->
<DefaultRolloverStrategy>
<Delete basePath="${logFileRootPath}" maxDepth="2">
<IfFileName glob="**/${project.name}-error**.log.gz">
<IfLastModified age="7d"/>
</IfFileName>
<!-- 兼容未压缩日志的版本,后期可移除 -->
<IfFileName glob="**/${project.name}-error**.log">
<IfLastModified age="7d"/>
</IfFileName>
</Delete>
</DefaultRolloverStrategy>
</RollingRandomAccessFile>
<!-- 应用调度日志文件-->
<ImppLog4j2File name="log_schedule_file"
filePath="${logFileRootPath}/schedule/"
append="false" immediateFlush="true" bufferedIO="true" bufferSize="8192"
filePattern="${logFileRootPath}/schedule/$${date:yyyy-MM}/task-name-%d{yyyy-MM-dd}-%i.log">
filePattern="${logFileRootPath}/schedule/$${date:yyyy-MM}/task-name-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="${file_pattern}"/>
<Filters>
@ -66,6 +101,11 @@
<!-- 定时删除 -->
<DefaultRolloverStrategy>
<Delete basePath="${logFileRootPath}" maxDepth="2">
<IfFileName glob="**/schedule/**.log.gz">
<IfLastModified age="7d"/>
</IfFileName>
<!-- 兼容未压缩日志的版本,后期可移除 -->
<IfFileName glob="**/schedule/**.log">
<IfLastModified age="7d"/>
</IfFileName>
@ -89,6 +129,7 @@
<appender-ref ref="console"/>
<appender-ref ref="log_schedule_file"/>
<appender-ref ref="log_file"/>
<appender-ref ref="log_error_file"/>
</root>
</loggers>
</configuration>
Loading…
Cancel
Save