mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-20 03:00:53 +08:00
style: 优化全局代码格式
This commit is contained in:
@@ -66,8 +66,9 @@ public class LogDaoLocalImpl implements LogDao {
|
||||
LogDO logDO = new LogDO();
|
||||
logDO.setDescription(logRecord.getDescription());
|
||||
String module = logRecord.getModule();
|
||||
logDO.setModule(
|
||||
StrUtil.isNotBlank(module) ? logRecord.getModule().replace("API", StringConstants.EMPTY).trim() : null);
|
||||
logDO.setModule(StrUtil.isNotBlank(module)
|
||||
? logRecord.getModule().replace("API", StringConstants.EMPTY).trim()
|
||||
: null);
|
||||
logDO.setCreateTime(LocalDateTime.ofInstant(logRecord.getTimestamp(), ZoneId.systemDefault()));
|
||||
logDO.setTimeTaken(logRecord.getTimeTaken().toMillis());
|
||||
// 请求信息
|
||||
@@ -105,16 +106,16 @@ public class LogDaoLocalImpl implements LogDao {
|
||||
logDO.setCreateUser(-1 != loginId ? loginId : null);
|
||||
} else if (result.isSuccess() && requestUri.startsWith(SysConstants.LOGIN_URI)) {
|
||||
AccountLoginReq loginReq = JSONUtil.toBean(requestBody, AccountLoginReq.class);
|
||||
logDO.setCreateUser(
|
||||
ExceptionUtils.exToNull(() -> userService.getByUsername(loginReq.getUsername()).getId()));
|
||||
logDO.setCreateUser(ExceptionUtils.exToNull(() -> userService.getByUsername(loginReq.getUsername())
|
||||
.getId()));
|
||||
}
|
||||
}
|
||||
// 操作人
|
||||
if (!requestUri.startsWith(SysConstants.LOGOUT_URI) && MapUtil.isNotEmpty(requestHeaderMap)
|
||||
&& requestHeaderMap.containsKey(HttpHeaders.AUTHORIZATION)) {
|
||||
if (!requestUri.startsWith(SysConstants.LOGOUT_URI) && MapUtil.isNotEmpty(requestHeaderMap) && requestHeaderMap
|
||||
.containsKey(HttpHeaders.AUTHORIZATION)) {
|
||||
String authorization = requestHeaderMap.get(HttpHeaders.AUTHORIZATION);
|
||||
String token = authorization.replace(SaManager.getConfig().getTokenPrefix() + StringConstants.SPACE,
|
||||
StringConstants.EMPTY);
|
||||
String token = authorization.replace(SaManager.getConfig()
|
||||
.getTokenPrefix() + StringConstants.SPACE, StringConstants.EMPTY);
|
||||
logDO.setCreateUser(Convert.toLong(StpUtil.getLoginIdByToken(token)));
|
||||
}
|
||||
logMapper.insert(logDO);
|
||||
|
@@ -45,8 +45,7 @@ public interface LogMapper extends BaseMapper<LogDO> {
|
||||
/**
|
||||
* 查询仪表盘访问趋势信息
|
||||
*
|
||||
* @param days
|
||||
* 日期数
|
||||
* @param days 日期数
|
||||
*
|
||||
* @return 仪表盘访问趋势信息
|
||||
*/
|
||||
|
@@ -47,7 +47,6 @@ public class DashboardGeoDistributionResp implements Serializable {
|
||||
/**
|
||||
* 地点 IP 统计信息
|
||||
*/
|
||||
@Schema(description = "地点 IP 统计信息",
|
||||
example = "[{\"name\":\"中国北京北京市\",\"value\":1000},{\"name\":\"中国广东省深圳市\",\"value\": 500}]")
|
||||
@Schema(description = "地点 IP 统计信息", example = "[{\"name\":\"中国北京北京市\",\"value\":1000},{\"name\":\"中国广东省深圳市\",\"value\": 500}]")
|
||||
private List<Map<String, Object>> locationIpStatistics;
|
||||
}
|
||||
|
@@ -42,8 +42,7 @@ public interface DashboardService {
|
||||
/**
|
||||
* 查询访问趋势信息
|
||||
*
|
||||
* @param days
|
||||
* 日期数
|
||||
* @param days 日期数
|
||||
* @return 访问趋势信息
|
||||
*/
|
||||
List<DashboardAccessTrendResp> listAccessTrend(Integer days);
|
||||
|
@@ -37,10 +37,8 @@ public interface LogService {
|
||||
/**
|
||||
* 分页查询操作日志列表
|
||||
*
|
||||
* @param query
|
||||
* 查询条件
|
||||
* @param pageQuery
|
||||
* 分页查询条件
|
||||
* @param query 查询条件
|
||||
* @param pageQuery 分页查询条件
|
||||
* @return 操作日志分页信息
|
||||
*/
|
||||
PageResp<OperationLogResp> page(OperationLogQuery query, PageQuery pageQuery);
|
||||
@@ -48,10 +46,8 @@ public interface LogService {
|
||||
/**
|
||||
* 分页查询登录日志列表
|
||||
*
|
||||
* @param query
|
||||
* 查询条件
|
||||
* @param pageQuery
|
||||
* 分页查询条件
|
||||
* @param query 查询条件
|
||||
* @param pageQuery 分页查询条件
|
||||
* @return 登录日志分页信息
|
||||
*/
|
||||
PageResp<LoginLogResp> page(LoginLogQuery query, PageQuery pageQuery);
|
||||
@@ -59,10 +55,8 @@ public interface LogService {
|
||||
/**
|
||||
* 分页查询系统日志列表
|
||||
*
|
||||
* @param query
|
||||
* 查询条件
|
||||
* @param pageQuery
|
||||
* 分页查询条件
|
||||
* @param query 查询条件
|
||||
* @param pageQuery 分页查询条件
|
||||
* @return 系统日志分页信息
|
||||
*/
|
||||
PageResp<SystemLogResp> page(SystemLogQuery query, PageQuery pageQuery);
|
||||
@@ -70,8 +64,7 @@ public interface LogService {
|
||||
/**
|
||||
* 查看系统日志详情
|
||||
*
|
||||
* @param logId
|
||||
* 日志 ID
|
||||
* @param logId 日志 ID
|
||||
* @return 系统日志详情
|
||||
*/
|
||||
SystemLogDetailResp get(Long logId);
|
||||
|
@@ -59,7 +59,8 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
Long todayPvCount = totalResp.getTodayPvCount();
|
||||
Long yesterdayPvCount = totalResp.getYesterdayPvCount();
|
||||
BigDecimal newPvCountFromYesterday = NumberUtil.sub(todayPvCount, yesterdayPvCount);
|
||||
BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) ? BigDecimal.valueOf(100)
|
||||
BigDecimal newPvFromYesterday = (0 == yesterdayPvCount)
|
||||
? BigDecimal.valueOf(100)
|
||||
: NumberUtil.round(NumberUtil.mul(NumberUtil.div(newPvCountFromYesterday, yesterdayPvCount), 100), 1);
|
||||
totalResp.setNewPvFromYesterday(newPvFromYesterday);
|
||||
return totalResp;
|
||||
@@ -78,7 +79,8 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
Long todayPvCount = popularModule.getTodayPvCount();
|
||||
Long yesterdayPvCount = popularModule.getYesterdayPvCount();
|
||||
BigDecimal newPvCountFromYesterday = NumberUtil.sub(todayPvCount, yesterdayPvCount);
|
||||
BigDecimal newPvFromYesterday = (0 == yesterdayPvCount) ? BigDecimal.valueOf(100)
|
||||
BigDecimal newPvFromYesterday = (0 == yesterdayPvCount)
|
||||
? BigDecimal.valueOf(100)
|
||||
: NumberUtil.round(NumberUtil.mul(NumberUtil.div(newPvCountFromYesterday, yesterdayPvCount), 100), 1);
|
||||
popularModule.setNewPvFromYesterday(newPvFromYesterday);
|
||||
}
|
||||
|
@@ -66,9 +66,10 @@ public class LogServiceImpl implements LogService {
|
||||
QueryWrapper<LogDO> queryWrapper = QueryHelper.build(query);
|
||||
// 限定查询信息
|
||||
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(OperationLogResp.class);
|
||||
List<String> columnNameList =
|
||||
fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX))
|
||||
.map(StrUtil::toUnderlineCase).collect(Collectors.toList());
|
||||
List<String> columnNameList = fieldNameList.stream()
|
||||
.filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX))
|
||||
.map(StrUtil::toUnderlineCase)
|
||||
.collect(Collectors.toList());
|
||||
queryWrapper.select(columnNameList);
|
||||
// 分页查询
|
||||
IPage<LogDO> page = logMapper.selectPage(pageQuery.toPage(), queryWrapper);
|
||||
@@ -89,9 +90,10 @@ public class LogServiceImpl implements LogService {
|
||||
queryWrapper.eq("module", "登录");
|
||||
// 限定查询信息
|
||||
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(LoginLogResp.class);
|
||||
List<String> columnNameList =
|
||||
fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX))
|
||||
.map(StrUtil::toUnderlineCase).collect(Collectors.toList());
|
||||
List<String> columnNameList = fieldNameList.stream()
|
||||
.filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX))
|
||||
.map(StrUtil::toUnderlineCase)
|
||||
.collect(Collectors.toList());
|
||||
queryWrapper.select(columnNameList);
|
||||
// 分页查询
|
||||
IPage<LogDO> page = logMapper.selectPage(pageQuery.toPage(), queryWrapper);
|
||||
@@ -106,9 +108,10 @@ public class LogServiceImpl implements LogService {
|
||||
QueryWrapper<LogDO> queryWrapper = QueryHelper.build(query);
|
||||
// 限定查询信息
|
||||
List<String> fieldNameList = ReflectUtils.getNonStaticFieldsName(SystemLogResp.class);
|
||||
List<String> columnNameList =
|
||||
fieldNameList.stream().filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX))
|
||||
.map(StrUtil::toUnderlineCase).collect(Collectors.toList());
|
||||
List<String> columnNameList = fieldNameList.stream()
|
||||
.filter(n -> !n.endsWith(SysConstants.DESCRIPTION_FIELD_SUFFIX))
|
||||
.map(StrUtil::toUnderlineCase)
|
||||
.collect(Collectors.toList());
|
||||
queryWrapper.select(columnNameList);
|
||||
// 分页查询
|
||||
IPage<LogDO> page = logMapper.selectPage(pageQuery.toPage(), queryWrapper);
|
||||
@@ -150,8 +153,7 @@ public class LogServiceImpl implements LogService {
|
||||
/**
|
||||
* 填充数据
|
||||
*
|
||||
* @param logResp
|
||||
* 日志信息
|
||||
* @param logResp 日志信息
|
||||
*/
|
||||
private void fill(LogResp logResp) {
|
||||
Long createUser = logResp.getCreateUser();
|
||||
|
Reference in New Issue
Block a user