huangjn 3 năm trước cách đây
mục cha
commit
1bf28f17c6

+ 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);
 
 }

+ 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());

+ 71 - 19
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);
 			}
 		}
@@ -1105,7 +1139,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 +1228,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());
 
@@ -1372,11 +1420,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();
@@ -1735,6 +1785,7 @@ public class InformationWriteQueryController extends BladeController {
 		if(new Integer("2").equals(contractInfo.getContractType())){
 			//监理合同段,需要获取关联的施工方合同段根节点数据
 			rootTreeNode = this.wbsTreeContractClient.lazyTree(StringUtils.isNotEmpty(parentId) ? Long.parseLong(parentId) : 0, contractId, contractIdRelation, contractInfo.getContractType());
+			int i = 0;
 		} else {
 			if(com.alibaba.nacos.common.utils.StringUtils.isEmpty(parentId)){
 				//为空,说明初始化
@@ -1757,7 +1808,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)){

+ 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);

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

@@ -113,7 +113,7 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
             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);
         });