From 43a85ad899a3b0b27b50967ff7e11f25d93edd4b Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期三, 24 七月 2024 10:41:17 +0800 Subject: [PATCH] 修改 --- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelLineService.java | 51 +++++++++++++++++++++++++++++++-------------------- 1 files changed, 31 insertions(+), 20 deletions(-) diff --git a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelLineService.java b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelLineService.java index 660d39d..8c2af11 100644 --- a/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelLineService.java +++ b/modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/ModelLineService.java @@ -138,7 +138,7 @@ // 6. 杞崲涓虹畻娉曞簱鎺ュ彛XML if (result) { - result = createIfXmlFromRbd(modelRbd, algorithmList, modelNodeAndVnodeList); +// result = createIfXmlFromRbd(modelRbd, algorithmList, modelNodeAndVnodeList); } // 7. 淇濆瓨妯″瀷 @@ -276,7 +276,7 @@ value = 1.0/value; argsTag.addAttribute("value", value.toString()); Element repairTimeLimitTag = element.addElement("RepairTimeLimit"); - repairTimeLimitTag.setText(paramData.getRepairMttcr()); + repairTimeLimitTag.setText(String.valueOf(paramData.getRepairMttcr())); } } else if ("10".equals(xhProductModel.getProductType())) { // 铏氬崟浣� @@ -1226,6 +1226,7 @@ List<ModelNode> modelNodeList, List<ModelLine> modelLineList, List<ProductImg> productImgList) { + Object jsonValue = null; for (int i = 0; i < rbdJsonArray.size(); i++) { JSONObject jsonObject = rbdJsonArray.getJSONObject(i); String shape = jsonObject.get("shape").toString(); @@ -1245,39 +1246,49 @@ modelNode.setNodeType(JsonUtils2.getJsonValueByPath(jsonObject, "data/nodeType".split("/")).toString()); modelNode.setPositionX(Double.valueOf(JsonUtils2.getJsonValueByPath(jsonObject, "position/x".split("/")).toString())); modelNode.setPositionY(Double.valueOf(JsonUtils2.getJsonValueByPath(jsonObject, "position/y".split("/")).toString())); - Object voteNum = JsonUtils2.getJsonValueByPath(jsonObject, "data/voteNum".split("/")); - if (voteNum!=null && StringUtils.isNotBlank(voteNum.toString())) { - modelNode.setVoteNum(Integer.valueOf(voteNum.toString())); + jsonValue = JsonUtils2.getJsonValueByPath(jsonObject, "data/voteNum".split("/")); + if (jsonValue!=null && StringUtils.isNotBlank(jsonValue.toString())) { + modelNode.setVoteNum(Integer.valueOf(jsonValue.toString())); } if ("node".equals(modelNode.getNodeType())) { ProductImg productImg = new ProductImg(); String dataId = JsonUtils2.getJsonValueByPath(jsonObject, "data/dataId".split("/")).toString(); modelNode.setDataId(Long.valueOf(dataId)); modelNode.setNodeTypeExt(JsonUtils2.getJsonValueByPath(jsonObject, "data/nodeTypeExt".split("/")).toString()); - Object name = JsonUtils2.getJsonValueByPath(jsonObject, "attrs/text/text".split("/")); - modelNode.setName(name==null ? "" : name.toString()); + jsonValue = JsonUtils2.getJsonValueByPath(jsonObject, "attrs/text/text".split("/")); + modelNode.setName(jsonValue==null ? "" : jsonValue.toString()); productImg.setDataId(dataId); String productType = JsonUtils2.getJsonValueByPath(jsonObject, "data/productType".split("/")).toString(); productImg.setProductType(productType); if ("product_sb".equals(productType)) { - Object obj = JsonUtils2.getJsonValueByPath(jsonObject, "data/reliabDistribType".split("/")); - if (obj != null && StringUtils.isNotBlank(obj.toString())) { - productImg.setReliabDistribType(Integer.valueOf(obj.toString())); + jsonValue = JsonUtils2.getJsonValueByPath(jsonObject, "data/reliabDistribType".split("/")); + if (jsonValue != null && StringUtils.isNotBlank(jsonValue.toString())) { + productImg.setReliabDistribType(Integer.valueOf(jsonValue.toString())); } - productImg.setTaskMtbcf(JsonUtils2.getJsonValueByPath(jsonObject, "data/taskMtbcf".split("/")).toString()); - productImg.setTaskMtbcfOther(JsonUtils2.getJsonValueByPath(jsonObject, "data/taskMtbcfOther".split("/")).toString()); - obj = JsonUtils2.getJsonValueByPath(jsonObject, "data/isRepair".split("/")); - if (obj != null && StringUtils.isNotBlank(obj.toString())) { - productImg.setIsRepair(Integer.valueOf(obj.toString())); + jsonValue = JsonUtils2.getJsonValueByPath(jsonObject, "data/taskMtbcf".split("/")); + if (null != jsonValue) productImg.setTaskMtbcf(jsonValue.toString()); + jsonValue = JsonUtils2.getJsonValueByPath(jsonObject, "data/taskMtbcfOtherParams2".split("/")); + if (null != jsonValue) productImg.setTaskMtbcfOtherParams2(jsonValue.toString()); + jsonValue = JsonUtils2.getJsonValueByPath(jsonObject, "data/taskMtbcfOtherParams3".split("/")); + if (null != jsonValue) productImg.setTaskMtbcfOtherParams3(jsonValue.toString()); + jsonValue = JsonUtils2.getJsonValueByPath(jsonObject, "data/isRepair".split("/")); + if (jsonValue != null && StringUtils.isNotBlank(jsonValue.toString()) && !"null".equals(jsonValue.toString())) { + productImg.setIsRepair(Integer.valueOf(jsonValue.toString())); + } else { + productImg.setIsRepair(0); } if (1 == productImg.getIsRepair()) { - obj = JsonUtils2.getJsonValueByPath(jsonObject, "data/repairDistribType".split("/")); - if (obj != null && StringUtils.isNotBlank(obj.toString())) { - productImg.setRepairDistribType(Integer.valueOf(obj.toString())); + jsonValue = JsonUtils2.getJsonValueByPath(jsonObject, "data/repairDistribType".split("/")); + if (jsonValue != null && StringUtils.isNotBlank(jsonValue.toString())) { + productImg.setRepairDistribType(Integer.valueOf(jsonValue.toString())); } - productImg.setRepairMttcr(JsonUtils2.getJsonValueByPath(jsonObject, "data/repairMttcr".split("/")).toString()); - productImg.setRepairMttcrOther(JsonUtils2.getJsonValueByPath(jsonObject, "data/repairMttcrOther".split("/")).toString()); + jsonValue = JsonUtils2.getJsonValueByPath(jsonObject, "data/repairMttcr".split("/")); + if (null != jsonValue) productImg.setRepairMttcr(jsonValue.toString()); + jsonValue = JsonUtils2.getJsonValueByPath(jsonObject, "data/repairMttcrOtherParams2".split("/")); + if (null != jsonValue) productImg.setRepairMttcrOtherParams2(jsonValue.toString()); + jsonValue = JsonUtils2.getJsonValueByPath(jsonObject, "data/repairMttcrOtherParams3".split("/")); + if (null != jsonValue) productImg.setRepairMttcrOtherParams3(jsonValue.toString()); } } productImgList.add(productImg); -- Gitblit v1.9.1