优化数据表导出 格式化上传时间和批次
This commit is contained in:
parent
68f56278a5
commit
5bd5146105
@ -345,7 +345,7 @@ public class QcSourceServiceImpl implements QcSourceService {
|
||||
return null;
|
||||
}
|
||||
for (Map<String, Object> room : mapList) {
|
||||
if (room.getOrDefault("batchNo", "").equals(batchNo) && room.getOrDefault("machineNo", "").equals(machineNo) && room.getOrDefault("materialNo", "").equals(materialNo) && room.getOrDefault("mouldNo", "").equals(mouldNo) && room.getOrDefault("varietyNo", "").equals(varietyNo) && room.getOrDefault("craftItemNo", "").equals(craftItemNo)) {
|
||||
if (room.get(EXCEL_HEAD_STYLE_ONE_NO.get(0)).equals(batchNo) && room.get(EXCEL_HEAD_STYLE_ONE_NO.get(1)).equals(machineNo) && room.get(EXCEL_HEAD_STYLE_ONE_NO.get(2)).equals(materialNo) && room.get(EXCEL_HEAD_STYLE_ONE_NO.get(3)).equals(mouldNo) && room.get(EXCEL_HEAD_STYLE_ONE_NO.get(4)).equals(varietyNo) && room.get(EXCEL_HEAD_STYLE_ONE_NO.get(5)).equals(craftItemNo)) {
|
||||
if (!room.containsKey(qcItemNo)) {
|
||||
return room;
|
||||
}
|
||||
@ -401,13 +401,14 @@ public class QcSourceServiceImpl implements QcSourceService {
|
||||
formatResultList.add(headList);
|
||||
for (Map<String, Object> dataMap : resultList) {
|
||||
List<String> dataList = new ArrayList<>();
|
||||
dataList.add((String) dataMap.getOrDefault(EXCEL_HEAD_STYLE_ONE_NO.get(0), ""));
|
||||
dataList.add((String) dataMap.getOrDefault(EXCEL_HEAD_STYLE_ONE_NO.get(1), ""));
|
||||
dataList.add((String) dataMap.getOrDefault(EXCEL_HEAD_STYLE_ONE_NO.get(2), ""));
|
||||
dataList.add((String) dataMap.getOrDefault(EXCEL_HEAD_STYLE_ONE_NO.get(3), ""));
|
||||
dataList.add((String) dataMap.getOrDefault(EXCEL_HEAD_STYLE_ONE_NO.get(4), ""));
|
||||
dataList.add((String) dataMap.getOrDefault(EXCEL_HEAD_STYLE_ONE_NO.get(5), ""));
|
||||
dataList.add((String) dataMap.getOrDefault(EXCEL_HEAD_STYLE_ONE_NO.get(6), ""));
|
||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(0)));
|
||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(1)));
|
||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(2)));
|
||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(3)));
|
||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(4)));
|
||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(5)));
|
||||
dataList.add(LocalDateUtils.exportFormatCurrentSecond((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(6))));
|
||||
dataList.add((String) dataMap.get(EXCEL_HEAD_STYLE_ONE_NO.get(7)));
|
||||
for (QcItemEntity entity : qcItemList) {
|
||||
String value = (String) dataMap.getOrDefault(entity.getQcItemNo(), "");
|
||||
if (Constant.QC_ITEM_TYPE_STRING.equals(entity.getQcItemType())) {
|
||||
@ -436,8 +437,8 @@ public class QcSourceServiceImpl implements QcSourceService {
|
||||
//建立新的sheet对象(excel的表单)
|
||||
XSSFSheet sheet = workbook.createSheet("检验数据表");
|
||||
for (int i = 0; i < dataListList.get(0).size(); i++) {
|
||||
if (i <= 5) {
|
||||
sheet.setColumnWidth(i, 20 * 256);
|
||||
if (i <= 7) {
|
||||
sheet.setColumnWidth(i, 22 * 256);
|
||||
} else {
|
||||
sheet.setColumnWidth(i, 14 * 256);
|
||||
}
|
||||
|
@ -13,8 +13,23 @@ public class LocalDateUtils {
|
||||
return String.valueOf(new Date().getTime() / 1000L);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回给前端用的日期格式化
|
||||
*
|
||||
* @param second 秒时间戳
|
||||
*/
|
||||
public static String formatCurrentSecond(String second) {
|
||||
long timeMillis = Long.parseLong(second + "000");
|
||||
return DateUtil.format(new Date(timeMillis), "yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出表格用的日期格式化
|
||||
*
|
||||
* @param second 秒时间戳
|
||||
*/
|
||||
public static String exportFormatCurrentSecond(String second) {
|
||||
long timeMillis = Long.parseLong(second + "000");
|
||||
return DateUtil.format(new Date(timeMillis), "yyyy-MM-dd HH");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user