修复不能正常报数的问题

This commit is contained in:
zayac 2024-06-07 17:55:39 +08:00
parent 9a8890996f
commit ac6e89af79
4 changed files with 14 additions and 20 deletions

View File

@ -6,8 +6,6 @@ MAINTAINER zayac stupidzayac@gmail.com
# 复制 JAR 文件和配置文件到容器中 # 复制 JAR 文件和配置文件到容器中
COPY ./bin/zayac-admin.jar /app/bin/app.jar COPY ./bin/zayac-admin.jar /app/bin/app.jar
COPY ./config /app/config/
COPY ./lib /app/lib/
# 设置工作目录 # 设置工作目录
WORKDIR /app/bin WORKDIR /app/bin

View File

@ -1,6 +1,6 @@
--- ### 项目配置 --- ### 项目配置
project: project:
# URL跨域配置默认放行此 URL请注意更改为你实际的前端 URL # URL跨域配置默认放行此 URL第三方登录回调默认使用此 URL 为前缀,请注意更改为你实际的前端 URL
url: http://localhost:5173 url: http://localhost:5173
# 是否为生产环境 # 是否为生产环境
production: true production: true
@ -8,7 +8,7 @@ project:
--- ### 服务器配置 --- ### 服务器配置
server: server:
# HTTP 端口(默认 8080 # HTTP 端口(默认 8080
port: 18000 port: 8000
--- ### 数据源配置 --- ### 数据源配置
spring.datasource: spring.datasource:
@ -60,7 +60,7 @@ spring.datasource:
## Liquibase 配置 ## Liquibase 配置
spring.liquibase: spring.liquibase:
# 是否启用 # 是否启用
enabled: true enabled: false
# 配置文件路径 # 配置文件路径
change-log: classpath:/db/changelog/db.changelog-master.yaml change-log: classpath:/db/changelog/db.changelog-master.yaml

View File

@ -62,7 +62,7 @@ import java.util.stream.Collectors;
@Component @Component
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
@Profile("dev") //@Profile("prod")
public class DailyReport { public class DailyReport {
private final TeamService teamService; private final TeamService teamService;
private final DeptService deptService; private final DeptService deptService;
@ -80,7 +80,7 @@ public class DailyReport {
private static final String ASSISTANT_ROLE_CODE = "assistant"; private static final String ASSISTANT_ROLE_CODE = "assistant";
private static final String SEO_ROLE_CODE = "seo"; private static final String SEO_ROLE_CODE = "seo";
@Scheduled(cron = "0 40 11,14,17,21 * * ?") @Scheduled(cron = "0 51 11,14,17,21 * * ?")
public void teamAccountDailyReport() { public void teamAccountDailyReport() {
LocalDateTime nowDateTime = LocalDateTime.now(); LocalDateTime nowDateTime = LocalDateTime.now();
LocalDate nowDate = LocalDate.now(); LocalDate nowDate = LocalDate.now();
@ -98,7 +98,7 @@ public class DailyReport {
var ministerUser = usersByRole.get(MINISTER_ROLE_CODE).get(0); var ministerUser = usersByRole.get(MINISTER_ROLE_CODE).get(0);
//获取账号不为空的用户 //获取账号不为空的用户
var deptUsers = dept.getUsers().stream().filter(user -> CollUtil.isEmpty(user.getAccounts())).toList(); var deptUsers = dept.getUsers().stream().filter(user -> CollUtil.isNotEmpty(user.getAccounts())).toList();
var assistants = usersByRole.get(ASSISTANT_ROLE_CODE); var assistants = usersByRole.get(ASSISTANT_ROLE_CODE);
sendDailyReport(nowDate, nowDate.atStartOfDay(), nowDateTime, ministerUser, assistants, deptUsers); sendDailyReport(nowDate, nowDate.atStartOfDay(), nowDateTime, ministerUser, assistants, deptUsers);
}); });
@ -130,7 +130,7 @@ public class DailyReport {
var ministerUser = usersByRole.get(MINISTER_ROLE_CODE).get(0); var ministerUser = usersByRole.get(MINISTER_ROLE_CODE).get(0);
//获取账号不为空的用户 //获取账号不为空的用户
var deptUsers = dept.getUsers().stream().filter(user -> CollUtil.isEmpty(user.getAccounts())).toList(); var deptUsers = dept.getUsers().stream().filter(user -> CollUtil.isNotEmpty(user.getAccounts())).toList();
var assistants = usersByRole.get(ASSISTANT_ROLE_CODE); var assistants = usersByRole.get(ASSISTANT_ROLE_CODE);
sendDailyReport(yesterday, yesterday.atStartOfDay(), LocalDateTime sendDailyReport(yesterday, yesterday.atStartOfDay(), LocalDateTime
@ -160,12 +160,8 @@ public class DailyReport {
.mapping(Map.Entry::getValue, Collectors.toList()))); .mapping(Map.Entry::getValue, Collectors.toList())));
var userWithRolesAndAccountsResps = usersByRole.get(MINISTER_ROLE_CODE); var userWithRolesAndAccountsResps = usersByRole.get(MINISTER_ROLE_CODE);
var assistants = usersByRole.get(ASSISTANT_ROLE_CODE); userWithRolesAndAccountsResps.forEach(ministerUser ->
userWithRolesAndAccountsResps.forEach(ministerUser -> { generateAndSendTeamReport(ministerUser, nowDate.atStartOfDay(), nowDateTime, null));
if (ministerUser.getNeedNotify() == DisEnableStatusEnum.ENABLE) {
generateAndSendTeamReport(ministerUser, nowDate.atStartOfDay(), nowDateTime, assistants);
}
});
}); });
} }
@ -290,7 +286,7 @@ public class DailyReport {
List<UserWithRolesAndAccountsResp> deptUsers) { List<UserWithRolesAndAccountsResp> deptUsers) {
List<CompletableFuture<Void>> tasks = new ArrayList<>(); List<CompletableFuture<Void>> tasks = new ArrayList<>();
tasks.add(generateAndSendTeamReport(ministerUser, startDateTime, endDateTime, assistants)); //tasks.add(generateAndSendTeamReport(ministerUser, startDateTime, endDateTime, assistants));
AgentDataVisualListReq agentDataVisualListReq = AgentDataVisualListReq.builder().monthDate(reportDate).build(); AgentDataVisualListReq agentDataVisualListReq = AgentDataVisualListReq.builder().monthDate(reportDate).build();

View File

@ -88,10 +88,10 @@ public class CompletableFutureWebClientService {
.onStatus(HttpStatusCode::isError, response -> Mono.error(new BusinessException("API call failed"))) .onStatus(HttpStatusCode::isError, response -> Mono.error(new BusinessException("API call failed")))
.bodyToMono(String.class) .bodyToMono(String.class)
.doOnNext(resStr -> { .doOnNext(resStr -> {
log.info("request url:{}", url); log.debug("request url:{}", url);
log.info("request headers :{}", headers); log.debug("request headers :{}", headers);
log.info("request params:{}", params); log.debug("request params:{}", params);
log.info("response {}", resStr); log.debug("response {}", resStr);
}) })
.flatMap(body -> { .flatMap(body -> {
try { try {