提交 808ca2c5 作者: xiaowang

接口放行

上级 f6c36e71
...@@ -3,12 +3,14 @@ package com.mmc.iuav.user; ...@@ -3,12 +3,14 @@ package com.mmc.iuav.user;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
/** /**
* @author:zhenjie * @author:zhenjie
* @Date:2023/5/15 15:35 * @Date:2023/5/15 15:35
*/ */
@EnableScheduling
@SpringBootApplication @SpringBootApplication
public class UserApplication { public class UserApplication {
public static void main(String[] args) { public static void main(String[] args) {
...@@ -16,7 +18,7 @@ public class UserApplication { ...@@ -16,7 +18,7 @@ public class UserApplication {
} }
@Bean @Bean
public RestTemplate restTemplate(){ public RestTemplate restTemplate() {
return new RestTemplate(); return new RestTemplate();
} }
} }
...@@ -2,6 +2,7 @@ package com.mmc.iuav.user.schedule; ...@@ -2,6 +2,7 @@ package com.mmc.iuav.user.schedule;
import com.mmc.iuav.user.model.vo.data.ActiveUserCountVO; import com.mmc.iuav.user.model.vo.data.ActiveUserCountVO;
import com.mmc.iuav.user.service.data.UserReportService; import com.mmc.iuav.user.service.data.UserReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -14,6 +15,7 @@ import java.util.Calendar; ...@@ -14,6 +15,7 @@ import java.util.Calendar;
*/ */
@Component @Component
@ConditionalOnProperty(prefix = "scheduling", name = "enabled", havingValue = "true") @ConditionalOnProperty(prefix = "scheduling", name = "enabled", havingValue = "true")
@Slf4j
public class ManagerLogSchedule { public class ManagerLogSchedule {
@Resource @Resource
UserReportService userReportService; UserReportService userReportService;
...@@ -21,10 +23,10 @@ public class ManagerLogSchedule { ...@@ -21,10 +23,10 @@ public class ManagerLogSchedule {
/** /**
* 统计日活量 * 统计日活量
*/ */
@Scheduled(cron = "0 0 10 * * ?") @Scheduled(cron = "0 0 20 * * ?")
public void calculateActiveUserCount() { public void calculateActiveUserCount() {
log.info("统计日活量");
Integer userActiveCount = userReportService.getUserActiveCount(); Integer userActiveCount = userReportService.getUserActiveCount();
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -1); calendar.add(Calendar.DAY_OF_MONTH, -1);
//记录到数据库 //记录到数据库
......
...@@ -96,4 +96,6 @@ iuav: ...@@ -96,4 +96,6 @@ iuav:
pay: pay:
uri: http://payment-svc:8088 uri: http://payment-svc:8088
pms: pms:
uri: http://pms-svc:8099 uri: http://pms-svc:8099
\ No newline at end of file scheduling:
enabled: true
\ No newline at end of file
...@@ -88,4 +88,6 @@ iuav: ...@@ -88,4 +88,6 @@ iuav:
pay: pay:
uri: http://payment-svc:8088 uri: http://payment-svc:8088
pms: pms:
uri: http://pms-svc:8099 uri: http://pms-svc:8099
\ No newline at end of file scheduling:
enabled: true
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论