forked from Gitlink/microservices
Compare commits
30 Commits
master
...
dev_monito
| Author | SHA1 | Date |
|---|---|---|
|
|
15aa7016b9 | |
|
|
f96cee3f4a | |
|
|
055b26ee29 | |
|
|
368a45e8b2 | |
|
|
2c5f0518ca | |
|
|
06fbbf7208 | |
|
|
6613950ff8 | |
|
|
8184eb2401 | |
|
|
213aee5587 | |
|
|
274af358dd | |
|
|
58bf8326c5 | |
|
|
5e19e53b94 | |
|
|
2be36ca12e | |
|
|
ad405c912e | |
|
|
39d43e3d68 | |
|
|
1eefa65c32 | |
|
|
c6b4a1bd80 | |
|
|
21ba1ce6bd | |
|
|
dd870b3cd3 | |
|
|
417d440549 | |
|
|
67b2e9ce7c | |
|
|
32b83749e2 | |
|
|
010d5e5354 | |
|
|
94e0be0e71 | |
|
|
2845d19aae | |
|
|
97b1c9437c | |
|
|
b0f9e06e18 | |
|
|
f58af4b0b5 | |
|
|
78cbd4b0ee | |
|
|
fca8490bdd |
|
|
@ -1,15 +1,16 @@
|
|||
package com.microservices.system.api;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.constant.ServiceNameConstants;
|
||||
import com.microservices.common.core.constant.TokenConstants;
|
||||
import com.microservices.system.api.factory.RemoteGatewayFallbackFactory;
|
||||
import feign.Response;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -28,6 +29,14 @@ public interface RemoteGatewayService {
|
|||
@PostMapping("/sentinel/auth/login")
|
||||
Response loginSentinel(@RequestParam("username") String username, @RequestParam("password") String password);
|
||||
|
||||
/**
|
||||
* 登录Rancher
|
||||
*
|
||||
* @return 响应
|
||||
*/
|
||||
@PostMapping("/rancher/v3-public/localProviders/local?action=login")
|
||||
Response loginRancher(@RequestBody JSONObject loginBody);
|
||||
|
||||
/**
|
||||
* 登录Nacos
|
||||
*
|
||||
|
|
@ -43,4 +52,15 @@ public interface RemoteGatewayService {
|
|||
*/
|
||||
@PostMapping("/portainer/api/auth")
|
||||
Response loginPortainer(@RequestBody JSONObject loginBody);
|
||||
|
||||
@GetMapping("/prometheus/api/v1/query")
|
||||
JSONObject getPrometheusQueryRes(@RequestParam("query") String query,
|
||||
@RequestHeader(TokenConstants.AUTHENTICATION) String token);
|
||||
|
||||
@GetMapping("/prometheus/api/v1/query_range")
|
||||
JSONObject getPrometheusQueryRangeRes(@RequestParam("query") String query,
|
||||
@RequestParam("step") Long step,
|
||||
@RequestParam("start") Long start,
|
||||
@RequestParam("end") Long end,
|
||||
@RequestHeader(TokenConstants.AUTHENTICATION) String token);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
package com.microservices.system.api;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.constant.ServiceNameConstants;
|
||||
import com.microservices.common.core.constant.TokenConstants;
|
||||
import com.microservices.system.api.factory.RemoteGatewayFallbackFactory;
|
||||
import com.microservices.system.api.factory.RemoteRancherFallbackFactory;
|
||||
import feign.Response;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 网关
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Component
|
||||
@FeignClient(contextId = "RemoteRancherService", value = ServiceNameConstants.GATEWAY_SERVICE, fallbackFactory = RemoteRancherFallbackFactory.class)
|
||||
public interface RemoteRancherService {
|
||||
|
||||
/**
|
||||
* 获取命名空间列表
|
||||
*
|
||||
* @return 响应
|
||||
*/
|
||||
@GetMapping("/rancher/v3/clusters/{cluster_id}/namespaces")
|
||||
JSONObject getK8sNamespaceList(@PathVariable("cluster_id") String cluster_id,
|
||||
@RequestHeader(TokenConstants.AUTHENTICATION) String token);
|
||||
|
||||
@GetMapping("/rancher/k8s/clusters/{cluster_id}/v1/apps.daemonsets?exclude=metadata.managedFields")
|
||||
JSONObject getK8sDaemonsetsList(@PathVariable("cluster_id") String cluster_id,
|
||||
@RequestHeader(TokenConstants.AUTHENTICATION) String token);
|
||||
|
||||
@GetMapping("/rancher/k8s/clusters/{cluster_id}/v1/apps.deployments?exclude=metadata.managedFields")
|
||||
JSONObject getK8sDeployList(@PathVariable("cluster_id") String cluster_id,
|
||||
@RequestHeader(TokenConstants.AUTHENTICATION) String token);
|
||||
|
||||
@GetMapping("/rancher/k8s/clusters/{cluster_id}/v1/apps.statefulsets?exclude=metadata.managedFields")
|
||||
JSONObject getK8sStatefulList(@PathVariable("cluster_id") String cluster_id,
|
||||
@RequestHeader(TokenConstants.AUTHENTICATION) String token);
|
||||
|
||||
@GetMapping("/rancher/k8s/clusters/{cluster_id}/v1/nodes?exclude=metadata.managedFields")
|
||||
JSONObject getK8sClusterNodeList(@PathVariable("cluster_id") String cluster_id,
|
||||
@RequestHeader(TokenConstants.AUTHENTICATION) String token);
|
||||
|
||||
@GetMapping("/rancher/k8s/clusters/{cluster_id}/v1/{fullKind}/{namespace}/{applicationName}")
|
||||
JSONObject getK8sApplicationDetail(@PathVariable("cluster_id") String cluster_id,
|
||||
@PathVariable("fullKind") String fullKind,
|
||||
@PathVariable("namespace") String namespace,
|
||||
@PathVariable("applicationName") String applicationName,
|
||||
@RequestHeader(TokenConstants.AUTHENTICATION) String token);
|
||||
|
||||
@GetMapping("/rancher/k8s/clusters/{cluster_id}/v1/pods/{namespace}")
|
||||
JSONObject getK8sPodListByNamespace(@PathVariable("cluster_id") String cluster_id,
|
||||
@PathVariable("namespace") String namespace,
|
||||
@RequestHeader(TokenConstants.AUTHENTICATION) String token);
|
||||
|
||||
@GetMapping("/rancher/k8s/clusters/{cluster_id}/v1/services/{nginxApplicationId}")
|
||||
JSONObject getK8sServiceByApplicationId(@PathVariable("cluster_id") String cluster_id,
|
||||
@PathVariable("nginxApplicationId") String nginxApplicationId,
|
||||
@RequestHeader(TokenConstants.AUTHENTICATION) String token);
|
||||
}
|
||||
|
|
@ -25,7 +25,12 @@ public class RemoteGatewayFallbackFactory implements FallbackFactory<RemoteGatew
|
|||
return new RemoteGatewayService() {
|
||||
|
||||
@Override
|
||||
public Response loginSentinel(String password, String username) {
|
||||
public Response loginSentinel(String username, String password) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response loginRancher(JSONObject loginBody) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +41,16 @@ public class RemoteGatewayFallbackFactory implements FallbackFactory<RemoteGatew
|
|||
|
||||
@Override
|
||||
public Response loginPortainer(JSONObject loginBody) {
|
||||
System.out.println(throwable.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getPrometheusQueryRes(String query, String token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getPrometheusQueryRangeRes(String query, Long step, Long start, Long end, String token) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
package com.microservices.system.api.factory;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.system.api.RemoteGatewayService;
|
||||
import com.microservices.system.api.RemoteRancherService;
|
||||
import feign.Response;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Component
|
||||
public class RemoteRancherFallbackFactory implements FallbackFactory<RemoteRancherService> {
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteRancherFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteRancherService create(Throwable throwable) {
|
||||
log.error("Rancher服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteRancherService() {
|
||||
@Override
|
||||
public JSONObject getK8sNamespaceList(String cluster_id, String token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getK8sDaemonsetsList(String cluster_id, String token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getK8sDeployList(String cluster_id, String token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getK8sStatefulList(String cluster_id, String token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getK8sClusterNodeList(String cluster_id, String token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getK8sApplicationDetail(String cluster_id, String fullKind, String namespace, String applicationName, String token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getK8sPodListByNamespace(String cluster_id, String namespace, String token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getK8sServiceByApplicationId(String cluster_id, String nginxApplicationId, String token) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -6,3 +6,4 @@ com.microservices.system.api.factory.RemoteCmsFallbackFactory
|
|||
com.microservices.system.api.factory.RemoteZoneFallbackFactory
|
||||
com.microservices.system.api.factory.RemotePmsFallbackFactory
|
||||
com.microservices.system.api.factory.RemoteGatewayFallbackFactory
|
||||
com.microservices.system.api.factory.RemoteRancherFallbackFactory
|
||||
|
|
|
|||
|
|
@ -213,6 +213,11 @@ public class CacheConstants {
|
|||
*/
|
||||
public final static String SENTINEL_TOKEN = "sentinel_token";
|
||||
|
||||
/**
|
||||
* Rancher Token缓存Key
|
||||
*/
|
||||
public final static String RANCHER_TOKEN = "rancher_token";
|
||||
|
||||
|
||||
/**
|
||||
* Nacos Token缓存Key
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ public class SecurityConstants
|
|||
*/
|
||||
public static final String USER_KEY = "user_key";
|
||||
|
||||
/**
|
||||
* 用户Token
|
||||
*/
|
||||
public static final String TOKEN = "token";
|
||||
|
||||
/**
|
||||
* 组织ID
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -22,9 +22,16 @@ public class TokenConstants {
|
|||
* Sentinel令牌标识
|
||||
*/
|
||||
public static final String Sentinel_Token_Key = "sentinel_dashboard_cookie";
|
||||
/**
|
||||
* Rancher令牌标识
|
||||
*/
|
||||
public static final String Rancher_Cookie_Token_Key = "R_SESS";
|
||||
/**
|
||||
* Portainer令牌标识
|
||||
*/
|
||||
public static final String Portainer_Token_Key = "portainer_api_key";
|
||||
/**
|
||||
* Sentinel令牌标识
|
||||
* Nacos令牌标识
|
||||
*/
|
||||
public static final String Nacos_Token_Key = "Accesstoken";
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.microservices.common.core.threadPool;
|
||||
|
||||
import com.microservices.common.core.constant.TokenConstants;
|
||||
import com.microservices.common.core.context.SecurityContextHolder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -37,6 +38,9 @@ public class ThreadPoolExecutorWrap extends ThreadPoolExecutor {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if(contextValue != null&&contextValue.containsKey("user_key")){
|
||||
contextValue.put(TokenConstants.AUTHENTICATION, contextValue.get("user_key"));
|
||||
}
|
||||
SecurityContextHolder.setLocalMap(contextValue);
|
||||
// 用户任务逻辑
|
||||
task.run();
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class GenericsTableDataInfo<T> implements Serializable {
|
|||
/**
|
||||
* 面包屑数据
|
||||
*/
|
||||
@ApiModelProperty("面包屑数据")
|
||||
@ApiModelProperty(value = "面包屑数据",hidden = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL) //为空时隐藏
|
||||
private List<Breadcrumb> breadcrumb;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public class GlobalResponseFilter implements GlobalFilter, Ordered {
|
|||
String lowerUrl = request.getURI().getPath().toLowerCase();
|
||||
ServerHttpResponse originalResponse = exchange.getResponse();
|
||||
DataBufferFactory bufferFactory = originalResponse.bufferFactory();
|
||||
|
||||
// 当请求为Nacos时,Nacos返回的所有非JSON响应都会被自动转换为结构化的错误信息,同时将HTTP状态码设置为200,适合用于规范化微服务架构的响应格式。
|
||||
if (lowerUrl.startsWith("/nacos")) {
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ public class ThirdPartyToolServiceImpl implements ThirdPartyToolService {
|
|||
public String portainerUsername;
|
||||
@Value("${thirdPartyTools.portainer.auth.password:}")
|
||||
public String portainerPassword;
|
||||
@Value("${thirdPartyTools.rancher.auth.username:}")
|
||||
public String rancherUsername;
|
||||
@Value("${thirdPartyTools.rancher.auth.password:}")
|
||||
public String rancherPassword;
|
||||
@Value("${thirdPartyTools.portainer.endpoints:}")
|
||||
public Integer portainerEndpoints;
|
||||
ThreadPoolExecutor threadPoolExecutor = CustomExecutorFactory.threadPoolExecutor;
|
||||
|
|
@ -106,6 +110,44 @@ public class ThirdPartyToolServiceImpl implements ThirdPartyToolService {
|
|||
throw new ServiceException("Sentinel服务获取Token失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 处理Rancher请求
|
||||
if (lowerUrl.startsWith("/rancher")) {
|
||||
String rancherToken = null;
|
||||
if (redisService.hasKey(CacheConstants.RANCHER_TOKEN)) {
|
||||
rancherToken = redisService.getCacheObject(CacheConstants.RANCHER_TOKEN);
|
||||
} else {
|
||||
JSONObject loginRancherBody = new JSONObject();
|
||||
loginRancherBody.put("description", "api session");
|
||||
loginRancherBody.put("responseType", "cookie");
|
||||
loginRancherBody.put("username", rancherUsername);
|
||||
loginRancherBody.put("password", rancherPassword);
|
||||
|
||||
// 网关采用异步架构,所以此处需要通过异步请求获取Sentinel Token
|
||||
Future<Response> future = threadPoolExecutor.submit(() -> remoteGatewayService.loginRancher(loginRancherBody));
|
||||
try {
|
||||
Response response = future.get(1, TimeUnit.SECONDS);
|
||||
Map<String, Collection<String>> header = response.headers();
|
||||
if (header != null && header.containsKey("set-cookie")) {
|
||||
String rancherCookie = header.get("set-cookie").iterator().next();
|
||||
rancherToken = getValueByCookieKey(rancherCookie,TokenConstants.Rancher_Cookie_Token_Key);
|
||||
//Rancher登录状态默认15小时失效,将Rancher Token缓存过期时间调整为14分钟
|
||||
redisService.setCacheObject(CacheConstants.RANCHER_TOKEN, rancherToken, 14L, TimeUnit.HOURS);
|
||||
|
||||
}
|
||||
} catch (TimeoutException e) {
|
||||
log.error("获取Rancher Token超时");
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
log.error("获取Rancher Token失败:{}", e.getMessage());
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotEmpty(rancherToken)) {
|
||||
ServletUtils.removeHeader(mutate, TokenConstants.AUTHENTICATION);
|
||||
mutate.header(TokenConstants.AUTHENTICATION, TokenConstants.PREFIX + rancherToken);
|
||||
} else {
|
||||
throw new ServiceException("Rancher服务获取Token失败");
|
||||
}
|
||||
}
|
||||
// 处理Nacos请求
|
||||
if (lowerUrl.startsWith("/nacos")) {
|
||||
String nacosToken = null;
|
||||
|
|
@ -229,4 +271,20 @@ public class ThirdPartyToolServiceImpl implements ThirdPartyToolService {
|
|||
log.error("[第三方工具请求处理异常]请求路径:{},异常信息:{}", exchange.getRequest().getPath(), msg);
|
||||
return ServletUtils.webFluxResponseWriter(exchange.getResponse(), ExceptionMsgConstants.SYSTEM_EXEC_ERROR, code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过指定Key获取Cookie中指定值
|
||||
*/
|
||||
private static String getValueByCookieKey(String cookie, String key) {
|
||||
if (cookie != null) {
|
||||
String[] cookies = StringUtils.split(cookie, ';');
|
||||
for (String cookieItem : cookies) {
|
||||
if (cookieItem.contains(key)) {
|
||||
String token = StringUtils.remove(cookieItem, key+"=");
|
||||
return StringUtils.remove(token, " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,125 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||
import com.microservices.system.api.domain.SysDictData;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.microservices.common.log.annotation.Log;
|
||||
import com.microservices.common.log.enums.BusinessType;
|
||||
import com.microservices.common.security.annotation.RequiresPermissions;
|
||||
import com.microservices.dms.achievementLibrary.domain.AchievementDictData;
|
||||
import com.microservices.dms.achievementLibrary.service.IAchievementDictDataService;
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.AjaxResult;
|
||||
import com.microservices.common.core.utils.poi.ExcelUtil;
|
||||
import com.microservices.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 成果相关字典Controller
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2025-05-23
|
||||
*/
|
||||
@Api(tags = "数据管理体系-成果字典管理")
|
||||
@RestController
|
||||
@RequestMapping("/achDict")
|
||||
public class AchievementDictDataController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAchievementDictDataService achievementDictDataService;
|
||||
|
||||
/**
|
||||
* 查询成果相关字典列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(AchievementDictData achievementDictData)
|
||||
{
|
||||
startPage();
|
||||
List<AchievementDictData> list = achievementDictDataService.selectAchievementDictDataList(achievementDictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出成果相关字典列表
|
||||
*/
|
||||
@Log(title = "成果相关字典", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, AchievementDictData achievementDictData)
|
||||
{
|
||||
List<AchievementDictData> list = achievementDictDataService.selectAchievementDictDataList(achievementDictData);
|
||||
ExcelUtil<AchievementDictData> util = new ExcelUtil<AchievementDictData>(AchievementDictData.class);
|
||||
util.exportExcel(response, list, "成果相关字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取成果相关字典详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
public AjaxResult getInfo(@PathVariable("dictCode") Long dictCode)
|
||||
{
|
||||
return success(achievementDictDataService.selectAchievementDictDataByDictCode(dictCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增成果相关字典
|
||||
*/
|
||||
@Log(title = "成果相关字典", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody AchievementDictData achievementDictData)
|
||||
{
|
||||
return toAjax(achievementDictDataService.insertAchievementDictData(achievementDictData));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改成果相关字典
|
||||
*/
|
||||
@Log(title = "成果相关字典", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody AchievementDictData achievementDictData)
|
||||
{
|
||||
return toAjax(achievementDictDataService.updateAchievementDictData(achievementDictData));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除成果相关字典
|
||||
*/
|
||||
@Log(title = "成果相关字典", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||
{
|
||||
return toAjax(achievementDictDataService.deleteAchievementDictDataByDictCodes(dictCodes));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据信息
|
||||
*/
|
||||
@ApiOperation("根据成果字典分类查询成果值")
|
||||
@GetMapping(value = "/getDictDateByType")
|
||||
public AjaxResult getDictDateByType(String dictType)
|
||||
{
|
||||
List<KeyValueVo> data = achievementDictDataService.selectDictDataByType(dictType);
|
||||
return success(data);
|
||||
}
|
||||
|
||||
@ApiOperation("根据成果字典分类")
|
||||
@GetMapping(value = "/getDictTypes")
|
||||
public AjaxResult getDictTypes()
|
||||
{
|
||||
List<String> data = achievementDictDataService.getDictTypes();
|
||||
return success(data);
|
||||
}
|
||||
}
|
||||
|
|
@ -210,9 +210,8 @@ public class AchievementsController extends BaseController {
|
|||
}
|
||||
@ApiOperation("根据成果ID,获取近7日成果点击数量(折线图)")
|
||||
@GetMapping("/get7AddClickById")
|
||||
public AjaxResult get7AddClickById(String id,@RequestParam(value = "clickType",required = false, defaultValue = "Achievements")
|
||||
String clickType) {
|
||||
return success(achievementsService.get7AddClickById(id,clickType));
|
||||
public AjaxResult get7AddClickById(String id) {
|
||||
return success(achievementsService.get7AddClickById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("根据成果ID,获取成果的相关行为数据统计(点击量、搜索量、附件下载量、收藏、关注)")
|
||||
|
|
@ -220,8 +219,10 @@ public class AchievementsController extends BaseController {
|
|||
public AjaxResult getActDataStatisticById(Long id) {
|
||||
return success(achievementsService.getActDataStatisticById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("根据领域,将成果数据进行分类")
|
||||
/**
|
||||
* 根据领域,将成果数据进行分类
|
||||
*
|
||||
*/
|
||||
@GetMapping("/getAreaStatistic")
|
||||
public AjaxResult getAreaStatistic(String areaKey)
|
||||
{
|
||||
|
|
@ -238,36 +239,6 @@ public class AchievementsController extends BaseController {
|
|||
return success(achievementsService.getRelatedAch(id,sourceId));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取开源竞赛的相关成果")
|
||||
@GetMapping("/getRelatedAchCompetition")
|
||||
public AjaxResult getRelatedAchCompetition(Long id,Long sourceId)
|
||||
{
|
||||
return success(achievementsService.getRelatedAchCompetition(id,sourceId));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取创客任务的相关成果")
|
||||
@GetMapping("/getRelatedAchTask")
|
||||
public AjaxResult getRelatedAchTask(Long id,Long sourceId)
|
||||
{
|
||||
return success(achievementsService.getRelatedAchTask(id,sourceId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取专家-创客任务的相关成果")
|
||||
@GetMapping("/getRelatedAchTaskOfExpert")
|
||||
public AjaxResult getRelatedAchTaskOfExpert(Long expertId)
|
||||
{
|
||||
return success(achievementsService.getRelatedAchTaskOfExpert(expertId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取专家-开源竞赛的相关成果")
|
||||
@GetMapping("/getRelatedAchCompetitionOfExpert")
|
||||
public AjaxResult getRelatedAchCompetitionOfExpert(Long expertId)
|
||||
{
|
||||
return success(achievementsService.getRelatedAchCompetitionOfExpert(expertId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "搜索行为数据记录")
|
||||
@GetMapping("/getSearchResult")
|
||||
public AjaxResult getSearchResult(String achName,Long userId)
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.controller;
|
||||
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.page.TableDataInfo;
|
||||
import com.microservices.dms.achievementLibrary.domain.TokenListVo;
|
||||
import com.microservices.dms.achievementLibrary.service.IAchievementsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/blockChain")
|
||||
@Api(tags = "数据产权子系统")
|
||||
public class BlockChainController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IAchievementsService achievementsService;
|
||||
|
||||
// @GetMapping("/projectTokenList")
|
||||
// @ApiOperation(value = "项目token列表")
|
||||
// public TableDataInfo projectTokenList() {
|
||||
// startPage();
|
||||
// List<TokenListVo> list = achievementsService.projectTokenList();
|
||||
// return getDataTable(list);
|
||||
// }
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ public class ExpertDashboardController {
|
|||
}
|
||||
|
||||
@GetMapping(value = "getExpertAduit")
|
||||
@ApiOperation(value = "专家评审作品数排序")
|
||||
@ApiOperation(value = "近一年专家评审作品数")
|
||||
public AjaxResult getExpertAduit() {
|
||||
return AjaxResult.success(expertDashboardService.getExpertAduit());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,25 +36,25 @@ public class MemoDashboardController {
|
|||
return AjaxResult.success(memoDashboardService.getMemoTotalByYear());
|
||||
}
|
||||
|
||||
@GetMapping(value = "getForumSectionStatistic")
|
||||
@GetMapping(value = "getForumSectionStatistic(")
|
||||
@ApiOperation(value = "帖子分类")
|
||||
public AjaxResult getForumSectionStatistic() {
|
||||
return AjaxResult.success(memoDashboardService.getForumSectionStatistic());
|
||||
}
|
||||
|
||||
@GetMapping(value = "getAddMemoStatistic")
|
||||
@GetMapping(value = "getAddMemoStatistic(")
|
||||
@ApiOperation(value = "近一年新增帖子数")
|
||||
public AjaxResult getAddMemoStatistic() {
|
||||
return AjaxResult.success(memoDashboardService.getAddMemoStatistic());
|
||||
}
|
||||
|
||||
@GetMapping(value = "getTop5Memos")
|
||||
@GetMapping(value = "getTop5Memos(")
|
||||
@ApiOperation(value = "年度帖子热度top5")
|
||||
public AjaxResult getTop5Memos() {
|
||||
return AjaxResult.success(memoDashboardService.getTop5Memos());
|
||||
}
|
||||
|
||||
@GetMapping(value = "get7DayPaise")
|
||||
@GetMapping(value = "get7DayPaise(")
|
||||
@ApiOperation(value = "近7日帖子点赞数")
|
||||
public AjaxResult get7DayPaise() {
|
||||
return AjaxResult.success(memoDashboardService.get7DayPaise());
|
||||
|
|
|
|||
|
|
@ -43,17 +43,6 @@ public class SchoolEnterpriseAchievementsController extends BaseController
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询校企成果列表
|
||||
*/
|
||||
@GetMapping("/listFront")
|
||||
public TableDataInfo listFront(SchoolEnterpriseAchievements schoolEnterpriseAchievements)
|
||||
{
|
||||
startPage();
|
||||
List<SchoolEnterpriseAchievements> list = schoolEnterpriseAchievementsService.listFront(schoolEnterpriseAchievements);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出校企成果列表
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ public class AchQueryVo {
|
|||
private String source;//来源
|
||||
private String achievementName;//名称
|
||||
private Long userId;
|
||||
private String showAchievementName;
|
||||
public String getAreaQuery() {
|
||||
return areaQuery;
|
||||
}
|
||||
|
|
@ -30,20 +29,4 @@ public class AchQueryVo {
|
|||
public void setAchievementName(String achievementName) {
|
||||
this.achievementName = achievementName;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getShowAchievementName() {
|
||||
return showAchievementName;
|
||||
}
|
||||
|
||||
public void setShowAchievementName(String showAchievementName) {
|
||||
this.showAchievementName = showAchievementName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ public class AchRelatedVo {
|
|||
private String source;
|
||||
private Long sourceId;
|
||||
private String achRelateName;
|
||||
private String showAchievementName;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
|
@ -74,12 +73,4 @@ public class AchRelatedVo {
|
|||
public void setAchRelateName(String achRelateName) {
|
||||
this.achRelateName = achRelateName;
|
||||
}
|
||||
|
||||
public String getShowAchievementName() {
|
||||
return showAchievementName;
|
||||
}
|
||||
|
||||
public void setShowAchievementName(String showAchievementName) {
|
||||
this.showAchievementName = showAchievementName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,112 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 成果相关字典对象 achievement_dict_data
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2025-05-23
|
||||
*/
|
||||
public class AchievementDictData extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 字典编码 */
|
||||
private Long dictCode;
|
||||
|
||||
/** 字典排序 */
|
||||
@Excel(name = "字典排序")
|
||||
private Integer dictSort;
|
||||
|
||||
/** 字典标签 */
|
||||
@Excel(name = "字典标签")
|
||||
private String dictLabel;
|
||||
|
||||
/** 字典键值 */
|
||||
@Excel(name = "字典键值")
|
||||
private String dictValue;
|
||||
|
||||
/** 字典类型 */
|
||||
@Excel(name = "字典类型")
|
||||
private String dictType;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
public void setDictCode(Long dictCode)
|
||||
{
|
||||
this.dictCode = dictCode;
|
||||
}
|
||||
|
||||
public Long getDictCode()
|
||||
{
|
||||
return dictCode;
|
||||
}
|
||||
public void setDictSort(Integer dictSort)
|
||||
{
|
||||
this.dictSort = dictSort;
|
||||
}
|
||||
|
||||
public Integer getDictSort()
|
||||
{
|
||||
return dictSort;
|
||||
}
|
||||
public void setDictLabel(String dictLabel)
|
||||
{
|
||||
this.dictLabel = dictLabel;
|
||||
}
|
||||
|
||||
public String getDictLabel()
|
||||
{
|
||||
return dictLabel;
|
||||
}
|
||||
public void setDictValue(String dictValue)
|
||||
{
|
||||
this.dictValue = dictValue;
|
||||
}
|
||||
|
||||
public String getDictValue()
|
||||
{
|
||||
return dictValue;
|
||||
}
|
||||
public void setDictType(String dictType)
|
||||
{
|
||||
this.dictType = dictType;
|
||||
}
|
||||
|
||||
public String getDictType()
|
||||
{
|
||||
return dictType;
|
||||
}
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("dictCode", getDictCode())
|
||||
.append("dictSort", getDictSort())
|
||||
.append("dictLabel", getDictLabel())
|
||||
.append("dictValue", getDictValue())
|
||||
.append("dictType", getDictType())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,6 @@ package com.microservices.dms.achievementLibrary.domain;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
|
|
@ -30,10 +29,6 @@ public class Achievements extends BaseEntity {
|
|||
*/
|
||||
@Excel(name = "成果名称")
|
||||
private String achievementName;
|
||||
/**
|
||||
* 成果展示名称
|
||||
*/
|
||||
private String showAchievementName;
|
||||
|
||||
/**
|
||||
* 成果领域1
|
||||
|
|
@ -186,23 +181,6 @@ public class Achievements extends BaseEntity {
|
|||
private String userNickName;
|
||||
public String gender;
|
||||
private String userLogin;
|
||||
private List<Map<String,Object>> dockingUserInfo;
|
||||
|
||||
public List<Map<String, Object>> getDockingUserInfo() {
|
||||
return dockingUserInfo;
|
||||
}
|
||||
|
||||
public void setDockingUserInfo(List<Map<String, Object>> dockingUserInfo) {
|
||||
this.dockingUserInfo = dockingUserInfo;
|
||||
}
|
||||
|
||||
public String getShowAchievementName() {
|
||||
return showAchievementName;
|
||||
}
|
||||
|
||||
public void setShowAchievementName(String showAchievementName) {
|
||||
this.showAchievementName = showAchievementName;
|
||||
}
|
||||
|
||||
public String getUserImg() {
|
||||
return userImg;
|
||||
|
|
@ -502,4 +480,38 @@ public class Achievements extends BaseEntity {
|
|||
return attachments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("achievementName", getAchievementName())
|
||||
.append("field1", getField1())
|
||||
.append("field2", getField2())
|
||||
.append("field3", getField3())
|
||||
.append("achievementType", getAchievementType())
|
||||
.append("source", getSource())
|
||||
.append("sourceId", getSourceId())
|
||||
.append("sourceLink", getSourceLink())
|
||||
.append("tags", getTags())
|
||||
.append("summary", getSummary())
|
||||
.append("publishingUnit", getPublishingUnit())
|
||||
.append("address", getAddress())
|
||||
.append("isFeatured", getIsFeatured())
|
||||
.append("contactPerson", getContactPerson())
|
||||
.append("contactNumber", getContactNumber())
|
||||
.append("ownerId", getOwnerId())
|
||||
.append("ownerName", getOwnerName())
|
||||
.append("status", getStatus())
|
||||
.append("details", getDetails())
|
||||
.append("reviewer", getReviewer())
|
||||
.append("reviewDate", getReviewDate())
|
||||
.append("reviewComments", getReviewComments())
|
||||
.append("images", getImages())
|
||||
.append("attachments", getAttachments())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,95 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.domain;
|
||||
|
||||
public class HotAchVo {
|
||||
|
||||
private int watcher;
|
||||
private int faviter;
|
||||
private int total;
|
||||
private String gender;
|
||||
private String name;
|
||||
private String showAchievementName;
|
||||
private Long id;
|
||||
private String userNickName;
|
||||
private String userName;
|
||||
private String userImg;
|
||||
|
||||
public String getUserImg() {
|
||||
return userImg;
|
||||
}
|
||||
|
||||
public void setUserImg(String userImg) {
|
||||
this.userImg = userImg;
|
||||
}
|
||||
|
||||
public int getWatcher() {
|
||||
return watcher;
|
||||
}
|
||||
|
||||
public void setWatcher(int watcher) {
|
||||
this.watcher = watcher;
|
||||
}
|
||||
|
||||
public int getFaviter() {
|
||||
return faviter;
|
||||
}
|
||||
|
||||
public void setFaviter(int faviter) {
|
||||
this.faviter = faviter;
|
||||
}
|
||||
|
||||
public int getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUserNickName() {
|
||||
return userNickName;
|
||||
}
|
||||
|
||||
public void setUserNickName(String userNickName) {
|
||||
this.userNickName = userNickName;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getShowAchievementName() {
|
||||
return showAchievementName;
|
||||
}
|
||||
|
||||
public void setShowAchievementName(String showAchievementName) {
|
||||
this.showAchievementName = showAchievementName;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.microservices.dms.achievementLibrary.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
|
@ -168,46 +167,6 @@ public class SchoolEnterpriseAchievements extends BaseEntity {
|
|||
@Excel(name = "成果附件")
|
||||
private String attachments;
|
||||
private Integer achievementStatus;
|
||||
//成果小类型
|
||||
private String achievementLittleType;
|
||||
//成果状态
|
||||
private String achievementCurStatus;
|
||||
//团队名称
|
||||
private String teamName;
|
||||
|
||||
private List<AchievementTeam> teamList;
|
||||
|
||||
public List<AchievementTeam> getTeamList() {
|
||||
return teamList;
|
||||
}
|
||||
|
||||
public void setTeamList(List<AchievementTeam> teamList) {
|
||||
this.teamList = teamList;
|
||||
}
|
||||
|
||||
public String getTeamName() {
|
||||
return teamName;
|
||||
}
|
||||
|
||||
public void setTeamName(String teamName) {
|
||||
this.teamName = teamName;
|
||||
}
|
||||
|
||||
public String getAchievementLittleType() {
|
||||
return achievementLittleType;
|
||||
}
|
||||
|
||||
public void setAchievementLittleType(String achievementLittleType) {
|
||||
this.achievementLittleType = achievementLittleType;
|
||||
}
|
||||
|
||||
public String getAchievementCurStatus() {
|
||||
return achievementCurStatus;
|
||||
}
|
||||
|
||||
public void setAchievementCurStatus(String achievementCurStatus) {
|
||||
this.achievementCurStatus = achievementCurStatus;
|
||||
}
|
||||
|
||||
public Integer getAchievementStatus() {
|
||||
return achievementStatus;
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TokenListVo {
|
||||
|
||||
private Long id; // 项目ID
|
||||
private String name; // 项目名称
|
||||
private Long totalToken; // 项目总Token
|
||||
private String createBy; // 创建人
|
||||
private Long currentToken; // 当前Token
|
||||
private String repositoryName; // 仓库名称
|
||||
private Long repositoryId; // 仓库名称
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Data createdOn; // 项目创建时间(以毫秒为单位)
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.microservices.common.datasource.annotation.Slave;
|
||||
import com.microservices.dms.achievementLibrary.domain.AchievementDictData;
|
||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 成果相关字典Mapper接口
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2025-05-23
|
||||
*/
|
||||
@Mapper
|
||||
@Slave
|
||||
public interface AchievementDictDataMapper
|
||||
{
|
||||
/**
|
||||
* 查询成果相关字典
|
||||
*
|
||||
* @param dictCode 成果相关字典主键
|
||||
* @return 成果相关字典
|
||||
*/
|
||||
public AchievementDictData selectAchievementDictDataByDictCode(Long dictCode);
|
||||
|
||||
/**
|
||||
* 查询成果相关字典列表
|
||||
*
|
||||
* @param achievementDictData 成果相关字典
|
||||
* @return 成果相关字典集合
|
||||
*/
|
||||
public List<AchievementDictData> selectAchievementDictDataList(AchievementDictData achievementDictData);
|
||||
|
||||
/**
|
||||
* 新增成果相关字典
|
||||
*
|
||||
* @param achievementDictData 成果相关字典
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAchievementDictData(AchievementDictData achievementDictData);
|
||||
|
||||
/**
|
||||
* 修改成果相关字典
|
||||
*
|
||||
* @param achievementDictData 成果相关字典
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAchievementDictData(AchievementDictData achievementDictData);
|
||||
|
||||
/**
|
||||
* 删除成果相关字典
|
||||
*
|
||||
* @param dictCode 成果相关字典主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAchievementDictDataByDictCode(Long dictCode);
|
||||
|
||||
/**
|
||||
* 批量删除成果相关字典
|
||||
*
|
||||
* @param dictCodes 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAchievementDictDataByDictCodes(Long[] dictCodes);
|
||||
|
||||
List<KeyValueVo> selectDictDataByType(@Param("dictType") String dictType);
|
||||
|
||||
int selectDictDataByLabel(@Param("label") String label,@Param("type") String type);
|
||||
|
||||
List<String> getDictTypes();
|
||||
}
|
||||
|
|
@ -66,6 +66,4 @@ public interface AchievementTeamMapper
|
|||
public int deleteAchievementTeamByIds(Long[] ids);
|
||||
|
||||
void deleteAchievementTeamByAId(@Param("aid") Long aid);
|
||||
|
||||
List<AchievementTeam> selectAchievementTeamByAchId(@Param("achId") Long achId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
package com.microservices.dms.achievementLibrary.mapper;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.microservices.common.datasource.annotation.Master;
|
||||
import com.microservices.common.datasource.annotation.Slave;
|
||||
import com.microservices.dms.achievementLibrary.domain.*;
|
||||
import com.microservices.dms.behaviorImage.domain.AchievementBehaviorSumVo;
|
||||
import com.microservices.dms.resourceLibrary.domain.CompetitionResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.domain.TaskResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
|
@ -90,7 +91,7 @@ public interface AchievementsMapper {
|
|||
|
||||
List<KeyValVo<String, Long>> getAchievement(@Param("s") Date s, @Param("e") Date e, @Param("t") String source);
|
||||
|
||||
List<HotAchVo> getHotAchievement();
|
||||
List<Map<String, String>> getHotAchievement();
|
||||
|
||||
Map<String, Long> indexProjectStatistic();
|
||||
|
||||
|
|
@ -114,7 +115,7 @@ public interface AchievementsMapper {
|
|||
|
||||
List<Map<String, Object>> getAchievementType();
|
||||
|
||||
List<KeyValueVo> getAchievementActData(@Param("s") Date s, @Param("e") Date e);
|
||||
List<KeyValueVo> getAchievementActData();
|
||||
|
||||
List<Map<String, Object>> getAchievementDomain();
|
||||
|
||||
|
|
@ -139,23 +140,4 @@ public interface AchievementsMapper {
|
|||
List<String> getExpertAreasByName(@Param("areaName") String areaName);
|
||||
|
||||
List<Long> getAllSourceId(@Param("id")Long id, @Param("sourceId")Long sourceId);
|
||||
|
||||
List<Long> getAllSourceIdCompetition(@Param("id")Long id, @Param("sourceId")Long sourceId);
|
||||
|
||||
List<Long> getAllSourceIdTask(@Param("id")Long id, @Param("sourceId")Long sourceId);
|
||||
|
||||
List<TaskResourceLibrary> getRelatedAchTaskOfExpert(@Param("id")Long id);
|
||||
|
||||
List<CompetitionResourceLibrary> getRelatedAchCompetitionOfExpert(@Param("id")Long id);
|
||||
|
||||
List<KeyValVo<String,Long>> getAchievementAddYearlyData(@Param("s") Date s, @Param("e") Date e);
|
||||
|
||||
List<KeyValueVo> getAchievementActDataW(@Param("s") Date s, @Param("e") Date e);
|
||||
|
||||
List<KeyValueVo> getAchievementActDataC(@Param("s") Date s, @Param("e") Date e);
|
||||
|
||||
List<KeyValueVo> getAchievementActDataD(@Param("s") Date s, @Param("e") Date e);
|
||||
List<KeyValueVo> getAchievementActDataF(@Param("s") Date s, @Param("e") Date e);
|
||||
|
||||
List<Map<String, Object>> getDockingUserInfo(@Param("id") Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.microservices.dms.achievementLibrary.service;
|
||||
|
||||
import com.alibaba.nacos.shaded.com.google.common.collect.Maps;
|
||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||
import com.microservices.dms.achievementLibrary.mapper.AchievementsMapper;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
|
|
@ -24,7 +23,7 @@ public class BigScreenStatisticService {
|
|||
Date[] days = DateUtil.getDays(0, 6);
|
||||
Map<String, Long> m = achievementsMapper.getAchievement(days[0], days[1], source)
|
||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||
List<String> dateStr = DateUtil.getDateStrMMDD(days[0], days[1]);
|
||||
List<String> dateStr = DateUtil.getDateStrYYYYMMDD(days[0], days[1]);
|
||||
Date[] lastDays = DateUtil.getDays(7, 13);
|
||||
long lastSum = Optional.ofNullable(achievementsMapper.countAchievementBySource(lastDays[0], lastDays[1], source)).orElse(0L);
|
||||
long sum = Optional.ofNullable(achievementsMapper.countAchievementBySource(null, null, source)).orElse(0L);
|
||||
|
|
@ -59,99 +58,18 @@ public class BigScreenStatisticService {
|
|||
return achievementsMapper.getAchievementType();
|
||||
}
|
||||
|
||||
public List<Map<String,Object>> getAchievementActData() {
|
||||
Date[] days = DateUtil.getDays(0, 6);
|
||||
Map<String, Long> wlist = achievementsMapper.getAchievementActDataW(days[0], days[1]).stream().collect(Collectors.toMap(KeyValueVo::getName, KeyValueVo::getValue));
|
||||
Map<String, Long> clist = achievementsMapper.getAchievementActDataC(days[0], days[1]).stream().collect(Collectors.toMap(KeyValueVo::getName, KeyValueVo::getValue));
|
||||
Map<String, Long> dlist = achievementsMapper.getAchievementActDataD(days[0], days[1]).stream().collect(Collectors.toMap(KeyValueVo::getName, KeyValueVo::getValue));
|
||||
Map<String, Long> flist = achievementsMapper.getAchievementActDataF(days[0], days[1]).stream().collect(Collectors.toMap(KeyValueVo::getName, KeyValueVo::getValue));
|
||||
|
||||
List<String> dateStr = DateUtil.getDateStrMMDD(days[0], days[1]);
|
||||
List<KeyValueVo> wres = new ArrayList<>();
|
||||
List<KeyValueVo> cres = new ArrayList<>();
|
||||
List<KeyValueVo> dres = new ArrayList<>();
|
||||
List<KeyValueVo> fres = new ArrayList<>();
|
||||
|
||||
for (String s : dateStr) {
|
||||
Long a = wlist.getOrDefault(s, 0L);
|
||||
KeyValueVo k1 = new KeyValueVo();
|
||||
k1.setKey(s);
|
||||
k1.setValue(a);
|
||||
k1.setName("关注");
|
||||
wres.add(k1);
|
||||
}
|
||||
|
||||
for (String s : dateStr) {
|
||||
Long a = clist.getOrDefault(s, 0L);
|
||||
KeyValueVo k1 = new KeyValueVo();
|
||||
k1.setKey(s);
|
||||
k1.setValue(a);
|
||||
k1.setName("浏览");
|
||||
cres.add(k1);
|
||||
}
|
||||
|
||||
|
||||
for (String s : dateStr) {
|
||||
Long a = dlist.getOrDefault(s, 0L);
|
||||
KeyValueVo k1 = new KeyValueVo();
|
||||
k1.setKey(s);
|
||||
k1.setValue(a);
|
||||
k1.setName("下载");
|
||||
dres.add(k1);
|
||||
}
|
||||
|
||||
for (String s : dateStr) {
|
||||
Long a = flist.getOrDefault(s, 0L);
|
||||
KeyValueVo k1 = new KeyValueVo();
|
||||
k1.setKey(s);
|
||||
k1.setValue(a);
|
||||
k1.setName("收藏");
|
||||
fres.add(k1);
|
||||
}
|
||||
|
||||
List<Map<String, Object>> r = new ArrayList<>();
|
||||
Map<String, Object> w = new HashMap<>();
|
||||
w.put("key", "关注");
|
||||
w.put("value", wres);
|
||||
Map<String, Object> c = new HashMap<>();
|
||||
c.put("key","浏览");
|
||||
c.put("value", cres);
|
||||
Map<String, Object> d = new HashMap<>();
|
||||
d.put("key","下载");
|
||||
d.put("value", dres);
|
||||
Map<String, Object> f = new HashMap<>();
|
||||
f.put("key", "收藏");
|
||||
f.put("value", fres);
|
||||
|
||||
|
||||
r.add(w);
|
||||
r.add(c);
|
||||
r.add(d);
|
||||
r.add(f);
|
||||
|
||||
return r;
|
||||
public Map<String, List<KeyValueVo>> getAchievementActData() {
|
||||
List<KeyValueVo> list = achievementsMapper.getAchievementActData();
|
||||
Map<String, List<KeyValueVo>> res = list.stream().collect(Collectors.groupingBy(KeyValueVo::getKey));
|
||||
return res;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getAchievementDomain() {
|
||||
return achievementsMapper.getAchievementDomain();
|
||||
}
|
||||
|
||||
public Object getAchievementAddYearly() {
|
||||
|
||||
Date[] currentYear = DateUtil.getLast12Months();
|
||||
|
||||
Map<String, Long> m = achievementsMapper.getAchievementAddYearlyData(currentYear[0],currentYear[1])
|
||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||
List<String> dateStr = DateUtil.getDateStrYYYYMM(currentYear[0], currentYear[1]);
|
||||
List<KeyValVo<String, Long>> res = new ArrayList<>();
|
||||
for (String s : dateStr) {
|
||||
Long a = m.getOrDefault(s, 0L);
|
||||
KeyValVo<String, Long> k1 = new KeyValVo<>();
|
||||
k1.setK(s);
|
||||
k1.setV(a);
|
||||
res.add(k1);
|
||||
}
|
||||
return res;
|
||||
public List<Map<String, Object>> getAchievementAddYearly() {
|
||||
return achievementsMapper.getAchievementAddYearly();
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getAchievementHotRank() {
|
||||
|
|
@ -184,11 +102,11 @@ public class BigScreenStatisticService {
|
|||
}
|
||||
|
||||
public List<KeyValVo<String, Long>> getCompetitionYearlyPaperAdd() {
|
||||
Date[] currentYear = DateUtil.getLast12Months();
|
||||
Date[] currentYear = DateUtil.getCurrentYear();
|
||||
|
||||
Map<String, Long> m = competitionResourceLibraryMapper.getCompetitionYearlyPaperAdd(currentYear[0],currentYear[1])
|
||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||
List<String> dateStr = DateUtil.getDateStrYYYYMM(currentYear[0], currentYear[1]);
|
||||
List<String> dateStr = DateUtil.getDateStrMMDD(currentYear[0], currentYear[1]);
|
||||
List<KeyValVo<String, Long>> res = new ArrayList<>();
|
||||
for (String s : dateStr) {
|
||||
Long a = m.getOrDefault(s, 0L);
|
||||
|
|
@ -201,11 +119,12 @@ public class BigScreenStatisticService {
|
|||
}
|
||||
|
||||
public List<KeyValVo<String, Long>> getCompetitionYearlyFinish() {
|
||||
Date[] currentYear = DateUtil.getLast12Months();
|
||||
Date[] currentYear = DateUtil.getCurrentYear();
|
||||
Date[] YearEndOfCur = DateUtil.getCurrentYearEndOf(LocalDate.now());
|
||||
|
||||
Map<String, Long> m = competitionResourceLibraryMapper.getCompetitionYearlyFinish(currentYear[0],currentYear[1])
|
||||
Map<String, Long> m = competitionResourceLibraryMapper.getCompetitionYearlyFinish(YearEndOfCur[0],YearEndOfCur[1])
|
||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||
List<String> dateStr = DateUtil.getDateStrYYYYMM(currentYear[0], currentYear[1]);
|
||||
List<String> dateStr = DateUtil.getDateStrMMDD(currentYear[0], currentYear[1]);
|
||||
List<KeyValVo<String, Long>> res = new ArrayList<>();
|
||||
for (String s : dateStr) {
|
||||
Long a = m.getOrDefault(s, 0L);
|
||||
|
|
|
|||
|
|
@ -1,67 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.microservices.dms.achievementLibrary.domain.AchievementDictData;
|
||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 成果相关字典Service接口
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2025-05-23
|
||||
*/
|
||||
public interface IAchievementDictDataService
|
||||
{
|
||||
/**
|
||||
* 查询成果相关字典
|
||||
*
|
||||
* @param dictCode 成果相关字典主键
|
||||
* @return 成果相关字典
|
||||
*/
|
||||
public AchievementDictData selectAchievementDictDataByDictCode(Long dictCode);
|
||||
|
||||
/**
|
||||
* 查询成果相关字典列表
|
||||
*
|
||||
* @param achievementDictData 成果相关字典
|
||||
* @return 成果相关字典集合
|
||||
*/
|
||||
public List<AchievementDictData> selectAchievementDictDataList(AchievementDictData achievementDictData);
|
||||
|
||||
/**
|
||||
* 新增成果相关字典
|
||||
*
|
||||
* @param achievementDictData 成果相关字典
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAchievementDictData(AchievementDictData achievementDictData);
|
||||
|
||||
/**
|
||||
* 修改成果相关字典
|
||||
*
|
||||
* @param achievementDictData 成果相关字典
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAchievementDictData(AchievementDictData achievementDictData);
|
||||
|
||||
/**
|
||||
* 批量删除成果相关字典
|
||||
*
|
||||
* @param dictCodes 需要删除的成果相关字典主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAchievementDictDataByDictCodes(Long[] dictCodes);
|
||||
|
||||
/**
|
||||
* 删除成果相关字典信息
|
||||
*
|
||||
* @param dictCode 成果相关字典主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAchievementDictDataByDictCode(Long dictCode);
|
||||
|
||||
List<KeyValueVo> selectDictDataByType(String dictType);
|
||||
|
||||
List<String> getDictTypes();
|
||||
}
|
||||
|
|
@ -5,8 +5,6 @@ import java.util.Map;
|
|||
|
||||
import com.microservices.dms.achievementLibrary.domain.*;
|
||||
import com.microservices.dms.behaviorImage.domain.AchievementBehaviorSumVo;
|
||||
import com.microservices.dms.resourceLibrary.domain.CompetitionResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.domain.TaskResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
|
||||
/**
|
||||
|
|
@ -78,7 +76,7 @@ public interface IAchievementsService {
|
|||
|
||||
Map<String, Object> getUerActionData();
|
||||
|
||||
List<HotAchVo> getHotAchievement();
|
||||
List<Map<String, String>> getHotAchievement();
|
||||
|
||||
List<KeyValVo<String, Long>> get7DayAdd(AchQueryVo achQueryVo);
|
||||
|
||||
|
|
@ -96,7 +94,7 @@ public interface IAchievementsService {
|
|||
|
||||
AchievementBehaviorSumVo getActDataStatisticById(Long id);
|
||||
|
||||
List<KeyValVo<String, Long>> get7AddClickById(String id, String clickType);
|
||||
List<KeyValVo<String, Long>> get7AddClickById(String id);
|
||||
|
||||
AchievementBehaviorSumVo getWatchFavoriteStatusById(Long id, Long userId);
|
||||
|
||||
|
|
@ -109,12 +107,4 @@ public interface IAchievementsService {
|
|||
List<KeyValueVo> getProjectAreasByName(String areaName);
|
||||
|
||||
List<String> getExpertAreasByName(String areaName);
|
||||
|
||||
List<AchRelatedResult> getRelatedAchCompetition(Long id, Long sourceId);
|
||||
|
||||
List<AchRelatedResult> getRelatedAchTask(Long id, Long sourceId);
|
||||
|
||||
List<TaskResourceLibrary> getRelatedAchTaskOfExpert(Long id);
|
||||
|
||||
List<CompetitionResourceLibrary> getRelatedAchCompetitionOfExpert(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,4 @@ public interface ISchoolEnterpriseAchievementsService
|
|||
public int deleteSchoolEnterpriseAchievementsById(Long id);
|
||||
|
||||
Long topStatistic(SchoolEnterpriseAchievements schoolEnterpriseAchievements);
|
||||
|
||||
List<SchoolEnterpriseAchievements> listFront(SchoolEnterpriseAchievements schoolEnterpriseAchievements);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.microservices.dms.achievementLibrary.service;
|
||||
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.AchQueryVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||
import com.microservices.dms.achievementLibrary.domain.MemoTotalVo;
|
||||
|
|
@ -34,7 +33,7 @@ public class MemoDashboardService {
|
|||
* 原创、非原创
|
||||
* @return
|
||||
*/
|
||||
public List<KeyValueVo> getIsOriginalStatistic() {
|
||||
public KeyValueVo getIsOriginalStatistic() {
|
||||
return memoResourceLibraryMapper.getIsOriginalStatistic();
|
||||
}
|
||||
|
||||
|
|
@ -75,7 +74,7 @@ public class MemoDashboardService {
|
|||
* @return
|
||||
*/
|
||||
public List<KeyValVo<String, Long>> get7DayPaise() {
|
||||
Date[] days = DateUtil.getDays(0, 6);
|
||||
Date[] days = DateUtil.getDays(1, 7);
|
||||
Map<String, Long> w = memoResourceLibraryMapper.get7DayPaise(days[0], days[1])
|
||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,116 +0,0 @@
|
|||
package com.microservices.dms.achievementLibrary.service.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.microservices.dms.achievementLibrary.mapper.AchievementDictDataMapper;
|
||||
import com.microservices.dms.achievementLibrary.domain.AchievementDictData;
|
||||
import com.microservices.dms.achievementLibrary.service.IAchievementDictDataService;
|
||||
|
||||
/**
|
||||
* 成果相关字典Service业务层处理
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2025-05-23
|
||||
*/
|
||||
@Service
|
||||
public class AchievementDictDataServiceImpl implements IAchievementDictDataService
|
||||
{
|
||||
@Autowired
|
||||
private AchievementDictDataMapper achievementDictDataMapper;
|
||||
|
||||
/**
|
||||
* 查询成果相关字典
|
||||
*
|
||||
* @param dictCode 成果相关字典主键
|
||||
* @return 成果相关字典
|
||||
*/
|
||||
@Override
|
||||
public AchievementDictData selectAchievementDictDataByDictCode(Long dictCode)
|
||||
{
|
||||
return achievementDictDataMapper.selectAchievementDictDataByDictCode(dictCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询成果相关字典列表
|
||||
*
|
||||
* @param achievementDictData 成果相关字典
|
||||
* @return 成果相关字典
|
||||
*/
|
||||
@Override
|
||||
public List<AchievementDictData> selectAchievementDictDataList(AchievementDictData achievementDictData)
|
||||
{
|
||||
return achievementDictDataMapper.selectAchievementDictDataList(achievementDictData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增成果相关字典
|
||||
*
|
||||
* @param achievementDictData 成果相关字典
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAchievementDictData(AchievementDictData achievementDictData)
|
||||
{
|
||||
//判断字典是否存在,存在则不管,不存在则新增
|
||||
String label = achievementDictData.getDictLabel();
|
||||
String type = achievementDictData.getDictType();
|
||||
int num = achievementDictDataMapper.selectDictDataByLabel(label,type);
|
||||
if (num > 0){
|
||||
return 0;
|
||||
}else{
|
||||
achievementDictData.setCreateTime(DateUtils.getNowDate());
|
||||
return achievementDictDataMapper.insertAchievementDictData(achievementDictData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改成果相关字典
|
||||
*
|
||||
* @param achievementDictData 成果相关字典
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAchievementDictData(AchievementDictData achievementDictData)
|
||||
{
|
||||
achievementDictData.setUpdateTime(DateUtils.getNowDate());
|
||||
return achievementDictDataMapper.updateAchievementDictData(achievementDictData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除成果相关字典
|
||||
*
|
||||
* @param dictCodes 需要删除的成果相关字典主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAchievementDictDataByDictCodes(Long[] dictCodes)
|
||||
{
|
||||
return achievementDictDataMapper.deleteAchievementDictDataByDictCodes(dictCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除成果相关字典信息
|
||||
*
|
||||
* @param dictCode 成果相关字典主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAchievementDictDataByDictCode(Long dictCode)
|
||||
{
|
||||
return achievementDictDataMapper.deleteAchievementDictDataByDictCode(dictCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KeyValueVo> selectDictDataByType(String dictType) {
|
||||
return achievementDictDataMapper.selectDictDataByType(dictType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getDictTypes() {
|
||||
return achievementDictDataMapper.getDictTypes();
|
||||
}
|
||||
}
|
||||
|
|
@ -5,25 +5,20 @@ import java.util.stream.Collectors;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.httpClient.service.HttpAPIService;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.*;
|
||||
import com.microservices.dms.behaviorImage.domain.AchievementBehaviorSumVo;
|
||||
import com.microservices.dms.behaviorImage.domain.AchievementImageVo;
|
||||
import com.microservices.dms.behaviorImage.service.IBehaviorImageService;
|
||||
import com.microservices.dms.resourceLibrary.domain.Clicker;
|
||||
import com.microservices.dms.resourceLibrary.domain.CompetitionResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.domain.Searcher;
|
||||
import com.microservices.dms.resourceLibrary.domain.TaskResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
import com.microservices.dms.resourceLibrary.mapper.ExpertResourceLibraryMapper;
|
||||
import com.microservices.dms.resourceLibrary.mapper.ProjectResourceLibraryMapper;
|
||||
import com.microservices.dms.resourceLibrary.mapper.TaskResourceLibraryMapper;
|
||||
import com.microservices.dms.utils.DateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
|
@ -31,7 +26,6 @@ import org.springframework.stereotype.Service;
|
|||
import com.microservices.dms.achievementLibrary.mapper.AchievementsMapper;
|
||||
import com.microservices.dms.achievementLibrary.service.IAchievementsService;
|
||||
|
||||
import static com.microservices.dms.constant.BlockChainFunConstants.QUERY_REPO;
|
||||
import static com.microservices.dms.utils.UrlUtil.getUrlPath;
|
||||
|
||||
/**
|
||||
|
|
@ -41,7 +35,6 @@ import static com.microservices.dms.utils.UrlUtil.getUrlPath;
|
|||
* @date 2025-04-02
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class AchievementsServiceImpl implements IAchievementsService {
|
||||
@Autowired
|
||||
private AchievementsMapper achievementsMapper;
|
||||
|
|
@ -52,6 +45,9 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
@Autowired
|
||||
private ExpertResourceLibraryMapper expertResourceLibraryMapper;
|
||||
|
||||
@Autowired
|
||||
private ProjectResourceLibraryMapper projectResourceLibraryMapper;
|
||||
|
||||
@Autowired
|
||||
private IBehaviorImageService behaviorImageService;
|
||||
|
||||
|
|
@ -64,6 +60,7 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
@Value("${http.gatewayUrl}")
|
||||
public String gatewayUrl;
|
||||
|
||||
|
||||
/**
|
||||
* 查询成果
|
||||
*
|
||||
|
|
@ -73,25 +70,20 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
@Override
|
||||
public Achievements selectAchievementsById(Long id) {
|
||||
Achievements a = achievementsMapper.selectAchievementsById(id);
|
||||
if (StringUtils.isNotNull(a)) {
|
||||
if(StringUtils.isNotNull(a)){
|
||||
String gender = a.getGender();
|
||||
String img = "";
|
||||
if (StringUtils.isNotEmpty(gender) && gender.equals("1")) {
|
||||
String img = "images/avatars/User/boy.jpg";
|
||||
if(StringUtils.isNotEmpty(gender) && gender.equals("1")){
|
||||
img = "images/avatars/User/girl.jpg";
|
||||
} else if (StringUtils.isNotEmpty(gender) && gender.equals("0")) {
|
||||
img = "images/avatars/User/boy.jpg";
|
||||
}
|
||||
a.setUserImg(img);
|
||||
if (StringUtils.isNotEmpty(a.getField1())) {
|
||||
if(StringUtils.isNotEmpty(a.getField1())) {
|
||||
String field1Name = achievementsMapper.getField1NameByParam(a.getSource(), a.getId());
|
||||
if (StringUtils.isNotNull(field1Name)) {
|
||||
a.setField1Name(field1Name);
|
||||
}
|
||||
}
|
||||
a.setUserImg(img);
|
||||
|
||||
a.setImages(buildFileInfoByIdents(a.getImages(), a.getSource()));
|
||||
a.setAttachments(buildFileInfoByIdents(a.getAttachments(), a.getSource()));
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
|
@ -107,15 +99,13 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
List<Achievements> list = achievementsMapper.selectAchievementsList(achievements);
|
||||
for (Achievements a : list) {
|
||||
String gender = a.getGender();
|
||||
String img = "";
|
||||
if (StringUtils.isNotEmpty(gender) && gender.equals("1")) {
|
||||
String img = "images/avatars/User/boy.jpg";
|
||||
if(StringUtils.isNotEmpty(gender) && gender.equals("1")){
|
||||
img = "images/avatars/User/girl.jpg";
|
||||
} else if (StringUtils.isNotEmpty(gender) && gender.equals("0")) {
|
||||
img = "images/avatars/User/boy.jpg";
|
||||
}
|
||||
a.setUserImg(img);
|
||||
//根据id获取领域名称
|
||||
if (StringUtils.isNotEmpty(a.getField1())) {
|
||||
if(StringUtils.isNotEmpty(a.getField1())) {
|
||||
String field1Name = achievementsMapper.getField1NameByParam(a.getSource(), a.getId());
|
||||
if (StringUtils.isNotNull(field1Name)) {
|
||||
a.setField1Name(field1Name);
|
||||
|
|
@ -123,10 +113,6 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
}
|
||||
a.setImages(buildFileInfoByIdents(a.getImages(), a.getSource()));
|
||||
a.setAttachments(buildFileInfoByIdents(a.getAttachments(), a.getSource()));
|
||||
|
||||
//拼接对接的用户信息
|
||||
List<Map<String,Object>> dockingUserInfo = achievementsMapper.getDockingUserInfo(a.getId());
|
||||
a.setDockingUserInfo(dockingUserInfo);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
|
@ -197,26 +183,25 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
return aStr;
|
||||
}
|
||||
|
||||
List<Map<String, String>> list = JSON.parseObject(aStr, new TypeReference<List<Map<String, String>>>() {
|
||||
});
|
||||
List<Map<String,String>> list = JSON.parseObject(aStr,new TypeReference<List<Map<String,String>>>() {});
|
||||
|
||||
if (Objects.equals(source, "1") || Objects.equals(source, "3")) {
|
||||
concatUrl(list, gitLinkUrl);
|
||||
concatUrl(list,gitLinkUrl);
|
||||
}
|
||||
|
||||
if (Objects.equals(source, "2")) {
|
||||
concatUrl(list, markerSpaceUrl);
|
||||
concatUrl(list,markerSpaceUrl);
|
||||
}
|
||||
|
||||
if (Objects.equals(source, "4")) {
|
||||
concatUrl(list, gatewayUrl);
|
||||
concatUrl(list,gatewayUrl);
|
||||
}
|
||||
|
||||
return JSON.toJSONString(list);
|
||||
}
|
||||
|
||||
private void concatUrl(List<Map<String, String>> list, String url) {
|
||||
for (Map<String, String> map : list) {
|
||||
for (Map<String,String> map : list) {
|
||||
String v = map.getOrDefault("v", "");
|
||||
String urlPath = getUrlPath(v);
|
||||
map.put("v", url + urlPath);
|
||||
|
|
@ -246,15 +231,13 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
//遍历成果数据,获取对应成果的点击数
|
||||
for (Achievements a : list) {
|
||||
String gender = a.getGender();
|
||||
String img = "";
|
||||
if (StringUtils.isNotEmpty(gender) && gender.equals("1")) {
|
||||
String img = "images/avatars/User/boy.jpg";
|
||||
if(StringUtils.isNotEmpty(gender) && gender.equals("1")){
|
||||
img = "images/avatars/User/girl.jpg";
|
||||
} else if (StringUtils.isNotEmpty(gender) && gender.equals("0")) {
|
||||
img = "images/avatars/User/boy.jpg";
|
||||
}
|
||||
a.setUserImg(img);
|
||||
//根据id获取领域名称
|
||||
if (StringUtils.isEmpty(achQueryVo.getSource()) && StringUtils.isNotEmpty(a.getField1())) {
|
||||
if(StringUtils.isEmpty(achQueryVo.getSource()) && StringUtils.isNotEmpty(a.getField1())) {
|
||||
String field1Name = achievementsMapper.getField1NameByParam(a.getSource(), a.getId());
|
||||
if (StringUtils.isNotNull(field1Name)) {
|
||||
a.setField1Name(field1Name);
|
||||
|
|
@ -298,21 +281,8 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<HotAchVo> getHotAchievement() {
|
||||
//根据查询条件获取所有的成果数据
|
||||
List<HotAchVo> resultList = achievementsMapper.getHotAchievement();
|
||||
//遍历成果数据,获取对应成果的点击数
|
||||
for (HotAchVo a : resultList) {
|
||||
String gender = a.getGender();
|
||||
String img = "";
|
||||
if (StringUtils.isNotEmpty(gender) && gender.equals("1")) {
|
||||
img = "images/avatars/User/girl.jpg";
|
||||
} else if (StringUtils.isNotEmpty(gender) && gender.equals("0")) {
|
||||
img = "images/avatars/User/boy.jpg";
|
||||
}
|
||||
a.setUserImg(img);
|
||||
}
|
||||
return resultList;
|
||||
public List<Map<String, String>> getHotAchievement() {
|
||||
return achievementsMapper.getHotAchievement();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -343,7 +313,7 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
@Override
|
||||
public Map<String, Object> indexTaskStatistic() {
|
||||
Map<String, Object> res = achievementsMapper.indexTaskStatistic();
|
||||
double convertedTaskAmount = taskResourceLibraryMapper.getConvertedTaskAmount2();
|
||||
double convertedTaskAmount = taskResourceLibraryMapper.getConvertedTaskAmount();
|
||||
res.put("convertedTaskAmount", convertedTaskAmount);
|
||||
return res;
|
||||
}
|
||||
|
|
@ -397,13 +367,10 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<KeyValVo<String, Long>> get7AddClickById(String id, String clickType) {
|
||||
public List<KeyValVo<String, Long>> get7AddClickById(String id) {
|
||||
|
||||
if (StringUtils.isEmpty(clickType)) {
|
||||
clickType = "Achievements";
|
||||
}
|
||||
Date[] days = DateUtil.getDays(0, 6);
|
||||
Map<String, Long> w = achievementsMapper.get7AddClickById(days[0], days[1], clickType, id)
|
||||
Map<String, Long> w = achievementsMapper.get7AddClickById(days[0], days[1], "Achievements", id)
|
||||
.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV));
|
||||
|
||||
List<String> dateStr = DateUtil.getDateStrMMDD(days[0], days[1]);
|
||||
|
|
@ -462,55 +429,6 @@ public class AchievementsServiceImpl implements IAchievementsService {
|
|||
return relatedResultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AchRelatedResult> getRelatedAchCompetition(Long id, Long sourceId) {
|
||||
List<AchRelatedResult> relatedResultList = new ArrayList<>();
|
||||
//想根据开源项目id,获取对应的年度信息
|
||||
List<Long> allSourceId = achievementsMapper.getAllSourceIdCompetition(id, sourceId);
|
||||
List<String> allYear = achievementsMapper.getDistinctYear(id, allSourceId);
|
||||
if (StringUtils.isNotNull(allYear)) {
|
||||
//遍历年度信息,获取年度成果数据
|
||||
for (String paramYear : allYear) {
|
||||
AchRelatedResult relatedResult = new AchRelatedResult();
|
||||
relatedResult.setYear(paramYear);
|
||||
List<AchRelatedVo> tmpList = achievementsMapper.getRelatedAch(id, allSourceId, paramYear);
|
||||
relatedResult.setAchRelatedVoList(tmpList);
|
||||
relatedResultList.add(relatedResult);
|
||||
}
|
||||
}
|
||||
return relatedResultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AchRelatedResult> getRelatedAchTask(Long id, Long sourceId) {
|
||||
List<AchRelatedResult> relatedResultList = new ArrayList<>();
|
||||
//想根据开源项目id,获取对应的年度信息
|
||||
List<Long> allSourceId = achievementsMapper.getAllSourceIdTask(id, sourceId);
|
||||
List<String> allYear = achievementsMapper.getDistinctYear(id, allSourceId);
|
||||
if (StringUtils.isNotNull(allYear)) {
|
||||
//遍历年度信息,获取年度成果数据
|
||||
for (String paramYear : allYear) {
|
||||
AchRelatedResult relatedResult = new AchRelatedResult();
|
||||
relatedResult.setYear(paramYear);
|
||||
List<AchRelatedVo> tmpList = achievementsMapper.getRelatedAch(id, allSourceId, paramYear);
|
||||
relatedResult.setAchRelatedVoList(tmpList);
|
||||
relatedResultList.add(relatedResult);
|
||||
}
|
||||
}
|
||||
return relatedResultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskResourceLibrary> getRelatedAchTaskOfExpert(Long id) {
|
||||
return achievementsMapper.getRelatedAchTaskOfExpert(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CompetitionResourceLibrary> getRelatedAchCompetitionOfExpert(Long id) {
|
||||
return achievementsMapper.getRelatedAchCompetitionOfExpert(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据查询内容,调用搜索行为接口
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
package com.microservices.dms.achievementLibrary.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.DateUtils;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.security.utils.SecurityUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.AchievementTeam;
|
||||
import com.microservices.dms.achievementLibrary.domain.Achievements;
|
||||
import com.microservices.dms.achievementLibrary.mapper.AchievementTeamMapper;
|
||||
import com.microservices.dms.achievementLibrary.mapper.AchievementsMapper;
|
||||
|
|
@ -48,15 +49,7 @@ public class SchoolEnterpriseAchievementsServiceImpl implements ISchoolEnterpris
|
|||
@Override
|
||||
public SchoolEnterpriseAchievements selectSchoolEnterpriseAchievementsById(Long id)
|
||||
{
|
||||
SchoolEnterpriseAchievements sAchievements = schoolEnterpriseAchievementsMapper.selectSchoolEnterpriseAchievementsById(id);
|
||||
if(StringUtils.isNotNull(sAchievements)){
|
||||
Long achId = sAchievements.getId();
|
||||
List<AchievementTeam> teamList = achievementTeamMapper.selectAchievementTeamByAchId(achId);
|
||||
if(StringUtils.isNotNull(teamList) && teamList.size() > 0){
|
||||
sAchievements.setTeamList(teamList);
|
||||
}
|
||||
}
|
||||
return sAchievements;
|
||||
return schoolEnterpriseAchievementsMapper.selectSchoolEnterpriseAchievementsById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -81,16 +74,6 @@ public class SchoolEnterpriseAchievementsServiceImpl implements ISchoolEnterpris
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SchoolEnterpriseAchievements> listFront(SchoolEnterpriseAchievements schoolEnterpriseAchievements) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
String username = loginUser.getUsername();
|
||||
schoolEnterpriseAchievements.setCreateBy(username);
|
||||
}
|
||||
return selectSchoolEnterpriseAchievementsList(schoolEnterpriseAchievements);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增校企成果
|
||||
*
|
||||
|
|
|
|||
|
|
@ -116,8 +116,9 @@ public class BehaviorImageController extends BaseController {
|
|||
List<ActivityUserLibrary> list = behaviorImageService.selectActivityUserLibraryList(activityUserLibrary);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("/根据用户ID,获取用户对应的成果汇总")
|
||||
/**
|
||||
* 根据用户ID,获取用户对应的成果汇总
|
||||
*/
|
||||
@GetMapping(value = "/getUserTypeStatistic")
|
||||
public AjaxResult getUserTypeStatistic(@PathVariable("userId") Long userId)
|
||||
{
|
||||
|
|
@ -170,12 +171,4 @@ public class BehaviorImageController extends BaseController {
|
|||
{
|
||||
return AjaxResult.success(behaviorImageService.getActivityStatistic());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/getUserBehaviorSum")
|
||||
@ApiOperation("获取用户的所有关注、点赞数")
|
||||
public AjaxResult getUserBehaviorSum(Long userId)
|
||||
{
|
||||
return AjaxResult.success(behaviorImageService.getUserBehaviorSum(userId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,16 +11,6 @@ public class AchievementBehaviorSumVo {
|
|||
private Long favoriteSum;
|
||||
//下载量
|
||||
private Long downloadSum;
|
||||
//成果用户对接
|
||||
private Long userDockingSum;
|
||||
|
||||
public Long getUserDockingSum() {
|
||||
return userDockingSum;
|
||||
}
|
||||
|
||||
public void setUserDockingSum(Long userDockingSum) {
|
||||
this.userDockingSum = userDockingSum;
|
||||
}
|
||||
|
||||
public Long getClickSum() {
|
||||
return clickSum;
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
package com.microservices.dms.behaviorImage.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
public class ActivityUserTotal {
|
||||
//活跃用户
|
||||
private Long totalUser;
|
||||
//活跃用户专家数
|
||||
private Long totalExpert;
|
||||
//活跃用户实名认证
|
||||
private Long authTotal;
|
||||
|
||||
public Long getTotalUser() {
|
||||
return totalUser;
|
||||
}
|
||||
|
||||
public void setTotalUser(Long totalUser) {
|
||||
this.totalUser = totalUser;
|
||||
}
|
||||
|
||||
public Long getTotalExpert() {
|
||||
return totalExpert;
|
||||
}
|
||||
|
||||
public void setTotalExpert(Long totalExpert) {
|
||||
this.totalExpert = totalExpert;
|
||||
}
|
||||
|
||||
public Long getAuthTotal() {
|
||||
return authTotal;
|
||||
}
|
||||
|
||||
public void setAuthTotal(Long authTotal) {
|
||||
this.authTotal = authTotal;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,10 @@ package com.microservices.dms.behaviorImage.mapper;
|
|||
|
||||
import com.microservices.common.datasource.annotation.Slave;
|
||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||
import com.microservices.dms.behaviorImage.domain.*;
|
||||
import com.microservices.dms.behaviorImage.domain.AchievementBehaviorSumVo;
|
||||
import com.microservices.dms.behaviorImage.domain.ActivityUserLibrary;
|
||||
import com.microservices.dms.behaviorImage.domain.BehaviorImageWeight;
|
||||
import com.microservices.dms.behaviorImage.domain.UserTypeTotalVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -95,9 +98,5 @@ public interface BehaviorImageMapper {
|
|||
|
||||
List<UserTypeTotalVo> getUserTypeStatistic(@Param("userId")Long userId);
|
||||
|
||||
ActivityUserTotal getActivityStatistic();
|
||||
|
||||
List<ActivityUserLibrary> selectActivityUserLibraryListAll(ActivityUserLibrary activityUserLibrary);
|
||||
|
||||
UserTypeTotalVo getUserBehaviorSum(@Param("userId")Long userId);
|
||||
List<KeyValueVo> getActivityStatistic();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,5 @@ public interface IBehaviorImageService {
|
|||
|
||||
UserExpertTotalVo getUserExpertStatistic(Long userId);
|
||||
|
||||
ActivityUserTotal getActivityStatistic();
|
||||
|
||||
UserTypeTotalVo getUserBehaviorSum(Long userId);
|
||||
List<KeyValueVo> getActivityStatistic();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ public class BehaviorImageServiceImpl implements IBehaviorImageService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActivityUserTotal getActivityStatistic() {
|
||||
public List<KeyValueVo> getActivityStatistic() {
|
||||
return behaviorImageMapper.getActivityStatistic();
|
||||
}
|
||||
|
||||
|
|
@ -318,30 +318,19 @@ public class BehaviorImageServiceImpl implements IBehaviorImageService {
|
|||
* @param activityUserLibrary 活跃用户资源库
|
||||
* @return
|
||||
*/
|
||||
// @Override
|
||||
// public List<ActivityUserLibrary> selectActivityUserLibraryList(ActivityUserLibrary activityUserLibrary) {
|
||||
// List<ActivityUserLibrary> list = behaviorImageMapper.selectActivityUserLibraryList(activityUserLibrary);
|
||||
// for (ActivityUserLibrary a : list) {
|
||||
// Long relatedProject= behaviorImageMapper.getrelatedProjectCount(a.getUserId());
|
||||
// a.setRelatedProject(relatedProject);
|
||||
// Long relatedTask= behaviorImageMapper.getrelatedTaskCount(a.getUserId());
|
||||
// a.setRelatedTask(relatedTask);
|
||||
// Long relatedCompetition= behaviorImageMapper.getrelatedCompetitionCount(a.getUserId());
|
||||
// a.setRelatedCompetition(relatedCompetition);
|
||||
// Long relatedMemo= behaviorImageMapper.getrelatedMemoCount(a.getUserId());
|
||||
// a.setRelatedMemo(relatedMemo);
|
||||
// }
|
||||
// return list;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<ActivityUserLibrary> selectActivityUserLibraryList(ActivityUserLibrary activityUserLibrary) {
|
||||
List<ActivityUserLibrary> list = behaviorImageMapper.selectActivityUserLibraryListAll(activityUserLibrary);
|
||||
List<ActivityUserLibrary> list = behaviorImageMapper.selectActivityUserLibraryList(activityUserLibrary);
|
||||
for (ActivityUserLibrary a : list) {
|
||||
Long relatedProject= behaviorImageMapper.getrelatedProjectCount(a.getUserId());
|
||||
a.setRelatedProject(relatedProject);
|
||||
Long relatedTask= behaviorImageMapper.getrelatedTaskCount(a.getUserId());
|
||||
a.setRelatedTask(relatedTask);
|
||||
Long relatedCompetition= behaviorImageMapper.getrelatedCompetitionCount(a.getUserId());
|
||||
a.setRelatedCompetition(relatedCompetition);
|
||||
Long relatedMemo= behaviorImageMapper.getrelatedMemoCount(a.getUserId());
|
||||
a.setRelatedMemo(relatedMemo);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserTypeTotalVo getUserBehaviorSum(Long userId) {
|
||||
return behaviorImageMapper.getUserBehaviorSum(userId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,23 +11,10 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -170,22 +157,4 @@ public class OpenController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/downloadAch")
|
||||
@ApiOperation("成果征集信息下载")
|
||||
public ResponseEntity<Resource> downloadAch() throws IOException {
|
||||
String fileName = "红山开源优秀科研成果信息征集.zip";
|
||||
Resource resource = new ClassPathResource(fileName);
|
||||
if (!resource.exists()) {
|
||||
throw new RuntimeException("文件不存在: " + fileName);
|
||||
}
|
||||
String encodedFileName = URLEncoder.encode(fileName, String.valueOf(StandardCharsets.UTF_8))
|
||||
.replace("+", "%20");
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION,
|
||||
"attachment; filename*=UTF-8''" + encodedFileName)
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.body(resource);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
package com.microservices.dms.constant;
|
||||
|
||||
/**
|
||||
* 区块链方法常量
|
||||
*/
|
||||
public class BlockChainFunConstants {
|
||||
public static final String CREATE_REPO = "create repo"; //项目入链
|
||||
public static final String QUERY_REPO = "query repo basic info"; //项目入链信息查询
|
||||
public static final String USER_SINGLE_REPO = "query user balance of single repo"; //单个项目某个用户token
|
||||
public static final String USER_ALL_REPOS = "query user balance of all repos"; //某个用户所有项目token
|
||||
|
||||
public static final String CREATE_COMMIT = "upload commit info"; //Commit新增入链
|
||||
public static final String QUERY_COMMIT = "query commit info"; //Commit入链信息查询
|
||||
|
||||
public static final String CREATE_PR = "upload pull request info"; //Pr新增入链
|
||||
public static final String QUERY_PR_LATEST = "query pull request latest info"; //单个pr入链所有信息
|
||||
public static final String QUERY_PR_ALL = "query pull request all info"; //单个pr最后一次入链信息
|
||||
|
||||
public static final String CREATE_upDATE_issue = "upload issue info"; //Issue新增、修改入链
|
||||
public static final String QUERY_ISSUE_LATEST = "query issue latest info"; //单个Issue最后一次入链信息
|
||||
public static final String QUERY_ISSUE_ALL = "query issue all info"; //单个Issue入链所有信息
|
||||
|
||||
public static final String ADD_USER_BALANCE = "add user balance"; //项目分配token——用户token新增
|
||||
public static final String MINUS_USER_BALANCE = "minus user balance"; //项目分配token-用户token减少
|
||||
public static final String LOCK_USER_BALANCE = "lock user balance"; //用户转账token-将自己token分配给本项目中的其他用户
|
||||
|
||||
}
|
||||
|
|
@ -2,8 +2,7 @@ package com.microservices.dms.constant;
|
|||
|
||||
public class TaskConstant {
|
||||
|
||||
private TaskConstant() {
|
||||
}
|
||||
private TaskConstant() {}
|
||||
|
||||
public static final String TASK_TYPE_WATCHERS = "MakerTask";
|
||||
public static final String TASK_TYPE_JOURNALS = "makerSpaceTask";
|
||||
|
|
@ -23,16 +22,4 @@ public class TaskConstant {
|
|||
public static final String EXPERTS = "Experts";
|
||||
public static final String ACHIEVEMENTS = "Achievements";
|
||||
|
||||
// task status dict
|
||||
public static final int DRAFT_STATUS = 0; //草稿状态
|
||||
public static final int TO_BE_REVIEWED_STATUS = 1; //待审核状态
|
||||
public static final int REFUSED_STATUS = 2; //已拒绝状态
|
||||
public static final int TASK_PAPER_COLLECTING_STATUS = 3; //成果征集中状态
|
||||
public static final int TASK_PAPER_CHOOSING_STATUS = 4; //成果评选中状态
|
||||
public static final int TASK_RESULT_PROOF_STATUS = 5; //公示中状态
|
||||
public static final int TASK_SIGNING_STATUS = 6; //协议签定中状态
|
||||
public static final int TASK_PAYING_STATUS = 7; //支付中状态
|
||||
public static final int TASK_COMPLETE_STATUS = 8; //任务完成状态
|
||||
public static final int TASK_TO_BE_REPAIRED_STATUS = 9; //待修缮状态
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,17 +4,13 @@ import com.microservices.common.core.web.domain.AjaxResult;
|
|||
import com.microservices.dms.referral.service.TalentReferralService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Data
|
||||
@Api(tags = "数据管理体系-推荐接口")
|
||||
@Api(tags = "数据管理体系-人才推荐接口")
|
||||
@RestController
|
||||
@RequestMapping("/talentReferral")
|
||||
@RequiredArgsConstructor
|
||||
|
|
@ -25,33 +21,12 @@ public class TalentReferralController {
|
|||
@GetMapping("/issueTalentReferral")
|
||||
@ApiOperation(value = "疑修人才推荐")
|
||||
public AjaxResult issueTalentReferral(@RequestParam("issueId") Long issueId, @RequestParam("projectId") Long projectId) {
|
||||
return AjaxResult.success(talentReferralService.doIssueTalentReferral(issueId, projectId));
|
||||
return AjaxResult.success(talentReferralService.issueTalentReferral(issueId, projectId));
|
||||
}
|
||||
|
||||
@GetMapping("/pullRequestTalentReferral")
|
||||
@ApiOperation(value = "PR人才推荐")
|
||||
public AjaxResult pullRequestTalentReferral(@RequestParam("prId") Long prId, @RequestParam("projectId") Long projectId) {
|
||||
return AjaxResult.success(talentReferralService.doPRTalentReferral(prId, projectId));
|
||||
return AjaxResult.success(talentReferralService.PRTalentReferral(prId, projectId));
|
||||
}
|
||||
|
||||
@GetMapping("/taskAchievementTalentReferral")
|
||||
@ApiOperation(value = "任务成果推荐")
|
||||
public AjaxResult taskAchievementTalentReferral(@RequestParam("taskId") Long taskId) {
|
||||
return AjaxResult.success(talentReferralService.taskAchievementTalentReferral(taskId));
|
||||
}
|
||||
|
||||
@GetMapping("/taskExpertTalentReferral")
|
||||
@ApiOperation(value = "任务专家推荐")
|
||||
public AjaxResult taskExpertTalentReferral(@RequestParam("taskId") Long taskId) {
|
||||
return AjaxResult.success(talentReferralService.taskExpertTalentReferral(taskId));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/competitionExpertTalentReferral")
|
||||
@ApiOperation(value = "竞赛专家推荐")
|
||||
public AjaxResult competitionExpertTalentReferral(@RequestParam("competitionId") Long competitionId) {
|
||||
return AjaxResult.success(talentReferralService.competitionExpertTalentReferral(competitionId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
package com.microservices.dms.referral.mapper;
|
||||
|
||||
import com.microservices.common.datasource.annotation.Slave;
|
||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||
import com.microservices.dms.referral.vo.*;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
import com.microservices.dms.referral.vo.IssuesVo;
|
||||
import com.microservices.dms.referral.vo.PullRequestVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
@Slave
|
||||
|
|
@ -29,21 +27,4 @@ public interface TalentReferralMapper {
|
|||
String selectRepositoriesUrl(@Param("id") Long id);
|
||||
|
||||
Long selectIdByLogin(@Param("login") String login);
|
||||
|
||||
List<TaskVo> selectTaskByStatus(@Param("statusIds") List<Integer> statusIds);
|
||||
|
||||
Map<String, Object> selectUsersById(@Param("id") Long id);
|
||||
|
||||
TaskVo selectTaskById(@Param("id") Long id);
|
||||
|
||||
List<ExpertVo> selectExpertsBy(ExpertVo expertVo);
|
||||
|
||||
List<KeyValVo<Long,String>> allTaskWithExpertIds(@Param("type") String type);
|
||||
|
||||
TaskVo selectCompetitionById(Long competitionId);
|
||||
|
||||
List<TaskVo> selectCompetitionIdByStatus();
|
||||
|
||||
PrInfoVo selectPRInfoById(@Param("id") Integer id);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,14 @@ package com.microservices.dms.referral.service;
|
|||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.dms.achievementLibrary.domain.Achievements;
|
||||
import com.microservices.dms.achievementLibrary.domain.KeyValueVo;
|
||||
import com.microservices.dms.achievementLibrary.mapper.AchievementsMapper;
|
||||
import com.microservices.common.httpClient.util.GitLinkRequestHelper;
|
||||
import com.microservices.dms.constant.ReferralConstant;
|
||||
import com.microservices.dms.constant.TaskConstant;
|
||||
import com.microservices.dms.referral.mapper.TalentReferralMapper;
|
||||
import com.microservices.dms.referral.vo.*;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
import com.microservices.dms.referral.vo.IssueDto;
|
||||
import com.microservices.dms.referral.vo.IssuesVo;
|
||||
import com.microservices.dms.referral.vo.PullRequestVo;
|
||||
import com.microservices.dms.utils.DmsGitLinkRequestUrl;
|
||||
import com.microservices.dms.utils.DmsRequestHelper;
|
||||
import com.microservices.dms.utils.SimilarityService;
|
||||
|
|
@ -36,17 +33,15 @@ public class TalentReferralService {
|
|||
@Autowired
|
||||
private DmsRequestHelper dmsRequestHelper;
|
||||
|
||||
@Autowired
|
||||
private AchievementsMapper achievementsMapper;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TalentReferralService.class);
|
||||
|
||||
public Set<Long> getContributors(String projectFullName) {
|
||||
try {
|
||||
// 获取项目贡献者数量
|
||||
JSONArray contributorsArray = dmsRequestHelper.getAllDataByPage(DmsGitLinkRequestUrl.CONTRIBUTORS(projectFullName), "list", "total_count");
|
||||
JSONArray contributorsArray = dmsRequestHelper.getAllDataByPage(DmsGitLinkRequestUrl.CONTRIBUTORS(projectFullName), "list","total_count");
|
||||
|
||||
return contributorsArray.stream().map(o -> (JSONObject) o).map(s -> s.getString("contributions")).filter(StringUtils::isNotBlank).mapToLong(Long::parseLong).boxed().collect(Collectors.toSet());
|
||||
return contributorsArray.stream().map(o -> (JSONObject) o).map(s -> s.getString("contributions")).filter(StringUtils::isNotBlank)
|
||||
.mapToLong(Long::parseLong).boxed().collect(Collectors.toSet());
|
||||
|
||||
} catch (ServiceException e) {
|
||||
logger.error("【{}】获取项目贡献者数量失败:{}", projectFullName, e.getMessage());
|
||||
|
|
@ -57,9 +52,10 @@ public class TalentReferralService {
|
|||
public Set<Long> getCollaborators(String projectFullName) {
|
||||
try {
|
||||
// 获取项目成员者数量
|
||||
JSONArray contributorsArray = dmsRequestHelper.getAllDataByPage(DmsGitLinkRequestUrl.QUERY_USER_FROM_PROJECT(projectFullName), "members", "total_count");
|
||||
JSONArray contributorsArray = dmsRequestHelper.getAllDataByPage(DmsGitLinkRequestUrl.QUERY_USER_FROM_PROJECT(projectFullName), "members","total_count");
|
||||
|
||||
return contributorsArray.stream().map(o -> (JSONObject) o).map(s -> s.getString("id")).filter(StringUtils::isNotBlank).mapToLong(Long::parseLong).boxed().collect(Collectors.toSet());
|
||||
return contributorsArray.stream().map(o -> (JSONObject) o).map(s -> s.getString("id"))
|
||||
.filter(StringUtils::isNotBlank).mapToLong(Long::parseLong).boxed().collect(Collectors.toSet());
|
||||
|
||||
} catch (ServiceException e) {
|
||||
logger.error("【{}】获取项目成员者数量失败:{}", projectFullName, e.getMessage());
|
||||
|
|
@ -91,14 +87,6 @@ public class TalentReferralService {
|
|||
return collaborators;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> doIssueTalentReferral(Long issueId , Long projectId) {
|
||||
List<Map.Entry<Long, Double>> entries = issueTalentReferral(projectId, issueId);
|
||||
return entries.stream().limit(3).map(s -> {
|
||||
Map<String, Object> mm = talentReferralMapper.selectUsersById(s.getKey());
|
||||
return mm;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Map.Entry<Long, Double>> issueTalentReferral(Long projectId, Long issueId) {
|
||||
|
||||
IssuesVo curIssue = talentReferralMapper.selectIssuesById(issueId);
|
||||
|
|
@ -108,12 +96,12 @@ public class TalentReferralService {
|
|||
|
||||
List<Long> curIssueAssigners = talentReferralMapper.selectIssuesAssigners(curIssue.getId());
|
||||
if (!curIssueAssigners.isEmpty()) {
|
||||
// return new ArrayList<>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
IssuesVo vo = new IssuesVo();
|
||||
vo.setProjectId(projectId);
|
||||
vo.setStatusIds(Lists.newArrayList(ReferralConstant.ISSUE_CLOSED,ReferralConstant.ISSUE_RESOLVED));
|
||||
vo.setStatusIds(Collections.singletonList(ReferralConstant.ISSUE_CLOSED));
|
||||
List<IssuesVo> issuesVos = talentReferralMapper.selectIssuesCondition(vo);
|
||||
Map<Long, Double> userFractionMap = new HashMap<>();
|
||||
// 计算与解决issue的相似度, 标题+描述
|
||||
|
|
@ -150,41 +138,37 @@ public class TalentReferralService {
|
|||
Map<Long, Double> userFractionMap = new HashMap<>();
|
||||
Map<String, Double> userNameFractionMap = new HashMap<>();
|
||||
Map<String, Set<String>> PRFilesMap = new HashMap<>();
|
||||
List<IssueDto> closedPullRequests = getPullRequests(projectId, "11").stream()
|
||||
.filter(e->StringUtils.isNotBlank(e.getAssignUserLogin())).collect(Collectors.toList());
|
||||
List<IssueDto> closedPullRequests = getPullRequests(projectId, "11");
|
||||
|
||||
for (IssueDto pr : prs) {
|
||||
PrInfoVo curPrInfoVo = talentReferralMapper.selectPRInfoById(pr.getPullRequestId());
|
||||
//关闭PR的对比
|
||||
for (IssueDto dto : closedPullRequests) {
|
||||
String reviewer = dto.getAssignUserLogin();
|
||||
Set<String> prFiles = getPRFiles(projectId, dto.getPullRequestNumber());
|
||||
PRFilesMap.merge(reviewer, prFiles, (a, b) -> {
|
||||
HashSet<String> set = new HashSet<>();
|
||||
set.addAll(a);
|
||||
set.addAll(b);
|
||||
return set;
|
||||
});
|
||||
|
||||
//标题、content匹配
|
||||
PrInfoVo prInfoVo = talentReferralMapper.selectPRInfoById(dto.getPullRequestId());
|
||||
double subjectFraction = SimilarityService.sentence(curPrInfoVo.getTitle(), prInfoVo.getTitle());
|
||||
double descFraction = SimilarityService.text(curPrInfoVo.getContent(), prInfoVo.getContent());
|
||||
//这个数据可以缓存下来
|
||||
userNameFractionMap.merge(dto.getAssignUserLogin(), (subjectFraction + descFraction) * 40.0D, Double::sum);
|
||||
List<String> reviewers = dto.getReviewers();
|
||||
for (String reviewer : reviewers) {
|
||||
Set<String> prFiles = getPRFiles(projectId, dto.getPullRequestNumber());
|
||||
PRFilesMap.merge(reviewer, prFiles, (a, b) -> {
|
||||
HashSet<String> set = new HashSet<>();
|
||||
set.addAll(a);
|
||||
set.addAll(b);
|
||||
return set;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> curPrFiles = getPRFiles(projectId, pr.getPullRequestNumber());
|
||||
for (String curPrFile : curPrFiles) {
|
||||
PRFilesMap.forEach((k, v) -> {
|
||||
if (v.contains(curPrFile)) {
|
||||
userNameFractionMap.merge(k, 30.0D, Double::sum);
|
||||
userNameFractionMap.merge(k, 60.0D, Double::sum);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 计算每个负责人关闭的 PR数量
|
||||
closedPullRequests.stream().map(IssueDto::getAssignUserLogin).forEach(s -> userNameFractionMap.merge(s, 30.0D, Double::sum));
|
||||
closedPullRequests.stream().map(IssueDto::getReviewers).flatMap(List::stream)
|
||||
.forEach(s -> userNameFractionMap.merge(s, 40.0D, Double::sum));
|
||||
|
||||
|
||||
}
|
||||
|
||||
userNameFractionMap.forEach((k, v) -> {
|
||||
|
|
@ -226,7 +210,7 @@ public class TalentReferralService {
|
|||
}
|
||||
|
||||
try {
|
||||
JSONArray allDataByPage = dmsRequestHelper.getAllDataByPage(DmsGitLinkRequestUrl.GET_PR_FILES(projectFullName, PRNum), "files", "file_nums");
|
||||
JSONArray allDataByPage = dmsRequestHelper.getAllDataByPage(DmsGitLinkRequestUrl.GET_PR_FILES(projectFullName, PRNum), "issues", "files");
|
||||
return allDataByPage.stream().map(o -> (JSONObject) o).map(o -> (String) o.get("filename")).collect(Collectors.toSet());
|
||||
} catch (ServiceException e) {
|
||||
logger.error("【{}】获取PR文件失败:{}", projectFullName, e.getMessage());
|
||||
|
|
@ -234,172 +218,25 @@ public class TalentReferralService {
|
|||
return new HashSet<>();
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> doPRTalentReferral(Long prId, Long projectId) {
|
||||
List<Map.Entry<Long, Double>> entries = PRTalentReferral(projectId, prId);
|
||||
return entries.stream().limit(3).map(s -> {
|
||||
Map<String, Object> mm = talentReferralMapper.selectUsersById(s.getKey());
|
||||
return mm;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Map.Entry<Long, Double>> PRTalentReferral(Long projectId, Long prId) {
|
||||
List<IssueDto> openPullRequests = getPullRequests(projectId, "1");
|
||||
openPullRequests = openPullRequests.stream().filter(e -> StringUtils.isEmpty(e.getAssignUserLogin())).collect(Collectors.toList());
|
||||
openPullRequests = openPullRequests.stream().filter(e -> e.getReviewers().isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (prId != null) {
|
||||
openPullRequests = openPullRequests.stream().filter(e -> Objects.equals((long) (e.getPullRequestId()), prId)).collect(Collectors.toList());
|
||||
openPullRequests = openPullRequests.stream().filter(e -> Objects.equals((long) (e.getId()), prId))
|
||||
.filter(e -> e.getReviewers().isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
return PRTalentReferral(projectId, prId, openPullRequests);
|
||||
}
|
||||
|
||||
return PRTalentReferral(projectId, null, openPullRequests);
|
||||
return PRTalentReferral(projectId, prId, openPullRequests);
|
||||
}
|
||||
|
||||
//定时统计
|
||||
public void projectsStatistic() {
|
||||
public void projectsStatistic(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1、先查找任务状态为成果征集中、成果评选中的数据,新增存储到数据表中
|
||||
* 2、获取系统中的任务领域和数据仓库中的领域是一样 ;50%
|
||||
* 3、根据1中任务标题和任务正文 与数据仓库中名称和简介、详情比较 ;取前10获取对比计算分值大于0的结果
|
||||
* 4、将2和3的结果相加,取前5个成果进行推荐
|
||||
*/
|
||||
public List<Achievements> taskAchievementTalentReferral(Long taskId) {
|
||||
TaskVo task = talentReferralMapper.selectTaskById(taskId);
|
||||
Achievements tCond = new Achievements();
|
||||
tCond.setSourceId(taskId);
|
||||
tCond.setSource("2");
|
||||
tCond.setStatus("1");
|
||||
List<Achievements> taskAchievements = achievementsMapper.selectAchievementsList(tCond);
|
||||
List<Achievements> result;
|
||||
|
||||
List<Long> trTaskIds = doTaskTalentReferral(task, taskAchievements);
|
||||
result = trTaskIds.stream().map(s -> taskAchievements.stream().filter(e -> e.getId().equals(s)).findFirst().orElse(null)).filter(Objects::nonNull).limit(5).collect(Collectors.toList());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<Long> doTaskTalentReferral(TaskVo task, List<Achievements> taskVos) {
|
||||
Long taskDomain = task.getCategoryId();
|
||||
Map<Long, Double> step1Map = new TreeMap<>();
|
||||
Map<Long, Double> step2Map = new TreeMap<>();
|
||||
for (Achievements t1 : taskVos) {
|
||||
if (Objects.equals(String.valueOf(taskDomain), t1.getField1())) {
|
||||
step1Map.put(t1.getId(), 50.0D);
|
||||
}
|
||||
double subjectFraction = SimilarityService.sentence(task.getName(), t1.getAchievementName());
|
||||
double descFraction = SimilarityService.text(t1.getSummary(), task.getDescription());
|
||||
step2Map.put(t1.getId(), (subjectFraction + descFraction) * 50.0D);
|
||||
}
|
||||
|
||||
step1Map.forEach((k, v) -> step2Map.merge(k, v, Double::sum));
|
||||
step2Map.keySet().removeIf(step -> Double.compare(step2Map.get(step), 0.0D) > 0);
|
||||
|
||||
List<Map.Entry<Long, Double>> entryList = new ArrayList<>(step2Map.entrySet());
|
||||
entryList.sort((entry1, entry2) -> Double.compare(entry2.getValue(), entry1.getValue()));
|
||||
|
||||
return entryList.stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创客任务评审专家推荐
|
||||
* 1、先查找创客任务状态未结束,并且已加入评审的数据,新增存储到数据表中
|
||||
* 2、技术匹配度:系统中专家领域 与 任务是一样的领域 20%
|
||||
* 3、根据1中任务标题和任务描述 与专家简介进行比较 ,匹配结果分数,取前10;30%
|
||||
* 4、根据1中任务标题和任务描述 与已完成的任务标题与任务描述比较,匹配结果分数,取前3 ,前3个竞赛中对应的专家 分数*50%
|
||||
*/
|
||||
public Object taskExpertTalentReferral(Long taskId) {
|
||||
TaskVo task = talentReferralMapper.selectTaskById(taskId);
|
||||
List<KeyValueVo> categories = achievementsMapper.getAreasByName(null);
|
||||
List<TaskVo> completedTasks = talentReferralMapper.selectTaskByStatus(Lists.newArrayList(TaskConstant.TASK_COMPLETE_STATUS));
|
||||
List<ExpertVo> allExperts = talentReferralMapper.selectExpertsBy(new ExpertVo());
|
||||
|
||||
List<Long> expertIds = doTaskExpertTalentReferral(task, categories, completedTasks, allExperts);
|
||||
return expertIds.stream().map(s -> allExperts.stream().filter(e -> e.getId().equals(s)).findFirst().orElse(null)).filter(Objects::nonNull).limit(3).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<Long> doTaskExpertTalentReferral(TaskVo task, List<KeyValueVo> categories, List<TaskVo> completedTasks, List<ExpertVo> allExperts) {
|
||||
|
||||
Map<Long, String> v2k = categories.stream().collect(Collectors.toMap(KeyValueVo::getValue, KeyValueVo::getKey, (o, n) -> n));
|
||||
|
||||
String taskDomain = v2k.get(task.getCategoryId());
|
||||
Map<Long, Double> step1Map = new TreeMap<>();
|
||||
Map<Long, Double> step2Map = new TreeMap<>();
|
||||
for (ExpertVo t1 : allExperts) {
|
||||
if (Objects.equals(taskDomain, t1.getReviewAreaOne()) || Objects.equals(taskDomain, t1.getReviewAreaTwo()) || Objects.equals(taskDomain, t1.getReviewAreaThree())) {
|
||||
step1Map.put(t1.getId(), 50.0D);
|
||||
}
|
||||
}
|
||||
|
||||
List<KeyValVo<Long, String>> allTaskWithExpertIds = talentReferralMapper.allTaskWithExpertIds("1");
|
||||
Map<Long, String> t2e = allTaskWithExpertIds.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV, (o, n) -> n));
|
||||
for (TaskVo t2 : completedTasks) {
|
||||
double subjectFraction = SimilarityService.sentence(task.getName(), t2.getName());
|
||||
double descFraction = SimilarityService.text(t2.getDescription(), task.getDescription());
|
||||
|
||||
String[] split = t2e.getOrDefault(t2.getId(), "").split(",");
|
||||
for (String s : split) {
|
||||
if (StringUtils.isNotBlank(s)) {
|
||||
step2Map.put(Long.parseLong(s), (subjectFraction + descFraction) * 50.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
step1Map.forEach((k, v) -> step2Map.merge(k, v, Double::sum));
|
||||
|
||||
List<Map.Entry<Long, Double>> entryList = new ArrayList<>(step2Map.entrySet());
|
||||
entryList.sort((entry1, entry2) -> Double.compare(entry2.getValue(), entry1.getValue()));
|
||||
|
||||
return entryList.stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 开源竞赛评审专家推荐
|
||||
* 1、先查找开放竞赛状态未结束,并且已提交评审的数据,新增存储到数据表中
|
||||
* 2、技术匹配度:系统中专家领域 与 竞赛是一样的领域 ; 20%
|
||||
* 3、根据1中竞赛标题和竞赛描述 与专家简介进行比较 ,匹配结果分数,取前10;30%
|
||||
* 4、根据1中竞赛标题和竞赛描述 与已完成的竞赛标题与竞赛描述比较,匹配结果分数,取前3 ,前3个竞赛中对应的专家;*50%
|
||||
*/
|
||||
public Object competitionExpertTalentReferral(Long competitionId) {
|
||||
TaskVo task = talentReferralMapper.selectCompetitionById(competitionId);
|
||||
List<KeyValueVo> categories = new ArrayList<>();
|
||||
List<TaskVo> completedTasks = talentReferralMapper.selectCompetitionIdByStatus();
|
||||
List<ExpertVo> allExperts = talentReferralMapper.selectExpertsBy(new ExpertVo());
|
||||
|
||||
List<Long> expertIds = doCompetitionExpertTalentReferral(task, categories, completedTasks, allExperts);
|
||||
return expertIds.stream().map(s -> allExperts.stream().filter(e -> e.getId().equals(s)).findFirst().orElse(null)).filter(Objects::nonNull).limit(3).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
private List<Long> doCompetitionExpertTalentReferral(TaskVo task, List<KeyValueVo> categories, List<TaskVo> completedTasks, List<ExpertVo> allExperts) {
|
||||
|
||||
Map<Long, Double> step1Map = new TreeMap<>();
|
||||
Map<Long, Double> step2Map = new TreeMap<>();
|
||||
|
||||
|
||||
List<KeyValVo<Long, String>> allTaskWithExpertIds = talentReferralMapper.allTaskWithExpertIds("2");
|
||||
Map<Long, String> t2e = allTaskWithExpertIds.stream().collect(Collectors.toMap(KeyValVo::getK, KeyValVo::getV, (o, n) -> n));
|
||||
for (TaskVo t2 : completedTasks) {
|
||||
double subjectFraction = SimilarityService.sentence(task.getName(), t2.getName());
|
||||
double descFraction = SimilarityService.text(t2.getDescription(), task.getDescription());
|
||||
|
||||
String[] split = t2e.getOrDefault(t2.getId(), "").split(",");
|
||||
for (String s : split) {
|
||||
if (StringUtils.isNotBlank(s)) {
|
||||
step2Map.put(Long.parseLong(s), (subjectFraction + descFraction) * 100.0D);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
step1Map.forEach((k, v) -> step2Map.merge(k, v, Double::sum));
|
||||
|
||||
List<Map.Entry<Long, Double>> entryList = new ArrayList<>(step2Map.entrySet());
|
||||
entryList.sort((entry1, entry2) -> Double.compare(entry2.getValue(), entry1.getValue()));
|
||||
|
||||
return entryList.stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
package com.microservices.dms.referral.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExpertVo {
|
||||
Long id;
|
||||
Long userId;
|
||||
String expertName;
|
||||
String nickname;
|
||||
String reviewAreaOne;
|
||||
String reviewAreaTwo;
|
||||
String reviewAreaThree;
|
||||
Integer status;
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
package com.microservices.dms.referral.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PrInfoVo {
|
||||
private Long id;
|
||||
private String title;
|
||||
private String content;
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package com.microservices.dms.referral.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TaskVo {
|
||||
private Long id;
|
||||
private Long taskId;
|
||||
private String name;
|
||||
private String description;
|
||||
private Long categoryId;
|
||||
private String identifier;
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ public class CollectUserActDataController {
|
|||
|
||||
@PostMapping("/addClicker")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "clickType", value = "点击类型(任务:makerSpaceTask、竞赛:CompetitionInfo、项目:Project、成果:Achievements、专家:Experts,校企:schoolEnterprise,成果用户对接:userDocking)", paramType = "query", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "clickType", value = "点击类型(任务:makerSpaceTask、竞赛:CompetitionInfo、项目:Project、成果:Achievements、专家:Experts,校企:schoolEnterprise)", paramType = "query", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name = "clickId", value = "点击对象ID", paramType = "query", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", paramType = "query", dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "extInfo", value = "补充信息", paramType = "query", dataTypeClass = String.class)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class CompetitionResourceLibrary extends BaseEntity {
|
|||
*/
|
||||
private String competitionField;
|
||||
/**
|
||||
* 竞赛状态 status: 0 未上架 1上架
|
||||
* 竞赛状态 0进行中 1已结束
|
||||
*/
|
||||
private String competitionStatus;
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public interface ExpertResourceLibraryMapper
|
|||
|
||||
List<KeyValueVo> getMemoAduit();
|
||||
|
||||
List<KeyValueVo> getIsOriginalStatistic();
|
||||
KeyValueVo getIsOriginalStatistic();
|
||||
|
||||
List<KeyValueVo> getMemoTotalByYear();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.microservices.dms.resourceLibrary.mapper;
|
||||
|
||||
import com.microservices.common.datasource.annotation.Slave;
|
||||
import com.microservices.dms.achievementLibrary.domain.TokenListVo;
|
||||
import com.microservices.dms.resourceLibrary.domain.ProjectResourceLibrary;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.KeyValVo;
|
||||
import com.microservices.dms.resourceLibrary.domain.vo.ProjectListVo;
|
||||
|
|
@ -52,8 +51,4 @@ public interface ProjectResourceLibraryMapper {
|
|||
List<KeyValVo<String,String>> getAttachments(@Param("containerId") Long containerId);
|
||||
|
||||
String getProjectDomainNameByKey(@Param("projectDomain") String projectDomain );
|
||||
|
||||
List<TokenListVo> selectProjectInfos();
|
||||
|
||||
Long sumProjectIssueToken(@Param("id") Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,6 +108,4 @@ public interface TaskResourceLibraryMapper {
|
|||
int delFavorite(Favorite favorite);
|
||||
|
||||
int delWatcher(Watcher watcher);
|
||||
|
||||
double getConvertedTaskAmount2();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class ProjectResourceLibraryService {
|
|||
if (v.startsWith("http")) {
|
||||
String urlPath = getUrlPath(v);
|
||||
if (StringUtils.isNotEmpty(urlPath)) {
|
||||
if (urlPath.startsWith("/api")) {
|
||||
if (urlPath.startsWith("/")) {
|
||||
a.setV(gitLinkUrl + urlPath);
|
||||
}else {
|
||||
a.setV(gitLinkUrl +"/api"+ urlPath);
|
||||
|
|
|
|||
|
|
@ -122,8 +122,6 @@ public class TaskResourceLibraryService {
|
|||
|
||||
|
||||
public int updateTaskResourceLibrary(TaskResourceLibrary taskResourceLibrary) {
|
||||
taskResourceLibrary.setUpdateTime(DateUtils.getNowDate());
|
||||
taskResourceLibrary.setUpdateBy(SecurityUtils.getUsername());
|
||||
return taskResourceLibraryMapper.updateTaskResourceLibrary(taskResourceLibrary);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,20 +42,6 @@ public class DateUtil {
|
|||
};
|
||||
}
|
||||
|
||||
public static Date[] getLast12Months() {
|
||||
LocalDate endDate = LocalDate.now();
|
||||
|
||||
LocalDate startDate = endDate.minusMonths(11);
|
||||
|
||||
LocalDateTime startDateTime = LocalDateTime.of(startDate.getYear(),startDate.getMonth(),1,0,0,0);
|
||||
LocalDateTime endDateTime = endDate.atTime(23, 59, 59);
|
||||
|
||||
return new Date[]{
|
||||
Date.from(startDateTime.atZone(ZoneId.systemDefault()).toInstant()),
|
||||
Date.from(endDateTime.atZone(ZoneId.systemDefault()).toInstant())
|
||||
};
|
||||
}
|
||||
|
||||
public static Date[] getCurrentYearEndOf(LocalDate endDate) {
|
||||
Year year = Year.now();
|
||||
|
||||
|
|
@ -82,19 +68,6 @@ public class DateUtil {
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public static List<String> getDateStrYYYYMM(Date start, Date end) {
|
||||
LocalDate s = start.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().toLocalDate();
|
||||
LocalDate e = end.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().toLocalDate();
|
||||
String pattern = "yyyy-MM";
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
|
||||
|
||||
return LongStream.range(0, s.until(e).getMonths() + 1)
|
||||
.mapToObj(s::plusMonths)
|
||||
.map(formatter::format)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<String> getDateStrYYYYMMDD(Date start, Date end) {
|
||||
LocalDate s = start.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().toLocalDate();
|
||||
LocalDate e = end.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().toLocalDate();
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class DmsRequestHelper extends GitLinkRequestHelper {
|
|||
int pageNum = 1;
|
||||
// 循环分页获取gitlink组织下所有成员
|
||||
while (!isAllData) {
|
||||
JSONObject result = doGet(GET_LIST_BY_PAGES(url, pageNum, 50)
|
||||
JSONObject result = doGet(GitLinkRequestUrl.GET_LIST_BY_PAGES(url, pageNum, 50)
|
||||
);
|
||||
allList.addAll(result.getList(listKey, tClass));
|
||||
long total = result.getLong("search_count");
|
||||
|
|
@ -84,7 +84,7 @@ public class DmsRequestHelper extends GitLinkRequestHelper {
|
|||
|
||||
|
||||
public static GitLinkRequestUrl GET_LIST_BY_PAGES(String url, Integer page, Integer limit) {
|
||||
String p = url.contains("?")? "%s&page=%s&limit=%s": "%s?page=%s&limit=%s";
|
||||
String p = url.contains("?")? "&page=%d&limit=%d": "%s?page=%d&limit=%d";
|
||||
return getAdminGitLinkRequestUrl(String.format(p, url, page, limit));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,108 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.microservices.dms.achievementLibrary.mapper.AchievementDictDataMapper">
|
||||
|
||||
<resultMap type="AchievementDictData" id="AchievementDictDataResult">
|
||||
<result property="dictCode" column="dict_code" />
|
||||
<result property="dictSort" column="dict_sort" />
|
||||
<result property="dictLabel" column="dict_label" />
|
||||
<result property="dictValue" column="dict_value" />
|
||||
<result property="dictType" column="dict_type" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAchievementDictDataVo">
|
||||
select dict_code, dict_sort, dict_label, dict_value, dict_type, status, create_by, create_time, update_by, update_time, remark from achievement_dict_data
|
||||
</sql>
|
||||
|
||||
<select id="selectAchievementDictDataList" parameterType="AchievementDictData" resultMap="AchievementDictDataResult">
|
||||
<include refid="selectAchievementDictDataVo"/>
|
||||
<where>
|
||||
<if test="dictSort != null "> and dict_sort = #{dictSort}</if>
|
||||
<if test="dictLabel != null and dictLabel != ''"> and dict_label = #{dictLabel}</if>
|
||||
<if test="dictValue != null and dictValue != ''"> and dict_value = #{dictValue}</if>
|
||||
<if test="dictType != null and dictType != ''"> and dict_type = #{dictType}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectAchievementDictDataByDictCode" parameterType="Long" resultMap="AchievementDictDataResult">
|
||||
<include refid="selectAchievementDictDataVo"/>
|
||||
where dict_code = #{dictCode}
|
||||
</select>
|
||||
|
||||
<insert id="insertAchievementDictData" parameterType="AchievementDictData" useGeneratedKeys="true" keyProperty="dictCode">
|
||||
insert into achievement_dict_data
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dictSort != null">dict_sort,</if>
|
||||
<if test="dictLabel != null">dict_label,</if>
|
||||
<if test="dictValue != null">dict_value,</if>
|
||||
<if test="dictType != null">dict_type,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dictSort != null">#{dictSort},</if>
|
||||
<if test="dictLabel != null">#{dictLabel},</if>
|
||||
<if test="dictValue != null">#{dictValue},</if>
|
||||
<if test="dictType != null">#{dictType},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateAchievementDictData" parameterType="AchievementDictData">
|
||||
update achievement_dict_data
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dictSort != null">dict_sort = #{dictSort},</if>
|
||||
<if test="dictLabel != null">dict_label = #{dictLabel},</if>
|
||||
<if test="dictValue != null">dict_value = #{dictValue},</if>
|
||||
<if test="dictType != null">dict_type = #{dictType},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where dict_code = #{dictCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteAchievementDictDataByDictCode" parameterType="Long">
|
||||
delete from achievement_dict_data where dict_code = #{dictCode}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAchievementDictDataByDictCodes" parameterType="String">
|
||||
delete from achievement_dict_data where dict_code in
|
||||
<foreach item="dictCode" collection="array" open="(" separator="," close=")">
|
||||
#{dictCode}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectDictDataByType" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
select dict_code as "key",dict_label as "name" from achievement_dict_data where dict_type = #{dictType}
|
||||
</select>
|
||||
|
||||
<select id="selectDictDataByLabel" resultType="int">
|
||||
select count(1) from achievement_dict_data where dict_type = #{type} and dict_label = #{label}
|
||||
</select>
|
||||
|
||||
<select id="getDictTypes" resultType="String">
|
||||
select distinct dict_type from achievement_dict_data
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -125,9 +125,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from achievement_team
|
||||
where achievement_id = #{aid}
|
||||
</delete>
|
||||
|
||||
<select id="selectAchievementTeamByAchId" resultMap="AchievementTeamResult">
|
||||
<include refid="selectAchievementTeamVo"/>
|
||||
where achievement_id = #{achId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -6,7 +6,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<resultMap type="Achievements" id="AchievementsResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="showAchievementName" column="showAchievementName" />
|
||||
<result property="achievementName" column="achievement_name" />
|
||||
<result property="field1" column="field_1" />
|
||||
<result property="field2" column="field_2" />
|
||||
|
|
@ -41,13 +40,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectAchievementsVo">
|
||||
select id, IFNULL(show_ach_name,achievement_name) as "showAchievementName", achievement_name,hot_rank, field_1, field_2, field_3, attachment_count,is_expert_audit,achievement_type, source, source_id, source_link, tags, summary, publishing_unit, address, is_featured, contact_person, contact_number, owner_id, owner_name, status, details, reviewer, review_date, review_comments, images, attachments, create_by, create_time, update_by, update_time from achievements
|
||||
select id, achievement_name,hot_rank, field_1, field_2, field_3, attachment_count,is_expert_audit,achievement_type, source, source_id, source_link, tags, summary, publishing_unit, address, is_featured, contact_person, contact_number, owner_id, owner_name, status, details, reviewer, review_date, review_comments, images, attachments, create_by, create_time, update_by, update_time from achievements
|
||||
</sql>
|
||||
|
||||
<select id="selectAchievementsList" parameterType="Achievements" resultMap="AchievementsResult">
|
||||
<include refid="selectAchievementsVo"/>
|
||||
<where>
|
||||
<if test="showAchievementName != null and showAchievementName != ''"> and show_ach_name like concat('%', #{showAchievementName}, '%')</if>
|
||||
<if test="achievementName != null and achievementName != ''"> and achievement_name like concat('%', #{achievementName}, '%')</if>
|
||||
<if test="field1 != null and field1 != ''"> and field_1 = #{field1}</if>
|
||||
<if test="field2 != null and field2 != ''"> and field_2 = #{field2}</if>
|
||||
|
|
@ -75,11 +73,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="hotRank != null and hotRank != ''"> and hot_rank = #{hotRank}</if>
|
||||
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectAchievementsById" parameterType="Long" resultType="com.microservices.dms.achievementLibrary.domain.Achievements">
|
||||
select a.id,IFNULL(a.show_ach_name,a.achievement_name) as "showAchievementName",a.achievement_name,a.hot_rank,a.field_1,a.field_2,a.field_3,a.attachment_count,a.is_expert_audit,a.achievement_type,a.source,a.source_id
|
||||
select a.id,a.achievement_name,a.hot_rank,a.field_1,a.field_2,a.field_3,a.attachment_count,a.is_expert_audit,a.achievement_type,a.source,a.source_id
|
||||
,u.login as "userLogin",IFNULL(u.nickname,owner_name) as "userNickName",ue.gender as "gender",
|
||||
a.source_link,a.tags,a.summary,a.publishing_unit,a.address,a.is_featured,a.contact_person,a.contact_number,a.owner_id,a.owner_name, a.status,a.details,
|
||||
a.reviewer,a.review_date,a.review_comments, a.images,a.attachments,a.create_by,a.create_time,a.update_by,a.update_time
|
||||
|
|
@ -100,7 +97,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="insertAchievements" parameterType="Achievements" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into achievements
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="showAchievementName != null">show_ach_name,</if>
|
||||
<if test="achievementName != null">achievement_name,</if>
|
||||
<if test="field1 != null">field_1,</if>
|
||||
<if test="field2 != null">field_2,</if>
|
||||
|
|
@ -134,7 +130,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="hotRank != null">hot_rank,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="showAchievementName != null">#{showAchievementName},</if>
|
||||
<if test="achievementName != null">#{achievementName},</if>
|
||||
<if test="field1 != null">#{field1},</if>
|
||||
<if test="field2 != null">#{field2},</if>
|
||||
|
|
@ -172,7 +167,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="updateAchievements" parameterType="Achievements">
|
||||
update achievements
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="showAchievementName != null">show_ach_name = #{showAchievementName},</if>
|
||||
<if test="achievementName != null">achievement_name = #{achievementName},</if>
|
||||
<if test="field1 != null">field_1 = #{field1},</if>
|
||||
<if test="field2 != null">field_2 = #{field2},</if>
|
||||
|
|
@ -220,7 +214,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
|
||||
<select id="getChoiceImport" resultType="com.microservices.dms.achievementLibrary.domain.Achievements">
|
||||
select id,IFNULL(show_ach_name,achievement_name) as "showAchievementName",achievement_name,images,field_1,field_2,field_3,summary,source,source_id
|
||||
select id, achievement_name,images,field_1,field_2,field_3,source,source_id
|
||||
from achievements
|
||||
where is_featured ='1'
|
||||
order by update_time desc
|
||||
|
|
@ -230,7 +224,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getTjBySources" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
select sum(1) as "value",source as "key"
|
||||
from achievements
|
||||
where status='1'
|
||||
group by source
|
||||
</select>
|
||||
|
||||
|
|
@ -256,27 +249,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="selectAchievementsByParam" parameterType="com.microservices.dms.achievementLibrary.domain.AchQueryVo" resultType="com.microservices.dms.achievementLibrary.domain.Achievements">
|
||||
<if test="source == '' or source == null">
|
||||
select a.id,IFNULL(a.show_ach_name,a.achievement_name) as "showAchievementName",a.achievement_name,a.summary,a.create_time,a.owner_name,a.tags,a.field_1,a.field_2,a.field_3,a.source,a.source_id,
|
||||
u.login as "userLogin",
|
||||
IFNULL(u.nickname,a.owner_name) as "userNickName",
|
||||
ue.gender as "gender",
|
||||
select a.id, a.achievement_name,a.summary,a.create_time,a.owner_name,a.tags,a.field_1,a.field_2,a.field_3,a.source,a.source_id,
|
||||
u.login as "userLogin",u.nickname as "userNickName",ue.gender as "gender",
|
||||
(select IFNULL(count(*), 0) from favorites where favorite_type = 'Achievements' and favorite_id = id) as watcherSum,
|
||||
(select IFNULL(count(*), 0) from watchers where watchable_type = 'Achievements' and watchable_id = id) as favoriteSum
|
||||
from achievements a
|
||||
left join users u on a.owner_name = u.login
|
||||
left join user_extensions ue on u.id = ue.user_id
|
||||
<where>
|
||||
and a.status='1'
|
||||
<if test="achievementName != null and achievementName != ''"> and a.achievement_name like concat('%', #{achievementName}, '%')</if>
|
||||
<if test="showAchievementName != null and showAchievementName != ''"> and a.show_ach_name like concat('%', #{showAchievementName}, '%')</if>
|
||||
</where>
|
||||
order by a.create_time desc
|
||||
</if>
|
||||
<if test='source=="1"'>
|
||||
select a.id,IFNULL(a.show_ach_name,a.achievement_name) as "showAchievementName", a.achievement_name, a.summary, a.create_time, a.owner_name, a.tags, a.field_1, a.field_2, a.field_3, a.source, a.source_id,
|
||||
c.name as "field1Name",u.login as "userLogin",
|
||||
IFNULL(u.nickname,a.owner_name) as "userNickName",
|
||||
ue.gender as "gender",
|
||||
select a.id, a.achievement_name, a.summary, a.create_time, a.owner_name, a.tags, a.field_1, a.field_2, a.field_3, a.source, a.source_id,
|
||||
c.name as "field1Name",u.login as "userLogin",u.nickname as "userNickName",ue.gender as "gender",
|
||||
(select IFNULL(count(*), 0) from favorites where favorite_type = 'Achievements' and favorite_id = a.id) as watcherSum,
|
||||
(select IFNULL(count(*), 0) from watchers where watchable_type = 'Achievements' and watchable_id = a.id) as favoriteSum
|
||||
from achievements a
|
||||
|
|
@ -284,9 +271,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join user_extensions ue on u.id = ue.user_id
|
||||
left join project_categories c on a.field_1 = c.id
|
||||
<where>
|
||||
and a.status='1'
|
||||
<if test="achievementName != null and achievementName != ''"> and a.achievement_name like concat('%', #{achievementName}, '%')</if>
|
||||
<if test="showAchievementName != null and showAchievementName != ''"> and a.show_ach_name like concat('%', #{showAchievementName}, '%')</if>
|
||||
<if test="source != null and source != ''"> and a.source = #{source}</if>
|
||||
<if test='areaQuery != null and areaQuery != "" '>
|
||||
and (a.field_1 = #{areaQuery} or a.field_2 = #{areaQuery} or a.field_3 = #{areaQuery})
|
||||
|
|
@ -295,10 +280,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
order by create_time desc
|
||||
</if>
|
||||
<if test='source=="2" or source=="3" or source=="4" '>
|
||||
select a.id, IFNULL(a.show_ach_name,a.achievement_name) as "showAchievementName", a.achievement_name, a.summary, a.create_time, a.owner_name, a.tags, a.field_1, a.field_2, a.field_3, a.source, a.source_id,
|
||||
c.name as "field1Name",u.login as "userLogin",
|
||||
IFNULL(u.nickname,a.owner_name) as "userNickName",
|
||||
ue.gender as "gender",
|
||||
select a.id, a.achievement_name, a.summary, a.create_time, a.owner_name, a.tags, a.field_1, a.field_2, a.field_3, a.source, a.source_id,
|
||||
c.name as "field1Name",u.login as "userLogin",u.nickname as "userNickName",ue.gender as "gender",
|
||||
(select IFNULL(count(*), 0) from favorites where favorite_type = 'Achievements' and favorite_id = a.id) as watcherSum,
|
||||
(select IFNULL(count(*), 0) from watchers where watchable_type = 'Achievements' and watchable_id = a.id) as favoriteSum
|
||||
from achievements a
|
||||
|
|
@ -306,9 +289,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join user_extensions ue on u.id = ue.user_id
|
||||
left join categories c on a.field_1 = c.id
|
||||
<where>
|
||||
and a.status='1'
|
||||
<if test="achievementName != null and achievementName != ''"> and a.achievement_name like concat('%', #{achievementName}, '%')</if>
|
||||
<if test="showAchievementName != null and showAchievementName != ''"> and a.show_ach_name like concat('%', #{showAchievementName}, '%')</if>
|
||||
<if test="source != null and source != ''"> and a.source = #{source}</if>
|
||||
<if test='areaQuery != null and areaQuery != "" '>
|
||||
and (a.field_1 = #{areaQuery} or a.field_2 = #{areaQuery} or a.field_3 = #{areaQuery})
|
||||
|
|
@ -343,21 +324,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
order by DATE_FORMAT(created_at, '%m-%d')
|
||||
</select>
|
||||
|
||||
<select id="getHotAchievement" resultType="com.microservices.dms.achievementLibrary.domain.HotAchVo">
|
||||
select t.show_ach_name as "showAchievementName",t.achievement_name as name, t.w as watcher, t.f as faviter, (t.w + t.f) as total, t.id as `id`,t.owner_name
|
||||
as userName,t.gender,t.userNickName
|
||||
<select id="getHotAchievement" resultType="java.util.Map">
|
||||
select t.achievement_name as name, t.w as watcher, t.f as faviter, (t.w + t.f) as total, t.id as `id`,t.owner_name
|
||||
as userName
|
||||
from (select a.achievement_name,
|
||||
IFNULL(a.show_ach_name,a.achievement_name) as "show_ach_name",
|
||||
a.id,a.owner_name,
|
||||
IFNULL(u.nickname,a.owner_name) as "userNickName",
|
||||
ue.gender as "gender",
|
||||
(select IFNULL(count(*), 0) from favorites where favorite_type = 'Achievements' and favorite_id = a.id) as f,
|
||||
(select IFNULL(count(*), 0) from watchers where watchable_type = 'Achievements' and watchable_id = a.id) as w
|
||||
from achievements a
|
||||
left join users u on a.owner_name = u.login
|
||||
left join user_extensions ue on u.id = ue.user_id
|
||||
where a.status = '1'
|
||||
) as t
|
||||
from achievements a) as t
|
||||
order by (f+w) desc
|
||||
limit 0,3
|
||||
</select>
|
||||
|
|
@ -375,37 +349,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="indexProjectStatistic" resultType="java.util.Map">
|
||||
select COUNT(*) as projectAchievementCount,
|
||||
IFNULL(SUM(attachment_count), 0) as attachmentCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='1' and a.status=1) as clickCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='1') as clickCount,
|
||||
(select COUNT(distinct project_id) from project_resource_library) as projectCount
|
||||
from achievements
|
||||
where source = '1' and status='1'
|
||||
where source = '1'
|
||||
</select>
|
||||
|
||||
<select id="indexTaskStatistic" resultType="java.util.Map">
|
||||
select (select count(distinct trl.task_id) from achievements a join task_resource_library trl on a.source_id = trl.id where a.source='2' and a.status=1) as taskCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='2' and a.status=1) as clickCount,
|
||||
select (select count(distinct trl.task_id) from achievements a join task_resource_library trl on a.source_id = trl.id where a.source='2') as taskCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='2') as clickCount,
|
||||
COUNT(*) as expertAuditCount
|
||||
from achievements
|
||||
where source = '2' and status=1
|
||||
where source = '2'
|
||||
</select>
|
||||
<select id="indexCompetitionStatistic" resultType="java.util.Map">
|
||||
select COUNT(*) as CompetitionCountAchievementCount,
|
||||
(select COUNT(distinct crl.open_competition_id) from achievements a join competition_resource_library crl
|
||||
on a.source_id = crl.id where source = '3' and a.is_expert_audit = 1 and a.status='1') as expertAuditCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='3' and a.status='1') as clickCount,
|
||||
(select COUNT(distinct open_competition_id) from competition_resource_library crl inner join achievements a on a.source_id=crl.id where a.status='1') as CompetitionCount
|
||||
IFNULL(SUM(is_expert_audit), 0) as expertAuditCount,
|
||||
(select count(1) from clickers c inner join achievements a ON a.id = c.click_id where click_type = 'Achievements' and a.source='3') as clickCount,
|
||||
(select COUNT(distinct open_competition_id) from competition_resource_library) as CompetitionCount
|
||||
from achievements
|
||||
where source = '3' and status='1'
|
||||
where source = '3'
|
||||
</select>
|
||||
|
||||
<select id="indexSchoolEnterpriseStatistic" resultType="java.lang.Long">
|
||||
select COUNT(*)
|
||||
from achievements a
|
||||
where source = #{s}
|
||||
and a.status = '1'
|
||||
<if test="t != null and t != ''">
|
||||
and tags = #{t}
|
||||
</if>
|
||||
and tags = #{t}
|
||||
</select>
|
||||
|
||||
<select id="getAreasByName" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
|
|
@ -436,7 +406,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
union all
|
||||
select review_area_one as "domainName" from experts
|
||||
)a
|
||||
where a.domainName is not null and a.domainName !=""
|
||||
</select>
|
||||
|
||||
<select id="getActDataStatisticById"
|
||||
|
|
@ -463,11 +432,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getWatchFavoriteStatusById" resultType="com.microservices.dms.behaviorImage.domain.AchievementBehaviorSumVo">
|
||||
select b.watchSum, d.favoriteSum,c.userDockingSum
|
||||
select b.watchSum, d.favoriteSum
|
||||
from (
|
||||
(select count(1) as watchSum from watchers where watchable_type = 'Achievements' and watchable_id = #{id} and user_id=#{userId}) b,
|
||||
(select count(1) as favoriteSum from favorites where favorite_type = 'Achievements' and favorite_id = #{id} and user_id=#{userId}) d,
|
||||
(select count(1) as userDockingSum from clickers where click_type = 'userDocking' and click_id = #{id} and user_id=#{userId}) c
|
||||
(select count(1) as favoriteSum from favorites where favorite_type = 'Achievements' and favorite_id = #{id} and user_id=#{userId}) d
|
||||
)
|
||||
</select>
|
||||
|
||||
|
|
@ -475,7 +443,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select count(*)
|
||||
from achievements
|
||||
<where>
|
||||
<if test="t != null and t != ''">and `source` = #{t}</if>
|
||||
<if test="source != null and source != ''">and `source` = #{source}</if>
|
||||
<if test="s != null">and create_time >= #{s}</if>
|
||||
<if test="e != null">and create_time <= #{e}</if>
|
||||
</where>
|
||||
|
|
@ -490,19 +458,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getAchievementType" resultType="java.util.Map">
|
||||
select achievement_type as 'k', count(*) as 'v'
|
||||
from achievements where achievement_type is not null
|
||||
from achievements
|
||||
group by achievement_type
|
||||
</select>
|
||||
|
||||
<select id="getAchievementActData" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
select * from (
|
||||
select '关注' as `key`, DATE_FORMAT(created_at, '%m-%d') as name ,COUNT(*) as value from watchers where watchable_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||
select 'w' as `key`, DATE_FORMAT(created_at, '%Y') as name ,COUNT(*) as value from watchers where watchable_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
||||
union all
|
||||
select '浏览' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from clickers where click_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||
select 'c' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from clickers where click_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
||||
union all
|
||||
select '下载' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from downloads where download_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||
select 'd' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from downloads where download_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y')
|
||||
union all
|
||||
select '收藏' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from favorites where favorite_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d'))t
|
||||
select 'f' as `key`, DATE_FORMAT(created_at, '%Y') as name,COUNT(*) as value from favorites where favorite_type = 'Achievements' group by DATE_FORMAT(created_at, '%Y'))t
|
||||
order by t.name
|
||||
</select>
|
||||
|
||||
|
|
@ -522,7 +490,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
group by field_3) a
|
||||
group by a.domain_value
|
||||
order by sum(a.countResult) desc) f
|
||||
right join categories c on c.id = f.name where f.value is not null
|
||||
right join categories c on c.id = f.name
|
||||
|
||||
</select>
|
||||
|
||||
|
|
@ -542,37 +510,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="getAreaStatistic" resultType="com.microservices.dms.achievementLibrary.domain.AreaStatisticVo">
|
||||
select
|
||||
z.name as "areaName",
|
||||
z.field_1 as "areaKey",
|
||||
z.remark as "remark",
|
||||
sum(z.kyxm) as "kyxmSum",
|
||||
sum(z.ckrw) as "ckrwSum",
|
||||
sum(z.kfjs) as "kfjsSum",
|
||||
sum(z.xqcg) as "xqcgSum"
|
||||
from (
|
||||
select r.name,
|
||||
r.field_1,
|
||||
r.remark,
|
||||
case when r.source = 1 then tmp else 0 end as "kyxm",
|
||||
case when r.source = 2 then tmp else 0 end as "ckrw",
|
||||
case when r.source = 3 then tmp else 0 end as "kfjs",
|
||||
case when r.source = 4 then tmp else 0 end as "xqcg"
|
||||
from (
|
||||
select t.name,t.source,count(1) as "tmp",t.field_1,t.remark
|
||||
from (
|
||||
select c.name,a.source, a.field_1,c.remark
|
||||
from achievements a
|
||||
left join project_categories c on a.field_1 = c.id where a.source='1'
|
||||
union all
|
||||
select c.name, a.source, a.field_1, c.remark
|
||||
from achievements a
|
||||
left join categories c on a.field_1 = c.id where a.source in ('2','3','4')
|
||||
)t
|
||||
where t.field_1 is not null and t.field_1 !=""
|
||||
group by t.name, t.source, t.field_1, t.remark
|
||||
) r
|
||||
) z
|
||||
select z.name as "areaName",
|
||||
z.field_1 as "areaKey",
|
||||
z.remark as "remark",
|
||||
sum(z.kyxm) as "kyxmSum",
|
||||
sum(z.ckrw) as "ckrwSum",
|
||||
sum(z.kfjs) as "kfjsSum",
|
||||
sum(z.xqcg) as "xqcgSum"
|
||||
from (select r.name,
|
||||
r.field_1,
|
||||
r.remark,
|
||||
case when r.source = 1 then tmp else 0 end as "kyxm",
|
||||
case when r.source = 2 then tmp else 0 end as "ckrw",
|
||||
case when r.source = 3 then tmp else 0 end as "kfjs",
|
||||
case when r.source = 4 then tmp else 0 end as "xqcg"
|
||||
from (select c.name, a.source, count(1) as "tmp", a.field_1, c.remark
|
||||
from achievements a
|
||||
inner join categories c on a.field_1 = c.id
|
||||
group by c.name, a.source, a.field_1, c.remark) r) z
|
||||
<where>
|
||||
<if test="areaKey != null and areaKey != ''">
|
||||
and z.field_1 = #{areaKey}
|
||||
|
|
@ -587,16 +542,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where project_id = (select project_id from project_resource_library where id = #{sourceId})
|
||||
</select>
|
||||
|
||||
<select id="getAllSourceIdCompetition" resultType="java.lang.Long">
|
||||
select id
|
||||
from competition_resource_library
|
||||
where open_competition_id = (select open_competition_id from competition_resource_library where id = #{sourceId})
|
||||
</select>
|
||||
<select id="getAllSourceIdTask" resultType="java.lang.Long">
|
||||
select id
|
||||
from task_resource_library
|
||||
where task_id = (select task_id from task_resource_library where id = #{sourceId})
|
||||
</select>
|
||||
<select id="getDistinctYear" resultType="String">
|
||||
select distinct DATE_FORMAT(create_time, '%Y')
|
||||
from achievements
|
||||
|
|
@ -616,7 +561,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
source as "source",
|
||||
source_id as "sourceId" ,
|
||||
achievement_name as "achRelateName",
|
||||
show_ach_name as "showAchievementName",
|
||||
#{paramYear} as resultYear
|
||||
from achievements
|
||||
where source_id in
|
||||
|
|
@ -626,36 +570,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and DATE_FORMAT(create_time, '%Y') = #{paramYear}
|
||||
order by DATE_FORMAT(create_time, '%m-%d')
|
||||
</select>
|
||||
|
||||
<select id="getRelatedAchTaskOfExpert"
|
||||
resultType="com.microservices.dms.resourceLibrary.domain.TaskResourceLibrary">
|
||||
select *
|
||||
from task_resource_library erl
|
||||
join
|
||||
(select container_id
|
||||
from task_expert
|
||||
where container_type = 1
|
||||
and `status` in (1, 2) and expert_id = #{id}
|
||||
group by container_id
|
||||
having count(*) > 0) as tmp
|
||||
on erl.task_id = tmp.container_id
|
||||
</select>
|
||||
|
||||
<select id="getRelatedAchCompetitionOfExpert"
|
||||
resultType="com.microservices.dms.resourceLibrary.domain.CompetitionResourceLibrary">
|
||||
select *
|
||||
from competition_resource_library erl
|
||||
join
|
||||
(select container_id
|
||||
from task_expert
|
||||
where container_type = 2
|
||||
and `status` in (1, 2) and expert_id = #{id}
|
||||
group by container_id
|
||||
having count(*) > 0) as tmp
|
||||
on erl.open_competition_id = tmp.container_id
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAchievementsByName" resultType="Long">
|
||||
select id
|
||||
from achievements
|
||||
|
|
@ -686,51 +600,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where a.id=#{id}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getAchievementAddYearlyData" resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
|
||||
select DATE_FORMAT(create_time, '%Y-%m') as 'k', count(*) as 'v'
|
||||
from achievements
|
||||
where create_time >= #{s}
|
||||
and create_time <= #{e}
|
||||
group by DATE_FORMAT(create_time, '%Y-%m')
|
||||
order by DATE_FORMAT(create_time, '%Y-%m')
|
||||
</select>
|
||||
|
||||
<select id="getAchievementActDataW"
|
||||
resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
select '关注' as `key`, DATE_FORMAT(created_at, '%m-%d') as name ,COUNT(*) as value from watchers where watchable_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||
</select>
|
||||
<select id="getAchievementActDataC"
|
||||
resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
select '浏览' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from clickers where click_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||
|
||||
</select>
|
||||
<select id="getAchievementActDataD"
|
||||
resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
select '下载' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from downloads where download_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getAchievementActDataF"
|
||||
resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
select '收藏' as `key`, DATE_FORMAT(created_at, '%m-%d') as name,COUNT(*) as value from favorites where favorite_type = 'Achievements' and created_at >= #{s} and created_at <= #{e} group by DATE_FORMAT(created_at, '%m-%d')
|
||||
</select>
|
||||
|
||||
<select id="getDockingUserInfo" resultType="java.util.Map">
|
||||
select * from (
|
||||
select u.id,u.login,u.nickname,p.name as "lastname,",u.phone,u.company_name,u.mail,p.card as "idNumber",e.entity_type,DATE_FORMAT(c.created_at,'%Y-%m-%d %H:%i:%s') as created_at
|
||||
from users u
|
||||
inner join entities e on u.id = e.user_id
|
||||
inner join personalities p on e.id = p.entity_id
|
||||
inner join (select created_at, user_id from clickers where click_id = #{id} and click_type ='userDocking' order by created_at desc limit 1) c on u.id = c.user_id
|
||||
where u.authentication='1'
|
||||
union all
|
||||
select u.id,u.login,u.nickname,u.lastname,u.phone,en.name as "company_name",u.mail,en.credit_code as "idNumber",e.entity_type,DATE_FORMAT(c.created_at,'%Y-%m-%d %H:%i:%s') as created_at
|
||||
from users u
|
||||
inner join entities e on u.id = e.user_id
|
||||
inner join enterprises en on e.id = en.entity_id
|
||||
inner join (select created_at,user_id from clickers where click_id = #{id} and click_type ='userDocking' order by created_at desc limit 1) c on u.id = c.user_id
|
||||
where u.enterprise_certification='1') t
|
||||
order by t.created_at
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -139,41 +139,21 @@
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectActivityUserLibraryListAll" resultType="com.microservices.dms.behaviorImage.domain.ActivityUserLibrary">
|
||||
select res.userId,res.loginName,res.userName,res.isExpert,res.isAuth,res.relatedCompetition,res.relatedTask,res.p1+res.p2+res.p3 as "relatedProject" from (
|
||||
select u.id as "userId",u.login as "loginName",u.nickname as "userName",u.is_expert as "isExpert",u.authentication as "isAuth",
|
||||
(select count(1) as "value" from tasks where is_delete='0' and status between 3 and 8 and user_id =u.id) as "relatedTask",
|
||||
(select count(1) from competition_infos ci inner join competition_users cu on ci.id = cu.competition_info_id where cu.user_id =u.id) as "relatedCompetition",
|
||||
(SELECT count(1) as "pCount" FROM `projects` WHERE id != 0 AND user_id =u.id) as p1,
|
||||
( SELECT count(1) as "pCount"
|
||||
FROM `projects`
|
||||
INNER JOIN `members` ON `members`.`project_id` = `projects`.`id`
|
||||
WHERE `projects`.`id` != 0 AND `projects`.`user_id` !=u.id AND `members`.`user_id` =u.id) as p2,
|
||||
(SELECT count(1) as "pCount"
|
||||
FROM `projects`
|
||||
INNER JOIN `team_projects` ON `team_projects`.`project_id` = `projects`.`id`
|
||||
INNER JOIN `teams` ON `teams`.`id` = `team_projects`.`team_id`
|
||||
INNER JOIN `team_users` ON `team_users`.`team_id` = `teams`.`id`
|
||||
WHERE `projects`.`id` != 0 AND `team_users`.`user_id` =u.id) as p3
|
||||
from users u) res
|
||||
where res.relatedCompetition >0 or res.relatedTask >0 or res.p1+res.p2+res.p3>0
|
||||
</select>
|
||||
|
||||
<select id="getrelatedProjectCount" resultType="long">
|
||||
select sum(r.pCount) from (
|
||||
SELECT count(1) as "pCount" FROM `projects` WHERE id != 0 AND user_id = #{userId}
|
||||
SELECT count(1) as "pCount" FROM `projects` WHERE id != 0 AND user_id = 1
|
||||
union all
|
||||
SELECT count(1) as "pCount"
|
||||
FROM `projects`
|
||||
INNER JOIN `members` ON `members`.`project_id` = `projects`.`id`
|
||||
WHERE `projects`.`id` != 0 AND `projects`.`user_id` != #{userId} AND `members`.`user_id` = #{userId}
|
||||
WHERE `projects`.`id` != 0 AND `projects`.`user_id` != 1 AND `members`.`user_id` = 1
|
||||
union all
|
||||
SELECT count(1) as "pCount"
|
||||
FROM `projects`
|
||||
INNER JOIN `team_projects` ON `team_projects`.`project_id` = `projects`.`id`
|
||||
INNER JOIN `teams` ON `teams`.`id` = `team_projects`.`team_id`
|
||||
INNER JOIN `team_users` ON `team_users`.`team_id` = `teams`.`id`
|
||||
WHERE `projects`.`id` != 0 AND `team_users`.`user_id` = #{userId}
|
||||
WHERE `projects`.`id` != 0 AND `team_users`.`user_id` = 1
|
||||
)r
|
||||
</select>
|
||||
|
||||
|
|
@ -306,32 +286,13 @@
|
|||
)t group by t.resultType
|
||||
</select>
|
||||
|
||||
<select id="getActivityStatistic" resultType="com.microservices.dms.behaviorImage.domain.ActivityUserTotal">
|
||||
select count(1) as "totalUser",sum(r.isExpert) as "totalExpert",sum(r.enterprise_certification+r.authentication) as "authTotal" from (
|
||||
select res.userId,res.loginName,res.userName,res.isExpert,res.authentication,res.enterprise_certification,res.relatedCompetition,res.relatedTask,res.p1+res.p2+res.p3 as "relatedProject" from (
|
||||
select u.id as "userId",u.login as "loginName",u.nickname as "userName",u.is_expert as "isExpert",u.authentication,u.enterprise_certification,
|
||||
(select count(1) as "value" from tasks where is_delete='0' and status between 3 and 8 and user_id =u.id) as "relatedTask",
|
||||
(select count(1) from competition_infos ci inner join competition_users cu on ci.id = cu.competition_info_id where cu.user_id =u.id) as "relatedCompetition",
|
||||
(SELECT count(1) as "pCount" FROM `projects` WHERE id != 0 AND user_id =u.id) as p1,
|
||||
( SELECT count(1) as "pCount"
|
||||
FROM `projects` INNER JOIN `members` ON `members`.`project_id` = `projects`.`id`
|
||||
WHERE `projects`.`id` != 0 AND `projects`.`user_id` !=u.id AND `members`.`user_id` =u.id) as p2,
|
||||
(SELECT count(1) as "pCount"
|
||||
FROM `projects`
|
||||
INNER JOIN `team_projects` ON `team_projects`.`project_id` = `projects`.`id`
|
||||
INNER JOIN `teams` ON `teams`.`id` = `team_projects`.`team_id`
|
||||
INNER JOIN `team_users` ON `team_users`.`team_id` = `teams`.`id`
|
||||
WHERE `projects`.`id` != 0 AND `team_users`.`user_id` =u.id) as p3
|
||||
from users u) res
|
||||
where res.relatedCompetition >0 or res.relatedTask >0 or res.p1+res.p2+res.p3>0 )r
|
||||
</select>
|
||||
|
||||
<select id="getUserBehaviorSum" resultType="com.microservices.dms.behaviorImage.domain.UserTypeTotalVo">
|
||||
select
|
||||
(select count(1) as "resultCount" from watchers where user_id = u.id ) as "watchSum",
|
||||
(select count(1) as "resultCount" from favorites where user_id = u.id ) as "favoriteSum",
|
||||
(select count(1) as "resultCount" from praise_treads where user_id = u.id ) as "praiseSum"
|
||||
from users u
|
||||
where u.id = #{userId}
|
||||
<select id="getActivityStatistic" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
select 'totalUser' as `key`, count(1) as " value" from users
|
||||
union all
|
||||
select'authTotal' as `key`,sum(u.authentication) as "value" from users u
|
||||
union all
|
||||
select 'totalexpert' as `key`, count(1) as " value"from users u
|
||||
inner join experts e on u.id = e.user_id
|
||||
where e.is_delete='0' and e.status = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -284,21 +284,21 @@
|
|||
|
||||
<select id="getCompetitionYearlyPaperAdd"
|
||||
resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
|
||||
select DATE_FORMAT(created_at, '%Y-%m') as 'k', count(*) as 'v'
|
||||
select DATE_FORMAT(created_at, '%m-%d') as 'k', count(*) as 'v'
|
||||
from competition_infos
|
||||
where created_at >= #{s}
|
||||
and created_at <= #{e}
|
||||
group by DATE_FORMAT(created_at, '%Y-%m')
|
||||
order by DATE_FORMAT(created_at, '%Y-%m')
|
||||
group by DATE_FORMAT(created_at, '%m-%d')
|
||||
order by DATE_FORMAT(created_at, '%m-%d')
|
||||
</select>
|
||||
<select id="getCompetitionYearlyFinish"
|
||||
resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
|
||||
select DATE_FORMAT(upload_date, '%Y-%m') as 'k', count(*) as 'v'
|
||||
select DATE_FORMAT(upload_date, '%m-%d') as 'k', count(*) as 'v'
|
||||
from competition_infos
|
||||
where upload_date >= #{s}
|
||||
and upload_date <= #{e}
|
||||
group by DATE_FORMAT(upload_date, '%Y-%m')
|
||||
order by DATE_FORMAT(upload_date, '%Y-%m')
|
||||
group by DATE_FORMAT(upload_date, '%m-%d')
|
||||
order by DATE_FORMAT(upload_date, '%m-%d')
|
||||
</select>
|
||||
|
||||
<insert id="insertCompetitionResourceLibrary" parameterType="CompetitionResourceLibrary" useGeneratedKeys="true"
|
||||
|
|
|
|||
|
|
@ -72,15 +72,15 @@
|
|||
<select id="selectExpertResourceLibraryList" parameterType="ExpertResourceLibrary"
|
||||
resultType="com.microservices.dms.resourceLibrary.domain.ExpertResourceLibrary">
|
||||
select * from ( select erl.id, e.id as expert_id,e.user_id, e.expert_name, e.highest_degree, e.graduated_from,
|
||||
u.nickname as "userNickName", IFNULL(erl.gender, ue.gender) as "gender",
|
||||
u.nickname as "userNickName",ue.gender as "gender",
|
||||
e.id_number,images, attachments,
|
||||
e.major, e.workplace, e.phone,
|
||||
e.workplace_type, e.expert_email, erl.expert_summary, erl.expert_detail, e.professional_title, e.expert_type,
|
||||
expert_domain,u.authentication as expertAuth,
|
||||
e.title_rank, erl.status, e.review_area_one, e.review_area_two, e.review_area_three, e.is_delete, erl.create_by,
|
||||
erl.create_time,
|
||||
(select COUNT(distinct container_id) from task_expert where expert_id = e.id and container_type = 1 and `status` in (1,2)) as taskAuditCount,
|
||||
(select COUNT(distinct container_id) from task_expert where expert_id = e.id and container_type = 2 and `status` in (1,2)) as competitionAuditCount,
|
||||
(select COUNT(*) from task_expert where expert_id = e.id and container_type = 1 and `status` in (1,2)) as taskAuditCount,
|
||||
(select COUNT(*) from task_expert where expert_id = e.id and container_type = 2 and `status` in (1,2)) as competitionAuditCount,
|
||||
erl.update_by, erl.update_time,erl.sort_no
|
||||
from experts e
|
||||
inner join users u on e.user_id = u.id
|
||||
|
|
@ -121,7 +121,7 @@
|
|||
<select id="selectExpertResourceLibraryList2" parameterType="ExpertResourceLibrary"
|
||||
resultMap="ExpertResourceLibraryResult">
|
||||
select erl.id, e.id as expert_id,e.user_id, e.expert_name, e.highest_degree, e.graduated_from, e.id_number,
|
||||
e.major, e.workplace, e.phone,u.nickname as "userNickName", IFNULL(erl.gender, ue.gender) as "gender",
|
||||
e.major, e.workplace, e.phone,
|
||||
e.workplace_type, e.expert_email, erl.expert_summary, erl.expert_detail, e.professional_title, e.expert_type,
|
||||
expert_domain,images, attachments,
|
||||
e.title_rank, erl.status, e.review_area_one, e.review_area_two, e.review_area_three, e.is_delete, erl.create_by,
|
||||
|
|
@ -131,10 +131,7 @@
|
|||
(select count(*) as watchSum from watchers where watchable_type = 'Experts' and watchable_id = erl.id) as watcherSum,
|
||||
(select count(*) as favoriteSum from favorites where favorite_type = 'Experts' and favorite_id = erl.id) as favoriteSum,
|
||||
erl.update_by, erl.update_time,erl.sort_no
|
||||
from expert_resource_library erl
|
||||
left join experts e on e.id = erl.expert_id
|
||||
left join users u on e.user_id = u.id
|
||||
left join user_extensions ue on u.id = ue.user_id
|
||||
from expert_resource_library erl left join experts e on e.id = erl.expert_id
|
||||
<where>
|
||||
<if test="userId != null ">and user_id = #{userId}</if>
|
||||
<if test="expertName != null and expertName != ''">and erl.expert_name like concat('%', #{expertName}, '%')
|
||||
|
|
@ -182,15 +179,15 @@
|
|||
|
||||
<select id="competitionAuditCount" resultType="java.lang.Long">
|
||||
select IFNULL(SUM(competitionAuditCount), 0)
|
||||
from (select COUNT(distinct container_id) as competitionAuditCount
|
||||
from task_expert te
|
||||
join experts e on e.id = te.expert_id and te.container_type = 2 and te.`status` in (1, 2)) tmp
|
||||
from (select (select COUNT(distinct container_id)
|
||||
from task_expert
|
||||
where expert_id = e.id and container_type = 2 and `status` in (1,2)) as competitionAuditCount
|
||||
from experts e) tmp
|
||||
</select>
|
||||
<select id="taskAuditCount" resultType="java.lang.Long">
|
||||
select IFNULL(SUM(taskAuditCount), 0)
|
||||
from (select COUNT(distinct container_id) as taskAuditCount
|
||||
from task_expert te
|
||||
join experts e on e.id = te.expert_id and te.container_type = 1 and te.`status` in (1, 2)) tmp
|
||||
from (select (select COUNT(distinct container_id) from task_expert where expert_id = e.id and container_type = 1 and `status` in (1,2)) as taskAuditCount
|
||||
from experts e) tmp
|
||||
</select>
|
||||
<select id="auditCompetitionAuditExpertCount" resultType="java.lang.Long">
|
||||
select count(*)
|
||||
|
|
@ -370,12 +367,12 @@
|
|||
select b.expertTotal as "total", d.expertAuth as "value"
|
||||
from (
|
||||
(select count(1) as "expertTotal" from experts where is_delete = '0' and status = 1) b,
|
||||
(select count(1) as "expertAuth"
|
||||
from experts e
|
||||
inner join users u on e.user_id = u.id
|
||||
where e.is_delete = '0'
|
||||
and e.status = 1
|
||||
and (u.authentication = true or u.enterprise_certification='1')) d
|
||||
(select count(1) as "expertAuth"
|
||||
from experts e
|
||||
inner join users u on e.user_id = u.id
|
||||
where e.is_delete = '0'
|
||||
and e.status = 1
|
||||
and u.authentication = true) d
|
||||
)
|
||||
</select>
|
||||
|
||||
|
|
@ -418,8 +415,6 @@
|
|||
and review_area_three is not null
|
||||
and review_area_three != '') a
|
||||
group by a.domain_value
|
||||
order by count(a.domain_value) desc
|
||||
limit 0,9
|
||||
</select>
|
||||
|
||||
<select id="getExpertAduit" resultType="com.microservices.dms.achievementLibrary.domain.ExpertTotallVo">
|
||||
|
|
@ -429,13 +424,17 @@
|
|||
(tmp.taskAuditCount + tmp.competitionAuditCount) as "total"
|
||||
from (select e.expert_name,
|
||||
(select COUNT(distinct container_id) from task_expert where expert_id = e.id and container_type = 1 and `status` in (1,2)) as taskAuditCount,
|
||||
(select COUNT(distinct container_id) from task_expert where expert_id = e.id and container_type = 2 and `status` in (1,2)) as competitionAuditCount
|
||||
(select COUNT(distinct container_id)
|
||||
from task_expert
|
||||
where expert_id = e.id
|
||||
and container_type = 2 and `status` in (1,2)) as competitionAuditCount
|
||||
from experts e
|
||||
left join users u on e.user_id = u.id
|
||||
inner join users u on e.user_id = u.id
|
||||
left join expert_resource_library erl on e.id = erl.user_id
|
||||
where e.is_delete = '0'
|
||||
and e.status = 1) tmp
|
||||
order by (tmp.taskAuditCount + tmp.competitionAuditCount) desc
|
||||
limit 0,12
|
||||
order by (tmp.taskAuditCount + tmp.competitionAuditCount) desc
|
||||
limit 0,9
|
||||
</select>
|
||||
|
||||
|
||||
|
|
@ -452,11 +451,10 @@
|
|||
</select>
|
||||
|
||||
<select id="getWatchFavoriteStatusById" resultType="com.microservices.dms.behaviorImage.domain.AchievementBehaviorSumVo">
|
||||
select b.watchSum, d.favoriteSum,c.userDockingSum
|
||||
select b.watchSum, d.favoriteSum
|
||||
from (
|
||||
(select count(1) as watchSum from watchers where watchable_type = 'Experts' and watchable_id = #{id} and user_id=#{userId}) b,
|
||||
(select count(1) as favoriteSum from favorites where favorite_type = 'Experts' and favorite_id = #{id} and user_id=#{userId}) d,
|
||||
(select count(1) as userDockingSum from clickers where click_type = 'userDocking' and click_id = #{id} and user_id=#{userId}) c
|
||||
(select count(1) as favoriteSum from favorites where favorite_type = 'Experts' and favorite_id = #{id} and user_id=#{userId}) d
|
||||
)
|
||||
</select>
|
||||
|
||||
|
|
@ -496,15 +494,14 @@
|
|||
|
||||
<select id="getForumSectionStatistic" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||
select a.ancestry as "key", fs.title as "name", a.tmp as "value"
|
||||
from (
|
||||
select IFNULL(f.ancestry, m.forum_section_id) as"ancestry",count(1) as "tmp" from memos m
|
||||
inner join forum_sections f on m.forum_section_id = f.id
|
||||
where m.destroy_status is null
|
||||
and m.hidden = 0
|
||||
and m.published_at is not null
|
||||
group by IFNULL(f.ancestry, m.forum_section_id)
|
||||
) a
|
||||
left join forum_sections fs on fs.id = a.ancestry
|
||||
from (select f.ancestry, count(1) as "tmp"
|
||||
from memos m
|
||||
left join forum_sections f on m.forum_section_id = f.id
|
||||
where m.destroy_status is null
|
||||
and m.hidden = 0
|
||||
and m.published_at is not null
|
||||
group by f.ancestry) a
|
||||
left join forum_sections fs on fs.id = a.ancestry
|
||||
ORDER BY a.ancestry DESC
|
||||
</select>
|
||||
|
||||
|
|
@ -527,13 +524,13 @@
|
|||
</select>
|
||||
|
||||
<select id="get7DayPaise" resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
|
||||
select DATE_FORMAT(created_at, '%m-%d') as 'k', count(*) as 'v'
|
||||
select DATE_FORMAT(created_at, '%Y-%m-%d') as 'k', count(*) as 'v'
|
||||
from praise_treads
|
||||
where praise_tread_object_type='Memo'
|
||||
and created_at >= #{s}
|
||||
and created_at <= #{e}
|
||||
group by DATE_FORMAT(created_at, '%m-%d')
|
||||
order by DATE_FORMAT(created_at, '%m-%d')
|
||||
group by DATE_FORMAT(created_at, '%Y-%m-%d')
|
||||
order by DATE_FORMAT(created_at, '%Y-%m-%d')
|
||||
</select>
|
||||
|
||||
<select id="getExpertInfoById" resultType="com.microservices.dms.resourceLibrary.domain.vo.ExpertAttachmentVo">
|
||||
|
|
|
|||
|
|
@ -369,16 +369,4 @@
|
|||
select name from project_categories where id=#{projectDomain}
|
||||
</select>
|
||||
|
||||
<select id="selectProjectInfos" resultType="com.microservices.dms.achievementLibrary.domain.TokenListVo">
|
||||
select p.id ,p.name ,created_on, r.identifier repositoryName, r.id as repositoryId from projects p
|
||||
join repositories r on p.id = r.project_id where p.use_blockchain = 1
|
||||
</select>
|
||||
|
||||
<select id="sumProjectIssueToken" resultType="java.lang.Long">
|
||||
select IFNULL(sum(i.blockchain_token_num),0)
|
||||
from issues i
|
||||
inner join projects p on i.project_id = p.id
|
||||
where p.id=#{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -35,17 +35,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="achievementStatus" column="achievement_status" />
|
||||
<result property="achievementLittleType" column="achievement_little_type" />
|
||||
<result property="achievementCurStatus" column="achievement_cur_status" />
|
||||
<result property="teamName" column="team_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSchoolEnterpriseAchievementsVo">
|
||||
select id, achievement_name, achievement_status,field_1, field_2, field_3,
|
||||
achievement_type, source, source_id, source_link, tags, summary, publishing_unit,
|
||||
address, is_featured, contact_person, contact_number, owner_id, owner_name, status, achievement_little_type,
|
||||
details, reviewer, review_date, review_comments, images, attachments, create_by, create_time, achievement_cur_status,team_name,
|
||||
update_by, update_time from school_enterprise_achievements
|
||||
select id, achievement_name, achievement_status,field_1, field_2, field_3, achievement_type, source, source_id, source_link, tags, summary, publishing_unit, address, is_featured, contact_person, contact_number, owner_id, owner_name, status, details, reviewer, review_date, review_comments, images, attachments, create_by, create_time, update_by, update_time from school_enterprise_achievements
|
||||
</sql>
|
||||
|
||||
<select id="selectSchoolEnterpriseAchievementsList" parameterType="SchoolEnterpriseAchievements" resultMap="SchoolEnterpriseAchievementsResult">
|
||||
|
|
@ -77,9 +70,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="images != null and images != ''"> and images = #{images}</if>
|
||||
<if test="attachments != null and attachments != ''"> and attachments = #{attachments}</if>
|
||||
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
|
||||
<if test="achievementCurStatus != null and achievementCurStatus != ''"> and achievement_cur_status = #{achievementCurStatus}</if>
|
||||
<if test="achievementLittleType != null and achievementLittleType != ''"> and achievement_little_type = #{achievementLittleType}</if>
|
||||
<if test="teamName != null and teamName != ''"> and team_name = #{teamName}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
@ -115,9 +105,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="reviewComments != null and reviewComments != ''"> and review_comments = #{reviewComments}</if>
|
||||
<if test="images != null and images != ''"> and images = #{images}</if>
|
||||
<if test="attachments != null and attachments != ''"> and attachments = #{attachments}</if>
|
||||
<if test="achievementCurStatus != null and achievementCurStatus != ''"> and achievement_cur_status = #{achievementCurStatus}</if>
|
||||
<if test="achievementLittleType != null and achievementLittleType != ''"> and achievement_little_type = #{achievementLittleType}</if>
|
||||
<if test="teamName != null and teamName != ''"> and team_name = #{teamName}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
@ -153,9 +140,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="achievementStatus != null">achievement_status,</if>
|
||||
<if test="achievementCurStatus != null">achievement_cur_status,</if>
|
||||
<if test="achievementLittleType != null">achievement_little_type,</if>
|
||||
<if test="teamName != null">team_name,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="achievementName != null">#{achievementName},</if>
|
||||
|
|
@ -187,9 +171,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="achievementStatus != null">#{achievementStatus},</if>
|
||||
<if test="achievementCurStatus != null">#{achievementCurStatus},</if>
|
||||
<if test="achievementLittleType != null">#{achievementLittleType},</if>
|
||||
<if test="teamName != null">#{teamName},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -225,9 +206,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="achievementStatus != null">achievement_status = #{achievementStatus},</if>
|
||||
<if test="achievementCurStatus != null">achievement_cur_status = #{achievementCurStatus},</if>
|
||||
<if test="achievementLittleType != null">achievement_little_type = #{achievementLittleType},</if>
|
||||
<if test="teamName != null">team_name = #{teamName},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<mapper namespace="com.microservices.dms.referral.mapper.TalentReferralMapper">
|
||||
|
||||
<select id="selectIssuesCondition" resultType="com.microservices.dms.referral.vo.IssuesVo">
|
||||
select id,project_id,`subject`,description,status_id from issues
|
||||
select project_id,`subject`,description,status_id from issues
|
||||
<where>
|
||||
<if test="id != null ">and id = #{id}</if>
|
||||
<if test="projectId != null ">and project_id = #{projectId}</if>
|
||||
|
|
@ -66,58 +66,5 @@
|
|||
select id from users where login = #{login} limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectTaskByStatus" resultType="com.microservices.dms.referral.vo.TaskVo">
|
||||
select t.id,td.task_id, name, status, category_id, description
|
||||
from tasks t
|
||||
join task_details td on t.id = td.task_id
|
||||
where status in
|
||||
<foreach collection="statusIds" item="item" close=")" index="idx" open="(" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectUsersById" resultType="java.util.Map">
|
||||
select id,login,nickname from users where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectTaskById" resultType="com.microservices.dms.referral.vo.TaskVo">
|
||||
select t.id,td.task_id, name, status, category_id, description
|
||||
from tasks t
|
||||
join task_details td on t.id = td.task_id
|
||||
where t.id =#{id}
|
||||
</select>
|
||||
|
||||
<select id="selectExpertsBy" resultType="com.microservices.dms.referral.vo.ExpertVo">
|
||||
select id,
|
||||
user_id,
|
||||
review_area_one,
|
||||
review_area_two,
|
||||
review_area_three,
|
||||
(select IFNULL(nickname,login) from users u where u.id = e.user_id) as nickname
|
||||
from experts e
|
||||
where is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="allTaskWithExpertIds" resultType="com.microservices.dms.resourceLibrary.domain.vo.KeyValVo">
|
||||
select container_id as 'k', group_concat(expert_id) as v from task_expert where container_type = #{type}
|
||||
group by container_id
|
||||
</select>
|
||||
|
||||
<select id="selectCompetitionById" resultType="com.microservices.dms.referral.vo.TaskVo">
|
||||
select t.id, title as name, status, description
|
||||
from competition_infos t
|
||||
where t.id =#{id}
|
||||
</select>
|
||||
|
||||
<select id="selectCompetitionIdByStatus" resultType="com.microservices.dms.referral.vo.TaskVo">
|
||||
select t.id, title as name, status, description,identifier
|
||||
from competition_infos t
|
||||
where upload_date < now()
|
||||
</select>
|
||||
|
||||
<select id="selectPRInfoById" resultType="com.microservices.dms.referral.vo.PrInfoVo">
|
||||
select pr.id,pr.title as "title",pr.body as "content"
|
||||
from pull_requests pr
|
||||
where pr.id= #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -522,22 +522,11 @@
|
|||
</select>
|
||||
|
||||
<select id="getConvertedTaskAmount" resultType="java.lang.Double">
|
||||
select IFNULL(SUM(bounty), 0)
|
||||
from (select distinct t.id, t.bounty
|
||||
from tasks t
|
||||
join (select distinct task_id from papers where status = 2) p on t.id = p.task_id
|
||||
join task_resource_library on t.id = task_resource_library.task_id
|
||||
where is_transferred_to_results_library = 1) tmp
|
||||
</select>
|
||||
|
||||
<select id="getConvertedTaskAmount2" resultType="java.lang.Double">
|
||||
select IFNULL(SUM(bounty), 0)
|
||||
from (select distinct t.id, t.bounty
|
||||
from tasks t
|
||||
join (select task_id from papers where status = 2) p on t.id = p.task_id
|
||||
join task_resource_library on t.id = task_resource_library.task_id
|
||||
join achievements a on a.source_id = task_resource_library.id and a.source='2' and a.status= '1'
|
||||
where is_transferred_to_results_library = 1) tmp
|
||||
select IFNULL(sum(t.bounty), 0)
|
||||
from tasks t
|
||||
join (select distinct task_id from papers where status = 2) p on t.id = p.task_id
|
||||
join task_resource_library on t.id = task_resource_library.task_id
|
||||
where is_transferred_to_results_library = 1
|
||||
</select>
|
||||
|
||||
<select id="getConvertedTasksCount" resultType="java.lang.Long">
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -142,7 +142,7 @@ public class CommonController extends BaseController {
|
|||
@ApiOperation("通用上传请求")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "file", value = "文件实体", paramType = "form", dataType = "_file"),
|
||||
@ApiImplicitParam(name = "type", value = "文件类型(zone-identifier:专区下支持文件标识的附件,dms:资源库,cms:内容管理,resource:专区资源,pms:项目管理,pms-gitlink:项目管理gitlink附件,gitlink:gitlink附件)", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "type", value = "文件类型(zone-identifier:专区下支持文件标识的附件,cms:内容管理,resource:专区资源,pms:项目管理,pms-gitlink:项目管理gitlink附件,gitlink:gitlink附件)", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "hierarchy", value = "层级结构(eg: pms项目管理中{enterpriseIdentifier}/products,{enterpriseIdentifier}/projects,{enterpriseIdentifier}/docs/{projectId})", paramType = "query", dataType = "String")
|
||||
})
|
||||
public AjaxResult uploadFile(@RequestPart("file") MultipartFile file, String type, String hierarchy) {
|
||||
|
|
@ -168,7 +168,7 @@ public class CommonController extends BaseController {
|
|||
@DeleteMapping("/byIdentifier/{fileIdentifier}")
|
||||
@ApiOperation("通用删除请求")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "文件类型(cms:内容管理,dms:资源库,resource:专区资源,pms:项目管理,pms-gitlink:项目管理gitlink附件)", paramType = "query", dataType = "String")
|
||||
@ApiImplicitParam(name = "type", value = "文件类型(cms:内容管理,resource:专区资源,pms:项目管理,pms-gitlink:项目管理gitlink附件)", paramType = "query", dataType = "String")
|
||||
})
|
||||
public AjaxResult deleteFile(@PathVariable("fileIdentifier") String fileIdentifier, @RequestParam("type") String type) {
|
||||
return toAjax(sysFileInfoService.deleteFile(fileIdentifier, type));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,127 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-modules</artifactId>
|
||||
<version>3.6.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>microservices-modules-mon</artifactId>
|
||||
|
||||
<description>
|
||||
microservices-modules-mon运维监控模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Microservices Common Async -->
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-async</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Microservices Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Microservices Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Microservices Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Microservices Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices-common-httpClient</artifactId>
|
||||
<version>3.6.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.microservices.mon;
|
||||
|
||||
import com.microservices.common.security.annotation.EnableCustomConfig;
|
||||
import com.microservices.common.security.annotation.EnableRyFeignClients;
|
||||
import com.microservices.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 运维监控模块
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication
|
||||
public class MicroservicesMonApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MicroservicesMonApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 运维监控模块启动成功 ლ(´ڡ`ლ)゙ \n");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.microservices.mon.k8s.controller;
|
||||
|
||||
import com.microservices.common.core.web.controller.BaseController;
|
||||
import com.microservices.common.core.web.domain.GenericsAjaxResult;
|
||||
import com.microservices.common.core.web.page.GenericsTableDataInfo;
|
||||
import com.microservices.mon.k8s.domain.*;
|
||||
import com.microservices.mon.k8s.service.IK8sDashboardService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("dashboard")
|
||||
@Api(tags = "微服务大屏")
|
||||
public class K8sDashboardController extends BaseController {
|
||||
@Autowired
|
||||
private IK8sDashboardService k8sNamespaceService;
|
||||
|
||||
/**
|
||||
* 获取命名空间列表
|
||||
*/
|
||||
@ApiOperation(value = "获取命名空间列表")
|
||||
@GetMapping("/namespace/list")
|
||||
public GenericsTableDataInfo<K8sNamespace> namespaceList() {
|
||||
return new GenericsTableDataInfo<>(k8sNamespaceService.getNamespaceDetailList(true));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取集群节点列表")
|
||||
@GetMapping("/cluster/Nodelist")
|
||||
public GenericsTableDataInfo<K8sClusterNode> clusterNodeList() {
|
||||
return new GenericsTableDataInfo<>(k8sNamespaceService.getClusterNodeList());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取应用Pod Ip列表")
|
||||
@GetMapping("/application/{kind}/{namespace}/{applicationName}/podIdList")
|
||||
public GenericsTableDataInfo<String> applicationPodIdList(@PathVariable("kind") String kind, @PathVariable("namespace") String namespace, @PathVariable("applicationName") String applicationName) {
|
||||
return new GenericsTableDataInfo<>(k8sNamespaceService.getApplicationPodIdList(kind, namespace, applicationName));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取集群状态数据")
|
||||
@GetMapping("/cluster/status")
|
||||
public GenericsAjaxResult<K8sClusterStatus> clusterStatus() {
|
||||
return GenericsAjaxResult.success(k8sNamespaceService.getClusterStatus());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "集群每秒请求率(QPS)")
|
||||
@GetMapping("/cluster/qps")
|
||||
public GenericsTableDataInfo<MetricCommonData> clusterQps() {
|
||||
return new GenericsTableDataInfo<>(k8sNamespaceService.getClusterQps());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "最近24小时应用接口请求次数")
|
||||
@GetMapping("/cluster/applicationRequestCount")
|
||||
public GenericsTableDataInfo<ApplicationRequestCountData> applicationRequestCount() {
|
||||
return new GenericsTableDataInfo<>(k8sNamespaceService.getApplicationRequestCount());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取Pod容器状态")
|
||||
@GetMapping("/cluster/podContainerStatus/{containerID}")
|
||||
public GenericsAjaxResult<K8sPodContainerStatus> podContainerStatus(@PathVariable("containerID") String containerID) {
|
||||
return GenericsAjaxResult.success(k8sNamespaceService.getPodContainerStatus(containerID));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取服务器节点状态")
|
||||
@GetMapping("/cluster/nodeStatus/{nodeIp}")
|
||||
public GenericsAjaxResult<K8sNodeStatus> nodeStatus(@PathVariable("nodeIp") String nodeIp) {
|
||||
return GenericsAjaxResult.success(k8sNamespaceService.getNodeStatus(nodeIp));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.microservices.mon.k8s.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel("应用请求次数对象")
|
||||
public class ApplicationRequestCountData {
|
||||
|
||||
@ApiModelProperty(value = "序号")
|
||||
private Integer number;
|
||||
|
||||
@ApiModelProperty(value = "应用名称")
|
||||
private String applicationAlias;
|
||||
|
||||
@ApiModelProperty(value = "请求次数")
|
||||
private Long requestCount;
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.microservices.mon.k8s.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("K8S应用")
|
||||
public class K8sApplication {
|
||||
|
||||
@ApiModelProperty(value = "应用Id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "应用名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "应用别名")
|
||||
private String alias;
|
||||
|
||||
@ApiModelProperty(value = "应用类型")
|
||||
private String kind;
|
||||
|
||||
@ApiModelProperty(value = "所属命名空间")
|
||||
private String namespace;
|
||||
|
||||
@ApiModelProperty(value = "副本数量")
|
||||
private Integer replicas;
|
||||
|
||||
@ApiModelProperty(value = "有效副本数量(当有效副本数为0时代表应用失败呈现红色;当有效副本数大于0但小于副本数时代表应用部分失败呈现橙色;当有效副本数等于副本数代表应用正常呈现蓝色)")
|
||||
private Integer readyReplicas;
|
||||
|
||||
@ApiModelProperty(value = "Pod选择器")
|
||||
private String podSelector;
|
||||
|
||||
private List<K8sApplicationPod> podList;
|
||||
public static String getApplicationFullKind(String kind) {
|
||||
if("DaemonSet".equals(kind)){
|
||||
return "apps.daemonsets";
|
||||
} else if ("StatefulSet".equals(kind)) {
|
||||
return "apps.statefulsets";
|
||||
} else if("Deployment".equals(kind)){
|
||||
return "apps.deployments";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.microservices.mon.k8s.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("K8S Pod")
|
||||
public class K8sApplicationPod {
|
||||
|
||||
@ApiModelProperty(value = "Pod Id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "Pod名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "Pod Ip")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(value = "容器id")
|
||||
private String containerID;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.microservices.mon.k8s.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("集群节点")
|
||||
public class K8sClusterNode {
|
||||
@ApiModelProperty(value = "节点标识")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "节点名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "节点IP")
|
||||
private String ip;
|
||||
|
||||
@ApiModelProperty(value = "节点角色(Master/Worker)")
|
||||
private String role;
|
||||
|
||||
@ApiModelProperty(value = "是否就绪")
|
||||
private Boolean Ready;
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package com.microservices.mon.k8s.domain;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.mon.k8s.domain.vo.PrometheusResVo;
|
||||
import com.microservices.mon.k8s.domain.vo.PrometheusResultVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("集群状态")
|
||||
public class K8sClusterStatus {
|
||||
@ApiModelProperty(value = "集群节点数量")
|
||||
private Integer nodeCount;
|
||||
|
||||
@ApiModelProperty(value = "不可用节点数量")
|
||||
private Integer unavailableNodeCount;
|
||||
|
||||
@ApiModelProperty(value = "Pod使用率")
|
||||
private Float podUsage;
|
||||
|
||||
@ApiModelProperty(value = "CPU使用率")
|
||||
private Float cpuUsage;
|
||||
|
||||
@ApiModelProperty(value = "内存使用率")
|
||||
private Float memoryUsage;
|
||||
|
||||
@ApiModelProperty(value = "最近24小时请求总数")
|
||||
private Long totalRequestCountToday;
|
||||
|
||||
@ApiModelProperty(value = "最近24小时请求平均处理时间(单位:ms)")
|
||||
private Float averageRequestProcessingTimeToday;
|
||||
|
||||
@ApiModelProperty(value = "最近24小时请求成功率")
|
||||
private Float requestSuccessRateToday;
|
||||
|
||||
@ApiModelProperty(value = "微服务应用数量")
|
||||
private Integer microserviceApplicationCount;
|
||||
|
||||
@ApiModelProperty(value = "最近24小时微服务重启次数")
|
||||
private Integer microserviceRestartCountToday;
|
||||
|
||||
@ApiModelProperty(value = "微服务Pod运行状态(Key代表状态,Value代表数量)")
|
||||
private HashMap<String, Integer> podStatus;
|
||||
|
||||
public void setNodeCount(PrometheusResVo prometheusResVo) {
|
||||
this.nodeCount = Integer.parseInt(getPromStringValue(prometheusResVo));
|
||||
}
|
||||
|
||||
public void setUnavailableNodeCount(PrometheusResVo prometheusResVo) {
|
||||
this.unavailableNodeCount = Integer.parseInt(getPromStringValue(prometheusResVo));
|
||||
}
|
||||
|
||||
public void setCpuUsage(PrometheusResVo prometheusResVo) {
|
||||
this.cpuUsage = Float.parseFloat(getPromStringValue(prometheusResVo));
|
||||
}
|
||||
|
||||
public void setPodUsage(PrometheusResVo prometheusResVo) {
|
||||
this.podUsage = Float.parseFloat(getPromStringValue(prometheusResVo));
|
||||
}
|
||||
|
||||
public void setMemoryUsage(PrometheusResVo prometheusResVo) {
|
||||
this.memoryUsage = Float.parseFloat(getPromStringValue(prometheusResVo));
|
||||
}
|
||||
|
||||
public void setTotalRequestCountToday(PrometheusResVo prometheusResVo) {
|
||||
this.totalRequestCountToday = Long.parseLong(getPromStringValue(prometheusResVo));
|
||||
}
|
||||
|
||||
public void setAverageRequestProcessingTimeToday(PrometheusResVo prometheusResVo) {
|
||||
this.averageRequestProcessingTimeToday = Float.parseFloat(getPromStringValue(prometheusResVo));
|
||||
}
|
||||
|
||||
public void setRequestSuccessRateToday(PrometheusResVo prometheusResVo) {
|
||||
this.requestSuccessRateToday = Float.parseFloat(getPromStringValue(prometheusResVo));
|
||||
}
|
||||
|
||||
public void setMicroserviceApplicationCount(List<K8sNamespace> k8sNamespaceList) {
|
||||
this.microserviceApplicationCount = k8sNamespaceList.stream().map(x -> x.getApplicationList().size()).reduce(0, Integer::sum);
|
||||
}
|
||||
|
||||
public void setMicroserviceRestartCountToday(PrometheusResVo prometheusResVo) {
|
||||
this.microserviceRestartCountToday = (int) Float.parseFloat(getPromStringValue(prometheusResVo));
|
||||
}
|
||||
|
||||
public void setPodStatus(PrometheusResVo prometheusResVo) {
|
||||
HashMap<String, Integer> podStatus = new HashMap<>();
|
||||
if (prometheusResVo != null && prometheusResVo.isSuccess()) {
|
||||
List<PrometheusResultVo> resultList = prometheusResVo.getData().getResult();
|
||||
for (PrometheusResultVo result : resultList) {
|
||||
Integer value = result.getValue().getIntValue(1);
|
||||
switch (result.getMetric().getString("phase")) {
|
||||
case "Running":
|
||||
podStatus.put("运行中", value);
|
||||
break;
|
||||
case "Pending":
|
||||
podStatus.put("等待中", value);
|
||||
break;
|
||||
case "Succeeded":
|
||||
podStatus.put("运行已完成", value);
|
||||
break;
|
||||
case "Failed":
|
||||
podStatus.put("运行失败", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.podStatus = podStatus;
|
||||
}
|
||||
|
||||
private String getPromStringValue(PrometheusResVo prometheusResVo) {
|
||||
String value = "";
|
||||
if (prometheusResVo != null && prometheusResVo.isSuccess()) {
|
||||
PrometheusResultVo result = prometheusResVo.getData().getResult().get(0);
|
||||
return result.getValue().getString(1);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.microservices.mon.k8s.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("命名空间")
|
||||
public class K8sNamespace {
|
||||
@ApiModelProperty(value = "命名空间标识")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "命名空间键值")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty(value = "命名空间名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "命名空间别名(中文)")
|
||||
private String alias;
|
||||
|
||||
@ApiModelProperty(value = "应用列表")
|
||||
private List<K8sApplication> applicationList;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.microservices.mon.k8s.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("K8S Node状态")
|
||||
public class K8sNodeStatus {
|
||||
@ApiModelProperty(value = "节点IP")
|
||||
private String nodeIp;
|
||||
|
||||
@ApiModelProperty(value = "CPU使用率")
|
||||
private Float cpuUsage;
|
||||
|
||||
@ApiModelProperty(value = "内存使用率")
|
||||
private Float memoryUsage;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.microservices.mon.k8s.domain;
|
||||
|
||||
import com.microservices.mon.k8s.domain.vo.PrometheusResVo;
|
||||
import com.microservices.mon.k8s.domain.vo.PrometheusResultVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("K8S Pod状态")
|
||||
public class K8sPodContainerStatus {
|
||||
@ApiModelProperty(value = "Pod名称")
|
||||
private String podName;
|
||||
|
||||
@ApiModelProperty(value = "CPU使用率")
|
||||
private Float cpuUsage;
|
||||
|
||||
@ApiModelProperty(value = "内存使用情况")
|
||||
private String memoryUsage;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.microservices.mon.k8s.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
@ApiModel("指标通用对象")
|
||||
public class MetricCommonData {
|
||||
|
||||
@ApiModelProperty(value = "时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date date;
|
||||
|
||||
@ApiModelProperty(value = "指标值")
|
||||
private Float value;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PrometheusDataVo {
|
||||
// 查询结果类型
|
||||
String resultType;
|
||||
// 应用类型
|
||||
List<PrometheusResultVo> result;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PrometheusResVo {
|
||||
// 状态(success代表成功)
|
||||
String status;
|
||||
// 数据
|
||||
PrometheusDataVo data;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return "success".equals(status)
|
||||
&& data != null
|
||||
&& !data.getResult().isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PrometheusResultVo {
|
||||
// 指标数据
|
||||
JSONObject metric;
|
||||
// 指标值
|
||||
JSONArray value;
|
||||
// 范围查询时指标值
|
||||
JSONArray values;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RancherApplicationStateVo {
|
||||
|
||||
// Daemonsets-期望数量
|
||||
Integer desiredNumberScheduled;
|
||||
|
||||
// Daemonsets-就绪数量
|
||||
Integer numberReady;
|
||||
|
||||
|
||||
|
||||
// Deploy/Stateful-就绪副本数
|
||||
Integer readyReplicas;
|
||||
|
||||
// Stateful-有效副本数
|
||||
Integer availableReplicas;
|
||||
|
||||
// Deploy/Stateful-副本数量
|
||||
Integer replicas;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.core.utils.bean.BeanUtils;
|
||||
import com.microservices.mon.k8s.domain.K8sApplication;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RancherApplicationVo {
|
||||
// 标识
|
||||
String id;
|
||||
// 应用类型
|
||||
String kind;
|
||||
// 元数据
|
||||
RancherMetadataVo metadata;
|
||||
// 状态
|
||||
RancherApplicationStateVo status;
|
||||
|
||||
|
||||
public K8sApplication toK8sApplication() {
|
||||
K8sApplication target = new K8sApplication();
|
||||
BeanUtils.copyProperties(this, target);
|
||||
if (metadata.getAnnotations() != null && metadata.getAnnotations().containsKey("mon-name")) {
|
||||
target.setAlias(metadata.getAnnotations().getString("mon-name"));
|
||||
}
|
||||
target.setName(metadata.getName());
|
||||
if ("DaemonSet".equals(kind)) {
|
||||
target.setReplicas(status.getDesiredNumberScheduled());
|
||||
target.setReadyReplicas(status.getNumberReady());
|
||||
} else if ("StatefulSet".equals(kind)) {
|
||||
target.setReplicas(status.getReplicas());
|
||||
target.setReadyReplicas(status.getAvailableReplicas());
|
||||
} else {
|
||||
target.setReplicas(status.getReplicas());
|
||||
target.setReadyReplicas(status.getReadyReplicas());
|
||||
}
|
||||
target.setNamespace(metadata.getNamespace());
|
||||
|
||||
JSONArray relationships = metadata.getRelationships();
|
||||
for (int i = 0; i < relationships.size(); i++) {
|
||||
JSONObject relationship = relationships.getJSONObject(i);
|
||||
if (relationship.containsKey("toType") && "pod".equals(relationship.getString("toType"))) {
|
||||
String selector = relationship.getString("selector");
|
||||
if (StringUtils.isNotEmpty(selector) && selector.contains("app=")) {
|
||||
String appName = selector.substring(selector.indexOf("=") + 1);
|
||||
target.setPodSelector(appName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RancherClusterNodeStateVo {
|
||||
|
||||
// ip地址
|
||||
JSONArray addresses;
|
||||
|
||||
// 资源分配
|
||||
JSONObject allocatable;
|
||||
|
||||
// 节点状况
|
||||
JSONArray conditions;
|
||||
|
||||
// 节点信息
|
||||
JSONObject nodeInfo;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.utils.bean.BeanUtils;
|
||||
import com.microservices.mon.k8s.domain.K8sApplication;
|
||||
import com.microservices.mon.k8s.domain.K8sClusterNode;
|
||||
import com.microservices.mon.k8s.domain.K8sNamespace;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class RancherClusterNodeVo {
|
||||
// 标识
|
||||
String id;
|
||||
// 元数据
|
||||
RancherMetadataVo metadata;
|
||||
// 节点状态
|
||||
RancherClusterNodeStateVo status;
|
||||
|
||||
public K8sClusterNode toK8sClusterNode() {
|
||||
K8sClusterNode target = new K8sClusterNode();
|
||||
BeanUtils.copyProperties(this, target);
|
||||
if (metadata.getLabels() != null && metadata.getLabels().containsKey("node-role.kubernetes.io/control-plane")) {
|
||||
target.setRole("Master");
|
||||
}else{
|
||||
target.setRole("Worker");
|
||||
}
|
||||
target.setName(metadata.getName());
|
||||
if(status!=null&&status.getAddresses()!=null){
|
||||
JSONArray addresses=status.getAddresses();
|
||||
for (int i = 0; i < addresses.size(); i++) {
|
||||
JSONObject jsonObject = addresses.getJSONObject(i);
|
||||
if (jsonObject.getString("type").equals("InternalIP")) {
|
||||
target.setIp(jsonObject.getString("address"));
|
||||
}
|
||||
}
|
||||
JSONArray conditions=status.getConditions();
|
||||
for (int i = 0; i < conditions.size(); i++) {
|
||||
JSONObject jsonObject = conditions.getJSONObject(i);
|
||||
if (jsonObject.getString("type").equals("Ready")) {
|
||||
target.setReady(jsonObject.getBoolean("status"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class RancherMetadataVo {
|
||||
// 所属命名空间
|
||||
String namespace;
|
||||
// 创建时间
|
||||
Date creationTimestamp;
|
||||
// 描述
|
||||
JSONObject annotations;
|
||||
// 关联数据
|
||||
JSONArray relationships;
|
||||
// 标签
|
||||
JSONObject labels;
|
||||
// 名称
|
||||
String name;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.utils.bean.BeanUtils;
|
||||
import com.microservices.mon.k8s.domain.K8sNamespace;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RancherNamespaceVo {
|
||||
// 描述
|
||||
JSONObject annotations;
|
||||
//创建时间
|
||||
Date created;
|
||||
// 标识
|
||||
String id;
|
||||
// 标签
|
||||
JSONObject labels;
|
||||
// 名称
|
||||
String name;
|
||||
// 状态
|
||||
String state;
|
||||
|
||||
public K8sNamespace toK8sNamespace() {
|
||||
K8sNamespace target = new K8sNamespace();
|
||||
BeanUtils.copyProperties(this, target);
|
||||
target.setKey(labels.getString("mon-key"));
|
||||
target.setAlias(annotations.getString("mon-name"));
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class RancherPodStateVo {
|
||||
|
||||
// Pod状况
|
||||
JSONArray conditions;
|
||||
|
||||
// Pod Ip
|
||||
String podIP;
|
||||
|
||||
// 启动时间
|
||||
Date startTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.core.utils.bean.BeanUtils;
|
||||
import com.microservices.mon.k8s.domain.K8sApplication;
|
||||
import com.microservices.mon.k8s.domain.K8sApplicationPod;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RancherPodVo {
|
||||
// 标识
|
||||
String id;
|
||||
// 元数据
|
||||
RancherMetadataVo metadata;
|
||||
// 状态
|
||||
RancherPodStateVo status;
|
||||
|
||||
public K8sApplicationPod toK8sApplicationPod() {
|
||||
K8sApplicationPod target = new K8sApplicationPod();
|
||||
BeanUtils.copyProperties(this, target);
|
||||
target.setIp(status.getPodIP());
|
||||
if (metadata != null) {
|
||||
if (metadata.getAnnotations() != null) {
|
||||
target.setContainerID(metadata.getAnnotations().getString("cni.projectcalico.org/containerID"));
|
||||
}
|
||||
target.setName(metadata.getName());
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RancherServicePortsVo {
|
||||
|
||||
// 端口名称
|
||||
String name;
|
||||
|
||||
// 映射端口
|
||||
Integer nodePort;
|
||||
|
||||
// 内部端口
|
||||
Integer port;
|
||||
|
||||
// 协议
|
||||
String protocol;
|
||||
|
||||
// 目标端口
|
||||
Integer targetPort;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RancherServiceSpecVo {
|
||||
|
||||
// 端口映射列表
|
||||
List<RancherServicePortsVo> ports;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.microservices.mon.k8s.domain.vo;
|
||||
|
||||
import com.microservices.common.core.utils.bean.BeanUtils;
|
||||
import com.microservices.mon.k8s.domain.K8sApplication;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RancherServiceVo {
|
||||
// 标识
|
||||
String id;
|
||||
// 元数据
|
||||
RancherMetadataVo metadata;
|
||||
// 状态
|
||||
RancherServiceSpecVo spec;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.microservices.mon.k8s.service;
|
||||
|
||||
import com.microservices.mon.k8s.domain.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public interface IK8sDashboardService {
|
||||
List<K8sNamespace> getNamespaceDetailList(boolean needPod);
|
||||
|
||||
List<K8sClusterNode> getClusterNodeList();
|
||||
|
||||
List<String> getApplicationPodIdList(String kind, String namespace,String applicationName);
|
||||
|
||||
K8sClusterStatus getClusterStatus();
|
||||
|
||||
List<MetricCommonData> getClusterQps();
|
||||
|
||||
List<ApplicationRequestCountData> getApplicationRequestCount();
|
||||
|
||||
K8sPodContainerStatus getPodContainerStatus(String containerID);
|
||||
|
||||
K8sNodeStatus getNodeStatus(String nodeIp);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.microservices.mon.k8s.service;
|
||||
|
||||
import com.microservices.mon.k8s.domain.K8sClusterStatus;
|
||||
|
||||
/**
|
||||
* 运维监控Service异步接口
|
||||
*/
|
||||
public interface IMonCommonAsyncService {
|
||||
|
||||
K8sClusterStatus getClusterStatus(String query);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue