Commit 4f28300d authored by luzhuang's avatar luzhuang

获取视频/音频时间存入

parent 477a772b
......@@ -10,10 +10,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bchapter.dto.QueryChapterListDTO;
import org.rcisoft.business.bchapter.dto.QueryChapterListResDTO;
import org.rcisoft.business.bchapter.dto.QueryScoreListDTO;
import org.rcisoft.business.bchapter.dto.ScoreInfoDTO;
import org.rcisoft.business.bchapter.dto.*;
import org.rcisoft.business.bchapter.entity.BChapter;
import org.rcisoft.business.bchapter.enums.IsCompleteEnum;
import org.rcisoft.business.bchapter.service.BChapterService;
......@@ -66,19 +63,13 @@ public class BChapterController extends PaginationController<BChapter> {
private Global global;
@ApiOperation(value = "201 添加/编辑章节", notes = "businessId为空时是添加方法,不为空时是修改方法")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "课程id 修改章节时传入", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "lessonId", value = "课程ID", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "chapterName", value = "章节名", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "pid", value = "上一级(添加节需要)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "chapterLevel", value = "等级,1:章 2:节", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "type", value = "课件类型(单选) 0视频 1音频 2PPT 3pdf 4资料", required = true, dataType = "varchar")})
@PostMapping(value = "/add")
public Result add(CurUser curUser, @Valid BChapter bChapter, BindingResult bindingResult, uploadDTO dto) {
PersistModel data = bChapterService.persist(bChapter,curUser.getCorpId(),dto);
public Result add(CurUser curUser, @Valid ChapterDTO chapterDTO, BindingResult bindingResult, uploadDTO dto) {
PersistModel data = bChapterService.persist(chapterDTO,curUser.getCorpId(),dto);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bChapter);
chapterDTO);
}
......@@ -124,8 +115,9 @@ public class BChapterController extends PaginationController<BChapter> {
bChapterService.queryBChaptersWithProgress(lessonId,curUser));
}
@RequestMapping("/getFile")
@ApiOperation(value = "206 流 输出ppt转为pdf", notes = "流 输出ppt转为pdf", response = QueryChapterListResDTO.class)
@GetMapping("/getFile")
public Result getFile(CurUser curUser, @RequestParam String chapterId, BindingResult br,HttpServletRequest request , HttpServletResponse response) throws IOException {
String newFileUrl = bChapterService.changeFileToPdf(chapterId);
//读取路径下面的文件
......@@ -168,17 +160,6 @@ public class BChapterController extends PaginationController<BChapter> {
newFileUrl);
}
// @ApiOperation(value = "206 获取uuid", notes = "获取uuid用于添加章节时使用")
// @PostMapping(value = "/getid")
// public Result getUuid() {
// String data = IdGen.uuid();
// return Result.builder(new PersistModel(1),
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// data);
// }
//
// @ApiOperation(value = "更改章节状态", notes = "根据章节ID更改章节状态")
// @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
......
......@@ -375,39 +375,6 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
int updateClassHourInLesson(@Param("lessonId") String lessonId);
// @Insert("<script>insert into b_chapter " +
// "<trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\"> " +
// "<if test=\"businessId !=null and businessId != ''\"> business_id, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> create_by, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> create_date, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> update_by, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> update_date, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> del_flag, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> flag, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> remarks, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> chapter_name, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> chapter_level, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> pid, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> chapter_url, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> md_file, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> is_test, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> lesson_id, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> class_hour, </if> " +
// "<if test=\"state !=null and state != ''\"> state, </if> " +
// "<if test=\"sort !=null and sort != ''\"> sort, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> is_test, </if> " +
// "<if test=\"businessId !=null and businessId != ''\"> is_test, </if> " +
//
// "</trim>"+
// "<trim prefix=\"values (\" suffix=\")\" suffixOverrides=\",\">"+
// "<if test=\"businessId !=null and businessId != ''\"> #{businessId}, </if> " +
//
// "</trim>"+
// "</script>")
//
//
// int insertBChapter(BChapter model);
@Select("<script>" +
"SELECT bc.*, brc.current_location as currentLocation, bf.video_url as videoUrl " +
"FROM " +
......@@ -423,5 +390,26 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"</script>")
@ResultMap(value = "SupperChildListResultMap")
QueryChapterListResDTO getWithCurrentChapterBylessonId(@Param("lessonId")String lessonId);
/**
* 根据business_id将第一章第一节的课程时长加到course_time
* @param time
* @param id
* @return
*/
@Update("UPDATE b_lesson set course_time = #{time} where business_id =#{id}")
int updateVideoTimeInLesson(@Param("time") String time,@Param("id") String id);
/**
* 根据lessonid获取它第一章第一节的章节id
* @param lessonId
* @return
*/
@Select("SELECT business_id FROM b_chapter " +
"WHERE pid = " +
"( SELECT business_id FROM b_chapter " +
"WHERE lesson_id = #{lessonId} AND chapter_level = 1 AND del_flag != 1 AND flag = 1 ORDER BY sort LIMIT 1 ) " +
"ORDER BY sort LIMIT 1")
String getFirstChapter(@Param("lessonId") String lessonId);
}
package org.rcisoft.business.bchapter.dto;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ChapterDTO {
@ApiModelProperty(value = "课程id 修改章节时传入")
private String businessId;
@ApiModelProperty(value = "课程ID")
private String lessonId;
@ApiModelProperty(value = "章节名")
private String chapterName;
@ApiModelProperty(value = "上一级(添加节需要)")
private String pid;
@ApiModelProperty(value = "等级,1:章 2:节")
private Byte chapterLevel;
}
package org.rcisoft.business.bchapter.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -71,7 +72,7 @@ public class BChapter extends IdEntity<BChapter> {
/*章节排序*/
private Integer sort;
/*课程时长 节填 章不填*/
// @ApiModelProperty(value = "课程时长 节填 章不填")
private String courseTime;
@Transient
......@@ -132,7 +133,6 @@ public class BChapter extends IdEntity<BChapter> {
@Transient
private String fileName;
public BChapter(String businessId) {
this.businessId = businessId;
}
......
......@@ -57,10 +57,10 @@ public interface BChapterService{
/**
* 插入
* @param model
* @param chapterDTO
* @return
*/
PersistModel persist(BChapter model, String corpId, uploadDTO dto);
PersistModel persist(ChapterDTO chapterDTO, String corpId, uploadDTO dto);
/**
* 修改
......
......@@ -170,9 +170,19 @@ public class BChapterServiceImpl implements BChapterService {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override
public PersistModel persist(BChapter model, String corpId, uploadDTO dto) {
public PersistModel persist(ChapterDTO chapterDTO, String corpId, uploadDTO dto) {
int line = 0;
BFile bFile = new BFile();
BChapter model = new BChapter();
//将dto中的数据放入bchapter实体类中
model.setBusinessId(chapterDTO.getBusinessId());
model.setLessonId(chapterDTO.getLessonId());
model.setChapterName(chapterDTO.getChapterName());
model.setPid(chapterDTO.getPid());
model.setChapterLevel(chapterDTO.getChapterLevel());
// if ("2".equals(dto.getType())||"4".equals(dto.getType())){
// mtCotactApiRequestClient.fileChange(dto);
// }
......@@ -198,11 +208,20 @@ public class BChapterServiceImpl implements BChapterService {
}
int sort = bChapterRepository.selectMaxSort(model.getPid(), model.getLessonId());
model.setSort(sort);
model.setCourseTime(dto.getFileTime());
// model.setCorpId(corpId);
bFile.setChapterId(model.getBusinessId());
bFile.setLessonId(model.getLessonId());
UserUtil.setCurrentPersistOperation(bFile);
//新建章节数据插入到chapter表
line = bChapterRepository.insertSelective(model);
//先判断该课程的第一章的第一节是否是本节 更新blesson表中course_time字段
String cid = bChapterRepository.getFirstChapter(model.getLessonId());
if(cid.equals(model.getBusinessId()) ){
bChapterRepository.updateVideoTimeInLesson(model.getCourseTime(),model.getLessonId());
}
//上传文件数据插入到bfile表中
int x = bFileRepository.insertUploadFile(bFile);
bChapterRepository.updateClassHourInLesson(model.getLessonId());//更新b_lesson表中 class_hour
} else {
......@@ -210,8 +229,15 @@ public class BChapterServiceImpl implements BChapterService {
bFile.setChapterId(model.getBusinessId());
UserUtil.setCurrentMergeOperation(bFile);
model.setCourseTime(dto.getFileTime());
//先判断该课程的第一章的第一节是否是本节 更新blesson表中course_time字段
String cid = bChapterRepository.getFirstChapter(model.getLessonId());
if(cid.equals(model.getBusinessId()) ){
bChapterRepository.updateVideoTimeInLesson(model.getCourseTime(),model.getLessonId());
}
line = bChapterRepository.updateByPrimaryKeySelective(model);
int x = bFileRepository.updateUploadFile(bFile);
}
......
......@@ -18,15 +18,6 @@ public interface BFileRepository extends BaseMapper<BFile> {
@Update("UPDATE b_chapter set course_time = #{time} where business_id =#{id}")
int updateVideoTimeInChapter(@Param("time") String time,@Param("id") String id);
@Update("UPDATE b_lesson set course_time = #{time} where business_id =#{id}")
int updateVideoTimeInLesson(@Param("time") String time,@Param("id") String id);
@Select("SELECT business_id FROM b_chapter " +
"WHERE pid = " +
"( SELECT business_id FROM b_chapter " +
"WHERE lesson_id = #{lessonId} AND chapter_level = 1 AND del_flag != 1 AND flag = 1 ORDER BY sort LIMIT 1 ) " +
"ORDER BY sort LIMIT 1")
String getFirstChapter(@Param("lessonId") String lessonId);
/**
* 根据条件查找
......
......@@ -15,9 +15,12 @@ public class uploadDTO {
@Length(min = 1,max = 256,message = "长度最小为1,最大为200")
private String videoUrl;
@ApiModelProperty(value = "0视频 1音频 2ppt 3pdf 4word")
@ApiModelProperty(value = "课件类型(单选) 0视频 1音频 2PPT 3pdf 4word")
private String type;
@ApiModelProperty(value = "文件大小")
private String fileSize;
@ApiModelProperty(value = "视频/音频时间")
private String fileTime;
}
......@@ -23,4 +23,16 @@ public class FindDepartByNameDTO {
@ApiModelProperty(value = "是否有子部门", position = 36)
@Order(37)
private String flag;
private String corpId;
private String outerId;
private String pid;
private String pids;
private String isCreateImgroup;
private int sort;
private String isBiz;
private String managers;
private String creator;
private String createAt;
private String updator;
private String updateAt;
}
......@@ -82,6 +82,8 @@ global:
pdf_location: pdf
cut_pdf_location: cutPdf
cource_logo_location: /course/logo
return_upload_server_location: http://192.168.5.201:18080/eduServer/
other:
is_server_linux: 5
cut_pdf_num: 30
......
......@@ -90,8 +90,6 @@ libreoffice:
port: 10188
mt:
api: http://192.168.5.47/api/
eureka:
instance:
hostname: localhost
......
......@@ -13,7 +13,7 @@
<appender name="fileInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<level>info</level>
<onMatch>DENY</onMatch>
<onMismatch>ACCEPT</onMismatch>
</filter>
......@@ -25,7 +25,7 @@
<!--滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--路径-->
<fileNamePattern>/working/test/info.%d.log</fileNamePattern>
<fileNamePattern>/working/test/info_edu.%d.log</fileNamePattern>
</rollingPolicy>
</appender>
......@@ -46,7 +46,7 @@
<!--滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--路径-->
<fileNamePattern>/working/test/error.%d.log</fileNamePattern>
<fileNamePattern>/working/test/error_edu.%d.log</fileNamePattern>
</rollingPolicy>
</appender>
<!--
......@@ -65,14 +65,12 @@
</springProfile>
<springProfile name="prod">
<root level="info">
<root level="debug">
<appender-ref ref="consoleLog" />
<appender-ref ref="fileInfoLog" />
<appender-ref ref="fileErrorLog" />
</root>
</springProfile>
<springProfile name="mt">
<root level="info">
<appender-ref ref="consoleLog" />
......
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