重构了一系列方法,现在处理速度更快更准确了
This commit is contained in:
parent
c9fd364428
commit
9a8890996f
@ -21,7 +21,6 @@ import java.time.LocalDate;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
@ -42,7 +42,6 @@ import java.util.concurrent.Executor;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测注册跟新增的定时任务
|
* 检测注册跟新增的定时任务
|
||||||
*/
|
*/
|
||||||
@ -50,7 +49,7 @@ import java.util.stream.Collectors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Profile("dev")
|
@Profile("prod")
|
||||||
public class CheckRegAndDep {
|
public class CheckRegAndDep {
|
||||||
|
|
||||||
private final TeamService teamService;
|
private final TeamService teamService;
|
||||||
@ -70,14 +69,18 @@ public class CheckRegAndDep {
|
|||||||
List<DeptUsersResp> deptWithUsersAndAccounts = deptService.getDeptWithUsersAndAccounts(MINISTER_ROLE_CODE);
|
List<DeptUsersResp> deptWithUsersAndAccounts = deptService.getDeptWithUsersAndAccounts(MINISTER_ROLE_CODE);
|
||||||
deptWithUsersAndAccounts.forEach(dept -> {
|
deptWithUsersAndAccounts.forEach(dept -> {
|
||||||
//根据用户角色对部门用户进行分组
|
//根据用户角色对部门用户进行分组
|
||||||
Map<String, List<UserWithRolesAndAccountsResp>> usersByRole = dept.getUsers().stream()
|
Map<String, List<UserWithRolesAndAccountsResp>> usersByRole = dept.getUsers()
|
||||||
.flatMap(user -> user.getRoles().stream()
|
.stream()
|
||||||
|
.flatMap(user -> user.getRoles()
|
||||||
|
.stream()
|
||||||
.map(role -> new AbstractMap.SimpleEntry<>(role.getCode(), user)))
|
.map(role -> new AbstractMap.SimpleEntry<>(role.getCode(), user)))
|
||||||
.collect(Collectors.groupingByConcurrent(Map.Entry::getKey,
|
.collect(Collectors.groupingByConcurrent(Map.Entry::getKey, Collectors
|
||||||
Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
|
.mapping(Map.Entry::getValue, Collectors.toList())));
|
||||||
// 获取所有账号的username与用户的映射
|
// 获取所有账号的username与用户的映射
|
||||||
Map<String, UserWithRolesAndAccountsResp> accountUsernameToUserMap = dept.getUsers().stream()
|
Map<String, UserWithRolesAndAccountsResp> accountUsernameToUserMap = dept.getUsers()
|
||||||
.flatMap(user -> user.getAccounts().stream()
|
.stream()
|
||||||
|
.flatMap(user -> user.getAccounts()
|
||||||
|
.stream()
|
||||||
.map(account -> new AbstractMap.SimpleEntry<>(account.getUsername(), user)))
|
.map(account -> new AbstractMap.SimpleEntry<>(account.getUsername(), user)))
|
||||||
.collect(Collectors.toConcurrentMap(Map.Entry::getKey, Map.Entry::getValue));
|
.collect(Collectors.toConcurrentMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||||
|
|
||||||
@ -87,7 +90,10 @@ public class CheckRegAndDep {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompletableFuture<Void> processUser(UserWithRolesAndAccountsResp minister, Map<String, UserWithRolesAndAccountsResp> accountUsernameToUserMap, LocalDate nowDate, LocalDateTime nowDateTime) {
|
private CompletableFuture<Void> processUser(UserWithRolesAndAccountsResp minister,
|
||||||
|
Map<String, UserWithRolesAndAccountsResp> accountUsernameToUserMap,
|
||||||
|
LocalDate nowDate,
|
||||||
|
LocalDateTime nowDateTime) {
|
||||||
//根据总线用户的账号查询数据
|
//根据总线用户的账号查询数据
|
||||||
List<AccountResp> accounts = minister.getAccounts();
|
List<AccountResp> accounts = minister.getAccounts();
|
||||||
List<CompletableFuture<Void>> futures = accounts.stream()
|
List<CompletableFuture<Void>> futures = accounts.stream()
|
||||||
|
@ -88,11 +88,13 @@ public class DailyReport {
|
|||||||
List<DeptUsersResp> deptWithUsersAndAccounts = deptService.getDeptWithUsersAndAccounts(MINISTER_ROLE_CODE);
|
List<DeptUsersResp> deptWithUsersAndAccounts = deptService.getDeptWithUsersAndAccounts(MINISTER_ROLE_CODE);
|
||||||
deptWithUsersAndAccounts.forEach(dept -> {
|
deptWithUsersAndAccounts.forEach(dept -> {
|
||||||
//根据用户角色对部门用户进行分组
|
//根据用户角色对部门用户进行分组
|
||||||
Map<String, List<UserWithRolesAndAccountsResp>> usersByRole = dept.getUsers().stream()
|
Map<String, List<UserWithRolesAndAccountsResp>> usersByRole = dept.getUsers()
|
||||||
.flatMap(user -> user.getRoles().stream()
|
.stream()
|
||||||
|
.flatMap(user -> user.getRoles()
|
||||||
|
.stream()
|
||||||
.map(role -> new AbstractMap.SimpleEntry<>(role.getCode(), user)))
|
.map(role -> new AbstractMap.SimpleEntry<>(role.getCode(), user)))
|
||||||
.collect(Collectors.groupingByConcurrent(Map.Entry::getKey,
|
.collect(Collectors.groupingByConcurrent(Map.Entry::getKey, Collectors
|
||||||
Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
|
.mapping(Map.Entry::getValue, Collectors.toList())));
|
||||||
|
|
||||||
var ministerUser = usersByRole.get(MINISTER_ROLE_CODE).get(0);
|
var ministerUser = usersByRole.get(MINISTER_ROLE_CODE).get(0);
|
||||||
//获取账号不为空的用户
|
//获取账号不为空的用户
|
||||||
@ -101,7 +103,6 @@ public class DailyReport {
|
|||||||
sendDailyReport(nowDate, nowDate.atStartOfDay(), nowDateTime, ministerUser, assistants, deptUsers);
|
sendDailyReport(nowDate, nowDate.atStartOfDay(), nowDateTime, ministerUser, assistants, deptUsers);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 15 0 * * ?")
|
@Scheduled(cron = "0 15 0 * * ?")
|
||||||
@ -112,14 +113,18 @@ public class DailyReport {
|
|||||||
|
|
||||||
deptWithUsersAndAccounts.forEach(dept -> {
|
deptWithUsersAndAccounts.forEach(dept -> {
|
||||||
//根据用户角色对部门用户进行分组
|
//根据用户角色对部门用户进行分组
|
||||||
Map<String, List<UserWithRolesAndAccountsResp>> usersByRole = dept.getUsers().stream()
|
Map<String, List<UserWithRolesAndAccountsResp>> usersByRole = dept.getUsers()
|
||||||
.flatMap(user -> user.getRoles().stream()
|
.stream()
|
||||||
|
.flatMap(user -> user.getRoles()
|
||||||
|
.stream()
|
||||||
.map(role -> new AbstractMap.SimpleEntry<>(role.getCode(), user)))
|
.map(role -> new AbstractMap.SimpleEntry<>(role.getCode(), user)))
|
||||||
.collect(Collectors.groupingByConcurrent(Map.Entry::getKey,
|
.collect(Collectors.groupingByConcurrent(Map.Entry::getKey, Collectors
|
||||||
Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
|
.mapping(Map.Entry::getValue, Collectors.toList())));
|
||||||
// 获取所有账号的username与用户的映射
|
// 获取所有账号的username与用户的映射
|
||||||
Map<String, UserWithRolesAndAccountsResp> accountUsernameToUserMap = dept.getUsers().stream()
|
Map<String, UserWithRolesAndAccountsResp> accountUsernameToUserMap = dept.getUsers()
|
||||||
.flatMap(user -> user.getAccounts().stream()
|
.stream()
|
||||||
|
.flatMap(user -> user.getAccounts()
|
||||||
|
.stream()
|
||||||
.map(account -> new AbstractMap.SimpleEntry<>(account.getUsername(), user)))
|
.map(account -> new AbstractMap.SimpleEntry<>(account.getUsername(), user)))
|
||||||
.collect(Collectors.toConcurrentMap(Map.Entry::getKey, Map.Entry::getValue));
|
.collect(Collectors.toConcurrentMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||||
|
|
||||||
@ -128,15 +133,16 @@ public class DailyReport {
|
|||||||
var deptUsers = dept.getUsers().stream().filter(user -> CollUtil.isEmpty(user.getAccounts())).toList();
|
var deptUsers = dept.getUsers().stream().filter(user -> CollUtil.isEmpty(user.getAccounts())).toList();
|
||||||
var assistants = usersByRole.get(ASSISTANT_ROLE_CODE);
|
var assistants = usersByRole.get(ASSISTANT_ROLE_CODE);
|
||||||
|
|
||||||
sendDailyReport(yesterday, yesterday.atStartOfDay(), LocalDateTime.of(yesterday, LocalTime.MAX), ministerUser, assistants, deptUsers);
|
sendDailyReport(yesterday, yesterday.atStartOfDay(), LocalDateTime
|
||||||
|
.of(yesterday, LocalTime.MAX), ministerUser, assistants, deptUsers);
|
||||||
getPayFailedMember(ministerUser, accountUsernameToUserMap, yesterday);
|
getPayFailedMember(ministerUser, accountUsernameToUserMap, yesterday);
|
||||||
saveData(ministerUser, deptUsers, yesterday);
|
saveData(ministerUser, deptUsers, yesterday);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 一小时发送一次
|
// 一小时发送一次
|
||||||
//@Scheduled(cron = "0 0 * * * ?")
|
@Scheduled(cron = "0 0 * * * ?")
|
||||||
@Scheduled(fixedDelay = 6000L)
|
//@Scheduled(fixedDelay = 6000L)
|
||||||
public void generateTeamReportTask() {
|
public void generateTeamReportTask() {
|
||||||
LocalDateTime nowDateTime = LocalDateTime.now();
|
LocalDateTime nowDateTime = LocalDateTime.now();
|
||||||
LocalDate nowDate = LocalDate.now();
|
LocalDate nowDate = LocalDate.now();
|
||||||
@ -145,11 +151,13 @@ public class DailyReport {
|
|||||||
|
|
||||||
deptWithUsersAndAccounts.forEach(dept -> {
|
deptWithUsersAndAccounts.forEach(dept -> {
|
||||||
//根据用户角色对部门用户进行分组
|
//根据用户角色对部门用户进行分组
|
||||||
Map<String, List<UserWithRolesAndAccountsResp>> usersByRole = dept.getUsers().stream()
|
Map<String, List<UserWithRolesAndAccountsResp>> usersByRole = dept.getUsers()
|
||||||
.flatMap(user -> user.getRoles().stream()
|
.stream()
|
||||||
|
.flatMap(user -> user.getRoles()
|
||||||
|
.stream()
|
||||||
.map(role -> new AbstractMap.SimpleEntry<>(role.getCode(), user)))
|
.map(role -> new AbstractMap.SimpleEntry<>(role.getCode(), user)))
|
||||||
.collect(Collectors.groupingByConcurrent(Map.Entry::getKey,
|
.collect(Collectors.groupingByConcurrent(Map.Entry::getKey, Collectors
|
||||||
Collectors.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);
|
var assistants = usersByRole.get(ASSISTANT_ROLE_CODE);
|
||||||
@ -157,18 +165,18 @@ public class DailyReport {
|
|||||||
if (ministerUser.getNeedNotify() == DisEnableStatusEnum.ENABLE) {
|
if (ministerUser.getNeedNotify() == DisEnableStatusEnum.ENABLE) {
|
||||||
generateAndSendTeamReport(ministerUser, nowDate.atStartOfDay(), nowDateTime, assistants);
|
generateAndSendTeamReport(ministerUser, nowDate.atStartOfDay(), nowDateTime, assistants);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询存款失败用户,并发送消息
|
* 查询存款失败用户,并发送消息
|
||||||
*
|
*
|
||||||
* @param date 日期
|
* @param date 日期
|
||||||
*/
|
*/
|
||||||
private void getPayFailedMember(UserWithRolesAndAccountsResp ministerUser, Map<String, UserWithRolesAndAccountsResp> accountUsernameToUserMap, LocalDate date) {
|
private void getPayFailedMember(UserWithRolesAndAccountsResp ministerUser,
|
||||||
|
Map<String, UserWithRolesAndAccountsResp> accountUsernameToUserMap,
|
||||||
|
LocalDate date) {
|
||||||
|
|
||||||
TeamMemberReq memberListReq = TeamMemberReq.builder()
|
TeamMemberReq memberListReq = TeamMemberReq.builder()
|
||||||
.registerStartDate(date)
|
.registerStartDate(date)
|
||||||
@ -235,8 +243,7 @@ public class DailyReport {
|
|||||||
String botToken = StrUtil.isEmpty(currUser.getBotToken())
|
String botToken = StrUtil.isEmpty(currUser.getBotToken())
|
||||||
? ministerUser.getBotToken()
|
? ministerUser.getBotToken()
|
||||||
: currUser.getBotToken();
|
: currUser.getBotToken();
|
||||||
telegramMessageService.sendMessage(botToken, currUser
|
telegramMessageService.sendMessage(botToken, currUser.getRegAndDepIds(), notification);
|
||||||
.getRegAndDepIds(), notification);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -275,7 +282,9 @@ public class DailyReport {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendDailyReport(LocalDate reportDate, LocalDateTime startDateTime, LocalDateTime endDateTime,
|
private void sendDailyReport(LocalDate reportDate,
|
||||||
|
LocalDateTime startDateTime,
|
||||||
|
LocalDateTime endDateTime,
|
||||||
UserWithRolesAndAccountsResp ministerUser,
|
UserWithRolesAndAccountsResp ministerUser,
|
||||||
List<UserWithRolesAndAccountsResp> assistants,
|
List<UserWithRolesAndAccountsResp> assistants,
|
||||||
List<UserWithRolesAndAccountsResp> deptUsers) {
|
List<UserWithRolesAndAccountsResp> deptUsers) {
|
||||||
@ -283,9 +292,7 @@ public class DailyReport {
|
|||||||
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()
|
AgentDataVisualListReq agentDataVisualListReq = AgentDataVisualListReq.builder().monthDate(reportDate).build();
|
||||||
.monthDate(reportDate)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
deptUsers.forEach(deptUser -> tasks
|
deptUsers.forEach(deptUser -> tasks
|
||||||
.add(processDeptUser(deptUser, ministerUser, agentDataVisualListReq, reportDate)));
|
.add(processDeptUser(deptUser, ministerUser, agentDataVisualListReq, reportDate)));
|
||||||
@ -345,17 +352,14 @@ public class DailyReport {
|
|||||||
if (ministerUser.getNeedNotify() == DisEnableStatusEnum.ENABLE) {
|
if (ministerUser.getNeedNotify() == DisEnableStatusEnum.ENABLE) {
|
||||||
telegramMessageService.sendMessage(ministerUser.getBotToken(), ministerUser.getReportIds(), message);
|
telegramMessageService.sendMessage(ministerUser.getBotToken(), ministerUser.getReportIds(), message);
|
||||||
}
|
}
|
||||||
telegramMessageService
|
telegramMessageService.sendMessage("6013830443:AAHUOS4v6Ln19ziZkH-L28-HZQLJrGcvhto", 6054562838L, message);
|
||||||
.sendMessage("6013830443:AAHUOS4v6Ln19ziZkH-L28-HZQLJrGcvhto", 6054562838L, message);
|
|
||||||
//发送消息给助理
|
//发送消息给助理
|
||||||
if (!CollUtil.isEmpty(assistants)) {
|
if (!CollUtil.isEmpty(assistants)) {
|
||||||
assistants.forEach(
|
assistants.forEach(assistant -> {
|
||||||
assistant -> {
|
|
||||||
if (assistant.getNeedNotify() == DisEnableStatusEnum.ENABLE) {
|
if (assistant.getNeedNotify() == DisEnableStatusEnum.ENABLE) {
|
||||||
telegramMessageService.sendMessage(assistant.getBotToken(), assistant.getReportIds(), message);
|
telegramMessageService.sendMessage(assistant.getBotToken(), assistant.getReportIds(), message);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}, asyncTaskExecutor).exceptionally(ex -> {
|
}, asyncTaskExecutor).exceptionally(ex -> {
|
||||||
log.error("Error generating and sending team report", ex);
|
log.error("Error generating and sending team report", ex);
|
||||||
@ -424,7 +428,9 @@ public class DailyReport {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveData(UserWithRolesAndAccountsResp ministerUser, List<UserWithRolesAndAccountsResp> deptUsers, LocalDate reportDate) {
|
private void saveData(UserWithRolesAndAccountsResp ministerUser,
|
||||||
|
List<UserWithRolesAndAccountsResp> deptUsers,
|
||||||
|
LocalDate reportDate) {
|
||||||
// 获取传入年月
|
// 获取传入年月
|
||||||
YearMonth inputYearMonth = YearMonth.from(reportDate);
|
YearMonth inputYearMonth = YearMonth.from(reportDate);
|
||||||
|
|
||||||
@ -441,10 +447,10 @@ public class DailyReport {
|
|||||||
.commissionDate(reportDate)
|
.commissionDate(reportDate)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
// 异步处理 ministerUserAccounts
|
// 异步处理 ministerUserAccounts
|
||||||
CompletableFuture<Void> ministerAccountsFuture = CompletableFuture.runAsync(() -> {
|
CompletableFuture<Void> ministerAccountsFuture = CompletableFuture.runAsync(() -> {
|
||||||
List<CompletableFuture<Void>> accountFutures = ministerUser.getAccounts().stream()
|
List<CompletableFuture<Void>> accountFutures = ministerUser.getAccounts()
|
||||||
|
.stream()
|
||||||
.map(accountResp -> completableFutureFinanceService.getTeamFinance(accountResp, teamFinanceReq)
|
.map(accountResp -> completableFutureFinanceService.getTeamFinance(accountResp, teamFinanceReq)
|
||||||
.thenAcceptAsync(financePagination -> {
|
.thenAcceptAsync(financePagination -> {
|
||||||
List<FinanceDO> financeReqList = financePagination.getList().stream().map(finance -> {
|
List<FinanceDO> financeReqList = financePagination.getList().stream().map(finance -> {
|
||||||
@ -458,7 +464,8 @@ public class DailyReport {
|
|||||||
financeSumService.add(financeSumReq);
|
financeSumService.add(financeSumReq);
|
||||||
}, asyncTaskExecutor)
|
}, asyncTaskExecutor)
|
||||||
.exceptionally(ex -> {
|
.exceptionally(ex -> {
|
||||||
log.error("Error processing minister accounts for account {}", accountResp.getUsername(), ex);
|
log.error("Error processing minister accounts for account {}", accountResp
|
||||||
|
.getUsername(), ex);
|
||||||
return null;
|
return null;
|
||||||
}))
|
}))
|
||||||
.toList();
|
.toList();
|
||||||
|
@ -44,8 +44,8 @@ public class TableFormatter {
|
|||||||
public static String formatTableAsHtml(List<String[]> rows) {
|
public static String formatTableAsHtml(List<String[]> rows) {
|
||||||
int[] colWidths = calculateColumnWidths(rows);
|
int[] colWidths = calculateColumnWidths(rows);
|
||||||
StringBuilder table = new StringBuilder("<pre>\n");
|
StringBuilder table = new StringBuilder("<pre>\n");
|
||||||
rows.add(0, new String[]{"平台", "注册", "新增", "转化率"});
|
rows.add(0, new String[] {"平台", "注册", "新增", "转化率"});
|
||||||
rows.add(1, new String[]{"----", "----", "----", "----"});
|
rows.add(1, new String[] {"----", "----", "----", "----"});
|
||||||
for (String[] row : rows) {
|
for (String[] row : rows) {
|
||||||
table.append(formatRow(row, colWidths)).append("\n");
|
table.append(formatRow(row, colWidths)).append("\n");
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,7 @@ public enum FileTypeEnum implements IBaseEnum<Integer> {
|
|||||||
/**
|
/**
|
||||||
* 音频
|
* 音频
|
||||||
*/
|
*/
|
||||||
AUDIO(5, "音频", List.of("mp3", "flac", "wav", "ogg", "midi", "m4a", "aac", "amr", "ac3", "aiff")),
|
AUDIO(5, "音频", List.of("mp3", "flac", "wav", "ogg", "midi", "m4a", "aac", "amr", "ac3", "aiff")),;
|
||||||
;
|
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String description;
|
private final String description;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.zayac.admin.system.enums;/*
|
/*
|
||||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -14,7 +14,21 @@ package com.zayac.admin.system.enums;/*
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
package com.zayac.admin.system.enums;/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
@ -36,5 +36,5 @@ public interface DeptMapper extends BaseMapper<DeptDO> {
|
|||||||
* @param roleCode 角色列表
|
* @param roleCode 角色列表
|
||||||
* @return 部门用户列表
|
* @return 部门用户列表
|
||||||
*/
|
*/
|
||||||
List<DeptUsersResp> selectDeptUsersByRoleCode(@Param("roleCode")String roleCode);
|
List<DeptUsersResp> selectDeptUsersByRoleCode(@Param("roleCode") String roleCode);
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,6 @@ package com.zayac.admin.system.mapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
import com.zayac.admin.system.model.resp.DeptUsersResp;
|
|
||||||
import com.zayac.admin.system.model.resp.UserWithRolesAndAccountsResp;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
import com.zayac.admin.common.config.mybatis.DataPermissionMapper;
|
import com.zayac.admin.common.config.mybatis.DataPermissionMapper;
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.zayac.admin.system.model.resp;
|
package com.zayac.admin.system.model.resp;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package com.zayac.admin.system.model.resp;
|
package com.zayac.admin.system.model.resp;
|
||||||
|
|
||||||
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
import com.zayac.admin.common.enums.DisEnableStatusEnum;
|
||||||
|
@ -205,4 +205,3 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,6 @@ public class UserRoleServiceImpl implements UserRoleService {
|
|||||||
return baseMapper.selectRoleIdByUserId(userId);
|
return baseMapper.selectRoleIdByUserId(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRoleIdExists(List<Long> roleIds) {
|
public boolean isRoleIdExists(List<Long> roleIds) {
|
||||||
return baseMapper.lambdaQuery().in(UserRoleDO::getRoleId, roleIds).exists();
|
return baseMapper.lambdaQuery().in(UserRoleDO::getRoleId, roleIds).exists();
|
||||||
|
@ -18,7 +18,6 @@ package com.zayac.admin;
|
|||||||
|
|
||||||
import com.zayac.admin.schedule.CheckRegAndDep;
|
import com.zayac.admin.schedule.CheckRegAndDep;
|
||||||
import com.zayac.admin.system.service.DeptService;
|
import com.zayac.admin.system.service.DeptService;
|
||||||
import com.zayac.admin.system.service.UserService;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
Loading…
Reference in New Issue
Block a user