fix(processor): 检查并修正hotel_id超出int2范围的情况

当hotel_id超出int2范围(-32768到32767)时,将其设置为0,避免数据库插入错误
This commit is contained in:
2026-02-27 08:56:31 +08:00
parent 21cf140c68
commit e76d04f526

View File

@@ -210,10 +210,12 @@ export const buildRowsFromPayload = (rawPayload) => {
const writeTsMs = Date.now();
// Base fields common to all rows (excluding unique ID)
// Check if hotel_id is within int2 range (-32768 to 32767), set to 0 if out of range
const validHotelId = (hotelId >= -32768 && hotelId <= 32767) ? hotelId : 0;
const commonFields = {
ts_ms: tsMs,
write_ts_ms: writeTsMs,
hotel_id: hotelId,
hotel_id: validHotelId,
room_id: roomId,
device_id: deviceId,
direction: normalizedDirection,