Skip to content

Commit

Permalink
fix time path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jzfai committed May 19, 2023
1 parent 84770f6 commit b295085
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hugo-admin/src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://111.230.198.245:3310/micro-service-single?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&useSSL=false
url: jdbc:mysql://111.230.198.245:3310/micro-service-single?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: root
password: '@Root123'
# 从库数据源
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void generatorTemplateFileByConfig(HttpServletResponse response, @Request
//生成模板
String exportFilePath = this.templateFileService.generatorTemplateFileByConfig(JsonUtils.parseObject(jsonData, Map.class), id, fileNamePre);
//你压缩包路径
FileSelfUtils.exportFile(response, exportFilePath, DateUtils.getTime() + ".zip");
FileSelfUtils.exportFile(response, exportFilePath, DateUtils.dateTimeNow() + ".zip");
FileSelfUtils.deleteFile(exportFilePath);
FileSelfUtils.deleteDir(GeneratorTempUtils.getNeedZipDir());
}
Expand All @@ -179,7 +179,7 @@ public void generatorTemplateFileByConfig(HttpServletResponse response, @Request
public void downZipByTemplateFileId(HttpServletResponse response, HttpServletRequest request, @RequestParam("id") Integer id) {
String exportFilePath = this.templateFileService.downZipByTemplateFileId(id);
//导出文件并删除响应文件和目录
FileSelfUtils.exportFile(response, exportFilePath, DateUtils.getTime() + ".zip");
FileSelfUtils.exportFile(response, exportFilePath, DateUtils.dateTimeNow() + ".zip");
FileSelfUtils.deleteFile(exportFilePath);
FileSelfUtils.deleteDir(GeneratorTempUtils.getNeedZipDir());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public String generatorTemplateFileByConfig(Map<String, Object> contextData, Int
}
}
});
String exportFileName = GeneratorTempUtils.getOutputZipPath() + DateUtils.getTime() + ".zip";
String exportFileName = GeneratorTempUtils.getOutputZipPath() + DateUtils.dateTimeNow() + ".zip";
//生成zip包
GeneratorTempUtils.createZipFile(exportFileName, GeneratorTempUtils.getNeedZipDir());
return exportFileName;
Expand All @@ -160,12 +160,20 @@ public String dillFileName(String fileNamePre, String fileName, String extendNam
//返回前端名
List<String> frontExtendList = Arrays.asList("vue", "js", "ts");
if (frontExtendList.contains(extendName)) {
return fileNamePre + "-" + fileName;
if (ObjectUtil.isNotEmpty(fileNamePre)) {
return fileNamePre + "-" + fileName;
} else {
return fileName;
}
}
//返回后端名
List<String> backExtendList = Arrays.asList("java", "xml", "yml");
if (backExtendList.contains(extendName)) {
return fileNamePre + setFirstWordUpCase(fileName);
if (ObjectUtil.isNotEmpty(fileNamePre)) {
return fileNamePre + "-" + setFirstWordUpCase(fileName);
} else {
return setFirstWordUpCase(fileName);
}
}
return "nomapping";
}
Expand Down Expand Up @@ -193,7 +201,7 @@ public String mappingDir(String fileName) {
public String downZipByTemplateFileId(Integer id) {
String workPath = FileSelfUtils.getTemplateSaveRootDir() + id;
log.info("导出的文件路径" + workPath);
String exportFileName = GeneratorTempUtils.getOutputZipPath() + DateUtils.getTime() + ".zip";
String exportFileName = GeneratorTempUtils.getOutputZipPath() + DateUtils.dateTimeNow() + ".zip";
//生成zip包
GeneratorTempUtils.createZipFile(exportFileName, workPath);
return exportFileName;
Expand Down

0 comments on commit b295085

Please sign in to comment.