优化数据表导出
成型过程检验添加过程抽检批次 成型先行工检不添加过程抽检批次
This commit is contained in:
parent
22587804c5
commit
27111d6f87
@ -394,23 +394,39 @@ public class QcSourceServiceImpl implements QcSourceService {
|
|||||||
if (resultList == null || resultList.isEmpty()) {
|
if (resultList == null || resultList.isEmpty()) {
|
||||||
return formatResultList;
|
return formatResultList;
|
||||||
}
|
}
|
||||||
List<String> headList = new ArrayList<>(EXCEL_HEAD_STYLE_ONE_NAME);
|
boolean needProcessBatch = needProcessBatch(resultList);
|
||||||
|
List<String> headList = new ArrayList<>();
|
||||||
|
for (int i = 0; i < EXCEL_HEAD_STYLE_ONE_NAME.size(); i++) {
|
||||||
|
if (i == 7) {
|
||||||
|
if (needProcessBatch) {
|
||||||
|
headList.add(EXCEL_HEAD_STYLE_ONE_NAME.get(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
headList.add(EXCEL_HEAD_STYLE_ONE_NAME.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
for (QcItemEntity qcItemEntity : qcItemList) {
|
for (QcItemEntity qcItemEntity : qcItemList) {
|
||||||
headList.add(qcItemEntity.getQcItemName());
|
headList.add(qcItemEntity.getQcItemName());
|
||||||
}
|
}
|
||||||
formatResultList.add(headList);
|
formatResultList.add(headList);
|
||||||
for (Map<String, Object> dataMap : resultList) {
|
for (Map<String, Object> result : resultList) {
|
||||||
List<String> dataList = new ArrayList<>();
|
List<String> dataList = new ArrayList<>();
|
||||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(0)));
|
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(0)));
|
||||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(1)));
|
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(1)));
|
||||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(2)));
|
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(2)));
|
||||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(3)));
|
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(3)));
|
||||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(4)));
|
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(4)));
|
||||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(5)));
|
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(5)));
|
||||||
dataList.add(LocalDateUtils.exportFormatCurrentSecond((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(6))));
|
dataList.add(LocalDateUtils.exportFormatCurrentSecond((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(6))));
|
||||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(7)));
|
if (needProcessBatch) {
|
||||||
|
if (isProcessBatch(result)) {
|
||||||
|
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(7)));
|
||||||
|
} else {
|
||||||
|
dataList.add("");
|
||||||
|
}
|
||||||
|
}
|
||||||
for (QcItemEntity entity : qcItemList) {
|
for (QcItemEntity entity : qcItemList) {
|
||||||
String value = (String) dataMap.getOrDefault(entity.getQcItemNo(), "");
|
String value = (String) result.getOrDefault(entity.getQcItemNo(), "");
|
||||||
if (Constant.QC_ITEM_TYPE_STRING.equals(entity.getQcItemType())) {
|
if (Constant.QC_ITEM_TYPE_STRING.equals(entity.getQcItemType())) {
|
||||||
dataList.add(value);
|
dataList.add(value);
|
||||||
} else if (Constant.QC_ITEM_TYPE_PICTURE.equals(entity.getQcItemType())) {
|
} else if (Constant.QC_ITEM_TYPE_PICTURE.equals(entity.getQcItemType())) {
|
||||||
@ -428,6 +444,30 @@ public class QcSourceServiceImpl implements QcSourceService {
|
|||||||
return formatResultList;
|
return formatResultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 这个表格是否需要过程抽检批次这个表头
|
||||||
|
* 只要存在一条项目工艺编号为U001的数据,就需要这个表头
|
||||||
|
*/
|
||||||
|
private boolean needProcessBatch(List<Map<String, Object>> resultList) {
|
||||||
|
for (Map<String, Object> result : resultList) {
|
||||||
|
if ("U001".equals((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(5)))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表格中的本行记录是否是成型过程工检数据
|
||||||
|
* 如果项目工艺编号为U001,那就是
|
||||||
|
*/
|
||||||
|
private boolean isProcessBatch(Map<String, Object> result) {
|
||||||
|
if ("U001".equals((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(5)))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将格式化后的结果集数据导出为Excel文件
|
* 将格式化后的结果集数据导出为Excel文件
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user