Merge remote-tracking branch 'origin/master'
| | |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | @GetMapping("exportData") |
| | | @ApiOperation("导åºäº§å模å") |
| | | @LogOperation("导åºäº§å模å") |
| | | public Result exportDataExcel(Long shipId) { |
| | | xhProductModelService.exportDataExcel(shipId); |
| | | public Result exportDataExcel(HttpServletRequest request, HttpServletResponse response, Long shipId,String fileName) { |
| | | xhProductModelService.exportDataExcel(request,response,shipId,fileName); |
| | | |
| | | return null; |
| | | } |
| | |
| | | package com.zt.life.modules.mainPart.basicInfo.dao; |
| | | |
| | | import com.zt.common.dao.BaseDao; |
| | | import com.zt.life.modules.mainPart.basicInfo.dto.ProductDto; |
| | | import com.zt.life.modules.mainPart.basicInfo.model.ProductImg; |
| | | import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | |
| | | Long[] getByPid(Long id); |
| | | |
| | | void getProductByShip(Long shipId); |
| | | List<ProductDto> getProductByShip(Long shipId); |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | private String dataId; |
| | | @TableField(exist = false) |
| | | private Integer basicUnitNum; |
| | | @TableField(exist = false) |
| | | private String statusImg; |
| | | @TableField(exist = false) |
| | | private String productType; |
| | |
| | | package com.zt.life.modules.mainPart.basicInfo.service; |
| | | |
| | | import com.alibaba.excel.EasyExcelFactory; |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.zt.common.constant.Constant; |
| | | import com.zt.common.service.BaseService; |
| | |
| | | import com.zt.common.utils.TreeUtils; |
| | | import com.zt.common.utils.UUIDUtil; |
| | | import com.zt.core.shiro.ImportUtil; |
| | | import com.zt.life.export.service.DownloadService; |
| | | import com.zt.life.modules.mainPart.basicInfo.dao.XhProductModelDao; |
| | | import com.zt.life.modules.mainPart.basicInfo.dto.ProductDto; |
| | | import com.zt.life.modules.mainPart.basicInfo.model.ParamData; |
| | | import com.zt.life.modules.mainPart.basicInfo.model.ProductImg; |
| | | import com.zt.life.modules.mainPart.basicInfo.model.XhProductModel; |
| | | import com.zt.life.modules.mainPart.sysPictureBase.service.SysPictureBaseService; |
| | | import com.zt.modules.sys.dto.DictTypeDto; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.apache.poi.openxml4j.exceptions.InvalidFormatException; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | |
| | | import com.zt.common.db.query.QueryFilter; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.util.*; |
| | | |
| | | |
| | |
| | | String xt = com.zt.core.shiro.ImportUtil.getCellValue(row, 1, pattern); //ç³»ç» |
| | | String fxt = com.zt.core.shiro.ImportUtil.getCellValue(row, 2, pattern); |
| | | String sb = com.zt.core.shiro.ImportUtil.getCellValue(row, 3, pattern); //è®¾å¤ |
| | | String sameSbName = com.zt.core.shiro.ImportUtil.getCellValue(row, 4, pattern); //å类设å¤åç§° |
| | | String sameSbNumStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 4, pattern); //åç±»è®¾å¤æ°é |
| | | String equipType = com.zt.core.shiro.ImportUtil.getCellValue(row, 5, pattern); //设å¤ç±»å |
| | | String reliabDistribType = com.zt.core.shiro.ImportUtil.getCellValue(row, 6, pattern); //å¯é æ§åå¸ç±»å |
| | | String basicJoinCompute = com.zt.core.shiro.ImportUtil.getCellValue(row, 7, pattern); //åå è®¡ç® |
| | | String basicMtbfRegulate = com.zt.core.shiro.ImportUtil.getCellValue(row, 8, pattern); //mtbf |
| | | String basicMtbfRegulSuccRate = com.zt.core.shiro.ImportUtil.getCellValue(row, 9, pattern); //æåç |
| | | String basicMtbfOperatingRatio = com.zt.core.shiro.ImportUtil.getCellValue(row, 10, pattern); //è¿è¡æ¯ |
| | | String taskMtbcfRegulate = com.zt.core.shiro.ImportUtil.getCellValue(row, 11, pattern); //mtbcf |
| | | String taskMtbcfOtherParams2 = com.zt.core.shiro.ImportUtil.getCellValue(row, 12, pattern); //mtbcfå
¶ä»åæ°2 |
| | | String taskMtbcfOtherParams3 = com.zt.core.shiro.ImportUtil.getCellValue(row, 13, pattern); //mtbcfå
¶ä»åæ°3 |
| | | String taskMtbcfRegulSuccRate = com.zt.core.shiro.ImportUtil.getCellValue(row, 14, pattern); //mtbcfæåç |
| | | String taskMtbcfOperatingRatio = com.zt.core.shiro.ImportUtil.getCellValue(row, 15, pattern); //mtbcfè¿è¡æ¯ |
| | | String basicMtbfRegulateStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 8, pattern); //mtbf |
| | | String basicMtbfRegulSuccRateStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 9, pattern); //æåç |
| | | String basicMtbfOperatingRatioStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 10, pattern); //è¿è¡æ¯ |
| | | String taskMtbcfRegulateStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 11, pattern); //mtbcf |
| | | String taskMtbcfOtherParams2Str = com.zt.core.shiro.ImportUtil.getCellValue(row, 12, pattern); //mtbcfå
¶ä»åæ°2 |
| | | String taskMtbcfOtherParams3Str = com.zt.core.shiro.ImportUtil.getCellValue(row, 13, pattern); //mtbcfå
¶ä»åæ°3 |
| | | String taskMtbcfRegulSuccRateStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 14, pattern); //mtbcfæåç |
| | | String taskMtbcfOperatingRatioStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 15, pattern); //mtbcfè¿è¡æ¯ |
| | | String repairable = com.zt.core.shiro.ImportUtil.getCellValue(row, 16, pattern); //æ¯å¦å¯ç»´ä¿® |
| | | String repairDistribType = com.zt.core.shiro.ImportUtil.getCellValue(row, 17, pattern); //ç»´ä¿®åå¸ç±»å |
| | | String repairMttcr = com.zt.core.shiro.ImportUtil.getCellValue(row, 18, pattern); //mttcr |
| | | String repairMttcrOtherParams2 = com.zt.core.shiro.ImportUtil.getCellValue(row, 19, pattern); //mttcrå
¶ä»åæ°2 |
| | | String repairMttcrOtherParams3 = com.zt.core.shiro.ImportUtil.getCellValue(row, 20, pattern); //mttcrå
¶ä»åæ°3 |
| | | String repairMttcrStr = com.zt.core.shiro.ImportUtil.getCellValue(row, 18, pattern); //mttcr |
| | | String repairMttcrOtherParams2Str = com.zt.core.shiro.ImportUtil.getCellValue(row, 19, pattern); //mttcrå
¶ä»åæ°2 |
| | | String repairMttcrOtherParams3Str = com.zt.core.shiro.ImportUtil.getCellValue(row, 20, pattern); //mttcrå
¶ä»åæ°3 |
| | | |
| | | Integer sameSbNum = StringUtils.isNotBlank(sameSbNumStr) ? Integer.parseInt(sameSbNumStr) : 1; |
| | | Double basicMtbfRegulate = StringUtils.isNotBlank(basicMtbfRegulateStr) ? Double.valueOf(basicMtbfRegulateStr) : null; |
| | | Double basicMtbfRegulSuccRate = StringUtils.isNotBlank(basicMtbfRegulSuccRateStr) ? Double.valueOf(basicMtbfRegulSuccRateStr) : null; |
| | | Double basicMtbfOperatingRatio = StringUtils.isNotBlank(basicMtbfOperatingRatioStr) ? Double.parseDouble(basicMtbfOperatingRatioStr) : 1.0; |
| | | Double taskMtbcfRegulate = StringUtils.isNotBlank(taskMtbcfRegulateStr) ? Double.parseDouble(taskMtbcfRegulateStr) : null; |
| | | Double taskMtbcfOtherParams2 = StringUtils.isNotBlank(taskMtbcfOtherParams2Str) ? Double.parseDouble(taskMtbcfOtherParams2Str) : null; |
| | | Double taskMtbcfOtherParams3 = StringUtils.isNotBlank(taskMtbcfOtherParams3Str) ? Double.parseDouble(taskMtbcfOtherParams3Str) : null; |
| | | Double taskMtbcfRegulSuccRate = StringUtils.isNotBlank(taskMtbcfRegulSuccRateStr) ? Double.parseDouble(taskMtbcfRegulSuccRateStr) : null; |
| | | Double taskMtbcfOperatingRatio = StringUtils.isNotBlank(taskMtbcfOperatingRatioStr) ? Double.parseDouble(taskMtbcfOperatingRatioStr) : 1.0; |
| | | Double repairMttcr = StringUtils.isNotBlank(repairMttcrStr) ? Double.parseDouble(repairMttcrStr) : null; |
| | | Double repairMttcrOtherParams2 = StringUtils.isNotBlank(repairMttcrOtherParams2Str) ? Double.parseDouble(repairMttcrOtherParams2Str) : null; |
| | | Double repairMttcrOtherParams3 = StringUtils.isNotBlank(repairMttcrOtherParams3Str) ? Double.parseDouble(repairMttcrOtherParams3Str) : null; |
| | | |
| | | |
| | | if (StringUtils.isBlank(sb)) |
| | | continue; |
| | |
| | | } else { |
| | | curSbId = modelMap.get(sbPath).getId(); |
| | | paramId = modelMap.get(sbPath).getParamId(); |
| | | } |
| | | |
| | | if(StringUtils.isBlank(sameSbName)){ |
| | | sameSbName = sb; |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(sb)) { |
| | |
| | | xhProductModel.setPid(curFxtId == null ? curXtId : curFxtId); |
| | | xhProductModel.setId(curSbId); |
| | | xhProductModel.setName(sb); |
| | | xhProductModel.setSameSbName(sameSbName); |
| | | //xhProductModel.setSameSbName(sameSbName); |
| | | xhProductModel.setEquipType(equipType); |
| | | xhProductModel.setProductType("5"); |
| | | xhProductModel.setSort(Integer.valueOf(sort)); |
| | |
| | | xhProductModel.setNamePath(sbPath); |
| | | if (insertSb) { |
| | | this.insert(xhProductModel); |
| | | }else{ |
| | | } else { |
| | | this.update(xhProductModel); |
| | | } |
| | | |
| | |
| | | itemEntity.setProductId(curSbId); |
| | | itemEntity.setReliabDistribType(reliabType.get(reliabDistribType)); |
| | | itemEntity.setBasicJoinCompute(isOrNot.get(basicJoinCompute)); |
| | | if (StringUtils.isNotBlank(basicMtbfRegulate)) { |
| | | itemEntity.setBasicMtbfRegulate(Double.valueOf(basicMtbfRegulate)); |
| | | } |
| | | if (StringUtils.isNotBlank(basicMtbfRegulSuccRate)) { |
| | | itemEntity.setBasicMtbfRegulSuccRate(Double.valueOf(basicMtbfRegulSuccRate)); |
| | | } |
| | | if (StringUtils.isNotBlank(basicMtbfOperatingRatio)) { |
| | | itemEntity.setBasicMtbfOperatingRatio(Double.valueOf(basicMtbfOperatingRatio)); |
| | | } else { |
| | | itemEntity.setBasicMtbfOperatingRatio(1.0); |
| | | } |
| | | if (StringUtils.isNotBlank(taskMtbcfRegulate)) { |
| | | itemEntity.setTaskMtbcfRegulate(Double.valueOf(taskMtbcfRegulate)); |
| | | } |
| | | if (StringUtils.isNotBlank(taskMtbcfOtherParams2)) { |
| | | itemEntity.setTaskMtbcfOtherParams2(Double.valueOf(taskMtbcfOtherParams2)); |
| | | } |
| | | if (StringUtils.isNotBlank(taskMtbcfOtherParams3)) { |
| | | itemEntity.setTaskMtbcfOtherParams3(Double.valueOf(taskMtbcfOtherParams3)); |
| | | } |
| | | if (StringUtils.isNotBlank(taskMtbcfRegulSuccRate)) { |
| | | itemEntity.setTaskMtbcfRegulSuccRate(Double.valueOf(taskMtbcfRegulSuccRate)); |
| | | } |
| | | if (StringUtils.isNotBlank(taskMtbcfOperatingRatio)) { |
| | | itemEntity.setTaskMtbcfOperatingRatio(Double.valueOf(taskMtbcfOperatingRatio)); |
| | | } else { |
| | | itemEntity.setTaskMtbcfOperatingRatio(1.0); |
| | | } |
| | | itemEntity.setBasicUnitNum(sameSbNum); |
| | | itemEntity.setBasicMtbfRegulate(basicMtbfRegulate); |
| | | itemEntity.setBasicMtbfRegulSuccRate(basicMtbfRegulSuccRate); |
| | | itemEntity.setBasicMtbfOperatingRatio(basicMtbfOperatingRatio); |
| | | itemEntity.setTaskMtbcfRegulate(taskMtbcfRegulate); |
| | | itemEntity.setTaskMtbcfOtherParams2(taskMtbcfOtherParams2); |
| | | itemEntity.setTaskMtbcfOtherParams3(taskMtbcfOtherParams3); |
| | | itemEntity.setTaskMtbcfRegulSuccRate(taskMtbcfRegulSuccRate); |
| | | itemEntity.setTaskMtbcfOperatingRatio(taskMtbcfOperatingRatio); |
| | | itemEntity.setRepairable(isOrNot.get(repairable)); |
| | | itemEntity.setRepairDistribType(repairType.get(repairDistribType)); |
| | | if (StringUtils.isNotBlank(repairMttcr)) { |
| | | itemEntity.setRepairMttcr(Double.valueOf(repairMttcr)); |
| | | } |
| | | if (StringUtils.isNotBlank(repairMttcrOtherParams2)) { |
| | | itemEntity.setRepairMttcrOtherParams2(Double.valueOf(repairMttcrOtherParams2)); |
| | | } |
| | | if (StringUtils.isNotBlank(repairMttcrOtherParams3)) { |
| | | itemEntity.setRepairMttcrOtherParams3(Double.valueOf(repairMttcrOtherParams3)); |
| | | } |
| | | itemEntity.setRepairMttcr(repairMttcr); |
| | | itemEntity.setRepairMttcrOtherParams2(repairMttcrOtherParams2); |
| | | itemEntity.setRepairMttcrOtherParams3(repairMttcrOtherParams3); |
| | | |
| | | if (modelMap.get(sbPath) == null) { |
| | | paramDataService.insert(itemEntity); |
| | | } else { |
| | |
| | | return baseDao.getByPid(id); |
| | | } |
| | | |
| | | public void exportDataExcel(Long shipId) { |
| | | baseDao.getProductByShip(shipId); |
| | | public void exportDataExcel(HttpServletRequest request, HttpServletResponse response, Long shipId, String name) { |
| | | Map<Integer, String> reliabType = new HashMap<>(); |
| | | reliabType.put(1, "ææ°åå¸"); |
| | | reliabType.put(3, "äºé¡¹åå¸"); |
| | | reliabType.put(2, "å¨å¸å°åå¸"); |
| | | Map<Integer, String> repairType = new HashMap<>(); |
| | | repairType.put(1, "ææ°åå¸"); |
| | | repairType.put(2, "å¨å¸å°åå¸"); |
| | | Map<Integer, String> isOrNot = new HashMap<>(); |
| | | isOrNot.put(1, "æ¯"); |
| | | isOrNot.put(0, "å¦"); |
| | | |
| | | List<ProductDto> data = baseDao.getProductByShip(shipId); |
| | | data = TreeUtils.build(data); |
| | | List<ProductDto> List = new ArrayList<>(); |
| | | this.writeExcel(data, List); |
| | | // è¯»åæ¨¡æ¿æä»¶ |
| | | try (InputStream inputStream = getClass().getResourceAsStream("/产åç»ææ å¯¼åºæ¨¡æ¿.xlsx")) { |
| | | Workbook workbook = new XSSFWorkbook(inputStream); |
| | | // è·å第ä¸ä¸ªå·¥ä½è¡¨ |
| | | Sheet sheet = workbook.getSheetAt(0); |
| | | int num = 0; |
| | | String xt = ""; |
| | | String fxt = ""; |
| | | String sb = ""; |
| | | for (int i = 0; i < List.size(); i++) { |
| | | if (List.get(i).getProductType() == 5) { |
| | | num = num + 1; |
| | | String[] parentList = List.get(i).getNamePath().split(","); |
| | | Row row = sheet.createRow(sheet.getLastRowNum() + 1); // å建æ°è¡ |
| | | Cell cell = row.createCell(0); |
| | | cell.setCellValue(num); |
| | | if (parentList.length > 2) { |
| | | if (!xt.equals(parentList[0])) { |
| | | xt = parentList[0]; |
| | | cell = row.createCell(1); |
| | | cell.setCellValue(xt); |
| | | } |
| | | if (!fxt.equals(parentList[1])) { |
| | | fxt = parentList[1]; |
| | | cell = row.createCell(2); |
| | | cell.setCellValue(fxt); |
| | | } |
| | | if (!sb.equals(parentList[2])) { |
| | | sb = parentList[2]; |
| | | cell = row.createCell(3); |
| | | cell.setCellValue(sb); |
| | | } |
| | | } else { |
| | | if (!xt.equals(parentList[0])) { |
| | | xt = parentList[0]; |
| | | cell = row.createCell(1); |
| | | cell.setCellValue(xt); |
| | | } |
| | | |
| | | if (!sb.equals(parentList[1])) { |
| | | sb = parentList[1]; |
| | | cell = row.createCell(3); |
| | | cell.setCellValue(sb); |
| | | } |
| | | } |
| | | cell = row.createCell(4); |
| | | if (StringUtils.isNotBlank(List.get(i).getSameSbName())) { |
| | | cell.setCellValue(List.get(i).getSameSbName()); |
| | | } |
| | | cell = row.createCell(5); |
| | | if (StringUtils.isNotBlank(List.get(i).getEquipType())) { |
| | | cell.setCellValue(List.get(i).getEquipType()); |
| | | } |
| | | cell = row.createCell(6); |
| | | String type = reliabType.get(List.get(i).getReliabDistribType()); |
| | | cell.setCellValue(type); |
| | | cell = row.createCell(7); |
| | | String isNot = isOrNot.get(List.get(i).getBasicJoinCompute()); |
| | | cell.setCellValue(isNot); |
| | | cell = row.createCell(8); |
| | | if (List.get(i).getBasicMtbfRegulate() != null) { |
| | | cell.setCellValue(List.get(i).getBasicMtbfRegulate()); |
| | | } |
| | | cell = row.createCell(9); |
| | | if (List.get(i).getBasicMtbfRegulSuccRate() != null) { |
| | | cell.setCellValue(List.get(i).getBasicMtbfRegulSuccRate()); |
| | | } |
| | | cell = row.createCell(10); |
| | | if (List.get(i).getBasicMtbfOperatingRatio() != null) { |
| | | cell.setCellValue(List.get(i).getBasicMtbfOperatingRatio()); |
| | | } else { |
| | | cell.setCellValue(1.0); |
| | | } |
| | | cell = row.createCell(11); |
| | | if (List.get(i).getTaskMtbcfRegulate() != null) { |
| | | cell.setCellValue(List.get(i).getTaskMtbcfRegulate()); |
| | | } |
| | | cell = row.createCell(12); |
| | | if (List.get(i).getTaskMtbcfOtherParams2() != null) { |
| | | cell.setCellValue(List.get(i).getTaskMtbcfOtherParams2()); |
| | | } |
| | | cell = row.createCell(13); |
| | | if (List.get(i).getTaskMtbcfOtherParams3() != null) { |
| | | cell.setCellValue(List.get(i).getTaskMtbcfOtherParams3()); |
| | | } |
| | | cell = row.createCell(14); |
| | | if (List.get(i).getTaskMtbcfRegulSuccRate() != null) { |
| | | cell.setCellValue(List.get(i).getTaskMtbcfRegulSuccRate()); |
| | | } |
| | | cell = row.createCell(15); |
| | | if (List.get(i).getTaskMtbcfOperatingRatio() != null) { |
| | | cell.setCellValue(List.get(i).getTaskMtbcfOperatingRatio()); |
| | | } else { |
| | | cell.setCellValue(1.0); |
| | | } |
| | | cell = row.createCell(16); |
| | | if (List.get(i).getRepairable() != null) { |
| | | isNot = isOrNot.get(List.get(i).getRepairable()); |
| | | cell.setCellValue(isNot); |
| | | } |
| | | cell = row.createCell(17); |
| | | if (List.get(i).getRepairDistribType() != null) { |
| | | type = repairType.get(List.get(i).getRepairDistribType()); |
| | | cell.setCellValue(type); |
| | | } |
| | | cell = row.createCell(18); |
| | | if (List.get(i).getRepairMttcr() != null) { |
| | | cell.setCellValue(List.get(i).getRepairMttcr()); |
| | | } |
| | | cell = row.createCell(19); |
| | | if (List.get(i).getRepairMttcrOtherParams2() != null) { |
| | | cell.setCellValue(List.get(i).getRepairMttcrOtherParams2()); |
| | | } |
| | | cell = row.createCell(20); |
| | | if (List.get(i).getRepairMttcrOtherParams3() != null) { |
| | | cell.setCellValue(List.get(i).getRepairMttcrOtherParams3()); |
| | | } |
| | | } |
| | | } |
| | | response.setContentType("application/octet-stream;charset=UTF-8"); |
| | | String encodedFilename = DownloadService.getNameEncoder(request, name + "_产åç»ææ .xlsx"); |
| | | response.addHeader("Content-Disposition", "attachment;filename=" + encodedFilename); |
| | | workbook.write(response.getOutputStream()); |
| | | |
| | | } catch ( |
| | | IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void writeExcel(List<ProductDto> data, List<ProductDto> List) { |
| | | for (ProductDto dto : data) { |
| | | List.add(dto); |
| | | writeExcel(dto.getChildren(), List); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.zt.common.validator.group.UpdateGroup; |
| | | import com.zt.life.modules.mainPart.async.PythonLib; |
| | | import com.zt.life.modules.mainPart.taskReliability.dto.*; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.CurveParam; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.SimulatAssess; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.Task; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.TimeDiagram; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.*; |
| | | import com.zt.life.modules.mainPart.taskReliability.service.SimulatAssessService; |
| | | import com.zt.life.modules.mainPart.taskReliability.service.TaskService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private PythonLib pythonLib; |
| | | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | |
| | | |
| | | @Autowired |
| | | private SimulatAssessService simulatAssessService; |
| | |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | @GetMapping("verify") |
| | | public Result<String> verify(Long taskId) { |
| | | String result = simulatAssessService.verify(taskId); |
| | | result = result.replaceAll("\n", "<br>"); |
| | | return Result.ok(result); |
| | | } |
| | | |
| | | @PostMapping("analyze") |
| | | public Result<Long> analyze(@RequestBody SimulatAssess simulatAssess) { |
| | | public Result<Object> analyze(@RequestBody SimulatAssess simulatAssess) { |
| | | //æéªæ°æ® |
| | | // Result result = pythonLib.callPython(simulatAssess); |
| | | Result result = simulatAssessService.simulate(simulatAssess); |
| | | |
| | | return result; |
| | | List<TaskModelCheckResultDto> result = simulatAssessService.simulateChecK(simulatAssess); |
| | | if (result != null) { |
| | | return Result.ok(result); |
| | | } |
| | | Boolean result2 = simulatAssessService.simulate(simulatAssess); |
| | | if (result2) |
| | | return Result.ok(); |
| | | else |
| | | return Result.error(); |
| | | } |
| | | |
| | | @PostMapping("getResultXML") |
| | |
| | | } |
| | | |
| | | @GetMapping("getStatus") |
| | | public Result<TimeDiagramDto> getTimeDiagram(Long productId, Long taskId, Long fzId, double smallWidth,double minPointNum) { |
| | | TimeDiagramDto data = simulatAssessService.getTimeDiagram(productId, taskId, fzId, smallWidth,minPointNum); |
| | | public Result<TimeDiagramDto> getTimeDiagram(Long productId, Long taskId, Long fzId, double smallWidth, double minPointNum) { |
| | | TimeDiagramDto data = simulatAssessService.getTimeDiagram(productId, taskId, fzId, smallWidth, minPointNum); |
| | | return Result.ok(data); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @GetMapping("getCalcProgress") |
| | | public Result getCalcProgress(Long taskId) { |
| | | String key = taskId.toString() + simulatAssessService.RELIA_SIM_TASK_TYPE_PROGRESS; |
| | | String progress = (String) redisTemplate.opsForValue().get(key); |
| | | if (progress == null) progress = "0"; |
| | | if (Objects.equals(progress, "100")) { |
| | | simulatAssessService.deleteSimInfoInRedis(taskId); |
| | | public Result getCalcProgress(@RequestParam("taskList[]") Long[] taskList) { |
| | | Integer progress = 0; |
| | | String progress2 = ""; |
| | | String key = null; |
| | | if (taskList.length == 1) { |
| | | key = taskList[0].toString() + simulatAssessService.RELIA_SIM_TASK_TYPE_PROGRESS; |
| | | progress2 = (String) redisTemplate.opsForValue().get(key); |
| | | progress = Integer.parseInt(progress2); |
| | | if (progress == null) progress = 0; |
| | | if (progress == 100) { |
| | | //simulatAssessService.deleteSimInfoInRedis(taskId); |
| | | } |
| | | } else { |
| | | for (Long taskId : taskList) { |
| | | key = taskId.toString() + simulatAssessService.RELIA_SIM_TASK_TYPE_PROGRESS; |
| | | progress2 = (String) redisTemplate.opsForValue().get(key); |
| | | progress = progress + Integer.parseInt(progress2); |
| | | } |
| | | progress = progress / taskList.length; |
| | | if (progress == 100) { |
| | | //simulatAssessService.deleteSimInfoInRedis(taskId); |
| | | } |
| | | } |
| | | return Result.ok(progress); |
| | | |
| | | return Result.ok(progress.toString()); |
| | | } |
| | | |
| | | @GetMapping("ReliabilityWeakness") |
| | |
| | | } |
| | | |
| | | @GetMapping("SchemeCompar") |
| | | public Result<SchemeComparDto> SchemeCompar(@RequestParam("taskList[]") String[] taskList,Long showProductId) { |
| | | SchemeComparDto data = simulatAssessService.SchemeCompar(taskList,showProductId); |
| | | public Result<SimulatResult> SchemeCompar(@RequestParam("taskList[]") String[] taskList, Long showProductId, Integer samplPeriod, Integer simulatFrequency) { |
| | | SimulatResult data = simulatAssessService.SchemeCompar(taskList, showProductId, samplPeriod, simulatFrequency); |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("getEcharts") |
| | | public Result<SchemeComparDto> getEcharts(@RequestParam("taskList[]") String[] taskList, Long showProductId) { |
| | | SchemeComparDto data = simulatAssessService.getEcharts(taskList, showProductId); |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation("ä¿®æ¹") |
| | |
| | | package com.zt.life.modules.mainPart.taskReliability.dao; |
| | | |
| | | import com.zt.common.dao.BaseDao; |
| | | import com.zt.life.modules.mainPart.taskReliability.dto.ModelDto; |
| | | import com.zt.life.modules.mainPart.taskReliability.dto.ProductStatusDto; |
| | | import com.zt.life.modules.mainPart.taskReliability.dto.WeakDto; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.ModelRbd; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.SimulatAssess; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.SimulatAssessTaskPhaseModel; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.TimeDiagram; |
| | | import com.zt.life.modules.mainPart.taskReliability.dto.verifyDto; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.*; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | |
| | |
| | | List<WeakDto> getProductList(Long taskId, Long productId); |
| | | |
| | | SimulatAssess getByTaskId(Long taskModelId); |
| | | |
| | | List<OperatConditModel> getModel(Long taskId); |
| | | |
| | | List<verifyDto> getNode(Long modelId); |
| | | |
| | | Integer getVoteNum(Long id); |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | private Long iid; |
| | | |
| | | @TableField(exist = false) |
| | | private String content; |
| | | |
| | | } |
| | |
| | | private String dataType; |
| | | |
| | | @TableField(exist = false) |
| | | private Integer taskDuration; |
| | | private Double taskDuration; |
| | | |
| | | @ApiModelProperty(value = "ä¼ ç»ç®æ³åºçxml") |
| | | private String xml; |
New file |
| | |
| | | package com.zt.life.modules.mainPart.taskReliability.model; |
| | | |
| | | import com.zt.life.modules.mainPart.taskReliability.dto.TaskModelCheckResultDto; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class SimulatResult { |
| | | private String type; |
| | | private List<Long> idList; |
| | | private List<TaskModelCheckResultDto> errList; |
| | | } |
| | |
| | | import com.zt.life.modules.mainPart.taskReliability.model.*; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * model_line |
| | |
| | | node.setProductId(modelRbd.getProductId()); |
| | | node.setModelId(modelRbd.getId()); |
| | | Long[] nodeArr = modelRbd.getNodeArr(); |
| | | Map<Long,Integer> nodeMap = new HashMap<>(); |
| | | for(Long nodeId :nodeArr){ |
| | | node.setId(UUIDUtil.generateId()); |
| | | node.setNodeId(nodeId); |
| | | baseDao.insert(node); |
| | | if (nodeMap.get(nodeId)!=null) { |
| | | node.setId(UUIDUtil.generateId()); |
| | | node.setNodeId(nodeId); |
| | | baseDao.insert(node); |
| | | nodeMap.put(nodeId,1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.zt.life.modules.mainPart.taskReliability.dto.TaskPhaseConstraintDto; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.*; |
| | | import com.zt.life.modules.mainPart.utils.GetStringSpace; |
| | | import io.swagger.models.auth.In; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.dom4j.Document; |
| | | import org.dom4j.DocumentHelper; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.*; |
| | | import java.nio.file.FileAlreadyExistsException; |
| | | import java.util.*; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | |
| | | double pointNumPerHour = 60.0 / simulatAssess.getSamplPeriod(); |
| | | |
| | | //æ¶åºå¾çº¿ |
| | | List<List<TimeDiagramStatusDto>> lineArray = new ArrayList(); |
| | | List<TimeDiagramStatusDto> statusDtoList = new ArrayList<>(); |
| | | List<TimeDiagramStatusDto> statusDtoListOld = new ArrayList<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | List<TimeDiagramStatusDto> statusDtoList = new ArrayList<>(); |
| | | x1 = 0; |
| | | groupY = groupHeight * i; |
| | | ProductStatusDto dto = list.get(i); |
| | |
| | | break; |
| | | } |
| | | x2 = x1 + status.getTimes() * pointNumPerHour + 5; |
| | | statusDtoList.add(new TimeDiagramStatusDto(x1, x2, status2)); |
| | | if (i == 0) { |
| | | statusDtoList.add(new TimeDiagramStatusDto(x1, x2, status2)); |
| | | } else { |
| | | statusDtoListOld.add(new TimeDiagramStatusDto(x1, x2, status2)); |
| | | } |
| | | JSONObject lineJson = new JSONObject(templetsStrMap.get(status.getStatus())); |
| | | setlineXy(lineJson, x1, y, x2, y, ""); |
| | | JsonUtils2.setJsonValueByPath(lineJson, "data/status".split("/"), status.getStatus()); |
| | |
| | | x1 = x2 - 5; |
| | | 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()); |
| | |
| | | curPointHour += periodHour; |
| | | } |
| | | |
| | | List<TimeDiagramStatusDto> statusDtoListNew = new ArrayList<>(); |
| | | while (statusDtoListOld.size() > 0) { |
| | | statusDtoListOld.stream().sorted(Comparator.comparing(TimeDiagramStatusDto::getX1)).collect(Collectors.toList()); |
| | | TimeDiagramStatusDto nextStatusDto = statusDtoListOld.get(0); |
| | | if (statusDtoListNew.size() == 0) { |
| | | statusDtoListNew.add(nextStatusDto); |
| | | } else { |
| | | TimeDiagramStatusDto currentStatusDto = statusDtoListNew.get(statusDtoListNew.size() - 1); |
| | | if (nextStatusDto.getStatus() < currentStatusDto.getStatus()) { |
| | | if (nextStatusDto.getX1() == currentStatusDto.getX1() && nextStatusDto.getX2() == currentStatusDto.getX2()) { |
| | | currentStatusDto.setStatus(nextStatusDto.getStatus()); |
| | | } else if (nextStatusDto.getX1() == currentStatusDto.getX1() && nextStatusDto.getX2() < currentStatusDto.getX2()) { |
| | | statusDtoListOld.add(new TimeDiagramStatusDto(nextStatusDto.getX2(), currentStatusDto.getX2(), currentStatusDto.getStatus())); |
| | | currentStatusDto.setStatus(nextStatusDto.getStatus()); |
| | | currentStatusDto.setX2(nextStatusDto.getX2()); |
| | | } else if (nextStatusDto.getX1() == currentStatusDto.getX1() && nextStatusDto.getX2() > currentStatusDto.getX2()) { |
| | | currentStatusDto.setStatus(nextStatusDto.getStatus()); |
| | | currentStatusDto.setX2(nextStatusDto.getX2()); |
| | | } else if (nextStatusDto.getX1() > currentStatusDto.getX1() && nextStatusDto.getX2() >= currentStatusDto.getX2()) { |
| | | currentStatusDto.setX2(nextStatusDto.getX1()); |
| | | statusDtoListNew.add(new TimeDiagramStatusDto(nextStatusDto.getX1(), nextStatusDto.getX2(), nextStatusDto.getStatus())); |
| | | } else if (nextStatusDto.getX1() > currentStatusDto.getX1() && nextStatusDto.getX2() < currentStatusDto.getX2()) { |
| | | currentStatusDto.setX2(nextStatusDto.getX1()); |
| | | statusDtoListNew.add(new TimeDiagramStatusDto(nextStatusDto.getX1(), nextStatusDto.getX2(), nextStatusDto.getStatus())); |
| | | statusDtoListOld.add(new TimeDiagramStatusDto(nextStatusDto.getX2(), currentStatusDto.getX2(), currentStatusDto.getStatus())); |
| | | } |
| | | } else { |
| | | if (nextStatusDto.getX2() > currentStatusDto.getX2()) { |
| | | statusDtoListOld.add(new TimeDiagramStatusDto(currentStatusDto.getX2(), nextStatusDto.getX2(), nextStatusDto.getStatus())); |
| | | } |
| | | } |
| | | } |
| | | statusDtoListOld.remove(0); |
| | | } |
| | | timeDiagramDto.setTotalWidth(x2); |
| | | double pointRate = timeDiagramDto.getTotalWidth() / timeDiagramDto.getSmallWidth(); |
| | | |
| | | List<TimeDiagramStatusDto> subStatusDtoList = new ArrayList<>(); |
| | | int lastStatus = 5; |
| | | boolean isFirst = true; |
| | | x1 = 0; |
| | | for (double i = 0; i < timeDiagramDto.getSmallWidth(); i = i + timeDiagramDto.getMinPointNum()) { |
| | | int netStatus = 5; |
| | | for (int j = 1; j < list.size(); j++) { |
| | | if (i >= 448) { |
| | | System.out.println(111); |
| | | } |
| | | int tmpStatus = getPointStatus(lineArray.get(j), i * pointRate, (i + timeDiagramDto.getMinPointNum()) * pointRate - 1); |
| | | if (tmpStatus < netStatus) { |
| | | netStatus = tmpStatus; |
| | | } |
| | | } |
| | | if (!isFirst) { |
| | | if (lastStatus != netStatus) { |
| | | subStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus)); |
| | | lastStatus = netStatus; |
| | | x1 = i; |
| | | } |
| | | } else { |
| | | lastStatus = netStatus; |
| | | isFirst = false; |
| | | } |
| | | x2 = i + timeDiagramDto.getMinPointNum() - 1; |
| | | } |
| | | subStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus)); |
| | | List<List<TimeDiagramStatusDto>> lineArray = new ArrayList(); |
| | | lineArray.add(statusDtoList); |
| | | lineArray.add(statusDtoListNew); |
| | | |
| | | List<TimeDiagramStatusDto> parentStatusDtoList = new ArrayList<>(); |
| | | lastStatus = 5; |
| | | isFirst = true; |
| | | x1 = 0; |
| | | for (double i = 0; i < timeDiagramDto.getSmallWidth(); i = i + timeDiagramDto.getMinPointNum()) { |
| | | if (i >= 448) { |
| | | System.out.println(111); |
| | | } |
| | | int netStatus = getPointStatus(lineArray.get(0), i * pointRate, (i + timeDiagramDto.getMinPointNum()) * pointRate - 1); |
| | | if (!isFirst) { |
| | | if (lastStatus != netStatus) { |
| | | parentStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus)); |
| | | List<List<TimeDiagramStatusDto>> smallStatusDtoList = new ArrayList<>(); |
| | | for (int j = 0; j < lineArray.size(); j++) { |
| | | List<TimeDiagramStatusDto> tmpStatusDtoList = new ArrayList<>(); |
| | | int lastStatus = 5; |
| | | Boolean isFirst = true; |
| | | x1 = 0; |
| | | for (double i = 0; i < timeDiagramDto.getSmallWidth(); i = i + timeDiagramDto.getMinPointNum()) { |
| | | int netStatus = getPointStatus(lineArray.get(j), i * pointRate, (i + timeDiagramDto.getMinPointNum()) * pointRate - 1); |
| | | if (!isFirst) { |
| | | if (lastStatus != netStatus) { |
| | | tmpStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus)); |
| | | lastStatus = netStatus; |
| | | x1 = i; |
| | | } |
| | | } else { |
| | | lastStatus = netStatus; |
| | | x1 = i; |
| | | isFirst = false; |
| | | } |
| | | } else { |
| | | lastStatus = netStatus; |
| | | isFirst = false; |
| | | x2 = i + timeDiagramDto.getMinPointNum() - 1; |
| | | } |
| | | x2 = i + timeDiagramDto.getMinPointNum() - 1; |
| | | tmpStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus)); |
| | | smallStatusDtoList.add(tmpStatusDtoList); |
| | | } |
| | | parentStatusDtoList.add(new TimeDiagramStatusDto(x1, x2, lastStatus)); |
| | | |
| | | JSONObject jsonObject2 = new JSONObject(modelStr2); |
| | | JSONArray jsonArray2 = jsonObject2.getJSONArray("cells"); |
| | | List<List<TimeDiagramStatusDto>> smallStatusDtoList = new ArrayList<>(); |
| | | smallStatusDtoList.add(parentStatusDtoList); |
| | | smallStatusDtoList.add(subStatusDtoList); |
| | | |
| | | y = 10; |
| | | for (int i = 0; i < smallStatusDtoList.size(); i++) { |
| | | for (TimeDiagramStatusDto status : smallStatusDtoList.get(i)) { |
| | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result simulate(SimulatAssess simulatAssess) { |
| | | Result result = null; |
| | | public List<TaskModelCheckResultDto> simulateChecK(SimulatAssess simulatAssess) { |
| | | List<TaskModelCheckResultDto> result = null; |
| | | // 1. æ£æ¥æ¨¡å宿´æ§ |
| | | List<TaskModelCheckResultDto> chkResult = taskService.checkTaskModel(simulatAssess.getProductId(), |
| | | simulatAssess.getTaskModelId()); |
| | | if (chkResult.size() > 0) { |
| | | result = Result.ok(chkResult); |
| | | return result; |
| | | return chkResult; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean simulate(SimulatAssess simulatAssess) { |
| | | Boolean result = false; |
| | | // 2. ç»è£
ä¾ç®æ³åºä»¿ççæ¨¡åxml |
| | | assembleModelXml(simulatAssess); |
| | | |
| | |
| | | return result; |
| | | } |
| | | |
| | | private Result callReliaSimLib(SimulatAssess simulatAssess) { |
| | | Result result = null; |
| | | private Boolean callReliaSimLib(SimulatAssess simulatAssess) { |
| | | Boolean result = false; |
| | | InputStream is = null; |
| | | BufferedReader br = null; |
| | | try { |
| | |
| | | ReliaSimLibResult rtn = com.alibaba.fastjson.JSONObject.parseObject(line, ReliaSimLibResult.class); |
| | | if ("0".equals(rtn.getCode())) { |
| | | logger.info("å¯å¨å¯é æ§ä»¿çè¯ä¼°ç®æ³åºæåã"); |
| | | result = Result.ok(); |
| | | result = true; |
| | | } else { |
| | | String errorMsg = rtn.getErrorMsg(); |
| | | throw new RenException("å¯å¨å¯é æ§ä»¿çè¯ä¼°ç®æ³åºå¤±è´¥: errorMsg=" + errorMsg); |
| | |
| | | List<ParamData> paramDataList = paramDataDao.getDeviceParams(productId); |
| | | Long taskId = simulatAssess.getTaskModelId(); |
| | | Task task = taskService.get(taskId); |
| | | if (simulatAssess.getTaskDuration() != null) { |
| | | task.setTaskDuration(simulatAssess.getTaskDuration()); |
| | | } |
| | | List<TaskBinoParam> binoParams = taskBinoParamDao.getBinoParams(taskId); |
| | | |
| | | // 1. 计ç®åä»»å¡é¶æ®µçè¿è¡æ¶é¿ |
| | |
| | | } |
| | | } |
| | | |
| | | public SchemeComparDto SchemeCompar(String[] taskList, Long showProductId) { |
| | | SchemeComparDto dto = new SchemeComparDto(); |
| | | public SimulatResult SchemeCompar(String[] taskList, Long showProductId, Integer samplPeriod, Integer simulatFrequency) { |
| | | SimulatResult simulatResult = new SimulatResult(); |
| | | List<Long> idList = new ArrayList<>(); |
| | | List<TaskModelCheckResultDto> result = null; |
| | | /* SchemeComparDto dto = new SchemeComparDto(); |
| | | List<SimulaDataDto> dataDtoList = new ArrayList<>(); |
| | | List<SchemeComparCurve> curveList = new ArrayList<>(); |
| | | List<Double> xData = new ArrayList<>(); |
| | | SimulatAssess simulatAssess; |
| | | SimulaDataDto data; |
| | | |
| | | SimulaDataDto data;*/ |
| | | |
| | | List<SimulatAssess> simulatAssessList = new ArrayList<>(); |
| | | |
| | | Task task; |
| | | double maxTaskDuration = 0.0; |
| | | for (String taskId : taskList) { |
| | | Long taskModelId = Long.parseLong(taskId); |
| | | task = taskService.get(taskModelId); |
| | | simulatAssess = this.getByTaskId(taskModelId); |
| | | SimulaDataDto resultData; |
| | | if (showProductId != null) { |
| | | simulatAssess.setProductId(showProductId); |
| | | resultData = this.getResultXML(simulatAssess); |
| | | } else { |
| | | resultData = this.getResultXML(simulatAssess); |
| | | task = taskService.get(Long.parseLong(taskId)); |
| | | if (task.getTaskDuration() > maxTaskDuration) { |
| | | maxTaskDuration = task.getTaskDuration(); |
| | | } |
| | | |
| | | data = resultData; |
| | | data.setName(task.getTaskName()); |
| | | dataDtoList.add(data); |
| | | xData = resultData.getCurveParam().getXData(); |
| | | SimulatAssess simulatAssess = new SimulatAssess(); |
| | | Long id = UUIDUtil.generateId(); |
| | | simulatAssess.setId(id); |
| | | simulatAssess.setName(""); |
| | | simulatAssess.setProductId(showProductId); |
| | | simulatAssess.setSamplPeriod(samplPeriod); |
| | | simulatAssess.setSimulatFrequency(simulatFrequency); |
| | | simulatAssess.setTaskDuration(maxTaskDuration); |
| | | simulatAssess.setTaskModelId(Long.parseLong(taskId)); |
| | | |
| | | SchemeComparCurve curve = new SchemeComparCurve(); |
| | | curve.setName(task.getTaskName()); |
| | | curve.setSmooth(true); |
| | | curve.setType("line"); |
| | | curve.setData(resultData.getCurveParam().getYData()); |
| | | curveList.add(curve); |
| | | simulatAssessList.add(simulatAssess); |
| | | result = simulateChecK(simulatAssess); |
| | | if (result!=null){ |
| | | simulatResult.setType("errorList"); |
| | | simulatResult.setErrList(result); |
| | | return simulatResult; |
| | | } |
| | | idList.add(id); |
| | | } |
| | | dto.setXDataList(xData); |
| | | dto.setDataList(dataDtoList); |
| | | dto.setCurveList(curveList); |
| | | return dto; |
| | | |
| | | for (SimulatAssess simulatAssess : simulatAssessList) { |
| | | simulatAssess.setTaskDuration(maxTaskDuration); |
| | | this.simulate(simulatAssess); |
| | | } |
| | | |
| | | simulatResult.setType("idList"); |
| | | simulatResult.setIdList(idList); |
| | | return simulatResult; |
| | | } |
| | | |
| | | public SimulaDataDto getResultXML(SimulatAssess simulatAssess) { |
| | |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | public String verify(Long taskId) { |
| | | StringBuilder result = new StringBuilder(); |
| | | Task task = taskService.get(taskId); |
| | | double taskTime = task.getTaskDuration(); |
| | | List<OperatConditModel> list = baseDao.getModel(taskId); |
| | | List<Double> reliabiyList = new ArrayList<>(); |
| | | String modelStr2 = ""; |
| | | for (OperatConditModel model : list) { |
| | | if (model.getProductId().equals(task.getProductId())) { |
| | | modelStr2 = model.getContent(); |
| | | continue; |
| | | } |
| | | List<verifyDto> listNodes = baseDao.getNode(model.getModelId()); |
| | | for (verifyDto node : listNodes) { |
| | | //lmd,reliabiy,failRate |
| | | double lmd = 1 / node.getMtbf(); |
| | | double reliabiy = Math.exp(-1 * lmd * taskTime); |
| | | double failRate = 1 - reliabiy; |
| | | node.setLmd(lmd); |
| | | node.setReliabiy(reliabiy); |
| | | node.setFailRate(failRate); |
| | | } |
| | | int total = listNodes.size(); |
| | | String modelStr = model.getContent(); |
| | | //æ¾å°è¡¨å³æ°é |
| | | |
| | | if (modelStr.contains("switch")) { |
| | | double a = 0; |
| | | double lmd = listNodes.get(0).getLmd(); |
| | | result.append("\n").append(total).append("个ç¸åè®¾å¤æè,3é1,MTTBCFæ¯").append(listNodes.get(0).getMtbf()).append("\n"); |
| | | for (int i = 0; i <= total - 1; i++) { |
| | | double ijc = getjc(i); |
| | | double b = Math.pow(taskTime * lmd, i) * Math.exp(-1 * lmd * taskTime) / ijc; |
| | | a = a + b; |
| | | result.append("æ").append(i + 1).append("个设å¤å¥½ççæ¦ç为").append(b).append("\n"); |
| | | } |
| | | result.append("æ´ä¸ªæèç³»ç»çå¯é 度为").append(new Formatter().format("%.4f", a)).append("\n"); |
| | | reliabiyList.add(a); |
| | | } else if (modelStr.contains("parallel")) { |
| | | double a = 1; |
| | | result.append("\nå¹¶èè®¾å¤æ").append(total).append("个\n"); |
| | | for (int i = 0; i < listNodes.size(); i++) { |
| | | a = a * listNodes.get(i).getFailRate(); |
| | | result.append("第").append(i + 1).append("个设å¤çMTBCF为").append(listNodes.get(i).getMtbf()).append(",").append(i + 1).append("个设å¤å¹¶èç失æç为").append(a).append("\n"); |
| | | } |
| | | double reliabiy = 1 - a; |
| | | result.append("æ´ä¸ªå¹¶èç³»ç»ç失æç为").append(a).append("æ´ä¸ªå¹¶èç³»ç»çå¯é 度为").append(new Formatter().format("%.4f", reliabiy)).append("\n"); |
| | | reliabiyList.add(reliabiy); |
| | | } else if (modelStr.contains("vote")) { |
| | | Integer voteNum = baseDao.getVoteNum(model.getModelId()); |
| | | if (voteNum != null) { |
| | | result.append("\n").append(total).append("个ç¸å设å¤è¡¨å³,MTBCF为").append(listNodes.get(0).getMtbf()).append("è¡¨å³æ°é为").append(voteNum).append("个\n"); |
| | | double a = 0; |
| | | double zjc = getjc(total); |
| | | double reliabiy = listNodes.get(0).getReliabiy(); |
| | | for (int i = voteNum; i <= total; i++) { |
| | | double ijc = getjc(i); |
| | | double nijc = getjc(total - i); |
| | | double b = (zjc / (ijc * nijc)) * Math.pow(reliabiy, i) * Math.pow(1 - reliabiy, total - i); |
| | | a = a + b; |
| | | result.append("æ").append(i).append("ä¸ªè®¾å¤æ¯å¥½çæ¦ç为").append(b).append("\n"); |
| | | } |
| | | result.append("æ´ä¸ªè¡¨å³ç³»ç»çå¯é 度为").append(new Formatter().format("%.4f", a)).append("\n"); |
| | | reliabiyList.add(a); |
| | | } |
| | | |
| | | } |
| | | } |
| | | double totalReliabiy = 1; |
| | | if (modelStr2.contains("parallel")) { |
| | | for (Double reliabiy : reliabiyList) { |
| | | totalReliabiy = totalReliabiy * (1 - reliabiy); |
| | | } |
| | | totalReliabiy = 1 - totalReliabiy; |
| | | } else { |
| | | for (Double reliabiy : reliabiyList) { |
| | | totalReliabiy = totalReliabiy * reliabiy; |
| | | } |
| | | } |
| | | result.append("\næ´ä¸ªæ»ä½ç³»ç»çå¯é 度为").append(totalReliabiy).append("\n"); |
| | | return String.valueOf(result); |
| | | } |
| | | |
| | | Double getjc(int a) { |
| | | double result = 1.0; |
| | | for (int i = a; i > 0; i--) |
| | | result = result * i; |
| | | return result; |
| | | } |
| | | |
| | | public SchemeComparDto getEcharts(String[] taskList, Long showProductId) { |
| | | SchemeComparDto dto = new SchemeComparDto(); |
| | | List<SimulaDataDto> dataDtoList = new ArrayList<>(); |
| | | List<SchemeComparCurve> curveList = new ArrayList<>(); |
| | | List<Double> xData = new ArrayList<>(); |
| | | SimulatAssess simulatAssess; |
| | | SimulaDataDto data; |
| | | |
| | | Task task; |
| | | for (String taskId : taskList) { |
| | | Long taskModelId = Long.parseLong(taskId); |
| | | task = taskService.get(taskModelId); |
| | | simulatAssess = this.getByTaskId(taskModelId); |
| | | simulatAssess.setDataType("fz"); |
| | | SimulaDataDto resultData; |
| | | if (showProductId != null) { |
| | | simulatAssess.setProductId(showProductId); |
| | | resultData = this.getResultXML(simulatAssess); |
| | | } else { |
| | | resultData = this.getResultXML(simulatAssess); |
| | | } |
| | | |
| | | data = resultData; |
| | | data.setName(task.getTaskName()); |
| | | dataDtoList.add(data); |
| | | xData = resultData.getCurveParam().getXData(); |
| | | |
| | | SchemeComparCurve curve = new SchemeComparCurve(); |
| | | curve.setName(task.getTaskName()); |
| | | curve.setSmooth(true); |
| | | curve.setType("line"); |
| | | curve.setData(resultData.getCurveParam().getYData()); |
| | | curveList.add(curve); |
| | | } |
| | | dto.setXDataList(xData); |
| | | dto.setDataList(dataDtoList); |
| | | dto.setCurveList(curveList); |
| | | return dto; |
| | | } |
| | | } |
| | |
| | | p.repair_mttcr as repairMttcr, |
| | | p.repair_mttcr_other_params2 as repairMttcrOtherParams2, |
| | | p.repair_mttcr_other_params3 as repairMttcrOtherParams3, |
| | | p.task_mtbcf_regul_succ_rate as success_rate |
| | | p.task_mtbcf_regul_succ_rate as success_rate, |
| | | p.basic_unit_num as basicUnitNum |
| | | FROM product_model a |
| | | left join sys_dict_data d on d.DICT_VALUE = a.product_type and dict_type_id = '1728965873022050306' |
| | | left join param_data p on p.product_id = a.id |
| | |
| | | <select id="getByPid" resultType="java.lang.Long"> |
| | | select id |
| | | from product_model |
| | | where IS_DELETE=0 and PID=${id} |
| | | where IS_DELETE = 0 |
| | | and PID = ${id} |
| | | </select> |
| | | <select id="getProductByShip" resultType="com.zt.life.modules.mainPart.basicInfo.dto.ProductDto"> |
| | | select a.id, |
| | | a.pid, |
| | | a.name, |
| | | a.product_type, |
| | | a.name_path, |
| | | a.same_sb_name, |
| | | a.equip_type, |
| | | b.reliab_distrib_type, |
| | | b.basic_join_compute, |
| | | b.basic_mtbf_regulate, |
| | | b.basic_mtbf_regul_succ_rate, |
| | | b.basic_mtbf_operating_ratio, |
| | | b.task_mtbcf_regulate, |
| | | b.task_mtbcf_other_params2, |
| | | b.task_mtbcf_other_params3, |
| | | b.task_mtbcf_regul_succ_rate, |
| | | b.task_mtbcf_operating_ratio, |
| | | b.repairable, |
| | | b.repair_distrib_type, |
| | | b.repair_mttcr, |
| | | b.repair_mttcr_other_params2, |
| | | b.repair_mttcr_other_params3 |
| | | from product_model a, |
| | | param_data b |
| | | where a.IS_DELETE = 0 |
| | | and b.IS_DELETE = 0 |
| | | and a.ship_id = ${shipId} |
| | | AND a.id <> a.ship_id |
| | | and a.id = b.product_id |
| | | </select> |
| | | </mapper> |
| | |
| | | order by CREATE_DATE desc |
| | | limit 1 |
| | | </select> |
| | | <select id="getModel" resultType="com.zt.life.modules.mainPart.taskReliability.model.OperatConditModel"> |
| | | SELECT d.product_id, |
| | | d.model_id, |
| | | e.content |
| | | FROM task a, |
| | | task_phase b, |
| | | `task_phase_model` c, |
| | | operat_condit_model d, |
| | | model_rbd e |
| | | WHERE a.id = ${taskId} |
| | | AND a.IS_DELETE = 0 |
| | | AND b.task_id = a.id |
| | | AND b.IS_DELETE = 0 |
| | | AND c.phase_id = b.id |
| | | AND c.operat_condit_duration_rate > 0 |
| | | AND c.IS_DELETE = 0 |
| | | AND d.operat_condit_id = c.operat_condit_id |
| | | AND d.IS_DELETE = 0 |
| | | AND e.id = d.model_id |
| | | AND e.IS_DELETE = 0 |
| | | </select> |
| | | <select id="getNode" resultType="com.zt.life.modules.mainPart.taskReliability.dto.verifyDto"> |
| | | SELECT c.`NAME`, |
| | | c.id, |
| | | b.task_mtbcf_regulate as mtbf |
| | | FROM `model_rbd_node` a, |
| | | param_data b, |
| | | product_model c |
| | | WHERE a.node_id = c.id |
| | | and a.model_id = ${modelId} |
| | | AND c.id = b.product_id |
| | | AND a.is_delete = 0 |
| | | AND b.is_delete = 0 |
| | | AND c.is_delete = 0 |
| | | </select> |
| | | <select id="getVoteNum" resultType="java.lang.Integer"> |
| | | select vote_num |
| | | from algorithm |
| | | where is_delete = 0 |
| | | and model_id = ${modelId} |
| | | and model_type = 'vote' |
| | | and vote_num is not null |
| | | limit 1 |
| | | </select> |
| | | </mapper> |
| | |
| | | <span v-else v-text="scope.row.basicMtbfAcceptSuccRate"></span> |
| | | </template> |
| | | </el-table-column>--> |
| | | <!-- <el-table-column prop="basicUnitNum" label="åå
æ°é" :key="11" width="100" align="center"> |
| | | <el-table-column prop="basicUnitNum" label="åå
æ°é" :key="11" width="100" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-if="scope.row.isEdit" v-model="scope.row.basicUnitNum"></el-input> |
| | | <span v-else v-text="scope.row.basicUnitNum"></span> |
| | | </template> |
| | | </el-table-column>--> |
| | | </el-table-column> |
| | | <el-table-column prop="basicRunsNum" label="è¿è¡æ¬¡æ°" :key="12" width="100" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-if="scope.row.isEdit" v-model="scope.row.basicRunsNum"></el-input> |
| | |
| | | import Cookies from "js-cookie"; |
| | | import TyProductModel from "./TyProductModel-AddOrUpdate"; |
| | | import ProductImport from "./ProductImport"; |
| | | import qs from 'qs' |
| | | |
| | | export default { |
| | | data() { |
| | |
| | | type: '', |
| | | pid: '', |
| | | srcId: '', |
| | | } |
| | | }, |
| | | productType:'' |
| | | } |
| | | }, |
| | | components: { |
| | |
| | | this.$refs.ProductImport.$refs.dialog.init(row) |
| | | }, |
| | | async exportData(row) { |
| | | let params = { |
| | | shipId:row.id |
| | | } |
| | | let res = await this.$http.get(`/basicInfo/XhProductModel/exportData`,{params:params}) |
| | | console.log(row) |
| | | let params = qs.stringify({ |
| | | 'token': Cookies.get('token'), |
| | | shipId:row.id, |
| | | fileName:row.name |
| | | }) |
| | | let apiURL = `/basicInfo/XhProductModel/exportData` |
| | | window.location.href = `${window.SITE_CONFIG['apiURL']}${apiURL}?${params}` |
| | | |
| | | |
| | | |
| | | }, |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | canAdd: true, |
| | | nodeX: '', |
| | | nodeY: '', |
| | | isFirstLoad: true, |
| | |
| | | }) |
| | | this.graph.centerContent() |
| | | const stencil = new Addon.Stencil({ |
| | | getDragNode: (node) => node.clone({keepId: true}), |
| | | //getDragNode: (node) => node.clone({keepId: true}), |
| | | getDropNode: (node) => { |
| | | this.canAdd = true |
| | | const {width, height} = node.size() |
| | | if (node.getData().type && node.getData().nodeType === 'dashedBox') { |
| | | return node.clone().size(60, 40) |
| | | } |
| | | if (node.getData().type && node.getData().type === 'imageNodes2') { |
| | | return node.clone({keepId: true}) |
| | | } else { |
| | | return node.clone() |
| | | } |
| | | }, |
| | | validateNode: (node) => { |
| | | const existingNodes = this.graph.getNodes(); // è·åç»å¸ä¸ææèç¹ |
| | | for (const existingNode of existingNodes) { |
| | | if (existingNode.id === node.id) { |
| | | this.$message({message: '该设å¤èç¹å·²å¨ç»å¸ä¸ï¼æ æ³å次ç»å¶', type: 'warning'}) |
| | | return false; // åæ¶æ·»å èç¹æä½ |
| | | const nodes = this.graph.getNodes() |
| | | let deviceNoArr = [] |
| | | // æ£æ¥é¤å½åèç¹ä¹å¤çææèç¹çå
å´æ¡æ¯å¦ç¸äº¤ |
| | | for (const node2 of nodes) { |
| | | console.log(node2, 'saveDiagram node') |
| | | if (node2.getData().nodeType == 'node' && node2.getData().dataId) { |
| | | if (node2.getData().dataId == node.getData().dataId) { |
| | | deviceNoArr.push(node2.getData().deviceNo) |
| | | } |
| | | } |
| | | } |
| | | let no = 0 |
| | | console.log(node, 'node') |
| | | console.log(deviceNoArr, 'deviceNoArr') |
| | | for (let i = 1; i <= node.getData().basicUnitNum; i++) { |
| | | if (deviceNoArr.findIndex(item => item === i) === -1) { |
| | | no = i |
| | | node.getData().deviceNo = i |
| | | node.attr('text/text', node.attr('text/text') + '-' + i) |
| | | break |
| | | } |
| | | } |
| | | if (no === 0) { |
| | | this.canAdd = false |
| | | } |
| | | } |
| | | return node.clone() |
| | | |
| | | }, |
| | | validateNode: (node) => { |
| | | if (!this.canAdd) { |
| | | this.$message({message: '该设å¤èç¹å·²å¨ç»å¸ä¸ï¼æ æ³å次ç»å¶', type: 'warning'}) |
| | | return false |
| | | } |
| | | |
| | | }, |
| | | title: '', |
| | | target: this.graph, |
| | |
| | | //imageUrl: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=${item.imgPath}`, |
| | | width: 60, |
| | | height: 60, |
| | | id: item.dataId, // æå¨è®¾ç½®èç¹ç ID |
| | | //id: item.dataId, // æå¨è®¾ç½®èç¹ç ID |
| | | data: { |
| | | type: 'imageNodes2', |
| | | dataId: item.dataId, |
| | | basicUnitNum: item.basicUnitNum, |
| | | deviceNo: 0, |
| | | nodeType: item.nodeType, |
| | | nodeTypeExt: item.nodeTypeExt, |
| | | productType: item.productType, |
| | |
| | | } |
| | | const nodeType = node.getData().nodeType; // è·åèç¹çç±»å |
| | | const nodeObj = node |
| | | console.log(123) |
| | | console.log(node.id, 'node.id') |
| | | let intersectNode = this.findIntersectsNode(node) |
| | | if (intersectNode) { // 彿èç¹ç¸äº¤ ==>å¹¶è¡ |
| | | this.addBranch(intersectNode, nodeObj) |
| | |
| | | createParallelBrach(x, y, dragNode) { |
| | | dragNode.position(x + 320, y - dragNode.size().height / 2) |
| | | const connectNode = this.createConnectNode(x + 50, y) |
| | | this.createBrach(dragNode,connectNode,x,y-50) |
| | | this.createBrach(dragNode,connectNode,x,y+50) |
| | | this.createBrach(dragNode, connectNode, x, y - 50) |
| | | this.createBrach(dragNode, connectNode, x, y + 50) |
| | | |
| | | return {newStartNode: connectNode, newEndNode: dragNode} |
| | | }, |
| | | createBrach(dragNode,connectNode,x,y){ |
| | | createBrach(dragNode, connectNode, x, y) { |
| | | const dashedBox = this.createDashedBox(x + 150, y) |
| | | dragNode.setData({startNodeId: connectNode.id}) |
| | | |
| | |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // ä»ä¸æ¹å¼å§ |
| | | startDirections: ['top', 'bottom'], // ä»ä¸æ¹å¼å§ |
| | | endDirections: ['left'], // åå·¦æ¹ç»æ |
| | | }, |
| | | }, |
| | |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['right'], // ä»ä¸æ¹å¼å§ |
| | | endDirections: ['top','bottom'], // åå·¦æ¹ç»æ |
| | | endDirections: ['top', 'bottom'], // åå·¦æ¹ç»æ |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'}, |
| | |
| | | <zt-select style="width: 400px" v-model="dataForm.taskModelId" :datas="schemeList" |
| | | @change="onTaskSelected" :multiple="true"/> |
| | | </zt-form-item> |
| | | <zt-form-item label="æ¶é´åç" prop="samplPeriod"> |
| | | <el-input type="number" :min="1" v-model="dataForm.samplPeriod"> |
| | | <template slot="append">åé</template> |
| | | </el-input> |
| | | </zt-form-item> |
| | | <zt-form-item label="ä»¿çæ¬¡æ°" prop="simulatFrequency"> |
| | | <el-input type="number" :min="1" v-model="dataForm.simulatFrequency"> |
| | | <template slot="append">次æ°</template> |
| | | </el-input> |
| | | </zt-form-item> |
| | | <zt-form-item> |
| | | <zt-button @click="compair()">æ¹æ¡å¯¹æ¯</zt-button> |
| | | </zt-form-item> |
| | | </el-form> |
| | | <el-progress v-if="isShow" :percentage="percentage"></el-progress> |
| | | <el-col :span="4"> |
| | | <div style="margin-right: 5px;height: calc(100vh - 230px)" v-if="isSelect"> |
| | | <product-model-tree @on-selected="onTreeSelected" showXdy="false" |
| | |
| | | </el-col> |
| | | <el-col :span="20"> |
| | | <div class="fa-card-a" style="position: relative;height: calc(100vh - 230px)"> |
| | | <div v-if="isShow"> |
| | | <div v-if="Show"> |
| | | <el-button v-if="isZk" type="info" size="small" icon="el-icon-caret-bottom" |
| | | style="position: absolute;right: 10%;top: 9%;z-index: 1" @click="zk()"></el-button> |
| | | <el-button v-if="!isZk" type="info" size="small" icon="el-icon-caret-right" |
| | |
| | | width="100px" |
| | | align="right"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ keepNumber(scope.row.mtbf) }}</span> |
| | | <span>{{ keepNumberBy2(scope.row.mtbf) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | width="100px" |
| | | align="right"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ keepNumber(scope.row.mttr) }}</span> |
| | | <span>{{ keepNumberBy2(scope.row.mttr) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | width="100px" |
| | | align="right"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ keepNumber(scope.row.mttr) }}</span> |
| | | <span>{{ keepNumberBy4(scope.row.msr) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-dialog v-dialogDrag :close-on-click-modal="false" top="8vh" :visible.sync="dialogVisible" title="æ¨¡åæ£æ¥" |
| | | width="60%" @close="dialogVisible = false"> |
| | | <el-tag type="danger" style="margin-bottom: 10px">模åå®ä¹/åæ°é
ç½®éåå¨ä»¥ä¸é®é¢ï¼</el-tag> |
| | | <el-table :data="modelCheckResult" height="350" |
| | | :header-cell-style="{'text-align':'center'}"> |
| | | <el-table-column prop="category" label="æ£æ¥ç»æ" align="center" width="150"/> |
| | | <el-table-column prop="taskName" label="ä»»å¡åç§°" align="center"/> |
| | | <el-table-column prop="taskPhaseName" label="ä»»å¡é¶æ®µåç§°" align="center"/> |
| | | <el-table-column prop="gkName" label="å·¥åµåç§°" align="center"/> |
| | | <el-table-column prop="nodeName" label="èç¹åç§°" align="center"/> |
| | | <el-table-column prop="modelName" label="模ååç§°" align="center"/> |
| | | <el-table-column prop="deviceName" label="设å¤åç§°" align="center"/> |
| | | <el-table-column prop="paramName" label="åæ°åç§°" align="center"/> |
| | | </el-table> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="dialogVisible = false">å
³ é</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | myChartStyle: {float: "left", width: "100%", height: "600px"}, //å¾è¡¨æ ·å¼ |
| | | isSelect: false, |
| | | isShow: false, |
| | | Show: false, |
| | | isZk: true, |
| | | productList: [], |
| | | schemeList: [], |
| | |
| | | productId: '', |
| | | showProductId: '', |
| | | dataType: 'fz', |
| | | samplPeriod: '10', |
| | | simulatFrequency: 500, |
| | | }, |
| | | percentage: 2, |
| | | xDataList: [], |
| | | seriesList: [], |
| | | tableData: [], |
| | | taskList: [], |
| | | fzIdList: [], |
| | | dialogVisible: false, |
| | | modelCheckResult: [], |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.getProductList() |
| | | }, |
| | | computed: { |
| | | keepNumber() { //è¿æ»¤å¨ä¿ç4ä¸ºå°æ° |
| | | keepNumberBy4() { //è¿æ»¤å¨ä¿ç4ä¸ºå°æ° |
| | | return function (val) { // 对计ç®å±æ§è¿è¡ä¼ å |
| | | const numM = Number(val).toFixed(5); |
| | | return numM.substring(0, numM.length - 1); |
| | | } |
| | | }, |
| | | keepNumberBy2() { //è¿æ»¤å¨ä¿ç4ä¸ºå°æ° |
| | | return function (val) { // 对计ç®å±æ§è¿è¡ä¼ å |
| | | const numM = Number(val).toFixed(3); |
| | | return numM.substring(0, numM.length - 1); |
| | | } |
| | | }, |
| | |
| | | components: { |
| | | ProductModelTree, |
| | | }, |
| | | |
| | | watch: { |
| | | percentage() { |
| | | if (this.percentage === 100) { |
| | | this.getEcharts(); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | onTreeSelected(data) { |
| | | if (this.dataForm.taskModelId.length > 0) { |
| | |
| | | console.log(data, 'onProductSelected') |
| | | this.dataForm.showProductId = data.id |
| | | this.$nextTick(() => { |
| | | this.compair() |
| | | this.getEcharts() |
| | | }) |
| | | } |
| | | }, |
| | |
| | | console.log(res.data) |
| | | this.schemeList = res.data |
| | | }, |
| | | getStroke() { |
| | | if (this.percentage < 100) { |
| | | let param = { |
| | | taskList: this.fzIdList |
| | | } |
| | | this.$http.get(`/taskReliability/SimulatAssess/getCalcProgress`, {params: param}).then( |
| | | res => { |
| | | if (res.data) { |
| | | this.percentage = parseFloat(res.data) |
| | | } |
| | | } |
| | | ) |
| | | } else { |
| | | clearInterval(this.timers) |
| | | this.percentage = 0 |
| | | } |
| | | }, |
| | | async compair() { |
| | | this.isShow = true |
| | | this.dialogVisible = false |
| | | this.modelCheckResult = [] |
| | | let params = { |
| | | taskList: this.dataForm.taskModelId, |
| | | showProductId: this.dataForm.productId, |
| | | samplPeriod: this.dataForm.samplPeriod, |
| | | simulatFrequency: this.dataForm.simulatFrequency |
| | | } |
| | | console.log(this.dataForm.taskModelId, 'this.dataForm.taskModelId') |
| | | let res = await this.$http.get('/taskReliability/SimulatAssess/SchemeCompar', {params: params}) |
| | | console.log(res.data, "res") |
| | | if (res.success) { |
| | | if (res.data.type=="errorList") { |
| | | this.modelCheckResult = res.data.errList |
| | | this.dialogVisible = true |
| | | this.isShow = false |
| | | } else { |
| | | this.fzIdList = res.data.idList |
| | | this.timers = window.setInterval(this.getStroke, 1000) |
| | | } |
| | | } |
| | | }, |
| | | async getEcharts() { |
| | | let params = { |
| | | taskList: this.dataForm.taskModelId, |
| | | showProductId: this.dataForm.showProductId |
| | | } |
| | | console.log(this.dataForm.taskModelId, 'this.dataForm.taskModelId') |
| | | let res = await this.$http.get('/taskReliability/SimulatAssess/SchemeCompar', {params: params}) |
| | | let res = await this.$http.get('/taskReliability/SimulatAssess/getEcharts', {params: params}) |
| | | console.log(res.data, "res") |
| | | this.xDataList = res.data.xdataList |
| | | this.seriesList = res.data.curveList |
| | | this.tableData = res.data.dataList |
| | | |
| | | this.isShow = true |
| | | this.Show = true |
| | | this.option = { |
| | | xAxis: { |
| | | data: this.xDataList, |
| | |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <el-dialog :close-on-click-modal="false" :visible.sync="dialogVisible" title="æ¨¡åæ£æ¥" width="60%" @close="dialogVisible = false"> |
| | | <el-tag type="danger">模åå®ä¹/åæ°é
ç½®éåå¨ä»¥ä¸é®é¢ï¼</el-tag> |
| | | <el-table :data="modelCheckResult" height="100px" v-adaptive="{bottomOffset:30}" |
| | | <el-dialog v-dialogDrag :close-on-click-modal="false" top="8vh" :visible.sync="dialogVisible" title="æ¨¡åæ£æ¥" width="60%" @close="dialogVisible = false"> |
| | | <el-tag type="danger" style="margin-bottom: 10px">模åå®ä¹/åæ°é
ç½®éåå¨ä»¥ä¸é®é¢ï¼</el-tag> |
| | | <el-table :data="modelCheckResult" height="350" |
| | | :header-cell-style="{'text-align':'center'}"> |
| | | <el-table-column prop="category" label="æ£æ¥ç»æ" align="center" width="150"/> |
| | | <el-table-column prop="taskName" label="ä»»å¡åç§°" align="center"/> |
| | |
| | | console.log(data, ' onProductSelected(data)') |
| | | this.dataForm.productId = data.id |
| | | this.getTaskList() |
| | | this.dataForm.taskModelId = '' |
| | | this.$nextTick(() => { |
| | | this.$refs.ProductModelTree.getProductList() |
| | | }) |
| | |
| | | }, |
| | | getStroke() { |
| | | if (this.percentage < 100) { |
| | | this.$http.get(`/taskReliability/SimulatAssess/getCalcProgress?taskId=${this.dataForm.id}`).then( |
| | | let param = { |
| | | taskList: [this.dataForm.id] |
| | | } |
| | | this.$http.get(`/taskReliability/SimulatAssess/getCalcProgress`, {params: param}).then( |
| | | res => { |
| | | if (res.data) { |
| | | this.percentage = parseFloat(res.data) |
| | |
| | | let res = await this.$http.post('/taskReliability/SimulatAssess/analyze', this.dataForm) |
| | | if (res.success) { |
| | | console.log(res.data) |
| | | if (res.data != null && res.data.length > 0) { |
| | | if (res.data && res.data.length > 0) { |
| | | this.modelCheckResult = res.data |
| | | this.dialogVisible = true |
| | | } else { |