refactor: 优化代码生成器前端API文件路径结构及日志统计重命名IP数为访客数(UV)
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user