| | |
| | | Map<Integer, String> templetsStrMap2 = new HashMap<>(); |
| | | |
| | | private JSONObject xmlJSONObj; |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param queryFilter |
| | | * @return |
| | | */ |
| | | /* public List<SimulatAssess> page(QueryFilter queryFilter) { |
| | | return baseDao.getList(queryFilter.getQueryParams()); |
| | | }*/ |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | |
| | | ele.addAttribute("value", String.valueOf(failureModel.getParam1())); |
| | | break; |
| | | case FailureModel.TYPE_BIN: |
| | | ele = failureModelTag.addElement("reliability"); |
| | | ele = failureModelTag.addElement("p"); |
| | | ele.addAttribute("value", String.valueOf(failureModel.getParam1())); |
| | | ele = failureModelTag.addElement("n"); |
| | | ele.addAttribute("value", String.valueOf(failureModel.getParam2())); |
| | | ele = failureModelTag.addElement("k"); |
| | | ele = failureModelTag.addElement("m"); |
| | | ele.addAttribute("value", String.valueOf(failureModel.getParam3())); |
| | | break; |
| | | case FailureModel.TYPE_WBL: |
| | |
| | | if (StringUtils.isNotBlank(nameValue)) { |
| | | productId1 = Convert.toLong(nameValue.split("-")[0]); |
| | | |
| | | Double mtbf = (Double) jsonArray.getJSONObject(i).get("mttf"); |
| | | Double mttr = (Double) jsonArray.getJSONObject(i).get("mttr"); |
| | | Double msr = (Double) jsonArray.getJSONObject(i).get("msr"); |
| | | Double mtbf = null; |
| | | Double mttr = null; |
| | | Double msr = null; |
| | | if (!jsonArray.getJSONObject(i).get("mttf").equals("inf")){ |
| | | mtbf = (Double)jsonArray.getJSONObject(i).get("mttf"); |
| | | }else{ |
| | | mtbf = 0.0; |
| | | } |
| | | if (!jsonArray.getJSONObject(i).get("mttr").equals("inf")){ |
| | | mttr = (Double)jsonArray.getJSONObject(i).get("mttr"); |
| | | }else{ |
| | | mttr = 0.0; |
| | | } |
| | | if (!jsonArray.getJSONObject(i).get("msr").equals("inf")){ |
| | | msr = (Double)jsonArray.getJSONObject(i).get("msr"); |
| | | }else{ |
| | | msr = 0.0; |
| | | } |
| | | |
| | | WeakDto weakDto = new WeakDto(); |
| | | weakDto.setId(productId1); |
| | | weakDto.setMtbf(mtbf); |
| | |
| | | |
| | | param.setXData(xList); |
| | | param.setYData(doubleArray); |
| | | Double mtbf = (Double) jsonArray.getJSONObject(i).get("mttf"); |
| | | Double mttr = (Double) jsonArray.getJSONObject(i).get("mttr"); |
| | | Double msr = (Double) jsonArray.getJSONObject(i).get("msr"); |
| | | |
| | | Double mttfMle = null; |
| | | Double mttrMle = null; |
| | | Double mtbf = null; |
| | | Double mttr = null; |
| | | Double msr = null; |
| | | if (!jsonArray.getJSONObject(i).get("mttf").equals("inf")){ |
| | | mtbf = (Double)jsonArray.getJSONObject(i).get("mttf"); |
| | | }else{ |
| | | mtbf = 0.0; |
| | | } |
| | | if (!jsonArray.getJSONObject(i).get("mttr").equals("inf")){ |
| | | mttr = (Double)jsonArray.getJSONObject(i).get("mttr"); |
| | | }else{ |
| | | mttr = 0.0; |
| | | } |
| | | if (!jsonArray.getJSONObject(i).get("msr").equals("inf")){ |
| | | msr = (Double)jsonArray.getJSONObject(i).get("msr"); |
| | | }else{ |
| | | msr = 0.0; |
| | | } |
| | | |
| | | if (!jsonArray.getJSONObject(i).get("mttr_MLE").equals("inf")){ |
| | | mttrMle = (Double)jsonArray.getJSONObject(i).get("mttr_MLE"); |
| | | }else{ |
| | | mttrMle = 0.0; |
| | | } |
| | | if(!jsonArray.getJSONObject(i).get("mttf_MLE").equals("inf")){ |
| | | mttfMle = (Double) jsonArray.getJSONObject(i).get("mttf_MLE"); |
| | | }else{ |
| | | mttfMle = 0.0; |
| | | } |
| | | data.setMtbf(mtbf); |
| | | data.setMttr(mttr); |
| | | data.setMsr(msr); |
| | | data.setMttfMle(mttfMle); |
| | | data.setMttrMle(mttrMle); |
| | | } |
| | | data.setCurveParam(param); |
| | | } |
| | |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | String jsonStr = null; |
| | | try { |
| | | // 使用 ObjectMapper 的 readValue 方法,将文件中的 JSON 数据转换为一个 Java 对象 |
| | | // 这里使用 Object 类作为泛型参数,表示任意类型的对象 |
| | | Object obj = mapper.readValue(new File(filePath), Object.class); |
| | | // 使用 ObjectMapper 的 writeValueAsString 方法,将 Java 对象转换为 JSON 字符串 |
| | | jsonStr = mapper.writeValueAsString(obj); |
| | | |
| | | } catch (IOException e) { |
| | | // 处理异常 |
| | | e.printStackTrace(); |