Browse Source

extra graph 2

master
gsd 1 month ago
parent
commit
da7dbdefa6
  1. 2
      src/main/java/app/controllers/other/PulseController.java
  2. 6
      src/main/java/app/services/db/GraphService.java

2
src/main/java/app/controllers/other/PulseController.java

@ -41,7 +41,7 @@ public class PulseController {
this.waitAfterNextAspect = waitAfterNextAspect; this.waitAfterNextAspect = waitAfterNextAspect;
} }
@GetMapping("/db") @GetMapping(value = {"/db", "/"})
public ResponseEntity<Long> getDBPulse() { public ResponseEntity<Long> getDBPulse() {
return new ResponseEntity(dbService.getDBServerTime(), HttpStatus.OK); return new ResponseEntity(dbService.getDBServerTime(), HttpStatus.OK);
} }

6
src/main/java/app/services/db/GraphService.java

@ -34,7 +34,8 @@ public class GraphService {
final String sql = "select date_trunc(:delta, timestamp) AS ts, :delta as period, sum(connect_duration) as value, srv_id from user_connections " + final String sql = "select date_trunc(:delta, timestamp) AS ts, :delta as period, sum(connect_duration) as value, srv_id from user_connections " +
"where (:account_ids_empty = true or account_id in (:account_ids)) and connect_duration != 0 and timestamp between :begindate and :enddate " + "where (:account_ids_empty = true or account_id in (:account_ids)) and connect_duration != 0 and timestamp between :begindate and :enddate " +
"and (:srv_id like '' or srv_id like :srv_id) " + "and (:srv_id like '' or srv_id like :srv_id) " +
"group by ts, srv_id"; "group by ts, srv_id " +
"order by ts asc";
MapSqlParameterSource map = new MapSqlParameterSource(); MapSqlParameterSource map = new MapSqlParameterSource();
map.addValue("delta", searchFilter.getMaybePeriod()); map.addValue("delta", searchFilter.getMaybePeriod());
List<Long> profiles = searchFilter.getAccounts(profileService); List<Long> profiles = searchFilter.getAccounts(profileService);
@ -62,7 +63,8 @@ public class GraphService {
public List<VipPerPeriodStatistic> getVipOnPeriod(SearchFilter searchFilter) { public List<VipPerPeriodStatistic> getVipOnPeriod(SearchFilter searchFilter) {
final String sql = "select date_trunc(:delta, timestamp) AS ts, :delta as period, count(*) as value, givemethod, amount from gived_vip " + final String sql = "select date_trunc(:delta, timestamp) AS ts, :delta as period, count(*) as value, givemethod, amount from gived_vip " +
"where (:account_ids_empty = true or steam2 in (:account_ids)) and givemethod != 4 and timestamp between :begindate and :enddate " + "where (:account_ids_empty = true or steam2 in (:account_ids)) and givemethod != 4 and timestamp between :begindate and :enddate " +
"group by ts, givemethod, amount"; "group by ts, givemethod, amount " +
"order by ts asc";
MapSqlParameterSource map = new MapSqlParameterSource(); MapSqlParameterSource map = new MapSqlParameterSource();
map.addValue("delta", searchFilter.getMaybePeriod()); map.addValue("delta", searchFilter.getMaybePeriod());
String profiles = searchFilter.getAccountsSteam2(profileService); String profiles = searchFilter.getAccountsSteam2(profileService);

Loading…
Cancel
Save