|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.io.LineHandler;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
|
|
@@ -125,11 +126,44 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
|
|
}
|
|
|
page = baseMapper.selectOrgList(page, org);
|
|
|
}
|
|
|
+ dealTableData(page);
|
|
|
//抓换为TableDataInfo适配前端
|
|
|
return TableDataInfo.build(page);
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private void dealTableData(Page<SysOrg> page)
|
|
|
+ {
|
|
|
+ if(ObjectUtil.isEmpty(page.getRecords()))
|
|
|
+ {
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ List<SysOrgVO> hsOrgList= getHSOrgCache();
|
|
|
+ page.getRecords().stream().forEach(x->{
|
|
|
+ if(ObjectUtil.isEmpty(x.getPath()))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if(Arrays.stream(x.getPath().split("-")).anyMatch(id->hsOrgList.stream().anyMatch(hsOrg->ObjectUtil.equal(id,hsOrg.getId().toString()))))
|
|
|
+ {
|
|
|
+ x.setUnderBank(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<SysOrgVO> getHSOrgCache() {
|
|
|
+ List<SysOrgVO> cacheList = null;
|
|
|
+ Boolean isOk = RedisUtils.hasKey(CacheConstants.HS_ORG_CACHE_LIST_KEY);
|
|
|
+ if (!isOk) {
|
|
|
+ cacheList = loadingOrgCache();
|
|
|
+ } else {
|
|
|
+ cacheList = RedisUtils.getCacheList(CacheConstants.HS_ORG_CACHE_LIST_KEY);
|
|
|
+ }
|
|
|
+
|
|
|
+ return cacheList;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<OrgPhysicalDefenseConstructionExport> excel(SysOrg dept) {
|
|
|
|
|
|
@@ -748,14 +782,17 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
|
|
|
@Override
|
|
|
public List<SysOrgVO> loadingOrgCache() {
|
|
|
List<SysOrgVO> sysOrgVOS = baseMapper.selectSysOrgVOList();
|
|
|
+ List<SysOrgVO> hsOrgs = sysOrgVOS.stream().filter(x -> ObjectUtil.equal(x.getType(), 3)).collect(Collectors.toList());
|
|
|
clearOrgCache();
|
|
|
RedisUtils.setCacheList(CacheConstants.ORG_CACHE_LIST_KEY, sysOrgVOS);
|
|
|
+ RedisUtils.setCacheList(CacheConstants.HS_ORG_CACHE_LIST_KEY, hsOrgs);
|
|
|
return sysOrgVOS;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void clearOrgCache() {
|
|
|
RedisUtils.deleteObject(CacheConstants.ORG_CACHE_LIST_KEY);
|
|
|
+ RedisUtils.deleteObject(CacheConstants.HS_ORG_CACHE_LIST_KEY);
|
|
|
//redisService.deleteObject(CacheConstants.ORG_CACHE_LIST_KEY);
|
|
|
}
|
|
|
|