diff --git a/.github/linters/checkstyle.xml b/.github/linters/checkstyle.xml
deleted file mode 100644
index fb7ba1b..0000000
--- a/.github/linters/checkstyle.xml
+++ /dev/null
@@ -1,209 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/.github/script/codearts_check.sh b/.github/script/codearts_check.sh
new file mode 100644
index 0000000..b0b84e2
--- /dev/null
+++ b/.github/script/codearts_check.sh
@@ -0,0 +1,79 @@
+
+IAM_DATA=$(cat < label.name);
+ if (!labels.includes(requiredLabel)) {
+ throw new Error(`PR 必须包含标签: ${requiredLabel}`);
+ }
diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml
deleted file mode 100644
index 0c13a16..0000000
--- a/.github/workflows/linter.yml
+++ /dev/null
@@ -1,35 +0,0 @@
-name: Lint Code Base
-on:
- push:
- branches: [master, main, test, develop_test]
- pull_request:
- branches: [master, main, test, develop_test]
-jobs:
- build:
- name: Lint
- runs-on: ubuntu-latest
-
- permissions:
- contents: read
- packages: read
- # To report GitHub Actions status checks
- statuses: write
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- # super-linter needs the full git history to get the
- # list of files that changed across commits
- fetch-depth: 0
-
- - name: Super-linter
- uses: super-linter/super-linter@v7.1.0 # x-release-please-version
- env:
- # To report GitHub Actions status checks
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- VALIDATE_JAVA: true
- FILTER_REGEX_INCLUDE: .*src/.*/ # Only lint files in src/
- LINTER_RULES_PATH: .github/linters
- JAVA_FILE_NAME: checkstyle.xml
-
diff --git a/pom.xml b/pom.xml
index a22ffa3..4753d24 100644
--- a/pom.xml
+++ b/pom.xml
@@ -229,6 +229,36 @@
org.springframework.boot
spring-boot-maven-plugin
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.7
+
+
+ default-prepare-agent
+
+ prepare-agent
+
+
+
+ default-report
+ test
+
+ report
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.2.5
+
+
+ com/datastat/ds/unit/*.java
+
+
+
diff --git a/src/main/java/com/datastat/config/FoundryConfig.java b/src/main/java/com/datastat/config/FoundryConfig.java
index 6db2aec..b96ed04 100644
--- a/src/main/java/com/datastat/config/FoundryConfig.java
+++ b/src/main/java/com/datastat/config/FoundryConfig.java
@@ -18,7 +18,7 @@
import org.springframework.context.annotation.PropertySource;
@ConfigurationProperties(prefix = "foundry")
-@PropertySource(value = {"file:${config.path}/foundry.properties"}, encoding = "UTF-8")
+@PropertySource(value = {"file:${config.path}/foundry.properties"}, ignoreResourceNotFound = true, encoding = "UTF-8")
@Configuration("foundryConf")
@Data
public class FoundryConfig extends CustomPropertiesConfig {
diff --git a/src/main/java/com/datastat/config/MindSporeConfig.java b/src/main/java/com/datastat/config/MindSporeConfig.java
index 1e1982e..17ed852 100644
--- a/src/main/java/com/datastat/config/MindSporeConfig.java
+++ b/src/main/java/com/datastat/config/MindSporeConfig.java
@@ -18,7 +18,7 @@
import org.springframework.context.annotation.PropertySource;
@ConfigurationProperties(prefix = "mindspore")
-@PropertySource(value = {"file:${config.path}/mindspore.properties"}, encoding = "UTF-8")
+@PropertySource(value = {"file:${config.path}/mindspore.properties"}, ignoreResourceNotFound = true, encoding = "UTF-8")
@Configuration("mindsporeConf")
@Data
public class MindSporeConfig extends CustomPropertiesConfig {
diff --git a/src/main/java/com/datastat/config/OpenEulerConfig.java b/src/main/java/com/datastat/config/OpenEulerConfig.java
index bc07a55..1692a3a 100644
--- a/src/main/java/com/datastat/config/OpenEulerConfig.java
+++ b/src/main/java/com/datastat/config/OpenEulerConfig.java
@@ -18,7 +18,7 @@
import org.springframework.context.annotation.PropertySource;
@ConfigurationProperties(prefix = "openeuler")
-@PropertySource(value = {"file:${config.path}/openeuler.properties"}, encoding = "UTF-8")
+@PropertySource(value = {"file:${config.path}/openeuler.properties"}, ignoreResourceNotFound = true, encoding = "UTF-8")
@Configuration("openeulerConf")
@Data
public class OpenEulerConfig extends CustomPropertiesConfig {
diff --git a/src/main/java/com/datastat/config/OpenGaussConfig.java b/src/main/java/com/datastat/config/OpenGaussConfig.java
index 6c903e8..9c55fbc 100644
--- a/src/main/java/com/datastat/config/OpenGaussConfig.java
+++ b/src/main/java/com/datastat/config/OpenGaussConfig.java
@@ -26,7 +26,7 @@
import org.springframework.core.env.Environment;
@ConfigurationProperties(prefix = "opengauss")
-@PropertySource(value = {"file:${config.path}/opengauss.properties"}, encoding = "UTF-8")
+@PropertySource(value = {"file:${config.path}/opengauss.properties"}, ignoreResourceNotFound = true, encoding = "UTF-8")
@Configuration("opengaussConf")
@Data
public class OpenGaussConfig extends CustomPropertiesConfig {
diff --git a/src/main/java/com/datastat/config/OpenLookengConfig.java b/src/main/java/com/datastat/config/OpenLookengConfig.java
index 51b7108..c4f1195 100644
--- a/src/main/java/com/datastat/config/OpenLookengConfig.java
+++ b/src/main/java/com/datastat/config/OpenLookengConfig.java
@@ -18,7 +18,7 @@
import org.springframework.context.annotation.PropertySource;
@ConfigurationProperties(prefix = "openlookeng")
-@PropertySource(value = {"file:${config.path}/openlookeng.properties"}, encoding = "UTF-8")
+@PropertySource(value = {"file:${config.path}/openlookeng.properties"}, ignoreResourceNotFound = true, encoding = "UTF-8")
@Configuration("openlookengConf")
@Data
public class OpenLookengConfig extends CustomPropertiesConfig {
diff --git a/src/main/java/com/datastat/config/QueryConfig.java b/src/main/java/com/datastat/config/QueryConfig.java
index d29fb10..a83ca7a 100644
--- a/src/main/java/com/datastat/config/QueryConfig.java
+++ b/src/main/java/com/datastat/config/QueryConfig.java
@@ -18,7 +18,7 @@
import org.springframework.context.annotation.PropertySource;
@ConfigurationProperties(prefix = "custom")
-@PropertySource(value = {"file:${config.path}/custom.properties"})
+@PropertySource(value = {"file:${config.path}/custom.properties"}, ignoreResourceNotFound = true, encoding = "UTF-8")
@Configuration("queryConf")
@Data
public class QueryConfig extends CustomPropertiesConfig {
diff --git a/src/main/java/com/datastat/config/SoftwareConfig.java b/src/main/java/com/datastat/config/SoftwareConfig.java
index 675ce7d..9f1a09c 100644
--- a/src/main/java/com/datastat/config/SoftwareConfig.java
+++ b/src/main/java/com/datastat/config/SoftwareConfig.java
@@ -9,7 +9,7 @@
import lombok.Data;
@ConfigurationProperties(prefix = "software")
-@PropertySource(value = {"file:${config.path}/software.properties"}, encoding = "UTF-8")
+@PropertySource(value = {"file:${config.path}/software.properties"}, ignoreResourceNotFound = true, encoding = "UTF-8")
@Configuration("softwareConf")
@Data
public class SoftwareConfig extends CustomPropertiesConfig { }
diff --git a/src/main/java/com/datastat/constant/Constant.java b/src/main/java/com/datastat/constant/Constant.java
index d051413..42f2e4b 100644
--- a/src/main/java/com/datastat/constant/Constant.java
+++ b/src/main/java/com/datastat/constant/Constant.java
@@ -16,6 +16,36 @@ private Constant() {
public static final String FEEDBACK_REPO = "easy-software";
+ /**
+ * VALID_APPROVAL_REG used to match input string.
+ */
+ public static final String VALID_APPROVAL_REG = "model|dataset|space|^\\*$";
+
+ /**
+ * VALID_DATE_REG used to match input string.
+ */
+ public static final String VALID_DATE_REG = "^(\\d{4})-(\\d{2})-(\\d{2})$";
+
+ /**
+ * START_DATE used to match input string.
+ */
+ public static final String START_DATE = "1970-01-01";
+
+ /**
+ * END_DATE used to match input string.
+ */
+ public static final String END_DATE = "2050-01-01";
+
+ /**
+ * VALID_OPENMIND_ENV_REG used to match input string.
+ */
+ public static final String VALID_OPENMIND_ENV_REG = "pro|yidong|sh";
+
+ /**
+ * VALID_REPO_ID used to match input string.
+ */
+ public static final String VALID_REPO_ID = "^\\d+$|^\\*$";
+
/**
* openmind社区.
*/
diff --git a/src/main/java/com/datastat/controller/QueryController.java b/src/main/java/com/datastat/controller/QueryController.java
index 9c7310a..aa9a61a 100644
--- a/src/main/java/com/datastat/controller/QueryController.java
+++ b/src/main/java/com/datastat/controller/QueryController.java
@@ -26,6 +26,7 @@
import com.datastat.model.TeamupApplyForm;
import com.datastat.model.dto.ContributeRequestParams;
import com.datastat.model.dto.NpsIssueBody;
+import com.datastat.model.dto.RequestParams;
import com.datastat.model.meetup.MeetupApplyForm;
import com.datastat.model.vo.*;
import com.datastat.service.QueryService;
@@ -676,10 +677,16 @@ public String queryModelFoundrySH(HttpServletRequest request,
return queryService.queryModelFoundrySH(request, repo);
}
+ /**
+ * Compute repo download based on the specified search conditions.
+ *
+ * @param request HttpServletRequest request.
+ * @param condition search condition.
+ * @return Response string.
+ */
@RequestMapping(value = "/modelfoundry/download/count")
- public String queryModelFoundryCountPath(HttpServletRequest request,
- @RequestParam(value = "path", required = false) String path) {
- return queryService.queryModelFoundryCountPath(request, path);
+ public String queryModelFoundryCountPath(HttpServletRequest request, @Valid final RequestParams condition) {
+ return queryService.queryModelFoundryCountPath(request, condition);
}
@RequestMapping(value = "/repo/developer")
@@ -689,10 +696,16 @@ public String queryRepoDeveloper(HttpServletRequest request,
return queryService.queryRepoDeveloper(request, timeRange);
}
+ /**
+ * Compute repo view count based on the specified search conditions.
+ *
+ * @param request HttpServletRequest request.
+ * @param condition search condition.
+ * @return Response string.
+ */
@RequestMapping(value = "/modelfoundry/view/count")
- public String queryViewCount(HttpServletRequest request,
- @RequestParam(value = "path", required = false) String path) {
- return queryService.queryViewCount(request, path);
+ public String queryViewCount(HttpServletRequest request, @Valid final RequestParams condition) {
+ return queryService.queryViewCount(request, condition);
}
@RequestMapping("/community/coreRepos")
@@ -766,4 +779,29 @@ public String saveFrontendEvents(HttpServletRequest request,
@RequestBody String requestBody) {
return queryService.saveFrontendEvents(request, community, requestBody);
}
+
+ /**
+ * Compute repo star count based on the specified search conditions.
+ *
+ * @param request HttpServletRequest request.
+ * @param condition search condition.
+ * @return Response string.
+ */
+ @RequestMapping(value = "/modelfoundry/star/count")
+ public String queryEventCount(HttpServletRequest request, @Valid final RequestParams condition) {
+ return queryService.queryEventCount(request, condition);
+ }
+
+ /**
+ * Handles HTTP requests to the "/monthdowncount/openmind" endpoint to retrieve the monthly download count for a specified repository.
+ *
+ * @param request The HTTP request object containing details of the request.
+ * @param repoID The unique identifier of the repository, passed as a request parameter.
+ * @return A string containing the monthly download count information for the repository.
+ */
+ @RequestMapping(value = "/monthdowncount/openmind")
+ public String monthDownCount(HttpServletRequest request,
+ @RequestParam(value = "repo_id") String repoID ) {
+ return queryService.getCommunityMonthDowncount(request, "foundry", repoID);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/datastat/dao/OpenUbmcQueryDao.java b/src/main/java/com/datastat/dao/OpenUbmcQueryDao.java
new file mode 100644
index 0000000..4d3f99a
--- /dev/null
+++ b/src/main/java/com/datastat/dao/OpenUbmcQueryDao.java
@@ -0,0 +1,51 @@
+/* This project is licensed under the Mulan PSL v2.
+ You can use this software according to the terms and conditions of the Mulan PSL v2.
+ You may obtain a copy of Mulan PSL v2 at:
+ http://license.coscl.org.cn/MulanPSL2
+ THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
+ PURPOSE.
+ See the Mulan PSL v2 for more details.
+ Create: 2024
+*/
+package com.datastat.dao;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.asynchttpclient.ListenableFuture;
+import org.asynchttpclient.Response;
+import org.springframework.stereotype.Repository;
+
+import com.datastat.model.CustomPropertiesConfig;
+import com.datastat.util.ResultUtil;
+
+import lombok.SneakyThrows;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+@Repository("openubmcDao")
+public class OpenUbmcQueryDao extends QueryDao {
+
+ /**
+ * Search ownertype based on username.
+ *
+ * @param queryConf query config.
+ * @param userName user name.
+ * @return Response string.
+ */
+ @Override
+ @SneakyThrows
+ public String queryUserOwnerType(CustomPropertiesConfig queryConf, String userName) {
+ String index = queryConf.getSigIndex();
+ String queryStr = queryConf.getAllUserOwnerTypeQueryStr();
+ ListenableFuture future = this.esAsyncHttpUtil.executeElasticSearch(queryConf.getEsBaseUrl(),
+ queryConf.getEsAuth(), index, queryStr);
+
+ String responseBody = future.get().getResponseBody(UTF_8);
+ HashMap> userData = parseOwnerInfo(responseBody, userName);
+
+ ArrayList