|
@@ -16,6 +16,7 @@ import org.springblade.core.tool.utils.*;
|
|
import org.springblade.manager.entity.*;
|
|
import org.springblade.manager.entity.*;
|
|
import org.springblade.manager.enums.WbsSyncTypeEnum;
|
|
import org.springblade.manager.enums.WbsSyncTypeEnum;
|
|
import org.springblade.manager.mapper.*;
|
|
import org.springblade.manager.mapper.*;
|
|
|
|
+import org.springblade.manager.service.WbsTreeContractExtendService;
|
|
import org.springblade.system.cache.ParamCache;
|
|
import org.springblade.system.cache.ParamCache;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
@@ -23,15 +24,14 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
-import java.io.FileInputStream;
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.StandardCopyOption;
|
|
import java.nio.file.StandardCopyOption;
|
|
import java.rmi.ServerException;
|
|
import java.rmi.ServerException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
-import java.util.function.Function;
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -76,6 +76,10 @@ public class WbsSynchronousServiceImpl {
|
|
@Autowired
|
|
@Autowired
|
|
private WbsTreeSynchronousRecordMapper synchronousRecordMapper;
|
|
private WbsTreeSynchronousRecordMapper synchronousRecordMapper;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private WbsTreeContractExtendService wbsTreeContractExtendService;
|
|
|
|
+
|
|
|
|
+
|
|
@Async("taskExecutor1")
|
|
@Async("taskExecutor1")
|
|
public void syncExecute(WbsTreeSynchronousRecord wbsTreeSynchronousRecord) {
|
|
public void syncExecute(WbsTreeSynchronousRecord wbsTreeSynchronousRecord) {
|
|
// 类型枚举 WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED
|
|
// 类型枚举 WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED
|
|
@@ -438,7 +442,7 @@ public class WbsSynchronousServiceImpl {
|
|
editPrivateNode.setInitTableName(templateNode.getInitTableName());
|
|
editPrivateNode.setInitTableName(templateNode.getInitTableName());
|
|
|
|
|
|
if (StringUtil.isBlank(templateNode.getHtmlUrl())) {
|
|
if (StringUtil.isBlank(templateNode.getHtmlUrl())) {
|
|
- throw new ServiceException(templateNode.getNodeName() + "( " + templateNode.getPKeyId() + ")HTML文件不存在");
|
|
|
|
|
|
+ throw new ServiceException(templateNode.getNodeName() + "( " + templateNode.getPKeyId() + ")HTML文件不存在");
|
|
}
|
|
}
|
|
//封装Html路径 根据模板html copy一份到自己项目节点上
|
|
//封装Html路径 根据模板html copy一份到自己项目节点上
|
|
String[] split = templateNode.getHtmlUrl().split("/");
|
|
String[] split = templateNode.getHtmlUrl().split("/");
|
|
@@ -508,6 +512,7 @@ public class WbsSynchronousServiceImpl {
|
|
//添加表单
|
|
//添加表单
|
|
case 1:
|
|
case 1:
|
|
insertPrivateForm(wbsTreeSynchronousRecord, wbsTreePrivates, addPrivateNodes);
|
|
insertPrivateForm(wbsTreeSynchronousRecord, wbsTreePrivates, addPrivateNodes);
|
|
|
|
+ updateEViSa(collect, wbsTreeSynchronousRecord.getTemplateId(), projectInfo.getId(), templateNodes, addPrivateNodes);
|
|
break;
|
|
break;
|
|
//清表
|
|
//清表
|
|
case 2:
|
|
case 2:
|
|
@@ -518,6 +523,8 @@ public class WbsSynchronousServiceImpl {
|
|
editData.addAll(addPrivateNodes);
|
|
editData.addAll(addPrivateNodes);
|
|
editData.addAll(editPrivateNodes);
|
|
editData.addAll(editPrivateNodes);
|
|
wbsSynchronousEViSaService.saveFormula(wbsTreeSynchronousRecord, editData);
|
|
wbsSynchronousEViSaService.saveFormula(wbsTreeSynchronousRecord, editData);
|
|
|
|
+ //现在电签使用的是模糊匹配 如果电签匹配方式改为精确匹配 则需要使用该功能
|
|
|
|
+ updateEViSa(collect, wbsTreeSynchronousRecord.getTemplateId(), projectInfo.getId(), templateNodes, editPrivateNodes);
|
|
//排序
|
|
//排序
|
|
case 7:
|
|
case 7:
|
|
//元素配置
|
|
//元素配置
|
|
@@ -527,8 +534,6 @@ public class WbsSynchronousServiceImpl {
|
|
case 4:
|
|
case 4:
|
|
//默认值 如果有数据 与节点绑定
|
|
//默认值 如果有数据 与节点绑定
|
|
case 6:
|
|
case 6:
|
|
- //现在电签使用的是模糊匹配 如果电签匹配方式改为精确匹配 则需要使用该功能
|
|
|
|
-// updateEViSa(collect, wbsTreeSynchronousRecord.getTemplateId(), projectInfo.getId(), templateNodes, editPrivateNodes);
|
|
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
@@ -597,6 +602,7 @@ public class WbsSynchronousServiceImpl {
|
|
//获取当前项目所有合同---------------------------------------------------------------------------------------------------
|
|
//获取当前项目所有合同---------------------------------------------------------------------------------------------------
|
|
List<ContractInfo> contractInfos = contractInfoMapper.selectContractIdByProjectId(String.valueOf(wbsTreeSynchronousRecord.getProjectId()));
|
|
List<ContractInfo> contractInfos = contractInfoMapper.selectContractIdByProjectId(String.valueOf(wbsTreeSynchronousRecord.getProjectId()));
|
|
|
|
|
|
|
|
+ List<WbsTreeContract> addData = new ArrayList<>();
|
|
List<WbsTreeContract> editData = new ArrayList<>();
|
|
List<WbsTreeContract> editData = new ArrayList<>();
|
|
List<WbsTreeContract> oldHtml = new ArrayList<>();
|
|
List<WbsTreeContract> oldHtml = new ArrayList<>();
|
|
StringBuilder errorMsg = new StringBuilder("");
|
|
StringBuilder errorMsg = new StringBuilder("");
|
|
@@ -618,7 +624,7 @@ public class WbsSynchronousServiceImpl {
|
|
.eq(WbsTreePrivate::getType, 2)
|
|
.eq(WbsTreePrivate::getType, 2)
|
|
.eq(WbsTreePrivate::getIsDeleted, 0)
|
|
.eq(WbsTreePrivate::getIsDeleted, 0)
|
|
.apply("FIND_IN_SET({0},ancestors_p_id)", wbsTreePrivate.getPKeyId());
|
|
.apply("FIND_IN_SET({0},ancestors_p_id)", wbsTreePrivate.getPKeyId());
|
|
- if(CollectionUtil.isNotEmpty(formList)){
|
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(formList)) {
|
|
wrapperPrivate.in(WbsTreePrivate::getPKeyId, formList);
|
|
wrapperPrivate.in(WbsTreePrivate::getPKeyId, formList);
|
|
}
|
|
}
|
|
//当前项目的子节点数据
|
|
//当前项目的子节点数据
|
|
@@ -641,6 +647,20 @@ public class WbsSynchronousServiceImpl {
|
|
// throw new ServiceException("当前节点不存在");
|
|
// throw new ServiceException("当前节点不存在");
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //查询合同段下所有的填报审批信息
|
|
|
|
+ HashMap<Long, Integer> informationQueryMap = new HashMap<>();
|
|
|
|
+ //查询质检合同节点填表信息
|
|
|
|
+ String sql = "SELECT c.wbs_id, c.STATUS FROM u_information_query c" +
|
|
|
|
+ " JOIN ( SELECT wbs_id, MAX( update_time ) AS max_update_time FROM u_information_query WHERE contract_id = " + contractInfo.getId() + " GROUP BY wbs_id ) subquery ON c.wbs_id = subquery.wbs_id " +
|
|
|
|
+ " AND c.update_time = subquery.max_update_time WHERE c.contract_id = " + contractInfo.getId() + " and c.is_deleted = 0";
|
|
|
|
+
|
|
|
|
+ List<InformationQuery> informationQueries = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(InformationQuery.class));
|
|
|
|
+ //质检节点填报信息
|
|
|
|
+ for (InformationQuery informationQuery : informationQueries) {
|
|
|
|
+ informationQueryMap.put(informationQuery.getWbsId(), informationQuery.getStatus());
|
|
|
|
+ }
|
|
|
|
+
|
|
for (WbsTreeContract wbsTreeContract : startContacts) {
|
|
for (WbsTreeContract wbsTreeContract : startContacts) {
|
|
//获取合同 当前节点的所有子节点数据
|
|
//获取合同 当前节点的所有子节点数据
|
|
LambdaQueryWrapper<WbsTreeContract> wrapperContract = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<WbsTreeContract> wrapperContract = Wrappers.lambdaQuery();
|
|
@@ -648,7 +668,7 @@ public class WbsSynchronousServiceImpl {
|
|
.eq(WbsTreeContract::getContractId, contractInfo.getId())
|
|
.eq(WbsTreeContract::getContractId, contractInfo.getId())
|
|
.eq(WbsTreeContract::getIsDeleted, 0)
|
|
.eq(WbsTreeContract::getIsDeleted, 0)
|
|
.apply("FIND_IN_SET({0},ancestors_p_id)", wbsTreeContract.getPKeyId());
|
|
.apply("FIND_IN_SET({0},ancestors_p_id)", wbsTreeContract.getPKeyId());
|
|
- if(CollectionUtil.isNotEmpty(formList)){
|
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(formList)) {
|
|
wrapperContract.in(WbsTreeContract::getIsTypePrivatePid, formList);
|
|
wrapperContract.in(WbsTreeContract::getIsTypePrivatePid, formList);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -657,27 +677,6 @@ public class WbsSynchronousServiceImpl {
|
|
wbsTreeContracts.add(wbsTreeContract);
|
|
wbsTreeContracts.add(wbsTreeContract);
|
|
|
|
|
|
|
|
|
|
- //获取所有表单的父节点
|
|
|
|
- List<Long> pIds = wbsTreeContracts.stream().filter(f -> f.getType() == 2).map(WbsTreeContract::getPId).collect(Collectors.toList());
|
|
|
|
- HashMap<Long, Integer> informationQueryMap = new HashMap<>();
|
|
|
|
- if(CollectionUtil.isNotEmpty(pIds)){
|
|
|
|
- //查询质检合同节点填表信息
|
|
|
|
- String sql = "SELECT c.wbs_id, c.STATUS FROM u_information_query c" +
|
|
|
|
- " JOIN ( SELECT wbs_id, MAX( update_time ) AS max_update_time FROM u_information_query WHERE contract_id = " + contractInfo.getId() + " GROUP BY wbs_id ) subquery ON c.wbs_id = subquery.wbs_id " +
|
|
|
|
- " AND c.update_time = subquery.max_update_time WHERE c.contract_id = " + contractInfo.getId() + " and c.is_deleted = 0 and c.wbs_id in(" + StringUtil.join(pIds,",") +")";
|
|
|
|
-
|
|
|
|
- List<InformationQuery> informationQueries = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(InformationQuery.class));
|
|
|
|
- //质检节点填报信息
|
|
|
|
-
|
|
|
|
- for (InformationQuery informationQuery : informationQueries) {
|
|
|
|
- informationQueryMap.put(informationQuery.getWbsId(), informationQuery.getStatus());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
//合同段节点对应的项目id
|
|
//合同段节点对应的项目id
|
|
List<Long> typePrivateIds = wbsTreeContracts.stream().map(WbsTreeContract::getIsTypePrivatePid).collect(Collectors.toList());
|
|
List<Long> typePrivateIds = wbsTreeContracts.stream().map(WbsTreeContract::getIsTypePrivatePid).collect(Collectors.toList());
|
|
|
|
|
|
@@ -705,7 +704,7 @@ public class WbsSynchronousServiceImpl {
|
|
//质检
|
|
//质检
|
|
case 1:
|
|
case 1:
|
|
//判断是否已保存
|
|
//判断是否已保存
|
|
- if(StringUtils.isEmpty(editContractNode.getInitTableName())){
|
|
|
|
|
|
+ if (StringUtils.isEmpty(editContractNode.getInitTableName())) {
|
|
throw new ServiceException(editContractNode.getNodeName() + "( " + editContractNode.getPKeyId() + ")--实体表不存在");
|
|
throw new ServiceException(editContractNode.getNodeName() + "( " + editContractNode.getPKeyId() + ")--实体表不存在");
|
|
}
|
|
}
|
|
String isSave = "select count(0) from " + editContractNode.getInitTableName() + " where p_key_id = " + editContractNode.getPKeyId();
|
|
String isSave = "select count(0) from " + editContractNode.getInitTableName() + " where p_key_id = " + editContractNode.getPKeyId();
|
|
@@ -718,26 +717,27 @@ public class WbsSynchronousServiceImpl {
|
|
//未填报 101
|
|
//未填报 101
|
|
isSync = true;
|
|
isSync = true;
|
|
} else {
|
|
} else {
|
|
- if (i == 0) {
|
|
|
|
- isSync = false;
|
|
|
|
|
|
+ //没有选择未填报,但是表单查不到数据,表示这个节点有问题
|
|
|
|
+ if (i == 0 && !contractRanges.contains(WbsSyncTypeEnum.NOT_FILLED_IN.code)) {
|
|
errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未填报;");
|
|
errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未填报;");
|
|
- }
|
|
|
|
- if (contractRanges.contains(WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED.code) && (submit == null || submit == 0)) {
|
|
|
|
- //已填报-未上报 102
|
|
|
|
- isSync = true;
|
|
|
|
} else {
|
|
} else {
|
|
- if (submit == null) {
|
|
|
|
- isSync = false;
|
|
|
|
- errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未上报;");
|
|
|
|
- }else{
|
|
|
|
- if (submit == 1 && contractRanges.contains(WbsSyncTypeEnum.PENDING_APPROVAL.code)) {
|
|
|
|
- //待审批 104
|
|
|
|
- isSync = true;
|
|
|
|
- isOldHtml = true;
|
|
|
|
- } else if (submit == 2 && contractRanges.contains(WbsSyncTypeEnum.APPROVED.code)) {
|
|
|
|
- //已审批 105
|
|
|
|
- isSync = true;
|
|
|
|
- isOldHtml = true;
|
|
|
|
|
|
+ if (contractRanges.contains(WbsSyncTypeEnum.ALREADY_FILLED_IN_NOT_REPORTED.code) && (submit == null || submit == 0)) {
|
|
|
|
+ //已填报-未上报 102
|
|
|
|
+ isSync = true;
|
|
|
|
+ } else {
|
|
|
|
+ if (submit == null) {
|
|
|
|
+ isSync = false;
|
|
|
|
+ errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未上报;");
|
|
|
|
+ } else {
|
|
|
|
+ if (submit == 1 && contractRanges.contains(WbsSyncTypeEnum.PENDING_APPROVAL.code)) {
|
|
|
|
+ //待审批 104
|
|
|
|
+ isSync = true;
|
|
|
|
+ isOldHtml = true;
|
|
|
|
+ } else if (submit == 2 && contractRanges.contains(WbsSyncTypeEnum.APPROVED.code)) {
|
|
|
|
+ //已审批 105
|
|
|
|
+ isSync = true;
|
|
|
|
+ isOldHtml = true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -765,22 +765,21 @@ public class WbsSynchronousServiceImpl {
|
|
|
|
|
|
//清表 公式 元素
|
|
//清表 公式 元素
|
|
if (collect.contains(2) || collect.contains(3) || collect.contains(5)) {
|
|
if (collect.contains(2) || collect.contains(3) || collect.contains(5)) {
|
|
- if(collect.contains(2) && (templateNode.getHtmlUrl() == null || templateNode.getInitTableName() == null || templateNode.getExcelId() == null)){
|
|
|
|
|
|
+ if (collect.contains(2) && (templateNode.getHtmlUrl() == null || templateNode.getInitTableName() == null || templateNode.getExcelId() == null)) {
|
|
errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未配置清表;");
|
|
errorMsg.append(editContractNode.getNodeName() + "(" + editContractNode.getPKeyId() + ")").append("未配置清表;");
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- editContractNode.setExcelId(templateNode.getExcelId());
|
|
|
|
- editContractNode.setInitTableName(templateNode.getInitTableName());
|
|
|
|
- editContractNode.setHtmlUrl(templateNode.getHtmlUrl());
|
|
|
|
- if (templateNode.getExcelId() != null) {
|
|
|
|
- editContractNode.setIsLinkTable(2);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ editContractNode.setExcelId(templateNode.getExcelId());
|
|
|
|
+ editContractNode.setInitTableName(templateNode.getInitTableName());
|
|
|
|
+ editContractNode.setHtmlUrl(templateNode.getHtmlUrl());
|
|
|
|
+ if (templateNode.getExcelId() != null) {
|
|
|
|
+ editContractNode.setIsLinkTable(2);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//排序
|
|
//排序
|
|
if (collect.contains(7)) {
|
|
if (collect.contains(7)) {
|
|
editContractNode.setSort(templateNode.getSort());
|
|
editContractNode.setSort(templateNode.getSort());
|
|
}
|
|
}
|
|
-
|
|
|
|
//手动选中的表单 进行筛选
|
|
//手动选中的表单 进行筛选
|
|
if (collect.contains(2) || collect.contains(3) || collect.contains(4) || collect.contains(5) || collect.contains(6) || collect.contains(7)) {
|
|
if (collect.contains(2) || collect.contains(3) || collect.contains(4) || collect.contains(5) || collect.contains(6) || collect.contains(7)) {
|
|
if (isSync) {
|
|
if (isSync) {
|
|
@@ -812,11 +811,8 @@ public class WbsSynchronousServiceImpl {
|
|
switch (i) {
|
|
switch (i) {
|
|
//添加表单
|
|
//添加表单
|
|
case 1:
|
|
case 1:
|
|
- insertContractForm(wbsTreeSynchronousRecord, contractInfo, wbsTreeContracts, addContractNode);
|
|
|
|
- //如果同时选择新增表单和其他的同步类型 在操作其他类型的时候需要添加新的表单
|
|
|
|
-// if (CollectionUtil.isNotEmpty(addContractNode)) {
|
|
|
|
-// editContractNodes.addAll(addContractNode.stream().filter(f -> f.getType() == 2).collect(Collectors.toList()));
|
|
|
|
-// }
|
|
|
|
|
|
+ List<WbsTreeContract> list = insertContractForm(wbsTreeSynchronousRecord, contractInfo, wbsTreeContracts, addContractNode, errorMsg);
|
|
|
|
+ addData.addAll(list);
|
|
break;
|
|
break;
|
|
//清表配置
|
|
//清表配置
|
|
case 2:
|
|
case 2:
|
|
@@ -837,30 +833,113 @@ public class WbsSynchronousServiceImpl {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- //合同段同步同时记录数量
|
|
|
|
|
|
+ Set<Long> pIdsNew = new HashSet<>();
|
|
|
|
+ //新增数据
|
|
|
|
+ Map<Long, List<WbsTreeContract>> collect2 = addData.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
|
|
|
|
+ List<WbsTreeContractExtend> wbsTreeContractExtends = new ArrayList<>();
|
|
|
|
+ //同步的表单及祖级节点
|
|
|
|
+ if (CollectionUtil.isNotEmpty(addData)) {
|
|
|
|
+ addData.forEach(f -> {
|
|
|
|
+ WbsTreeContractExtend wbsTreeContractExtend = new WbsTreeContractExtend();
|
|
|
|
+ wbsTreeContractExtend.setPKeyId(f.getPKeyId());
|
|
|
|
+ wbsTreeContractExtend.setContractId(Long.valueOf(f.getContractId()));
|
|
|
|
+ wbsTreeContractExtend.setIsSync(1);
|
|
|
|
+ wbsTreeContractExtend.setSyncTime(DateTime.now());
|
|
|
|
+ wbsTreeContractExtend.setAncestors(f.getAncestorsPId());
|
|
|
|
+ //施工
|
|
|
|
+ if (Arrays.asList("1", "2", "3").contains(f.getTableOwner())) {
|
|
|
|
+ //
|
|
|
|
+ wbsTreeContractExtend.setType(1);
|
|
|
|
+ }
|
|
|
|
+ //监理
|
|
|
|
+ if (Arrays.asList("4", "5", "6").contains(f.getTableOwner())) {
|
|
|
|
+ wbsTreeContractExtend.setType(2);
|
|
|
|
+ }
|
|
|
|
+ wbsTreeContractExtends.add(wbsTreeContractExtend);
|
|
|
|
+ });
|
|
|
|
+ pIdsNew.addAll(collect2.keySet());
|
|
|
|
+ }
|
|
|
|
+ //修改数据
|
|
Map<Long, List<WbsTreeContract>> collect1 = editData.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
|
|
Map<Long, List<WbsTreeContract>> collect1 = editData.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
|
|
- Set<Long> pIds = collect1.keySet();
|
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(editData)) {
|
|
|
|
+ editData.forEach(f -> {
|
|
|
|
+ WbsTreeContractExtend wbsTreeContractExtend = new WbsTreeContractExtend();
|
|
|
|
+ wbsTreeContractExtend.setPKeyId(f.getPKeyId());
|
|
|
|
+ wbsTreeContractExtend.setContractId(Long.valueOf(f.getContractId()));
|
|
|
|
+ wbsTreeContractExtend.setIsSync(1);
|
|
|
|
+ wbsTreeContractExtend.setSyncTime(DateTime.now());
|
|
|
|
+ wbsTreeContractExtend.setAncestors(f.getAncestorsPId());
|
|
|
|
+ //施工
|
|
|
|
+ if (Arrays.asList("1", "2", "3").contains(f.getTableOwner())) {
|
|
|
|
+ //
|
|
|
|
+ wbsTreeContractExtend.setType(1);
|
|
|
|
+ }
|
|
|
|
+ //监理
|
|
|
|
+ if (Arrays.asList("4", "5", "6").contains(f.getTableOwner())) {
|
|
|
|
+ wbsTreeContractExtend.setType(2);
|
|
|
|
+ }
|
|
|
|
+ wbsTreeContractExtends.add(wbsTreeContractExtend);
|
|
|
|
+ });
|
|
|
|
+ pIdsNew.addAll(collect1.keySet());
|
|
|
|
+ }
|
|
|
|
+ //计数 同步节点数量 按最小节点统计
|
|
Integer nodeNumEnd = 0;
|
|
Integer nodeNumEnd = 0;
|
|
|
|
|
|
- Map<Long, List<WbsTreeContract>> collect2 = oldHtml.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
|
|
|
|
|
|
+ //需要记录历史html的表单
|
|
|
|
+ Map<Long, List<WbsTreeContract>> collect3 = oldHtml.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
|
|
|
|
|
|
- for (Long pId : pIds) {
|
|
|
|
|
|
+ for (Long pId : pIdsNew) {
|
|
nodeNumEnd++;
|
|
nodeNumEnd++;
|
|
- List<WbsTreeContract> list = collect1.get(pId);
|
|
|
|
- List<WbsTreeContract> oldHtmlPId = collect2.get(pId);
|
|
|
|
|
|
|
|
- wbsSynchronousEViSaService.updateContract(wbsTreeSynchronousRecord.getType(), pId, wbsTreeSynchronousRecord.getCreateUserId(), list, oldHtmlPId);
|
|
|
|
|
|
+ //新增数据
|
|
|
|
+ List<WbsTreeContract> addContractNode = collect2.get(pId);
|
|
|
|
+ if (CollectionUtil.isNotEmpty(addContractNode)) {
|
|
|
|
+ int i = wbsSynchronousEViSaService.insertContractForm(wbsTreeSynchronousRecord, addContractNode, pId);
|
|
|
|
+ //如果失败 -- - - - - 继续执行 或者把当前节点的p_key_id 记录到某个地方 方便后续处理
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ //这里可以保存到数据库指定错误日志表
|
|
|
|
+ //这里可以保存到数据库指定错误日志表
|
|
|
|
+ } else {
|
|
|
|
+ //排序调整
|
|
|
|
+ if (wbsTreeSynchronousRecord.getType().contains("7")) {
|
|
|
|
+ //获取节点下的当前表单
|
|
|
|
+ List<WbsTreeContract> resourceData = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
+ .select(WbsTreeContract::getPKeyId, WbsTreeContract::getSort)
|
|
|
|
+ .eq(WbsTreeContract::getPId, pId)
|
|
|
|
+ .eq(WbsTreeContract::getIsDeleted, 0)
|
|
|
|
+ .orderByAsc(WbsTreeContract::getSort));
|
|
|
|
+ if (CollectionUtil.isNotEmpty(resourceData)) {
|
|
|
|
+ for (int j = 0; j < resourceData.size(); j++) {
|
|
|
|
+ resourceData.get(j).setSort(j + 1);
|
|
|
|
+ }
|
|
|
|
+ //修改排序为连续排序
|
|
|
|
+ wbsTreeContractMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<WbsTreeContract> list = collect1.get(pId);
|
|
|
|
+ if (CollectionUtil.isNotEmpty(list)) {
|
|
|
|
+ //历史html 只会在更新数据的时候取记录
|
|
|
|
+ List<WbsTreeContract> oldHtmlPId = collect3.get(pId);
|
|
|
|
+ wbsSynchronousEViSaService.updateContract(wbsTreeSynchronousRecord.getType(), pId, wbsTreeSynchronousRecord.getCreateUserId(), list, oldHtmlPId);
|
|
|
|
+ }
|
|
synchronousRecordMapper.update(null, Wrappers.<WbsTreeSynchronousRecord>lambdaUpdate()
|
|
synchronousRecordMapper.update(null, Wrappers.<WbsTreeSynchronousRecord>lambdaUpdate()
|
|
.set(WbsTreeSynchronousRecord::getNodeNumEnd, nodeNumEnd)
|
|
.set(WbsTreeSynchronousRecord::getNodeNumEnd, nodeNumEnd)
|
|
.set(WbsTreeSynchronousRecord::getUpdateTime, DateTime.now())
|
|
.set(WbsTreeSynchronousRecord::getUpdateTime, DateTime.now())
|
|
.eq(WbsTreeSynchronousRecord::getId, wbsTreeSynchronousRecord.getId()));
|
|
.eq(WbsTreeSynchronousRecord::getId, wbsTreeSynchronousRecord.getId()));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ System.err.println(errorMsg);
|
|
|
|
|
|
|
|
+ //添加记录
|
|
|
|
+ if (CollectionUtil.isNotEmpty(wbsTreeContractExtends)) {
|
|
|
|
+ wbsTreeContractExtendService.saveOrUpdateBatch(wbsTreeContractExtends);
|
|
|
|
+ }
|
|
synchronousRecordMapper.update(null, Wrappers.<WbsTreeSynchronousRecord>lambdaUpdate()
|
|
synchronousRecordMapper.update(null, Wrappers.<WbsTreeSynchronousRecord>lambdaUpdate()
|
|
.set(WbsTreeSynchronousRecord::getStatus, 2)
|
|
.set(WbsTreeSynchronousRecord::getStatus, 2)
|
|
- .set(WbsTreeSynchronousRecord::getErrorMsg, errorMsg.toString())
|
|
|
|
|
|
+ .set(WbsTreeSynchronousRecord::getErrorMsg, null)
|
|
.set(WbsTreeSynchronousRecord::getUpdateTime, DateTime.now())
|
|
.set(WbsTreeSynchronousRecord::getUpdateTime, DateTime.now())
|
|
.eq(WbsTreeSynchronousRecord::getId, wbsTreeSynchronousRecord.getId()));
|
|
.eq(WbsTreeSynchronousRecord::getId, wbsTreeSynchronousRecord.getId()));
|
|
}
|
|
}
|
|
@@ -896,7 +975,7 @@ public class WbsSynchronousServiceImpl {
|
|
}
|
|
}
|
|
//如果现在还找不到当前节点的父节点就表示数据有问题
|
|
//如果现在还找不到当前节点的父节点就表示数据有问题
|
|
if (addPrivateParentNodes.isEmpty()) {
|
|
if (addPrivateParentNodes.isEmpty()) {
|
|
- throw new ServiceException(addPrivateNode.getNodeName() + "( " + addPrivateNode.getPKeyId() + ")-找不到父节点");
|
|
|
|
|
|
+ throw new ServiceException(addPrivateNode.getNodeName() + "( " + addPrivateNode.getPKeyId() + ")-找不到父节点");
|
|
}
|
|
}
|
|
//当前新增节点的父节点
|
|
//当前新增节点的父节点
|
|
WbsTreePrivate parent = addPrivateParentNodes.get(0);
|
|
WbsTreePrivate parent = addPrivateParentNodes.get(0);
|
|
@@ -952,21 +1031,6 @@ public class WbsSynchronousServiceImpl {
|
|
throw new ServiceException("重置表单路径错误");
|
|
throw new ServiceException("重置表单路径错误");
|
|
}
|
|
}
|
|
|
|
|
|
- //查询出当前项目所有节点---------------------------------------------------------------------------------------------------
|
|
|
|
-// List<WbsTreePrivate> addList = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
|
|
-// .select(WbsTreePrivate::getPKeyId, WbsTreePrivate::getPId)
|
|
|
|
-// .eq(WbsTreePrivate::getIsDeleted, 0)
|
|
|
|
-// .eq(WbsTreePrivate::getProjectId, addData.get(0).getProjectId()));
|
|
|
|
-//
|
|
|
|
-// addList.addAll(addData);
|
|
|
|
-// //组合祖级路径 根据当前选中节点为开始
|
|
|
|
-// Map<Long, WbsTreePrivate> collect = addList.stream().collect(Collectors.toMap(WbsTreePrivate::getPKeyId, Function.identity()));
|
|
|
|
-//
|
|
|
|
-// addData.forEach(node -> {
|
|
|
|
-// String correctAncestors = createAncestorsPId(node, collect);
|
|
|
|
-// node.setAncestorsPId(correctAncestors);
|
|
|
|
-// });
|
|
|
|
-
|
|
|
|
//新增-----------------------------------------------------------------------------------------------------------------
|
|
//新增-----------------------------------------------------------------------------------------------------------------
|
|
Map<Long, List<WbsTreePrivate>> collect = addData.stream().collect(Collectors.groupingBy(WbsTreePrivate::getPId));
|
|
Map<Long, List<WbsTreePrivate>> collect = addData.stream().collect(Collectors.groupingBy(WbsTreePrivate::getPId));
|
|
Set<Long> longs = collect.keySet();
|
|
Set<Long> longs = collect.keySet();
|
|
@@ -1043,35 +1107,36 @@ public class WbsSynchronousServiceImpl {
|
|
* @param wbsTreeContracts 当前合同节点数据
|
|
* @param wbsTreeContracts 当前合同节点数据
|
|
* @param addContractNodes 新增节点数据
|
|
* @param addContractNodes 新增节点数据
|
|
*/
|
|
*/
|
|
- public void insertContractForm(WbsTreeSynchronousRecord wbsTreeSynchronousRecord, ContractInfo contractInfo, List<WbsTreeContract> wbsTreeContracts, List<WbsTreeContract> addContractNodes) {
|
|
|
|
|
|
+ public List<WbsTreeContract> insertContractForm(WbsTreeSynchronousRecord wbsTreeSynchronousRecord, ContractInfo contractInfo, List<WbsTreeContract> wbsTreeContracts, List<WbsTreeContract> addContractNodes, StringBuilder errorMsg) {
|
|
List<WbsTreeContract> addData = new ArrayList<>();
|
|
List<WbsTreeContract> addData = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(addContractNodes)) {
|
|
if (CollectionUtil.isNotEmpty(addContractNodes)) {
|
|
|
|
+ //项目级:p_key_id:p_id
|
|
|
|
+ HashMap<Long, Long> map = new HashMap<>();
|
|
|
|
+
|
|
|
|
|
|
//选给新增的节点赋值
|
|
//选给新增的节点赋值
|
|
addContractNodes.forEach(f -> {
|
|
addContractNodes.forEach(f -> {
|
|
|
|
+ Long id = SnowFlakeUtil.getId();
|
|
|
|
+ map.put(id, f.getPId());
|
|
|
|
+
|
|
f.setIsTypePrivatePid(f.getPKeyId());
|
|
f.setIsTypePrivatePid(f.getPKeyId());
|
|
- f.setPKeyId(SnowFlakeUtil.getId());
|
|
|
|
|
|
+ f.setPKeyId(id);
|
|
});
|
|
});
|
|
|
|
|
|
for (WbsTreeContract addContractNode : addContractNodes) {
|
|
for (WbsTreeContract addContractNode : addContractNodes) {
|
|
if (addContractNode.getParentId() == 0) {
|
|
if (addContractNode.getParentId() == 0) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
-
|
|
|
|
- //查询出当前模板节点的父节点 去获取对应项目节点 如果父节点为0就跳过
|
|
|
|
- List<WbsTreeContract> addContractParentNodes = wbsTreeContracts.stream().filter(f -> Objects.equals(f.getTreePId(), addContractNode.getParentId())).collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
- //如果没有数据 就表示这条数据的父节点也时新增节点 就需要从新增节点集合中找父级节点
|
|
|
|
- if (addContractParentNodes.isEmpty()) {
|
|
|
|
- addContractParentNodes = addContractNodes.stream().filter(f -> f.getTreePId().equals(addContractNode.getParentId())).collect(Collectors.toList());
|
|
|
|
- }
|
|
|
|
- //如果现在还找不到当前节点的父节点就表示数据有问题
|
|
|
|
- if (addContractParentNodes.isEmpty()) {
|
|
|
|
- //TODO
|
|
|
|
- throw new ServiceException(addContractNode.getNodeName() + "( " + addContractNode.getPKeyId() + ")-找不到父节点");
|
|
|
|
|
|
+ //新增的数据只有表单,所以找父节点可以直接在合同段中找,如果找不到就说明当前表单的父节点在合同段中不存在 数据有问题
|
|
|
|
+ List<WbsTreeContract> addContractParentNodes = wbsTreeContracts.stream().filter(f -> Objects.equals(f.getIsTypePrivatePid(), map.get(addContractNode.getPKeyId()))).collect(Collectors.toList());
|
|
|
|
+ //获取新增数据中的父级节点
|
|
|
|
+ if (CollectionUtil.isEmpty(addContractParentNodes)) {
|
|
|
|
+ errorMsg.append("未在合同段[" + contractInfo.getContractName() + "]找到当前节点父节点-p_key_id(" + map.get(addContractNode.getPKeyId()) + ");");
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
|
|
+
|
|
//当前新增节点的父节点
|
|
//当前新增节点的父节点
|
|
WbsTreeContract parent = addContractParentNodes.get(0);
|
|
WbsTreeContract parent = addContractParentNodes.get(0);
|
|
|
|
|
|
@@ -1093,91 +1158,7 @@ public class WbsSynchronousServiceImpl {
|
|
}
|
|
}
|
|
addData.addAll(addContractNodes);
|
|
addData.addAll(addContractNodes);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
- //查询出当前项目所有节点---------------------------------------------------------------------------------------------------
|
|
|
|
-// List<WbsTreeContract> addList = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
-// .select(WbsTreeContract::getPKeyId, WbsTreeContract::getPId)
|
|
|
|
-// .eq(WbsTreeContract::getIsDeleted, 0)
|
|
|
|
-// .eq(WbsTreeContract::getContractId, contractInfo.getId()));
|
|
|
|
-//
|
|
|
|
-// addList.addAll(addData);
|
|
|
|
-//
|
|
|
|
-//
|
|
|
|
-// //组合祖级路径 根据当前选中节点为开始
|
|
|
|
-// Map<Long, WbsTreeContract> collect = addList.stream().collect(Collectors.toMap(WbsTreeContract::getPKeyId, Function.identity()));
|
|
|
|
-//
|
|
|
|
-// addData.forEach(node -> {
|
|
|
|
-// //通过转换为WbsTreePrivate的方式 去获取祖级节点
|
|
|
|
-// String correctAncestors = createAncestorsPId(node, collect);
|
|
|
|
-// node.setAncestorsPId(correctAncestors);
|
|
|
|
-// });
|
|
|
|
-
|
|
|
|
- //新增-----------------------------------------------------------------------------------------------------------------
|
|
|
|
- Map<Long, List<WbsTreeContract>> collect = addData.stream().collect(Collectors.groupingBy(WbsTreeContract::getPId));
|
|
|
|
- Set<Long> longs = collect.keySet();
|
|
|
|
-
|
|
|
|
- List<Long> pIds = new ArrayList<>(longs);
|
|
|
|
- List<WbsTreeContract> saveData = new ArrayList<>();
|
|
|
|
- //按最小节点批量新增
|
|
|
|
- List<List<Long>> partition = Lists.partition(pIds, 100);
|
|
|
|
- for (List<Long> data : partition) {
|
|
|
|
- for (Long pId : data) {
|
|
|
|
- List<WbsTreeContract> list = collect.get(pId);
|
|
|
|
- //排序调整
|
|
|
|
- if (wbsTreeSynchronousRecord.getType().contains("7")) {
|
|
|
|
- list.sort(Comparator.comparingInt(WbsTreeContract::getSort));
|
|
|
|
- //获取节点下的当前表单
|
|
|
|
- List<WbsTreeContract> resourceData = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
- .select(WbsTreeContract::getPKeyId, WbsTreeContract::getSort)
|
|
|
|
- .eq(WbsTreeContract::getPId, pId)
|
|
|
|
- .eq(WbsTreeContract::getIsDeleted, 0)
|
|
|
|
- .orderByAsc(WbsTreeContract::getSort));
|
|
|
|
- if (CollectionUtil.isNotEmpty(resourceData)) {
|
|
|
|
- for (int i = 0; i < resourceData.size(); i++) {
|
|
|
|
- resourceData.get(i).setSort(i + 1);
|
|
|
|
- }
|
|
|
|
- //修改排序为连续排序
|
|
|
|
- wbsTreeContractMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- for (WbsTreeContract wbsTreePrivate : list) {
|
|
|
|
- wbsTreeContractMapper.updateSortByPId(pId, wbsTreePrivate.getSort());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- boolean b = saveData.addAll(list);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //单个批次一个事务,只会回滚当前批次数据
|
|
|
|
- Integer i = wbsTreeContractMapper.insertBatchSomeColumn(saveData);
|
|
|
|
- //如果失败 -- - - - - 继续执行 或者把当前节点的p_key_id 记录到某个地方 方便后续处理
|
|
|
|
- if (i == 0) {
|
|
|
|
- List<Long> collect1 = addData.stream().map(WbsTreeContract::getPKeyId).collect(Collectors.toList());
|
|
|
|
- //这里可以保存到数据库指定错误日志表
|
|
|
|
- //这里可以保存到数据库指定错误日志表
|
|
|
|
- throw new ServiceException("添加失败:" + StringUtil.join(collect1, ","));
|
|
|
|
- } else {
|
|
|
|
- //排序调整
|
|
|
|
- if (wbsTreeSynchronousRecord.getType().contains("7")) {
|
|
|
|
- //获取节点下的当前表单
|
|
|
|
- List<WbsTreeContract> resourceData = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
|
- .select(WbsTreeContract::getPKeyId, WbsTreeContract::getSort)
|
|
|
|
- .eq(WbsTreeContract::getPId, pId)
|
|
|
|
- .eq(WbsTreeContract::getIsDeleted, 0)
|
|
|
|
- .orderByAsc(WbsTreeContract::getSort));
|
|
|
|
- if (CollectionUtil.isNotEmpty(resourceData)) {
|
|
|
|
- for (int j = 0; i < resourceData.size(); j++) {
|
|
|
|
- resourceData.get(j).setSort(j + 1);
|
|
|
|
- }
|
|
|
|
- //修改排序为连续排序
|
|
|
|
- wbsTreeContractMapper.updateSortBatchByPKeyId(resourceData);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ return addData;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1203,8 +1184,6 @@ public class WbsSynchronousServiceImpl {
|
|
|
|
|
|
//模板的主键ids
|
|
//模板的主键ids
|
|
List<Long> tempPKeyIds = new ArrayList<>();
|
|
List<Long> tempPKeyIds = new ArrayList<>();
|
|
- List<Long> editPKeyIds = new ArrayList<>();
|
|
|
|
-
|
|
|
|
|
|
|
|
for (WbsTreePrivate tempPrivate : treePrivates) {
|
|
for (WbsTreePrivate tempPrivate : treePrivates) {
|
|
for (WbsTreePrivate editPrivate : editPrivateNodes) {
|
|
for (WbsTreePrivate editPrivate : editPrivateNodes) {
|
|
@@ -1220,43 +1199,41 @@ public class WbsSynchronousServiceImpl {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (CollectionUtil.isEmpty(tempPKeyIds)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
//源项目电签和默认值信息
|
|
//源项目电签和默认值信息
|
|
List<TextdictInfo> tempTextDictInfo = textdictInfoMapper.selectList(Wrappers.<TextdictInfo>lambdaQuery()
|
|
List<TextdictInfo> tempTextDictInfo = textdictInfoMapper.selectList(Wrappers.<TextdictInfo>lambdaQuery()
|
|
.eq(TextdictInfo::getProjectId, templateId)
|
|
.eq(TextdictInfo::getProjectId, templateId)
|
|
.eq(TextdictInfo::getIsDeleted, 0)
|
|
.eq(TextdictInfo::getIsDeleted, 0)
|
|
.in(TextdictInfo::getTabId, tempPKeyIds)
|
|
.in(TextdictInfo::getTabId, tempPKeyIds)
|
|
- .in(TextdictInfo::getType, 4));
|
|
|
|
- //当前值同步默认值
|
|
|
|
-// .in(TextdictInfo::getType, 2, 4, 6));
|
|
|
|
|
|
+ //当前值同步默认值
|
|
|
|
+ .in(TextdictInfo::getType, 2, 4, 6));
|
|
if (CollectionUtil.isEmpty(tempTextDictInfo)) {
|
|
if (CollectionUtil.isEmpty(tempTextDictInfo)) {
|
|
- throw new ServiceException("源数据无电签及默认值配置");
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
Map<Integer, List<TextdictInfo>> tempTextDictInfoMap = tempTextDictInfo.stream().collect(Collectors.groupingBy(TextdictInfo::getType));
|
|
Map<Integer, List<TextdictInfo>> tempTextDictInfoMap = tempTextDictInfo.stream().collect(Collectors.groupingBy(TextdictInfo::getType));
|
|
|
|
|
|
|
|
|
|
List<TextdictInfo> tempViSa = new ArrayList<>();
|
|
List<TextdictInfo> tempViSa = new ArrayList<>();
|
|
//电签
|
|
//电签
|
|
- if (collect.contains(3)) {
|
|
|
|
- //个人电签
|
|
|
|
- List<TextdictInfo> tempMyViSa = tempTextDictInfoMap.get(2);
|
|
|
|
- if (CollectionUtil.isNotEmpty(tempMyViSa)) {
|
|
|
|
- tempViSa.addAll(tempMyViSa);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- //企业电签
|
|
|
|
- List<TextdictInfo> tempEnterViSa = tempTextDictInfoMap.get(6);
|
|
|
|
- if (CollectionUtil.isNotEmpty(tempEnterViSa)) {
|
|
|
|
- tempViSa.addAll(tempEnterViSa);
|
|
|
|
- }
|
|
|
|
|
|
+ List<TextdictInfo> tempMyViSa = tempTextDictInfoMap.get(2);
|
|
|
|
+ if (CollectionUtil.isNotEmpty(tempMyViSa)) {
|
|
|
|
+ tempViSa.addAll(tempMyViSa);
|
|
|
|
|
|
}
|
|
}
|
|
- //默认值
|
|
|
|
- if (collect.contains(5)) {
|
|
|
|
- List<TextdictInfo> tempDefault = tempTextDictInfoMap.get(4);
|
|
|
|
- if (CollectionUtil.isNotEmpty(tempDefault)) {
|
|
|
|
- tempViSa.addAll(tempDefault);
|
|
|
|
- }
|
|
|
|
|
|
+ //企业电签
|
|
|
|
+ List<TextdictInfo> tempEnterViSa = tempTextDictInfoMap.get(6);
|
|
|
|
+ if (CollectionUtil.isNotEmpty(tempEnterViSa)) {
|
|
|
|
+ tempViSa.addAll(tempEnterViSa);
|
|
}
|
|
}
|
|
|
|
+ //默认值
|
|
|
|
+// if (collect.contains(5)) {
|
|
|
|
+// List<TextdictInfo> tempDefault = tempTextDictInfoMap.get(4);
|
|
|
|
+// if (CollectionUtil.isNotEmpty(tempDefault)) {
|
|
|
|
+// tempViSa.addAll(tempDefault);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
|
|
|
|
List<TextdictInfo> addData = new ArrayList<>();
|
|
List<TextdictInfo> addData = new ArrayList<>();
|
|
@@ -1284,112 +1261,7 @@ public class WbsSynchronousServiceImpl {
|
|
//调用其他类使事务生效
|
|
//调用其他类使事务生效
|
|
wbsSynchronousEViSaService.updateTextDictInfo(projectId, editPrivateIds, addData);
|
|
wbsSynchronousEViSaService.updateTextDictInfo(projectId, editPrivateIds, addData);
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- throw new ServiceException("模板为公共项目,无法同步电签");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 20250414-lhb-新增
|
|
|
|
- * 创建祖级路径
|
|
|
|
- * <p>
|
|
|
|
- * 该方法用于构建给定节点的祖先路径标识符(PId)字符串
|
|
|
|
- * 它通过追溯节点的父节点,直到达到根节点或满足特定条件为止
|
|
|
|
- *
|
|
|
|
- * @param node WbsTreeContract类型的节点,表示需要构建路径的起始节点
|
|
|
|
- * @param nodeMap 一个映射,其键为节点ID,值为WbsTreeContract类型的节点对象,用于快速查找节点
|
|
|
|
- * @return 返回一个字符串,表示构建的祖先路径标识符序列,以逗号分隔
|
|
|
|
- */
|
|
|
|
- private String createAncestorsPId(WbsTreePrivate node, Map<Long, WbsTreePrivate> nodeMap) {
|
|
|
|
- // 初始化路径列表,用于存储祖先节点的ID
|
|
|
|
- List<Long> path = new ArrayList<>();
|
|
|
|
- // 从给定的节点开始
|
|
|
|
- WbsTreePrivate current = node;
|
|
|
|
- // 初始化访问集合,用于检测循环引用
|
|
|
|
- Set<Long> visited = new HashSet<>();
|
|
|
|
-
|
|
|
|
- while (true) {
|
|
|
|
- // 检查当前节点是否为根节点或无效节点
|
|
|
|
- if (current == null || current.getPId() == null ||
|
|
|
|
- current.getPId() == 0 || current.getPId().equals(current.getPKeyId())) {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 检测循环引用
|
|
|
|
- if (visited.contains(current.getPId())) {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- // 将当前节点的ID添加到已访问集合中
|
|
|
|
- visited.add(current.getPKeyId());
|
|
|
|
-
|
|
|
|
- // 从映射中获取当前节点的父节点
|
|
|
|
- current = nodeMap.get(current.getPId());
|
|
|
|
- // 如果父节点存在,则将其ID添加到路径列表的开头
|
|
|
|
- if (current != null) {
|
|
|
|
- path.add(0, current.getPKeyId());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 安全限制,防止路径过长导致性能问题
|
|
|
|
- if (path.size() > 50) {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 将根节点ID(0)添加到路径的最前面,表示路径的起点
|
|
|
|
- path.add(0, 0L);
|
|
|
|
- // 将路径列表转换为字符串并返回
|
|
|
|
- return String.join(",", path.stream().map(String::valueOf).toArray(String[]::new));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 20250414-lhb-新增
|
|
|
|
- * 创建祖级路径
|
|
|
|
- * <p>
|
|
|
|
- * 该方法用于构建给定节点的祖先路径标识符(PId)字符串
|
|
|
|
- * 它通过追溯节点的父节点,直到达到根节点或满足特定条件为止
|
|
|
|
- *
|
|
|
|
- * @param node WbsTreeContract类型的节点,表示需要构建路径的起始节点
|
|
|
|
- * @param nodeMap 一个映射,其键为节点ID,值为WbsTreeContract类型的节点对象,用于快速查找节点
|
|
|
|
- * @return 返回一个字符串,表示构建的祖先路径标识符序列,以逗号分隔
|
|
|
|
- */
|
|
|
|
- private String createAncestorsPId(WbsTreeContract node, Map<Long, WbsTreeContract> nodeMap) {
|
|
|
|
- // 初始化路径列表,用于存储祖先节点的ID
|
|
|
|
- List<Long> path = new ArrayList<>();
|
|
|
|
- // 从给定的节点开始
|
|
|
|
- WbsTreeContract current = node;
|
|
|
|
- // 初始化访问集合,用于检测循环引用
|
|
|
|
- Set<Long> visited = new HashSet<>();
|
|
|
|
-
|
|
|
|
- while (true) {
|
|
|
|
- // 检查当前节点是否为根节点或无效节点
|
|
|
|
- if (current == null || current.getPId() == null ||
|
|
|
|
- current.getPId() == 0 || current.getPId().equals(current.getPKeyId())) {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 检测循环引用
|
|
|
|
- if (visited.contains(current.getPId())) {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- // 将当前节点的ID添加到已访问集合中
|
|
|
|
- visited.add(current.getPKeyId());
|
|
|
|
-
|
|
|
|
- // 从映射中获取当前节点的父节点
|
|
|
|
- current = nodeMap.get(current.getPId());
|
|
|
|
- // 如果父节点存在,则将其ID添加到路径列表的开头
|
|
|
|
- if (current != null) {
|
|
|
|
- path.add(0, current.getPKeyId());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 安全限制,防止路径过长导致性能问题
|
|
|
|
- if (path.size() > 50) {
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
- // 将根节点ID(0)添加到路径的最前面,表示路径的起点
|
|
|
|
- path.add(0, 0L);
|
|
|
|
- // 将路径列表转换为字符串并返回
|
|
|
|
- return String.join(",", path.stream().map(String::valueOf).toArray(String[]::new));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|