From 195bb5267a6ece13363303e177fee7d1fa3941aa Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期二, 19 十一月 2024 15:25:25 +0800 Subject: [PATCH] 修改 --- modules/mainPart/src/main/java/com/zt/life/modules/mainPart/taskReliability/service/SimulatAssessService.java | 36 ++++++++++++++++++++++-------------- 1 files changed, 22 insertions(+), 14 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 ec03e1b..ba5f857 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 @@ -561,22 +561,30 @@ List<ProductStatusDto> dbList = this.getProduct(productId, taskId); List<ProductStatusDto> childList = new ArrayList<>(); for (ProductStatusDto item : dbList) { - if (item.getSameSbNum() > 1) { - for (int i = 1; i <= item.getSameSbNum(); i++) { - try { - ProductStatusDto newRow = item.clone(); - newRow.setDeviceNo(i); - newRow.setName(item.getName() + "-" + i); - newRow.setDataId(item.getId().toString() + "-" + i); - childList.add(newRow); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); + int sameNum = item.getSameSbNum() == null ? 1 : item.getSameSbNum(); + for (int i = 1; i <= sameNum; i++) { + try { + ProductStatusDto newRow = null; + if (sameNum > 1) { + newRow = item.clone(); } + else + newRow = item; + if ("5".equals(newRow.getProductType())){ + newRow.setDeviceNo(i); + newRow.setDataId(item.getId().toString() + "-" + i); + if (i>1){ + newRow.setName(item.getName() + "-" + i); + } + } + else{ + newRow.setDeviceNo(0); + newRow.setDataId(item.getId().toString()); + } + childList.add(newRow); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); } - } else { - item.setDeviceNo(0); - item.setDataId(item.getId().toString()); - childList.add(item); } } childList.sort(Comparator.comparing(ProductStatusDto::getDeviceNo, Comparator.naturalOrder())); -- Gitblit v1.9.1