|
|
@ -83,7 +83,7 @@ public class DashboardAlertDao { |
|
|
// 批量执行 upsert
|
|
|
// 批量执行 upsert
|
|
|
StringBuilder sql = new StringBuilder( |
|
|
StringBuilder sql = new StringBuilder( |
|
|
"INSERT INTO device_rawdata_realtime (" + |
|
|
"INSERT INTO device_rawdata_realtime (" + |
|
|
"device_id, building_id, status, receive_ts, " + |
|
|
"device_id, building_id, status, dashboard_status, receive_ts, " + |
|
|
"alert_title, alert_content, alert_cancel_title, alert_cancel_content, " + |
|
|
"alert_title, alert_content, alert_cancel_title, alert_cancel_content, " + |
|
|
"raw_data, upload_year, upload_month, upload_day) VALUES " |
|
|
"raw_data, upload_year, upload_month, upload_day) VALUES " |
|
|
); |
|
|
); |
|
|
@ -91,7 +91,7 @@ public class DashboardAlertDao { |
|
|
for (int i = 0; i < subList.size(); i++) { |
|
|
for (int i = 0; i < subList.size(); i++) { |
|
|
DynamodbEntity entity = subList.get(i).getEntity(); |
|
|
DynamodbEntity entity = subList.get(i).getEntity(); |
|
|
|
|
|
|
|
|
sql.append("(?,?,?,?,?,?,?,?,?,?,?,?)"); |
|
|
sql.append("(?,?,?,?,?,?,?,?,?,?,?,?,?)"); |
|
|
if (i < subList.size() - 1) { |
|
|
if (i < subList.size() - 1) { |
|
|
sql.append(","); |
|
|
sql.append(","); |
|
|
} |
|
|
} |
|
|
@ -99,6 +99,7 @@ public class DashboardAlertDao { |
|
|
params.add(entity.getDeviceId()); |
|
|
params.add(entity.getDeviceId()); |
|
|
params.add(entity.getDbBuildingId()); |
|
|
params.add(entity.getDbBuildingId()); |
|
|
params.add(entity.getStatus()); |
|
|
params.add(entity.getStatus()); |
|
|
|
|
|
params.add(entity.getStatus()); |
|
|
params.add(entity.getReceive_ts()); |
|
|
params.add(entity.getReceive_ts()); |
|
|
params.add(entity.getAlertTitle()); |
|
|
params.add(entity.getAlertTitle()); |
|
|
params.add(entity.getAlertContent()); |
|
|
params.add(entity.getAlertContent()); |
|
|
@ -108,6 +109,8 @@ public class DashboardAlertDao { |
|
|
params.add(Integer.parseInt(entity.getYearKey())); |
|
|
params.add(Integer.parseInt(entity.getYearKey())); |
|
|
params.add(Integer.parseInt(entity.getMonthKey())); |
|
|
params.add(Integer.parseInt(entity.getMonthKey())); |
|
|
params.add(Integer.parseInt(entity.getDayKey())); |
|
|
params.add(Integer.parseInt(entity.getDayKey())); |
|
|
|
|
|
//给下面dashboard_status = IF(? = 1 里的?用
|
|
|
|
|
|
params.add(entity.getRetainAlert()); |
|
|
} |
|
|
} |
|
|
sql.append(" ON DUPLICATE KEY UPDATE ") |
|
|
sql.append(" ON DUPLICATE KEY UPDATE ") |
|
|
.append("building_id = VALUES(building_id), ") |
|
|
.append("building_id = VALUES(building_id), ") |
|
|
@ -120,7 +123,8 @@ public class DashboardAlertDao { |
|
|
.append("raw_data = VALUES(raw_data), ") |
|
|
.append("raw_data = VALUES(raw_data), ") |
|
|
.append("upload_year = VALUES(upload_year), ") |
|
|
.append("upload_year = VALUES(upload_year), ") |
|
|
.append("upload_month = VALUES(upload_month), ") |
|
|
.append("upload_month = VALUES(upload_month), ") |
|
|
.append("upload_day = VALUES(upload_day)"); |
|
|
.append("upload_day = VALUES(upload_day), ") |
|
|
|
|
|
.append("dashboard_status = IF(? = 1 AND VALUES(status) = 'alert_cancel' AND dashboard_status = 'alert', dashboard_status, VALUES(status))"); |
|
|
jdbcTemplate.update(sql.toString(), params.toArray()); |
|
|
jdbcTemplate.update(sql.toString(), params.toArray()); |
|
|
|
|
|
|
|
|
} finally { |
|
|
} finally { |
|
|
|