Compare commits
2 Commits
9927546b78
...
c23abf1b96
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c23abf1b96 | ||
|
|
c6f9dbb182 |
@@ -224,11 +224,9 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
} else if ("MapperXml".equals(templateName)) {
|
} else if ("MapperXml".equals(templateName)) {
|
||||||
return entityName + "Mapper" + extension;
|
return entityName + "Mapper" + extension;
|
||||||
} else if ("API".equals(templateName)) {
|
} else if ("API".equals(templateName)) {
|
||||||
// 生成 user.ts 命名
|
return "index" + extension;
|
||||||
return StrUtil.toSymbolCase(entityName, '-') + extension;
|
|
||||||
} else if ("API_TYPES".equals(templateName)) {
|
} else if ("API_TYPES".equals(templateName)) {
|
||||||
// 生成 types/api/user.ts
|
return "types" + extension;
|
||||||
return StrUtil.toSymbolCase(entityName, '-') + extension;
|
|
||||||
} else if ("VIEW".equals(templateName)) {
|
} else if ("VIEW".equals(templateName)) {
|
||||||
return "index.vue";
|
return "index.vue";
|
||||||
}
|
}
|
||||||
@@ -255,18 +253,18 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
+ File.separator + moduleName
|
+ File.separator + moduleName
|
||||||
);
|
);
|
||||||
} else if ("API".equals(templateName)) {
|
} else if ("API".equals(templateName)) {
|
||||||
// path = "src/api/system";
|
|
||||||
path = (codegenProperties.getFrontendAppName()
|
path = (codegenProperties.getFrontendAppName()
|
||||||
+ File.separator + "src"
|
+ File.separator + "src"
|
||||||
+ File.separator + subPackageName
|
+ File.separator + "api"
|
||||||
+ File.separator + moduleName
|
+ File.separator + moduleName
|
||||||
|
+ File.separator + StrUtil.toSymbolCase(entityName, '-')
|
||||||
);
|
);
|
||||||
} else if ("API_TYPES".equals(templateName)) {
|
} else if ("API_TYPES".equals(templateName)) {
|
||||||
// path = "src/types/api";
|
|
||||||
path = (codegenProperties.getFrontendAppName()
|
path = (codegenProperties.getFrontendAppName()
|
||||||
+ File.separator + "src"
|
+ File.separator + "src"
|
||||||
+ File.separator + "types"
|
|
||||||
+ File.separator + "api"
|
+ File.separator + "api"
|
||||||
|
+ File.separator + moduleName
|
||||||
|
+ File.separator + StrUtil.toSymbolCase(entityName, '-')
|
||||||
);
|
);
|
||||||
} else if ("VIEW".equals(templateName)) {
|
} else if ("VIEW".equals(templateName)) {
|
||||||
// path = "src/views/system/user";
|
// path = "src/views/system/user";
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class LogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "访问趋势统计")
|
@Operation(summary = "访问趋势统计")
|
||||||
@GetMapping("/views/trend")
|
@GetMapping("/analytics/trend")
|
||||||
public Result<VisitTrendVO> getVisitTrend(
|
public Result<VisitTrendVO> getVisitTrend(
|
||||||
@Parameter(description = "开始时间", example = "2024-01-01") @RequestParam String startDate,
|
@Parameter(description = "开始时间", example = "2024-01-01") @RequestParam String startDate,
|
||||||
@Parameter(description = "结束时间", example = "2024-12-31") @RequestParam String endDate
|
@Parameter(description = "结束时间", example = "2024-12-31") @RequestParam String endDate
|
||||||
@@ -56,7 +56,7 @@ public class LogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "访问统计概览")
|
@Operation(summary = "访问统计概览")
|
||||||
@GetMapping("/views")
|
@GetMapping("/analytics/overview")
|
||||||
public Result<VisitOverviewVO> getVisitOverview() {
|
public Result<VisitOverviewVO> getVisitOverview() {
|
||||||
VisitOverviewVO result = logService.getVisitStats();
|
VisitOverviewVO result = logService.getVisitStats();
|
||||||
return Result.success(result);
|
return Result.success(result);
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ public class VisitTrendVO {
|
|||||||
@Schema(description = "浏览量(PV)")
|
@Schema(description = "浏览量(PV)")
|
||||||
private List<Integer> pvList;
|
private List<Integer> pvList;
|
||||||
|
|
||||||
@Schema(description = "IP数")
|
@Schema(description = "访客数(UV)")
|
||||||
private List<Integer> ipList;
|
private List<Integer> uvList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,19 +66,19 @@ public class LogServiceImpl extends ServiceImpl<LogMapper, SysLog>
|
|||||||
|
|
||||||
// 将统计数据转换为 Map
|
// 将统计数据转换为 Map
|
||||||
Map<String, Integer> pvMap = pvCounts.stream().collect(Collectors.toMap(VisitCountDTO::getDate, VisitCountDTO::getCount));
|
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> pvList = new ArrayList<>();
|
||||||
List<Integer> ipList = new ArrayList<>();
|
List<Integer> uvList = new ArrayList<>();
|
||||||
|
|
||||||
for (String date : dates) {
|
for (String date : dates) {
|
||||||
pvList.add(pvMap.getOrDefault(date, 0));
|
pvList.add(pvMap.getOrDefault(date, 0));
|
||||||
ipList.add(ipMap.getOrDefault(date, 0));
|
uvList.add(uvMap.getOrDefault(date, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
visitTrend.setPvList(pvList);
|
visitTrend.setPvList(pvList);
|
||||||
visitTrend.setIpList(ipList);
|
visitTrend.setUvList(uvList);
|
||||||
|
|
||||||
return visitTrend;
|
return visitTrend;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user