- try {\r
- DB db = new DB();\r
- @SuppressWarnings("resource")\r
- Connection conn = db.getConnection();\r
- try(PreparedStatement ps = conn.prepareStatement(SELECT_SQL_OLD)) {\r
- ps.setLong(1, from);\r
- ps.setLong(2, to);\r
- ps.setFetchSize(100000);\r
- try(ResultSet rs = ps.executeQuery()) {\r
- while (rs.next()) {\r
- String id = rs.getString("PUBLISH_ID");\r
- String date = sdf.format(new Date(getPstart(id)));\r
- JSONObject datemap = jo.optJSONObject(date);\r
- if (datemap == null) {\r
- datemap = new JSONObject();\r
- jo.put(date, datemap);\r
- }\r
- int feed = rs.getInt("FEEDID");\r
- JSONObject feedmap = datemap.optJSONObject("" + feed);\r
- if (feedmap == null) {\r
- feedmap = new JSONObject();\r
- feedmap.put("pubcount", 0);\r
- datemap.put("" + feed, feedmap);\r
+ try (Connection conn = ProvDbUtils.getInstance().getConnection();\r
+ PreparedStatement ps = conn.prepareStatement(\r
+ "select PUBLISH_ID, TYPE, FEEDID, DELIVERY_SUBID from LOG_RECORDS "\r
+ + "where EVENT_TIME >= ? and EVENT_TIME <= ?")) {\r
+ ps.setLong(1, from);\r
+ ps.setLong(2, to);\r
+ ps.setFetchSize(100000);\r
+ try(ResultSet rs = ps.executeQuery()) {\r
+ while (rs.next()) {\r
+ String id = rs.getString("PUBLISH_ID");\r
+ String date = sdf.format(new Date(getPstart(id)));\r
+ JSONObject datemap = jo.optJSONObject(date);\r
+ if (datemap == null) {\r
+ datemap = new JSONObject();\r
+ jo.put(date, datemap);\r
+ }\r
+ int feed = rs.getInt("FEEDID");\r
+ JSONObject feedmap = datemap.optJSONObject("" + feed);\r
+ if (feedmap == null) {\r
+ feedmap = new JSONObject();\r
+ feedmap.put("pubcount", 0);\r
+ datemap.put("" + feed, feedmap);\r
+ }\r
+ String type = rs.getString("TYPE");\r
+ if (type.equals("pub")) {\r
+ try {\r
+ int n = feedmap.getInt("pubcount");\r
+ feedmap.put("pubcount", n + 1);\r
+ } catch (JSONException e) {\r
+ feedmap.put("pubcount", 1);\r
+ logger.error(e.toString());\r