Commit 9cdc52f3 authored by YangZhaoJun1's avatar YangZhaoJun1

重新转换ppt接口

parent be0ebdae
...@@ -14,7 +14,7 @@ public interface BSubtaskRepository extends BaseMapper<BSubtask> { ...@@ -14,7 +14,7 @@ public interface BSubtaskRepository extends BaseMapper<BSubtask> {
// @Select("SELECT DISTINCT(`status`) from b_subtask\n" + // @Select("SELECT DISTINCT(`status`) from b_subtask\n" +
// "where arrange_id = \n" + // "where arrange_id = \n" +
// "(SELECT arrange_id FROM b_subtask where business_id = #{subTaskId})") // "(SELECT arrange_id FROM b_subtask where business_id = #{subTaskId})")
@Select("SELECT DISTINCT(status) from b_subtask where arrange_id = #{0}") @Select("SELECT DISTINCT(status) from b_subtask where arrange_id = #{0} and del_flag = 0")
List<String> querySubTaskStatusById(String arrangeId); List<String> querySubTaskStatusById(String arrangeId);
@Select("SELECT arrange_id FROM b_subtask where business_id = #{subTaskId}") @Select("SELECT arrange_id FROM b_subtask where business_id = #{subTaskId}")
......
...@@ -274,6 +274,10 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -274,6 +274,10 @@ public class BChapterServiceImpl implements BChapterService {
chapterList.add(sl_chapter); chapterList.add(sl_chapter);
} }
if(chapterList.size()>0){
for (int i=0;i<chapterList.size();i++){ for (int i=0;i<chapterList.size();i++){
if(!chapterList.get(i).getPid().equals("-1")){ if(!chapterList.get(i).getPid().equals("-1")){
//取出map中存放的新的章ID作为父节点ID //取出map中存放的新的章ID作为父节点ID
...@@ -281,9 +285,8 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -281,9 +285,8 @@ public class BChapterServiceImpl implements BChapterService {
} }
} }
if(chapterList.size()>0){
result = bChapterRepository.insertChapterList(chapterList); result = bChapterRepository.insertChapterList(chapterList);
}
String oldPath = global.getBASE_UPLOAD_SERVER_LOCATION()+File.separator String oldPath = global.getBASE_UPLOAD_SERVER_LOCATION()+File.separator
+global.getCOURSE_LOCATION()+File.separator +global.getCOURSE_LOCATION()+File.separator
...@@ -296,7 +299,10 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -296,7 +299,10 @@ public class BChapterServiceImpl implements BChapterService {
//复制章节的所有文件 //复制章节的所有文件
try { try {
File file = new File(oldPath);
if(file.exists()){
copyFileToSl(oldPath,newPath); copyFileToSl(oldPath,newPath);
}
/*File oldFile = new File(oldPath); /*File oldFile = new File(oldPath);
File newFile = new File(newPath); File newFile = new File(newPath);
FileUtils.copyDirectory(oldFile,newFile,true);*/ FileUtils.copyDirectory(oldFile,newFile,true);*/
...@@ -304,6 +310,7 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -304,6 +310,7 @@ public class BChapterServiceImpl implements BChapterService {
throw new ServiceException(ResultServiceEnums.COPY_FILES_ERROR); throw new ServiceException(ResultServiceEnums.COPY_FILES_ERROR);
} }
//数据库操作 //数据库操作
for (BChapter leBChapter : lessonList){ for (BChapter leBChapter : lessonList){
for(BChapter slChapter : chapterList){ for(BChapter slChapter : chapterList){
...@@ -347,6 +354,12 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -347,6 +354,12 @@ public class BChapterServiceImpl implements BChapterService {
} }
} }
} }
}
return result; return result;
} }
......
...@@ -192,5 +192,19 @@ public class BFileController extends PaginationController<BFile> { ...@@ -192,5 +192,19 @@ public class BFileController extends PaginationController<BFile> {
""); "");
} }
@ApiOperation(value="重新转换ppt", notes="重新转换ppt")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "课程或开课的ID", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "type", value = "'0'开课,'1'课程", required = true, dataType = "varchar")})
@GetMapping(value = "/reConversionPPTWithoutAuth")
public Result reConversionPPTWithoutAuth(String businessId, String type) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bFileService.reConversionPPT(businessId,type));
}
} }
...@@ -57,4 +57,6 @@ public interface BFileService { ...@@ -57,4 +57,6 @@ public interface BFileService {
* @param file * @param file
*/ */
public void uploadLicense(MultipartFile file) throws IOException; public void uploadLicense(MultipartFile file) throws IOException;
List<String> reConversionPPT(String businessId, String type);
} }
...@@ -25,6 +25,10 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -25,6 +25,10 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.*; import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -85,6 +89,7 @@ public class BFileServiceImpl implements BFileService { ...@@ -85,6 +89,7 @@ public class BFileServiceImpl implements BFileService {
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public String uploadVideoToServer(List<MultipartFile> list, BFile bFile, String token) { public String uploadVideoToServer(List<MultipartFile> list, BFile bFile, String token) {
String videoUrl = ""; String videoUrl = "";
...@@ -228,7 +233,6 @@ public class BFileServiceImpl implements BFileService { ...@@ -228,7 +233,6 @@ public class BFileServiceImpl implements BFileService {
if(!outFile.exists()){//判断保存路径是否存在,不存在新建 if(!outFile.exists()){//判断保存路径是否存在,不存在新建
outFile.mkdirs(); outFile.mkdirs();
} }
//上传文件 //上传文件
String uploadFile = file.getOriginalFilename(); String uploadFile = file.getOriginalFilename();
...@@ -318,8 +322,54 @@ public class BFileServiceImpl implements BFileService { ...@@ -318,8 +322,54 @@ public class BFileServiceImpl implements BFileService {
return; return;
} }
/**
* 重新转换ppt
* @param businessId
* @param type 0开课 1课程
* @return
*/
@Override
public List<String> reConversionPPT(String businessId, String type) {
List<String> failPPTPath = new ArrayList<>();
try {
String basePath = global.getSL_LOCATION();
if(type.equals("1")){
basePath = global.getLESSON_LOCATION();
}
String path = global.getBASE_UPLOAD_SERVER_LOCATION() + File.separator
+ global.getCOURSE_LOCATION() + File.separator
+ basePath + File.separator + businessId;
File file = new File(path);
failPPTPath = this.changePPTToPDF(file,failPPTPath);
public String uploadFileToServer(MultipartFile file, BFile bFile) throws Exception{ } catch (IOException e) {
e.printStackTrace();
}
return failPPTPath;
}
private List<String> changePPTToPDF(File slFile, List<String> failPPTPath) throws IOException {
for (File chapterFile : slFile.listFiles()) {
String pptPath = chapterFile.getPath()+File.separator+"ppt";
File pptFile = new File(pptPath);
if(pptFile.exists()){
File[] pptFiles = pptFile.listFiles();
if(pptFiles.length==1&&pptFiles[0].getName().endsWith("ppt")){
failPPTPath.add(pptFiles[0].getPath());
String inputFile = pptFiles[0].getPath();
String outputFile = pptFiles[0].getPath().substring(0,pptFiles[0].getPath().lastIndexOf(".")) + ".pdf";
slTask.officeToPdf(inputFile,outputFile);
}
}
}
return failPPTPath;
}
/*public String uploadFileToServer(MultipartFile file, BFile bFile) throws Exception{
String fileUrl = ""; String fileUrl = "";
//查询此节是否已有视频或文件 //查询此节是否已有视频或文件
BFile f = bFileRepository.selectInfoByChapterId(bFile.getChapterId()); BFile f = bFileRepository.selectInfoByChapterId(bFile.getChapterId());
...@@ -339,7 +389,7 @@ public class BFileServiceImpl implements BFileService { ...@@ -339,7 +389,7 @@ public class BFileServiceImpl implements BFileService {
} }
} }
return fileUrl; return fileUrl;
} }*/
......
...@@ -130,8 +130,7 @@ public class BGradeServiceImpl implements BGradeService { ...@@ -130,8 +130,7 @@ public class BGradeServiceImpl implements BGradeService {
newGrades.add(grade); newGrades.add(grade);
} }
bGradeRepository.insertList(newGrades); bGradeRepository.insertList(newGrades);
} }else{
//查询是否有本年的年级 //查询是否有本年的年级
// List<BGrade> bGrades = bGradeRepository.queryBGradeByNowYear(nowYear); // List<BGrade> bGrades = bGradeRepository.queryBGradeByNowYear(nowYear);
String nowYearCode = grades.get(0).getCode(); String nowYearCode = grades.get(0).getCode();
...@@ -142,6 +141,9 @@ public class BGradeServiceImpl implements BGradeService { ...@@ -142,6 +141,9 @@ public class BGradeServiceImpl implements BGradeService {
UserUtil.setCurrentPersistOperation(grade); UserUtil.setCurrentPersistOperation(grade);
bGradeRepository.insertSelective(grade); bGradeRepository.insertSelective(grade);
} }
}
grades = bGradeRepository.queryFirstFiveBGrades(bGrade); grades = bGradeRepository.queryFirstFiveBGrades(bGrade);
return grades; return grades;
} }
......
package org.rcisoft.business.brclassstudent.dao; package org.rcisoft.business.brclassstudent.dao;
import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.business.brclassstudent.entity.BRClassStudent; import org.rcisoft.business.brclassstudent.entity.BRClassStudent;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.springframework.security.access.method.P;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
...@@ -75,6 +73,6 @@ public interface BRClassStudentRepository extends BaseMapper<BRClassStudent> { ...@@ -75,6 +73,6 @@ public interface BRClassStudentRepository extends BaseMapper<BRClassStudent> {
"WHERE bcs.student_code=#{studentCode} " + "WHERE bcs.student_code=#{studentCode} " +
"AND bc.type=#{type}</script>") "AND bc.type=#{type}</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
BRClassStudent queryClassStudent(String studentCode, String type); BRClassStudent queryClassStudent(@Param("studentCode") String studentCode, @Param("type") String type);
} }
...@@ -33,7 +33,6 @@ public interface BStudentRepository extends BaseMapper<BStudent> { ...@@ -33,7 +33,6 @@ public interface BStudentRepository extends BaseMapper<BStudent> {
"LEFT JOIN b_grade bg ON b.grade_code = bg.`code`\n" + "LEFT JOIN b_grade bg ON b.grade_code = bg.`code`\n" +
"where b.del_flag != 1 and b.flag = 1 "+ "where b.del_flag != 1 and b.flag = 1 "+
"<if test=\"condition!=null and condition != ''\">and u.`name` like CONCAT('%',#{condition},'%') or b.`code` like CONCAT('%',#{condition},'%') </if>"+ "<if test=\"condition!=null and condition != ''\">and u.`name` like CONCAT('%',#{condition},'%') or b.`code` like CONCAT('%',#{condition},'%') </if>"+
//"order by b.grade_code desc" +
"order by b.create_date desc" + "order by b.create_date desc" +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
...@@ -64,6 +63,7 @@ public interface BStudentRepository extends BaseMapper<BStudent> { ...@@ -64,6 +63,7 @@ public interface BStudentRepository extends BaseMapper<BStudent> {
"<if test=\"classCode!=null and classCode != ''\">\n" + "<if test=\"classCode!=null and classCode != ''\">\n" +
" AND t6.code = #{classCode}\n" + " AND t6.code = #{classCode}\n" +
"</if>" + "</if>" +
"group by t3.code " +
"order by className asc,code asc</script>") "order by className asc,code asc</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BStudent> queryStudentBySlCode(@Param("slCode") String slCode, @Param("classCode") String classCode); List<BStudent> queryStudentBySlCode(@Param("slCode") String slCode, @Param("classCode") String classCode);
...@@ -178,7 +178,7 @@ public interface BStudentRepository extends BaseMapper<BStudent> { ...@@ -178,7 +178,7 @@ public interface BStudentRepository extends BaseMapper<BStudent> {
"LEFT JOIN b_r_class_student bcs on bcs.student_code = bs.`code` " + "LEFT JOIN b_r_class_student bcs on bcs.student_code = bs.`code` " +
"LEFT JOIN b_class bc on bc.`code` = bcs.class_code " + "LEFT JOIN b_class bc on bc.`code` = bcs.class_code " +
"WHERE FIND_IN_SET(bcs.class_code,( " + "WHERE FIND_IN_SET(bcs.class_code,( " +
"SELECT bec.classes_id FROM b_edu_class bec WHERE bec.`code` = 'D0001')) " + "SELECT bec.classes_id FROM b_edu_class bec WHERE bec.`code` = #{classCode})) " +
"GROUP BY bs.`code` " + "GROUP BY bs.`code` " +
"ORDER BY bs.`code`") "ORDER BY bs.`code`")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
......
...@@ -70,11 +70,13 @@ public interface BTermRepository extends BaseMapper<BTerm> { ...@@ -70,11 +70,13 @@ public interface BTermRepository extends BaseMapper<BTerm> {
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
BTerm queryCurrentTerm(String termCode); BTerm queryCurrentTerm(String termCode);
@Select("select * from b_term " + @Select("<script>select * from b_term " +
"WHERE (#{startDate} BETWEEN start_date AND end_date) " + "WHERE ((#{startDate} BETWEEN start_date AND end_date) " +
"OR (#{endDate} BETWEEN start_date AND end_date) " + "OR (#{endDate} BETWEEN start_date AND end_date) " +
"OR (start_date BETWEEN #{startDate} AND #{endDate}) " + "OR (start_date BETWEEN #{startDate} AND #{endDate}) " +
"OR (end_date BETWEEN #{startDate} AND #{endDate})") "OR (end_date BETWEEN #{startDate} AND #{endDate})) " +
"<if test=\"businessId !=null and businessId != '' \">and business_id != #{businessId} </if>" +
"</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BTerm> queryBTermsByStartDateOrEndDate(BTerm model); List<BTerm> queryBTermsByStartDateOrEndDate(BTerm model);
......
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