fix: 修复一些问题
This commit is contained in:
parent
9da6db4960
commit
aca359088d
|
|
@ -314,6 +314,9 @@ public class TicketController extends ControllerBase {
|
||||||
public ApiResult<Void> addTicketHandle(@Valid @RequestBody TicketHandleAddRequest request){
|
public ApiResult<Void> addTicketHandle(@Valid @RequestBody TicketHandleAddRequest request){
|
||||||
Ticket ticket=ticketService.getById(request.getTicketId());
|
Ticket ticket=ticketService.getById(request.getTicketId());
|
||||||
List<Integer> handleIds= Arrays.stream(ticket.getHandle().split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
List<Integer> 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);
|
Ticket ticket1=ticketService.addTicketHandle(request);
|
||||||
request.getUserIds().removeAll(handleIds);
|
request.getUserIds().removeAll(handleIds);
|
||||||
if(CollectionUtil.isNotEmpty(request.getUserIds())) {
|
if(CollectionUtil.isNotEmpty(request.getUserIds())) {
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
|
||||||
List<Integer> companyIds = lambdaQuery()
|
List<Integer> companyIds = lambdaQuery()
|
||||||
.select(AppUser::getCompanyId)
|
.select(AppUser::getCompanyId)
|
||||||
.eq(AppUser::getIsPrimary, true)
|
.eq(AppUser::getIsPrimary, true)
|
||||||
|
.eq(AppUser::getIsDel, false)
|
||||||
.list()
|
.list()
|
||||||
.stream()
|
.stream()
|
||||||
.map(AppUser::getCompanyId)
|
.map(AppUser::getCompanyId)
|
||||||
|
|
@ -196,6 +197,9 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AppUser> getChildren(AppUser primaryUser) {
|
public List<AppUser> getChildren(AppUser primaryUser) {
|
||||||
|
if (!primaryUser.getIsPrimary()){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
String[] companyIds = primaryUser.getCompanyId().split(",");
|
String[] companyIds = primaryUser.getCompanyId().split(",");
|
||||||
LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(AppUser::getIsDel, false);
|
queryWrapper.eq(AppUser::getIsDel, false);
|
||||||
|
|
@ -249,13 +253,15 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
|
||||||
.eq(AppUser::getId, id)
|
.eq(AppUser::getId, id)
|
||||||
.update();
|
.update();
|
||||||
AppUser primaryUser=getById(id);
|
AppUser primaryUser=getById(id);
|
||||||
List<AppUser> children=getChildren(primaryUser);
|
if (primaryUser.getIsPrimary()) {
|
||||||
if (CollectionUtil.isNotEmpty(children)){
|
List<AppUser> children = getChildren(primaryUser);
|
||||||
lambdaUpdate()
|
if (CollectionUtil.isNotEmpty(children)) {
|
||||||
.set(AppUser::getIsDel, true)
|
lambdaUpdate()
|
||||||
.set(AppUser::getUpdateTime, LocalDateTime.now())
|
.set(AppUser::getIsDel, true)
|
||||||
.in(AppUser::getId, children.stream().map(AppUser::getId).collect(Collectors.toList()))
|
.set(AppUser::getUpdateTime, LocalDateTime.now())
|
||||||
.update();
|
.in(AppUser::getId, children.stream().map(AppUser::getId).collect(Collectors.toList()))
|
||||||
|
.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -685,7 +691,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
|
||||||
return lambdaQuery()
|
return lambdaQuery()
|
||||||
.eq(AppUser::getIsDel,false)
|
.eq(AppUser::getIsDel,false)
|
||||||
.eq(AppUser::getCompanyId, companyId.toString())
|
.eq(AppUser::getCompanyId, companyId.toString())
|
||||||
.eq(AppUser::getState, UserState.Activated.getState())
|
// .eq(AppUser::getState, UserState.Activated.getState())
|
||||||
.eq(AppUser::getIsPrimary, false)
|
.eq(AppUser::getIsPrimary, false)
|
||||||
.list()
|
.list()
|
||||||
.stream()
|
.stream()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.nflg.mobilebroken.repository.service.impl;
|
package com.nflg.mobilebroken.repository.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
|
@ -78,7 +79,9 @@ public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Diction
|
||||||
public void delete(List<Integer> ids) {
|
public void delete(List<Integer> ids) {
|
||||||
removeByIds(ids);
|
removeByIds(ids);
|
||||||
List<Integer> itemIds=dictionaryItemService.lambdaQuery().eq(DictionaryItem::getDictionaryId, ids).list().stream().map(DictionaryItem::getId).collect(Collectors.toList());
|
List<Integer> itemIds=dictionaryItemService.lambdaQuery().eq(DictionaryItem::getDictionaryId, ids).list().stream().map(DictionaryItem::getId).collect(Collectors.toList());
|
||||||
dictionaryItemService.removeByIds(itemIds);
|
if (CollectionUtil.isNotEmpty(itemIds)) {
|
||||||
dictionaryItemTranslateService.remove(new LambdaQueryWrapper<DictionaryItemTranslate>().in(DictionaryItemTranslate::getDictionaryItemId, itemIds));
|
dictionaryItemService.removeByIds(itemIds);
|
||||||
|
dictionaryItemTranslateService.remove(new LambdaQueryWrapper<DictionaryItemTranslate>().in(DictionaryItemTranslate::getDictionaryItemId, itemIds));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue