From d0bff7a4d7e0bd53f11ea629df20e48c3f72a0e6 Mon Sep 17 00:00:00 2001 From: xyc <jc_xiong@hotmail.com> Date: 星期一, 14 十月 2024 10:09:00 +0800 Subject: [PATCH] 修改RBD识别算法 --- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-) diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java index 909ede2..8609219 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java @@ -182,7 +182,10 @@ JSONObject jsonObject = new JSONObject(templetStr); JSONArray jsonArray = jsonObject.getJSONArray("cells"); - this.getPetsInfo(); + JSONObject jsonObject3 = new JSONObject(templetStr); + JSONArray jsonArray3 = jsonObject3.getJSONArray("cells"); + + String modelStr2 = this.getPetsInfo(); double x1 = 0; double x2 = 0; int y = -10; @@ -237,12 +240,13 @@ jsonArray.add(lineJson); } lineArray.add(statusDtoList); + JSONObject textJson = new JSONObject(templetsStrMap.get("text")); JsonUtils2.setJsonValueByPath(textJson, "id".split("/"), UUIDUtil.generateId().toString()); JsonUtils2.setJsonValueByPath(textJson, "attrs/label/textWrap/text".split("/"), dto.getName()); JsonUtils2.setJsonValueByPath(textJson, "position/x".split("/"), 20); JsonUtils2.setJsonValueByPath(textJson, "position/y".split("/"), y - 15); - jsonArray.add(textJson); + jsonArray3.add(textJson); } //闃舵妯″瀷鍙婂埢搴� @@ -375,7 +379,7 @@ } parentStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus)); - JSONObject jsonObject2 = new JSONObject(templetStr); + JSONObject jsonObject2 = new JSONObject(modelStr2); JSONArray jsonArray2 = jsonObject2.getJSONArray("cells"); List<List<TimeDiagramStatusDto>> smallStatusDtoList = new ArrayList<>(); smallStatusDtoList.add(parentStatusDtoList); @@ -385,18 +389,19 @@ for (int i = 0; i < smallStatusDtoList.size(); i++) { for (TimeDiagramStatusDto status : smallStatusDtoList.get(i)) { JSONObject lineJson = new JSONObject(templetsStrMap2.get(status.getStatus())); - setlineXy(lineJson, status.getX1(), y, status.getX2(), y, ""); + setlineXy(lineJson, status.getX1(), y, status.getX2() + 5, y, ""); JsonUtils2.setJsonValueByPath(lineJson, "data/status".split("/"), status.getStatus()); JsonUtils2.setJsonValueByPath(lineJson, "id".split("/"), UUIDUtil.generateId().toString()); jsonArray2.add(lineJson); } - y = y + 20; + y = y + 25; } //鍥句緥 int spaceWitdth = 80; x1 = 0; x2 = spaceWitdth - 11; + y = 60; String[] tlArr = "O,F,I,S,M".split(","); for (String s : tlArr) { JSONObject f = templetsMap.get(s); @@ -407,6 +412,7 @@ } timeDiagramDto.setDiagramJson(jsonObject.toString()); timeDiagramDto.setSmallDiagramJson(jsonObject2.toString()); + timeDiagramDto.setTextDiagramJson(jsonObject3.toString()); return timeDiagramDto; } @@ -446,12 +452,14 @@ } } - public void getPetsInfo() { + public String getPetsInfo() { Map<String, Object> params = new HashMap<String, Object>(); params.put("projectId", 10000); params.put("diagramId", 10000); + String modelStr2 = ""; List<TimeDiagram> list_style = baseDao.getTimeDiagram(params); if (list_style.size() > 0) { + modelStr2 = list_style.get(0).getContent2(); String modelStr = list_style.get(0).getContent(); JSONObject modelJson = new JSONObject(modelStr); JSONArray modelJsonArray = modelJson.getJSONArray("cells"); @@ -524,6 +532,7 @@ } } } + return modelStr2; } public List<ProductStatusDto> getStatusData(Long productId, Long taskId) { @@ -604,6 +613,7 @@ simulatAssess.getTaskModelId()); if (chkResult.size() > 0) { result = Result.error("妯″瀷涓嶅畬鏁达紝璇锋鏌ユā鍨嬪畾涔夊強鍙傛暟閰嶇疆銆�"); +// result = Result.ok(chkResult); return result; } @@ -1056,6 +1066,7 @@ element.addAttribute("k", algo.getVoteNum().toString()); } else if ("switch".equals(algo.getAlgorithmType())) { element.addAttribute("type", "standby"); + element.addAttribute("k", algo.getVoteNum().toString()); } else if ("bridge".equals(algo.getAlgorithmType())) { element.addAttribute("type", "bridge"); } -- Gitblit v1.9.1