Commit af4547d6 authored by zhangqingle's avatar zhangqingle

Merge remote-tracking branch 'origin/meiteng' into zql

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