From aca359088de1343ac22ff941693681b214c9ee2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Tue, 4 Mar 2025 19:25:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/TicketController.java | 3 +++ .../service/impl/AppUserServiceImpl.java | 22 ++++++++++++------- .../service/impl/DictionaryServiceImpl.java | 7 ++++-- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/nflg-mobilebroken-admin/src/main/java/com/nflg/mobilebroken/admin/controller/TicketController.java b/nflg-mobilebroken-admin/src/main/java/com/nflg/mobilebroken/admin/controller/TicketController.java index f177ad02..d5db4dba 100644 --- a/nflg-mobilebroken-admin/src/main/java/com/nflg/mobilebroken/admin/controller/TicketController.java +++ b/nflg-mobilebroken-admin/src/main/java/com/nflg/mobilebroken/admin/controller/TicketController.java @@ -314,6 +314,9 @@ public class TicketController extends ControllerBase { public ApiResult addTicketHandle(@Valid @RequestBody TicketHandleAddRequest request){ Ticket ticket=ticketService.getById(request.getTicketId()); List handleIds= Arrays.stream(ticket.getHandle().split(",")).map(Integer::parseInt).collect(Collectors.toList()); + VUtils.trueThrowBusinessError(handleIds.stream().anyMatch(uid -> Objects.equals(uid, AdminUserUtil.getUserId())) + && request.getUserIds().stream().noneMatch(uid -> Objects.equals(uid, AdminUserUtil.getUserId()))) + .throwMessage("不可以移除自己"); Ticket ticket1=ticketService.addTicketHandle(request); request.getUserIds().removeAll(handleIds); if(CollectionUtil.isNotEmpty(request.getUserIds())) { diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/AppUserServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/AppUserServiceImpl.java index 6bdce6d6..815dbe9e 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/AppUserServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/AppUserServiceImpl.java @@ -138,6 +138,7 @@ public class AppUserServiceImpl extends ServiceImpl impl List companyIds = lambdaQuery() .select(AppUser::getCompanyId) .eq(AppUser::getIsPrimary, true) + .eq(AppUser::getIsDel, false) .list() .stream() .map(AppUser::getCompanyId) @@ -196,6 +197,9 @@ public class AppUserServiceImpl extends ServiceImpl impl @Override public List getChildren(AppUser primaryUser) { + if (!primaryUser.getIsPrimary()){ + return Collections.emptyList(); + } String[] companyIds = primaryUser.getCompanyId().split(","); LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(AppUser::getIsDel, false); @@ -249,13 +253,15 @@ public class AppUserServiceImpl extends ServiceImpl impl .eq(AppUser::getId, id) .update(); AppUser primaryUser=getById(id); - List children=getChildren(primaryUser); - if (CollectionUtil.isNotEmpty(children)){ - lambdaUpdate() - .set(AppUser::getIsDel, true) - .set(AppUser::getUpdateTime, LocalDateTime.now()) - .in(AppUser::getId, children.stream().map(AppUser::getId).collect(Collectors.toList())) - .update(); + if (primaryUser.getIsPrimary()) { + List children = getChildren(primaryUser); + if (CollectionUtil.isNotEmpty(children)) { + lambdaUpdate() + .set(AppUser::getIsDel, true) + .set(AppUser::getUpdateTime, LocalDateTime.now()) + .in(AppUser::getId, children.stream().map(AppUser::getId).collect(Collectors.toList())) + .update(); + } } } @@ -685,7 +691,7 @@ public class AppUserServiceImpl extends ServiceImpl impl return lambdaQuery() .eq(AppUser::getIsDel,false) .eq(AppUser::getCompanyId, companyId.toString()) - .eq(AppUser::getState, UserState.Activated.getState()) +// .eq(AppUser::getState, UserState.Activated.getState()) .eq(AppUser::getIsPrimary, false) .list() .stream() diff --git a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DictionaryServiceImpl.java b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DictionaryServiceImpl.java index 2f8fda23..e50ef60c 100644 --- a/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DictionaryServiceImpl.java +++ b/nflg-mobilebroken-repository/src/main/java/com/nflg/mobilebroken/repository/service/impl/DictionaryServiceImpl.java @@ -1,5 +1,6 @@ package com.nflg.mobilebroken.repository.service.impl; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -78,7 +79,9 @@ public class DictionaryServiceImpl extends ServiceImpl ids) { removeByIds(ids); List itemIds=dictionaryItemService.lambdaQuery().eq(DictionaryItem::getDictionaryId, ids).list().stream().map(DictionaryItem::getId).collect(Collectors.toList()); - dictionaryItemService.removeByIds(itemIds); - dictionaryItemTranslateService.remove(new LambdaQueryWrapper().in(DictionaryItemTranslate::getDictionaryItemId, itemIds)); + if (CollectionUtil.isNotEmpty(itemIds)) { + dictionaryItemService.removeByIds(itemIds); + dictionaryItemTranslateService.remove(new LambdaQueryWrapper().in(DictionaryItemTranslate::getDictionaryItemId, itemIds)); + } } }