diff --git a/com.actionsoft.apps.coe.pal.processlist/lib/com.actionsoft.apps.coe.pal.processlist.jar b/com.actionsoft.apps.coe.pal.processlist/lib/com.actionsoft.apps.coe.pal.processlist.jar index a3b95eff..cf365f08 100644 Binary files a/com.actionsoft.apps.coe.pal.processlist/lib/com.actionsoft.apps.coe.pal.processlist.jar and b/com.actionsoft.apps.coe.pal.processlist/lib/com.actionsoft.apps.coe.pal.processlist.jar differ diff --git a/com.actionsoft.apps.coe.pal.processlist/src/com/actionsoft/apps/coe/pal/processlist/web/PALRepositoryListWeb.java b/com.actionsoft.apps.coe.pal.processlist/src/com/actionsoft/apps/coe/pal/processlist/web/PALRepositoryListWeb.java index b8fe0e8b..4ee9d36b 100644 --- a/com.actionsoft.apps.coe.pal.processlist/src/com/actionsoft/apps/coe/pal/processlist/web/PALRepositoryListWeb.java +++ b/com.actionsoft.apps.coe.pal.processlist/src/com/actionsoft/apps/coe/pal/processlist/web/PALRepositoryListWeb.java @@ -1184,10 +1184,6 @@ public class PALRepositoryListWeb extends ActionWeb { List propertyModelList = propertyDao.queryByWsId(wsId); long s3 = System.currentTimeMillis(); List tempLongList = new ArrayList<>(); - - // 扩展属性 - boolean extendAttr = tempArr.stream().anyMatch(item -> ((JSONObject) item).getString("columnType").equals("extendAttr")); - for (int i = 0; i < palList.size(); i++) { PALRepositoryModel model = palList.get(i); rowIndex++; @@ -1228,63 +1224,74 @@ public class PALRepositoryListWeb extends ActionWeb { count++; cellIndex = cellIndex + maxLevel + 1;// 第一列+level所占列数+空闲一列 long s5 = System.currentTimeMillis(); - - // 获取所有扩展属性的值 - if (extendAttr) {// 如果表格中没有更多特性,则不查询,节省时间 - try { - int parentNameCellIndex = 0; - for (int j = 0; j < tempArr.size(); j++) { - HSSFCell attrCell = row.createCell(++cellIndex); - String attrCellValue = ""; - JSONObject config = tempArr.getJSONObject(j); - String propId = config.getString("id"); - - // 伊利定制化需求23-01-05 - if ("status".equals(propId)){ - parentNameCellIndex = ++cellIndex; - } - - // 标准列 - if ("default".equals(config.getString("columnType"))) { - attrCellValue = getDefaultFixedValueById(propId, model.getId()); - } - // 扩展列 - if ("extendAttr".equals(config.getString("columnType"))) { - JSONObject extendAttrValObj = new JSONObject(); - List props = propertyModelList.stream().filter(prop -> {return prop.getPlId().equals(model.getId());}).collect(Collectors.toList()); - extendAttrValObj = ProcessListUtil.getProcessLevelPropertyVal(model.getId(), model, props); - Iterator iter = extendAttrValObj.entrySet().iterator(); - JSONObject object = new JSONObject(); - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry) iter.next(); - JSONObject valueObj = JSONObject.parseObject(entry.getValue().toString()); - object.put(valueObj.getString("key"), valueObj.getString("value")); - } - extendAttrValObj = object; - if (extendAttrValObj.containsKey(propId)) { - attrCellValue = extendAttrValObj.getString(propId); - } - } - attrCell.setCellValue(attrCellValue); - } - long e5 = System.currentTimeMillis(); - tempLongList.add(e5 - s5); - HSSFCell attrCell = row.createCell(parentNameCellIndex); - String parentName = model.getParentId().length() < 36 ? I18nRes.findValue(CoEConstant.APP_ID,model.getParentId()) : PALRepositoryCache.getCache().get(model.getParentId()).getName(); - attrCell.setCellValue(parentName); - } catch (Exception e) { - System.err.println("清单无法导出的模型ID:"+model.getId()); - // TODO: handle exception + // 扩展属性 + boolean extendAttr = false; + for (int j = 0; j < tempArr.size(); j++) { + JSONObject object = tempArr.getJSONObject(j); + if ("extendAttr".equals(object.getString("columnType"))) { + extendAttr = true; } } + // 获取所有扩展属性的值 + JSONObject extendAttrValObj = new JSONObject(); + List props = propertyModelList.stream().filter(prop -> {return prop.getPlId().equals(model.getId());}).collect(Collectors.toList()); + if (extendAttr) {// 如果表格中没有更多特性,则不查询,节省时间 + if(null!=model) { + try { + extendAttrValObj = ProcessListUtil.getProcessLevelPropertyVal(model.getId(), model, props); + } catch (Exception e) { + System.err.println("清单无法导出的模型ID:"+model.getId()); + // TODO: handle exception + } + } + + } + Iterator iter = extendAttrValObj.entrySet().iterator(); + JSONObject object = new JSONObject(); + while (iter.hasNext()) { + Map.Entry entry = (Map.Entry) iter.next(); + JSONObject valueObj = JSONObject.parseObject(entry.getValue().toString()); + object.put(valueObj.getString("key"), valueObj.getString("value")); + } + extendAttrValObj = object; -// for (int j = 0; j <= cellIndex; j++) { -// HSSFCell tempCell = row.getCell(j); -// if (tempCell == null) { -// tempCell = row.createCell(j); -// } -// tempCell.setCellStyle(styleData); -// } + int parentNameCellIndex = 0; + for (int j = 0; j < tempArr.size(); j++) { + HSSFCell attrCell = row.createCell(++cellIndex); + String attrCellValue = ""; + JSONObject config = tempArr.getJSONObject(j); + String propId = config.getString("id"); + + // 伊利定制化需求23-01-05 + if ("status".equals(propId)){ + parentNameCellIndex = ++cellIndex; + } + + // 标准列 + if ("default".equals(config.getString("columnType"))) { + attrCellValue = getDefaultFixedValueById(propId, model.getId()); + } + // 扩展列 + if ("extendAttr".equals(config.getString("columnType"))) { + if (extendAttrValObj.containsKey(propId)) { + attrCellValue = extendAttrValObj.getString(propId); + } + } + attrCell.setCellValue(attrCellValue); + } + long e5 = System.currentTimeMillis(); + tempLongList.add(e5 - s5); + HSSFCell attrCell = row.createCell(parentNameCellIndex); + String parentName = model.getParentId().length() < 36 ? I18nRes.findValue(CoEConstant.APP_ID,model.getParentId()) : PALRepositoryCache.getCache().get(model.getParentId()).getName(); + attrCell.setCellValue(parentName); + + for (int j = 0; j <= cellIndex; j++) { + HSSFCell tempCell = row.getCell(j); + if (tempCell == null) { + tempCell = row.createCell(j); + } + tempCell.setCellStyle(styleData); + } } ConsolePrinter.info("扩展属性处理时长详细: " + tempLongList.toString()); ConsolePrinter.info("扩展属性处理平均时长: " + tempLongList.stream().mapToLong(Long::longValue).average().orElse(0.0));