|
@@ -25,6 +25,7 @@ import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
|
+import org.springblade.manager.dto.ArchiveTreeContractAutoRuleMapDTO;
|
|
|
import org.springblade.manager.entity.ArchiveTree;
|
|
|
import org.springblade.manager.entity.ArchiveTreeContract;
|
|
|
import org.springblade.manager.entity.ContractInfo;
|
|
@@ -224,28 +225,29 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
|
|
|
//步骤1保存选择节点的立卷规则。
|
|
|
String[] ids = nodeIds.split(",");
|
|
|
|
|
|
- Long archiveAutoNodeId=null;
|
|
|
+ Long archiveAutoGroupId=null;
|
|
|
|
|
|
//分类并卷规则的需要生成个随机数,作为同一个分类赋值archiveAutoNodeId
|
|
|
if(archiveAutoType==2){
|
|
|
double ran=(Math.random()*100000000) + 1;
|
|
|
- archiveAutoNodeId=Long.parseLong(System.currentTimeMillis()+""+ran);
|
|
|
+ archiveAutoGroupId=Long.parseLong(System.currentTimeMillis()+""+ran);
|
|
|
}
|
|
|
for(String nodeId:ids){
|
|
|
long nodeIdLong = Long.parseLong(nodeId);
|
|
|
ArchiveTreeContract archiveTreeContract = baseMapper.selectById(nodeIdLong);
|
|
|
- archiveTreeContract.setArchiveAutoSelect(1);
|
|
|
archiveTreeContract.setArchiveAutoType(archiveAutoType);
|
|
|
- if(archiveAutoType==2){
|
|
|
- //分类并卷规则 提交都是一个分类类型
|
|
|
- archiveTreeContract.setArchiveAutoNodeId(archiveAutoNodeId);
|
|
|
- }else{
|
|
|
+ if(archiveAutoType==1){
|
|
|
//最高并卷规则 选择节点的ID
|
|
|
archiveTreeContract.setArchiveAutoNodeId(nodeIdLong);
|
|
|
}
|
|
|
+ if(archiveAutoType==2){
|
|
|
+ //分类并卷规则 提交都是一个分类类型
|
|
|
+ archiveTreeContract.setArchiveAutoGroupId(archiveAutoGroupId);
|
|
|
+ archiveTreeContract.setArchiveAutoGroupSelect(1);
|
|
|
+ }
|
|
|
baseMapper.updateById(archiveTreeContract);
|
|
|
|
|
|
- //TODO 步骤2保存选择节点下所有子节点的立卷规则。注意立卷规则优先级覆盖原则。(单独组卷>分类并卷>最高并卷)
|
|
|
+ //步骤2保存选择节点下所有子节点的立卷规则。注意立卷规则优先级覆盖原则。(单独组卷>分类并卷>最高并卷)
|
|
|
baseMapper.updateAllSonNodeIdsForArchiveAutoRule(archiveTreeContract);
|
|
|
}
|
|
|
|
|
@@ -264,145 +266,136 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public Map<Integer, List<ArchiveTreeContractAutoRuleVO>> getArchiveAutoRule(Long id) {
|
|
|
+ public Map<String,Object> getArchiveAutoRule(Long id) {
|
|
|
|
|
|
- Map<Integer, List<ArchiveTreeContractAutoRuleVO>> map= new HashMap<>();
|
|
|
- List<ArchiveTreeContractAutoRuleVO> voList_1 = new ArrayList<>();//最高规则显示节点及节点下有设置的节点(archive_auto_select=1)
|
|
|
- List<ArchiveTreeContractAutoRuleVO> voList_2 = new ArrayList<>();//分类并卷的tab显示当前节点的相同分类节点
|
|
|
- List<ArchiveTreeContractAutoRuleVO> voList_3 = new ArrayList<>();//单独组卷的显示节点及节点下有设置的节点(archive_auto_select=1)
|
|
|
+ Map<String,Object> map= new HashMap<>();
|
|
|
|
|
|
ArchiveTreeContract archiveTreeContract = baseMapper.selectById(id);
|
|
|
-
|
|
|
- Map<Long,String> nodeNameMap = new HashMap<>();//单个节点名称缓存
|
|
|
-
|
|
|
- //获取当前节点下所有设置的节点
|
|
|
- List<ArchiveTreeContract> list=baseMapper.getAllSonNodeIdsForArchiveAutoRuleSelected(archiveTreeContract);
|
|
|
- //找出最高规则和单独规则列表
|
|
|
- for(ArchiveTreeContract node:list){
|
|
|
- Integer archiveAutoType = node.getArchiveAutoType();
|
|
|
- if(archiveAutoType !=null && archiveAutoType!=2){
|
|
|
- ArchiveTreeContractAutoRuleVO vo = new ArchiveTreeContractAutoRuleVO();
|
|
|
- vo.setNodeId(node.getId());
|
|
|
+ Integer archiveAutoType = archiveTreeContract.getArchiveAutoType();
|
|
|
+ if(archiveAutoType!=null){
|
|
|
+ if(archiveAutoType==1){
|
|
|
+ //最高并卷层级 默认规则的节点 显示最高并卷层级节点
|
|
|
+ Long archiveAutoNodeId = archiveTreeContract.getArchiveAutoNodeId();
|
|
|
+ ArchiveTreeContract archiveAutoNode = baseMapper.selectById(archiveAutoNodeId);
|
|
|
StringBuffer allName= new StringBuffer();
|
|
|
- String ancestors = node.getAncestors();
|
|
|
+ String ancestors = archiveAutoNode.getAncestors();
|
|
|
String[] ancestorssplit = ancestors.split(",");//全路径ID
|
|
|
for(String pId:ancestorssplit){
|
|
|
long pIdLong = Long.parseLong(pId);
|
|
|
- if(nodeNameMap.containsKey(pIdLong)){
|
|
|
- allName.append(nodeNameMap.get(pIdLong)+"/");
|
|
|
- }else{
|
|
|
- ArchiveTreeContract pIdNode = baseMapper.selectById(pIdLong);
|
|
|
- nodeNameMap.put(pIdNode.getId(),pIdNode.getNodeName());
|
|
|
- allName.append(pIdNode.getNodeName()+"/");
|
|
|
- }
|
|
|
+ ArchiveTreeContract pIdNode = baseMapper.selectById(pIdLong);
|
|
|
+ allName.append(pIdNode.getNodeName()+"/");
|
|
|
}
|
|
|
- allName.append(node.getNodeName());
|
|
|
+ allName.append(archiveAutoNode.getNodeName());
|
|
|
+ ArchiveTreeContractAutoRuleVO vo= new ArchiveTreeContractAutoRuleVO();
|
|
|
vo.setAllName(allName.toString());
|
|
|
-
|
|
|
- if(archiveAutoType==3){
|
|
|
- vo.setSelectVo(1);
|
|
|
- voList_3.add(vo);
|
|
|
-
|
|
|
- ArchiveTreeContractAutoRuleVO vo1 = vo.clone();
|
|
|
- vo1.setSelectVo(0);
|
|
|
- voList_1.add(vo1);
|
|
|
- }
|
|
|
-
|
|
|
- if(archiveAutoType==1){
|
|
|
- vo.setSelectVo(0);
|
|
|
- voList_3.add(vo);
|
|
|
-
|
|
|
- ArchiveTreeContractAutoRuleVO vo1 = vo.clone();
|
|
|
- vo1.setSelectVo(1);
|
|
|
- voList_1.add(vo1);
|
|
|
+ vo.setNodeId(archiveAutoNode.getId());
|
|
|
+ vo.setArchiveAutoType(archiveAutoType);
|
|
|
+ map.put("type",archiveAutoType);
|
|
|
+ map.put("data",vo);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ if(archiveAutoType==2){
|
|
|
+ //分类并卷显示所在大类下树结构,过滤单独规则,其他分类并卷规则组节点 本节点分类组显示打钩
|
|
|
+ //找出当前节点大类
|
|
|
+ String ancestors = archiveTreeContract.getAncestors();
|
|
|
+ String[] ancestorssplit = ancestors.split(",");//全路径ID
|
|
|
+ String nodeAncestors = ancestorssplit[0]+","+ancestorssplit[1]; //大类的ancestors
|
|
|
+ //获取大类下所有节点,过滤单独规则,其他分类并卷规则组节点
|
|
|
+ List<ArchiveTreeContractAutoRuleVO> nodetree = ForestNodeMerger.merge(baseMapper.getAllSonNodeforGroupView(nodeAncestors, archiveTreeContract.getArchiveAutoNodeId()));
|
|
|
+ //获取与当前节点同一分类的节点
|
|
|
+ List<ArchiveTreeContract> listGroup= baseMapper.selectList(Wrappers.<ArchiveTreeContract>lambdaQuery()
|
|
|
+ .eq(ArchiveTreeContract::getArchiveAutoGroupId, archiveTreeContract.getArchiveAutoGroupId())
|
|
|
+ .orderByAsc(ArchiveTreeContract::getSort));
|
|
|
+ StringBuffer nodeSelect = new StringBuffer();
|
|
|
+
|
|
|
+ for(ArchiveTreeContract node:listGroup){
|
|
|
+ nodeSelect.append(node.getId()+",");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ map.put("type",archiveAutoType);
|
|
|
+ map.put("tree",nodetree);
|
|
|
+ map.put("data",nodeSelect.toString());
|
|
|
+ return map;
|
|
|
}
|
|
|
- }
|
|
|
- //找出分类并卷规则 与当前节点同一分类的节点
|
|
|
- if(archiveTreeContract.getArchiveAutoType()!=null && archiveTreeContract.getArchiveAutoType()==2){
|
|
|
-
|
|
|
- //设置同一分类的节点 archiveAutoSelect=1的,不是范围内的所有子节点
|
|
|
- List<ArchiveTreeContract> list2= baseMapper.selectList(Wrappers.<ArchiveTreeContract>lambdaQuery()
|
|
|
- .eq(ArchiveTreeContract::getArchiveAutoNodeId, archiveTreeContract.getArchiveAutoNodeId())
|
|
|
- .eq(ArchiveTreeContract::getArchiveAutoSelect, 1).orderByAsc(ArchiveTreeContract::getSort));
|
|
|
- for(ArchiveTreeContract node:list2){
|
|
|
- ArchiveTreeContractAutoRuleVO vo = new ArchiveTreeContractAutoRuleVO();
|
|
|
- vo.setNodeId(node.getId());
|
|
|
+ if(archiveAutoType==3){
|
|
|
+ //单独组卷规则 显示当前节点
|
|
|
StringBuffer allName= new StringBuffer();
|
|
|
- String ancestors = node.getAncestors();
|
|
|
+ String ancestors = archiveTreeContract.getAncestors();
|
|
|
String[] ancestorssplit = ancestors.split(",");//全路径ID
|
|
|
for(String pId:ancestorssplit){
|
|
|
long pIdLong = Long.parseLong(pId);
|
|
|
- if(nodeNameMap.containsKey(pIdLong)){
|
|
|
- allName.append(nodeNameMap.get(pIdLong)+"/");
|
|
|
- }else{
|
|
|
- ArchiveTreeContract pIdNode = baseMapper.selectById(pIdLong);
|
|
|
- nodeNameMap.put(pIdNode.getId(),pIdNode.getNodeName());
|
|
|
- allName.append(pIdNode.getNodeName()+"/");
|
|
|
- }
|
|
|
+ ArchiveTreeContract pIdNode = baseMapper.selectById(pIdLong);
|
|
|
+ allName.append(pIdNode.getNodeName()+"/");
|
|
|
}
|
|
|
- allName.append(node.getNodeName());
|
|
|
+ allName.append(archiveTreeContract.getNodeName());
|
|
|
+ ArchiveTreeContractAutoRuleVO vo= new ArchiveTreeContractAutoRuleVO();
|
|
|
vo.setAllName(allName.toString());
|
|
|
- vo.setSelectVo(1);
|
|
|
- voList_2.add(vo);
|
|
|
+ vo.setNodeId(archiveTreeContract.getId());
|
|
|
+ vo.setArchiveAutoType(archiveAutoType);
|
|
|
+ map.put("type",archiveAutoType);
|
|
|
+ map.put("data",vo);
|
|
|
+ return map;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- map.put(1,voList_1);
|
|
|
- map.put(2,voList_2);
|
|
|
- map.put(3,voList_3);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
- public boolean updateArchiveAutoRule(Integer archiveAutoType, String nodeIds) {
|
|
|
- //项目级不需要考虑是否为wbs节点,已经同步出来了都属于归档树节点,直接按归档树节点处理
|
|
|
+ public void removeArchiveAutoRule(Long nodeId){
|
|
|
+ ArchiveTreeContract node = baseMapper.selectById(nodeId);
|
|
|
+ Integer archiveAutoType = node.getArchiveAutoType();
|
|
|
+ if(archiveAutoType!=null){
|
|
|
+ //删除默认规则
|
|
|
+ if(archiveAutoType==1){
|
|
|
+ baseMapper.removeAllSonNodeIdsForArchiveAutoRule_1(node);
|
|
|
+ }
|
|
|
+ //删除节点及所有子节点 分类并卷规则
|
|
|
+ if(archiveAutoType==2){
|
|
|
+ //删除规则
|
|
|
+ baseMapper.removeAllSonNodeIdsForArchiveAutoRule_2(node);
|
|
|
+ //TODO 验证节点的父节点是否为分类并卷规则,如是则取消。若无其他兄弟节点,继续往上验证。
|
|
|
+ }
|
|
|
+ //删除节点及所有子节点 单独并卷规则
|
|
|
+ if(archiveAutoType==3){
|
|
|
+ baseMapper.removeAllSonNodeIdsForArchiveAutoRule_3(node);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- String[] ids = nodeIds.split(",");
|
|
|
- Set<String> idsSet=new HashSet<>(Arrays.asList(ids));
|
|
|
-
|
|
|
- //判断修改的原来是否是分类并卷规则类型
|
|
|
- List<ArchiveTreeContract> archiveTreeContracts_db=null;
|
|
|
- long nodeId_0_Long = Long.parseLong(ids[0]);
|
|
|
- ArchiveTreeContract archiveTreeContract0 = baseMapper.selectById(nodeId_0_Long);
|
|
|
- Integer archiveAutoType_db = archiveTreeContract0.getArchiveAutoType();
|
|
|
- if(archiveAutoType_db==2){
|
|
|
- //获取分类ID
|
|
|
- Long archiveAutoNodeId_db = archiveTreeContract0.getArchiveAutoNodeId();
|
|
|
- //获取该分类下的设置选择节点 archiveAutoSelect=1的,不是范围内的所有子节点
|
|
|
- archiveTreeContracts_db = baseMapper.selectList(Wrappers.<ArchiveTreeContract>lambdaQuery()
|
|
|
- .eq(ArchiveTreeContract::getArchiveAutoNodeId, archiveAutoNodeId_db)
|
|
|
- .eq(ArchiveTreeContract::getArchiveAutoSelect, 1)
|
|
|
- );
|
|
|
- }else{
|
|
|
- //原来是最高,单独规则类型的
|
|
|
+ @Override
|
|
|
+ public boolean updateArchiveAutoRule(ArchiveTreeContractAutoRuleMapDTO dto) {
|
|
|
+ //项目级不需要考虑是否为wbs节点,已经同步出来了都属于归档树节点,直接按归档树节点处理
|
|
|
|
|
|
+ Integer archiveAutoType = dto.getArchiveAutoType();
|
|
|
+ if(archiveAutoType!=null){
|
|
|
if(archiveAutoType==2){
|
|
|
- //修改成分类并卷
|
|
|
- }
|
|
|
- if(archiveAutoType==1){
|
|
|
- //修改成最高
|
|
|
- }
|
|
|
- if(archiveAutoType==3){
|
|
|
- //修改成单独
|
|
|
- for(String nodeId:ids){
|
|
|
- //步骤1更新选择节点的立卷规则。
|
|
|
+ Long groupId = dto.getArchiveAutoGroupId();
|
|
|
+ String selectNodeIds = dto.getSelectNodeIds();
|
|
|
+ List<String> selectNodeIdlist = Arrays.asList(selectNodeIds);
|
|
|
+ //先将同一分类的节点删除配置,。
|
|
|
+ baseMapper.removeNodeForArchiveAutoRule_Group(groupId);
|
|
|
+ //然后再按照选择节点保存新的设置
|
|
|
+ for(String nodeId:selectNodeIdlist){
|
|
|
long nodeIdLong = Long.parseLong(nodeId);
|
|
|
ArchiveTreeContract archiveTreeContract = baseMapper.selectById(nodeIdLong);
|
|
|
- archiveTreeContract.setArchiveAutoSelect(1);
|
|
|
archiveTreeContract.setArchiveAutoType(archiveAutoType);
|
|
|
- archiveTreeContract.setArchiveAutoNodeId(nodeIdLong);//最高/单独规则 选择节点的ID
|
|
|
+ //分类并卷规则 提交都是一个分类类型
|
|
|
+ archiveTreeContract.setArchiveAutoGroupId(groupId);
|
|
|
+ archiveTreeContract.setArchiveAutoGroupSelect(1);
|
|
|
baseMapper.updateById(archiveTreeContract);
|
|
|
- //步骤2保存选择节点下所有子节点的立卷规则。注意立卷规则优先级覆盖原则。(单独组卷>分类并卷>最高并卷)
|
|
|
+ //保存选择节点下所有子节点的立卷规则。注意立卷规则优先级覆盖原则。(单独组卷>分类并卷>最高并卷)
|
|
|
baseMapper.updateAllSonNodeIdsForArchiveAutoRule(archiveTreeContract);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ if(archiveAutoType==1){
|
|
|
|
|
|
+ }
|
|
|
+ if(archiveAutoType==3){
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
return false;
|
|
|
}
|