shasteel-biz/pom.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
shasteel-biz/src/main/java/com/iailab/module/shasteel/config/FeignTokenInterceptor.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleModuleTask.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
shasteel-biz/src/main/resources/logback-spring.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
shasteel-biz/pom.xml
@@ -44,6 +44,7 @@ <dependency> <groupId>com.iailab</groupId> <artifactId>iailab-common-biz-tenant</artifactId> <version>${revision}</version> </dependency> <dependency> @@ -125,13 +126,6 @@ <artifactId>HikariCP-java6</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.quartz-scheduler</groupId> <artifactId>quartz</artifactId> <version>2.3.2</version> </dependency> <dependency> shasteel-biz/src/main/java/com/iailab/module/shasteel/config/FeignTokenInterceptor.java
@@ -22,11 +22,10 @@ if (token!= null) { requestTemplate.header(HttpHeaders.AUTHORIZATION, token); } } Long tenantId = IailabClient.getTenantId(); if (tenantId != null) { requestTemplate.header("tenant-id", String.valueOf(tenantId)); Long tenantId = IailabClient.getTenantId(); if (tenantId != null) { requestTemplate.header("tenant-id", String.valueOf(tenantId)); } } } shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunPredictModuleTask.java
@@ -1,12 +1,18 @@ package com.iailab.module.shasteel.job.task; import com.iailab.module.model.api.mdk.MdkApi; import com.iailab.module.model.api.mdk.dto.MdkPredictModuleRespDTO; import com.iailab.module.model.api.mdk.dto.MdkPredictReqDTO; import com.iailab.module.shasteel.mq.common.RoutingConstant; import com.iailab.module.shasteel.mq.consumer.AlarmMessage; import com.iailab.module.shasteel.mq.consumer.PredictFinishMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.Calendar; /** @@ -18,7 +24,9 @@ private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired MdkApi mdkApi; private MdkApi mdkApi; @Autowired private RabbitTemplate rabbitTemplate; @Override @@ -32,9 +40,9 @@ MdkPredictReqDTO dto = new MdkPredictReqDTO(); dto.setPredictTime(calendar.getTime()); dto.setModuleType(params); mdkApi.predictModule(dto); logger.info(params + "模块预测完成"); MdkPredictModuleRespDTO mdkPredictModuleRespDTO = mdkApi.predictModule(dto); logger.info(params + "模块预测完成," + mdkPredictModuleRespDTO); rabbitTemplate.convertAndSend(PredictFinishMessage.EXCHANGE, PredictFinishMessage.PREDICTFINISH_ROUTING_KEY, mdkPredictModuleRespDTO); } catch (Exception ex) { logger.error("runPredictModuleTask运行异常"); shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunScheduleModuleTask.java
对比新文件 @@ -0,0 +1,45 @@ package com.iailab.module.shasteel.job.task; import com.iailab.module.model.api.mdk.MdkApi; import com.iailab.module.model.api.mdk.dto.MdkScheduleReqDTO; import com.iailab.module.model.api.mdk.dto.MdkScheduleRespDTO; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Calendar; /** * 执行调度方案定时任务 * */ @Component("runScheduleModuleTask") public class RunScheduleModuleTask implements ITask { private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private MdkApi mdkApi; @Override public void run(String params) { logger.info("runScheduleModuleTask定时任务正在执行,参数为:{}",params ); try { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.SECOND,0); calendar.set(Calendar.MILLISECOND,0); MdkScheduleReqDTO dto = new MdkScheduleReqDTO(); dto.setScheduleTime(calendar.getTime()); dto.setScheduleCode(params); MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(dto); logger.info(params + "调度方案执行完成," + mdkScheduleRespDTO); } catch (Exception ex) { logger.error("runScheduleModuleTask运行异常"); ex.printStackTrace(); } logger.info("runScheduleModuleTask运行完成"); } } shasteel-biz/src/main/resources/logback-spring.xml
@@ -57,15 +57,15 @@ </appender> <!-- 本地环境 --> <springProfile name="local"> <root level="INFO"> <springProfile name="dev"> <root level="DEBUG"> <appender-ref ref="STDOUT"/> <appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 --> <appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 --> </root> </springProfile> <!-- 其它环境 --> <springProfile name="dev,test,stage,prod,default"> <springProfile name="test,stage,prod,default"> <root level="INFO"> <appender-ref ref="STDOUT"/> <appender-ref ref="ASYNC"/>