Merge branch 'master' into deploy

# Conflicts:
#	README.md
pull/875/head
Zheng Jie 2023-07-07 17:35:17 +08:00
commit e67300e919
3 changed files with 21 additions and 5 deletions

View File

@ -127,6 +127,7 @@ public class RedisConfig extends CachingConfigurerSupport {
@Bean @Bean
@Override @Override
@SuppressWarnings({"all"})
public CacheErrorHandler errorHandler() { public CacheErrorHandler errorHandler() {
// 异常处理当Redis发生异常时打印日志但是程序正常走 // 异常处理当Redis发生异常时打印日志但是程序正常走
log.info("初始化 -> [{}]", "Redis CacheErrorHandler"); log.info("初始化 -> [{}]", "Redis CacheErrorHandler");
@ -152,7 +153,6 @@ public class RedisConfig extends CachingConfigurerSupport {
} }
}; };
} }
} }
/** /**
@ -161,7 +161,7 @@ public class RedisConfig extends CachingConfigurerSupport {
* @author / * @author /
* @param <T> * @param <T>
*/ */
class FastJsonRedisSerializer<T> implements RedisSerializer<T> { class FastJsonRedisSerializer<T> implements RedisSerializer<T> {
private final Class<T> clazz; private final Class<T> clazz;
@ -180,7 +180,7 @@ public class RedisConfig extends CachingConfigurerSupport {
@Override @Override
public T deserialize(byte[] bytes) { public T deserialize(byte[] bytes) {
if (bytes == null || bytes.length <= 0) { if (bytes == null || bytes.length == 0) {
return null; return null;
} }
String str = new String(bytes, StandardCharsets.UTF_8); String str = new String(bytes, StandardCharsets.UTF_8);

View File

@ -34,6 +34,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author Zheng Jie * @author Zheng Jie
@ -71,8 +72,15 @@ public class DeptController {
for (Long id : ids) { for (Long id : ids) {
DeptDto deptDto = deptService.findById(id); DeptDto deptDto = deptService.findById(id);
List<DeptDto> depts = deptService.getSuperior(deptDto, new ArrayList<>()); List<DeptDto> depts = deptService.getSuperior(deptDto, new ArrayList<>());
for (DeptDto dept : depts) {
if(dept.getId().equals(deptDto.getPid())) {
dept.setSubCount(dept.getSubCount() - 1);
}
}
deptSet.addAll(depts); deptSet.addAll(depts);
} }
// 编辑部门时不显示自己以及自己下级的数据避免出现PID数据环形问题
deptSet = deptSet.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet());
return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptSet)),HttpStatus.OK); return new ResponseEntity<>(deptService.buildTree(new ArrayList<>(deptSet)),HttpStatus.OK);
} }

View File

@ -24,6 +24,7 @@ import me.zhengjie.modules.system.domain.Menu;
import me.zhengjie.exception.BadRequestException; import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.domain.vo.MenuVo; import me.zhengjie.modules.system.domain.vo.MenuVo;
import me.zhengjie.modules.system.service.MenuService; import me.zhengjie.modules.system.service.MenuService;
import me.zhengjie.modules.system.service.dto.DeptDto;
import me.zhengjie.modules.system.service.dto.MenuDto; import me.zhengjie.modules.system.service.dto.MenuDto;
import me.zhengjie.modules.system.service.dto.MenuQueryCriteria; import me.zhengjie.modules.system.service.dto.MenuQueryCriteria;
import me.zhengjie.modules.system.service.mapstruct.MenuMapper; import me.zhengjie.modules.system.service.mapstruct.MenuMapper;
@ -43,7 +44,6 @@ import java.util.stream.Collectors;
* @author Zheng Jie * @author Zheng Jie
* @date 2018-12-03 * @date 2018-12-03
*/ */
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@Api(tags = "系统:菜单管理") @Api(tags = "系统:菜单管理")
@ -104,8 +104,16 @@ public class MenuController {
if(CollectionUtil.isNotEmpty(ids)){ if(CollectionUtil.isNotEmpty(ids)){
for (Long id : ids) { for (Long id : ids) {
MenuDto menuDto = menuService.findById(id); MenuDto menuDto = menuService.findById(id);
menuDtos.addAll(menuService.getSuperior(menuDto, new ArrayList<>())); List<MenuDto> menuDtoList = menuService.getSuperior(menuDto, new ArrayList<>());
for (MenuDto menu : menuDtoList) {
if(menu.getId().equals(menuDto.getPid())) {
menu.setSubCount(menu.getSubCount() - 1);
}
}
menuDtos.addAll(menuDtoList);
} }
// 编辑菜单时不显示自己以及自己下级的数据避免出现PID数据环形问题
menuDtos = menuDtos.stream().filter(i -> !ids.contains(i.getId())).collect(Collectors.toSet());
return new ResponseEntity<>(menuService.buildTree(new ArrayList<>(menuDtos)),HttpStatus.OK); return new ResponseEntity<>(menuService.buildTree(new ArrayList<>(menuDtos)),HttpStatus.OK);
} }
return new ResponseEntity<>(menuService.getMenus(null),HttpStatus.OK); return new ResponseEntity<>(menuService.getMenus(null),HttpStatus.OK);