完善切片存储
This commit is contained in:
@@ -14,6 +14,8 @@ public class LiveVideoDatabaseBean extends AbsDatabasesBean {
|
||||
String roomInfoJson;
|
||||
@JSONField(name = "start_time")
|
||||
Date startTime;
|
||||
@JSONField(name = "stop_time")
|
||||
Date stopTime;
|
||||
@JSONField(name = "path")
|
||||
String path;
|
||||
|
||||
|
||||
@@ -118,8 +118,6 @@ public class BiliLiveDatabase extends SQLiteManager {
|
||||
}
|
||||
|
||||
public JSONObject getGiftInfo(long startTimeLong, long endTimeLong) {
|
||||
String startTime = DateFormatUtils.getInstance().format(startTimeLong);
|
||||
String endTime = DateFormatUtils.getInstance().format(endTimeLong);
|
||||
String giftSql = "WITH filtered_gifts AS (" +
|
||||
"SELECT " +
|
||||
"`gift_name`," +
|
||||
@@ -132,8 +130,8 @@ public class BiliLiveDatabase extends SQLiteManager {
|
||||
"FROM " +
|
||||
"`gift` " +
|
||||
"WHERE " +
|
||||
"`sql_time` >= '" + startTime + "' " +
|
||||
"AND `sql_time` <= '" + endTime + "' " +
|
||||
"`sql_time` >= '" + startTimeLong + "' " +
|
||||
"AND `sql_time` <= '" + endTimeLong + "' " +
|
||||
"GROUP BY " +
|
||||
"`gift_name`, `coin_type`" +
|
||||
")" +
|
||||
@@ -147,10 +145,10 @@ public class BiliLiveDatabase extends SQLiteManager {
|
||||
"GROUP BY " +
|
||||
"`gift_name`, `icon`;";
|
||||
String guardSql = "SELECT `gift_name`, SUM(`num`) AS `total_num`,SUM(`price`*`num`) as `total_price`" +
|
||||
"FROM `guardBuy` where `sql_time` >= '" + startTime + "' and `sql_time` <= '" + endTime + "'" +
|
||||
"FROM `guardBuy` where `sql_time` >= '" + startTimeLong + "' and `sql_time` <= '" + endTimeLong + "'" +
|
||||
"GROUP BY `gift_name`;";
|
||||
String superChatSql = "SELECT SUM(`price`*100) as `total_price`, count(`price`) as `total_count`" +
|
||||
"FROM `superChat` where `sql_time` >= '" + startTime + "' and `sql_time` <= '" + endTime + "';";
|
||||
"FROM `superChat` where `sql_time` >= '" + startTimeLong + "' and `sql_time` <= '" + endTimeLong + "';";
|
||||
JSONObject json = new JSONObject();
|
||||
JSONArray giftInfo = get(giftSql);
|
||||
JSONArray guardInfo = get(guardSql);
|
||||
@@ -177,15 +175,14 @@ public class BiliLiveDatabase extends SQLiteManager {
|
||||
}
|
||||
|
||||
private void createInfo(LiveVideoDatabaseBean bean) {
|
||||
String format = DateFormatUtils.getInstance().format(bean.getSql_time());
|
||||
if (get(bean.getTableName(), " `sql_time` = '" + format + "'", LiveVideoDatabaseBean.class).isEmpty()) {
|
||||
if (get(bean.getTableName(), " `sql_time` = '" + bean.getSql_time().getTime() + "'", LiveVideoDatabaseBean.class).isEmpty()) {
|
||||
add(bean);
|
||||
} else {
|
||||
update(bean);
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends AbsDatabasesBean> List<T> getOfTime(String startTime, String endTime, Class<T> clazz) {
|
||||
public <T extends AbsDatabasesBean> List<T> getOfTime(Long startTime, Long endTime, Class<T> clazz) {
|
||||
String tableName = null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String where = null;
|
||||
|
||||
Reference in New Issue
Block a user