Commit bdab4573 authored by luzhuang's avatar luzhuang

修改

parent 2426ac2a
# 修改 blesson value 19-12-10
ALTER table b_lesson modify column value_consume VARCHAR (16);
ALTER table b_lesson modify column value_gain VARCHAR (16);
# 修改 b_lesson_person value 19-12-10
ALTER table b_lesson_person modify column `value` VARCHAR (16);
# 修改 b_person_value value 19-12-10
ALTER table b_person_value modify column `value` VARCHAR (16);
# 修改 b_release_value value 19-12-10
ALTER table b_release_value modify column lesson_value VARCHAR (16);
ALTER table b_release_value modify column train_value VARCHAR (16);
# 添加b_person_value lessonId 字段 19-12-11
alter table b_person_value add lesson_id varchar(64) COMMENT '课程或培训id' after type;
# -------------测试环境已更新--------------
......@@ -6,6 +6,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.business.brstudentchapter.dto.BRStudentChapterDto;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.sys.user.bean.CurUser;
......@@ -44,11 +45,11 @@ public class BRStudentChapterController extends PaginationController<BRStudentCh
@PostMapping(value = "/add")
public Result addOrUpdate(CurUser curUser, @Valid BRStudentChapterDto brStudentChapterDto, BindingResult bindingResult) {
brStudentChapterDto.setStudentId(curUser.getUserId());
PersistModel data = bRStudentChapterServiceImpl.save(brStudentChapterDto, curUser);
return Result.builder(data,
// String currentProgress = bRStudentChapterServiceImpl.save(brStudentChapterDto, curUser);
return Result.builder( new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
brStudentChapterDto);
bRStudentChapterServiceImpl.save(brStudentChapterDto, curUser));
}
}
package org.rcisoft.business.brstudentchapter.service;
import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.business.brstudentchapter.dto.BRStudentChapterDto;
import org.rcisoft.business.brstudentchapter.entity.BRStudentChapter;
import org.rcisoft.core.model.PersistModel;
......@@ -18,7 +19,7 @@ public interface BRStudentChapterService {
* @param bRStudentChapter
* @return
*/
PersistModel save(BRStudentChapterDto bRStudentChapter, CurUser curUser);
String save(BRStudentChapterDto bRStudentChapter, CurUser curUser);
/**
* 根据id查询
......
......@@ -65,8 +65,9 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel save(BRStudentChapterDto brStudentChapterDto, CurUser curUser){
public String save(BRStudentChapterDto brStudentChapterDto, CurUser curUser){
int line = 0;
String currentProgress = "";
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(0);
// 查詢是否已經開始觀看此章節
......@@ -78,12 +79,14 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
// 判断进度 是否大于数据库已经存在的进度
double now = brStudentChapter.getProgress();
if (now >= old){ // 进度大于以前的进度
currentProgress = (now*100)+"%";
if (brStudentChapterDto.getMaxPosition() != null){
brStudentChapter.setMaxPosition(brStudentChapterDto.getMaxPosition());
}
line = bRStudentChapterRepository.updateById(brStudentChapter);
}else { // 反之,只需更新最近看的时间
brStudentChapter.setProgress(old);
currentProgress = (old*100)+"%";
line = bRStudentChapterRepository.updateById(brStudentChapter);
}
}else { // 更新
......@@ -128,9 +131,10 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
totalProgress = tempTotalProgress > 100 ? "100%" : tempTotalProgress < 0 ? "0%" : tempTotalProgress + "%";
// totalProgress = tempTotalProgress + "%";
};
BLessonPerson bLessonPerson = new BLessonPerson();
// 判斷是否已經開始觀看此課程
if (null != bLessonPersonList && bLessonPersonList.size() >0 && bLessonPersonList.get(0) != null){
BLessonPerson bLessonPerson = this.dealBLessonPerson(bLessonPersonList.get(0),brStudentChapterDto,totalProgress);
bLessonPerson = this.dealBLessonPerson(bLessonPersonList.get(0),brStudentChapterDto,totalProgress);
//TODO 判断是否为已学完 曾经是否学完过 奖励积分
BLesson bLesson = bLessonRepository.selectByPrimaryKey(brStudentChapterDto.getLessonId());
if (bLesson != null && "2".equals(bLessonPerson.getIsFinish()) && !("1".equals(bLessonPerson.getEverFinished()))){
......@@ -141,7 +145,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
}
bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
}else {
BLessonPerson bLessonPerson = new BLessonPerson();
bLessonPerson.initModel();
bLessonPerson = this.dealBLessonPerson(bLessonPerson,brStudentChapterDto,totalProgress);
bLessonPerson.setPersonId(brStudentChapterDto.getStudentId());
......@@ -163,7 +167,7 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
bChapter.setCourseTime(brStudentChapterDto.getDuration().toString());
line = bChapterRepository.updateByPrimaryKeySelective(bChapter) > line ? bChapterRepository.updateByPrimaryKeySelective(bChapter): line;
}
return new PersistModel(line);
return currentProgress;
}
// b_r_student_chapter
......
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