style: 优化部分代码格式

This commit is contained in:
Charles7c 2023-11-05 21:26:12 +08:00
parent 7b741d5f8c
commit 2f87310bc8
5 changed files with 9 additions and 12 deletions

View File

@ -19,7 +19,6 @@ package top.charles7c.cnadmin.monitor.service.impl;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
@ -91,8 +90,7 @@ public class DashboardServiceImpl implements DashboardService {
List<Map<String, Object>> locationIpStatistics = logService.listDashboardGeoDistribution();
DashboardGeoDistributionResp geoDistribution = new DashboardGeoDistributionResp();
geoDistribution.setLocationIpStatistics(locationIpStatistics);
geoDistribution.setLocations(
locationIpStatistics.stream().map(m -> Convert.toStr(m.get("name"))).collect(Collectors.toList()));
geoDistribution.setLocations(locationIpStatistics.stream().map(m -> Convert.toStr(m.get("name"))).toList());
return geoDistribution;
}

View File

@ -139,10 +139,9 @@ public class LogServiceImpl implements LogService {
public SystemLogDetailResp get(Long id) {
LogDO logDO = logMapper.selectById(id);
CheckUtils.throwIfNotExists(logDO, "LogDO", "ID", id);
SystemLogDetailResp detailVO = BeanUtil.copyProperties(logDO, SystemLogDetailResp.class);
this.fill(detailVO);
return detailVO;
SystemLogDetailResp detail = BeanUtil.copyProperties(logDO, SystemLogDetailResp.class);
this.fill(detail);
return detail;
}
@Override

View File

@ -82,7 +82,7 @@ public class DeptServiceImpl extends BaseServiceImpl<DeptMapper, DeptDO, DeptRes
String oldName = oldDept.getName();
DisEnableStatusEnum newStatus = req.getStatus();
Long oldParentId = oldDept.getParentId();
if (oldDept.getIsSystem()) {
if (Boolean.TRUE.equals(oldDept.getIsSystem())) {
CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, newStatus, "[{}] 是系统内置部门,不允许禁用", oldName);
CheckUtils.throwIfNotEqual(req.getParentId(), oldParentId, "[{}] 是系统内置部门,不允许变更上级部门", oldName);
}

View File

@ -92,7 +92,7 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
RoleDO oldRole = super.getById(id);
DataScopeEnum oldDataScope = oldRole.getDataScope();
String oldCode = oldRole.getCode();
if (oldRole.getIsSystem()) {
if (Boolean.TRUE.equals(oldRole.getIsSystem())) {
CheckUtils.throwIfEqual(DisEnableStatusEnum.DISABLE, req.getStatus(), "[{}] 是系统内置角色,不允许禁用",
oldRole.getName());
CheckUtils.throwIfNotEqual(req.getCode(), oldCode, "[{}] 是系统内置角色,不允许修改角色编码", oldRole.getName());
@ -152,7 +152,7 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes
if (CollUtil.isEmpty(list)) {
return new ArrayList<>(0);
}
return list.stream().map(r -> new LabelValueResp<>(r.getName(), r.getId())).collect(Collectors.toList());
return list.stream().map(r -> new LabelValueResp<>(r.getName(), r.getId())).toList();
}
@Override