| | |
| | | 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())); |