Revert "流程清单 导出接口调整"

This reverts commit 7cc9c53871.
This commit is contained in:
qinoy 2023-11-07 17:31:48 +08:00
parent 7cc9c53871
commit ef968b55c1
2 changed files with 65 additions and 58 deletions

View File

@ -1184,10 +1184,6 @@ public class PALRepositoryListWeb extends ActionWeb {
List<PALRepositoryPropertyModel> propertyModelList = propertyDao.queryByWsId(wsId); List<PALRepositoryPropertyModel> propertyModelList = propertyDao.queryByWsId(wsId);
long s3 = System.currentTimeMillis(); long s3 = System.currentTimeMillis();
List<Long> tempLongList = new ArrayList<>(); List<Long> tempLongList = new ArrayList<>();
// 扩展属性
boolean extendAttr = tempArr.stream().anyMatch(item -> ((JSONObject) item).getString("columnType").equals("extendAttr"));
for (int i = 0; i < palList.size(); i++) { for (int i = 0; i < palList.size(); i++) {
PALRepositoryModel model = palList.get(i); PALRepositoryModel model = palList.get(i);
rowIndex++; rowIndex++;
@ -1228,63 +1224,74 @@ public class PALRepositoryListWeb extends ActionWeb {
count++; count++;
cellIndex = cellIndex + maxLevel + 1;// 第一列+level所占列数+空闲一列 cellIndex = cellIndex + maxLevel + 1;// 第一列+level所占列数+空闲一列
long s5 = System.currentTimeMillis(); long s5 = System.currentTimeMillis();
// 扩展属性
// 获取所有扩展属性的值 boolean extendAttr = false;
if (extendAttr) {// 如果表格中没有更多特性则不查询节省时间 for (int j = 0; j < tempArr.size(); j++) {
try { JSONObject object = tempArr.getJSONObject(j);
int parentNameCellIndex = 0; if ("extendAttr".equals(object.getString("columnType"))) {
for (int j = 0; j < tempArr.size(); j++) { extendAttr = true;
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<PALRepositoryPropertyModel> 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
} }
} }
// 获取所有扩展属性的值
JSONObject extendAttrValObj = new JSONObject();
List<PALRepositoryPropertyModel> 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++) { int parentNameCellIndex = 0;
// HSSFCell tempCell = row.getCell(j); for (int j = 0; j < tempArr.size(); j++) {
// if (tempCell == null) { HSSFCell attrCell = row.createCell(++cellIndex);
// tempCell = row.createCell(j); String attrCellValue = "";
// } JSONObject config = tempArr.getJSONObject(j);
// tempCell.setCellStyle(styleData); 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.toString());
ConsolePrinter.info("扩展属性处理平均时长: " + tempLongList.stream().mapToLong(Long::longValue).average().orElse(0.0)); ConsolePrinter.info("扩展属性处理平均时长: " + tempLongList.stream().mapToLong(Long::longValue).average().orElse(0.0));