|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import org.jsoup.Jsoup;
|
|
import org.jsoup.Jsoup;
|
|
import org.jsoup.nodes.Document;
|
|
import org.jsoup.nodes.Document;
|
|
@@ -20,7 +21,6 @@ import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.constant.BladeConstant;
|
|
import org.springblade.core.tool.constant.BladeConstant;
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
import org.springblade.core.tool.node.ForestNodeMerger;
|
|
import org.springblade.core.tool.utils.*;
|
|
import org.springblade.core.tool.utils.*;
|
|
-import org.springblade.manager.dto.WbsTreeContractDTO;
|
|
|
|
import org.springblade.manager.dto.WbsTreePrivateDTO2;
|
|
import org.springblade.manager.dto.WbsTreePrivateDTO2;
|
|
import org.springblade.manager.dto.WbsTreePrivateDTO3;
|
|
import org.springblade.manager.dto.WbsTreePrivateDTO3;
|
|
import org.springblade.manager.entity.*;
|
|
import org.springblade.manager.entity.*;
|
|
@@ -34,10 +34,16 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileInputStream;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.concurrent.Callable;
|
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
|
+import java.util.concurrent.Future;
|
|
|
|
+import java.util.concurrent.ThreadPoolExecutor;
|
|
|
|
+import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -46,8 +52,6 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
|
|
|
private final WbsTreeContractMapper wbsTreeContractMapper;
|
|
private final WbsTreeContractMapper wbsTreeContractMapper;
|
|
private final WbsTreeContractServiceImpl wbsTreeContractService;
|
|
private final WbsTreeContractServiceImpl wbsTreeContractService;
|
|
-
|
|
|
|
- // 表单主表信息
|
|
|
|
private final ITableInfoService tableInfoService;
|
|
private final ITableInfoService tableInfoService;
|
|
private final WbsTreeMapper wbsTreeMapper;
|
|
private final WbsTreeMapper wbsTreeMapper;
|
|
private final ContractInfoMapper contractInfoMapper;
|
|
private final ContractInfoMapper contractInfoMapper;
|
|
@@ -59,6 +63,9 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
private final JdbcTemplate jdbcTemplate;
|
|
private final JdbcTemplate jdbcTemplate;
|
|
private final TextdictInfoServiceImpl textDictInfoService;
|
|
private final TextdictInfoServiceImpl textDictInfoService;
|
|
|
|
|
|
|
|
+ @Resource(name = "taskExecutor1")
|
|
|
|
+ private ThreadPoolExecutor executor;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public List<WbsTreePrivateVO> tree(String wbsId, String projectId) {
|
|
public List<WbsTreePrivateVO> tree(String wbsId, String projectId) {
|
|
WbsInfo wbsInfo = wbsInfoMapper.selectOne(Wrappers.<WbsInfo>query().lambda().eq(WbsInfo::getId, wbsId));
|
|
WbsInfo wbsInfo = wbsInfoMapper.selectOne(Wrappers.<WbsInfo>query().lambda().eq(WbsInfo::getId, wbsId));
|
|
@@ -1631,34 +1638,41 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
WbsTreePrivate oneRecordRoot = this.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, projectInfo.getReferenceWbsTemplateId()));
|
|
WbsTreePrivate oneRecordRoot = this.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, projectInfo.getReferenceWbsTemplateId()));
|
|
|
|
|
|
//获取当前项目下节点树所有节点、表、独立表
|
|
//获取当前项目下节点树所有节点、表、独立表
|
|
- List<WbsTreePrivate> wbsTreePrivatesNodeAndTabNow = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getProjectId, projectId).eq(WbsTreePrivate::getWbsType, 1).eq(WbsTreePrivate::getStatus, 1).and(obj -> obj.eq(WbsTreePrivate::getType, 1).or().eq(WbsTreePrivate::getType, 2)));
|
|
|
|
- List<WbsTreePrivate> wbsTreePrivatesTableDL = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getProjectId, projectId).eq(WbsTreePrivate::getType, 10).eq(WbsTreePrivate::getParentId, -10).eq(WbsTreePrivate::getStatus, 1));
|
|
|
|
- wbsTreePrivatesNodeAndTabNow.addAll(wbsTreePrivatesTableDL);
|
|
|
|
- //获取当前项目节点树的所有id
|
|
|
|
- List<Long> saveIds = wbsTreePrivatesNodeAndTabNow.stream().filter(f -> f.getType().equals(1)).collect(Collectors.toList()).stream().map(WbsTreePrivate::getId).collect(Collectors.toList());
|
|
|
|
|
|
+ String sqlNodeTreeAllNow = "SELECT p_key_id,id,type,parent_id,html_url FROM m_wbs_tree_private WHERE project_id = " + projectId + " AND STATUS = 1 AND is_deleted = 0 AND (((type = 1 OR type = 2) AND wbs_type = 1) OR (type= 10 AND parent_id = -10 ))";
|
|
|
|
+ List<WbsTreePrivate> wbsTreePrivatesNodeAndTabNow = jdbcTemplate.query(sqlNodeTreeAllNow, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
|
+ List<WbsTreePrivate> wbsTreePrivatesTableDL = wbsTreePrivatesNodeAndTabNow.stream().filter(f -> f.getType().equals(10) && f.getParentId().equals(-10L)).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ //获取当前项目节点树
|
|
|
|
+ Map<Long, WbsTreePrivate> nowNodeTreeAll = wbsTreePrivatesNodeAndTabNow.stream().filter(f -> f.getType().equals(1)).collect(Collectors.toList()).stream()
|
|
|
|
+ .collect(Collectors.toMap(WbsTreePrivate::getId, Function.identity()));
|
|
|
|
|
|
//获取当前引用的节点树下所有节点、表、独立表
|
|
//获取当前引用的节点树下所有节点、表、独立表
|
|
- List<WbsTreePrivate> wbsTreePrivatesNodeAndTab = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getProjectId, oneRecordRoot.getProjectId()).eq(WbsTreePrivate::getWbsId, oneRecordRoot.getWbsId()).eq(WbsTreePrivate::getStatus, 1).and(obj -> obj.eq(WbsTreePrivate::getType, 1).or().eq(WbsTreePrivate::getType, 2)));
|
|
|
|
- List<WbsTreePrivate> wbsTreePrivatesTableDLOld = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getProjectId, oneRecordRoot.getProjectId()).eq(WbsTreePrivate::getType, 10).eq(WbsTreePrivate::getStatus, 1).eq(WbsTreePrivate::getParentId, -10).isNull(WbsTreePrivate::getWbsId));
|
|
|
|
- wbsTreePrivatesNodeAndTab.addAll(wbsTreePrivatesTableDLOld);
|
|
|
|
|
|
+ String sqlNodeTreeAllOld = "SELECT p_key_id,id,type,parent_id FROM m_wbs_tree_private WHERE project_id = " + oneRecordRoot.getProjectId() + " AND STATUS = 1 AND is_deleted = 0 AND (((type = 1 OR type = 2) AND wbs_id = " + oneRecordRoot.getWbsId() + ") OR ((type= 10 OR parent_id = -10 ) AND wbs_id IS NULL))";
|
|
|
|
+ List<WbsTreePrivate> wbsTreePrivatesNodeAndTab = jdbcTemplate.query(sqlNodeTreeAllOld, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
|
|
|
//获取当前对应电签位置配置信息
|
|
//获取当前对应电签位置配置信息
|
|
- List<Long> pIdsDL = wbsTreePrivatesNodeAndTab.stream().filter(f -> f.getType().equals(10) || f.getType().equals(2)).collect(Collectors.toList()).stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
|
- String sql = "select * from m_textdict_info where tab_id in (" + org.apache.commons.lang.StringUtils.join(pIdsDL, ",") + ") and is_deleted = 0";
|
|
|
|
- List<TextdictInfo> textDictInfosAll = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TextdictInfo.class));
|
|
|
|
|
|
+ List<WbsTreePrivate> collect1 = wbsTreePrivatesNodeAndTab.stream().filter(f -> f.getType().equals(10) || f.getType().equals(2)).collect(Collectors.toList());
|
|
|
|
+ List<Long> pKeyIds = collect1.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ //分组查询
|
|
|
|
+ List<TextdictInfo> textDictInfosAll = new ArrayList<>();
|
|
|
|
+ List<List<Long>> partition = Lists.partition(pKeyIds, 1000);
|
|
|
|
+ for (List<Long> ids : partition) {
|
|
|
|
+ String sql = "select id,name,type,tab_id,col_key,sig_role_id,is_deleted,sig_role_name,col_name,pyzbx,pyzby from m_textdict_info where tab_id in(" + org.apache.commons.lang.StringUtils.join(ids, ",") + ")";
|
|
|
|
+ List<TextdictInfo> textDictInfos = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TextdictInfo.class));
|
|
|
|
+ textDictInfosAll.addAll(textDictInfos);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map<String, List<TextdictInfo>> collect3 = textDictInfosAll.stream().collect(Collectors.groupingBy(TextdictInfo::getTabId));
|
|
|
|
|
|
//构造原始电签信息
|
|
//构造原始电签信息
|
|
- for (WbsTreePrivate wbsTreePrivate : wbsTreePrivatesNodeAndTab) {
|
|
|
|
|
|
+ for (WbsTreePrivate wbsTreePrivate : collect1) {
|
|
if (wbsTreePrivate.getType() == 2) {
|
|
if (wbsTreePrivate.getType() == 2) {
|
|
- for (Long id : saveIds) {
|
|
|
|
- if (id.equals(wbsTreePrivate.getParentId())) {
|
|
|
|
- //根据元素表pKeyId,获取电签位置匹配信息、编辑默认信息
|
|
|
|
- List<TextdictInfo> textDictInfos = textDictInfosAll.stream().filter(f ->
|
|
|
|
- ObjectUtils.isNotEmpty(f.getTabId()) && f.getTabId().equals(String.valueOf(wbsTreePrivate.getPKeyId()))).collect(Collectors.toList());
|
|
|
|
- if (textDictInfos.size() > 0) {
|
|
|
|
- textDictInfoData.put(wbsTreePrivate.getPKeyId() + "," + wbsTreePrivate.getId(), textDictInfos);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ WbsTreePrivate obj = nowNodeTreeAll.get(wbsTreePrivate.getParentId());
|
|
|
|
+ assert obj != null;
|
|
|
|
+ List<TextdictInfo> textDictInfos = collect3.get(String.valueOf(wbsTreePrivate.getPKeyId()));
|
|
|
|
+ if (textDictInfos != null && textDictInfos.size() > 0) {
|
|
|
|
+ textDictInfoData.put(wbsTreePrivate.getPKeyId() + "," + wbsTreePrivate.getId(), textDictInfos);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1667,9 +1681,8 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
List<WbsTreePrivate> collect = wbsTreePrivatesTableDL.stream().filter(f -> f.getId().equals(wbsTreePrivate.getId())).collect(Collectors.toList());
|
|
List<WbsTreePrivate> collect = wbsTreePrivatesTableDL.stream().filter(f -> f.getId().equals(wbsTreePrivate.getId())).collect(Collectors.toList());
|
|
if (collect.size() == 0) {
|
|
if (collect.size() == 0) {
|
|
//根据元素表pKeyId,获取电签位置匹配信息、编辑默认信息
|
|
//根据元素表pKeyId,获取电签位置匹配信息、编辑默认信息
|
|
- List<TextdictInfo> textDictInfos = textDictInfosAll.stream().filter(f -> ObjectUtils.isNotEmpty(f.getTabId())
|
|
|
|
- && f.getTabId().equals(String.valueOf(wbsTreePrivate.getPKeyId()))).collect(Collectors.toList());
|
|
|
|
- if (textDictInfos.size() > 0) {
|
|
|
|
|
|
+ List<TextdictInfo> textDictInfos = collect3.get(String.valueOf(wbsTreePrivate.getPKeyId()));
|
|
|
|
+ if (textDictInfos != null && textDictInfos.size() > 0) {
|
|
textDictInfoData.put(wbsTreePrivate.getPKeyId() + "," + wbsTreePrivate.getId(), textDictInfos);
|
|
textDictInfoData.put(wbsTreePrivate.getPKeyId() + "," + wbsTreePrivate.getId(), textDictInfos);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1686,7 +1699,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
for (TextdictInfo textdictInfo : v) {
|
|
for (TextdictInfo textdictInfo : v) {
|
|
TextdictInfo obj = BeanUtil.copyProperties(textdictInfo, TextdictInfo.class);
|
|
TextdictInfo obj = BeanUtil.copyProperties(textdictInfo, TextdictInfo.class);
|
|
assert obj != null;
|
|
assert obj != null;
|
|
- obj.setTabId(String.valueOf(tree.getPKeyId()));
|
|
|
|
|
|
+ obj.setTabId(String.valueOf(tree.getPKeyId())); //重新赋值绑定到对应的表上
|
|
obj.setId(SnowFlakeUtil.getId());
|
|
obj.setId(SnowFlakeUtil.getId());
|
|
insertData.add(obj);
|
|
insertData.add(obj);
|
|
}
|
|
}
|
|
@@ -1695,8 +1708,10 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
});
|
|
});
|
|
|
|
|
|
//去重,删除当前表的电签信息
|
|
//去重,删除当前表的电签信息
|
|
- for (TextdictInfo insertDatum : insertData) {
|
|
|
|
- String delSql = "delete from m_textdict_info where tab_id = " + insertDatum.getTabId();
|
|
|
|
|
|
+ List<String> collect2 = insertData.stream().map(TextdictInfo::getTabId).collect(Collectors.toList());
|
|
|
|
+ List<List<String>> partitionDel = Lists.partition(collect2, 1000);
|
|
|
|
+ for (List<String> ids : partitionDel) {
|
|
|
|
+ String delSql = "delete from m_textdict_info where tab_id in (" + org.apache.commons.lang.StringUtils.join(ids, ",") + ")";
|
|
jdbcTemplate.execute(delSql);
|
|
jdbcTemplate.execute(delSql);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1705,12 +1720,53 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
|
|
|
|
return true;
|
|
return true;
|
|
} else {
|
|
} else {
|
|
- throw new ServiceException("未获取到项目的关联的私有wbs树信息");
|
|
|
|
|
|
+ throw new ServiceException("当前项目关联的wbs树不是私有关联");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void eVisInfoRepeatDel(String pid) {
|
|
|
|
+ //获取当前项目下节点树所有节点、表、独立表
|
|
|
|
+ String sqlNodeTreeAllNow = "SELECT p_key_id,id,type,parent_id,html_url FROM m_wbs_tree_private WHERE project_id = " + pid + " AND STATUS = 1 AND is_deleted = 0 AND (((type = 1 OR type = 2) AND wbs_type = 1) OR (type= 10 AND parent_id = -10 ))";
|
|
|
|
+ List<WbsTreePrivate> wbsTreePrivatesNodeAndTabNow = jdbcTemplate.query(sqlNodeTreeAllNow, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
|
+
|
|
|
|
+ //获取当前对应电签位置配置信息
|
|
|
|
+ List<WbsTreePrivate> collect1 = wbsTreePrivatesNodeAndTabNow.stream().filter(f -> f.getType().equals(10) || f.getType().equals(2)).collect(Collectors.toList());
|
|
|
|
+ List<Long> pKeyIds = collect1.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ //分组查询电签信息
|
|
|
|
+ List<TextdictInfo> textDictInfosAll = new ArrayList<>();
|
|
|
|
+ List<List<Long>> partition = Lists.partition(pKeyIds, 1000);
|
|
|
|
+ for (List<Long> ids : partition) {
|
|
|
|
+ String sql = "select id,tab_id,col_key,col_name,sig_role_id,sig_role_name from m_textdict_info where tab_id in(" + org.apache.commons.lang.StringUtils.join(ids, ",") + ")";
|
|
|
|
+ List<TextdictInfo> textDictInfos = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TextdictInfo.class));
|
|
|
|
+ textDictInfosAll.addAll(textDictInfos);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //去重,解决之前由于删除接口重复保存,导致数据重复问题
|
|
|
|
+ List<TextdictInfo> list = textDictInfosAll.stream().collect(
|
|
|
|
+ Collectors.collectingAndThen(
|
|
|
|
+ Collectors.toCollection(() -> new TreeSet<>(
|
|
|
|
+ Comparator.comparing(o -> o.getTabId() + ";" + o.getSigRoleId() + ";" + o.getColKey() + ";" + o.getSigRoleName() + ";" + o.getColName()
|
|
|
|
+ )
|
|
|
|
+ )), ArrayList::new));
|
|
|
|
+
|
|
|
|
+ List<Long> idsAll = textDictInfosAll.stream().map(TextdictInfo::getId).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ List<Long> saveIds = list.stream().map(TextdictInfo::getId).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ List<Long> delIds = idsAll.stream().filter(f -> !saveIds.contains(f)).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ List<List<Long>> partition1 = Lists.partition(delIds, 1000);
|
|
|
|
+ for (List<Long> ids : partition1) {
|
|
|
|
+ String delSql = "delete from m_textdict_info where id in (" + org.apache.commons.lang.StringUtils.join(ids, ",") + ")";
|
|
|
|
+ jdbcTemplate.execute(delSql);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public boolean insertBatch(Collection<WbsTreePrivate> entityList, int batchSize) {
|
|
public boolean insertBatch(Collection<WbsTreePrivate> entityList, int batchSize) {
|
|
try {
|
|
try {
|