Commit 745610a2 authored by zhangqingle's avatar zhangqingle

修改接口、添加新接口

parent ef475f9d
......@@ -257,7 +257,8 @@ public class BChapterServiceImpl implements BChapterService {
public String changeFileToPdf(String chapterId) {
//1. 获取文件信息
BFile bFile = bFileRepository.selectInfoByChapterId(chapterId);
String filePath = global.getBASE_UPLOAD_SERVER_LOCATION()+"/"+global.getTEMP_LOCATION()+"/"+bFile.getLessonId();
String filePath = global.getBASE_UPLOAD_SERVER_LOCATION()+"/"+global.getCOURSE_LOCATION()+"/"+bFile.getLessonId();
String returnBasePath = global.getRETURN_UPLOAD_SERVER_LOCATION()+"/"+global.getCOURSE_LOCATION()+bFile.getLessonId();
File file=new File(filePath);
//2. pdf 本地是否存在, word ppt 转换后的pdf是否存在
File fileOld = new File(filePath+"/"+bFile.getFileName());
......@@ -266,15 +267,16 @@ public class BChapterServiceImpl implements BChapterService {
File fileNew = new File(filePath+"/"+newName);
if ("3".equals(bFile.getType())){
if (fileOld.exists()){
return filePath+"/"+bFile.getFileName();
return returnBasePath+"/"+bFile.getFileName();
}else {
return downLoadFile(bFile,file,filePath);
String downLoadName = downLoadFile(bFile,file,filePath);
return returnBasePath +"/"+ downLoadName;
}
}
//3. pdf不存在,下载 , 删除word ppt,重新下载,转换
if ("2".equals(bFile.getType()) || "4".equals(bFile.getType())){
if (fileNew.exists()){
return filePath+"/"+newName;
return returnBasePath+"/"+newName;
}else {
fileOld.delete();
String downLoadFileUrl = downLoadFile(bFile,file,filePath);
......@@ -286,7 +288,7 @@ public class BChapterServiceImpl implements BChapterService {
//4. 更新在 bfile 表 , ppt和word 存一下转换之后的url filePath
bFile.setFileUrl(filePath+"/"+newName);
bFileRepository.updateByPrimaryKeySelective(bFile);
return filePath+"/"+newName;
return returnBasePath+"/"+newName;
}
}else{
return null;
......@@ -342,7 +344,7 @@ public class BChapterServiceImpl implements BChapterService {
log.error(e.getMessage() + "下载文件异常");
throw new ServiceException(ResultServiceEnums.DOWNLOAD_ERROR);
}
return filePath+bFile.getFileName();
return bFile.getFileName();
}
@Override
......
......@@ -32,6 +32,10 @@ public class Global {
@Value("${global.path.base_upload_server_location}")
private String BASE_UPLOAD_SERVER_LOCATION;
/*服务器返回文件路径*/
@Value("${global.path.return_upload_server_location}")
private String RETURN_UPLOAD_SERVER_LOCATION;
/*课程相关文件路径*/
@Value("${global.path.course_location}")
......
......@@ -72,6 +72,7 @@ global:
pubPath: /lk/publicCerts.store
path:
base_upload_server_location: /working/resource/eduServer/
return_upload_server_location: http://192.168.5.201:18080/eduServer/
course_location: course
lesson_location: lesson
sl_location: sl
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment