...
This commit is contained in:
parent
802a5b83ec
commit
2c99eb5590
|
@ -304,7 +304,7 @@
|
||||||
<!-- 排除生产环境配置 -->
|
<!-- 排除生产环境配置 -->
|
||||||
<exclude>application-prod.yml</exclude>
|
<exclude>application-prod.yml</exclude>
|
||||||
<!-- 排除flyway管理的sql -->
|
<!-- 排除flyway管理的sql -->
|
||||||
<exclude>db/*.sql</exclude>
|
<!-- <exclude>db/*.sql</exclude>-->
|
||||||
</excludes>
|
</excludes>
|
||||||
</resource>
|
</resource>
|
||||||
<resource>
|
<resource>
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
package io.renren.common.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import io.renren.common.utils.Result;
|
||||||
|
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
||||||
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
|
import io.renren.modules.resourceBrowse.service.ResourceBrowseService;
|
||||||
|
import io.renren.modules.sys.service.SysDeptService;
|
||||||
|
import io.renren.modules.sys.service.SysUserService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2022.6.19 版本
|
||||||
|
*/
|
||||||
|
@Api(tags = "全局统计中心v2")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/census/center/v2")
|
||||||
|
public class CensusControllerV2 {
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(CensusControllerV2.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ResourceService resourceService;
|
||||||
|
@Autowired
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
@Autowired
|
||||||
|
private TAbilityApplicationService tAbilityApplicationService;
|
||||||
|
@Autowired
|
||||||
|
private ResourceBrowseService resourceBrowseService;
|
||||||
|
@Autowired
|
||||||
|
private SysDeptService sysDeptService;
|
||||||
|
|
||||||
|
@Value("${census.type}")
|
||||||
|
private String[] censusTypes; // 需要进行统计的资源类型
|
||||||
|
|
||||||
|
@GetMapping(value = "/whole_amount")
|
||||||
|
@ApiOperation("平台概览")
|
||||||
|
public Result<List<Map<String, Object>>> wholeAmount() {
|
||||||
|
List<Map<String, Object>> result = Collections.synchronizedList(new ArrayList<>());
|
||||||
|
|
||||||
|
CompletableFuture<Void> userAmount = CompletableFuture.supplyAsync(() -> { // 获取平台用户总数
|
||||||
|
return sysUserService.countAllUser();
|
||||||
|
}).thenAccept(sum -> {
|
||||||
|
result.add(new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("amount", sum);
|
||||||
|
put("type", "用户量");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
CompletableFuture<Void> pvAmount = CompletableFuture.supplyAsync(() -> { // 平台访问量
|
||||||
|
return resourceService.countAllVisits();
|
||||||
|
}).thenAccept(sum -> {
|
||||||
|
result.add(new HashMap<String, Object>() {
|
||||||
|
{
|
||||||
|
put("amount", sum);
|
||||||
|
put("type", "平台访问量");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
CompletableFuture<Void> all = CompletableFuture.allOf(userAmount, pvAmount);
|
||||||
|
all.join();
|
||||||
|
result.sort(Comparator.comparing(x -> x.get("type").toString()));
|
||||||
|
return new Result<List<Map<String, Object>>>().ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result<List<Map<String, Object>>> visitTrend() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,10 +9,8 @@ import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSource
|
||||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||||
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
|
||||||
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
|
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.servlet.Filter;
|
import javax.servlet.Filter;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -83,8 +81,7 @@ public class ShiroConfig {
|
||||||
*/
|
*/
|
||||||
filterMap.put("/upload", "anon");
|
filterMap.put("/upload", "anon");
|
||||||
filterMap.put("/upload/**", "anon");
|
filterMap.put("/upload/**", "anon");
|
||||||
filterMap.put("/census/center/**", "anon"); // 全局各类统计
|
filterMap.put("/census/center/**", "anon"); // 全局各类统计 包含 /census/center/v2
|
||||||
|
|
||||||
filterMap.put("/**", "oauth2");
|
filterMap.put("/**", "oauth2");
|
||||||
shiroFilter.setFilterChainDefinitionMap(filterMap);
|
shiroFilter.setFilterChainDefinitionMap(filterMap);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue