|
@@ -1653,17 +1653,27 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//更新redis缓存
|
|
|
informationQueryService.delAsyncWbsTree(contractId);
|
|
|
}
|
|
|
- String nodeName = vo.getNeedCopyNodeName();
|
|
|
+ //拼接操作记录
|
|
|
+ List<CopyContractTreeNodeVO.CopyBatch> list = vo.getCopyBatchToPaths();
|
|
|
+ Set<String> titles = new HashSet<>();
|
|
|
+ list.stream().forEach(l->titles.add(l.getTitle()));
|
|
|
StringBuilder addNames = new StringBuilder();
|
|
|
- addNames.append(nodeName+"-");
|
|
|
- addNames.append("[");
|
|
|
- for (WbsTreeContract node : toCopyNodes) {
|
|
|
- addNames.append(node.getNodeName() + "-");
|
|
|
+ addNames.append("{");
|
|
|
+ for (String title : titles) {
|
|
|
+ addNames.append(title+"-[");
|
|
|
+ for (CopyContractTreeNodeVO.CopyBatch li : list) {
|
|
|
+ if (title.equals(li.getTitle())){
|
|
|
+ addNames.append(li.getNodeName()+",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ addNames.setLength(addNames.length()-1);
|
|
|
+ addNames.append("],");
|
|
|
}
|
|
|
- String substring = addNames.substring(0, addNames.length() - 1);
|
|
|
- needCopyNodeRoot.setNodeName(substring + "]");
|
|
|
+ addNames.setLength(addNames.length()-1);
|
|
|
+ addNames.append("}");
|
|
|
+ needCopyNodeRoot.setNodeName(addNames.toString());
|
|
|
// return R.success("操作成功");
|
|
|
- return this.saveOrCopyNodeTree(addNodeList, null, 32, needCopyNodeRoot);
|
|
|
+ return this.saveOrCopyNodeTree2(addNodeList, null, 32, needCopyNodeRoot);
|
|
|
} else {
|
|
|
throw new ServiceException("没有找到需要复制的节点信息,请联系管理员");
|
|
|
}
|
|
@@ -2882,6 +2892,53 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
return R.data(false);
|
|
|
}
|
|
|
|
|
|
+ @NotNull
|
|
|
+ private R<Boolean> saveOrCopyNodeTree2
|
|
|
+ (List<WbsTreeContract> saveList, List<ConstructionLedger> saveLedger, Integer
|
|
|
+ operationType, WbsTreeContract currentNode) {
|
|
|
+
|
|
|
+ if (saveList.size() > 0) {
|
|
|
+// StringBuilder str = new StringBuilder();
|
|
|
+// str.append("-" + saveList.get(0).getFullName());
|
|
|
+ //保存施工日志
|
|
|
+ /*if (saveLedger.size() > 0) {
|
|
|
+ this.constructionLedgerService.saveBatch(saveLedger, 1000);
|
|
|
+ str.append("-[");
|
|
|
+ for (ConstructionLedger ledger : saveLedger) {
|
|
|
+ str.append(ledger.getSite() + ",");
|
|
|
+ }
|
|
|
+ str.deleteCharAt(str.length() - 1);
|
|
|
+ str.append("]");
|
|
|
+ }*/
|
|
|
+
|
|
|
+ try {
|
|
|
+ //获取当前节点的所有父节点
|
|
|
+ List<WbsTreeContract> result = new ArrayList<>();
|
|
|
+ result.add(currentNode);
|
|
|
+ this.queryParentNode(currentNode, result);
|
|
|
+ StringBuilder pathName = new StringBuilder();
|
|
|
+ for (int i = 1, l = result.size()-1; i < l; i++) {
|
|
|
+ WbsTreeContract node = result.get(result.size() - i);
|
|
|
+ pathName.append("-").append(StringUtils.isNotEmpty(node.getFullName()) ? node.getFullName() : node.getNodeName());
|
|
|
+ }
|
|
|
+ pathName.append("-" + currentNode.getNodeName());
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("operationObjIds", JSONArray.parseArray(JSONObject.toJSONString(saveList.stream().map(WbsTreeContract::getPKeyId).distinct().collect(Collectors.toList())), String.class));
|
|
|
+ json.put("operationObjName", pathName.substring(1));
|
|
|
+ //保存操作记录
|
|
|
+ this.operationLogClient.saveUserOperationLog(operationType, "资料管理", "工序资料", json);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ //保存节点(10s)
|
|
|
+ Boolean aBoolean = this.wbsTreeContractClient.saveBatch(saveList);
|
|
|
+ return R.data(aBoolean);
|
|
|
+ }
|
|
|
+
|
|
|
+ return R.data(false);
|
|
|
+ }
|
|
|
+
|
|
|
private void queryParentNode(WbsTreeContract currentNode, List<WbsTreeContract> result) {
|
|
|
WbsTreeContract parentNode = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(currentNode.getParentId(), Long.parseLong(currentNode.getContractId()));
|
|
|
if (parentNode != null) {
|