Sonar代码缺陷修复

查询条件优化
拦截器,自定义按钮对外接口实现
表单-功能目录优化
软适配日志优化
yun-zuoyi
汪云昊 5 years ago
parent 483d88812f
commit acae46c408

@ -24,13 +24,14 @@ import java.util.Map;
* @Modify: * @Modify:
**/ **/
public class DefaultModularRealm extends ModularRealmAuthenticator { public class DefaultModularRealm extends ModularRealmAuthenticator {
private static final Logger LOGGER = LoggerFactory.getLogger(DemoAuthController.class); private static final Logger LOGGER = LoggerFactory.getLogger(DefaultModularRealm.class);
private Map<String, Realm> definedRealms; private Map<String, Realm> definedRealms;
public DefaultModularRealm(Map<String, Realm> definedRealms) { public DefaultModularRealm(Map<String, Realm> definedRealms) {
this.definedRealms = definedRealms; this.definedRealms = definedRealms;
} }
@Override
protected AuthenticationInfo doMultiRealmAuthentication(Collection<Realm> realms, AuthenticationToken token) { protected AuthenticationInfo doMultiRealmAuthentication(Collection<Realm> realms, AuthenticationToken token) {
return super.doMultiRealmAuthentication(realms, token); return super.doMultiRealmAuthentication(realms, token);
} }
@ -43,6 +44,7 @@ public class DefaultModularRealm extends ModularRealmAuthenticator {
this.definedRealms = definedRealms; this.definedRealms = definedRealms;
} }
@Override
protected AuthenticationInfo doAuthenticate(AuthenticationToken token) throws AuthenticationException { protected AuthenticationInfo doAuthenticate(AuthenticationToken token) throws AuthenticationException {
Realm realm; Realm realm;
if (token instanceof SaAdminToken) { if (token instanceof SaAdminToken) {
@ -61,6 +63,7 @@ public class DefaultModularRealm extends ModularRealmAuthenticator {
return this.doSingleRealmAuthentication(realm, token); return this.doSingleRealmAuthentication(realm, token);
} }
@Override
protected AuthenticationInfo doSingleRealmAuthentication(Realm realm, AuthenticationToken token) { protected AuthenticationInfo doSingleRealmAuthentication(Realm realm, AuthenticationToken token) {
if (!realm.supports(token)) { if (!realm.supports(token)) {
throw new AuthenticationException("TOKEN类型异常请联系管理员"); throw new AuthenticationException("TOKEN类型异常请联系管理员");

@ -40,7 +40,7 @@ public class AppStartSystemInit implements CommandLineRunner {
private static Environment environment; private static Environment environment;
@Value("${spring.profiles.active}") @Value("${spring.profiles.active}")
public String SPRING_PROFILES_ACTIVE; public String springProfilesActive;
// 限制组织数量 // 限制组织数量
public static int organizeCount = 5; public static int organizeCount = 5;
// 限制账号数量 // 限制账号数量
@ -66,9 +66,6 @@ public class AppStartSystemInit implements CommandLineRunner {
@Override @Override
public void run(String... args) throws Exception { public void run(String... args) throws Exception {
try { try {
LOGGER.info("【IMPP-Core开始绑定资源信息...】");
packIMPPResources();
LOGGER.info("【IMPP-Core开始加载基础信息...】"); LOGGER.info("【IMPP-Core开始加载基础信息...】");
systemInitService.putAndLoadAll(); systemInitService.putAndLoadAll();
@ -124,168 +121,4 @@ public class AppStartSystemInit implements CommandLineRunner {
} }
} }
/**
*
* cn.estsh.i3plus.core.apiservice.serviceimpl.base.SystemInitService
*/
public void packIMPPResources() {
// /**
// * 整体数据结构:
// * code <lang : value>
// * 先根据code查询判断是否存在然后通过语言获取对应的值
// */
// HashMap<String, HashMap<String, String>> resMap = new HashMap();
// HashMap<String, String> lanMap = null;
// HashMap<String, HashMap<String, String>> webLangMap = new HashMap<>();
// HashMap<String, String> webResMap;
//
// //语言数量
// List<SysLocaleLanguage> langList = systemResourceService.listSysLocaleLanguage(null);
//
// //查询所有资源
// List<SysLocaleResource> resourceList = systemResourceService.listSysLocaleResource(null);
// LOGGER.info("【加载平台资源】共有{}个资源,{}种语言。", resourceList.size(), langList.size());
// for (SysLocaleResource res : resourceList) {
// //遍历资源放入map中
// lanMap = resMap.get(res.getResourceKey());
// //判断是否已存在资源信息
// if (lanMap == null) {
// lanMap = new HashMap<String, String>();
// //将key/代码放入
// resMap.put(res.getResourceKey(), lanMap);
// }
// //根据语言放入
// lanMap.put(res.getLanguageCode(), res.getResourceValue());
//
// // web 资源
// if (!webLangMap.containsKey(res.getLanguageCode())) {
// webLangMap.put(res.getLanguageCode(), new HashMap<>());
// }
// // 放入资源信息
// webResMap = webLangMap.get(res.getLanguageCode());
// webResMap.put(res.getResourceKey(), res.getResourceValue());
// }
//
// for (String key : resMap.keySet()) {
// //放入缓存
// redisRes.putHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + ":" + key, resMap.get(key), 0);
// }
//
// for (String key : webLangMap.keySet()) {
// //放入缓存
// redisRes.putHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + ":" + key, webLangMap.get(key), 0);
// }
//
// LOGGER.info("【资源配置文件已全部加载:{}个】", resMap.size());
/*
//资源集合
HashMap<String,String> resMap;
//模块集合
HashMap<String,HashMap<String,String>> langModoleMap = new HashMap();
//功能集合
HashMap<String,HashMap<String,String>> langMethodMap = new HashMap();
//按钮集合
HashMap<String,HashMap<String,String>> langBtnMap = new HashMap();
//信息集合
HashMap<String,HashMap<String,String>> langMsgMap = new HashMap();
//异常集合
HashMap<String,HashMap<String,String>> langExMap = new HashMap();
*//************** 加载国际化 *************//*
for(SysLocaleLanguage lang : langList) {
*//************** 加载模块 *************//*
resource = new SysLocaleResource();
resource.setResourceType(CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.MODULE.getValue());
resource.setLanguageCode(lang.getLanguageCode());
resourceList = systemResourceService.listSysLocaleResource(resource);
if(resourceList.size() > 0) {
LOGGER.info("【{}-{},{}】共有{}个资源。", CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.MODULE.getDescription(),
lang.getLanguageName(), lang.getLanguageCode(), resourceList.size());
}
resMap = new HashMap<String,String>();
for(SysLocaleResource res : resourceList){
resMap.put(res.getResourceKey(),res.getResourceValue());
}
langModoleMap.put(lang.getLanguageCode(),resMap);
*//************** 加载功能 *************//*
resource = new SysLocaleResource();
resource.setResourceType(CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.METHOD.getValue());
resource.setLanguageCode(lang.getLanguageCode());
resourceList = systemResourceService.listSysLocaleResource(resource);
if(resourceList.size() > 0) {
LOGGER.info("【{}-{},{}】共有{}个资源。",CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.METHOD.getDescription(),
lang.getLanguageName(),lang.getLanguageCode(),resourceList.size());
}
resMap = new HashMap<String,String>();
for(SysLocaleResource res : resourceList){
resMap.put(res.getResourceKey(),res.getResourceValue());
}
langMethodMap.put(lang.getLanguageCode(),resMap);
*//************** 加载按钮 *************//*
resource = new SysLocaleResource();
resource.setResourceType(CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.BUTTON.getValue());
resource.setLanguageCode(lang.getLanguageCode());
resourceList = systemResourceService.listSysLocaleResource(resource);
if(resourceList.size() > 0) {
LOGGER.info("【{}-{},{}】共有{}个资源。", CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.BUTTON.getDescription(),
lang.getLanguageName(), lang.getLanguageCode(), resourceList.size());
}
resMap = new HashMap<String,String>();
for(SysLocaleResource res : resourceList){
resMap.put(res.getResourceKey(),res.getResourceValue());
}
langBtnMap.put(lang.getLanguageCode(),resMap);
*//************** 加载资源 *************//*
resource = new SysLocaleResource();
resource.setResourceType(CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.COMMON.getValue());
resource.setLanguageCode(lang.getLanguageCode());
resourceList = systemResourceService.listSysLocaleResource(resource);
if(resourceList.size() > 0) {
LOGGER.info("【{}-{},{}】共有{}个资源。", CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.COMMON.getDescription(),
lang.getLanguageName(), lang.getLanguageCode(), resourceList.size());
}
resMap = new HashMap<String,String>();
for(SysLocaleResource res : resourceList){
resMap.put(res.getResourceKey(),res.getResourceValue());
}
langMsgMap.put(lang.getLanguageCode(),resMap);
*//************** 加载异常 *************//*
resource = new SysLocaleResource();
resource.setResourceType(CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.EXCEPTION.getValue());
resource.setLanguageCode(lang.getLanguageCode());
resourceList = systemResourceService.listSysLocaleResource(resource);
if(resourceList.size() > 0) {
LOGGER.info("【{}-{},{}】共有{}个资源。", CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.EXCEPTION.getDescription(),
lang.getLanguageName(), lang.getLanguageCode(), resourceList.size());
}
resMap = new HashMap<String,String>();
for(SysLocaleResource res : resourceList){
resMap.put(res.getResourceKey(),res.getResourceValue());
}
langExMap.put(lang.getLanguageCode(),resMap);
}
redisCore.putHashMap(CommonConstWords.RES_PLAT_MODULE,langModoleMap);
redisCore.putHashMap(CommonConstWords.RES_PLAT_MODULE_METHOD,langMethodMap);
redisCore.putHashMap(CommonConstWords.RES_PLAT_MODULE_BUTTON,langBtnMap);
redisCore.putHashMap(CommonConstWords.RES_LANGUAGE_CONVERT,langMsgMap);
redisCore.putHashMap(CommonConstWords.RES_EXCEPTION_CONVERT,langExMap);
LOGGER.info("【资源配置文件已全部加载】");*/
}
} }

@ -89,7 +89,7 @@ public class DemoAuthController extends CoreBaseController {
while (headerNames.hasMoreElements()) { while (headerNames.hasMoreElements()) {
String key = (String) headerNames.nextElement(); String key = (String) headerNames.nextElement();
String value = request.getHeader(key); String value = request.getHeader(key);
System.out.println("k : " + key + " , v : " + value); LOGGER.info("k : {} , v : {}", key, value);
} }
return new ResultBean(true, "", sUser); return new ResultBean(true, "", sUser);

@ -9,7 +9,6 @@ import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.SessionUser; import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
import cn.estsh.i3plus.pojo.platform.bean.SysLocaleLanguage; import cn.estsh.i3plus.pojo.platform.bean.SysLocaleLanguage;
import cn.estsh.i3plus.pojo.platform.bean.SysMenu; import cn.estsh.i3plus.pojo.platform.bean.SysMenu;
import cn.estsh.i3plus.pojo.platform.bean.SysUser;
import cn.estsh.impp.framework.base.controller.CoreBaseController; import cn.estsh.impp.framework.base.controller.CoreBaseController;
import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppBusiException;
@ -23,7 +22,7 @@ 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.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;

@ -5,16 +5,12 @@ import cn.estsh.i3plus.core.api.iservice.busi.ICoreMemTreeService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysMenuService; import cn.estsh.i3plus.core.api.iservice.busi.ISysMenuService;
import cn.estsh.i3plus.core.apiservice.serviceimpl.base.SysLogElasticSearchService; import cn.estsh.i3plus.core.apiservice.serviceimpl.base.SysLogElasticSearchService;
import cn.estsh.i3plus.core.apiservice.serviceimpl.base.SysLogMongoService; import cn.estsh.i3plus.core.apiservice.serviceimpl.base.SysLogMongoService;
import cn.estsh.i3plus.platform.common.tool.SerializeTool;
import cn.estsh.i3plus.platform.common.tool.TimeTool; import cn.estsh.i3plus.platform.common.tool.TimeTool;
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.plugin.elasticsearch.ElasticSearchTool; import cn.estsh.i3plus.platform.plugin.elasticsearch.ElasticSearchTool;
import cn.estsh.i3plus.platform.plugin.license.ImppLicense; import cn.estsh.i3plus.platform.plugin.license.ImppLicense;
import cn.estsh.i3plus.platform.plugin.license.ImppLicenseTool; import cn.estsh.i3plus.platform.plugin.license.ImppLicenseTool;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.SysMenu;
import cn.estsh.i3plus.pojo.platform.platbean.SysLogException; import cn.estsh.i3plus.pojo.platform.platbean.SysLogException;
import cn.estsh.i3plus.pojo.platform.platbean.SysLogOperate; import cn.estsh.i3plus.pojo.platform.platbean.SysLogOperate;
import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem; import cn.estsh.i3plus.pojo.platform.platbean.SysLogSystem;
@ -25,7 +21,6 @@ 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.ResultBean; import cn.estsh.impp.framework.boot.util.ResultBean;
import cn.estsh.impp.framework.boot.util.ValidatorBean; import cn.estsh.impp.framework.boot.util.ValidatorBean;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -37,7 +32,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @Description : * @Description :

@ -520,12 +520,12 @@ public class WhiteController extends CoreBaseController {
} }
@PostMapping(value = "/miss-resource/get") @PostMapping(value = "/miss-resource/get")
@ApiOperation(value = "根据条件分页查询账号信息", notes = "根据条件分页查询账号信息") @ApiOperation(value = "缺失资源", notes = "缺失资源")
public ResultBean getMissResourceByKey(String key,String soft){ public ResultBean getMissResourceByKey(String key,String soft){
try { try {
LocaleUtils.saveMissResource(key, AuthUtil.getSessionLanguage().toString(), CommonEnumUtil.SOFT_TYPE.descOf(soft), LocaleUtils.saveMissResource(key, AuthUtil.getSessionLanguage().toString(), CommonEnumUtil.SOFT_TYPE.descOf(soft),
CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.MISSING.getValue(), CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.MISSING.getValue(),
CommonEnumUtil.MiSS_RESOURCE_SOURCE.SERVER.getValue()); CommonEnumUtil.MiSS_RESOURCE_SOURCE.WEB.getValue());
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException busExcep) { } catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep); return ResultBean.fail(busExcep);

@ -135,7 +135,7 @@ public class CoreReportController extends CoreBaseController {
LOGGER.info("【类信息:{}】", clzNameList); LOGGER.info("【类信息:{}】", clzNameList);
List<ClassModel> clzList = new ArrayList<>(clzNameList.size()); List<ClassModel> clzList = new ArrayList<>(clzNameList.size());
for (String clzName : clzNameList) { for (String clzName : clzNameList) {
ClassModel model = ClassTool.getClassModel(clzName); ClassTool.getClassModel(clzName);
} }
return ResultBean.success("获取类:" + clzList.size()).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(clzList); return ResultBean.success("获取类:" + clzList.size()).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(clzList);
} }

@ -27,7 +27,7 @@ public class DemoCloudJob extends BaseImppScheduleJob {
@Override @Override
public void executeImppJob(JobExecutionContext context, ApplicationProperties applicationProperties) { public void executeImppJob(JobExecutionContext context, ApplicationProperties applicationProperties) {
System.out.println("==============测试微服定时任务demo==========="); LOGGER.info("==============测试微服定时任务demo===========");
} }
} }

@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -35,10 +36,10 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysPosition> packTreeSysPosition(List<SysPosition> list, Long parentId) { public List<SysPosition> packTreeSysPosition(List<SysPosition> list, Long parentId) {
List<SysPosition> result = new ArrayList<>(); List<SysPosition> result = new ArrayList<>();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
List<SysPosition> copyList = new ArrayList<>(list); List<SysPosition> copyList = new ArrayList<>(list);
list.forEach(position -> { list.forEach(position -> {
if(position.getParentId() != null && position.getParentId().equals(parentId)){ if (position.getParentId() != null && position.getParentId().equals(parentId)) {
result.add(position); result.add(position);
copyList.remove(position); copyList.remove(position);
position.setChildList(packTreeSysPosition(copyList, position.getId())); position.setChildList(packTreeSysPosition(copyList, position.getId()));
@ -51,11 +52,11 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public List<SysPosition> packTreeSysPositionBySysRefUserPosition(List<SysPosition> list, List<SysRefUserPosition> refList) { public List<SysPosition> packTreeSysPositionBySysRefUserPosition(List<SysPosition> list, List<SysRefUserPosition> refList) {
List<Long> ids = new ArrayList<>(refList.size()); if (refList == null || refList.isEmpty()) {
return Collections.emptyList();
if(refList != null && refList.size() > 0){
refList.forEach(ref -> ids.add(ref.getPositionId()));
} }
List<Long> ids = new ArrayList<>(refList.size());
refList.forEach(ref -> ids.add(ref.getPositionId()));
return packTreeSysPositionByIds(list, ids); return packTreeSysPositionByIds(list, ids);
} }
@ -64,15 +65,15 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysPosition> packTreeSysPositionByIds(List<SysPosition> list, List<Long> ids) { public List<SysPosition> packTreeSysPositionByIds(List<SysPosition> list, List<Long> ids) {
List<SysPosition> result = new ArrayList<>(); List<SysPosition> result = new ArrayList<>();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
list.forEach(position -> { list.forEach(position -> {
if(position.getChildList() == null || position.getChildList().size() <= 0){ if (position.getChildList() == null || position.getChildList().size() <= 0) {
if(ids.contains(position.getId())){ if (ids.contains(position.getId())) {
result.add(position); result.add(position);
} }
}else{ } else {
List<SysPosition> childList = packTreeSysPositionByIds(position.getChildList(), ids); List<SysPosition> childList = packTreeSysPositionByIds(position.getChildList(), ids);
if(ids.contains(position.getId()) || childList != null && childList.size() > 0){ if (ids.contains(position.getId()) || childList != null && childList.size() > 0) {
position.setChildList(childList); position.setChildList(childList);
result.add(position); result.add(position);
} }
@ -85,9 +86,9 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public SysPosition packTreeSysPositionById(List<SysPosition> list, Long id) { public SysPosition packTreeSysPositionById(List<SysPosition> list, Long id) {
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
for (SysPosition position : list) { for (SysPosition position : list) {
if(position.getId().equals(id)){ if (position.getId().equals(id)) {
position.setChildList(packTreeSysPosition(list, position.getId())); position.setChildList(packTreeSysPosition(list, position.getId()));
return position; return position;
} }
@ -100,7 +101,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<Long> findChildSysPosition(SysPosition position) { public List<Long> findChildSysPosition(SysPosition position) {
List<Long> result = new ArrayList<>(); List<Long> result = new ArrayList<>();
if(position != null && position.getChildList() != null && position.getChildList().size() > 0){ if (position != null && position.getChildList() != null && position.getChildList().size() > 0) {
for (SysPosition sp : position.getChildList()) { for (SysPosition sp : position.getChildList()) {
result.add(sp.getId()); result.add(sp.getId());
List<Long> list = findChildSysPosition(sp); List<Long> list = findChildSysPosition(sp);
@ -114,16 +115,16 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public List<Long> findSysPositionChildIdList(Long id) { public List<Long> findSysPositionChildIdList(Long id) {
SysPosition position = personnelService.getSysPositionById(id); SysPosition position = personnelService.getSysPositionById(id);
if(position != null){ if (position != null) {
List<SysPosition> list = personnelService.findSysPositionList(); List<SysPosition> list = personnelService.findSysPositionList();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
SysPosition treeSPosition = packTreeSysPositionById(list, position.getId()); SysPosition treeSPosition = packTreeSysPositionById(list, position.getId());
List<Long> idList = findChildSysPosition(treeSPosition); List<Long> idList = findChildSysPosition(treeSPosition);
idList.add(position.getId()); idList.add(position.getId());
return idList; return idList;
} }
} }
return null; return Collections.emptyList();
} }
/********************************************* Start SysOrganize Tree *********************************************/ /********************************************* Start SysOrganize Tree *********************************************/
@ -131,10 +132,10 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysOrganize> packTreeSysOrganize(List<SysOrganize> list, Long parentId) { public List<SysOrganize> packTreeSysOrganize(List<SysOrganize> list, Long parentId) {
List<SysOrganize> result = new ArrayList<>(); List<SysOrganize> result = new ArrayList<>();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
List<SysOrganize> copyList = new ArrayList<>(list); List<SysOrganize> copyList = new ArrayList<>(list);
list.forEach(organize -> { list.forEach(organize -> {
if(organize.getParentId() != null && organize.getParentId().equals(parentId)){ if (organize.getParentId() != null && organize.getParentId().equals(parentId)) {
result.add(organize); result.add(organize);
copyList.remove(organize); copyList.remove(organize);
organize.setChildList(packTreeSysOrganize(copyList, organize.getId())); organize.setChildList(packTreeSysOrganize(copyList, organize.getId()));
@ -149,7 +150,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysOrganize> packTreeSysOrganizeBySysRefUserOrganize(List<SysOrganize> list, List<SysRefUserDepartment> refList) { public List<SysOrganize> packTreeSysOrganizeBySysRefUserOrganize(List<SysOrganize> list, List<SysRefUserDepartment> refList) {
List<Long> ids = new ArrayList<>(refList.size()); List<Long> ids = new ArrayList<>(refList.size());
if(refList != null && refList.size() > 0){ if (refList != null && refList.size() > 0) {
refList.forEach(ref -> ids.add(ref.getOrganizeId())); refList.forEach(ref -> ids.add(ref.getOrganizeId()));
} }
@ -160,8 +161,8 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysOrganize> packTreeSysOrganizeBySysRefUserInfoOrganize(List<SysOrganize> list, List<SysRefUserInfoDepartment> refList) { public List<SysOrganize> packTreeSysOrganizeBySysRefUserInfoOrganize(List<SysOrganize> list, List<SysRefUserInfoDepartment> refList) {
List<Long> ids = new ArrayList<>(refList.size()); List<Long> ids = new ArrayList<>(refList.size());
if(refList != null && refList.size() > 0){ if (refList != null && refList.size() > 0) {
refList.forEach(ref ->{ refList.forEach(ref -> {
ids.add(ref.getOrganizeId()); ids.add(ref.getOrganizeId());
}); });
} }
@ -173,15 +174,15 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysOrganize> packTreeSysOrganizeByIds(List<SysOrganize> list, List<Long> ids) { public List<SysOrganize> packTreeSysOrganizeByIds(List<SysOrganize> list, List<Long> ids) {
List<SysOrganize> result = new ArrayList<>(); List<SysOrganize> result = new ArrayList<>();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
list.forEach(organize -> { list.forEach(organize -> {
if(organize.getChildList() == null || organize.getChildList().size() <= 0){ if (organize.getChildList() == null || organize.getChildList().size() <= 0) {
if(ids.contains(organize.getId())){ if (ids.contains(organize.getId())) {
result.add(organize); result.add(organize);
} }
}else{ } else {
List<SysOrganize> childList = packTreeSysOrganizeByIds(organize.getChildList(), ids); List<SysOrganize> childList = packTreeSysOrganizeByIds(organize.getChildList(), ids);
if(ids.contains(organize.getId()) || childList != null && childList.size() > 0){ if (ids.contains(organize.getId()) || childList != null && childList.size() > 0) {
organize.setChildList(childList); organize.setChildList(childList);
result.add(organize); result.add(organize);
} }
@ -194,9 +195,9 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public SysOrganize packTreeSysOrganizeById(List<SysOrganize> list, Long id) { public SysOrganize packTreeSysOrganizeById(List<SysOrganize> list, Long id) {
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
for (SysOrganize organize : list) { for (SysOrganize organize : list) {
if(organize.getId().equals(id)){ if (organize.getId().equals(id)) {
organize.setChildList(packTreeSysOrganize(list, organize.getId())); organize.setChildList(packTreeSysOrganize(list, organize.getId()));
return organize; return organize;
} }
@ -208,14 +209,14 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public SysOrganize getTreeSysOrganizeById(List<SysOrganize> list, Long id) { public SysOrganize getTreeSysOrganizeById(List<SysOrganize> list, Long id) {
SysOrganize result = null; SysOrganize result = null;
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
for (SysOrganize organize : list) { for (SysOrganize organize : list) {
if(organize.getId().equals(id)){ if (organize.getId().equals(id)) {
result = organize; result = organize;
} else if(organize.getChildList() != null && organize.getChildList().size() > 0){ } else if (organize.getChildList() != null && organize.getChildList().size() > 0) {
result = getTreeSysOrganizeById(organize.getChildList(), id); result = getTreeSysOrganizeById(organize.getChildList(), id);
} }
if(result != null){ if (result != null) {
return result; return result;
} }
} }
@ -227,8 +228,8 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<Long> findChildSysOrganize(SysOrganize organize) { public List<Long> findChildSysOrganize(SysOrganize organize) {
List<Long> result = new ArrayList<>(); List<Long> result = new ArrayList<>();
if(organize != null){ if (organize != null) {
if(organize.getChildList() != null && organize.getChildList().size() > 0){ if (organize.getChildList() != null && organize.getChildList().size() > 0) {
for (SysOrganize so : organize.getChildList()) { for (SysOrganize so : organize.getChildList()) {
result.add(so.getId()); result.add(so.getId());
result.addAll(findChildSysOrganize(so)); result.addAll(findChildSysOrganize(so));
@ -243,16 +244,16 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public List<Long> findSysOrganizeChildIdList(Long id) { public List<Long> findSysOrganizeChildIdList(Long id) {
SysOrganize organize = personnelService.getSysOrganizeById(id); SysOrganize organize = personnelService.getSysOrganizeById(id);
if(organize != null){ if (organize != null) {
List<SysOrganize> list = personnelService.findSysOrganizeList(); List<SysOrganize> list = personnelService.findSysOrganizeList();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
SysOrganize treeSPosition = packTreeSysOrganizeById(list, organize.getId()); SysOrganize treeSPosition = packTreeSysOrganizeById(list, organize.getId());
List<Long> idList = findChildSysOrganize(treeSPosition); List<Long> idList = findChildSysOrganize(treeSPosition);
idList.add(organize.getId()); idList.add(organize.getId());
return idList; return idList;
} }
} }
return null; return Collections.emptyList();
} }
/********************************************* End SysOrganize Tree *********************************************/ /********************************************* End SysOrganize Tree *********************************************/
@ -262,15 +263,15 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public List<CommonTreeModel> packTreeTreeModelByRefUserDepartment(List<SysOrganize> organizeList, List<SysDepartment> departmentList, List<SysRefUserDepartment> refList) { public List<CommonTreeModel> packTreeTreeModelByRefUserDepartment(List<SysOrganize> organizeList, List<SysDepartment> departmentList, List<SysRefUserDepartment> refList) {
if(refList != null && organizeList != null && departmentList != null){ if (refList != null && organizeList != null && departmentList != null) {
List<Long> organizeIdList = new ArrayList<>(); List<Long> organizeIdList = new ArrayList<>();
List<Long> departmentIdList = new ArrayList<>(); List<Long> departmentIdList = new ArrayList<>();
refList.forEach(ref -> { refList.forEach(ref -> {
if(!organizeIdList.contains(ref.getOrganizeId())){ if (!organizeIdList.contains(ref.getOrganizeId())) {
organizeIdList.add(ref.getOrganizeId()); organizeIdList.add(ref.getOrganizeId());
} }
if(!departmentIdList.contains(ref.getDepartmentId())){ if (!departmentIdList.contains(ref.getDepartmentId())) {
departmentIdList.add(ref.getDepartmentId()); departmentIdList.add(ref.getDepartmentId());
} }
}); });
@ -286,7 +287,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
return result; return result;
} }
return null; return Collections.emptyList();
} }
@Override @Override
@ -324,7 +325,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<CommonTreeModel> packTreeTreeModelSysOrganize(List<SysOrganize> list) { public List<CommonTreeModel> packTreeTreeModelSysOrganize(List<SysOrganize> list) {
List<CommonTreeModel> result = new ArrayList<>(); List<CommonTreeModel> result = new ArrayList<>();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
for (SysOrganize organize : list) { for (SysOrganize organize : list) {
CommonTreeModel model = new CommonTreeModel(); CommonTreeModel model = new CommonTreeModel();
model.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_ORGANIZE.getValue()); model.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_ORGANIZE.getValue());
@ -342,7 +343,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<CommonTreeModel> packTreeTreeModelSysDepartment(List<SysDepartment> list) { public List<CommonTreeModel> packTreeTreeModelSysDepartment(List<SysDepartment> list) {
List<CommonTreeModel> result = new ArrayList<>(); List<CommonTreeModel> result = new ArrayList<>();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
for (SysDepartment department : list) { for (SysDepartment department : list) {
CommonTreeModel model = new CommonTreeModel(); CommonTreeModel model = new CommonTreeModel();
model.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_DEPARTMENT.getValue()); model.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_DEPARTMENT.getValue());
@ -358,12 +359,12 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public List<CommonTreeModel> packTreeTreeModel(List<CommonTreeModel> list, List<SysDepartment> departmentList) { public List<CommonTreeModel> packTreeTreeModel(List<CommonTreeModel> list, List<SysDepartment> departmentList) {
if(list != null && list.size() > 0 && departmentList != null && departmentList.size() > 0){ if (list != null && list.size() > 0 && departmentList != null && departmentList.size() > 0) {
list.forEach(model -> { list.forEach(model -> {
SysOrganize organize = (SysOrganize) model.getBean(); SysOrganize organize = (SysOrganize) model.getBean();
List<SysDepartment> departments = new ArrayList<>(); List<SysDepartment> departments = new ArrayList<>();
departmentList.forEach(department -> { departmentList.forEach(department -> {
if(department.getParentId().equals(CommonEnumUtil.PARENT.DEFAULT.getValue()) && department.getOrganizeId().equals(organize.getId())){ if (department.getParentId().equals(CommonEnumUtil.PARENT.DEFAULT.getValue()) && department.getOrganizeId().equals(organize.getId())) {
departments.add(department); departments.add(department);
} }
}); });
@ -387,9 +388,9 @@ public class CoreMemTreeService implements ICoreMemTreeService {
refList.forEach(ref -> refFilterIds.add(ref.getDepartmentId())); refList.forEach(ref -> refFilterIds.add(ref.getDepartmentId()));
} }
if(refIdList.size() <= 0){ if (refIdList.size() <= 0) {
refIdList = refFilterIds; refIdList = refFilterIds;
}else { } else {
// List 取交集 // List 取交集
refIdList = (ArrayList<Long>) CollectionUtils.intersection(refIdList, refFilterIds); refIdList = (ArrayList<Long>) CollectionUtils.intersection(refIdList, refFilterIds);
} }
@ -429,10 +430,10 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysDepartment> packTreeSysDepartment(List<SysDepartment> list, Long parentId) { public List<SysDepartment> packTreeSysDepartment(List<SysDepartment> list, Long parentId) {
List<SysDepartment> result = new ArrayList<>(); List<SysDepartment> result = new ArrayList<>();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
List<SysDepartment> copyList = new ArrayList<>(list); List<SysDepartment> copyList = new ArrayList<>(list);
list.forEach(department -> { list.forEach(department -> {
if(department.getParentId() != null && department.getParentId().equals(parentId)){ if (department.getParentId() != null && department.getParentId().equals(parentId)) {
result.add(department); result.add(department);
copyList.remove(department); copyList.remove(department);
department.setChildList(packTreeSysDepartment(copyList, department.getId())); department.setChildList(packTreeSysDepartment(copyList, department.getId()));
@ -447,7 +448,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysDepartment> packTreeSysDepartmentBySysRefUserOrganize(List<SysDepartment> list, List<SysRefUserDepartment> refList) { public List<SysDepartment> packTreeSysDepartmentBySysRefUserOrganize(List<SysDepartment> list, List<SysRefUserDepartment> refList) {
List<Long> ids = new ArrayList<>(refList.size()); List<Long> ids = new ArrayList<>(refList.size());
if(refList != null && refList.size() > 0){ if (refList != null && refList.size() > 0) {
refList.forEach(ref -> ids.add(ref.getDepartmentId())); refList.forEach(ref -> ids.add(ref.getDepartmentId()));
} }
@ -458,7 +459,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysDepartment> packTreeSysDepartmentBySysRefUserInfoOrganize(List<SysDepartment> list, List<SysRefUserInfoDepartment> refList) { public List<SysDepartment> packTreeSysDepartmentBySysRefUserInfoOrganize(List<SysDepartment> list, List<SysRefUserInfoDepartment> refList) {
List<Long> ids = new ArrayList<>(refList.size()); List<Long> ids = new ArrayList<>(refList.size());
if(refList != null && refList.size() > 0){ if (refList != null && refList.size() > 0) {
refList.forEach(ref -> ids.add(ref.getDepartmentId())); refList.forEach(ref -> ids.add(ref.getDepartmentId()));
} }
@ -469,15 +470,15 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysDepartment> packTreeSysDepartmentByIds(List<SysDepartment> list, List<Long> ids) { public List<SysDepartment> packTreeSysDepartmentByIds(List<SysDepartment> list, List<Long> ids) {
List<SysDepartment> result = new ArrayList<>(); List<SysDepartment> result = new ArrayList<>();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
list.forEach(department -> { list.forEach(department -> {
if(department.getChildList() == null || department.getChildList().size() <= 0){ if (department.getChildList() == null || department.getChildList().size() <= 0) {
if(ids.contains(department.getId())){ if (ids.contains(department.getId())) {
result.add(department); result.add(department);
} }
}else{ } else {
List<SysDepartment> childList = packTreeSysDepartmentByIds(department.getChildList(), ids); List<SysDepartment> childList = packTreeSysDepartmentByIds(department.getChildList(), ids);
if(ids.contains(department.getId()) || childList != null && childList.size() > 0){ if (ids.contains(department.getId()) || childList != null && childList.size() > 0) {
department.setChildList(childList); department.setChildList(childList);
result.add(department); result.add(department);
} }
@ -490,9 +491,9 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public SysDepartment packTreeSysDepartmentById(List<SysDepartment> list, Long id) { public SysDepartment packTreeSysDepartmentById(List<SysDepartment> list, Long id) {
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
for (SysDepartment department : list) { for (SysDepartment department : list) {
if(department.getId().equals(id)){ if (department.getId().equals(id)) {
department.setChildList(packTreeSysDepartment(list, department.getId())); department.setChildList(packTreeSysDepartment(list, department.getId()));
return department; return department;
} }
@ -505,7 +506,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<Long> findChildSysDepartment(SysDepartment department) { public List<Long> findChildSysDepartment(SysDepartment department) {
List<Long> result = new ArrayList<>(); List<Long> result = new ArrayList<>();
if(department != null && department.getChildList() != null && department.getChildList().size() > 0){ if (department != null && department.getChildList() != null && department.getChildList().size() > 0) {
for (SysDepartment dep : department.getChildList()) { for (SysDepartment dep : department.getChildList()) {
result.add(dep.getId()); result.add(dep.getId());
result.addAll(findChildSysDepartment(dep)); result.addAll(findChildSysDepartment(dep));
@ -518,16 +519,16 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public List<Long> findSysDepartmentChildIdList(Long id) { public List<Long> findSysDepartmentChildIdList(Long id) {
SysDepartment department = personnelService.getSysDepartmentById(id); SysDepartment department = personnelService.getSysDepartmentById(id);
if(department != null){ if (department != null) {
List<SysDepartment> list = personnelService.findSysDepartmentList(); List<SysDepartment> list = personnelService.findSysDepartmentList();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
SysDepartment treeDep = packTreeSysDepartmentById(list, department.getId()); SysDepartment treeDep = packTreeSysDepartmentById(list, department.getId());
List<Long> idList = findChildSysDepartment(treeDep); List<Long> idList = findChildSysDepartment(treeDep);
idList.add(department.getId()); idList.add(department.getId());
return idList; return idList;
} }
} }
return null; return Collections.emptyList();
} }
/********************************************* End SysDepartment Tree *********************************************/ /********************************************* End SysDepartment Tree *********************************************/
@ -537,10 +538,10 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysMenu> packTreeSysMenu(List<SysMenu> list, Long parentId) { public List<SysMenu> packTreeSysMenu(List<SysMenu> list, Long parentId) {
List<SysMenu> result = new ArrayList<>(); List<SysMenu> result = new ArrayList<>();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
List<SysMenu> copyList = new ArrayList<>(list); List<SysMenu> copyList = new ArrayList<>(list);
list.forEach(menu -> { list.forEach(menu -> {
if(menu.getParentId() != null && menu.getParentId().equals(parentId)){ if (menu.getParentId() != null && menu.getParentId().equals(parentId)) {
result.add(menu); result.add(menu);
copyList.remove(menu); copyList.remove(menu);
menu.setChildList(packTreeSysMenu(copyList, menu.getId())); menu.setChildList(packTreeSysMenu(copyList, menu.getId()));
@ -555,7 +556,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysMenu> packTreeSysMenuBySysRefRoleMenu(List<SysMenu> list, List<SysRefRoleMenu> refList) { public List<SysMenu> packTreeSysMenuBySysRefRoleMenu(List<SysMenu> list, List<SysRefRoleMenu> refList) {
List<Long> ids = new ArrayList<>(refList.size()); List<Long> ids = new ArrayList<>(refList.size());
if(refList != null && refList.size() > 0){ if (refList != null && refList.size() > 0) {
refList.forEach(ref -> ids.add(ref.getMenuId())); refList.forEach(ref -> ids.add(ref.getMenuId()));
} }
@ -566,15 +567,15 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysMenu> packTreeSysMenuByIds(List<SysMenu> list, List<Long> ids) { public List<SysMenu> packTreeSysMenuByIds(List<SysMenu> list, List<Long> ids) {
List<SysMenu> result = new ArrayList<>(); List<SysMenu> result = new ArrayList<>();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
list.forEach(menu -> { list.forEach(menu -> {
if(menu.getChildList() == null || menu.getChildList().size() <= 0){ if (menu.getChildList() == null || menu.getChildList().size() <= 0) {
if(ids.contains(menu.getId())){ if (ids.contains(menu.getId())) {
result.add(menu); result.add(menu);
} }
}else{ } else {
List<SysMenu> childList = packTreeSysMenuByIds(menu.getChildList(), ids); List<SysMenu> childList = packTreeSysMenuByIds(menu.getChildList(), ids);
if(ids.contains(menu.getId()) || childList != null && childList.size() > 0){ if (ids.contains(menu.getId()) || childList != null && childList.size() > 0) {
menu.setChildList(childList); menu.setChildList(childList);
result.add(menu); result.add(menu);
} }
@ -587,9 +588,9 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public SysMenu packTreeSysMenuById(List<SysMenu> list, Long id) { public SysMenu packTreeSysMenuById(List<SysMenu> list, Long id) {
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
for (SysMenu menu : list) { for (SysMenu menu : list) {
if(menu.getId().equals(id)){ if (menu.getId().equals(id)) {
menu.setChildList(packTreeSysMenu(list, menu.getId())); menu.setChildList(packTreeSysMenu(list, menu.getId()));
return menu; return menu;
} }
@ -602,7 +603,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<Long> findChildSysMenu(SysMenu menu) { public List<Long> findChildSysMenu(SysMenu menu) {
List<Long> result = new ArrayList<>(); List<Long> result = new ArrayList<>();
if(menu != null && menu.getChildList() != null && menu.getChildList().size() > 0){ if (menu != null && menu.getChildList() != null && menu.getChildList().size() > 0) {
for (SysMenu sp : menu.getChildList()) { for (SysMenu sp : menu.getChildList()) {
result.add(sp.getId()); result.add(sp.getId());
result.addAll(findChildSysMenu(sp)); result.addAll(findChildSysMenu(sp));
@ -621,28 +622,28 @@ public class CoreMemTreeService implements ICoreMemTreeService {
public List<SysMenu> packTreeSysMenuByUserIdAndParentId(Long userId, Long parentId) { public List<SysMenu> packTreeSysMenuByUserIdAndParentId(Long userId, Long parentId) {
List<SysRefUserRole> roleList = personnelService.findSysRefUserRole(userId); List<SysRefUserRole> roleList = personnelService.findSysRefUserRole(userId);
if(roleList != null && roleList.size() > 0){ if (roleList != null && roleList.size() > 0) {
List<SysRefRoleMenu> refRoleMenuList = personnelService.findSysRefRoleMenuByRefUserRole(roleList); List<SysRefRoleMenu> refRoleMenuList = personnelService.findSysRefRoleMenuByRefUserRole(roleList);
if(refRoleMenuList != null && refRoleMenuList.size() > 0){ if (refRoleMenuList != null && refRoleMenuList.size() > 0) {
List<SysMenu> menuList = menuService.findLanguageMenuByMenuAndInId(null,null); List<SysMenu> menuList = menuService.findLanguageMenuByMenuAndInId(null, null);
List<SysMenu> menuRootTree = packTreeSysMenu(menuList, parentId); List<SysMenu> menuRootTree = packTreeSysMenu(menuList, parentId);
return packTreeSysMenuBySysRefRoleMenu(menuRootTree, refRoleMenuList); return packTreeSysMenuBySysRefRoleMenu(menuRootTree, refRoleMenuList);
} }
} }
return null; return Collections.emptyList();
} }
@Override @Override
public List<SysMenu> packTreeSysMenuByParentIdAndMenuType(List<SysMenu> list,Long parentId, Integer menuType) { public List<SysMenu> packTreeSysMenuByParentIdAndMenuType(List<SysMenu> list, Long parentId, Integer menuType) {
List<SysMenu> result = new ArrayList<>(); List<SysMenu> result = new ArrayList<>();
if(list != null && list.size() > 0){ if (list != null && list.size() > 0) {
for (SysMenu menu : list) { for (SysMenu menu : list) {
if(menu.getChildList() != null && menu.getChildList().size() > 0){ if (menu.getChildList() != null && menu.getChildList().size() > 0) {
result.addAll(packTreeSysMenuByParentIdAndMenuType(menu.getChildList(), parentId, menuType)); result.addAll(packTreeSysMenuByParentIdAndMenuType(menu.getChildList(), parentId, menuType));
} }
if(menu.getParentId().equals(parentId) && menu.getMenuType().equals(menuType)){ if (menu.getParentId().equals(parentId) && menu.getMenuType().equals(menuType)) {
result.add(menu); result.add(menu);
} }
} }
@ -653,7 +654,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
@Override @Override
public List<SysMenu> packTreeSysMenu() { public List<SysMenu> packTreeSysMenu() {
List<SysMenu> menuList = menuService.findLanguageMenuByMenuAndInId(null,null); List<SysMenu> menuList = menuService.findLanguageMenuByMenuAndInId(null, null);
return packTreeSysMenu(menuList, CommonEnumUtil.PARENT.DEFAULT.getValue()); return packTreeSysMenu(menuList, CommonEnumUtil.PARENT.DEFAULT.getValue());
} }

@ -610,37 +610,10 @@ public class CoreTreeService implements ICoreTreeService {
private List<SysDepartment> findSysDepartmentCacheByHqlWhere(String hql) { private List<SysDepartment> findSysDepartmentCacheByHqlWhere(String hql) {
return departmentRDao.findByHqlWhere(hql); return departmentRDao.findByHqlWhere(hql);
// if(!StringUtils.isBlank(hql)){
// String redisKey = CommonConstWords.REDIS_PREFIX_CACHE_DEPARTMENT+ "_findCacheByHqlWhere" + "_" + hql.hashCode();
// List list = redisCore.getList(redisKey, 0, -1);
// if(list == null){
// list = departmentRDao.findByHqlWhere(hql);
// if(list != null){
// redisCore.putList(redisKey,list,CommonConstWords.REDIS_TIME_DAY_ONE);
// }
// }
// return list;
// }else {
// return null;
// }
} }
private List<SysOrganize> findSysOrganizeCacheByHqlWhere(String hql) { private List<SysOrganize> findSysOrganizeCacheByHqlWhere(String hql) {
return organizeRDao.findByHqlWhere(hql); return organizeRDao.findByHqlWhere(hql);
// if(!StringUtils.isBlank(hql)){
// String redisKey = CommonConstWords.REDIS_PREFIX_CACHE_ORGANIZE+ "_findCacheByHqlWhere" + "_" + hql.hashCode();
// List list = redisCore.getList(redisKey, 0, -1);
// if(list == null){
// list = organizeRDao.findByHqlWhere(hql);
// if(list != null){
// redisCore.putList(redisKey,list,CommonConstWords.REDIS_TIME_DAY_ONE);
// }
// }
// return list;
// }else {
// return null;
// }
} }
} }

@ -14,5 +14,5 @@ import org.springframework.stereotype.Service;
**/ **/
@Service @Service
public class DataMoreService implements IDataMoreService { public class DataMoreService implements IDataMoreService {
private Logger LOGGER = LoggerFactory.getLogger(this.getClass()); public static final Logger LOGGER = LoggerFactory.getLogger(DataMoreService.class);
} }

@ -195,7 +195,7 @@ public class SysDictionaryService implements ISysDictionaryService {
List<SysDictionary> list = findSysDictionaryBySoftTypeAndParentCode(CommonEnumUtil.SOFT_TYPE.CORE.getValue(), List<SysDictionary> list = findSysDictionaryBySoftTypeAndParentCode(CommonEnumUtil.SOFT_TYPE.CORE.getValue(),
BaseConstWords.DICTIONARY_FILE_TYPE); BaseConstWords.DICTIONARY_FILE_TYPE);
if (list != null && list.size() > 0) { if (list != null && !list.isEmpty()) {
String suffix = StringTool.getStringFileSuffix(fileName, true); String suffix = StringTool.getStringFileSuffix(fileName, true);
for (SysDictionary dictionary : list) { for (SysDictionary dictionary : list) {

@ -24,25 +24,25 @@ public class CoreDemoThread extends BaseThread {
private String param; private String param;
public CoreDemoThread(String param){ public CoreDemoThread(String param) {
this.param = param; this.param = param;
IPersonnelService personnelService = ( IPersonnelService ) SpringContextsUtil.getBean(IPersonnelService.class); IPersonnelService personnelService = (IPersonnelService) SpringContextsUtil.getBean(IPersonnelService.class);
LOGGER.info("spring容器获取服务{}" + personnelService); LOGGER.info("spring容器获取服务{}", personnelService);
WebApplicationContext webAppContext = WebApplicationContextUtils.getWebApplicationContext(ServletContextUtil.getServletContext()); WebApplicationContext webAppContext = WebApplicationContextUtils.getWebApplicationContext(ServletContextUtil.getServletContext());
ISysMessageService sysMessageService = webAppContext.getBean(ISysMessageService.class); ISysMessageService sysMessageService = webAppContext.getBean(ISysMessageService.class);
LOGGER.info("servlet容器获取服务{}" + sysMessageService); LOGGER.info("servlet容器获取服务{}", sysMessageService);
} }
@Override @Override
public boolean doRun() { public boolean doRun() {
//处理业务逻辑 //处理业务逻辑
System.out.println("线程执行:获取参数" + param); LOGGER.info("线程执行:获取参数" + param);
return true; return true;
} }
//使用方式 //使用方式
public static void main(String[] args){ public static void main(String[] args) {
ImppThreadPool.getThreadExcutorService().execute(new CoreDemoThread("thread param")); ImppThreadPool.getThreadExcutorService().execute(new CoreDemoThread("thread param"));
} }
} }

@ -1,9 +1,10 @@
package cn.estsh.i3plus.core.apiservice.util; package cn.estsh.i3plus.core.apiservice.util;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.SysBarcodeRule; import cn.estsh.i3plus.pojo.platform.bean.SysBarcodeRule;
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 java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

Loading…
Cancel
Save