2 Commits

4 changed files with 15 additions and 17 deletions

View File

@@ -224,11 +224,9 @@ public class CodegenServiceImpl implements CodegenService {
} else if ("MapperXml".equals(templateName)) {
return entityName + "Mapper" + extension;
} else if ("API".equals(templateName)) {
// 生成 user.ts 命名
return StrUtil.toSymbolCase(entityName, '-') + extension;
return "index" + extension;
} else if ("API_TYPES".equals(templateName)) {
// 生成 types/api/user.ts
return StrUtil.toSymbolCase(entityName, '-') + extension;
return "types" + extension;
} else if ("VIEW".equals(templateName)) {
return "index.vue";
}
@@ -255,18 +253,18 @@ public class CodegenServiceImpl implements CodegenService {
+ File.separator + moduleName
);
} else if ("API".equals(templateName)) {
// path = "src/api/system";
path = (codegenProperties.getFrontendAppName()
+ File.separator + "src"
+ File.separator + subPackageName
+ File.separator + "api"
+ File.separator + moduleName
+ File.separator + StrUtil.toSymbolCase(entityName, '-')
);
} else if ("API_TYPES".equals(templateName)) {
// path = "src/types/api";
path = (codegenProperties.getFrontendAppName()
+ File.separator + "src"
+ File.separator + "types"
+ File.separator + "api"
+ File.separator + moduleName
+ File.separator + StrUtil.toSymbolCase(entityName, '-')
);
} else if ("VIEW".equals(templateName)) {
// path = "src/views/system/user";

View File

@@ -44,7 +44,7 @@ public class LogController {
}
@Operation(summary = "访问趋势统计")
@GetMapping("/views/trend")
@GetMapping("/analytics/trend")
public Result<VisitTrendVO> getVisitTrend(
@Parameter(description = "开始时间", example = "2024-01-01") @RequestParam String startDate,
@Parameter(description = "结束时间", example = "2024-12-31") @RequestParam String endDate
@@ -56,7 +56,7 @@ public class LogController {
}
@Operation(summary = "访问统计概览")
@GetMapping("/views")
@GetMapping("/analytics/overview")
public Result<VisitOverviewVO> getVisitOverview() {
VisitOverviewVO result = logService.getVisitStats();
return Result.success(result);

View File

@@ -23,8 +23,8 @@ public class VisitTrendVO {
@Schema(description = "浏览量(PV)")
private List<Integer> pvList;
@Schema(description = "IP数")
private List<Integer> ipList;
@Schema(description = "访客数(UV)")
private List<Integer> uvList;
}

View File

@@ -66,19 +66,19 @@ public class LogServiceImpl extends ServiceImpl<LogMapper, SysLog>
// 将统计数据转换为 Map
Map<String, Integer> pvMap = pvCounts.stream().collect(Collectors.toMap(VisitCountDTO::getDate, VisitCountDTO::getCount));
Map<String, Integer> ipMap = ipCounts.stream().collect(Collectors.toMap(VisitCountDTO::getDate, VisitCountDTO::getCount));
Map<String, Integer> uvMap = ipCounts.stream().collect(Collectors.toMap(VisitCountDTO::getDate, VisitCountDTO::getCount));
// 匹配日期和访问量/访问 IP
// 匹配日期和访问量/访
List<Integer> pvList = new ArrayList<>();
List<Integer> ipList = new ArrayList<>();
List<Integer> uvList = new ArrayList<>();
for (String date : dates) {
pvList.add(pvMap.getOrDefault(date, 0));
ipList.add(ipMap.getOrDefault(date, 0));
uvList.add(uvMap.getOrDefault(date, 0));
}
visitTrend.setPvList(pvList);
visitTrend.setIpList(ipList);
visitTrend.setUvList(uvList);
return visitTrend;
}