|
|
@@ -117,6 +117,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
private final ContractClient contractClient;
|
|
|
|
|
|
private final WbsTreeContractClient wbsTreeContractClient;
|
|
|
+
|
|
|
+ private final WbsTreeContractExtendClient wbsTreeContractExtendClient;
|
|
|
+
|
|
|
private final WbsTreeContractOldHtmlClient wbsTreeContractOldHtmlClient;
|
|
|
|
|
|
private final WbsTreePrivateClient wbsTreePrivateClient;
|
|
|
@@ -2046,6 +2049,8 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
if (("1").equals(vo.getCopyType())) {
|
|
|
//选中节点
|
|
|
WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
|
+ //获取扩展表信息,同时复制扩展表信息 要考虑复制节点下存在其他子级节点
|
|
|
+ List<WbsTreeContractExtend> wbsTreeContractExtend = wbsTreeContractExtendClient.getByPKeyId(needCopyNode);
|
|
|
|
|
|
/*结果集-节点表*/
|
|
|
List<WbsTreeContract> saveList = new ArrayList<>();
|
|
|
@@ -2157,6 +2162,17 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
logger.info("以下元素表没有获取到对应实体表数据,已跳过 ===> 表pKeyId:[{}]", StringUtils.join(continuePkeyIds, ","));
|
|
|
}
|
|
|
}
|
|
|
+ //根据旧节点 pkid 获取新节点pkid
|
|
|
+ if(wbsTreeContractExtend != null){
|
|
|
+ wbsTreeContractExtend.forEach(f->{
|
|
|
+ f.setPKeyId(oldPKeyIdToNewPKeyIdMap.get(f.getPKeyId()));
|
|
|
+ });
|
|
|
+ List<WbsTreeContractExtend> collect = wbsTreeContractExtend.stream().filter(f -> f.getPKeyId() != null).collect(Collectors.toList());
|
|
|
+ if(!collect.isEmpty()){
|
|
|
+ //排除没有扩展表记录的节点
|
|
|
+ Boolean b = wbsTreeContractExtendClient.saveList(collect);
|
|
|
+ }
|
|
|
+ }
|
|
|
// 节点+表节点
|
|
|
for (WbsTreeContract nodeOld : nodeChildAll) {
|
|
|
//新节点
|
|
|
@@ -2376,6 +2392,8 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
}
|
|
|
|
|
|
WbsTreeContract needCopyNodeRoot = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
|
|
|
+ //获取当前节点扩展表
|
|
|
+ List<WbsTreeContractExtend> contractExtends = wbsTreeContractExtendClient.getByPKeyId(needCopyNodeRoot);
|
|
|
if (needCopyNodeRoot != null) {
|
|
|
/*缓存需要复制的节点、表信息*/
|
|
|
Map<String, List<WbsTreeContract>> needCopyNodeAndTabMap = new HashMap<>();
|
|
|
@@ -2553,6 +2571,9 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
if (nodes.size() > 0) {
|
|
|
/*复制formulaOption*/
|
|
|
this.copyFormulaOptions(nodes, peerMap);
|
|
|
+ /*复制扩展表数据*/
|
|
|
+ List<WbsTreeContractExtend> saveContractExtend = this.copyContractExtend(contractExtends, peerMap);
|
|
|
+ wbsTreeContractExtendClient.saveList(saveContractExtend);
|
|
|
}
|
|
|
if (row) {
|
|
|
//更新redis缓存
|
|
|
@@ -2590,6 +2611,33 @@ public R<Boolean> copyContractTreeNode(@RequestBody CopyContractTreeNodeVO vo) {
|
|
|
return R.fail("操作失败");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 复制合同段扩展表
|
|
|
+ * @param contractExtends 旧节点扩展表信息
|
|
|
+ * @param map 新节点与旧节点 映射关系
|
|
|
+ * */
|
|
|
+ private List<WbsTreeContractExtend> copyContractExtend(List<WbsTreeContractExtend> contractExtends, Map<Long, Long> map) {
|
|
|
+ List<WbsTreeContractExtend> wbsTreeContractExtends = new ArrayList<>();
|
|
|
+ contractExtends.forEach(f->{
|
|
|
+ //根基旧节点查询新节点信息,一个旧节点可能存在多个新节点数据
|
|
|
+ List<Long> cities = map.entrySet()
|
|
|
+ .stream()
|
|
|
+ .filter(entry -> f.getPKeyId().equals(entry.getValue()))
|
|
|
+ .map(Map.Entry::getKey)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if(CollectionUtil.isNotEmpty(cities)){
|
|
|
+ cities.forEach(c->{
|
|
|
+ WbsTreeContractExtend wbsTreeContractExtend = BeanUtil.copyProperties(f, WbsTreeContractExtend.class);
|
|
|
+ if(wbsTreeContractExtend != null){
|
|
|
+ wbsTreeContractExtend.setPKeyId(c);
|
|
|
+ wbsTreeContractExtends.add(wbsTreeContractExtend);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return wbsTreeContractExtends;
|
|
|
+ }
|
|
|
+
|
|
|
@Async
|
|
|
public void copyFormulaOptions(List<WbsTreeContract> saveList, Map<Long, Long> peerMap) {
|
|
|
if (peerMap.size() > 0) {
|