mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-11 13:19:01 +08:00
refactor(stream): 替换Collectors.toList()为toList()方法
- 优化代码简洁性,使用Java 16引入的Stream.toList()替代Collectors.toList() - 统一代码风格,减少冗余代码 - 提升代码可读性,简化stream操作
This commit is contained in:
1 parent
e2e73dffda
commit
a970fe166a
44 files changed
+190
-224
No files matched your search
+1
-2
@@ -15,7 +15,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 页面管理
|
||||
@@ -60,7 +59,7 @@ public class AppPageController {
|
||||
|
||||
if (CollUtil.isNotEmpty(pageEntityList)) {
|
||||
// 删掉原来类型的页面数据
|
||||
pageService.removeByIds(pageEntityList.stream().map(AppPageEntity::getId).collect(Collectors.toList()));
|
||||
pageService.removeByIds(pageEntityList.stream().map(AppPageEntity::getId).toList());
|
||||
}
|
||||
|
||||
page.setPageName(PageTypeEnums.getNameByType(page.getPageType()));
|
||||
|
||||
+2
-3
@@ -13,7 +13,6 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 底部导航
|
||||
@@ -45,8 +44,8 @@ public class AppTabbarController {
|
||||
@PutMapping
|
||||
public R update(@RequestBody List<AppTabbarEntity> tabbarEntityList) {
|
||||
// 删除不在新增范围的导航菜单
|
||||
List<Long> idList = tabbarService.list().stream().map(AppTabbarEntity::getId).collect(Collectors.toList());
|
||||
List<Long> newIdList = tabbarEntityList.stream().map(AppTabbarEntity::getId).collect(Collectors.toList());
|
||||
List<Long> idList = tabbarService.list().stream().map(AppTabbarEntity::getId).toList();
|
||||
List<Long> newIdList = tabbarEntityList.stream().map(AppTabbarEntity::getId).toList();
|
||||
|
||||
// 计算需要删除的 ID 列表
|
||||
List<Long> idsToRemove = CollUtil.subtractToList(idList, newIdList);
|
||||
|
||||
@@ -64,7 +64,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -213,7 +212,7 @@ public class PigxTokenEndpoint {
|
||||
int current = MapUtil.getInt(params, CommonConstants.CURRENT);
|
||||
int size = MapUtil.getInt(params, CommonConstants.SIZE);
|
||||
Set<String> keys = redisTemplate.keys(key);
|
||||
List<String> pages = keys.stream().skip((current - 1) * size).limit(size).collect(Collectors.toList());
|
||||
List<String> pages = keys.stream().skip((current - 1) * size).limit(size).toList();
|
||||
Page<TokenVO> result = new Page(current, size);
|
||||
|
||||
List<TokenVO> tokenVoList = redisTemplate.opsForValue().multiGet(pages).stream().map(obj -> {
|
||||
@@ -250,7 +249,7 @@ public class PigxTokenEndpoint {
|
||||
return true;
|
||||
}
|
||||
return tokenVo.getUsername().contains(username);
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
result.setRecords(tokenVoList);
|
||||
result.setTotal(keys.size());
|
||||
return R.ok(result);
|
||||
|
||||
+52
-53
@@ -35,7 +35,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -46,65 +45,65 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class SqlFilterArgumentResolver implements HandlerMethodArgumentResolver {
|
||||
|
||||
/**
|
||||
* 判断Controller是否包含page 参数
|
||||
*
|
||||
* @param parameter 参数
|
||||
* @return 是否过滤
|
||||
*/
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
return parameter.getParameterType().equals(Page.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断Controller是否包含page 参数
|
||||
*
|
||||
* @param parameter 参数
|
||||
* @return 是否过滤
|
||||
*/
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
return parameter.getParameterType().equals(Page.class);
|
||||
}
|
||||
/**
|
||||
* @param parameter 入参集合
|
||||
* @param mavContainer model 和 view
|
||||
* @param webRequest web相关
|
||||
* @param binderFactory 入参解析
|
||||
* @return 检查后新的page对象
|
||||
* <p>
|
||||
* page 只支持查询 GET .如需解析POST获取请求报文体处理
|
||||
*/
|
||||
@Override
|
||||
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
|
||||
|
||||
/**
|
||||
* @param parameter 入参集合
|
||||
* @param mavContainer model 和 view
|
||||
* @param webRequest web相关
|
||||
* @param binderFactory 入参解析
|
||||
* @return 检查后新的page对象
|
||||
* <p>
|
||||
* page 只支持查询 GET .如需解析POST获取请求报文体处理
|
||||
*/
|
||||
@Override
|
||||
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {
|
||||
HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
|
||||
|
||||
HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
|
||||
String ascs = request.getParameter("ascs");
|
||||
String descs = request.getParameter("descs");
|
||||
|
||||
String ascs = request.getParameter("ascs");
|
||||
String descs = request.getParameter("descs");
|
||||
String current = request.getParameter("current");
|
||||
String size = request.getParameter("size");
|
||||
|
||||
String current = request.getParameter("current");
|
||||
String size = request.getParameter("size");
|
||||
Page page = new Page();
|
||||
if (StrUtil.isNotBlank(current)) {
|
||||
// 如果current page 小于零 视为不合法数据
|
||||
if (CompareUtil.compare(Long.parseLong(current), 0L) < 0) {
|
||||
throw new CheckedException("current page error");
|
||||
}
|
||||
page.setCurrent(Long.parseLong(current));
|
||||
}
|
||||
|
||||
Page page = new Page();
|
||||
if (StrUtil.isNotBlank(current)) {
|
||||
// 如果current page 小于零 视为不合法数据
|
||||
if (CompareUtil.compare(Long.parseLong(current), 0L) < 0) {
|
||||
throw new CheckedException("current page error");
|
||||
}
|
||||
page.setCurrent(Long.parseLong(current));
|
||||
}
|
||||
if (StrUtil.isNotBlank(size)) {
|
||||
page.setSize(Long.parseLong(size));
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(size)) {
|
||||
page.setSize(Long.parseLong(size));
|
||||
}
|
||||
List<OrderItem> orderItemList = new ArrayList<>();
|
||||
Optional.ofNullable(ascs)
|
||||
.ifPresent(s -> orderItemList.addAll(Arrays.stream(s.split(StrUtil.COMMA))
|
||||
.filter(asc -> !SqlInjectionUtils.check(asc))
|
||||
.map(OrderItem::asc)
|
||||
.toList()));
|
||||
Optional.ofNullable(descs)
|
||||
.ifPresent(s -> orderItemList.addAll(Arrays.stream(s.split(StrUtil.COMMA))
|
||||
.filter(desc -> !SqlInjectionUtils.check(desc))
|
||||
.map(OrderItem::desc)
|
||||
.toList()));
|
||||
page.addOrder(orderItemList);
|
||||
|
||||
List<OrderItem> orderItemList = new ArrayList<>();
|
||||
Optional.ofNullable(ascs)
|
||||
.ifPresent(s -> orderItemList.addAll(Arrays.stream(s.split(StrUtil.COMMA))
|
||||
.filter(asc -> !SqlInjectionUtils.check(asc))
|
||||
.map(OrderItem::asc)
|
||||
.collect(Collectors.toList())));
|
||||
Optional.ofNullable(descs)
|
||||
.ifPresent(s -> orderItemList.addAll(Arrays.stream(s.split(StrUtil.COMMA))
|
||||
.filter(desc -> !SqlInjectionUtils.check(desc))
|
||||
.map(OrderItem::desc)
|
||||
.collect(Collectors.toList())));
|
||||
page.addOrder(orderItemList);
|
||||
return page;
|
||||
}
|
||||
|
||||
return page;
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -12,7 +12,6 @@ import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.util.PropertyPlaceholderHelper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 对表头进行国际化处理
|
||||
@@ -52,7 +51,7 @@ public class I18nHeaderCellWriteHandler implements CellWriteHandler {
|
||||
// 国际化处理
|
||||
List<String> i18nHeadNames = originHeadNameList.stream()
|
||||
.map(headName -> propertyPlaceholderHelper.replacePlaceholders(headName, placeholderResolver))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
head.setHeadNameList(i18nHeadNames);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -32,7 +32,6 @@ import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -66,7 +65,7 @@ public class VersionGrayLoadBalancer implements GrayLoadBalancer {
|
||||
// 过滤出不含VERSION实例
|
||||
List<ServiceInstance> versionInstanceList = instances.stream()
|
||||
.filter(instance -> !instance.getMetadata().containsKey(CommonConstants.VERSION))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (CollUtil.isEmpty(versionInstanceList)) {
|
||||
// 根据权重获取实例
|
||||
return randomByWeight(instances);
|
||||
@@ -78,7 +77,7 @@ public class VersionGrayLoadBalancer implements GrayLoadBalancer {
|
||||
List<ServiceInstance> availableList = instances.stream()
|
||||
.filter(instance -> reqVersion
|
||||
.equalsIgnoreCase(MapUtil.getStr(instance.getMetadata(), CommonConstants.VERSION)))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (CollUtil.isEmpty(availableList)) {
|
||||
// 根据权重获取实例
|
||||
return randomByWeight(instances);
|
||||
|
||||
+2
-3
@@ -20,7 +20,6 @@ import reactor.core.publisher.Mono;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -78,7 +77,7 @@ public class GrayRoundRobinLoadBalancer extends RoundRobinLoadBalancer {
|
||||
// 过滤出不含VERSION实例
|
||||
List<ServiceInstance> versionInstanceList = instances.stream()
|
||||
.filter(instance -> !instance.getMetadata().containsKey(CommonConstants.VERSION))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (CollUtil.isEmpty(versionInstanceList)) {
|
||||
// 根据权重获取实例
|
||||
return new DefaultResponse(randomByWeight(instances));
|
||||
@@ -93,7 +92,7 @@ public class GrayRoundRobinLoadBalancer extends RoundRobinLoadBalancer {
|
||||
Map<String, String> metadata = nacosInstance.getMetadata();
|
||||
String targetVersion = MapUtil.getStr(metadata, CommonConstants.VERSION);
|
||||
return reqVersion.equalsIgnoreCase(targetVersion);
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
|
||||
// 存在 随机返回
|
||||
if (CollUtil.isNotEmpty(serviceInstanceList)) {
|
||||
|
||||
+2
-3
@@ -14,7 +14,6 @@ import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 本地文件读取模式
|
||||
@@ -47,7 +46,7 @@ public class LocalFileTemplate implements FileTemplate {
|
||||
return Arrays.stream(FileUtil.ls(properties.getLocal().getBasePath()))
|
||||
.filter(FileUtil::isDirectory)
|
||||
.map(dir -> new Bucket(dir.getName()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +166,7 @@ public class LocalFileTemplate implements FileTemplate {
|
||||
S3ObjectSummary summary = new S3ObjectSummary();
|
||||
summary.setKey(file.getName());
|
||||
return summary;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
}
|
||||
|
||||
}
|
||||
+2
-3
@@ -38,7 +38,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 工作流控制器 负责流程模型的创建、启动、审批等功能
|
||||
@@ -143,7 +142,7 @@ public class EngineFlowController {
|
||||
.list()
|
||||
.stream()
|
||||
.map(Execution::getId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
// 更改活动状态为结束
|
||||
runtimeService.createChangeActivityStateBuilder()
|
||||
.moveExecutionsToSingleActivityId(executionIds, "end")
|
||||
@@ -244,7 +243,7 @@ public class EngineFlowController {
|
||||
if (CollUtil.isNotEmpty(processInstanceList)) {
|
||||
taskQuery.processInstanceIdIn(processInstanceList.stream()
|
||||
.map(ProcessInstance::getProcessInstanceId)
|
||||
.collect(Collectors.toList()));
|
||||
.toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -25,7 +25,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 表达式解析
|
||||
@@ -236,7 +235,7 @@ public class ExpressionHandler {
|
||||
List<NodeUser> paramDeptList = objectMapper.readValue(param, new TypeReference<List<NodeUser>>() {
|
||||
});
|
||||
Long deptId = nodeUserDto.getId();
|
||||
List<Long> deptIdList = paramDeptList.stream().map(NodeUser::getId).collect(Collectors.toList());
|
||||
List<Long> deptIdList = paramDeptList.stream().map(NodeUser::getId).toList();
|
||||
|
||||
return inCompare(symbol, deptId, deptIdList);
|
||||
|
||||
@@ -292,12 +291,12 @@ public class ExpressionHandler {
|
||||
List<Long> deptIdList = paramDeptList.stream()
|
||||
.filter(w -> StrUtil.equals(w.getType(), NodeUserTypeEnum.DEPT.getKey()))
|
||||
.map(NodeUser::getId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
List<Long> userIdList = paramDeptList.stream()
|
||||
.filter(w -> StrUtil.equals(w.getType(), NodeUserTypeEnum.USER.getKey()))
|
||||
.map(NodeUser::getId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
if (CollUtil.isNotEmpty(deptIdList)) {
|
||||
R<List<SysUser>> r = remoteUserService.getUserIdListByDeptIdList(deptIdList);
|
||||
|
||||
+2
-3
@@ -15,7 +15,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 指定具体用户
|
||||
@@ -46,12 +45,12 @@ public class AssignUserFixedStrategyImpl implements AssignUserStrategy {
|
||||
List<Long> userIdList = userDtoList.stream()
|
||||
.filter(w -> StrUtil.equals(w.getType(), NodeUserTypeEnum.USER.getKey()))
|
||||
.map(NodeUser::getId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
// 部门ID列表
|
||||
List<Long> deptIdList = userDtoList.stream()
|
||||
.filter(w -> StrUtil.equals(w.getType(), NodeUserTypeEnum.DEPT.getKey()))
|
||||
.map(NodeUser::getId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
if (CollUtil.isNotEmpty(deptIdList)) {
|
||||
R<List<SysUser>> r = remoteUserService.getUserIdListByDeptIdList(deptIdList);
|
||||
|
||||
+1
-2
@@ -15,7 +15,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
@@ -45,7 +44,7 @@ public class AssignUserLeaderStrategyImpl implements AssignUserStrategy {
|
||||
.map(nodeUser -> deptService.getAllDeptLeader(nodeUser.getId()))
|
||||
.flatMap((Function<R<List<Long>>, Stream<Long>>) listR -> listR.getData() == null ? null
|
||||
: listR.getData().stream())
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
}
|
||||
+1
-2
@@ -13,7 +13,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 来自角色
|
||||
@@ -38,7 +37,7 @@ public class AssignUserRoleStrategyImpl implements AssignUserStrategy {
|
||||
@Override
|
||||
public List<Long> handle(Node node, NodeUser rootUser, Map<String, Object> variables) {
|
||||
// 使用 lambda 表达式和方法引用从 NodeUser 列表中提取角色 ID
|
||||
List<Long> roleIds = node.getNodeUserList().stream().map(NodeUser::getId).collect(Collectors.toList());
|
||||
List<Long> roleIds = node.getNodeUserList().stream().map(NodeUser::getId).toList();
|
||||
// 提取 Optional 结果中的数据
|
||||
List<Long> data = RetOps.of(remoteUserService.getUserIdListByRoleIdList(roleIds))
|
||||
.getData()
|
||||
|
||||
+2
-3
@@ -20,7 +20,6 @@ import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 抄送任务处理器--java服务任务
|
||||
@@ -48,12 +47,12 @@ public class CopyServiceTask implements JavaDelegate {
|
||||
List<String> userIdList = userDtoList.stream()
|
||||
.filter(w -> StrUtil.equals(w.getType(), NodeUserTypeEnum.USER.getKey()))
|
||||
.map(w -> Convert.toStr(w.getId()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
// 部门ID列表
|
||||
List<String> deptIdList = userDtoList.stream()
|
||||
.filter(w -> StrUtil.equals(w.getType(), NodeUserTypeEnum.DEPT.getKey()))
|
||||
.map(w -> Convert.toStr(w.getId()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
if (CollUtil.isNotEmpty(deptIdList)) {
|
||||
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ public class CombinationGroupServiceImpl implements ICombinationGroupService {
|
||||
Map<Long, Boolean> existMap = new HashMap<>();
|
||||
|
||||
if (!processList.isEmpty()) {
|
||||
List<Long> idList = processList.stream().map(Process::getId).collect(Collectors.toList());
|
||||
List<Long> idList = processList.stream().map(Process::getId).toList();
|
||||
// 查询发起人集合
|
||||
List<ProcessStarter> processStarterList = processStarterService.lambdaQuery()
|
||||
.in(ProcessStarter::getProcessId, idList)
|
||||
|
||||
+3
-3
@@ -106,7 +106,7 @@ public class ProcessInstanceServiceImpl implements IProcessInstanceService {
|
||||
|
||||
// 发起人
|
||||
// 发起人
|
||||
List<Long> collect = processInstanceRecordList.stream().map(ProcessInstanceRecord::getUserId).collect(Collectors.toList());
|
||||
List<Long> collect = processInstanceRecordList.stream().map(ProcessInstanceRecord::getUserId).toList();
|
||||
List<SysUser> startUserList = userService.getUserById(collect).getData();
|
||||
|
||||
Page<TaskDto> pageResultDto = r.getData();
|
||||
@@ -167,7 +167,7 @@ public class ProcessInstanceServiceImpl implements IProcessInstanceService {
|
||||
.list();
|
||||
|
||||
// 发起人
|
||||
List<Long> collect = processInstanceRecordList.stream().map(ProcessInstanceRecord::getUserId).collect(Collectors.toList());
|
||||
List<Long> collect = processInstanceRecordList.stream().map(ProcessInstanceRecord::getUserId).toList();
|
||||
List<SysUser> startUserList = userService.getUserById(collect).getData();
|
||||
|
||||
List<TaskDto> taskDtoList = new ArrayList<>();
|
||||
@@ -273,7 +273,7 @@ public class ProcessInstanceServiceImpl implements IProcessInstanceService {
|
||||
|
||||
if (CollUtil.isNotEmpty(records)) {
|
||||
// 发起人
|
||||
List<Long> userIdList = records.stream().map(ProcessCopy::getStartUserId).collect(Collectors.toList());
|
||||
List<Long> userIdList = records.stream().map(ProcessCopy::getStartUserId).toList();
|
||||
List<SysUser> startUserList = userService.getUserById(userIdList).getData();
|
||||
|
||||
for (ProcessCopyVo record : processCopyVoList) {
|
||||
|
||||
+2
-3
@@ -24,7 +24,6 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@@ -115,7 +114,7 @@ public class RemoteServiceImpl implements IRemoteService {
|
||||
List<SysDept> allDept = deptService.getAllDept(null).getData();
|
||||
List<SysDept> childrenDeptList = DataUtil.selectChildrenByDept(parentId, allDept);
|
||||
|
||||
List<Long> childrenDeptIdList = childrenDeptList.stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
||||
List<Long> childrenDeptIdList = childrenDeptList.stream().map(SysDept::getDeptId).toList();
|
||||
childrenDeptIdList.remove(parentId);
|
||||
|
||||
List<Long> remainIdList = CollUtil.removeAny(deptIdList, ArrayUtil.toArray(childrenDeptIdList, Long.class));
|
||||
@@ -150,7 +149,7 @@ public class RemoteServiceImpl implements IRemoteService {
|
||||
// 查询父级包括自己
|
||||
List<SysDept> allDept = deptService.getAllDept(null).getData();
|
||||
List<SysDept> parentDeptList = DataUtil.selectParentByDept(childId, allDept);
|
||||
List<Long> parentDeptIdList = parentDeptList.stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
||||
List<Long> parentDeptIdList = parentDeptList.stream().map(SysDept::getDeptId).toList();
|
||||
parentDeptIdList.remove(childId);
|
||||
List<Long> remainIdList = CollUtil.removeAny(deptIdList, ArrayUtil.toArray(parentDeptIdList, Long.class));
|
||||
return R.ok(remainIdList.isEmpty());
|
||||
|
||||
+1
-2
@@ -26,7 +26,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@@ -246,7 +245,7 @@ public class TaskServiceImpl implements ITaskService {
|
||||
.eq(ProcessInstanceRecord::getParentProcessInstanceId, processInstanceId)
|
||||
.list();
|
||||
|
||||
List<String> collect = list.stream().map(w -> w.getProcessInstanceId()).collect(Collectors.toList());
|
||||
List<String> collect = list.stream().map(w -> w.getProcessInstanceId()).toList();
|
||||
|
||||
for (ProcessInstanceRecord processInstanceRecord : list) {
|
||||
List<String> allStopProcessInstanceIdList = getAllStopProcessInstanceIdList(
|
||||
|
||||
+2
-3
@@ -6,7 +6,6 @@ import com.pig4cloud.pigx.admin.api.entity.SysMenu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DataUtil {
|
||||
|
||||
@@ -42,7 +41,7 @@ public class DataUtil {
|
||||
|
||||
List<SysDept> collect = allDeptList.stream()
|
||||
.filter(w -> w.getParentId() == deptId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
}
|
||||
@@ -66,7 +65,7 @@ public class DataUtil {
|
||||
|
||||
List<SysMenu> collect = allMenuList.stream()
|
||||
.filter(w -> w.getParentId() == menuId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
}
|
||||
|
||||
+2
-2
@@ -279,12 +279,12 @@ public class NodeFormatUtil {
|
||||
List<Long> userIdList = nodeUserList.stream()
|
||||
.filter(w -> StrUtil.equals(w.getType(), NodeUserTypeEnum.USER.getKey()))
|
||||
.map(w -> Convert.toLong(w.getId()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
// 部门id
|
||||
List<Long> deptIdList = nodeUserList.stream()
|
||||
.filter(w -> StrUtil.equals(w.getType(), NodeUserTypeEnum.DEPT.getKey()))
|
||||
.map(w -> Convert.toLong(w.getId()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
if (CollUtil.isNotEmpty(deptIdList)) {
|
||||
|
||||
|
||||
@@ -25,9 +25,11 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.pig4cloud.pigx.common.core.util.TenantTable;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.javers.core.metamodel.annotation.DiffInclude;
|
||||
import org.javers.core.metamodel.annotation.PropertyName;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -42,8 +44,10 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@TenantTable
|
||||
@Schema(description = "用户")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysUser extends Model<SysUser> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
||||
+2
-3
@@ -8,7 +8,6 @@ import lombok.experimental.UtilityClass;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@UtilityClass
|
||||
public class DataUtil {
|
||||
@@ -49,7 +48,7 @@ public class DataUtil {
|
||||
|
||||
List<SysDept> collect = allDeptList.stream()
|
||||
.filter(w -> w.getParentId() == deptId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
@@ -75,7 +74,7 @@ public class DataUtil {
|
||||
|
||||
List<SysMenu> collect = allMenuList.stream()
|
||||
.filter(w -> w.getParentId() == menuId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
}
|
||||
|
||||
+1
-2
@@ -36,7 +36,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -87,7 +86,7 @@ public class SysMenuController {
|
||||
@GetMapping("/tree/{roleId}")
|
||||
public R getRoleTree(@PathVariable Long roleId) {
|
||||
return R
|
||||
.ok(sysMenuService.findMenuByRoleId(roleId).stream().map(SysMenu::getMenuId).collect(Collectors.toList()));
|
||||
.ok(sysMenuService.findMenuByRoleId(roleId).stream().map(SysMenu::getMenuId).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 敏感词
|
||||
@@ -67,7 +66,7 @@ public class SysSensitiveWordController {
|
||||
@GetMapping("/remote/list/{type}")
|
||||
public R list(@PathVariable String type) {
|
||||
return R.ok(sysSensitiveWordService.list(Wrappers.<SysSensitiveWordEntity>lambdaQuery()
|
||||
.eq(SysSensitiveWordEntity::getSensitiveType, type)).stream().map(SysSensitiveWordEntity::getSensitiveWord).collect(Collectors.toList()));
|
||||
.eq(SysSensitiveWordEntity::getSensitiveType, type)).stream().map(SysSensitiveWordEntity::getSensitiveWord).toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -45,7 +45,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 租户管理
|
||||
@@ -147,7 +146,7 @@ public class SysTenantController {
|
||||
.stream()
|
||||
.filter(tenant -> tenant.getStartTime().isBefore(LocalDateTime.now()))
|
||||
.filter(tenant -> tenant.getEndTime().isAfter(LocalDateTime.now()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
return R.ok(tenants);
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -47,7 +47,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 互联平台实现
|
||||
@@ -87,7 +86,7 @@ public class ConnectServiceImpl implements ConnectService {
|
||||
List<SysDept> insertDept = queryChildDept(req, getDingAccessToken(), deptList);
|
||||
|
||||
// 去重
|
||||
List<SysDept> syncDept = insertDept.stream().distinct().collect(Collectors.toList());
|
||||
List<SysDept> syncDept = insertDept.stream().distinct().toList();
|
||||
|
||||
// 保存部门以及部门关系
|
||||
if (CollectionUtils.isNotEmpty(syncDept)) {
|
||||
@@ -316,7 +315,7 @@ public class ConnectServiceImpl implements ConnectService {
|
||||
sysDept.setParentId(Convert.toLong(dept.get("parent_id")));
|
||||
return sysDept;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
// 递归查询下一级
|
||||
if (CollectionUtils.isNotEmpty(depts)) {
|
||||
|
||||
+5
-6
@@ -45,7 +45,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -78,7 +77,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean removeDeptById(Long id) {
|
||||
// 级联删除部门
|
||||
List<Long> idList = this.listDescendant(id).stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
||||
List<Long> idList = this.listDescendant(id).stream().map(SysDept::getDeptId).toList();
|
||||
|
||||
Optional.ofNullable(idList).filter(CollUtil::isNotEmpty).ifPresent(this::removeByIds);
|
||||
|
||||
@@ -122,7 +121,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
treeNode.setExtra(extra);
|
||||
return treeNode;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
// 模糊查询 不组装树结构 直接返回 表格方便编辑
|
||||
if (StrUtil.isNotBlank(deptName)) {
|
||||
@@ -131,7 +130,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
tree.putAll(node.getExtra());
|
||||
BeanUtils.copyProperties(node, tree);
|
||||
return tree;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
}
|
||||
|
||||
return TreeUtil.build(collect, parentId == null ? 0 : parentId);
|
||||
@@ -155,7 +154,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
deptExcelVo.setParentName(first.orElse("根部门"));
|
||||
deptExcelVo.setSortOrder(item.getSortOrder());
|
||||
return deptExcelVo;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
return deptExcelVos;
|
||||
}
|
||||
|
||||
@@ -338,7 +337,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
orgTreeVo.setAvatar(user.getAvatar());
|
||||
return orgTreeVo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -35,7 +35,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 字典表
|
||||
@@ -63,7 +62,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
.stream()
|
||||
.filter(sysDict -> !sysDict.getSystemFlag().equals(DictTypeEnum.SYSTEM.getType()))// 系统内置类型不删除
|
||||
.map(SysDict::getId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
baseMapper.deleteByIds(dictIdList);
|
||||
|
||||
|
||||
+2
-2
@@ -74,7 +74,7 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
||||
log.setRequestUri(pre.getUrl());
|
||||
log.setCreateBy(pre.getUser());
|
||||
return log;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
return this.saveBatch(sysLogs);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
||||
})
|
||||
// 按createTime升序排序
|
||||
.sorted(Comparator.comparing(map -> map.get(SysLog.Fields.createTime).toString()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
}
|
||||
+3
-4
@@ -52,7 +52,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -116,7 +115,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
.orderByAsc(SysMenu::getSortOrder))
|
||||
.stream()
|
||||
.map(getNodeFunction())
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
// 模糊查询 不组装树结构 直接返回 表格方便编辑
|
||||
if (StrUtil.isNotBlank(menuName)) {
|
||||
@@ -125,7 +124,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
tree.putAll(node.getExtra());
|
||||
BeanUtils.copyProperties(node, tree);
|
||||
return tree;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
}
|
||||
|
||||
return TreeUtil.build(collect, parent);
|
||||
@@ -144,7 +143,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
List<TreeNode<Long>> collect = all.stream().filter(menuTypePredicate(type)).peek(item -> {
|
||||
Optional<SysI18nEntity> first = list.stream().filter(it -> it.getZhCn().equals(item.getName())).findFirst();
|
||||
first.ifPresent(sysI18nEntity -> item.setName(sysI18nEntity.getName()));
|
||||
}).map(getNodeFunction()).collect(Collectors.toList());
|
||||
}).map(getNodeFunction()).toList();
|
||||
|
||||
Long parent = parentId == null ? CommonConstants.MENU_TREE_ROOT_ID : parentId;
|
||||
return TreeUtil.build(collect, parent);
|
||||
|
||||
+2
-3
@@ -86,7 +86,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 站内信息
|
||||
@@ -214,7 +213,7 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
||||
if (messageEntity.getAllFlag().equals(YesNoEnum.YES.getCode())) {
|
||||
return SysMessageVO;
|
||||
}
|
||||
List<Long> userIdList = relationMapper.selectList(Wrappers.<SysMessageRelationEntity>lambdaQuery().eq(SysMessageRelationEntity::getMsgId, id)).stream().map(SysMessageRelationEntity::getUserId).collect(Collectors.toList());
|
||||
List<Long> userIdList = relationMapper.selectList(Wrappers.<SysMessageRelationEntity>lambdaQuery().eq(SysMessageRelationEntity::getMsgId, id)).stream().map(SysMessageRelationEntity::getUserId).toList();
|
||||
|
||||
if (CollUtil.isNotEmpty(userIdList)) {
|
||||
List<OrgTreeVO> orgNodeUserVoList = userMapper.selectByIds(userIdList).stream().map(user -> {
|
||||
@@ -223,7 +222,7 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
||||
nodeUserVo.setAvatar(user.getAvatar());
|
||||
nodeUserVo.setName(user.getName());
|
||||
return nodeUserVo;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
|
||||
SysMessageVO.setUserList(orgNodeUserVoList);
|
||||
}
|
||||
|
||||
+1
-2
@@ -40,7 +40,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -127,7 +126,7 @@ public class SysOauthClientDetailsServiceImpl extends ServiceImpl<SysOauthClient
|
||||
dto.setEncFlag(encFlag);
|
||||
dto.setOnlineQuantity(onlineQuantity);
|
||||
return dto;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
|
||||
// 构建dto page 对象
|
||||
Page<SysOauthClientDetailsDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), selectPage.getTotal());
|
||||
|
||||
+1
-2
@@ -35,7 +35,6 @@ import org.springframework.validation.BindingResult;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 岗位信息表
|
||||
@@ -101,7 +100,7 @@ public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> impl
|
||||
PostExcelVO postExcelVO = new PostExcelVO();
|
||||
BeanUtil.copyProperties(post, postExcelVO);
|
||||
return postExcelVO;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -36,7 +36,6 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 公共参数配置
|
||||
@@ -103,7 +102,7 @@ public class SysPublicParamServiceImpl extends ServiceImpl<SysPublicParamMapper,
|
||||
.stream()
|
||||
.filter(p -> !p.getSystemFlag().equals(DictTypeEnum.SYSTEM.getType()))// 系统内置的跳过不能删除
|
||||
.map(SysPublicParam::getPublicId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
return R.ok(this.removeBatchByIds(idList));
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -34,7 +34,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -70,7 +69,7 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
||||
roleMenu.setRoleId(roleId);
|
||||
roleMenu.setMenuId(Long.valueOf(menuId));
|
||||
return roleMenu;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
|
||||
// 清空userinfo
|
||||
cacheManager.getCache(CacheConstants.USER_DETAILS).clear();
|
||||
|
||||
+1
-2
@@ -45,7 +45,6 @@ import org.springframework.validation.BindingResult;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -161,7 +160,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
RoleExcelVO roleExcelVO = new RoleExcelVO();
|
||||
BeanUtil.copyProperties(role, roleExcelVO);
|
||||
return roleExcelVO;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+50
-50
@@ -38,7 +38,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -48,60 +47,61 @@ import java.util.stream.Collectors;
|
||||
@AllArgsConstructor
|
||||
@Service("sysSocialDetailsService")
|
||||
public class SysSocialDetailsServiceImpl extends ServiceImpl<SysSocialDetailsMapper, SysSocialDetails>
|
||||
implements SysSocialDetailsService {
|
||||
implements SysSocialDetailsService {
|
||||
|
||||
private final Map<String, LoginHandler> loginHandlerMap;
|
||||
private final Map<String, LoginHandler> loginHandlerMap;
|
||||
|
||||
private final CacheManager cacheManager;
|
||||
private final CacheManager cacheManager;
|
||||
|
||||
private final SysUserMapper sysUserMapper;
|
||||
private final SysUserMapper sysUserMapper;
|
||||
|
||||
/**
|
||||
* 绑定社交账号
|
||||
*
|
||||
* @param type type
|
||||
* @param code code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean bindSocial(String type, String code) {
|
||||
LoginHandler loginHandler = loginHandlerMap.get(type);
|
||||
// 绑定逻辑
|
||||
String identify = loginHandler.identify(code);
|
||||
SysUser sysUser = sysUserMapper.selectById(SecurityUtils.getUser().getId());
|
||||
loginHandler.bind(sysUser, identify);
|
||||
/**
|
||||
* 绑定社交账号
|
||||
*
|
||||
* @param type type
|
||||
* @param code code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean bindSocial(String type, String code) {
|
||||
LoginHandler loginHandler = loginHandlerMap.get(type);
|
||||
// 绑定逻辑
|
||||
String identify = loginHandler.identify(code);
|
||||
SysUser sysUser = sysUserMapper.selectById(SecurityUtils.getUser().getId());
|
||||
loginHandler.bind(sysUser, identify);
|
||||
|
||||
// 更新緩存
|
||||
cacheManager.getCache(CacheConstants.USER_DETAILS).evict(sysUser.getUsername());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
// 更新緩存
|
||||
cacheManager.getCache(CacheConstants.USER_DETAILS).evict(sysUser.getUsername());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据入参查询用户信息
|
||||
*
|
||||
* @param inStr TYPE@code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public UserInfo getUserInfo(String inStr) {
|
||||
String[] inStrs = inStr.split(StringPool.AT);
|
||||
String type = inStrs[0];
|
||||
String loginStr = inStr.substring(type.length() + 1);
|
||||
return loginHandlerMap.get(type).handle(loginStr);
|
||||
}
|
||||
/**
|
||||
* 根据入参查询用户信息
|
||||
*
|
||||
* @param inStr TYPE@code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public UserInfo getUserInfo(String inStr) {
|
||||
String[] inStrs = inStr.split(StringPool.AT);
|
||||
String type = inStrs[0];
|
||||
String loginStr = inStr.substring(type.length() + 1);
|
||||
return loginHandlerMap.get(type).handle(loginStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前租户下的三方应用信息 ,脱敏 appSecret
|
||||
*
|
||||
* @return List<SysSocialDetails>
|
||||
*/
|
||||
@Override
|
||||
public List<SysSocialDetailsVO> selectList() {
|
||||
List<SysSocialDetails> sysSocialDetailsList = baseMapper.selectList(Wrappers.query());
|
||||
return sysSocialDetailsList.stream().map(sysSocialDetails -> {
|
||||
SysSocialDetailsVO newSysSocialDetails = new SysSocialDetailsVO();
|
||||
BeanUtils.copyProperties(sysSocialDetails, newSysSocialDetails);
|
||||
return newSysSocialDetails;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前租户下的三方应用信息 ,脱敏 appSecret
|
||||
*
|
||||
* @return List<SysSocialDetails>
|
||||
*/
|
||||
@Override
|
||||
public List<SysSocialDetailsVO> selectList() {
|
||||
List<SysSocialDetails> sysSocialDetailsList = baseMapper.selectList(Wrappers.query());
|
||||
return sysSocialDetailsList.stream().map(sysSocialDetails -> {
|
||||
SysSocialDetailsVO newSysSocialDetails = new SysSocialDetailsVO();
|
||||
BeanUtils.copyProperties(sysSocialDetails, newSysSocialDetails);
|
||||
return newSysSocialDetails;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -49,7 +49,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.lang.reflect.Field;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 租户
|
||||
@@ -190,7 +189,7 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
}).toList();
|
||||
roleMenuList.forEach(roleMenuMapper::insert);
|
||||
// 插入系统字典
|
||||
dictService.saveBatch(dictList.stream().peek(d -> d.setId(null)).collect(Collectors.toList()));
|
||||
dictService.saveBatch(dictList.stream().peek(d -> d.setId(null)).toList());
|
||||
// 处理字典项最新关联的字典ID
|
||||
List<SysDictItem> itemList = dictList.stream()
|
||||
.flatMap(dict -> dictItemList.stream()
|
||||
@@ -199,13 +198,13 @@ public class SysTenantServiceImpl extends ServiceImpl<SysTenantMapper, SysTenant
|
||||
item.setDictId(dict.getId());
|
||||
item.setId(null);
|
||||
}))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
// 插入客户端
|
||||
clientServices.saveBatch(clientDetailsList.stream().peek(d -> d.setId(null)).collect(Collectors.toList()));
|
||||
clientServices.saveBatch(clientDetailsList.stream().peek(d -> d.setId(null)).toList());
|
||||
// 插入系统配置
|
||||
paramService
|
||||
.saveBatch(publicParamList.stream().peek(d -> d.setPublicId(null)).collect(Collectors.toList()));
|
||||
.saveBatch(publicParamList.stream().peek(d -> d.setPublicId(null)).toList());
|
||||
return dictItemService.saveBatch(itemList);
|
||||
}));
|
||||
|
||||
|
||||
+8
-9
@@ -64,7 +64,6 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@@ -159,7 +158,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
List<Long> roleIds = sysRoleService.findRolesByUserId(sysUser.getUserId())
|
||||
.stream()
|
||||
.map(SysRole::getRoleId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
userInfo.setRoles(ArrayUtil.toArray(roleIds, Long.class));
|
||||
|
||||
// 设置权限列表(menu.permission)
|
||||
@@ -169,7 +168,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
.stream()
|
||||
.filter(menu -> StrUtil.isNotEmpty(menu.getPermission()))
|
||||
.map(SysMenu::getPermission)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
permissions.addAll(permissionList);
|
||||
});
|
||||
userInfo.setPermissions(ArrayUtil.toArray(permissions, String.class));
|
||||
@@ -322,7 +321,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
.collect(Collectors.joining(StrUtil.COMMA));
|
||||
excelVO.setPostNameList(postNameList);
|
||||
return excelVO;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
return userExcelVOList;
|
||||
}
|
||||
|
||||
@@ -367,7 +366,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
List<String> roleNameList = StrUtil.split(excel.getRoleNameList(), StrUtil.COMMA);
|
||||
List<SysRole> roleCollList = roleList.stream()
|
||||
.filter(role -> roleNameList.stream().anyMatch(name -> role.getRoleName().equals(name)))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
if (roleCollList.size() != roleNameList.size()) {
|
||||
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_ROLENAME_INEXISTENCE, excel.getRoleNameList()));
|
||||
@@ -377,7 +376,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
List<String> postNameList = StrUtil.split(excel.getPostNameList(), StrUtil.COMMA);
|
||||
List<SysPost> postCollList = postList.stream()
|
||||
.filter(post -> postNameList.stream().anyMatch(name -> post.getPostName().equals(name)))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
if (postCollList.size() != postNameList.size()) {
|
||||
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_POST_POSTNAME_INEXISTENCE, excel.getPostNameList()));
|
||||
@@ -417,10 +416,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
// 根据部门名称查询部门ID
|
||||
userDTO.setDeptId(deptOptional.get().getDeptId());
|
||||
// 插入岗位名称
|
||||
List<Long> postIdList = postCollList.stream().map(SysPost::getPostId).collect(Collectors.toList());
|
||||
List<Long> postIdList = postCollList.stream().map(SysPost::getPostId).toList();
|
||||
userDTO.setPost(postIdList);
|
||||
// 根据角色名称查询角色ID
|
||||
List<Long> roleIdList = roleCollList.stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
||||
List<Long> roleIdList = roleCollList.stream().map(SysRole::getRoleId).toList();
|
||||
userDTO.setRole(roleIdList);
|
||||
// 插入用户
|
||||
this.saveUser(userDTO);
|
||||
@@ -607,7 +606,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
return sysUserRoleMapper.selectList(Wrappers.<SysUserRole>lambdaQuery().in(SysUserRole::getRoleId, roleIdList))
|
||||
.stream()
|
||||
.map(SysUserRole::getUserId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -16,7 +16,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 表字段信息管理
|
||||
@@ -83,7 +82,7 @@ public class GenTableColumnServiceImpl extends ServiceImpl<GenTableColumnMapper,
|
||||
AtomicInteger sort = new AtomicInteger();
|
||||
this.updateBatchById(tableFieldList.stream()
|
||||
.peek(field -> field.setSort(sort.getAndIncrement()))
|
||||
.collect(Collectors.toList()));
|
||||
.toList());
|
||||
}
|
||||
|
||||
}
|
||||
+1
-2
@@ -54,7 +54,6 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 列属性
|
||||
@@ -135,7 +134,7 @@ public class GenTableServiceImpl extends ServiceImpl<GenTableMapper, GenTable> i
|
||||
long time2 = (o2.getUpdateTime() != null ? o2.getUpdateTime().getTime() :
|
||||
(o2.getCreateTime() != null ? o2.getCreateTime().getTime() : 0));
|
||||
return NumberUtil.compare(time2, time1);
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
|
||||
// 根据 page 进行分页
|
||||
List<Table> records = CollUtil.page((int) page.getCurrent() - 1, (int) page.getSize(), tableList);
|
||||
|
||||
+3
-3
@@ -484,15 +484,15 @@ public class GeneratorServiceImpl implements GeneratorService {
|
||||
List<GenTableColumnEntity> formList = typeMap.get(false)
|
||||
.stream()
|
||||
.filter(columnEntity -> BooleanUtil.toBoolean(columnEntity.getFormItem()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
List<GenTableColumnEntity> gridList = typeMap.get(false)
|
||||
.stream()
|
||||
.filter(columnEntity -> BooleanUtil.toBoolean(columnEntity.getGridItem()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
List<GenTableColumnEntity> queryList = typeMap.get(false)
|
||||
.stream()
|
||||
.filter(columnEntity -> BooleanUtil.toBoolean(columnEntity.getQueryItem()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
if (CollUtil.isNotEmpty(primaryList)) {
|
||||
dataModel.put("pk", primaryList.get(0));
|
||||
|
||||
+7
-8
@@ -58,7 +58,6 @@ import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -142,11 +141,11 @@ public class WxAccountFansServiceImpl extends ServiceImpl<WxAccountFansMapper, W
|
||||
List<WxAccountTag> tagList = wxAccountTags.stream()
|
||||
.filter(tag -> tag.getWxAccountAppid().endsWith(fans.getWxAccountAppid()) //
|
||||
&& ArrayUtil.contains(fans.getTagIds(), tag.getTagId()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
vo.setTagList(tagList);
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
|
||||
page.setRecords(voList);
|
||||
page.setTotal(fansPage.getTotal());
|
||||
@@ -198,12 +197,12 @@ public class WxAccountFansServiceImpl extends ServiceImpl<WxAccountFansMapper, W
|
||||
List<WxAccountFans> wxAccountFans = this.listByIds(CollUtil.toList(ids));
|
||||
WxMpService wxMpService = WxMpInitConfigRunner.getMpServices().get(appId);
|
||||
WxMpUserBlacklistService blackListService = wxMpService.getBlackListService();
|
||||
List<String> collect = wxAccountFans.stream().map(WxAccountFans::getOpenid).collect(Collectors.toList());
|
||||
List<String> collect = wxAccountFans.stream().map(WxAccountFans::getOpenid).toList();
|
||||
blackListService.pullFromBlacklist(collect);
|
||||
// 更新数据
|
||||
List<WxAccountFans> fansList = wxAccountFans.stream().peek(item -> {
|
||||
item.setIsBlack(CommonConstants.SUCCESS);
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
this.updateBatchById(fansList);
|
||||
|
||||
return Boolean.TRUE;
|
||||
@@ -215,12 +214,12 @@ public class WxAccountFansServiceImpl extends ServiceImpl<WxAccountFansMapper, W
|
||||
List<WxAccountFans> wxAccountFans = this.listByIds(CollUtil.toList(ids));
|
||||
WxMpService wxMpService = WxMpInitConfigRunner.getMpServices().get(appId);
|
||||
WxMpUserBlacklistService blackListService = wxMpService.getBlackListService();
|
||||
List<String> collect = wxAccountFans.stream().map(WxAccountFans::getOpenid).collect(Collectors.toList());
|
||||
List<String> collect = wxAccountFans.stream().map(WxAccountFans::getOpenid).toList();
|
||||
blackListService.pushToBlacklist(collect);
|
||||
// 更新数据
|
||||
List<WxAccountFans> fansList = wxAccountFans.stream().peek(item -> {
|
||||
item.setIsBlack(CommonConstants.FAIL);
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
this.updateBatchById(fansList);
|
||||
|
||||
return Boolean.TRUE;
|
||||
@@ -263,7 +262,7 @@ public class WxAccountFansServiceImpl extends ServiceImpl<WxAccountFansMapper, W
|
||||
List<List<String>> openIdsList = CollUtil.split(wxMpUserList.getOpenids(), SIZE)
|
||||
.stream()
|
||||
.filter(CollUtil::isNotEmpty)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
// 处理每个分组. 调用查询用户信息
|
||||
for (List<String> openIdList : openIdsList) {
|
||||
log.info("开始批量获取用户信息 {}", openIdList);
|
||||
|
||||
+1
-3
@@ -28,8 +28,6 @@ import com.pig4cloud.pigx.pay.service.PayChannelService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 渠道
|
||||
*
|
||||
@@ -69,7 +67,7 @@ public class PayChannelServiceImpl extends ServiceImpl<PayChannelMapper, PayChan
|
||||
|
||||
// 对敏感信息进行脱敏
|
||||
selectedPage.setRecords(selectedPage.getRecords().stream().peek(channel -> channel
|
||||
.setParam(DesensitizedUtils.json(channel.getParam(), true, "key"))).collect(Collectors.toList()));
|
||||
.setParam(DesensitizedUtils.json(channel.getParam(), true, "key"))).toList());
|
||||
|
||||
return selectedPage;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user