|
|
@@ -5,20 +5,20 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.uas.sso.common.encrypt.MD5;
|
|
|
import com.uas.sso.common.util.HttpUtil;
|
|
|
import com.uas.sso.core.Const;
|
|
|
-import com.uas.sso.core.ICallable;
|
|
|
import com.uas.sso.core.Status;
|
|
|
import com.uas.sso.core.Type;
|
|
|
import com.uas.sso.dao.UserDao;
|
|
|
import com.uas.sso.dao.UserRecordDao;
|
|
|
import com.uas.sso.entity.*;
|
|
|
import com.uas.sso.exception.VisibleError;
|
|
|
+import com.uas.sso.i.CountCallBack;
|
|
|
import com.uas.sso.logging.LoggerManager;
|
|
|
import com.uas.sso.logging.SyncBufferedLogger;
|
|
|
import com.uas.sso.logging.UserBufferedLogger;
|
|
|
import com.uas.sso.service.*;
|
|
|
import com.uas.sso.support.SyncFail;
|
|
|
import com.uas.sso.util.AccountTypeUtils;
|
|
|
-import com.uas.sso.util.ExecuteUtils;
|
|
|
+import com.uas.sso.util.CountUtils;
|
|
|
import com.uas.sso.util.PasswordLevelUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
@@ -604,12 +604,12 @@ public class UserServiceImpl implements UserService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public long getCount() {
|
|
|
+ public long count() {
|
|
|
return userDao.count();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public long getCountByRegisterDate(final Calendar start, final Calendar end) {
|
|
|
+ public long countByRegisterDate(final Calendar start, final Calendar end) {
|
|
|
return userDao.count(new Specification<User>() {
|
|
|
@Override
|
|
|
public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
|
|
|
@@ -620,6 +620,81 @@ public class UserServiceImpl implements UserService {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Long> countByRegisterDate(Timestamp start, Timestamp end, List<String> fromApps) {
|
|
|
+ Map<String, Long> data = new HashMap<>();
|
|
|
+ List<Map<String, Object>> counts = userDao.getCountByRegisterDate(start, end, fromApps);
|
|
|
+ for (Map<String, Object> count : counts) {
|
|
|
+ data.put((String) count.get("appId"), (Long) count.get("count"));
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public long countInCurrentMonth() {
|
|
|
+ return CountUtils.countInCurrentMonth(new CountCallBack<Long>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long countByTime(Calendar start, Calendar end) {
|
|
|
+ return countByRegisterDate(start, end);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public long countInLastMonth() {
|
|
|
+ return CountUtils.countInLastMonth(new CountCallBack<Long>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long countByTime(Calendar start, Calendar end) {
|
|
|
+ return countByRegisterDate(start, end);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public long countInCurrentWeek() {
|
|
|
+ return CountUtils.countInCurrentWeek(new CountCallBack<Long>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Long countByTime(Calendar start, Calendar end) {
|
|
|
+ return countByRegisterDate(start, end);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Long> count(final List<String> fromApps) {
|
|
|
+ Map<String, Long> data = new HashMap<>();
|
|
|
+ List<Map<String, Object>> counts = userDao.getCountByRegisterDate(fromApps);
|
|
|
+ for (Map<String, Object> count : counts) {
|
|
|
+ data.put((String) count.get("appId"), (Long) count.get("count"));
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Long> countInCurrentMonth(final List<String> fromApps) {
|
|
|
+ return CountUtils.countInCurrentMonth(new CountCallBack<Map<String, Long>>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Long> countByTime(Calendar start, Calendar end) {
|
|
|
+ return countByRegisterDate(new Timestamp(start.getTimeInMillis()), new Timestamp(end.getTimeInMillis()), fromApps);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Long> countInCurrentWeek(final List<String> fromApps) {
|
|
|
+ return CountUtils.countInCurrentWeek(new CountCallBack<Map<String, Long>>() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Long> countByTime(Calendar start, Calendar end) {
|
|
|
+ return countByRegisterDate(new Timestamp(start.getTimeInMillis()), new Timestamp(end.getTimeInMillis()), fromApps);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 同步用户信息到各个应用
|
|
|
* @param user 用户信息
|