|
@@ -117,14 +117,31 @@ public class SysRepoController extends BaseController
|
|
|
if(sysRepoService.updateSysRepo(sysRepo)<1){
|
|
|
return AjaxResult.error("文件插入失败");
|
|
|
}
|
|
|
- if(sysRepo.getRepoType().equals(".docx")){
|
|
|
- Set<String> set = OfficeCompareUtils.compare(sysRepoHistory.getUrl(),sysRepo.getUrl(),"spire");
|
|
|
- return AjaxResult.success(set);
|
|
|
- }
|
|
|
+// if(sysRepo.getRepoType().equals(".docx") || sysRepo.getRepoType().equals(".doc")){
|
|
|
+// Set<String> set = OfficeCompareUtils.compare(sysRepoHistory.getUrl(),sysRepo.getUrl(),"spire");
|
|
|
+// return AjaxResult.success(set);
|
|
|
+// }
|
|
|
return success();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 对比接口
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:repo:compare')")
|
|
|
+ @PostMapping("/compare")
|
|
|
+ public AjaxResult compare(@RequestBody SysRepo sysRepo)
|
|
|
+ {
|
|
|
+ SysRepo sysRepo_old = sysRepoService.selectSysRepoByRepoId(sysRepo.getRepoId());
|
|
|
+ if(FileUtils.getFileExtension(sysRepo_old.getUrl()).equals(".docx")){
|
|
|
+
|
|
|
+ return AjaxResult.success(OfficeCompareUtils.compare(FileUtils.getUploadPath(sysRepo_old.getUrl()),FileUtils.getUploadPath(sysRepo.getUrl()),"spire"));
|
|
|
+ }
|
|
|
+ return AjaxResult.error("对比失败");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取文件版本
|
|
|
*/
|
|
@@ -180,10 +197,7 @@ public class SysRepoController extends BaseController
|
|
|
{
|
|
|
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", url));
|
|
|
}
|
|
|
- //去除固定前缀“/profile”
|
|
|
- url = url.substring(15);
|
|
|
- String filePath = RuoYiConfig.getUploadPath() + url;
|
|
|
- System.out.println(filePath);
|
|
|
+ String filePath = FileUtils.getUploadPath(url);
|
|
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
|
|
FileUtils.setAttachmentResponseHeader(response, fileName);
|
|
|
FileUtils.writeBytes(filePath, response.getOutputStream());
|