فهرست منبع

Merge remote-tracking branch 'origin/master' into master

yangyj 3 سال پیش
والد
کامیت
bbba01ee15
29فایلهای تغییر یافته به همراه611 افزوده شده و 116 حذف شده
  1. 3 2
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/OperationLogClient.java
  2. 22 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/MessageWarningVO.java
  3. 19 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/wrapper/MessageWarningWrapper.java
  4. 4 1
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/WbsTreePrivateClient.java
  5. 6 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractTreeVO3.java
  6. 4 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractTreeVOS.java
  7. 17 4
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ArchiveFileController.java
  8. 20 4
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractLogController.java
  9. 5 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java
  10. 110 27
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  11. 94 5
      blade-service/blade-business/src/main/java/org/springblade/business/controller/MessageWarningController.java
  12. 24 0
      blade-service/blade-business/src/main/java/org/springblade/business/controller/UserOpinionController.java
  13. 33 1
      blade-service/blade-business/src/main/java/org/springblade/business/controller/UserOpinionFlowController.java
  14. 10 5
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/OperationLogClientImpl.java
  15. 4 1
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/MessageWarningServiceImpl.java
  16. 8 8
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsFormElementController.java
  17. 3 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeController.java
  18. 61 15
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java
  19. 3 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java
  20. 5 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreePrivateClientImpl.java
  21. 0 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml
  22. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java
  23. 26 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml
  24. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.java
  25. 21 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.xml
  26. 17 15
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsFormElementServiceImpl.java
  27. 7 6
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java
  28. 44 7
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java
  29. 37 6
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeServiceImpl.java

+ 3 - 2
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/OperationLogClient.java

@@ -1,5 +1,6 @@
 package org.springblade.business.feign;
 
+import com.alibaba.fastjson.JSONObject;
 import org.springblade.common.constant.BusinessConstant;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -18,9 +19,9 @@ public interface OperationLogClient {
     /**
      * 保存操作日志
      * @param type 操作类型,详见业务字典中操作类型
-     * @param operationObjIds 操作的业务对象ID
+     * @param json 操作的业务数据
      */
     @PostMapping(API_PREFIX + "/saveUserOperationLog")
-    void saveUserOperationLog(@RequestParam Integer type, @RequestParam String operationModule, @RequestParam String operationView, @RequestBody List<String> operationObjIds, @RequestParam String operationObjName);
+    void saveUserOperationLog(@RequestParam Integer type, @RequestParam String operationModule, @RequestParam String operationView, @RequestBody JSONObject json);
 
 }

+ 22 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/MessageWarningVO.java

@@ -25,6 +25,7 @@ import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.secure.utils.AuthUtil;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 视图实体类
@@ -43,6 +44,27 @@ public class MessageWarningVO extends MessageWarning {
 	@ApiModelProperty("结束时间")
 	private String endTime;
 
+	@ApiModelProperty("类型")
+	private String typeValue;
+
+	@ApiModelProperty("任务催办未读数量")
+	private Long typeOneNumber;
+
+	@ApiModelProperty("监测预警未读数量")
+	private Long typeTowNumber;
+
+	@ApiModelProperty("废除通知未读数量")
+	private Long typeThreeNumber;
+
+	@ApiModelProperty("工单反馈未读数量")
+	private Long typeFourNumber;
+
+	@ApiModelProperty("系统消息未读数量")
+	private Long typeFiveNumber;
+
+	@ApiModelProperty("用以批量标记已读,所勾选的列表数据ID")
+	private List<String> ids;
+
 	public MessageWarningVO(Long projectId, Long contractId, Integer type, String content, Long pushUser, Integer isRead){
 		this.setId(SnowFlakeUtil.getId());
 		this.setProjectId(projectId);

+ 19 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/wrapper/MessageWarningWrapper.java

@@ -0,0 +1,19 @@
+package org.springblade.business.wrapper;
+
+import org.springblade.business.entity.MessageWarning;
+import org.springblade.business.vo.MessageWarningVO;
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+
+import java.util.Objects;
+
+public class MessageWarningWrapper extends BaseEntityWrapper<MessageWarning, MessageWarningVO> {
+
+    public static MessageWarningWrapper build(){return new MessageWarningWrapper();}
+
+    @Override
+    public MessageWarningVO entityVO(MessageWarning entity){
+        return Objects.requireNonNull(BeanUtil.copy(entity, MessageWarningVO.class));
+    }
+
+}

+ 4 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/WbsTreePrivateClient.java

@@ -20,6 +20,9 @@ public interface WbsTreePrivateClient {
      */
     String API_PREFIX = "/api/manager/WbsTreePrivate";
 
+    @PostMapping(API_PREFIX + "/queryAllNodeByProjectId")
+    List<WbsTreePrivate> queryAllNodeByProjectId(@RequestParam String projectId);
+
     @PostMapping(API_PREFIX + "/queryExcelTableByParentId")
     List<WbsTreePrivate> queryExcelTableByParentId(@RequestBody WbsTreePrivate treePrivate);
 
@@ -27,7 +30,7 @@ public interface WbsTreePrivateClient {
     List<WbsTreePrivate> queryChildByParentId(@RequestBody WbsTreePrivate treePrivate);
 
     @PostMapping(API_PREFIX + "/queryByPKeyIds")
-    List<WbsTreePrivate> queryByPKeyIds(@RequestParam List<String> ids);
+    List<WbsTreePrivate> queryByPKeyIds(@RequestBody List<String> ids);
 
     @PostMapping(API_PREFIX + "/queryPeersNodeByProjectIdAndId")
     WbsTreePrivate queryPeersNodeByProjectIdAndId(@RequestParam String projectId, @RequestParam Long id);

+ 6 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractTreeVO3.java

@@ -67,4 +67,10 @@ public class WbsTreeContractTreeVO3 implements INode<WbsTreeContractTreeVO3> {
 
     private String title;
 
+    private Long originallyId;
+
+    private Long originallyPkeyId;
+
+    private boolean notExsitChild;
+
 }

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsTreeContractTreeVOS.java

@@ -82,6 +82,10 @@ public class WbsTreeContractTreeVOS extends WbsTreeContract implements INode<Wbs
 
     private Integer majorDataType;
 
+    private Long originallyId;
+
+    private Long originallyPkeyId;
+
     @Override
     public List<WbsTreeContractTreeVOS> getChildren() {
         if (this.children == null) {

+ 17 - 4
blade-service/blade-business/src/main/java/org/springblade/business/controller/ArchiveFileController.java

@@ -177,12 +177,18 @@ public class ArchiveFileController extends BladeController {
 								//默认未读
 								0
 						));
+
+						//保存操作记录
+						JSONObject json = new JSONObject();
+						json.put("operationObjIds", Func.toStrList(archiveFile.getId().toString()));
+						json.put("operationObjName", archiveFile.getFileName());
+						this.operationLogClient.saveUserOperationLog(26, "其它文件", "工程文件", json);
+
 					}catch (Exception e){
 						e.printStackTrace();
 					}
 
-					//保存操作记录
-					this.operationLogClient.saveUserOperationLog(26, "其它文件", "工程文件", Func.toStrList(archiveFile.getId().toString()), archiveFile.getFileName());
+
 				}
 			}
 		}
@@ -212,7 +218,10 @@ public class ArchiveFileController extends BladeController {
 			}
 
 			//新增操作日志
-			this.operationLogClient.saveUserOperationLog(25, "其它文件", "工程文件", Func.toStrList(archiveTaskIds), title);
+			JSONObject json = new JSONObject();
+			json.put("operationObjIds", Func.toStrList(archiveTaskIds));
+			json.put("operationObjName", title);
+			this.operationLogClient.saveUserOperationLog(25, "其它文件", "工程文件", json);
 
 			//启动流程
 			this.taskClient.startTask(taskVO);
@@ -338,7 +347,11 @@ public class ArchiveFileController extends BladeController {
 				}
 
 				//保存操作日志
-				this.operationLogClient.saveUserOperationLog(27, "其他文件", "工程文件", Func.toStrList(ids), title);
+				JSONObject json = new JSONObject();
+				json.put("operationObjIds", Func.toStrList(ids));
+				json.put("operationObjName", title);
+
+				this.operationLogClient.saveUserOperationLog(27, "其他文件", "工程文件", json);
 
 				//保存回收站记录
 				this.recycleBinClient.saveDelBusinessData(Func.toStrList(ids), title, 1, position, fileList.get(0).getProjectId(), fileList.get(0).getContractId());

+ 20 - 4
blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractLogController.java

@@ -1,5 +1,6 @@
 package org.springblade.business.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@@ -100,12 +101,18 @@ public class ContractLogController extends BladeController {
 								0
 
 						));
+
+						//保存操作记录
+						JSONObject json = new JSONObject();
+						json.put("operationObjIds", Func.toStrList(task.getFormDataId()));
+						json.put("operationObjName", contractLog.getFileName());
+
+						this.operationLogClient.saveUserOperationLog(9, "台账日志", "日志填报", json);
+
 					}catch (Exception e){
 						e.printStackTrace();
 					}
 
-					//保存操作记录
-					this.operationLogClient.saveUserOperationLog(9, "台账日志", "日志填报", Func.toStrList(task.getFormDataId()), contractLog.getFileName());
 				}
 			}
 		}
@@ -144,8 +151,17 @@ public class ContractLogController extends BladeController {
 					title = contractLogs.stream().map(ContractLog::getFileName).distinct().collect(Collectors.joining());
 				}
 
-				//保存操作记录
-				this.operationLogClient.saveUserOperationLog(8, "台账日志", "日志填报", Func.toStrList(startTaskVO.getIds()), title);
+				try{
+					//保存操作记录
+					JSONObject json = new JSONObject();
+					json.put("operationObjIds", Func.toStrList(startTaskVO.getIds()));
+					json.put("operationObjName", title);
+
+					this.operationLogClient.saveUserOperationLog(8, "台账日志", "日志填报", json);
+				}catch (Exception e){
+					e.printStackTrace();
+				}
+
 				return R.data(true);
 			}
 		}

+ 5 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/ImageClassificationFileController.java

@@ -589,7 +589,11 @@ public class ImageClassificationFileController extends BladeController {
 			}
 
 			//保存操作日志
-			this.operationLogClient.saveUserOperationLog(31, "其它文件", "影像资料", Func.toStrList(ids), title);
+			JSONObject json = new JSONObject();
+			json.put("operationObjIds", Func.toStrList(ids));
+			json.put("operationObjName", title);
+
+			this.operationLogClient.saveUserOperationLog(31, "其它文件", "影像资料", json);
 
 			//保存回收站记录
 			this.recycleBinClient.saveDelBusinessData(Func.toStrList(ids), title, 1, position, fileList.get(0).getProjectId().toString(), fileList.get(0).getContractId().toString());

+ 110 - 27
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -36,11 +36,9 @@ import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.evisa.feign.EVisaClient;
 import org.springblade.evisa.vo.CertBeanVO;
-import org.springblade.manager.entity.ContractInfo;
-import org.springblade.manager.entity.ContractRelationJlyz;
-import org.springblade.manager.entity.WbsTreeContract;
-import org.springblade.manager.entity.WbsTreePrivate;
+import org.springblade.manager.entity.*;
 import org.springblade.manager.feign.ContractClient;
+import org.springblade.manager.feign.ProjectClient;
 import org.springblade.manager.feign.WbsTreeContractClient;
 import org.springblade.manager.feign.WbsTreePrivateClient;
 import org.springblade.manager.vo.WbsTreeContractTreeVOS;
@@ -101,6 +99,8 @@ public class InformationWriteQueryController extends BladeController {
 
 	private final MessageWarningClient messageWarningClient;
 
+	private final ProjectClient projectClient;
+
 	/**
 	 * 初始化合同段导图树
 	 */
@@ -564,12 +564,34 @@ public class InformationWriteQueryController extends BladeController {
 					if(queries != null && queries.size() > 0){
 						title = queries.stream().map(InformationQuery::getName).distinct().collect(Collectors.joining());
 
+						List<Long> projectIds = queries.stream().map(InformationQuery::getProjectId).distinct().collect(Collectors.toList());
+						List<Long> contractIds = queries.stream().map(InformationQuery::getContractId).distinct().collect(Collectors.toList());
+
+						List<ProjectInfo> projects = this.projectClient.queryProjectList(JSONArray.parseArray(JSONObject.toJSONString(projectIds), String.class));
+						List<ContractInfo> contracts = this.contractClient.queryContractListByIds(contractIds);
+
+						Map<String, ProjectInfo> projectMap = new HashMap<>();
+						Map<String, ContractInfo> contractMap = new HashMap<>();
+						projects.forEach(project -> projectMap.put(project.getId().toString(), project));
+						contracts.forEach(contract -> contractMap.put(contract.getId().toString(), contract));
+
 						for(InformationQuery query : queries){
 							if(StringUtils.isNotEmpty(query.getFileUserIdAndName())){
 								String[] userArray = query.getFileUserIdAndName().split(",");
 								for(String str : userArray){
 									String[] strs = str.split("-");
 									try{
+										String projectName = "", contractName = "";
+										if(projectMap.containsKey(query.getProjectId().toString())){
+											ProjectInfo project = projectMap.get(query.getProjectId().toString());
+											projectName = StringUtils.isNotEmpty(project.getProjectAlias()) ? project.getProjectAlias() : project.getProjectName();
+										}
+										if(contractMap.containsKey(query.getContractId().toString())){
+											ContractInfo contract = contractMap.get(query.getContractId().toString());
+											contractName = contract.getContractName();
+										}
+
+
 										//保存通知记录
 										this.messageWarningClient.savePushUserMessageWarning(
 												new MessageWarningVO(
@@ -578,7 +600,7 @@ public class InformationWriteQueryController extends BladeController {
 														//废除通知
 														3,
 														//内容
-														AuthUtil.getNickName() + "废除了【" + query.getName() + "】",
+														projectName + contractName + "的用户【" + AuthUtil.getNickName() + "废除了【" + query.getName() + "】",
 														//推送的目标人
 														Long.parseLong(strs[0]),
 														//默认未读
@@ -590,13 +612,17 @@ public class InformationWriteQueryController extends BladeController {
 								}
 							}
 						}
-
-
 					}
-
-
-					//保存操作记录
-					this.operationLogClient.saveUserOperationLog(6, "资料管理", "工序资料", Func.toStrList(task.getFormDataId()), title);
+					try{
+						JSONObject json = new JSONObject();
+						json.put("operationObjIds", Func.toStrList(task.getFormDataId()));
+						json.put("operationObjName", title);
+
+						//保存操作记录
+						this.operationLogClient.saveUserOperationLog(6, "资料管理", "工序资料", json);
+					}catch (Exception e){
+						e.printStackTrace();
+					}
 				}
 				return R.data(true, "废除成功");
 			}catch (Exception e){
@@ -651,8 +677,16 @@ public class InformationWriteQueryController extends BladeController {
 					title = queries.stream().map(InformationQuery::getName).distinct().collect(Collectors.joining());
 				}
 
-				//保存操作记录
-				this.operationLogClient.saveUserOperationLog(5, "资料管理", "工序资料", Func.toStrList(startTaskVO.getIds()), title);
+				try{
+					//保存操作记录
+					JSONObject json = new JSONObject();
+					json.put("operationObjIds", Func.toStrList(startTaskVO.getIds()));
+					json.put("operationObjName", title);
+
+					this.operationLogClient.saveUserOperationLog(5, "资料管理", "工序资料", json);
+				}catch (Exception e){
+					e.printStackTrace();
+				}
 				return R.data(true);
 			}
 		}
@@ -696,11 +730,16 @@ public class InformationWriteQueryController extends BladeController {
 		//首先查询需要复制的节点及其下级所有子节点的信息
 		WbsTreeContract needCopyNode = this.wbsTreeContractClient.getContractNodeByPrimaryKeyId(vo.getNeedCopyPrimaryKeyId());
 
+		//获取当前合同段所有节点
+
 		List<WbsTreeContract> parentList = new ArrayList<>(), childList = new ArrayList<>(), allList = new ArrayList<>(), saveList = new ArrayList<>();
 		//新增施工台账
 		List<ConstructionLedger> saveLedger = new ArrayList<>();
 
 		parentList.add(needCopyNode);
+
+//		this.wbsTreeContractClient.searchContractTree(needCopyNode.getContractId());
+
 		//查询所有有效子节点
 		this.foreachQueryChildContract(parentList, childList);
 		allList.addAll(parentList);
@@ -872,7 +911,13 @@ public class InformationWriteQueryController extends BladeController {
 			if(contractNodeMap.containsKey(newData.getOldId())){
 				WbsTreeContract contractNode = contractNodeMap.get(newData.getOldId());
 				if(contractNode.getParentId() != null && StringUtils.isNotEmpty(contractNode.getParentId().toString())){
-					WbsTreeContract parentNode = this.wbsTreeContractClient.queryCurrentNodeAllParent(Long.parseLong(contractNode.getContractId()), contractNode.getParentId());
+					WbsTreeContract parentNode;
+					if(contractNodeMap.containsKey(contractNode.getParentId().toString())){
+						parentNode = contractNodeMap.get(contractNode.getParentId().toString());
+					} else {
+						parentNode = this.wbsTreeContractClient.queryCurrentNodeAllParent(Long.parseLong(contractNode.getContractId()), contractNode.getParentId());
+					}
+
 					if(parentNode != null){
 						ledger.setStation(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getDeptName());
 					}
@@ -882,8 +927,15 @@ public class InformationWriteQueryController extends BladeController {
 			if(projectNodeMap.containsKey(newData.getOldId())){
 				WbsTreePrivate contractNode = projectNodeMap.get(newData.getOldId());
 				if(contractNode.getParentId() != null && StringUtils.isNotEmpty(contractNode.getParentId().toString())){
-					WbsTreePrivate parentNode = this.wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(contractNode.getProjectId(), contractNode.getParentId());
-					ledger.setStation(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getDeptName());
+					WbsTreePrivate parentNode;
+					if(projectNodeMap.containsKey(contractNode.getParentId().toString())){
+						parentNode = projectNodeMap.get(contractNode.getParentId().toString());
+					} else {
+						parentNode = this.wbsTreePrivateClient.queryPeersNodeByProjectIdAndId(contractNode.getProjectId(), contractNode.getParentId());
+					}
+					if(parentNode != null){
+						ledger.setStation(StringUtils.isNotEmpty(parentNode.getFullName()) ? parentNode.getFullName() : parentNode.getDeptName());
+					}
 				}
 			}
 		}
@@ -1105,7 +1157,16 @@ public class InformationWriteQueryController extends BladeController {
 		WbsTreeContract queries = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(pKeyId);
 
 		//保存操作记录
-		this.operationLogClient.saveUserOperationLog(3, "资料管理", "工序资料", Func.toStrList(pKeyId.toString()), StringUtils.isNotEmpty(queries.getFullName()) ? queries.getFullName() : queries.getDeptName());
+		try{
+			JSONObject json = new JSONObject();
+			json.put("operationObjIds", Func.toStrList(pKeyId.toString()));
+			json.put("operationObjName", StringUtils.isNotEmpty(queries.getFullName()) ? queries.getFullName() : queries.getDeptName());
+
+			this.operationLogClient.saveUserOperationLog(3, "资料管理", "工序资料", json);
+		}catch (Exception e){
+			e.printStackTrace();
+		}
+
 		return R.data(this.wbsTreeContractClient.updateContractNodeParameter(node));
 	}
 
@@ -1185,7 +1246,12 @@ public class InformationWriteQueryController extends BladeController {
 
 		//保存操作记录
 		List<String> idArray = JSONArray.parseArray(JSONObject.toJSONString(ids.split(",")), String.class);
-		this.operationLogClient.saveUserOperationLog(4, "资料管理", "工序资料", idArray, nodeName);
+
+		JSONObject json = new JSONObject();
+		json.put("operationObjIds", idArray);
+		json.put("operationObjName", nodeName);
+		this.operationLogClient.saveUserOperationLog(4, "资料管理", "工序资料", json);
+
 		//保存进回收站
 		this.recycleBinClient.saveDelBusinessData(idArray, StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getDeptName(), 2, parentNodeName.toString(), removeNode.getProjectId(), removeNode.getContractId());
 
@@ -1223,9 +1289,15 @@ public class InformationWriteQueryController extends BladeController {
 				//查询数据
 				selectedNodeList = this.unifiedCode(allSelectedNodeList, treeContract);
 
-				//全选的集合则进一步向下查询
+				//检查当前操作的节点是否是填报节点,如果是则需要查询相关联表格
+				List<WbsTreePrivate> submitNodeList = selectedNodeList.stream().filter(treePrivate -> Arrays.asList("1,2,3,4".split(",")).contains(treePrivate.getMajorDataType().toString())).distinct().collect(Collectors.toList());
+
 				List<WbsTreePrivate> childList = new ArrayList<>();
-				this.foreachQueryChild(selectedNodeList, childList);
+				if(submitNodeList.size() > 0){
+					this.foreachQueryChild(submitNodeList, childList);
+					//将表格数据设置
+					selectedNodeList.addAll(childList);
+				}
 
 				if(childList.size() > 0){
 					//处理重复的数据
@@ -1372,11 +1444,13 @@ public class InformationWriteQueryController extends BladeController {
 			if(saveLedger.size() > 0){
 				this.constructionLedgerService.saveBatch(saveLedger);
 			}
+
 			try{
+				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", saveList.stream().map(wbs -> StringUtils.isNotEmpty(wbs.getFullName()) ? wbs.getFullName() : wbs.getDeptName()).collect(Collectors.joining()));
 				//保存操作记录
-				this.operationLogClient.saveUserOperationLog(operationType, "资料管理", "工序资料",
-						JSONArray.parseArray(JSONObject.toJSONString(saveList.stream().map(WbsTreeContract::getPKeyId).distinct().collect(Collectors.toList())), String.class),
-						saveList.stream().map(wbs -> StringUtils.isNotEmpty(wbs.getFullName()) ? wbs.getFullName() : wbs.getDeptName()).collect(Collectors.joining()));
+				this.operationLogClient.saveUserOperationLog(operationType, "资料管理", "工序资料", json);
 
 			}catch (Exception e){
 				e.printStackTrace();
@@ -1411,12 +1485,12 @@ public class InformationWriteQueryController extends BladeController {
 	 */
 	private void foreachQueryChild(List<WbsTreePrivate> parentList, List<WbsTreePrivate> childList){
 		parentList.forEach(parent -> {
-			//查询子节点
 			List<WbsTreePrivate> childs = this.wbsTreePrivateClient.queryChildByParentId(parent);
+
 			if(childs != null && childs.size() > 0){
 				//添加入结果集
 				childList.addAll(childs);
-				//还有子级,继续向下
+				//继续向下检查子集
 				this.foreachQueryChild(childs, childList);
 			}
 		});
@@ -1554,6 +1628,11 @@ public class InformationWriteQueryController extends BladeController {
 		submitNodeKeyIds.add(vo.getWbsId().toString());
 		//查询当前节点下的所有填报节点
 		WbsTreeContract node = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(vo.getWbsId());
+		if(node == null){
+			//这一步主要是为了兼容监理合同段
+			node = this.wbsTreeContractClient.getContractWbsTreeByContractIdAndId(vo.getWbsId(), Long.parseLong(vo.getContractIdRelation()));
+		}
+
 		if(!new Integer("6").equals(node.getDeptCategory()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())){
 			//不是工序,则查询当前节点下的所有填报节点
 			List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(node.getId().toString(), contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
@@ -1585,7 +1664,10 @@ public class InformationWriteQueryController extends BladeController {
 			@ApiImplicitParam(name = "parentId", value = "父节点,为空则查询第一级节点"),
 			@ApiImplicitParam(name = "contractId", value = "合同段ID", required = true)
 	})
-	public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByContractIdAndType(@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation){
+	public R<List<WbsTreeContractTreeVOS>> queryContractWbsTreeByContractIdAndType(@RequestParam String primaryKeyId,@RequestParam String parentId, @RequestParam String contractId, @RequestParam String contractIdRelation){
+		if (StringUtils.isNotEmpty(primaryKeyId)){
+			parentId = primaryKeyId;
+		}
 		List<WbsTreeContractTreeVOS> rootTreeNode = this.queryContractTree(parentId, contractId, contractIdRelation);
 		rootTreeNode = rootTreeNode.stream().filter(vo -> vo.getDeptCategory() != 111).collect(Collectors.toList());
 
@@ -1754,7 +1836,8 @@ public class InformationWriteQueryController extends BladeController {
 			}
 
 			rootTreeNode.forEach(vo -> {
-				String primaryKeyId = new Integer("2").equals(contractInfo.getContractType()) ? vo.getId().toString() : vo.getPrimaryKeyId();
+//				String primaryKeyId = new Integer("2").equals(contractInfo.getContractType()) ? vo.getId().toString() : vo.getPrimaryKeyId();
+				String primaryKeyId = vo.getPrimaryKeyId();
 
 				if(new Integer("1").equals(contractInfo.getContractType())){
 					if(StringUtils.isEmpty(parentId) || "0".equals(parentId)){

+ 94 - 5
blade-service/blade-business/src/main/java/org/springblade/business/controller/MessageWarningController.java

@@ -16,7 +16,9 @@
  */
 package org.springblade.business.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -24,12 +26,15 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.time.DateUtils;
 import org.springblade.business.entity.MessageWarning;
 import org.springblade.business.vo.MessageWarningVO;
+import org.springblade.business.wrapper.MessageWarningWrapper;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
@@ -50,7 +55,7 @@ import java.util.List;
  */
 @RestController
 @AllArgsConstructor
-@RequestMapping("/OperationWarning")
+@RequestMapping("/messageWarning")
 @Api(value = "消息提醒", tags = "消息提醒接口")
 public class MessageWarningController extends BladeController {
 
@@ -58,6 +63,68 @@ public class MessageWarningController extends BladeController {
 
 	private final IDictBizClient dictBizClient;
 
+	/**
+	 * 标记已读
+	 */
+	@PostMapping("/setMessageWarningRead")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "标记已读")
+	public R<Boolean> setMessageWarningRead(MessageWarningVO vo){
+		if(vo.getIds() != null && vo.getIds().size() > 0){
+			try{
+				this.messageWarningService.update(Wrappers.<MessageWarning>lambdaUpdate().set(MessageWarning::getIsRead, 1).in(MessageWarning::getId, vo.getIds()));
+				return R.data(true);
+			}catch (Exception e){
+				e.printStackTrace();
+			}
+		}
+		return R.data(300, false, "标记失败");
+	}
+
+	/**
+	 * 获取当前用户的消息数量
+	 */
+	@GetMapping("/queryCurrentUserMessageCount")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "获取当前用户的消息数量")
+	public R<MessageWarningVO> queryCurrentUserMessageCount(){
+		MessageWarningVO vo = new MessageWarningVO();
+
+		for(int i = 1, l = 6; i < l; i ++){
+			LambdaQueryWrapper<MessageWarning> wrapper = Wrappers.lambdaQuery();
+			//当前用户
+			wrapper.eq(MessageWarning::getPushUser, AuthUtil.getUserId());
+			wrapper.eq(MessageWarning::getType, i);
+			wrapper.eq(MessageWarning::getIsRead, 0);
+
+			//获取数量
+			Long typeNumber = this.messageWarningService.count(wrapper);
+
+			switch (i){
+				case 1:
+					vo.setTypeOneNumber(typeNumber);
+					break;
+				case 2:
+					vo.setTypeTowNumber(typeNumber);
+					break;
+				case 3:
+					vo.setTypeThreeNumber(typeNumber);
+					break;
+				case 4:
+					vo.setTypeFourNumber(typeNumber);
+					break;
+				case 5:
+					vo.setTypeFiveNumber(typeNumber);
+					break;
+				default:
+					break;
+			}
+
+		}
+
+		return R.data(vo);
+	}
+
 	/**
 	 * 获取消息类型(左侧菜单)
 	 */
@@ -78,18 +145,40 @@ public class MessageWarningController extends BladeController {
 	@GetMapping("/list")
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "分页", notes = "传入operationWarning")
-	public R<IPage<MessageWarning>> list(MessageWarningVO vo, Query query) {
+	public R<IPage<MessageWarningVO>> list(MessageWarningVO vo, Query query) {
+		//置空项目及合同段ID
+		vo.setProjectId(null);
+		vo.setContractId(null);
+
 		QueryWrapper<MessageWarning> wrapper = Condition.getQueryWrapper(vo);
 		//获取当前人的数据
 		wrapper.lambda().eq(MessageWarning::getPushUser, AuthUtil.getUserId().toString());
 		if(StringUtils.isNotEmpty(vo.getStartTime())){
-			wrapper.lambda().between(MessageWarning::getCreateTime, vo.getStartTime(), vo.getEndTime());
+			wrapper.lambda().between(MessageWarning::getCreateTime, vo.getStartTime(), DateUtil.format(DateUtils.addDays(DateUtil.parse(vo.getEndTime(), "yyyy-MM-dd"), 1), "yyyy-MM-dd"));
 		}
 
 		//时间倒序,状态正序(已读在后,未读在前)
-		wrapper.lambda().orderByDesc(MessageWarning::getCreateTime).orderByAsc(MessageWarning::getStatus);
+		wrapper.lambda().orderByDesc(MessageWarning::getCreateTime).orderByAsc(MessageWarning::getIsRead);
+
+		IPage<MessageWarningVO> iPage = MessageWarningWrapper.build().pageVO(this.messageWarningService.page(Condition.getPage(query), wrapper));
+
+		if(iPage.getRecords() != null && iPage.getRecords().size() > 0){
+			//获取类型
+			List<DictBiz> dictBizs = this.dictBizClient.getList("business_message_type", "notRoot").getData();
+
+			iPage.getRecords().forEach(reVO -> {
+				if(dictBizs != null && dictBizs.size() > 0){
+					for(DictBiz biz : dictBizs){
+						if(biz.getDictKey().equals(reVO.getType().toString())){
+							reVO.setTypeValue(biz.getDictValue());
+							break;
+						}
+					}
+				}
+			});
+		}
 
-		return R.data(this.messageWarningService.page(Condition.getPage(query), wrapper));
+		return R.data(iPage);
 	}
 
 	

+ 24 - 0
blade-service/blade-business/src/main/java/org/springblade/business/controller/UserOpinionController.java

@@ -17,6 +17,7 @@ import org.springblade.business.feign.MessageWarningClient;
 import org.springblade.business.service.IUserOpinionFileService;
 import org.springblade.business.service.IUserOpinionFlowService;
 import org.springblade.business.service.IUserOpinionGoodService;
+import org.springblade.business.vo.MessageWarningVO;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
@@ -24,8 +25,13 @@ import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
+import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ProjectInfo;
+import org.springblade.manager.feign.ContractClient;
 import org.springblade.manager.feign.ProjectAssignmentUserClient;
+import org.springblade.manager.feign.ProjectClient;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.user.entity.User;
@@ -70,6 +76,10 @@ public class UserOpinionController extends BladeController {
 
 	private final MessageWarningClient messageWarningClient;
 
+	private final ContractClient contractClient;
+
+	private final ProjectClient projectClient;
+
 	/**
 	 * 取消点赞
 	 * @param userOpinionId 工单ID
@@ -261,6 +271,20 @@ public class UserOpinionController extends BladeController {
 					manegeUserPhone = user.getPhone();
 				}
 			}
+
+			ProjectInfo projectInfo = this.projectClient.queryProjectList(Func.toStrList(userOpinionVo.getProjectId().toString())).get(0);
+			ContractInfo contractInfo = this.contractClient.getContractById(userOpinionVo.getContractId());
+
+			//保存推送记录
+			this.messageWarningClient.savePushUserMessageWarning(new MessageWarningVO(
+					userOpinionVo.getProjectId(),
+					userOpinionVo.getContractId(),
+					4,
+					(StringUtils.isNotEmpty(projectInfo.getProjectAlias()) ? projectInfo.getProjectAlias() : projectInfo.getProjectName()) + contractInfo.getContractName() + "的用户" + AuthUtil.getNickName() + "向您提交的【" + userOpinionVo.getProblemType() + ":" + userOpinionVo.getOpinionContent() + "】工单反馈,请及时处理",
+					manageUser,
+					0
+			));
+
 		}catch (Exception e){
 			e.printStackTrace();
 		}

+ 33 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/UserOpinionFlowController.java

@@ -8,16 +8,22 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.time.DateUtils;
 import org.springblade.business.entity.AssessmentUser;
 import org.springblade.business.entity.UserOpinion;
+import org.springblade.business.feign.MessageWarningClient;
 import org.springblade.business.service.IAssessmentUserService;
 import org.springblade.business.service.IUserOpinionService;
+import org.springblade.business.vo.MessageWarningVO;
 import org.springblade.business.vo.UserOpinionFlowVO;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ProjectInfo;
+import org.springblade.manager.feign.ContractClient;
+import org.springblade.manager.feign.ProjectClient;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springframework.web.bind.annotation.*;
@@ -50,6 +56,12 @@ public class UserOpinionFlowController extends BladeController {
 
 	private final IDictBizClient dictBizClient;
 
+	private final MessageWarningClient messageWarningClient;
+
+	private final ContractClient contractClient;
+
+	private final ProjectClient projectClient;
+
 	/**
 	 * 统合接口
 	 * @param oldEndFlow 流程图的最后一个节点ID
@@ -124,6 +136,26 @@ public class UserOpinionFlowController extends BladeController {
 				manageUser = leftFlow.getManageUser();
 				manageUserName = leftFlow.getManageUserName();
 				manegeUserPhone = leftFlow.getManageUserPhone();
+
+				try{
+
+					ProjectInfo projectInfo = this.projectClient.queryProjectList(Func.toStrList(userOpinion.getProjectId().toString())).get(0);
+					ContractInfo contractInfo = this.contractClient.getContractById(userOpinion.getContractId());
+
+					//保存推送记录
+					this.messageWarningClient.savePushUserMessageWarning(new MessageWarningVO(
+							userOpinion.getProjectId(),
+							userOpinion.getContractId(),
+							4,
+							(StringUtils.isNotEmpty(projectInfo.getProjectAlias()) ? projectInfo.getProjectAlias() : projectInfo.getProjectName()) + contractInfo.getContractName() + "的用户【" + AuthUtil.getNickName() + "】再次向您提交了【" + userOpinion.getProblemType() + ":" + userOpinion.getOpinionContent() + "】工单反馈(客户执行了不满意并再次提交操作),请及时处理",
+							manageUser,
+							0
+					));
+
+				}catch (Exception e){
+					e.printStackTrace();
+				}
+
 			}
 
 			//生成新流程

+ 10 - 5
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/OperationLogClientImpl.java

@@ -1,5 +1,7 @@
 package org.springblade.business.feignClient;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import lombok.AllArgsConstructor;
 import org.springblade.business.entity.OperationLog;
 import org.springblade.business.feign.OperationLogClient;
@@ -23,7 +25,7 @@ public class OperationLogClientImpl implements OperationLogClient {
     private final IDictBizClient dictBizClient;
 
     @Override
-    public void saveUserOperationLog(Integer type, String operationModule, String operationView, List<String> operationObjIds, String operationObjName) {
+    public void saveUserOperationLog(Integer type, String operationModule, String operationView, JSONObject json) {
         try{
             //获取业务字典
             List<DictBiz> dictBizList = this.dictBizClient.getList("operation_type", "notRoot").getData();
@@ -40,14 +42,17 @@ public class OperationLogClientImpl implements OperationLogClient {
             //操作模块
             newData.setOperationModule(operationModule);
             //操作内容
-            newData.setOperationContent(operationAccount + ":" + operationObjName);
+            newData.setOperationContent(operationAccount + ":" + json.get("operationObjName"));
             //PC 还是 APP
             newData.setOperationMedium("PC");
             //业务数据
             newData.setOperationType(type);
-            if(operationObjIds != null && operationObjIds.size() > 0){
-                //业务数据ID
-                newData.setBusinessId(String.join(",", operationObjIds));
+            if(json.containsKey("operationObjIds")){
+                List<String> operationObjIds = JSONArray.parseArray(JSONObject.toJSONString(json.get("operationObjIds")), String.class);
+                if(operationObjIds != null && operationObjIds.size() > 0){
+                    //业务数据ID
+                    newData.setBusinessId(String.join(",", operationObjIds));
+                }
             }
             //操作页面
             newData.setOperationView(operationView);

+ 4 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/MessageWarningServiceImpl.java

@@ -21,8 +21,8 @@ import org.springblade.business.mapper.MessageWarningMapper;
 import org.springblade.business.service.IMessageWarningService;
 import org.springblade.business.vo.MessageWarningVO;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 
 /**
  *  服务实现类
@@ -35,6 +35,9 @@ public class MessageWarningServiceImpl extends BaseServiceImpl<MessageWarningMap
 
 	@Override
 	public void savePushUserMessageWarning(MessageWarningVO vo) {
+		MessageWarning messageWarning = new MessageWarning();
+		BeanUtils.copyProperties(vo, messageWarning);
 
+		this.baseMapper.insert(messageWarning);
 	}
 }

+ 8 - 8
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsFormElementController.java

@@ -131,28 +131,28 @@ public class WbsFormElementController extends BladeController {
         for (WbsFormElementExcel wbsFE : list) {
             if (("字符串").equals(wbsFE.getElementType()) || ("string").equals(wbsFE.getElementType())) {
                 wbsFE.setElementType("1");
-                wbsFE.setElementLength("255");
+                wbsFE.setElementLength("250");
             } else if (("整数").equals(wbsFE.getElementType()) || ("bigint").equals(wbsFE.getElementType())) {
                 wbsFE.setElementType("2");
-                wbsFE.setElementLength("20");
+                wbsFE.setElementLength("50");
             } else if (("小数").equals(wbsFE.getElementType()) || ("decimal").equals(wbsFE.getElementType())) {
                 wbsFE.setElementType("3");
-                wbsFE.setElementLength("20");
+                wbsFE.setElementLength("50");
             } else if (("日期").equals(wbsFE.getElementType()) || ("datetime").equals(wbsFE.getElementType())) {
                 wbsFE.setElementType("4");
-                wbsFE.setElementLength("0");
+                wbsFE.setElementLength("50");
             } else if (("数值").equals(wbsFE.getElementType())) {
                 wbsFE.setElementType("3");
-                wbsFE.setElementLength("20");
+                wbsFE.setElementLength("50");
             } else if (("签名").equals(wbsFE.getElementType())) {
                 wbsFE.setElementType("1");
-                wbsFE.setElementLength("255");
+                wbsFE.setElementLength("250");
             } else if (("文件").equals(wbsFE.getElementType())) {
                 wbsFE.setElementType("1");
-                wbsFE.setElementLength("255");
+                wbsFE.setElementLength("250");
             } else {
                 wbsFE.setElementType("1");
-                wbsFE.setElementLength("255");
+                wbsFE.setElementLength("250");
             }
         }
         return R.data(list, "操作成功");

+ 3 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeController.java

@@ -7,6 +7,7 @@ import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.springblade.core.cache.utils.CacheUtil;
 import org.springblade.core.excel.util.ExcelUtil;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.tool.api.R;
@@ -137,14 +138,14 @@ public class WbsTreeController extends BladeController {
     public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String id) {
         /*List<WbsTree> wbsTreeList = wbsTreeService.selectByWbsId(id);
         if (wbsTreeList.size() > 0) {
-            return R.fail("当前节点下存在子节点或表单,删除失败");
+            throw new ServiceException("当前节点下存在子节点或表单,删除失败");
         }*/
         List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>query().lambda()
                 .eq(WbsTreePrivate::getStatus, 1)
                 .eq(WbsTreePrivate::getId, id)
         );
         if (wbsTreePrivates.size() > 0) {
-            return R.fail(200,"当前节点已被项目引用,删除失败");
+            throw new ServiceException("当前节点已被项目引用,删除失败");
         }
         return R.status(wbsTreeService.deleteLogicById(id));
     }

+ 61 - 15
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java

@@ -58,8 +58,10 @@ public class WbsTreePrivateController extends BladeController {
     @ApiOperation(value = "保存项目日志划分")
     public R<Boolean> saveContractLogNode(@RequestBody SaveLogContractVO vo){
         if(StringUtils.isNotEmpty(vo.getWbsTreeIds())){
+            Date now = new Date();
+
             //获取当前项目已经划分的日志树
-            List<WbsTreePrivate> oldDataList = this.wbsTreePrivateService.list(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getProjectId, vo.getProjectId()).eq(WbsTreePrivate::getWbsType, "4").eq(WbsTreePrivate::getWbsId, vo.getWbsId()));
+            List<WbsTreePrivate> oldDataList = this.wbsTreePrivateService.list(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getProjectId, vo.getProjectId()).eq(WbsTreePrivate::getWbsType, "4").eq(WbsTreePrivate::getWbsId, vo.getWbsId()).eq(WbsTreePrivate::getType, 1));
 
             //需要保存的集合
             List<WbsTreePrivate> saveTreePrivateList = new ArrayList<>();
@@ -82,6 +84,51 @@ public class WbsTreePrivateController extends BladeController {
                 }
             }
 
+            //检查一下原本节点的表是否有新增的(只处理新增)
+            if(oldDataList != null && oldDataList.size() > 0){
+                for(WbsTreePrivate treePrivate : oldDataList){
+                    //获取当前节点下绑定的表格元素
+                    List<WbsTreePrivate> treePrivateTableList = this.wbsTreePrivateService.list(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getProjectId, treePrivate.getProjectId()).eq(WbsTreePrivate::getParentId, treePrivate.getId()).eq(WbsTreePrivate::getType, 2));
+
+                    //获取当前节点引用的模板下的表格元素
+                    List<WbsTree> wbsTreeTableList = this.wbsTreeService.list(Wrappers.<WbsTree>lambdaQuery().eq(WbsTree::getParentId, treePrivate.getId()).eq(WbsTree::getType, 2));
+
+                    //校验数量
+                    if(wbsTreeTableList != null && wbsTreeTableList.size() > 0){
+                        if(treePrivateTableList != null){
+                            if(treePrivateTableList.size() < wbsTreeTableList.size()){
+                                //小于,说明模板节点存在新增,检查哪些是新增的
+                                Iterator<WbsTree> iterator = wbsTreeTableList.iterator();
+                                while (iterator.hasNext()){
+                                    WbsTree tree = iterator.next();
+                                    for(WbsTreePrivate privateNode : treePrivateTableList){
+                                        if(privateNode.getId().equals(tree.getId())){
+                                            //存在,删除
+                                            iterator.remove();
+                                            break;
+                                        }
+                                    }
+                                }
+                                //多出来的,新增
+                                if(wbsTreeTableList.size() > 0){
+                                    for(WbsTree wbsTree : wbsTreeTableList){
+                                        WbsTreePrivate newTreePrivate = new WbsTreePrivate();
+                                        BeanUtils.copyProperties(wbsTree, newTreePrivate);
+                                        newTreePrivate.setWbsType("4");
+                                        newTreePrivate.setProjectId(vo.getProjectId());
+                                        newTreePrivate.setCreateTime(now);
+                                        newTreePrivate.setPKeyId(SnowFlakeUtil.getId());
+
+                                        saveTreePrivateList.add(newTreePrivate);
+                                    }
+                                }
+
+                            }
+                        }
+                    }
+                }
+            }
+
             if(wbsTreeIds.size() > 0){
                 //获取模板节点
                 List<WbsTree> wbsTreeList = this.wbsTreeService.list(Wrappers.<WbsTree>lambdaQuery().in(WbsTree::getId, wbsTreeIds));
@@ -90,28 +137,29 @@ public class WbsTreePrivateController extends BladeController {
                 if(wbsTreeTableList != null && wbsTreeTableList.size() > 0){
                     wbsTreeList.addAll(wbsTreeTableList);
                 }
+
                 //复制数据
-                Date now = new Date();
                 for(WbsTree tree : wbsTreeList){
                     WbsTreePrivate treePrivate = new WbsTreePrivate();
                     BeanUtils.copyProperties(tree, treePrivate);
-                    saveTreePrivateList.add(treePrivate);
                     treePrivate.setWbsType("4");
                     treePrivate.setProjectId(vo.getProjectId());
                     treePrivate.setPKeyId(SnowFlakeUtil.getId());
                     treePrivate.setCreateTime(now);
-                }
-                if(saveTreePrivateList.size() > 0){
-                    //修改项目引用
-                    this.projectInfoService.update(Wrappers.<ProjectInfo>lambdaUpdate().set(ProjectInfo::getReferenceLogWbsTemplateId, vo.getWbsId()).eq(ProjectInfo::getId, vo.getProjectId()));
 
-                    //保存数据
-                    return R.data(this.wbsTreePrivateService.saveBatch(saveTreePrivateList));
+                    saveTreePrivateList.add(treePrivate);
                 }
-            } else {
-                return R.data(200, true, "未找到需要新增的节点");
             }
 
+            if(saveTreePrivateList.size() > 0){
+                //修改项目引用
+                this.projectInfoService.update(Wrappers.<ProjectInfo>lambdaUpdate().set(ProjectInfo::getReferenceLogWbsTemplateId, vo.getWbsId()).eq(ProjectInfo::getId, vo.getProjectId()));
+
+                //保存数据
+                return R.data(this.wbsTreePrivateService.saveBatch(saveTreePrivateList));
+            }
+
+            return R.data(200, true, "保存成功");
         }
         return R.data(300, true, "保存失败,未选择任何数据");
     }
@@ -132,18 +180,16 @@ public class WbsTreePrivateController extends BladeController {
                 .eq(WbsTreePrivate::getWbsId, wbsTreePrivate.getWbsId())
                 .eq(WbsTreePrivate::getStatus, 1));
         if (wbsTreePrivate1.size() > 0) {
-            return R.fail("当前节点下存在子节点或表单,删除失败");
+            throw new ServiceException("当前节点下存在子节点或表单,删除失败");
         }*/
-
         List<WbsTreeContract> wbsTreeContracts = wbsTreeContractMapper.selectList(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getStatus, 1)
                 .eq(WbsTreeContract::getId, wbsTreePrivate.getId())
                 .eq(WbsTreeContract::getProjectId, wbsTreePrivate.getProjectId())
                 .eq(WbsTreeContract::getWbsId, wbsTreePrivate.getWbsId())
         );
-
         if (wbsTreeContracts.size() > 0) {
-            return R.fail("当前节点已被项目合同段引用,删除失败");
+            throw new ServiceException("当前节点已被合同段引用中,删除失败");
         }
         if (wbsTreePrivateService.deleteLogicBypKeyId(pKeyId) > 0) {
             return R.success("删除成功");

+ 3 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java

@@ -110,8 +110,10 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
 
         vos.forEach(voData -> {
             voData.setLeaf(new Integer("6").equals(voData.getDeptCategory()));
+            voData.setId(voData.getOriginallyId());
+            voData.setPrimaryKeyId(String.valueOf(voData.getOriginallyPkeyId()));
             //检查是否有下级
-            long count = this.wbsTreeContractService.count(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getParentId, voData.getPrimaryKeyId()).eq(WbsTreeContract::getContractId, voData.getContractIdRelation()).eq(WbsTreeContract::getType, 1));
+            long count = this.wbsTreeContractService.count(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getParentId, voData.getId()).eq(WbsTreeContract::getContractId, voData.getContractIdRelation()).eq(WbsTreeContract::getType, 1));
             voData.setNotExsitChild(count == 0);
         });
 

+ 5 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreePrivateClientImpl.java

@@ -20,6 +20,11 @@ public class WbsTreePrivateClientImpl implements WbsTreePrivateClient {
 
     private final IWbsTreePrivateService wbsTreePrivateService;
 
+    @Override
+    public List<WbsTreePrivate> queryAllNodeByProjectId(String projectId) {
+        return this.wbsTreePrivateService.list(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getProjectId, projectId));
+    }
+
     @Override
     public List<WbsTreePrivate> queryExcelTableByParentId(WbsTreePrivate treePrivate) {
         return this.wbsTreePrivateService.list(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getParentId, treePrivate.getId()).eq(WbsTreePrivate::getProjectId, treePrivate.getProjectId()).eq(WbsTreePrivate::getType, 2));

+ 0 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.xml

@@ -274,8 +274,6 @@
         WHERE
         d.is_deleted = 0
         AND d.status = 1
-        /*如果加上此条件,日志将不显示,暂注释*/
-        /*AND (major_data_type != 5 or major_data_type is null)*/
         AND d.type = 1
         <if test="wbsId!=null and wbsId!=''">
             and wbs_id = #{wbsId}

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.java

@@ -79,4 +79,6 @@ public interface WbsTreeContractMapper extends BaseMapper<WbsTreeContract> {
 
     void updateContractTablesInfo(@Param("contractInfoId") Long contractInfoId,@Param("wbsTreePrivate") WbsTreePrivate wbsTreePrivate);
 
+    void updateBatchWbsContract(@Param("listContract") List<WbsTreeContract> listContract);
+
 }

+ 26 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -269,9 +269,9 @@
         ORDER BY dept.sort
     </select>
 
-
     <select id="lazyTreeThree" resultType="org.springblade.manager.vo.WbsTreeContractTreeVO3">
-        SELECT c.id AS "primaryKeyId",
+        SELECT
+        c.id AS "primaryKeyId",
         c.p_key_id AS "id",
         c.type AS "type",
         c.wbs_type AS "wbsType",
@@ -280,7 +280,8 @@
         c.dept_category AS "deptCategory",
         c.parent_id,
         c.tenant_id AS "tenantId",
-        -- IFNULL(c.full_name, c.dept_name) AS "title",
+        c.id AS "originallyId",
+        c.p_key_id AS "originallyPkeyId",
         case
         when c.full_name is null then c.dept_name
         when c.full_name = '' then c.dept_name
@@ -494,6 +495,27 @@
         AND is_deleted = 0
     </update>
 
+    <update id="updateBatchWbsContract" parameterType="java.util.List">
+        <foreach  collection="listContract" item="item" index="index" separator=";">
+            UPDATE m_wbs_tree_contract
+            <set>
+                dept_name = #{item.deptName},
+                full_name = #{item.deptName},
+                dept_category = #{item.deptCategory},
+                major_data_type = #{item.majorDataType},
+                unique_code = #{item.uniqueCode},
+                partition_code = #{item.partitionCode},
+                table_type = #{item.tableType},
+                table_owner = #{item.tableOwner}
+            </set>
+            WHERE id = #{item.id}
+            AND project_id = #{item.projectId}
+            AND contract_id = #{item.contractId}
+            AND status = 1
+            AND is_deleted = 0
+        </foreach>
+    </update>
+
     <select id="selectQueryValueLikeNodeName" resultMap="ResultMap">
         select * from m_wbs_tree_contract where is_deleted = 0 and contract_id = #{contractId} and (dept_name like concat('%',#{queryValue},'%') or full_name like concat('%',#{queryValue},'%')) and `type` = '1'
     </select>
@@ -518,4 +540,5 @@
         AND wbs_id = #{wbsId}
     </select>
 
+
 </mapper>

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.java

@@ -72,4 +72,6 @@ public interface WbsTreePrivateMapper extends BaseMapper<WbsTreePrivate> {
 
     void updateBatchByIds2(@Param("wbsTreePrivate") WbsTreePrivate wbsTreePrivate, @Param("projectId") String projectId, @Param("wbsId") String wbsId);
 
+    void updateBatchWbsPrivate(@Param("listPrivate")List<WbsTreePrivate> listPrivate);
+
 }

+ 21 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.xml

@@ -238,6 +238,27 @@
           AND is_deleted = 0
     </update>
 
+    <update id="updateBatchWbsPrivate" parameterType="java.util.List">
+        <foreach  collection="listPrivate" item="item" index="index" separator=";">
+            UPDATE m_wbs_tree_private
+            <set>
+                dept_name = #{item.deptName},
+                full_name = #{item.deptName},
+                dept_category = #{item.deptCategory},
+                major_data_type = #{item.majorDataType},
+                unique_code = #{item.uniqueCode},
+                partition_code = #{item.partitionCode},
+                table_type = #{item.tableType},
+                table_owner = #{item.tableOwner}
+            </set>
+            WHERE id = #{item.id}
+            AND project_id = #{item.projectId}
+            AND wbs_id = #{item.wbsId}
+            AND status = 1
+            AND is_deleted = 0
+        </foreach>
+    </update>
+
     <select id="lazyTree" resultMap="treeNodeResultMap">
         SELECT
         dept.p_key_id as "primaryKeyId",

+ 17 - 15
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsFormElementServiceImpl.java

@@ -107,7 +107,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             //默认字段类型=varchar 长度=255
             String fieldNameKey = wbsFormElement.getEKey();
             String fieldType = "varchar";
-            String fieldLength = "255";
+            String fieldLength = "250";
             sbr.append(fieldNameKey);
             sbr.append(" ").append(fieldType).append("(").append(fieldLength).append(") ,\n");
 
@@ -182,6 +182,8 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
                     //同步
                     //sbr1.append(" ").append(fieldType).append("(").append(wbsFormElement.getELength()).append(")");
 
+                    wbsFormElement.setELength(250);
+
                     sbr1.append(" ").append("varchar").append("(").append(wbsFormElement.getELength()).append(")");
                     String sql = newName + " " + sbr1;
                     baseMapper.alterAddFiled(sql, tableName);
@@ -198,7 +200,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
                     //同步
                     //sbr1.append(" ").append(fieldType).append("(").append(wbsFormElement.getELength()).append(")");
 
-                    wbsFormElement.setELength(255);
+                    wbsFormElement.setELength(250);
 
                     sbr1.append(" ").append("varchar").append("(").append(wbsFormElement.getELength()).append(")");
                     String sql = newName + " " + sbr1;
@@ -216,7 +218,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
                     //同步
                     //sbr1.append(" ").append(fieldType).append("(").append(wbsFormElement.getELength()).append(")");
 
-                    wbsFormElement.setELength(255);
+                    wbsFormElement.setELength(250);
 
                     sbr1.append(" ").append("varchar").append("(").append(wbsFormElement.getELength()).append(")");
                     String sql = newName + " " + sbr1;
@@ -233,7 +235,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
                     //同步
                     //sbr1.append(" ").append(fieldType).append("(").append(0).append(")");
 
-                    wbsFormElement.setELength(255);
+                    wbsFormElement.setELength(250);
 
                     sbr1.append(" ").append("varchar").append("(").append(wbsFormElement.getELength()).append(")");
                     String sql = newName + " " + sbr1;
@@ -315,11 +317,11 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
 
                 //设置默认长度
                 if (eLength <= 255 && eLength > 65) {
-                    eLength = 255;
+                    eLength = 250;
                 } else if (eLength <= 1000 && eLength > 500) {
                     eLength = 500;
                 } else if (eLength >= 0 && eLength <= 65) {
-                    eLength = 20;
+                    eLength = 50;
                 }
 
                 //判断是否存在该Key字段
@@ -484,7 +486,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
 
                             //初始化默认值varchar 长度255
                             String eTypeFiled = "varchar";
-                            int eLengthFiled = 255;
+                            int eLengthFiled = 250;
 
                             //判断是否存在该Key字段
                             int row1 = wbsTreeMapper.isThereAField(wbsTree.getInitTableName(), key);
@@ -570,7 +572,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
 
                     //初始化默认值varchar 长度255
                     String eTypeFiled = "varchar";
-                    int eLengthFiled = 255;
+                    int eLengthFiled = 250;
 
                     //判断是否存在该Key字段
                     int row1 = wbsTreeMapper.isThereAField(wbsTree.getInitTableName(), key);
@@ -727,7 +729,7 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             //默认初始化值
             String eKey = listDatum.getEKey();
             String initTableFiledType = "varchar";
-            Integer elementLength = 255;
+            Integer elementLength = 250;
 
             //同步
             baseMapper.addTableFiled(initTableName, eKey, initTableFiledType, elementLength);
@@ -768,11 +770,11 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             case "字符串":
             case "签名":
             case "文件":
-                return 255;
+                return 250;
             case "整数":
             case "数值":
             case "小数":
-                return 20;
+                return 50;
             case "日期":
             default:
                 return 0;
@@ -782,10 +784,10 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
     private Integer getElementLength2(String type) {
         switch (type) {
             case "varchar":
-                return 255;
+                return 250;
             case "bigint":
             case "decimal":
-                return 20;
+                return 50;
             case "datetime":
             default:
                 return 0;
@@ -797,11 +799,11 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             case 1:  //字符串
             case 7:  //文件
             case 6:  //签名
-                return "255";
+                return "250";
             case 2:  //整数
             case 5:  //数值
             case 3:  //小数
-                return "20";
+                return "50";
             case 4:  //日期
             default:
                 return "0";

+ 7 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -9,7 +9,9 @@ import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.node.ForestNodeManager;
 import org.springblade.core.tool.node.ForestNodeMerger;
+import org.springblade.core.tool.node.INode;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.manager.dto.WbsTreeContractDTO;
@@ -19,6 +21,7 @@ import org.springblade.manager.mapper.WbsTreePrivateMapper;
 import org.springblade.manager.service.IWbsTreeContractService;
 import org.springblade.manager.vo.WbsTreeContractTreeVO;
 import org.springblade.manager.vo.WbsTreeContractTreeVO3;
+import org.springblade.manager.vo.WbsTreeContractVO;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -317,7 +320,6 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         return ForestNodeMerger.merge(baseMapper.lazyTreeTwo(contractIdRelation, parentId, contractType, contractId));
     }
 
-
     public List<WbsTreeContractTreeVO3> lazyTreeThree(String contractIdRelation, Long parentId, String contractId) {
         //获取关联信息
         List<ContractRelationJlyz> listContractRelationInfo = baseMapper.selectContractRelationInfo(Long.valueOf(contractId));
@@ -326,22 +328,21 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         List<Long> idsSG = listContractRelationInfo.stream().map(ContractRelationJlyz::getContractIdSg).collect(Collectors.toList());
 
         if (StringUtils.isNotEmpty(contractIdRelation)) {
-            //施工合同段分节点下的子节点
+            //施工合同段wbs树
             return ForestNodeMerger.merge(baseMapper.lazyTreeThree(Collections.singletonList(Long.parseLong(contractIdRelation)), parentId));
 
         } else {
-            //监理合同下所引用的所有施工合同段根节点
+            //监理合同段wbs树
             List<WbsTreeContractTreeVO3> wbsTreeContractTreeVOS = baseMapper.lazyTreeThree(idsSG, 0L);
 
             for (WbsTreeContractTreeVO3 wbsTreeContractTreeVO : wbsTreeContractTreeVOS) {
                 if (wbsTreeContractTreeVO.getParentId().equals(0L)) {
-                    //获取施工合同段
+                    //设置根节点
                     ContractInfo contractInfo = baseMapper.selectContractInfo(String.valueOf(wbsTreeContractTreeVO.getContractId()));
                     wbsTreeContractTreeVO.setTitle(contractInfo.getContractName());
                 }
             }
             return ForestNodeMerger.merge(wbsTreeContractTreeVOS);
-
         }
     }
 
@@ -355,7 +356,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 
         //当前项目合同段只会存在一个角色roleId
         SaveUserInfoByProject userInfo = baseMapper.selectRoleInfo(AuthUtil.getUserId(), contractId, projectId);
-        if (userInfo == null){
+        if (userInfo == null) {
             throw new ServiceException("请先分配当前用户对该合同段的角色信息");
         }
         String roleId = userInfo.getRoleId();

+ 44 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -10,6 +10,7 @@ import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.node.ForestNodeMerger;
+import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.StringPool;
 import org.springblade.manager.dto.WbsTreePrivateDTO2;
 import org.springblade.manager.dto.WbsTreePrivateDTO3;
@@ -294,6 +295,8 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
 
     @Override
     public boolean updateBatchByIds(List<WbsTree> wbsTreeListAll, List<WbsTreePrivate> wbsTreePrivatesAll, String projectId) {
+        List<WbsTreePrivate> listPrivate = new ArrayList<>();
+        List<WbsTreeContract> listContract = new ArrayList<>();
         //获取当前项目下所有合同段信息
         List<ContractInfo> contractInfos = contractInfoMapper.selectList(Wrappers.<ContractInfo>query().lambda().eq(ContractInfo::getPId, projectId));
 
@@ -308,21 +311,39 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
                                 || (wbsTree.getMajorDataType() != null && !wbsTree.getMajorDataType().equals(wbsTreePrivate.getMajorDataType()))
                                 || (wbsTree.getTableType() != null && !wbsTree.getTableType().equals(wbsTreePrivate.getTableType()))
                                 || (wbsTree.getTableOwner() != null && !wbsTree.getTableOwner().equals(wbsTreePrivate.getTableOwner())))) {
-                    //同步修改私有项目节点、元素表基础信息
-                    baseMapper.updateBatchByIds(wbsTree, projectId);
+                    //修改项目wbs信息
+                    //baseMapper.updateBatchByIds(wbsTree, projectId);
+                    WbsTreePrivate wbsPrivate = new WbsTreePrivate();
+                    BeanUtil.copyProperties(wbsTree,wbsPrivate);
+                    wbsPrivate.setProjectId(projectId);
+                    listPrivate.add(wbsPrivate);
 
-                    //同步修改合同段节点信息、元素表基础信息
                     for (ContractInfo contractInfo : contractInfos) {
-                        wbsTreeContractMapper.updateBatchByIds(wbsTree, contractInfo.getId());
+                        //修改合同段wbs信息
+                        //wbsTreeContractMapper.updateBatchByIds(wbsTree, contractInfo.getId());
+                        WbsTreeContract wbsContract = new WbsTreeContract();
+                        BeanUtil.copyProperties(wbsTree,wbsContract);
+                        wbsContract.setContractId(String.valueOf(contractInfo.getId()));
+                        wbsContract.setProjectId(projectId);
+                        listContract.add(wbsContract);
                     }
                 }
             }
         }
+        try {
+            baseMapper.updateBatchWbsPrivate(listPrivate);
+            wbsTreeContractMapper.updateBatchWbsContract(listContract);
+        }catch (Exception e){
+            e.printStackTrace();
+            //throw new ServiceException("节点基础信息同步修改失败");
+        }
         return true;
     }
 
     @Override
     public boolean updateBatchByIds2(List<WbsTreePrivate> wbsTreePrivates, List<WbsTreePrivate> wbsTreePrivatesAllNow, String projectId, String wbsId) {
+        List<WbsTreePrivate> listPrivate = new ArrayList<>();
+        List<WbsTreeContract> listContract = new ArrayList<>();
         //获取当前项目下所有合同段信息
         List<ContractInfo> contractInfos = contractInfoMapper.selectList(Wrappers.<ContractInfo>query().lambda().eq(ContractInfo::getPId, projectId));
 
@@ -339,16 +360,32 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
                                 || (wbsTreePrivate.getTableOwner() != null && !wbsTreePrivate.getTableOwner().equals(treePrivateNow.getTableOwner())))) {
 
                     //修改项目wbs信息
-                    baseMapper.updateBatchByIds2(wbsTreePrivate, projectId, wbsId);
+                    //baseMapper.updateBatchByIds2(wbsTreePrivate, projectId, wbsId);
+                    WbsTreePrivate wbsPrivate = new WbsTreePrivate();
+                    BeanUtil.copyProperties(wbsTreePrivate,wbsPrivate);
+                    wbsPrivate.setWbsId(wbsId);
+                    wbsPrivate.setProjectId(projectId);
+                    listPrivate.add(wbsPrivate);
 
                     for (ContractInfo contractInfo : contractInfos) {
                         //修改合同段wbs信息
-                        wbsTreeContractMapper.updateBatchByIds2(wbsTreePrivate, contractInfo.getId());
+                        //wbsTreeContractMapper.updateBatchByIds2(wbsTreePrivate, contractInfo.getId());
+                        WbsTreeContract wbsContract = new WbsTreeContract();
+                        BeanUtil.copyProperties(wbsTreePrivate,wbsContract);
+                        wbsContract.setContractId(String.valueOf(contractInfo.getId()));
+                        wbsContract.setProjectId(projectId);
+                        listContract.add(wbsContract);
                     }
-
                 }
             }
         }
+        try {
+            baseMapper.updateBatchWbsPrivate(listPrivate);
+            wbsTreeContractMapper.updateBatchWbsContract(listContract);
+        }catch (Exception e){
+            e.printStackTrace();
+            //throw new ServiceException("节点基础信息同步修改失败");
+        }
         return true;
     }
 

+ 37 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeServiceImpl.java

@@ -480,11 +480,25 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                     wbsTreeZi.setId(SnowFlakeUtil.getId());
                     wbsTreeZi.setTenantId(AuthUtil.getTenantId());
                     wbsTreeZi.setDeptName(maps.getValue());
+                    wbsTreeZi.setFullName(maps.getValue());
                     wbsTreeZi.setDeptCategory(Integer.valueOf(maps.getKey()));
                     wbsTreeZi.setWbsId(wbsTreeFu.getWbsId());
                     wbsTreeZi.setParentId(wbsTreeFu.getParentId());
                     wbsTreeZi.setAncestors(wbsTreeFu.getAncestors());
                     wbsTreeZi.setProjectNodeId(wbsTree1.getProjectNodeId());
+                    wbsTreeZi.setMajorDataType(0);
+                    //内页资料
+                    if (wbsTreeZi.getDeptCategory() == 6 && !(("中间交工证书").equals(wbsTreeZi.getDeptName()) || ("分项工程质量检验评定表").equals(wbsTreeZi.getDeptName()) || ("分项工程开工报告").equals(wbsTreeZi.getDeptName()))) {
+                        wbsTreeZi.setMajorDataType(4);
+                    }else if (wbsTreeZi.getDeptCategory() == 5 || wbsTreeZi.getDeptCategory() == 4 || wbsTreeZi.getDeptCategory() == 3 || wbsTreeZi.getDeptCategory() == 2) {
+                        if (getContains(wbsTreeZi.getDeptName(),"开工报告")) {
+                            wbsTreeZi.setMajorDataType(1);
+                        } else if (getContains(wbsTreeZi.getDeptName(),"质量评定")) {
+                            wbsTreeZi.setMajorDataType(2);
+                        } else if (getContains(wbsTreeZi.getDeptName(),"中间交工")) {
+                            wbsTreeZi.setMajorDataType(3);
+                        }
+                    }
 
                     //构建参数
                     WbsTree wbsTree = buildTreeNode(wbsTreeZi, allNodeData);
@@ -530,7 +544,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                     && tree.getDeptCategory().equals(wbsTreeZi.getDeptCategory())
                     && tree.getProjectNodeId().equals(wbsTreeZi.getProjectNodeId())) {
                 //判断上级节点不同,当前节点名相同的tree选择问题
-                //例如:第X跨的上级有上部构造现场浇筑、上部构造预制和安装,导致下方新增重复节点判断时找到的是前一个
+                //例如:第X跨的上级有上部构造现场浇筑、上部构造预制和安装,导致下方新增重复节点判断时找到的是前一个 TODO
                 if (!tree.getAncestors().equals(wbsTreeZi.getAncestors())) {
                     wbsTrees.add(tree);
                     break;
@@ -543,7 +557,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
         if (wbsTrees.size() <= 0) {
             wbsTreeZi.setStatus(1);
             wbsTreeZi.setType(1);
-            wbsTreeZi.setMajorDataType(0);
             if (wbsTreeZi.getDeptCategory() == 6) {
                 wbsTreeZi.setIsConcrete(0);
                 wbsTreeZi.setIsExpernode(0);
@@ -556,7 +569,6 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                     if (!wbsTreeZi.getParentId().equals(tree.getParentId()) && wbsTreeZi.getDeptName().equals(tree.getDeptName())) {
                         wbsTreeZi.setStatus(1);
                         wbsTreeZi.setType(1);
-                        wbsTreeZi.setMajorDataType(0);
                         if (wbsTreeZi.getDeptCategory() == 6) {
                             wbsTreeZi.setIsConcrete(0);
                             wbsTreeZi.setIsExpernode(0);
@@ -570,6 +582,24 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
         return wbsTree;
     }
 
+    private boolean getContains(String A,String B){
+        boolean result = false;
+        char[] arrayA = A.toCharArray();
+        char[] arrayB = B.toCharArray();
+        int intLen = 0;
+        for(int i = 0;i < arrayB.length;i++){
+            for(int j = 0;j < arrayA.length;j++){
+                if(arrayB[i] == arrayA[j]){
+                    intLen++;
+                    break;
+                }
+            }
+        }
+        if(intLen == arrayB.length)
+            result = true;
+        return result;
+    }
+
     @Override
     public int deleteBatchByProjectNodeId(Long projectNodeId) {
         return baseMapper.deleteBatchProjectNodeId(projectNodeId);
@@ -868,7 +898,8 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                             WbsTreePrivate wbsTreePrivate1 = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>query().lambda()
                                     .eq(WbsTreePrivate::getId, list.getParentId())
                                     .eq(WbsTreePrivate::getWbsId, pawDTO.getPrimaryKeyId())
-                                    .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
+                                    .eq(WbsTreePrivate::getProjectId, pawDTO.getProjectId())
+                                    .eq(WbsTreePrivate::getStatus,1)
                             );
 
                             if (wbsTreePrivate1 != null) {
@@ -927,7 +958,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                                 }
                             }
                         });
-                        return true;
+
                     }
                 }
             }
@@ -985,7 +1016,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
 
             //2.新增
             if (saveIds.size() > 0) {
-                if (saveIds.size() >=  1000){ //新增1000个以上节点时,防止响应过慢重复提交
+                if (saveIds.size() >= 1000) { //新增1000个以上节点时,防止响应过慢重复提交
                     //获取Redis的Value
                     String redisValue = bladeRedis.get("submit-wbs-project:" + pawDTO.getProjectId());
                     if (StringUtils.isNotEmpty(redisValue) && redisValue.equals("1")) {