|
|
@ -32,7 +32,11 @@ import java.net.URLEncoder; |
|
|
import java.text.ParseException; |
|
|
import java.text.ParseException; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDate; |
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
|
import java.time.ZoneId; |
|
|
import java.time.format.DateTimeFormatter; |
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
|
import java.time.format.DateTimeFormatterBuilder; |
|
|
|
|
|
import java.time.format.DateTimeParseException; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.concurrent.atomic.AtomicLong; |
|
|
import java.util.concurrent.atomic.AtomicLong; |
|
|
import java.util.zip.ZipEntry; |
|
|
import java.util.zip.ZipEntry; |
|
|
@ -198,41 +202,37 @@ public class MesTidEpcLogServiceImpl extends ServiceImpl<MesTidEpcLogMapper, Mes |
|
|
// 列0: 序号 |
|
|
// 列0: 序号 |
|
|
entity.setSeqNo(getCellValue(row.getCell(0), dataFormatter)); |
|
|
entity.setSeqNo(getCellValue(row.getCell(0), dataFormatter)); |
|
|
// 列1: EPC |
|
|
// 列1: EPC |
|
|
entity.setEpc(getCellValue(row.getCell(1), dataFormatter)); |
|
|
|
|
|
|
|
|
entity.setEpc(getCellValue(row.getCell(2), dataFormatter)); |
|
|
// 列2: TID |
|
|
// 列2: TID |
|
|
entity.setTid(getCellValue(row.getCell(2), dataFormatter)); |
|
|
|
|
|
|
|
|
entity.setTid(getCellValue(row.getCell(3), dataFormatter)); |
|
|
// 列3: 用户区 |
|
|
// 列3: 用户区 |
|
|
entity.setUserArea(getCellValue(row.getCell(3), dataFormatter)); |
|
|
|
|
|
|
|
|
entity.setUserArea(getCellValue(row.getCell(4), dataFormatter)); |
|
|
// 列4: LockiBtis |
|
|
// 列4: LockiBtis |
|
|
entity.setLockBits(getCellValue(row.getCell(4), dataFormatter)); |
|
|
|
|
|
|
|
|
entity.setLockBits(getCellValue(row.getCell(5), dataFormatter)); |
|
|
// 列5: 密匙 |
|
|
// 列5: 密匙 |
|
|
entity.setSecretKey(getCellValue(row.getCell(5), dataFormatter)); |
|
|
|
|
|
|
|
|
entity.setSecretKey(getCellValue(row.getCell(6), dataFormatter)); |
|
|
// 列6: 写码成功 |
|
|
// 列6: 写码成功 |
|
|
entity.setWriteSuccess(getCellValue(row.getCell(6), dataFormatter)); |
|
|
|
|
|
|
|
|
entity.setWriteSuccess(getCellValue(row.getCell(7), dataFormatter)); |
|
|
// 列7: 读码成功 |
|
|
// 列7: 读码成功 |
|
|
entity.setReadSuccess(getCellValue(row.getCell(7), dataFormatter)); |
|
|
|
|
|
|
|
|
entity.setReadSuccess(getCellValue(row.getCell(8), dataFormatter)); |
|
|
// 列8: EPC锁定 |
|
|
// 列8: EPC锁定 |
|
|
entity.setEpcLocked(getCellValue(row.getCell(8), dataFormatter)); |
|
|
|
|
|
|
|
|
entity.setEpcLocked(getCellValue(row.getCell(9), dataFormatter)); |
|
|
// 列9: 强度/读距 |
|
|
// 列9: 强度/读距 |
|
|
entity.setSignalStrength(getCellValue(row.getCell(9), dataFormatter)); |
|
|
|
|
|
|
|
|
entity.setSignalStrength(getCellValue(row.getCell(10), dataFormatter)); |
|
|
// 列10: 时间 |
|
|
// 列10: 时间 |
|
|
Cell timeCell = row.getCell(10); |
|
|
|
|
|
|
|
|
Cell timeCell = row.getCell(11); |
|
|
if (timeCell != null) { |
|
|
if (timeCell != null) { |
|
|
if (timeCell.getCellType() == CellType.NUMERIC && DateUtil.isCellDateFormatted(timeCell)) { |
|
|
if (timeCell.getCellType() == CellType.NUMERIC && DateUtil.isCellDateFormatted(timeCell)) { |
|
|
entity.setScanTime(timeCell.getDateCellValue()); |
|
|
entity.setScanTime(timeCell.getDateCellValue()); |
|
|
} else { |
|
|
} else { |
|
|
String timeStr = getCellValue(timeCell, dataFormatter); |
|
|
String timeStr = getCellValue(timeCell, dataFormatter); |
|
|
if (StringUtils.hasText(timeStr)) { |
|
|
if (StringUtils.hasText(timeStr)) { |
|
|
try { |
|
|
|
|
|
entity.setScanTime(sdf.parse(timeStr)); |
|
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
|
log.warn("第{}行时间格式解析失败: {} - rqrq", rowNum + 1, timeStr); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
entity.setScanTime(parseDate(timeStr)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// 列11: 计数 |
|
|
// 列11: 计数 |
|
|
entity.setCountInfo(getCellValue(row.getCell(11), dataFormatter)); |
|
|
|
|
|
|
|
|
entity.setCountInfo(getCellValue(row.getCell(12), dataFormatter)); |
|
|
|
|
|
|
|
|
dataList.add(entity); |
|
|
dataList.add(entity); |
|
|
} |
|
|
} |
|
|
@ -241,6 +241,26 @@ public class MesTidEpcLogServiceImpl extends ServiceImpl<MesTidEpcLogMapper, Mes |
|
|
return dataList; |
|
|
return dataList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static Date parseDate(String timeStr) { |
|
|
|
|
|
DateTimeFormatter FORMATTER = |
|
|
|
|
|
new DateTimeFormatterBuilder() |
|
|
|
|
|
.appendOptional(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) |
|
|
|
|
|
.appendOptional(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) |
|
|
|
|
|
.toFormatter(); |
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
LocalDateTime localDateTime = |
|
|
|
|
|
LocalDateTime.parse(timeStr, FORMATTER); |
|
|
|
|
|
|
|
|
|
|
|
return Date.from( |
|
|
|
|
|
localDateTime.atZone(ZoneId.systemDefault()).toInstant() |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
} catch (DateTimeParseException e) { |
|
|
|
|
|
|
|
|
|
|
|
throw new RuntimeException("时间格式错误: " + timeStr, e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
/** |
|
|
/** |
|
|
* @Description 获取单元格值 - rqrq |
|
|
* @Description 获取单元格值 - rqrq |
|
|
* @param cell 单元格 |
|
|
* @param cell 单元格 |
|
|
|