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 { ...@@ -306,7 +306,7 @@ public class BChapterServiceImpl implements BChapterService {
int x = bFileRepository.insertUploadFile(bFile); int x = bFileRepository.insertUploadFile(bFile);
bChapterRepository.updateClassHourInLesson(model.getLessonId());//更新b_lesson表中 class_hour bChapterRepository.updateClassHourInLesson(model.getLessonId());//更新b_lesson表中 class_hour
// 更新课程总进度 // 更新课程总进度
this.updateLessonProgress(chapterDTO.getLessonId(), true); this.updateLessonProgress(chapterDTO.getLessonId(), true, 0);
log.debug("-----------------------------更新课时成功-------------------"); log.debug("-----------------------------更新课时成功-------------------");
} }
} else { } else {
...@@ -431,7 +431,7 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -431,7 +431,7 @@ public class BChapterServiceImpl implements BChapterService {
* @param add true: 新增 false 删除 * @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 numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(2); numberFormat.setMaximumFractionDigits(2);
List<BLessonPerson> bLessonPersonList = bLessonPersonRepository.selectByLessonId(lessonId); List<BLessonPerson> bLessonPersonList = bLessonPersonRepository.selectByLessonId(lessonId);
...@@ -445,19 +445,24 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -445,19 +445,24 @@ public class BChapterServiceImpl implements BChapterService {
if (add){ if (add){
newLearnProgress =Integer.parseInt(bLesson.getClassHour()) -1 == 0? "0": numberFormat.format( learnProgress * (Integer.parseInt(bLesson.getClassHour()) -1) / (Double.parseDouble(bLesson.getClassHour())) ); newLearnProgress =Integer.parseInt(bLesson.getClassHour()) -1 == 0? "0": numberFormat.format( learnProgress * (Integer.parseInt(bLesson.getClassHour()) -1) / (Double.parseDouble(bLesson.getClassHour())) );
}else { }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)){
newLearnProgress = "0.01"; lessonPerson.setIsFinish("0");
}
if ("2".equals(lessonPerson.getIsFinish()) && Double.parseDouble(newLearnProgress) < 1){
lessonPerson.setIsFinish("1");
lessonPerson.setFinishDate(null); lessonPerson.setFinishDate(null);
} }else {
if (Double.parseDouble(newLearnProgress) >= 1){ if (learnProgress > 0 && Double.parseDouble(newLearnProgress) < 0.01) {
newLearnProgress = "1"; newLearnProgress = "0.01";
lessonPerson.setIsFinish("2"); }
if ("2".equals(lessonPerson.getIsFinish()) && Double.parseDouble(newLearnProgress) < 1) {
lessonPerson.setIsFinish("1");
lessonPerson.setFinishDate(null);
}
if (Double.parseDouble(newLearnProgress) >= 1) {
newLearnProgress = "1";
lessonPerson.setIsFinish("2");
}
} }
//TODO 判断 曾经是否学完过 奖励积分 //TODO 判断 曾经是否学完过 奖励积分
if ( "2".equals(lessonPerson.getIsFinish()) && !"1".equals(lessonPerson.getEverFinished())){ if ( "2".equals(lessonPerson.getIsFinish()) && !"1".equals(lessonPerson.getEverFinished())){
...@@ -510,8 +515,6 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -510,8 +515,6 @@ public class BChapterServiceImpl implements BChapterService {
String time = bChapterRepository.getTimeByChapterId(secondId); String time = bChapterRepository.getTimeByChapterId(secondId);
//更新到b_lesson 表 //更新到b_lesson 表
bChapterRepository.updateCourseTimeForLesson(time,lessonId); bChapterRepository.updateCourseTimeForLesson(time,lessonId);
// 更新学生 对应章节总进度
this.updateLessonProgress(lessonId, false);
} }
//更新表中sort //更新表中sort
List<String> chapterIds = bChapterRepository.getChapterIds(bChapter.getPid(),bChapter.getLessonId()); List<String> chapterIds = bChapterRepository.getChapterIds(bChapter.getPid(),bChapter.getLessonId());
...@@ -526,8 +529,16 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -526,8 +529,16 @@ public class BChapterServiceImpl implements BChapterService {
//更新表中sort //更新表中sort
bChapterRepository.updateSort(params); 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表中数据 //删除student_chapter表中数据
bChapterRepository.deleteBStudentChapter(id,userId); bChapterRepository.deleteBStudentChapter(id,userId);
return new PersistModel(line); return new PersistModel(line);
} }
......
...@@ -416,7 +416,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> { ...@@ -416,7 +416,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
" from tm_paper b " + " from tm_paper b " +
" left join tm_examdata a on a.e_pid = b.p_id " + " 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 " + " 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}" + " and corp_id = #{corpId}" +
"<if test= \" paperName != null and paperName != ''\">and b.p_name like concat('%',#{paperName},'%') </if> " + "<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> " + "<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; package org.rcisoft.business.blesson.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
...@@ -29,11 +31,17 @@ public class ExamDto { ...@@ -29,11 +31,17 @@ public class ExamDto {
public String timeCost; public String timeCost;
@ApiModelProperty(value = "开考时间") @ApiModelProperty(value = "开考时间")
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm")
public Date examStart; public Date examStart;
@ApiModelProperty(value = "交卷时间") @ApiModelProperty(value = "交卷时间")
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm")
public Date examEnd; public Date examEnd;
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm")
public Date PaperEndTime; public Date PaperEndTime;
} }
...@@ -30,16 +30,16 @@ public class ExamQueryDto { ...@@ -30,16 +30,16 @@ public class ExamQueryDto {
private String consumeTimeEnd; private String consumeTimeEnd;
@ApiModelProperty(value = "开考时间起始",required = true) @ApiModelProperty(value = "开考时间起始",required = true)
private Date examTimeStart; private String examTimeStart;
@ApiModelProperty(value = "开考时间截止",required = true) @ApiModelProperty(value = "开考时间截止",required = true)
private Date examTimeEnd; private String examTimeEnd;
@ApiModelProperty(value = "交卷时间起始",required = true) @ApiModelProperty(value = "交卷时间起始",required = true)
private Date handInTimeStart; private String handInTimeStart;
@ApiModelProperty(value = "交卷时间截止",required = true) @ApiModelProperty(value = "交卷时间截止",required = true)
private Date handInTimeEnd; private String handInTimeEnd;
@ApiModelProperty(value = "试卷得分排序 0正序 1倒序",required = true) @ApiModelProperty(value = "试卷得分排序 0正序 1倒序",required = true)
private String scoreSort; private String scoreSort;
...@@ -53,6 +53,6 @@ public class ExamQueryDto { ...@@ -53,6 +53,6 @@ public class ExamQueryDto {
@ApiModelProperty(value = "企业id",required = true) @ApiModelProperty(value = "企业id",required = true)
private String corpId; private String corpId;
@ApiModelProperty(value = "用户id",required = true) @ApiModelProperty(value = "详情用户id",required = true)
private String userId; private String personId;
} }
...@@ -12,10 +12,10 @@ public class PersonValueClientDto { ...@@ -12,10 +12,10 @@ public class PersonValueClientDto {
public String businessId; public String businessId;
@ApiModelProperty(value = "起始时间") @ApiModelProperty(value = "起始时间")
public Date startTime; public String startTime;
@ApiModelProperty(value = "结束时间") @ApiModelProperty(value = "结束时间")
public Date endTime; public String endTime;
@ApiModelProperty(value = "事件") @ApiModelProperty(value = "事件")
public String event; public String event;
......
...@@ -103,8 +103,8 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> { ...@@ -103,8 +103,8 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> {
* @return * @return
*/ */
@Select("<script>" + @Select("<script>" +
"select bl.business_id businessId,bl.lesson_name lessonName,su.name name," + "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.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 " + "from b_lesson bl " +
"left join s_user su on su.business_id = bl.lecturer_id " + "left join s_user su on su.business_id = bl.lecturer_id " +
"where bl.del_flag !=1 and bl.flag = 1 " + "where bl.del_flag !=1 and bl.flag = 1 " +
...@@ -114,6 +114,8 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> { ...@@ -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.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.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.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.corp_id = #{curUser.corpId} " +
"and bl.lesson_type = #{dto.type} " + "and bl.lesson_type = #{dto.type} " +
"</script>") "</script>")
......
package org.rcisoft.business.breleasevalue.dto; package org.rcisoft.business.breleasevalue.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date; import java.util.Date;
...@@ -17,5 +19,17 @@ public class LessonValueDto { ...@@ -17,5 +19,17 @@ public class LessonValueDto {
public String valueGain; 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; public Date updateDate;
} }
...@@ -24,6 +24,12 @@ public class LessonValueSettingQueryDto { ...@@ -24,6 +24,12 @@ public class LessonValueSettingQueryDto {
@ApiModelProperty(value = "积分获得最大值") @ApiModelProperty(value = "积分获得最大值")
public String valueGainEnd; 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培训") @ApiModelProperty(value = "0 课程 1培训")
public String type; public String type;
} }
...@@ -26,10 +26,7 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -26,10 +26,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -108,7 +105,46 @@ public class BReleaseValueServiceImpl implements BReleaseValueService { ...@@ -108,7 +105,46 @@ public class BReleaseValueServiceImpl implements BReleaseValueService {
}catch (Exception e){ }catch (Exception e){
throw new ServiceException(ResultServiceEnums.NUM_IS_ERROR); 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 @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