Commit 1eb628f0 authored by zhangqingle's avatar zhangqingle

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

parents 8f727f43 0162a679
......@@ -306,7 +306,7 @@ public class BChapterServiceImpl implements BChapterService {
int x = bFileRepository.insertUploadFile(bFile);
bChapterRepository.updateClassHourInLesson(model.getLessonId());//更新b_lesson表中 class_hour
// 更新课程总进度
this.updateLessonProgress(chapterDTO.getLessonId(), true);
this.updateLessonProgress(chapterDTO.getLessonId(), true, 0);
log.debug("-----------------------------更新课时成功-------------------");
}
} else {
......@@ -431,7 +431,7 @@ public class BChapterServiceImpl implements BChapterService {
* @param add true: 新增 false 删除
*/
// 新增章节 - 更新学生观看课程总进度
private void updateLessonProgress(String lessonId, boolean add){
private void updateLessonProgress(String lessonId, boolean add, double delProgress){
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(2);
List<BLessonPerson> bLessonPersonList = bLessonPersonRepository.selectByLessonId(lessonId);
......@@ -445,20 +445,25 @@ public class BChapterServiceImpl implements BChapterService {
if (add){
newLearnProgress =Integer.parseInt(bLesson.getClassHour()) -1 == 0? "0": numberFormat.format( learnProgress * (Integer.parseInt(bLesson.getClassHour()) -1) / (Double.parseDouble(bLesson.getClassHour())) );
}else {
newLearnProgress = Integer.parseInt(bLesson.getClassHour()) == 0 ? "0" : numberFormat.format( Math.floor(learnProgress * Integer.parseInt(bLesson.getClassHour() + 1) / Double.parseDouble(bLesson.getClassHour()) ));
newLearnProgress = numberFormat.format(learnProgress - delProgress/ (Integer.parseInt(bLesson.getClassHour()) + 1));
// newLearnProgress = numberFormat.format(((learnProgress * Integer.parseInt(bLesson.getClassHour() + 1) - delProgress) / Double.parseDouble(bLesson.getClassHour()) ));
}
if (learnProgress > 0 && Double.parseDouble(newLearnProgress) < 0.01){
if (0 == Double.parseDouble(newLearnProgress)){
lessonPerson.setIsFinish("0");
lessonPerson.setFinishDate(null);
}else {
if (learnProgress > 0 && Double.parseDouble(newLearnProgress) < 0.01) {
newLearnProgress = "0.01";
}
if ("2".equals(lessonPerson.getIsFinish()) && Double.parseDouble(newLearnProgress) < 1){
if ("2".equals(lessonPerson.getIsFinish()) && Double.parseDouble(newLearnProgress) < 1) {
lessonPerson.setIsFinish("1");
lessonPerson.setFinishDate(null);
}
if (Double.parseDouble(newLearnProgress) >= 1){
if (Double.parseDouble(newLearnProgress) >= 1) {
newLearnProgress = "1";
lessonPerson.setIsFinish("2");
}
}
//TODO 判断 曾经是否学完过 奖励积分
if ( "2".equals(lessonPerson.getIsFinish()) && !"1".equals(lessonPerson.getEverFinished())){
//查询课程信息
......@@ -510,8 +515,6 @@ public class BChapterServiceImpl implements BChapterService {
String time = bChapterRepository.getTimeByChapterId(secondId);
//更新到b_lesson 表
bChapterRepository.updateCourseTimeForLesson(time,lessonId);
// 更新学生 对应章节总进度
this.updateLessonProgress(lessonId, false);
}
//更新表中sort
List<String> chapterIds = bChapterRepository.getChapterIds(bChapter.getPid(),bChapter.getLessonId());
......@@ -526,8 +529,16 @@ public class BChapterServiceImpl implements BChapterService {
//更新表中sort
bChapterRepository.updateSort(params);
}
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(id, userId);
double oldProgress = 0;
if (null !=brStudentChapterList && brStudentChapterList.size()>0){
oldProgress = brStudentChapterList.get(0).getProgress();
}
// 更新学生 对应章节总进度
this.updateLessonProgress(lessonId, false, oldProgress);
//删除student_chapter表中数据
bChapterRepository.deleteBStudentChapter(id,userId);
return new PersistModel(line);
}
......
......@@ -416,7 +416,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
" from tm_paper b " +
" left join tm_examdata a on a.e_pid = b.p_id " +
" left join tm_paper_link_branch plb on plb.ln_pid = b.p_id " +
" where plb.ln_buid= #{userId}" +
" where plb.ln_buid= #{personId}" +
" and corp_id = #{corpId}" +
"<if test= \" paperName != null and paperName != ''\">and b.p_name like concat('%',#{paperName},'%') </if> " +
"<if test= \" examType != null and examType != '' and examType == '0'.toString()\"> and b.p_id not in(select e_pid from tm_examdata where e_uid = #{userId}) and now() &gt; b.p_endtime </if> " +
......
package org.rcisoft.business.blesson.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
......@@ -29,11 +31,17 @@ public class ExamDto {
public String timeCost;
@ApiModelProperty(value = "开考时间")
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm")
public Date examStart;
@ApiModelProperty(value = "交卷时间")
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm")
public Date examEnd;
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm")
public Date PaperEndTime;
}
......@@ -30,16 +30,16 @@ public class ExamQueryDto {
private String consumeTimeEnd;
@ApiModelProperty(value = "开考时间起始",required = true)
private Date examTimeStart;
private String examTimeStart;
@ApiModelProperty(value = "开考时间截止",required = true)
private Date examTimeEnd;
private String examTimeEnd;
@ApiModelProperty(value = "交卷时间起始",required = true)
private Date handInTimeStart;
private String handInTimeStart;
@ApiModelProperty(value = "交卷时间截止",required = true)
private Date handInTimeEnd;
private String handInTimeEnd;
@ApiModelProperty(value = "试卷得分排序 0正序 1倒序",required = true)
private String scoreSort;
......@@ -53,6 +53,6 @@ public class ExamQueryDto {
@ApiModelProperty(value = "企业id",required = true)
private String corpId;
@ApiModelProperty(value = "用户id",required = true)
private String userId;
@ApiModelProperty(value = "详情用户id",required = true)
private String personId;
}
......@@ -12,10 +12,10 @@ public class PersonValueClientDto {
public String businessId;
@ApiModelProperty(value = "起始时间")
public Date startTime;
public String startTime;
@ApiModelProperty(value = "结束时间")
public Date endTime;
public String endTime;
@ApiModelProperty(value = "事件")
public String event;
......
......@@ -103,8 +103,8 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> {
* @return
*/
@Select("<script>" +
"select bl.business_id businessId,bl.lesson_name lessonName,su.name name," +
"bl.value_consume valueConsume,bl.value_gain valueGain ,bl.value_update_date updateDate " +
"select bl.business_id businessId,bl.lesson_name lessonName,su.name name,bl.release_state releaseState," +
"bl.value_consume valueConsume,bl.value_gain valueGain ,bl.value_update_date updateDate ,bl.train_start_date trainStart ,bl.train_over_date trainEnd " +
"from b_lesson bl " +
"left join s_user su on su.business_id = bl.lecturer_id " +
"where bl.del_flag !=1 and bl.flag = 1 " +
......@@ -114,6 +114,8 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> {
"<if test=\"dto.valueGainEnd!=null and dto.valueGainEnd != ''\"> and bl.value_gain &lt;= #{dto.valueGainEnd} </if> " +
"<if test=\"dto.lessonName!=null and dto.lessonName != ''\"> and bl.lesson_name like concat('%',#{dto.lessonName},'%') </if> " +
"<if test=\"dto.lecturerName!=null and dto.lecturerName != ''\"> and su.`name` like concat('%',#{dto.lecturerName},'%') </if> " +
"<if test=\"dto.status!=null and dto.status != ''\"> and bl.release_state in(${dto.status}) </if> " +
"<if test=\"dto.trainStatus!=null and dto.trainStatus != ''\"> and ( ${dto.trainStatus} )</if> " +
"and bl.corp_id = #{curUser.corpId} " +
"and bl.lesson_type = #{dto.type} " +
"</script>")
......
package org.rcisoft.business.breleasevalue.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
......@@ -17,5 +19,17 @@ public class LessonValueDto {
public String valueGain;
public String releaseState;
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm")
public Date trainStart;
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm")
public Date trainEnd;
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm")
public Date updateDate;
}
......@@ -24,6 +24,12 @@ public class LessonValueSettingQueryDto {
@ApiModelProperty(value = "积分获得最大值")
public String valueGainEnd;
@ApiModelProperty(value = "状态 0未发布 2已发布 4已关闭 (培训已发布后的状态===>)5培训未开始 6培训进行中 7培训已结束 ")
public String status;
@ApiModelProperty(value = "培训状态 0培训未开始 1培训进行中 2培训已结束 ")
public String trainStatus;
@ApiModelProperty(value = "0 课程 1培训")
public String type;
}
......@@ -26,10 +26,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
import lombok.extern.slf4j.Slf4j;
......@@ -108,7 +105,46 @@ public class BReleaseValueServiceImpl implements BReleaseValueService {
}catch (Exception e){
throw new ServiceException(ResultServiceEnums.NUM_IS_ERROR);
}
return bReleaseValueRepository.getLessonValue(curUser,dto);
if(dto.getTrainStatus() != null && !"".equals(dto.getTrainStatus())){
String[] trainStatus = dto.getTrainStatus().split(",");
StringBuffer sb = new StringBuffer(" 1 != 1");
for(String str : trainStatus){
if("0".equals(str)){
sb.append(" or bl.train_start_date > now()");
}if("1".equals(str)){
sb.append(" or now() BETWEEN bl.train_start_date and bl.train_over_date");
}if("2".equals(str)){
sb.append(" or bl.train_over_date < now() ");
}
}
dto.setTrainStatus(sb.toString());
}else {
dto.setTrainStatus(null);
}
List<LessonValueDto> list = bReleaseValueRepository.getLessonValue(curUser,dto);
for(LessonValueDto valueDto :list){
//0未发布 1审核 2已发布 3驳回 4关闭
if("0".equals(valueDto.getReleaseState())){
valueDto.setReleaseState("未发布");
}else if("2".equals(valueDto.getReleaseState())){
if("0".equals(dto.getType())){
valueDto.setReleaseState("已发布");
}else{
if(valueDto.getTrainStart().after(new Date())){
valueDto.setReleaseState("已发布(未开始)");
}else if(valueDto.getTrainStart().before(new Date()) && valueDto.getTrainEnd().after(new Date())){
valueDto.setReleaseState("已发布(进行中)");
}else if(valueDto.getTrainEnd().before(new Date())){
valueDto.setReleaseState("已发布(已结束)");
}
}
}else if("4".equals(valueDto.getReleaseState())){
valueDto.setReleaseState("已关闭");
}
}
return list;
}
@Override
......
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