Commit aebf5b1b authored by zhangqingle's avatar zhangqingle

Merge branch 'meiteng' of ssh://103.249.252.28:10022/lcy/education into meiteng

parents 2f273c7d 5f52f044
......@@ -74,7 +74,7 @@ public class BChapterController extends PaginationController<BChapter> {
@ApiOperation(value = "202 删除章节", notes = "根据ID删除一条记录")
@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar")
@ApiImplicitParam(name = "id", value = "章节Id", required = true, dataType = "varchar")
@PostMapping(value = "/remove")
public Result remove(CurUser curUser,@Valid String id,BindingResult br) {
PersistModel data = bChapterService.removeBChapter(id);
......
......@@ -298,57 +298,18 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
List<BChapter> queryBchapterStudentById(String chapterId);
@Select("<script>SELECT brc.student_id as studentId from b_r_student_chapter brc" +
"LEFT JOIN b_student bs ON brc.student_id = bs.business_id" +
"where bs.`code` = #{studentCode}" +
"AND brc.chapter_id = #{chapterId}</script>")
ScoreInfoDTO queryScoreByChapterId(@Param("chapterId") String chapterId, @Param("studentCode") String studentCode);
@Update("<script>update b_r_student_chapter " +
"set score = #{score}," +
"automatic = '0' " +
"where student_id = #{studentId} " +
"and chapter_id = #{chapterId}</script>")
int remark(@Param("chapterId") String chapterId, @Param("studentId") String studentId, @Param("score") String score);
@Insert("<script>insert into b_r_student_chapter(" +
"business_id,student_id,chapter_id,is_complete,sl_id,score,automatic) " +
"values (" +
"#{businessId},#{studentId},#{chapterId},'1',#{slId},#{score},'0')</script>")
int insertStudentScore(String businessId, String chapterId, String slId, String studentId, String score);
@Select("<script>SELECT bc.business_id as businessId, " +
"(SELECT CONCAT((SELECT sort from b_chapter where business_id = bc.pid), " +
"'.', " +
"(SELECT sort from b_chapter where business_id = bc.business_id), " +
"' ', " +
"(SELECT chapter_name from b_chapter where business_id = bc.business_id))) as chapterName " +
" from b_chapter bc where bc.pid !='-1' AND bc.sl_id = #{slId} ORDER BY chapterName </script>")
List<ChapterSelectDto> chapterListBySlId(String slId);
@Select("<script>select business_id from b_student where code = #{code} and del_flag = 0 and flag = 1</script>")
String queryStuIdByCode(String code);
/*@Update("<script>update b_r_student_chapter <trim prefix=\"set\" suffixOverrides=\",\"> " +
"<if test=\"pptFinish !=null and pptFinish != ''\"> ppt_finish = '1', </if>" +
"<if test=\"pdfFinish !=null and pdfFinish != '' \"> pdf_finish = '1', </if>" +
"<if test=\"videoFinish !=null and videoFinish != ''\"> video_finish = '1', </if>" +
"<if test=\"paperFinish !=null and paperFinish != ''\"> paper_finish = '1', </if>" +
"<if test=\"isComplete !=null and isComplete != ''\"> is_complete = #{isComplete}, </if>" +
"<if test=\"automatic !=null and automatic != ''\"> automatic = #{automatic}, </if>" +
"<if test=\"score !=null and score != ''\"> score = #{score}, </if>" +
"</trim> where student_id = #{studentId} and chapter_id = #{chapterId} </script>")*/
int updateToFinish(ScoreInfoDTO scoreInfoDTO);
@Select(" SELECT business_id AS businessId " +
" from b_r_student_chapter " +
" where student_id = #{stuId} " +
" and chapter_id = #{chapterId} LIMIT 1")
ScoreInfoDTO queryStudentChapter(@Param("chapterId") String chapterId, @Param("stuId") String stuId);
@Select("select paper_finish from b_r_student_chapter where chapter_id = #{chapterId} and student_id = #{userId}")
String queryPaperFinish(@Param("chapterId") String chapterId, @Param("userId") String userId);
@Insert("<script>insert into b_r_student_chapter" +
"(business_id,student_id,chapter_id,is_complete,sl_id,score,ppt_finish,pdf_finish,video_finish,paper_finish)" +
......@@ -414,5 +375,13 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
"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);
/**
* 根据章节id查询所在课程id
* @param businessId
* @return
*/
@Select("select lesson_id from b_chapter where business_id = #{businessId}")
String getLessonIdBychaperId(@Param("businessId") String businessId);
}
......@@ -15,9 +15,7 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* Created by gwf on 2017-7-21 15:08:47.
*/
public interface BChapterService{
/**
* 根据主键唯一查找
......@@ -127,20 +125,4 @@ public interface BChapterService{
int updateDownChapter(BChapter bChapter);
int updateAutomatic(String businessId);
String queryMdFileByChapterId(String businessId);
int Mark(String chapterId, String slId, String studentCode, String score);
List<ChapterSelectDto> chapterListBySlId(String slId);
String queryStuIdByCode(String code);
int updateToFinish(String type, String studentCode, String chapterId ,String slId);
String queryIsCompleteByUserIdAndChapId(String userInfoProp, String chapId);
int updateMdFile(String businessId, String mdFile);
}
......@@ -204,6 +204,7 @@ public class BChapterServiceImpl implements BChapterService {
bFile.setFileSize(dto.getFileSize());
if (model.getBusinessId() == null) {
//新建章节
UserUtil.setCurrentPersistOperation(model);
if (model.getClassHour() == null || model.getClassHour().equals("")) {
model.setClassHour("");
......@@ -226,7 +227,6 @@ public class BChapterServiceImpl implements BChapterService {
line = bChapterRepository.insertSelective(model);
} else {
model.setClassHour("1");
// model.setCorpId(corpId);
bFile.setChapterId(model.getBusinessId());
bFile.setLessonId(model.getLessonId());
......@@ -314,7 +314,10 @@ public class BChapterServiceImpl implements BChapterService {
if (isChapter && hasChild) {
throw new ServiceException(ResultServiceEnums.CHAPTER_HAS_CHILD);
}
int line = bChapterRepository.removeByPrimaryKey(id);
String lessonId = bChapterRepository.getLessonIdBychaperId(id);
bChapterRepository.updateClassHourInLesson(lessonId);
return new PersistModel(line);
}
......@@ -613,91 +616,5 @@ public class BChapterServiceImpl implements BChapterService {
return result;
}
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override
public int updateAutomatic(String businessId) {
String nowAutomatic = bChapterRepository.selectAutomatic(businessId);
String automatic = AutomaticEnum.AUTOMATIC_YES.getCode();
if (nowAutomatic.equals(AutomaticEnum.AUTOMATIC_YES.getCode())) {
automatic = AutomaticEnum.AUTOMATIC_NO.getCode();
}
int result = bChapterRepository.updateAutomatic(automatic, businessId);
return result;
}
@Override
public String queryMdFileByChapterId(String businessId) {
return bChapterRepository.queryMdFileByChapterId(businessId);
}
@Override
public int Mark(String chapterId, String slId, String studentCode, String score) {
// int line;
// ScoreInfoDTO scoreInfoDTO = bChapterRepository.queryScoreByChapterId(chapterId,studentCode);
// if(scoreInfoDTO!=null){//重新打分
// scoreInfoDTO.setAutomatic("0");
// line=bChapterRepository.remark(chapterId,scoreInfoDTO.getStudentId(),score);
// }else {//打分
//// BStudent student = bStudentRepository.selectOne(new BStudent(studentCode));
// line=bChapterRepository.insertStudentScore(IdGen.uuid(),chapterId,slId,student.getBusinessId(),score);
// }
//
// return line;
return 0;
}
@Override
public List<ChapterSelectDto> chapterListBySlId(String slId) {
return bChapterRepository.chapterListBySlId(slId);
}
@Override
public String queryStuIdByCode(String code) {
return bChapterRepository.queryStuIdByCode(code);
}
@Override
public int updateToFinish(String type, String studentCode, String chapterId, String slId) {
ScoreInfoDTO scoreInfoDTO = new ScoreInfoDTO();
scoreInfoDTO.setChapterId(chapterId);
String stuId = bChapterRepository.queryStuIdByCode(studentCode);
scoreInfoDTO.setStudentId(stuId);
if (type.equals("1")) {
scoreInfoDTO.setPptFinish("1");
} else if (type.equals("2")) {
scoreInfoDTO.setPdfFinish("1");
} else if (type.equals("3")) {
scoreInfoDTO.setVideoFinish("1");
} else if (type.equals("4")) {
scoreInfoDTO.setPaperFinish("1");
}
//查询是否已有关联关系
ScoreInfoDTO studentChapter = bChapterRepository.queryStudentChapter(chapterId, stuId);
if (studentChapter != null) {//update
scoreInfoDTO.setBusinessId(studentChapter.getBusinessId());
return bChapterRepository.updateToFinish(scoreInfoDTO);
} else {//insert
scoreInfoDTO.setSlId(slId);
scoreInfoDTO.setScore(-1);
UserUtil.setCurrentPersistOperation(scoreInfoDTO);
return bChapterRepository.insertStudentChapter(scoreInfoDTO);
}
}
@Override
public String queryIsCompleteByUserIdAndChapId(String userId, String chapId) {
return bChapterRepository.queryIsCompleteByUserIdAndChapId(userId, chapId);
}
@Override
public int updateMdFile(String businessId, String mdFile) {
BChapter bChapter = new BChapter();
bChapter.setBusinessId(businessId);
bChapter.setMdFile(mdFile);
return bChapterRepository.updateByPrimaryKeySelective(bChapter);
}
}
......@@ -594,7 +594,8 @@ public class BLessonController extends PaginationController<BLesson> {
bLessonService.findAppointPerson(curUser,lessonId));
}
@ApiOperation(value = "634 收藏课程或培训", notes = "收藏课程或培训")
@ApiOperation(value = "635 收藏课程或培训", notes = "收藏课程或培训")
@ApiImplicitParam(name = "lessonId", value = "培训/课程id", required = true, dataType = "varchar")
@GetMapping(value = "/collectLesson")
public Result collectLesson(CurUser curUser, String lessonId) {
return Result.builder(bLessonService.colletLesson(curUser, lessonId),
......@@ -603,7 +604,8 @@ public class BLessonController extends PaginationController<BLesson> {
curUser.getUserId());
}
@ApiOperation(value = "635 取消收藏课程或培训", notes = "取消收藏课程或培训")
@ApiOperation(value = "636 取消收藏课程或培训", notes = "取消收藏课程或培训")
@ApiImplicitParam(name = "lessonId", value = "培训/课程id", required = true, dataType = "varchar")
@GetMapping(value = "/notCollectLesson")
public Result notCollectLesson(CurUser curUser, String lessonId) {
return Result.builder(bLessonService.notColletLesson(curUser, lessonId),
......
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