Merge branch 'develop_3' into 'develop_master'
feat: 标准库 体系树形结构等 See merge request !19
This commit is contained in:
-1
@@ -4,7 +4,6 @@ package com.adc.da.slrs.sarResource.controller;
|
|||||||
import com.adc.da.base.web.BaseController;
|
import com.adc.da.base.web.BaseController;
|
||||||
import com.adc.da.http.ResponseMessage;
|
import com.adc.da.http.ResponseMessage;
|
||||||
import com.adc.da.http.Result;
|
import com.adc.da.http.Result;
|
||||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandard;
|
|
||||||
import com.adc.da.slrs.sarResource.entity.TsResource;
|
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||||
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.adc.da.slrs.sarResource.service;
|
package com.adc.da.slrs.sarResource.service;
|
||||||
|
|
||||||
import com.adc.da.http.ResponseMessage;
|
import com.adc.da.http.ResponseMessage;
|
||||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandard;
|
|
||||||
import com.adc.da.slrs.sarResource.entity.TsResource;
|
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
|||||||
-2
@@ -3,8 +3,6 @@ package com.adc.da.slrs.sarResource.service.impl;
|
|||||||
import com.adc.da.http.ResponseMessage;
|
import com.adc.da.http.ResponseMessage;
|
||||||
import com.adc.da.http.Result;
|
import com.adc.da.http.Result;
|
||||||
|
|
||||||
import com.adc.da.slrs.sarMenu.entity.SarMenu;
|
|
||||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandard;
|
|
||||||
import com.adc.da.slrs.sarResource.dao.TsResourceDao;
|
import com.adc.da.slrs.sarResource.dao.TsResourceDao;
|
||||||
import com.adc.da.slrs.sarResource.entity.TsResource;
|
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||||
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
||||||
|
|||||||
+23
-15
@@ -927,12 +927,12 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
|||||||
//修改标准过程中,重新修改代替标准号对应的标准的被代替标准号
|
//修改标准过程中,重新修改代替标准号对应的标准的被代替标准号
|
||||||
// updateReplacedNumber(sarStandardsInfoEO,beforeSarStandardsInfo);
|
// updateReplacedNumber(sarStandardsInfoEO,beforeSarStandardsInfo);
|
||||||
// 根据引用标准修改其他被引用标准
|
// 根据引用标准修改其他被引用标准
|
||||||
updateCiteStand(sarStandardsInfoEO, beforeSarStandardsInfo, "DTBJH", "BDTBZBH");
|
// updateCiteStand(sarStandardsInfoEO, beforeSarStandardsInfo, "DTBJH", "BDTBZBH");
|
||||||
updateCiteStand(sarStandardsInfoEO, beforeSarStandardsInfo, "YYBJ", "BYYBJ");
|
// updateCiteStand(sarStandardsInfoEO, beforeSarStandardsInfo, "YYBJ", "BYYBJ");
|
||||||
// 根据对应其他标准修改其他对应其他标准
|
// 根据对应其他标准修改其他对应其他标准
|
||||||
updateRelateStand(sarStandardsInfoEO, "CBBH");
|
// updateRelateStand(sarStandardsInfoEO, "CBBH");
|
||||||
// 根据代替标准号修改被代替的标准的状态 修改为已修订状态
|
// 根据代替标准号修改被代替的标准的状态 修改为已修订状态
|
||||||
replaseStandState(sarStandardsInfoEO);
|
// replaseStandState(sarStandardsInfoEO);
|
||||||
// 记录修改日志
|
// 记录修改日志
|
||||||
saveUpdateLog(sarStandardsInfoEO, beforeSarStandardsInfo);
|
saveUpdateLog(sarStandardsInfoEO, beforeSarStandardsInfo);
|
||||||
// if(elasflag) {
|
// if(elasflag) {
|
||||||
@@ -990,25 +990,33 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> changeMap(SarStandardsInfo sarStandardsInfoEO, Map<String, Object> map) {
|
public Map<String, Object> changeMap(SarStandardsInfo sarStandardsInfoEO, Map<String, Object> map) {
|
||||||
map.put("country", sarStandardsInfoEO.getCountry());
|
// map.put("country", sarStandardsInfoEO.getCountry());
|
||||||
map.put("isRelateAccess", sarStandardsInfoEO.getIsRelateAccess());
|
if(map == null){
|
||||||
map.put("standSort", sarStandardsInfoEO.getStandSort());
|
map = new TreeMap<String, Object>();
|
||||||
map.put("standNumber", sarStandardsInfoEO.getStandNumber());
|
}
|
||||||
map.put("standYear", sarStandardsInfoEO.getStandYear());
|
map.put("standSystem", verifyObj(sarStandardsInfoEO.getStandSystem()));
|
||||||
map.put("standName", sarStandardsInfoEO.getStandName());
|
map.put("isRelateAccess", verifyObj(sarStandardsInfoEO.getIsRelateAccess()));
|
||||||
map.put("standEnName", sarStandardsInfoEO.getStandEnName());
|
map.put("standSort", verifyObj(sarStandardsInfoEO.getStandSort()));
|
||||||
map.put("standNature", sarStandardsInfoEO.getStandNature());
|
map.put("standNumber", verifyObj(sarStandardsInfoEO.getStandNumber()));
|
||||||
map.put("standState", sarStandardsInfoEO.getStandState());
|
map.put("standYear", verifyObj(sarStandardsInfoEO.getStandYear()));
|
||||||
|
map.put("standName", verifyObj(sarStandardsInfoEO.getStandName()));
|
||||||
|
map.put("standEnName", verifyObj(sarStandardsInfoEO.getStandEnName()));
|
||||||
|
map.put("standNature", verifyObj(sarStandardsInfoEO.getStandNature()));
|
||||||
|
map.put("standState", verifyObj(sarStandardsInfoEO.getStandState()));
|
||||||
// if (sarStandardsInfoEO.getIssueTime() != null) {
|
// if (sarStandardsInfoEO.getIssueTime() != null) {
|
||||||
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
// String issueStr = format.format(sarStandardsInfoEO.getIssueTime());
|
// String issueStr = format.format(sarStandardsInfoEO.getIssueTime());
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
map.put("issueTime", sarStandardsInfoEO.getIssueTime());
|
map.put("issueTime", verifyObj(sarStandardsInfoEO.getIssueTime()));
|
||||||
map.put("synopsis", sarStandardsInfoEO.getSynopsis());
|
map.put("synopsis", verifyObj(sarStandardsInfoEO.getSynopsis()));
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Object verifyObj(Object str){
|
||||||
|
return str == null ? "" : str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public int deleteSarStandards(String ids) {
|
public int deleteSarStandards(String ids) {
|
||||||
String[] idArr = ids.split(",");
|
String[] idArr = ids.split(",");
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ public class InitStandAttrUtil implements ApplicationRunner {
|
|||||||
StringBuilder fieldInfoNameBuilderLaws = new StringBuilder();
|
StringBuilder fieldInfoNameBuilderLaws = new StringBuilder();
|
||||||
StringBuilder fieldInfoNameBuilderBuss = new StringBuilder();
|
StringBuilder fieldInfoNameBuilderBuss = new StringBuilder();
|
||||||
QueryWrapper qw = new QueryWrapper();
|
QueryWrapper qw = new QueryWrapper();
|
||||||
|
qw.eq("VALID_FLAG","0");
|
||||||
List<SarStandAttrDetails> getDetailsList = sarStandAttrDetailsEOService.list(qw);
|
List<SarStandAttrDetails> getDetailsList = sarStandAttrDetailsEOService.list(qw);
|
||||||
if (getDetailsList != null && !getDetailsList.isEmpty()) {
|
if (getDetailsList != null && !getDetailsList.isEmpty()) {
|
||||||
logger.info("项目启动时加载--查询标准属性类--查询到" + getDetailsList.size() + "条属性字段数据!");
|
logger.info("项目启动时加载--查询标准属性类--查询到" + getDetailsList.size() + "条属性字段数据!");
|
||||||
|
|||||||
+3
-3
@@ -52,7 +52,7 @@
|
|||||||
SAR_STANDARDS_INFO.stand_number, SAR_STANDARDS_INFO.stand_year, SAR_STANDARDS_INFO.stand_name, SAR_STANDARDS_INFO.stand_en_name,
|
SAR_STANDARDS_INFO.stand_number, SAR_STANDARDS_INFO.stand_year, SAR_STANDARDS_INFO.stand_name, SAR_STANDARDS_INFO.stand_en_name,
|
||||||
SAR_STANDARDS_INFO.stand_state, SAR_STANDARDS_INFO.stand_nature, SAR_STANDARDS_INFO.issue_time, SAR_STANDARDS_INFO.put_time,
|
SAR_STANDARDS_INFO.stand_state, SAR_STANDARDS_INFO.stand_nature, SAR_STANDARDS_INFO.issue_time, SAR_STANDARDS_INFO.put_time,
|
||||||
SAR_STANDARDS_INFO.synopsis, SAR_STANDARDS_INFO.creation_user, SAR_STANDARDS_INFO.valid_flag,
|
SAR_STANDARDS_INFO.synopsis, SAR_STANDARDS_INFO.creation_user, SAR_STANDARDS_INFO.valid_flag,
|
||||||
SAR_STANDARDS_INFO.creation_time, SAR_STANDARDS_INFO.modify_time,SAR_STANDARDS_INFO.is_relate_access,SAR_STANDARDS_INFO.cite_stand,SAR_STANDARDS_INFO.cited_stand,SAR_STANDARDS_INFO.text_status
|
SAR_STANDARDS_INFO.creation_time, SAR_STANDARDS_INFO.modify_time,SAR_STANDARDS_INFO.is_relate_access,SAR_STANDARDS_INFO.cite_stand,SAR_STANDARDS_INFO.cited_stand,SAR_STANDARDS_INFO.text_status,SAR_STANDARDS_INFO.STAND_SYSTEM
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="Base_Column_List_Show" >
|
<sql id="Base_Column_List_Show" >
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
SAR_STANDARDS_INFO.stand_state, SAR_STANDARDS_INFO.stand_nature, SAR_STANDARDS_INFO.issue_time, SAR_STANDARDS_INFO.put_time,
|
SAR_STANDARDS_INFO.stand_state, SAR_STANDARDS_INFO.stand_nature, SAR_STANDARDS_INFO.issue_time, SAR_STANDARDS_INFO.put_time,
|
||||||
concat(SAR_STANDARDS_INFO.synopsis, '') as synopsis, concat(replace_stand_num, '') as replace_stand_num, replaced_stand_num, SAR_STANDARDS_INFO.creation_user, SAR_STANDARDS_INFO.valid_flag,
|
concat(SAR_STANDARDS_INFO.synopsis, '') as synopsis, concat(replace_stand_num, '') as replace_stand_num, replaced_stand_num, SAR_STANDARDS_INFO.creation_user, SAR_STANDARDS_INFO.valid_flag,
|
||||||
SAR_STANDARDS_INFO.creation_time, SAR_STANDARDS_INFO.modify_time,dicountry.DIC_TYPE_NAME as countryShow, dicstandSort.DIC_TYPE_NAME as standSortShow,
|
SAR_STANDARDS_INFO.creation_time, SAR_STANDARDS_INFO.modify_time,dicountry.DIC_TYPE_NAME as countryShow, dicstandSort.DIC_TYPE_NAME as standSortShow,
|
||||||
dicstandState.DIC_TYPE_NAME as standStateShow,dicstandNature.DIC_TYPE_NAME as standNatureShow,is_relate_access,cite_stand,cited_stand,SAR_STANDARDS_INFO.text_status
|
dicstandState.DIC_TYPE_NAME as standStateShow,dicstandNature.DIC_TYPE_NAME as standNatureShow,is_relate_access,cite_stand,cited_stand,SAR_STANDARDS_INFO.text_status,SAR_STANDARDS_INFO.STAND_SYSTEM
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="Group_Column_List_Show">
|
<sql id="Group_Column_List_Show">
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
SAR_STANDARDS_INFO.stand_state, SAR_STANDARDS_INFO.stand_nature, SAR_STANDARDS_INFO.issue_time, SAR_STANDARDS_INFO.put_time,
|
SAR_STANDARDS_INFO.stand_state, SAR_STANDARDS_INFO.stand_nature, SAR_STANDARDS_INFO.issue_time, SAR_STANDARDS_INFO.put_time,
|
||||||
concat(SAR_STANDARDS_INFO.synopsis, ''), concat(replace_stand_num, ''), replaced_stand_num, SAR_STANDARDS_INFO.creation_user, SAR_STANDARDS_INFO.valid_flag,
|
concat(SAR_STANDARDS_INFO.synopsis, ''), concat(replace_stand_num, ''), replaced_stand_num, SAR_STANDARDS_INFO.creation_user, SAR_STANDARDS_INFO.valid_flag,
|
||||||
SAR_STANDARDS_INFO.creation_time, SAR_STANDARDS_INFO.modify_time,dicountry.DIC_TYPE_NAME, dicstandSort.DIC_TYPE_NAME,
|
SAR_STANDARDS_INFO.creation_time, SAR_STANDARDS_INFO.modify_time,dicountry.DIC_TYPE_NAME, dicstandSort.DIC_TYPE_NAME,
|
||||||
dicstandState.DIC_TYPE_NAME,dicstandNature.DIC_TYPE_NAME,is_relate_access,cite_stand,cited_stand,SAR_STANDARDS_INFO.text_status
|
dicstandState.DIC_TYPE_NAME,dicstandNature.DIC_TYPE_NAME,is_relate_access,cite_stand,cited_stand,SAR_STANDARDS_INFO.text_status,SAR_STANDARDS_INFO.STAND_SYSTEM
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 查询条件 -->
|
<!-- 查询条件 -->
|
||||||
|
|||||||
+5
-7
@@ -1,19 +1,17 @@
|
|||||||
package com.adc.da.slrs.sarMenuStandard.controller;
|
package com.adc.da.sys.sarMenuStandard.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.adc.da.base.web.BaseController;
|
||||||
import com.adc.da.http.ResponseMessage;
|
import com.adc.da.http.ResponseMessage;
|
||||||
import com.adc.da.http.Result;
|
import com.adc.da.http.Result;
|
||||||
import com.adc.da.slrs.sarMenu.entity.SarMenu;
|
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
|
||||||
import com.adc.da.slrs.sarMenu.service.ISarMenuService;
|
import com.adc.da.sys.sarMenuStandard.service.ISarMenuStandardService;
|
||||||
import com.adc.da.slrs.sarMenuStandard.service.ISarMenuStandardService;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandard;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import com.adc.da.base.web.BaseController;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
+2
-3
@@ -1,8 +1,7 @@
|
|||||||
package com.adc.da.slrs.sarMenuStandard.dao;
|
package com.adc.da.sys.sarMenuStandard.dao;
|
||||||
|
|
||||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandard;
|
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
+6
-8
@@ -1,15 +1,11 @@
|
|||||||
package com.adc.da.slrs.sarMenuStandard.entity;
|
package com.adc.da.sys.sarMenuStandard.entity;
|
||||||
|
|
||||||
import com.adc.da.base.entity.BaseEntity;
|
import com.adc.da.base.entity.BaseEntity;
|
||||||
import com.adc.da.utils.treetool.annotation.TreeNodeName;
|
import com.adc.da.sys.utils.treetool.annotation.TreeNodeName;
|
||||||
import com.adc.da.utils.treetool.annotation.TreeNodeParentId;
|
import com.adc.da.sys.utils.treetool.annotation.TreeNodeParentId;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -18,6 +14,8 @@ import lombok.experimental.Accessors;
|
|||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package com.adc.da.slrs.sarMenuStandard.service;
|
package com.adc.da.sys.sarMenuStandard.service;
|
||||||
|
|
||||||
import com.adc.da.http.ResponseMessage;
|
import com.adc.da.http.ResponseMessage;
|
||||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandard;
|
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
+4
-5
@@ -1,11 +1,10 @@
|
|||||||
package com.adc.da.slrs.sarMenuStandard.service.impl;
|
package com.adc.da.sys.sarMenuStandard.service.impl;
|
||||||
|
|
||||||
import com.adc.da.http.ResponseMessage;
|
import com.adc.da.http.ResponseMessage;
|
||||||
import com.adc.da.http.Result;
|
import com.adc.da.http.Result;
|
||||||
import com.adc.da.slrs.sarMenu.entity.SarMenu;
|
import com.adc.da.sys.sarMenuStandard.dao.SarMenuStandardDao;
|
||||||
import com.adc.da.slrs.sarMenuStandard.entity.SarMenuStandard;
|
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
|
||||||
import com.adc.da.slrs.sarMenuStandard.dao.SarMenuStandardDao;
|
import com.adc.da.sys.sarMenuStandard.service.ISarMenuStandardService;
|
||||||
import com.adc.da.slrs.sarMenuStandard.service.ISarMenuStandardService;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.adc.da.sys.service.impl;
|
package com.adc.da.sys.service.impl;
|
||||||
|
|
||||||
import com.adc.da.sys.common.SelectionResult;
|
import com.adc.da.sys.common.SelectionResult;
|
||||||
import com.adc.da.sys.dao.DicEODao;
|
|
||||||
import com.adc.da.sys.dao.DicTypeEODao;
|
import com.adc.da.sys.dao.DicTypeEODao;
|
||||||
import com.adc.da.sys.entity.DicTypeEO;
|
import com.adc.da.sys.entity.DicTypeEO;
|
||||||
import com.adc.da.sys.entity.DictionaryEO;
|
import com.adc.da.sys.entity.DictionaryEO;
|
||||||
import com.adc.da.sys.page.DicTypeEOPage;
|
import com.adc.da.sys.page.DicTypeEOPage;
|
||||||
|
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
|
||||||
|
import com.adc.da.sys.sarMenuStandard.service.ISarMenuStandardService;
|
||||||
import com.adc.da.sys.service.IDicEOService;
|
import com.adc.da.sys.service.IDicEOService;
|
||||||
import com.adc.da.sys.service.IDicTypeEOService;
|
import com.adc.da.sys.service.IDicTypeEOService;
|
||||||
import com.adc.da.util.LoginUserUtil;
|
import com.adc.da.util.LoginUserUtil;
|
||||||
@@ -33,6 +34,9 @@ public class DicTypeEOServiceImpl extends ServiceImpl<DicTypeEODao,DicTypeEO> im
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IDicEOService dicEODao;
|
private IDicEOService dicEODao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISarMenuStandardService iSarMenuStandardService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public DicTypeEODao getDao() {
|
public DicTypeEODao getDao() {
|
||||||
@@ -168,8 +172,13 @@ public class DicTypeEOServiceImpl extends ServiceImpl<DicTypeEODao,DicTypeEO> im
|
|||||||
Map<String,Object> resultMap = new HashMap<>();
|
Map<String,Object> resultMap = new HashMap<>();
|
||||||
List<DictionaryEO> diclist = dicEODao.getDictionaryEO();
|
List<DictionaryEO> diclist = dicEODao.getDictionaryEO();
|
||||||
for (DictionaryEO dictionaryEO : diclist){
|
for (DictionaryEO dictionaryEO : diclist){
|
||||||
List<Map<String,String >> relist = getDicTypeByDicCode(dictionaryEO.getDictionaryCode());
|
if(dictionaryEO.getDictionType().equals("TREE")){
|
||||||
resultMap.put(dictionaryEO.getDictionaryCode(),relist);
|
List<SarMenuStandard> treeList = iSarMenuStandardService.getAll(dictionaryEO.getId());
|
||||||
|
resultMap.put(dictionaryEO.getDictionaryCode(),treeList);
|
||||||
|
}else {
|
||||||
|
List<Map<String,String >> relist = getDicTypeByDicCode(dictionaryEO.getDictionaryCode());
|
||||||
|
resultMap.put(dictionaryEO.getDictionaryCode(),relist);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 查询细类
|
// 查询细类
|
||||||
List<Map<String,String >> relist = getDicTypeByDicCode("BUSSFINECLASSSHOW");
|
List<Map<String,String >> relist = getDicTypeByDicCode("BUSSFINECLASSSHOW");
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.adc.da.sys.utils.tree;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作树的接口类
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ITree {
|
||||||
|
/**
|
||||||
|
* 获取构建数的list,因为根节点可能不止一个,所有返回List
|
||||||
|
* 获取的结构与getRoot基本一致,但是后边增加了另外的数据,不建议调用
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TreeNode> getTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取根节点树结构,因为根节点可能不止一个,所有返回List
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<TreeNode> getRoot();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定节点数据
|
||||||
|
*
|
||||||
|
* @param nodeId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TreeNode getTreeNode(String nodeId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.adc.da.sys.utils.tree;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要实现树的实体类需要实现的接口,获取关键数据
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface ITreeNode<T> {
|
||||||
|
/**
|
||||||
|
* TreeNode获取nodeId
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getNodeId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TreeNode获取nodeName
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getNodeName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TreeNode获取nodeParentId(父id)
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getNodeParentId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TreeNode获取orderNum(排序字段用于排序)
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer getOrderNum();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TreeNode获取nodeLevel(当前属于第几层级)
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Integer getNodeLevel();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
package com.adc.da.sys.utils.tree;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建树形建构
|
||||||
|
*/
|
||||||
|
public class Tree implements ITree {
|
||||||
|
/**
|
||||||
|
* 用于存放treeNode的Map
|
||||||
|
*/
|
||||||
|
private LinkedHashMap<String, TreeNode> treeNodesMap = new LinkedHashMap<>();
|
||||||
|
/**
|
||||||
|
* 用于存放treeNode的list
|
||||||
|
*/
|
||||||
|
private List<TreeNode> treeNodesList = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造方法
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
public Tree(List<ITreeNode> list) {
|
||||||
|
initTreeNodeMap(list);
|
||||||
|
initTreeNodeList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将List对象数据转为TreeNodeMap
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
private void initTreeNodeMap(List<ITreeNode> list) {
|
||||||
|
TreeNode treeNode;
|
||||||
|
for (ITreeNode item : list) {
|
||||||
|
treeNode = new TreeNode(item);
|
||||||
|
treeNode.setLastNodeNum(1);
|
||||||
|
treeNodesMap.put(treeNode.getNodeId(), treeNode);
|
||||||
|
}
|
||||||
|
Iterator<TreeNode> iterator = treeNodesMap.values().iterator();
|
||||||
|
TreeNode parentTreeNode;
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
treeNode = iterator.next();
|
||||||
|
if (StringUtils.isEmpty(treeNode.getParentNodeId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
parentTreeNode = treeNodesMap.get(treeNode.getParentNodeId());
|
||||||
|
if (parentTreeNode != null) {
|
||||||
|
treeNode.setParent(parentTreeNode);
|
||||||
|
parentTreeNode.addChild(treeNode);
|
||||||
|
// 按照orderNum排序
|
||||||
|
Collections.sort(parentTreeNode.getChildren(), new OrdNamComparator());
|
||||||
|
// 判断这个节点是否是最子节点
|
||||||
|
if (treeNode.getChildren().size() == 0) {
|
||||||
|
treeNode.setLastNode(true);
|
||||||
|
}
|
||||||
|
// 计算每一个节点的最子节点的数量
|
||||||
|
List<TreeNode> children = parentTreeNode.getChildren();
|
||||||
|
if (children.size() > 0) {
|
||||||
|
int sum = 0;
|
||||||
|
for (TreeNode treeNode2 : children) {
|
||||||
|
sum += treeNode2.getLastNodeNum();
|
||||||
|
}
|
||||||
|
parentTreeNode.setLastNodeNum(sum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据treeNodesMap转为treeNodesList
|
||||||
|
*/
|
||||||
|
private void initTreeNodeList() {
|
||||||
|
if (treeNodesList.size() > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (treeNodesMap.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Iterator<TreeNode> iterator = treeNodesMap.values().iterator();
|
||||||
|
TreeNode treeNode;
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
treeNode = iterator.next();
|
||||||
|
if (treeNode.getParent() == null) {
|
||||||
|
this.treeNodesList.add(treeNode);
|
||||||
|
this.treeNodesList.addAll(treeNode.getAllChildren());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TreeNode> getTree() {
|
||||||
|
return this.treeNodesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TreeNode> getRoot() {
|
||||||
|
List<TreeNode> rootList = new ArrayList<>();
|
||||||
|
if (this.treeNodesList.size() > 0) {
|
||||||
|
for (TreeNode node : treeNodesList) {
|
||||||
|
if (node.getParent() == null) {
|
||||||
|
rootList.add(node);
|
||||||
|
Collections.sort(rootList, new OrdNamComparator());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rootList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TreeNode getTreeNode(String nodeId) {
|
||||||
|
return this.treeNodesMap.get(nodeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义排序,按照orderNum排序
|
||||||
|
*/
|
||||||
|
class OrdNamComparator implements Comparator<TreeNode> {
|
||||||
|
@Override
|
||||||
|
public int compare(TreeNode t1, TreeNode t2) {
|
||||||
|
if (t1.getOrderNum() > t2.getOrderNum()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (t1.getOrderNum() < t2.getOrderNum()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return t1.getNodeName().compareTo(t2.getNodeName());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
package com.adc.da.sys.utils.tree;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TreeNode {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 树节点ID
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 1)
|
||||||
|
private String nodeId;
|
||||||
|
/**
|
||||||
|
* 树节点名称
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 2)
|
||||||
|
private String nodeName;
|
||||||
|
/**
|
||||||
|
* 父节点ID
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 3)
|
||||||
|
private String parentNodeId;
|
||||||
|
/**
|
||||||
|
* 节点在树中的排序号
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 4)
|
||||||
|
private int orderNum;
|
||||||
|
/**
|
||||||
|
* 节点所在的层级
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 5)
|
||||||
|
private int level;
|
||||||
|
/**
|
||||||
|
* 最子节点的数量
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 6)
|
||||||
|
private int lastNodeNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是最子节点
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 7)
|
||||||
|
private boolean lastNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前节点的儿子节点
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 8)
|
||||||
|
private List<TreeNode> children = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前节点的完整路径
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 9)
|
||||||
|
private String completeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前节点的父级节点
|
||||||
|
* 转json的时候忽略此属性,因为此属性到前端无作用
|
||||||
|
*/
|
||||||
|
@JSONField(serialize = false)
|
||||||
|
private TreeNode parent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前节点的子孙节点
|
||||||
|
* 转json的时候忽略此属性,因为此属性到前端无作用
|
||||||
|
*/
|
||||||
|
@JSONField(serialize = false)
|
||||||
|
private List<TreeNode> allChildren = new ArrayList<>();
|
||||||
|
|
||||||
|
public TreeNode(ITreeNode obj) {
|
||||||
|
this.nodeId = obj.getNodeId();
|
||||||
|
this.nodeName = obj.getNodeName();
|
||||||
|
this.parentNodeId = obj.getNodeParentId();
|
||||||
|
this.orderNum = obj.getOrderNum();
|
||||||
|
this.level = obj.getNodeLevel();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode(TreeNode obj) {
|
||||||
|
this.orderNum = obj.getOrderNum();
|
||||||
|
this.level = obj.getLevel();
|
||||||
|
this.lastNodeNum = obj.getLastNodeNum();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addChild(TreeNode treeNode) {
|
||||||
|
this.children.add(treeNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeChild(TreeNode treeNode) {
|
||||||
|
this.children.remove(treeNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNodeId() {
|
||||||
|
return nodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNodeId(String nodeId) {
|
||||||
|
this.nodeId = nodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNodeName() {
|
||||||
|
return nodeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNodeName(String nodeName) {
|
||||||
|
this.nodeName = nodeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentNodeId() {
|
||||||
|
return parentNodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentNodeId(String parentNodeId) {
|
||||||
|
this.parentNodeId = parentNodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(int level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode getParent() {
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(TreeNode parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TreeNode> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildren(List<TreeNode> children) {
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOrderNum() {
|
||||||
|
return orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderNum(int orderNum) {
|
||||||
|
this.orderNum = orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLastNodeNum() {
|
||||||
|
return lastNodeNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastNodeNum(int lastNodeNum) {
|
||||||
|
this.lastNodeNum = lastNodeNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLastNode() {
|
||||||
|
return lastNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastNode(boolean lastNode) {
|
||||||
|
this.lastNode = lastNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TreeNode> getAllChildren() {
|
||||||
|
if (this.allChildren.isEmpty()) {
|
||||||
|
for (TreeNode treeNode : this.children) {
|
||||||
|
this.allChildren.add(treeNode);
|
||||||
|
this.allChildren.addAll(treeNode.getAllChildren());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.allChildren;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompleteName() {
|
||||||
|
return completeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompleteName(String completeName) {
|
||||||
|
this.completeName = completeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.adc.da.sys.utils.treetool;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List 排序 Comparator
|
||||||
|
* @author david
|
||||||
|
*/
|
||||||
|
public class OrdNamComparator implements Comparator<TreeNode> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(TreeNode t1, TreeNode t2) {
|
||||||
|
if (t1.getOrderNum() > t2.getOrderNum()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (t1.getOrderNum() < t2.getOrderNum()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return t1.getNodeName().compareTo(t2.getNodeName());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,179 @@
|
|||||||
|
package com.adc.da.sys.utils.treetool;
|
||||||
|
|
||||||
|
import com.adc.da.sys.utils.treetool.annotation.*;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
//import group.ipp.tree.util.annotation.TreeNodeLevel;
|
||||||
|
//import group.ipp.tree.util.annotation.TreeNodeName;
|
||||||
|
//import group.ipp.tree.util.annotation.TreeNodeOrder;
|
||||||
|
//import group.ipp.tree.util.annotation.TreeNodeParentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建树形建构
|
||||||
|
*
|
||||||
|
* @author David
|
||||||
|
*/
|
||||||
|
public class Tree<T> {
|
||||||
|
/**
|
||||||
|
* 用于存放treeNode的Map
|
||||||
|
*/
|
||||||
|
private LinkedHashMap<String, TreeNode> treeNodesMap = new LinkedHashMap<>();
|
||||||
|
/**
|
||||||
|
* 用于存放treeNode的list
|
||||||
|
*/
|
||||||
|
private List<TreeNode> treeNodesList = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造方法
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
public Tree(List<T> list) {
|
||||||
|
initTreeNodeMap(list);
|
||||||
|
initTreeNodeList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将List对象数据转为TreeNodeMap
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
private void initTreeNodeMap(List<T> list) {
|
||||||
|
TreeNode treeNode;
|
||||||
|
for (Object item : list) {
|
||||||
|
treeNode = new TreeNode();
|
||||||
|
treeNode.setNodeId(getFieldValue(item, "TreeNodeId"));
|
||||||
|
treeNode.setNodeName(getFieldValue(item, "TreeNodeName"));
|
||||||
|
treeNode.setParentNodeId(getFieldValue(item, "TreeNodeParentId"));
|
||||||
|
if(StringUtils.isEmpty(getFieldValue(item, "TreeNodeLevel"))) {
|
||||||
|
treeNode.setLevel(0);
|
||||||
|
} else {
|
||||||
|
treeNode.setLevel(Integer.parseInt(getFieldValue(item, "TreeNodeLevel")));
|
||||||
|
}
|
||||||
|
if(StringUtils.isEmpty(getFieldValue(item, "TreeNodeOrder"))) {
|
||||||
|
treeNode.setOrderNum(0);
|
||||||
|
} else {
|
||||||
|
treeNode.setOrderNum(Integer.parseInt(getFieldValue(item, "TreeNodeOrder")));
|
||||||
|
}
|
||||||
|
treeNode.setLastNodeNum(1);
|
||||||
|
treeNode.setData(item);
|
||||||
|
treeNodesMap.put(treeNode.getNodeId(), treeNode);
|
||||||
|
}
|
||||||
|
Iterator<TreeNode> iterator = treeNodesMap.values().iterator();
|
||||||
|
TreeNode parentTreeNode;
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
treeNode = iterator.next();
|
||||||
|
if (StringUtils.isEmpty(treeNode.getParentNodeId())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
parentTreeNode = treeNodesMap.get(treeNode.getParentNodeId());
|
||||||
|
if (parentTreeNode != null) {
|
||||||
|
treeNode.setParent(parentTreeNode);
|
||||||
|
parentTreeNode.addChild(treeNode);
|
||||||
|
// 按照orderNum排序
|
||||||
|
Collections.sort(parentTreeNode.getChildren(), new OrdNamComparator());
|
||||||
|
// 判断这个节点是否是最子节点
|
||||||
|
if (treeNode.getChildren().size() == 0) {
|
||||||
|
treeNode.setLastNode(true);
|
||||||
|
}
|
||||||
|
// 计算每一个节点的最子节点的数量
|
||||||
|
List<TreeNode> children = parentTreeNode.getChildren();
|
||||||
|
if (children.size() > 0) {
|
||||||
|
int sum = 0;
|
||||||
|
for (TreeNode treeNode2 : children) {
|
||||||
|
sum += treeNode2.getLastNodeNum();
|
||||||
|
}
|
||||||
|
parentTreeNode.setLastNodeNum(sum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getFieldValue(Object obj, String type) {
|
||||||
|
Class clz = obj.getClass();
|
||||||
|
Field[] fields = clz.getDeclaredFields();
|
||||||
|
String value = null;
|
||||||
|
try {
|
||||||
|
for(Field field : fields){
|
||||||
|
field.setAccessible(true);
|
||||||
|
switch (type){
|
||||||
|
case "TreeNodeId":
|
||||||
|
if(field.isAnnotationPresent(TreeNodeId.class)) {
|
||||||
|
value = String.valueOf(field.get(obj));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "TreeNodeParentId":
|
||||||
|
if(field.isAnnotationPresent(TreeNodeParentId.class)) {
|
||||||
|
value = String.valueOf(field.get(obj));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "TreeNodeName":
|
||||||
|
if(field.isAnnotationPresent(TreeNodeName.class)) {
|
||||||
|
value = String.valueOf(field.get(obj));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "TreeNodeOrder":
|
||||||
|
if(field.isAnnotationPresent(TreeNodeOrder.class)) {
|
||||||
|
value = String.valueOf(field.get(obj));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "TreeNodeLevel":
|
||||||
|
if(field.isAnnotationPresent(TreeNodeLevel.class)) {
|
||||||
|
value = String.valueOf(field.get(obj));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据treeNodesMap转为treeNodesList
|
||||||
|
*/
|
||||||
|
private void initTreeNodeList() {
|
||||||
|
if (treeNodesList.size() > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (treeNodesMap.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Iterator<TreeNode> iterator = treeNodesMap.values().iterator();
|
||||||
|
TreeNode treeNode;
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
treeNode = iterator.next();
|
||||||
|
if (treeNode.getParent() == null) {
|
||||||
|
this.treeNodesList.add(treeNode);
|
||||||
|
this.treeNodesList.addAll(treeNode.getAllChildren());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TreeNode> getTree() {
|
||||||
|
return this.treeNodesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TreeNode> getRoot() {
|
||||||
|
List<TreeNode> rootList = new ArrayList<>();
|
||||||
|
if (this.treeNodesList.size() > 0) {
|
||||||
|
for (TreeNode node : treeNodesList) {
|
||||||
|
if (node.getParent() == null) {
|
||||||
|
rootList.add(node);
|
||||||
|
Collections.sort(rootList, new OrdNamComparator());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rootList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode getTreeNode(String nodeId) {
|
||||||
|
return this.treeNodesMap.get(nodeId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,202 @@
|
|||||||
|
package com.adc.da.sys.utils.treetool;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author David
|
||||||
|
*/
|
||||||
|
public class TreeNode {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 树节点ID
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 1)
|
||||||
|
private String nodeId;
|
||||||
|
/**
|
||||||
|
* 树节点名称
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 2)
|
||||||
|
private String nodeName;
|
||||||
|
/**
|
||||||
|
* 父节点ID
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 3)
|
||||||
|
private String parentNodeId;
|
||||||
|
/**
|
||||||
|
* 节点在树中的排序号
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 4)
|
||||||
|
private int orderNum;
|
||||||
|
/**
|
||||||
|
* 节点所在的层级
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 5)
|
||||||
|
private int level;
|
||||||
|
/**
|
||||||
|
* 最子节点的数量
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 6)
|
||||||
|
private int lastNodeNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是最子节点
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 7)
|
||||||
|
private boolean lastNode;
|
||||||
|
|
||||||
|
private Object data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前节点的儿子节点
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 8)
|
||||||
|
private List<TreeNode> children = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前节点的完整路径
|
||||||
|
*/
|
||||||
|
@JSONField(ordinal = 9)
|
||||||
|
private String completeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前节点的父级节点
|
||||||
|
* 转json的时候忽略此属性,因为此属性到前端无作用
|
||||||
|
*/
|
||||||
|
@JSONField(serialize = false)
|
||||||
|
private TreeNode parent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前节点的子孙节点
|
||||||
|
* 转json的时候忽略此属性,因为此属性到前端无作用
|
||||||
|
*/
|
||||||
|
@JSONField(serialize = false)
|
||||||
|
private List<TreeNode> allChildren = new ArrayList<>();
|
||||||
|
|
||||||
|
private int standFlag;
|
||||||
|
|
||||||
|
public TreeNode(TreeNode obj) {
|
||||||
|
this.orderNum = obj.getOrderNum();
|
||||||
|
this.level = obj.getLevel();
|
||||||
|
this.lastNodeNum = obj.getLastNodeNum();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addChild(TreeNode treeNode) {
|
||||||
|
this.children.add(treeNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeChild(TreeNode treeNode) {
|
||||||
|
this.children.remove(treeNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNodeId() {
|
||||||
|
return nodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNodeId(String nodeId) {
|
||||||
|
this.nodeId = nodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNodeName() {
|
||||||
|
return nodeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNodeName(String nodeName) {
|
||||||
|
this.nodeName = nodeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParentNodeId() {
|
||||||
|
return parentNodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParentNodeId(String parentNodeId) {
|
||||||
|
this.parentNodeId = parentNodeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(int level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode getParent() {
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(TreeNode parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TreeNode> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChildren(List<TreeNode> children) {
|
||||||
|
this.children = children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOrderNum() {
|
||||||
|
return orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderNum(int orderNum) {
|
||||||
|
this.orderNum = orderNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLastNodeNum() {
|
||||||
|
return lastNodeNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastNodeNum(int lastNodeNum) {
|
||||||
|
this.lastNodeNum = lastNodeNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLastNode() {
|
||||||
|
return lastNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastNode(boolean lastNode) {
|
||||||
|
this.lastNode = lastNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TreeNode> getAllChildren() {
|
||||||
|
if (this.allChildren.isEmpty()) {
|
||||||
|
for (TreeNode treeNode : this.children) {
|
||||||
|
this.allChildren.add(treeNode);
|
||||||
|
this.allChildren.addAll(treeNode.getAllChildren());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.allChildren;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompleteName() {
|
||||||
|
return completeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompleteName(String completeName) {
|
||||||
|
this.completeName = completeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(Object data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStandFlag() {
|
||||||
|
return standFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStandFlag(int standFlag) {
|
||||||
|
this.standFlag = standFlag;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.adc.da.sys.utils.treetool.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author david
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Documented
|
||||||
|
public @interface TreeNodeId {
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.adc.da.sys.utils.treetool.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author david
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Documented
|
||||||
|
public @interface TreeNodeLevel {
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.adc.da.sys.utils.treetool.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author david
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Documented
|
||||||
|
public @interface TreeNodeName {
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.adc.da.sys.utils.treetool.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author david
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Documented
|
||||||
|
public @interface TreeNodeOrder {
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package com.adc.da.sys.utils.treetool.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author david
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.FIELD})
|
||||||
|
@Documented
|
||||||
|
public @interface TreeNodeParentId {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user