|
|
@@ -1,5 +1,6 @@
|
|
|
package com.siwei.apply.service.impl;
|
|
|
|
|
|
+import com.siwei.apply.common.UnifyAttachmentEnum;
|
|
|
import com.siwei.apply.domain.NodeAttachment;
|
|
|
import com.siwei.apply.domain.Project;
|
|
|
import com.siwei.apply.domain.ProjectWorkflow;
|
|
|
@@ -12,10 +13,10 @@ import com.siwei.apply.service.NodeAttachmentService;
|
|
|
import com.siwei.apply.service.TdgyService;
|
|
|
import com.siwei.apply.utils.FileExtractUtil;
|
|
|
import com.siwei.apply.utils.ServiceUtil;
|
|
|
-import com.siwei.common.core.domain.R;
|
|
|
import com.siwei.common.core.exception.ServiceException;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -25,7 +26,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.nio.file.*;
|
|
|
import java.util.*;
|
|
|
|
|
|
-import static com.siwei.apply.utils.ServiceUtil.assemblyAttachment;
|
|
|
|
|
|
/**
|
|
|
* 记录流程对应的附件材料 服务实现类
|
|
|
@@ -268,8 +268,6 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 保存附件信息
|
|
|
*/
|
|
|
@@ -284,6 +282,7 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 修改节点附件信息
|
|
|
*/
|
|
|
@@ -297,6 +296,20 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
+ public NodeAttachment getAttachmentByProjectIdAndTable(String projectId,String nodeTableName) {
|
|
|
+ NodeAttachment nodeAttachment = null;
|
|
|
+ List<ProjectWorkflow> projectWorkflows = projectWorkflowMapper.selectByProjectIdAndNodeTableName(projectId, nodeTableName);
|
|
|
+ Optional<ProjectWorkflow> res = projectWorkflows.stream().findFirst();
|
|
|
+ if(res.isPresent()){
|
|
|
+ String nodeId = res.get().getNodeId();
|
|
|
+ logger.info("-------getAttachmentByProjectIdAndTable-----"+nodeId);
|
|
|
+ nodeAttachment = this.getByNodeId(nodeId);
|
|
|
+ }
|
|
|
+ return nodeAttachment;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 根据节点ID获取当前节点的附件信息
|
|
|
@@ -312,7 +325,6 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
* 3.查询出当前节点信息,解析object对象
|
|
|
* 4.如果存在引用关系,查询出所有被引用节点的附件信息
|
|
|
* 5.重新组装object信息并且生成json对象展示。
|
|
|
- *
|
|
|
* 找到当前枚举类,
|
|
|
* 查看其依赖关系
|
|
|
* 根据依赖关系把其它数据进行整理。
|
|
|
@@ -333,12 +345,12 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
throw new ServiceException("未查询到节点对应的流程信息,nodeId: " + nodeId);
|
|
|
}
|
|
|
String nodeTableName = projectWorkflow.getNodeTableName();
|
|
|
- Project project =projectMapper.get(projectWorkflow.getProjectId());
|
|
|
+ String projectId = projectWorkflow.getProjectId();
|
|
|
+ Project project =projectMapper.get(projectId);
|
|
|
Integer projectType = project.getProjectType();
|
|
|
|
|
|
//最终结果集合
|
|
|
- Map <String, List<String>> currentNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
- Map <String, List<String>> relationNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
+ Map <String, Object> currentNodeAttachmentMap = null;
|
|
|
|
|
|
//单独选址
|
|
|
if(ProjectType.ALONE.getCode().equals(String.valueOf(projectType))){
|
|
|
@@ -349,50 +361,51 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
//取当前节点数据内容;
|
|
|
TdgyRes tdgy = tdgyService.getById(nodeId);
|
|
|
String gdType = tdgy.getGdType();
|
|
|
+
|
|
|
+
|
|
|
if("出让".equals(gdType)) {
|
|
|
//处理-规划条件出具依赖
|
|
|
- currentNodeAttachmentMap = ServiceUtil.assemblyAttachment(TdgyAttachmentNameEnum.NAME_2,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
+ currentNodeAttachmentMap = this.assemblyAttachment(projectId,TdgyAttachmentNameEnum.NAME_2,nodeAttachment);
|
|
|
//处理-出让图形依赖
|
|
|
- relationNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
- currentNodeAttachmentMap = ServiceUtil.assemblyAttachment(TdgyAttachmentNameEnum.NAME_3,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
+ currentNodeAttachmentMap = this.assemblyAttachment(projectId,TdgyAttachmentNameEnum.NAME_3,nodeAttachment);
|
|
|
|
|
|
}else if("划拨".equals(gdType)) {
|
|
|
|
|
|
}
|
|
|
- } else if(AloneWorkFlowEnum.NODE_3.getTableName().equalsIgnoreCase(nodeTableName)){
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ else if(AloneWorkFlowEnum.NODE_3.getTableName().equalsIgnoreCase(nodeTableName)){
|
|
|
//处理-规划条件出具依赖
|
|
|
relationNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
- currentNodeAttachmentMap = ServiceUtil.assemblyAttachment(GyjsydscdjAttachmentNameEnum.NAME_2,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
+ currentNodeAttachmentMap = this.assemblyAttachment(GyjsydscdjAttachmentNameEnum.NAME_2,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
|
|
|
relationNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
- currentNodeAttachmentMap = ServiceUtil.assemblyAttachment(GyjsydscdjAttachmentNameEnum.NAME_3,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
+ currentNodeAttachmentMap = this.assemblyAttachment(GyjsydscdjAttachmentNameEnum.NAME_3,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
|
|
|
relationNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
- currentNodeAttachmentMap = ServiceUtil.assemblyAttachment(GyjsydscdjAttachmentNameEnum.NAME_4,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
+ currentNodeAttachmentMap = this.assemblyAttachment(GyjsydscdjAttachmentNameEnum.NAME_4,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
|
|
|
} else if(AloneWorkFlowEnum.NODE_4.getTableName().equalsIgnoreCase(nodeTableName)){
|
|
|
//处理-规划条件出具依赖
|
|
|
relationNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
- currentNodeAttachmentMap = ServiceUtil.assemblyAttachment(JsydghxkAttachmentNameEnum.NAME_3,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
+ currentNodeAttachmentMap = this.assemblyAttachment(JsydghxkAttachmentNameEnum.NAME_3,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
|
|
|
} else if(AloneWorkFlowEnum.NODE_5.getTableName().equalsIgnoreCase(nodeTableName)){
|
|
|
//处理-规划条件出具依赖
|
|
|
relationNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
- currentNodeAttachmentMap = ServiceUtil.assemblyAttachment(JsgcghxkAttachmentNameEnum.NAME_2,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
+ currentNodeAttachmentMap = this.assemblyAttachment(JsgcghxkAttachmentNameEnum.NAME_2,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
|
|
|
} else if(AloneWorkFlowEnum.NODE_6.getTableName().equalsIgnoreCase(nodeTableName)){
|
|
|
//处理-规划条件出具依赖
|
|
|
relationNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
- currentNodeAttachmentMap = ServiceUtil.assemblyAttachment(TdhyhsAttachmentNameEnum.NAME_2,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
+ currentNodeAttachmentMap = this.assemblyAttachment(TdhyhsAttachmentNameEnum.NAME_2,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
}else if(AloneWorkFlowEnum.NODE_7.getTableName().equalsIgnoreCase(nodeTableName)){
|
|
|
//处理-规划条件出具依赖
|
|
|
relationNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
- currentNodeAttachmentMap = ServiceUtil.assemblyAttachment(GyjsydjfwscdjAttachmentNameEnum.NAME_1,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ currentNodeAttachmentMap = this.assemblyAttachment(GyjsydjfwscdjAttachmentNameEnum.NAME_1,currentNodeAttachmentMap,relationNodeAttachmentMap);
|
|
|
+ }*/
|
|
|
|
|
|
+ }
|
|
|
return null;
|
|
|
} catch (Exception e) {
|
|
|
logger.error("查询节点附件信息异常,nodeId: {}", nodeId, e);
|
|
|
@@ -400,6 +413,55 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * 这里处理依赖关系
|
|
|
+ * 先判断当前是否存在该资料
|
|
|
+ * 1.如果当前节点附件信息不包含该资料,则进行合并
|
|
|
+ * 获取依赖的map,写一个方法:
|
|
|
+ *
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public Map <String, Object> assemblyAttachment(String projectId,UnifyAttachmentEnum attachmentEnum,NodeAttachment nodeAttachment){
|
|
|
+ //最终结果集合
|
|
|
+ Map <String, Object> currentNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
+ Map <String, Object> relationNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
+ if(Objects.nonNull(nodeAttachment) && Objects.nonNull(nodeAttachment.getAttachment())) {
|
|
|
+ currentNodeAttachmentMap = nodeAttachment.getAttachment();
|
|
|
+ }
|
|
|
+ String name = attachmentEnum.getName();
|
|
|
+ List<String> currentAttachmentList = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(!currentNodeAttachmentMap.containsKey(name) || Objects.isNull(currentNodeAttachmentMap.get(name))) {
|
|
|
+ List<String> relationNameList = new ArrayList();
|
|
|
+ String relationNameStr = attachmentEnum.getRelationName();
|
|
|
+ if (StringUtils.isNotBlank(relationNameStr)) {
|
|
|
+ relationNameList = Arrays.asList(relationNameStr.split("\\|"));
|
|
|
+ if (CollectionUtils.isNotEmpty(relationNameList)) {
|
|
|
+ for (String innerRelationNameStr : relationNameList) {
|
|
|
+ List<String> innerRelationNameList = Arrays.asList(innerRelationNameStr.split("\\:"));
|
|
|
+ String relationName = innerRelationNameList.get(0);
|
|
|
+ String tableName = innerRelationNameList.get(1);
|
|
|
+ NodeAttachment relationNodeAttachment = this.getAttachmentByProjectIdAndTable(projectId, tableName);
|
|
|
+ if (Objects.nonNull(relationNodeAttachment) && Objects.nonNull(relationNodeAttachment.getAttachment())) {
|
|
|
+ relationNodeAttachmentMap.putAll(relationNodeAttachment.getAttachment());
|
|
|
+ }
|
|
|
+ //获取两个合并的map
|
|
|
+ if (relationNodeAttachmentMap.containsKey(relationName) && Objects.nonNull(relationNodeAttachmentMap.get(relationName))) {
|
|
|
+ currentAttachmentList.addAll((Collection<? extends String>) relationNodeAttachmentMap.get(relationName));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }//end for
|
|
|
+ }
|
|
|
+ //第一个依赖关系解决
|
|
|
+ currentNodeAttachmentMap.put(name,currentAttachmentList);
|
|
|
+ }
|
|
|
+ return currentNodeAttachmentMap;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|