fix active user count

This commit is contained in:
Benjamin Gamard 2017-11-21 19:37:29 +01:00
parent 5bc73548b3
commit e4fe1cfa90

View File

@ -312,8 +312,11 @@ public class UserDao {
*/ */
public long getActiveUserCount() { public long getActiveUserCount() {
EntityManager em = ThreadLocalContext.get().getEntityManager(); EntityManager em = ThreadLocalContext.get().getEntityManager();
Query query = em.createNativeQuery("select count(u.USE_ID_C) from T_USER u where u.USE_DELETEDATE_D is null and (u.USE_DISABLEDATE_D is null or u.USE_DISABLEDATE_D > :date)"); Query query = em.createNativeQuery("select count(u.USE_ID_C) from T_USER u where u.USE_DELETEDATE_D is null and (u.USE_DISABLEDATE_D is null or u.USE_DISABLEDATE_D >= :fromDate and u.USE_DISABLEDATE_D < :toDate)");
query.setParameter("date", DateTime.now().minusMonths(1).toDate()); DateTime fromDate = DateTime.now().minusMonths(1).dayOfMonth().withMinimumValue().withTimeAtStartOfDay();
DateTime toDate = fromDate.plusMonths(1);
query.setParameter("fromDate", fromDate.toDate());
query.setParameter("toDate", toDate.toDate());
return ((Number) query.getSingleResult()).longValue(); return ((Number) query.getSingleResult()).longValue();
} }
} }