|
|
@@ -26,6 +26,7 @@ import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.persistence.criteria.*;
|
|
|
import java.sql.Timestamp;
|
|
|
+import java.text.ParseException;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
|
|
@@ -135,9 +136,10 @@ public class UserspaceServiceImpl implements UserspaceService {
|
|
|
|
|
|
/**
|
|
|
* 同步企业信息到其他应用
|
|
|
+ *
|
|
|
* @param userSpaceView 企业信息
|
|
|
- * @param msg 同步日志信息
|
|
|
- * @param otherApp 需要同步的其他应用
|
|
|
+ * @param msg 同步日志信息
|
|
|
+ * @param otherApp 需要同步的其他应用
|
|
|
*/
|
|
|
private void syncUserSpaceInfo(UserSpaceView userSpaceView, String msg, App otherApp) {
|
|
|
syncUserSpaceInfo(userSpaceView, msg, otherApp, null);
|
|
|
@@ -146,10 +148,11 @@ public class UserspaceServiceImpl implements UserspaceService {
|
|
|
/**
|
|
|
* 同步企业信息到其他应用
|
|
|
* 如果需要同步的应用和不需要同步的应用相同,则不同步改应用
|
|
|
+ *
|
|
|
* @param userSpaceView 企业信息
|
|
|
- * @param msg 同步日志信息
|
|
|
- * @param otherApp 需要同步的其他应用
|
|
|
- * @param noSyncApp 不需要同步的应用
|
|
|
+ * @param msg 同步日志信息
|
|
|
+ * @param otherApp 需要同步的其他应用
|
|
|
+ * @param noSyncApp 不需要同步的应用
|
|
|
*/
|
|
|
private void syncUserSpaceInfo(final UserSpaceView userSpaceView, final String msg, App otherApp, App noSyncApp) {
|
|
|
// 封装数据
|
|
|
@@ -239,7 +242,7 @@ public class UserspaceServiceImpl implements UserspaceService {
|
|
|
public void checkSpaceName(String spaceName) {
|
|
|
Userspace userSpace = userspaceDao.findBySpaceName(spaceName);
|
|
|
if (userSpace != null) {
|
|
|
- throw new VisibleError("企业已被注册,请确认无误后联系管理员("+userSpace.getAdmin().getVipName()+")处理");
|
|
|
+ throw new VisibleError("企业已被注册,请确认无误后联系管理员(" + userSpace.getAdmin().getVipName() + ")处理");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -424,6 +427,16 @@ public class UserspaceServiceImpl implements UserspaceService {
|
|
|
return userspaceDao.count();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Long> countByapps(final List<String> fromApps) {
|
|
|
+ Map<String, Long> data = new HashMap<>();
|
|
|
+ List<Map<String, Object>> counts = userspaceDao.getCountByApps(fromApps);
|
|
|
+ for(Map<String, Object> count : counts){
|
|
|
+ data.put((String) count.get("appId"),(Long) count.get("count"));
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public long getCountByRegisterDate(final Calendar start, final Calendar end) {
|
|
|
return userspaceDao.count(new Specification<Userspace>() {
|
|
|
@@ -436,6 +449,20 @@ public class UserspaceServiceImpl implements UserspaceService {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Long> countByRegisterDate(Timestamp start, Timestamp end, List<String> fromApps) {
|
|
|
+ Map<String, Long> data = new HashMap<>();
|
|
|
+ List<Map<String, Object>> Counts = userspaceDao.getCountByRegisterDate(start, end, fromApps);
|
|
|
+ for (Map<String, Object> Count : Counts) {
|
|
|
+ data.put((String) Count.get("appId"), (Long) Count.get("count"));
|
|
|
+ fromApps.remove(Count.get("appId"));
|
|
|
+ }
|
|
|
+ for (String app : fromApps) {
|
|
|
+ data.put(app, 0L);
|
|
|
+ }
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public long countInCurrentMonth() {
|
|
|
return CountUtils.countInCurrentMonth(new CountCallBack<Long>() {
|
|
|
@@ -466,4 +493,14 @@ public class UserspaceServiceImpl implements UserspaceService {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Long> countInInputTime(String startTime, String endTime, List<String> fromApps) throws ParseException {
|
|
|
+ CountCallBack<Map<String, Long>> countCallBack = 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);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return CountUtils.countInInputTime(countCallBack, startTime, endTime);
|
|
|
+ }
|
|
|
}
|