Browse Source

功能:实现定时调度模型解析任务

lijie 3 years ago
parent
commit
28c03303f2

+ 4 - 0
adm-business/adm-server/pom.xml

@@ -38,6 +38,10 @@
             <artifactId>dmp-amqp-starter</artifactId>
         </dependency>
         <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>dmp-job-executor-starter</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.locationtech.jts</groupId>
             <artifactId>jts-core</artifactId>
             <version>1.16.1</version>

+ 2 - 2
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/constant/AdmServerConstant.java

@@ -33,6 +33,6 @@ public interface AdmServerConstant {
     String CAD_ID="cADID";
     /**floorId*/
     String FLOOR_ID="floorId";
-
-
+    /***/
+    String MODEL_ANALYSIS_TIME_RULE_JOB = "modelAnalysisTimeRuleJob";
 }

+ 38 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/backstage/jobhandler/CommonTimeRuleJob.java

@@ -0,0 +1,38 @@
+package com.persagy.adm.server.backstage.jobhandler;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.adm.server.algorithm.constant.AdmServerConstant;
+import com.persagy.adm.server.backstage.service.impl.AdmAnalysisFacade;
+import com.persagy.common.util.HttpClientUtil.HttpResult;
+import com.persagy.common.utils.StringUtil;
+import com.persagy.dmp.common.constant.CommonConstant;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+/**
+ * 通用的时间规则调度
+ * @author : lijie
+ * Update By 2022/1/24 20:32
+ */
+@Slf4j
+@Component
+public class CommonTimeRuleJob {
+
+    @XxlJob(AdmServerConstant.MODEL_ANALYSIS_TIME_RULE_JOB)
+    public void modelAnalysisJobHandler() throws Exception {
+        XxlJobHelper.log("modelAnalysisTimeRuleJob start ...");
+        log.info("modelAnalysisTimeRuleJob start ...");
+        try {
+			AdmAnalysisFacade.analysisAdmModelFile();
+			XxlJobHelper.handleSuccess();
+		} catch (Exception e) {
+			log.error("模型解析定时任务执行失败", e);
+			XxlJobHelper.handleFail(e.getMessage());
+		} finally {
+			log.info("modelAnalysisTimeRuleJob end ... ");
+		}
+    }
+
+}

+ 35 - 0
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/client/BossStewardClient.java

@@ -0,0 +1,35 @@
+package com.persagy.adm.steward.client;
+
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.adm.steward.basic.config.StewardFeignConfig;
+import com.persagy.adm.steward.basic.model.response.BossResponse;
+import com.persagy.dmp.common.model.response.CommonResult;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+import java.util.Set;
+
+/***
+ * Description:对象管理Client
+ * @author : lijie
+ * @date :2021/8/19 17:38
+ * Update By lijie 2021/8/19 17:38
+ */
+@FeignClient(name = "boss-steward", configuration = StewardFeignConfig.class,
+        url = "${persagy.boss.steward.service:}",path = "/")
+public interface BossStewardClient {
+
+    /**
+     * 根据项目id批量查询项目信息
+     * @param projectIds: 项目id数组
+     * @return 对象数组
+     */
+    @PostMapping("test")
+    BossResponse<Void> test(@RequestHeader(value = "encryption-rsa", required = false,defaultValue = "true") Boolean rsaFlag,
+                            @RequestBody Set<String> projectIds);
+}

+ 23 - 0
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/client/BossStewardFacade.java

@@ -0,0 +1,23 @@
+package com.persagy.adm.steward.client;
+
+import cn.hutool.extra.spring.SpringUtil;
+import java.util.Set;
+
+/**
+ * 物理世界对象Client门面
+ * @author Charlie Yu
+ * @date 2021-05-15
+ */
+public class BossStewardFacade {
+
+    private static BossStewardClient client = SpringUtil.getBean(BossStewardClient.class);
+
+    /**
+     * 根据项目id批量查询项目信息
+     * @param projectIds: 项目id数组
+     * @return 对象数组
+     */
+    public static void test(Set<String> projectIds) {
+        client.test(Boolean.TRUE,projectIds);
+    }
+}