Commit b46f5daf authored by luzhuang's avatar luzhuang

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

parents dac63368 f2f2ac56
......@@ -64,9 +64,6 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value = "601 添加/编辑课程", notes = "businessId为空时是添加方法,不为空时是修改方法")
@PostMapping(value = "/add")
public Result add(CurUser curUser, @Valid AddLessonDTO addLessonDTO, BindingResult bindingResult) {
// if(addLessonDTO.getCode().length()>
// Integer.parseInt(global.getMAX_CODE_LENGTH()))
// throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
PersistModel data = bLessonService.persist(addLessonDTO);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
......@@ -115,7 +112,7 @@ public class BLessonController extends PaginationController<BLesson> {
@GetMapping(value = "/queryBLessonsByPagination")
public Result queryBLessonsByPagination(CurUser curUser, MyReleaseDTO myReleaseDTO, BindingResult bindingResult) {
String userId = curUser.getUserId();
bLessonService.queryBLessonsByPagination(getPaginationUtility(), myReleaseDTO, curUser);
bLessonService.queryBLessonsByPagination(getPaginationUtility(), myReleaseDTO);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
......@@ -298,7 +295,7 @@ public class BLessonController extends PaginationController<BLesson> {
@GetMapping(value = "/queryLearnBLessonsByPagination")
public Result queryLearnBLessonsByPagination(CurUser curUser, @Valid ILearnLessonDTO param, BindingResult bindingResult) {
String userId = curUser.getUserId();
bLessonPersonService.queryLearnBLessonsByPagination(getPaginationUtility(), param, userId);
bLessonPersonService.queryLearnBLessonsByPagination(getPaginationUtility(), param);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
......
......@@ -27,16 +27,22 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
" left join b_course bc on bc.business_id = bl.course_id " +
" where blp.del_flag != 1 and blp.flag = 1 " +
" and bl.del_flag != 1 and bl.flag = 1 " +
" and bl.del_flag != 1 and bl.flag = 1 " +
// " and bl.release_state = '2' " +
" and blp.person_id = #{userId} " +
" and blp.person_id = #{param.userId} " +
" and bl.corp_id = #{param.corpId} " +
" <if test= \" param.isFinish != null and param.isFinish != ''\">and blp.is_finish = #{param.isFinish} </if> " +
" <if test= \" param.lessonType !=null and param.lessonType != ''\">and bl.lesson_type = #{param.lessonType} </if> " +
// " <if test= \" param.startFlag !=null and param.startFlag != ''\">and blp.start_flag = #{param.startFlag} </if> " +
" <if test= \" param.isAppoint !=null and param.isAppoint != ''\">and blp.is_appoint = #{param.isAppoint} </if> " +
" <if test= \" param.trainIsSign !=null and param.trainIsSign != ''\">and blp.train_is_sign = #{param.trainIsSign} </if> " +
" order by blp.update_date desc</script>")
" order by blp.update_date desc" +
"" +
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryLearnBLessons(@Param("param") ILearnLessonDTO param, @Param("userId") String userId);
List<BLesson> queryLearnBLessons(@Param("param") ILearnLessonDTO param);
......
......@@ -30,17 +30,20 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" left join s_user su on b.lecturer_id = su.business_id " +
" where b.del_flag != 1 and b.flag = 1 " +
// " and su.del_flag != 1 and su.flag = 1 " +
"and b.lecturer_id = #{curUser.userId}" +
"and b.lecturer_id = #{param.userId}" +
// " and b.corp_id = #{curUser.corpId} "+
// " and su.corp_id = #{curUser.corpId} "+
" and b.corp_id = #{param.corpId} "+
// " and su.corp_id = #{param.corpId} "+
" <if test=\"param.releaseState!=null and param.releaseState != ''\">and b.release_state = #{param.releaseState} </if>" +
" <if test=\"param.lessonType!=null and param.lessonType != ''\">and b.lesson_type = #{param.lessonType} </if>" +
" <if test=\"param.releaseState!=null and param.releaseState == 0\"> order by b.create_date desc </if>" +
" <if test=\"param.releaseState!=null and param.releaseState == 2\"> order by b.release_date desc </if>" +
" <if test=\"param.releaseState!=null and param.releaseState == 4\"> order by b.close_date desc </if>" +
// "order by b.update_date desc" +
"</script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> queryBLessons(@Param("param") MyReleaseDTO param,@Param("curUser")CurUser curUser);
List<BLesson> queryBLessons(@Param("param") MyReleaseDTO param);
/**
......@@ -405,6 +408,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" <set>",
" <if test='updateBy != null'>update_by=#{updateBy},</if>",
" <if test='updateDate != null'>update_date=#{updateDate},</if>",
" <if test='closeDate != null'>close_date=#{closeDate},</if>",
" release_state = '4'",
" </set>",
"where business_id=#{businessId}",
......
......@@ -54,9 +54,9 @@ public interface BRecommendRepository extends BaseMapper<BRecommend> {
List<String> selectIdByLessonId(String lessonId);
@Insert("<script>INSERT INTO b_recommend_son" +
"(business_id,recommend_id,type,target_id)VALUES" +
"(business_id,recommend_id,type,target_id,sort)VALUES" +
"<foreach collection=\"list\" item=\"item\" separator=\",\">" +
"(#{item.businessId},#{item.recommendId},#{item.type},#{item.targetId})" +
"(#{item.businessId},#{item.recommendId},#{item.type},#{item.targetId},#{item.sort})" +
"</foreach></script>")
int insertBRecommendSons(List<BRecommendSon> bRecommendSons);
......
......@@ -47,9 +47,9 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> {
int deleteViewrangeSon(BViewrange bViewrange);
@Insert("<script>INSERT INTO b_viewrange_son" +
"(business_id,viewrange_id,type,target_id)VALUES" +
"(business_id,viewrange_id,type,target_id,sort)VALUES" +
"<foreach collection=\"list\" item=\"item\" separator=\",\">" +
"(#{item.businessId},#{item.viewrangeId},#{item.type},#{item.targetId})" +
"(#{item.businessId},#{item.viewrangeId},#{item.type},#{item.targetId},#{item.sort})" +
"</foreach></script>")
int insertBViewrangeSons(List<BViewrangeSon> bViewrangeSons);
......
......@@ -31,4 +31,8 @@ public class ILearnLessonDTO {
@ApiModelProperty(value = "是否为指派课程(0非必修(自选) 1必修(指派))")
private String isAppoint;
private String userId;
private String corpId;
}
......@@ -11,4 +11,7 @@ public class MyReleaseDTO {
@ApiModelProperty(value = "课程类型(0:课程 1:培训)")
private String lessonType;
private String userId;
private String corpId;
}
......@@ -86,6 +86,10 @@ public class BLesson extends IdEntity<BLesson> {
//@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private Date releaseDate;
@ApiModelProperty(value = "关闭时间")
//@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private Date closeDate;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String lessonType;
......@@ -223,7 +227,7 @@ public class BLesson extends IdEntity<BLesson> {
@Transient
private String isCollect;
@ApiModelProperty(value = "报名是否已满")
@ApiModelProperty(value = "报名是否已满(1 已满 2未满)")
@Transient
private String applyIsFull;
......
......@@ -73,6 +73,9 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
@ApiModelProperty(value = "报名日期")
private Date applyDate;
@ApiModelProperty(value = "学完成时间")
private Date finishDate;
@ApiModelProperty(value = "签到日期")
private Date signDate;
//-----------------------------
......@@ -137,7 +140,7 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
public void initModel(){
UserUtil.setCurrentPersistOperation(this);
//学习进度为0
this.setLearnProgress("0");
this.setLearnProgress("0.00%");
//设置正在学
this.setIsFinish("1");
//设置不收藏
......
......@@ -24,7 +24,7 @@ public interface BLessonPersonService {
* @param model
* @return
*/
List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, ILearnLessonDTO model, String userId);
List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, ILearnLessonDTO model);
/**
* 查询线上课程学员追踪图表
......
......@@ -40,7 +40,7 @@ public interface BLessonService{
* @param myReleaseDTO
* @return
*/
List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, MyReleaseDTO myReleaseDTO, CurUser curUser);
List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, MyReleaseDTO myReleaseDTO);
/**
* 根据条件分页查找
......
......@@ -71,8 +71,8 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
}
@Override
public List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, ILearnLessonDTO model, String userId) {
return bLessonPersonRepository.queryLearnBLessons(model, userId);
public List<BLesson> queryLearnBLessonsByPagination(PageUtil pageUtil, ILearnLessonDTO model) {
return bLessonPersonRepository.queryLearnBLessons(model);
}
@Override
......@@ -181,7 +181,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
bLessonPerson = bLessonPersons.get(0);
bLessonPerson.setIsFinish("1");
line = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
//课程在学人数+1
//重新统计在学人数
bLessonRepository.personNumberReCount(addMyLearnLessonDTO.getLessonId());
return new PersistModel(line);
}
......
......@@ -140,8 +140,8 @@ public class BLessonServiceImpl implements BLessonService {
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, MyReleaseDTO myReleaseDTO, CurUser curUser) {
return bLessonRepository.queryBLessons(myReleaseDTO, curUser);
public List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, MyReleaseDTO myReleaseDTO) {
return bLessonRepository.queryBLessons(myReleaseDTO);
}
@Override
......@@ -449,6 +449,7 @@ public class BLessonServiceImpl implements BLessonService {
public PersistModel closeBLesson(String id) {
BLesson bLesson = new BLesson();
bLesson.setBusinessId(id);
bLesson.setCloseDate(new Date());
UserUtil.setCurrentMergeOperation(bLesson);
int line = bLessonRepository.closeLesson(bLesson);
//int line = bLessonRepository.deleteByPrimaryKey(id);
......@@ -914,7 +915,7 @@ public class BLessonServiceImpl implements BLessonService {
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public int toTraining(CurUser curUser, String lessonId) {
BLessonPerson person = new BLessonPerson();
BLessonPerson person ;
BLessonPerson bLessonPerson = new BLessonPerson();
//判断当前时间是否在报名范围内
BLesson bLesson = bLessonRepository.selectInfoById(lessonId);
......
......@@ -33,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.BreakIterator;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
......@@ -64,7 +65,45 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
@Override
public PersistModel save(BRStudentChapterDto brStudentChapterDto, CurUser curUser){
int line = 0;
DecimalFormat df=new DecimalFormat("0.000");//设置保留位数
DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
// 查詢是否已經開始觀看此章節
List<BRStudentChapter> brStudentChapterList = bRStudentChapterRepository.queryByStuIdAndChapter(brStudentChapterDto.getChapterId(),brStudentChapterDto.getStudentId());
String isFinish = "0";
// 沒有開始看-新增信息
if (null != brStudentChapterList && brStudentChapterList.size() >0){
double old = brStudentChapterList.get(0).getProgress();
BRStudentChapter brStudentChapter = this.dealBrstudentChapter(brStudentChapterList.get(0), brStudentChapterDto);
if (1== brStudentChapter.getProgress()){
isFinish = "2";
}
// 判断进度 是否大于数据库已经存在的进度
double now = brStudentChapter.getProgress();
if (now > old){
line = bRStudentChapterRepository.updateById(brStudentChapter);
}
}else { // 更新
BRStudentChapter brStudentChapter = new BRStudentChapter();
brStudentChapter.setBusinessId(IdGen.uuid());
brStudentChapter = this.dealBrstudentChapter(brStudentChapter, brStudentChapterDto);
brStudentChapter.setStudentId(brStudentChapterDto.getStudentId());
brStudentChapter.setChapterId(brStudentChapterDto.getChapterId());
if (1== brStudentChapter.getProgress()){
isFinish = "2";
}
// brStudentChapter.setCurrentLocation(brStudentChapterDto.getCurrent()); // 保存當前學習進度
// if (brStudentChapterDto.getCurrent().equals(brStudentChapterDto.getDuration())){ // 判断是否已经完成
// brStudentChapter.setIsComplete("1");
// brStudentChapter.setProgress(1);
// isFinish = "2";
// }else {
// isFinish = "1";
// brStudentChapter.setIsComplete("0");
// brStudentChapter.setProgress((float)brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration());
//// brStudentChapter.setProgress(new BigDecimal((float)brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
// }
line = bRStudentChapterRepository.insertSelective(brStudentChapter);
}
// b_lesson_person
AddMyLearnLessonDTO addMy = new AddMyLearnLessonDTO();
addMy.setUserId(brStudentChapterDto.getStudentId());
addMy.setLessonId(brStudentChapterDto.getLessonId());
......@@ -90,66 +129,65 @@ public class BRStudentChapterServiceImpl implements BRStudentChapterService {
}
String totalProgress = "";
if (i==0){
totalProgress = "0%";
totalProgress = "0.00%";
}else {
totalProgress = df.format((float) ((percent / i) * 100)) + "%";
};
// 判斷是否已經開始觀看此課程
if (null != bLessonPersonList && bLessonPersonList.size() >0){
BLessonPerson bLessonPerson = bLessonPersonList.get(0);
bLessonPerson.setChapterId(brStudentChapterDto.getChapterId());
bLessonPerson.setLearnProgress(totalProgress); // 保存课程学习进度
BLessonPerson bLessonPerson = this.dealBLessonPerson(bLessonPersonList.get(0),brStudentChapterDto,totalProgress,isFinish);
// BLessonPerson bLessonPerson = bLessonPersonList.get(0);
// bLessonPerson.setChapterId(brStudentChapterDto.getChapterId());
// bLessonPerson.setLearnProgress(totalProgress); // 保存课程学习进度
// if ("2".equals(isFinish))
// bLessonPerson.setFinishDate(new Date());
// bLessonPerson.setIsFinish(isFinish);
bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
}else {
BLessonPerson bLessonPerson = new BLessonPerson();
UserUtil.setCurrentPersistOperation(bLessonPerson);
bLessonPerson.setChapterId(brStudentChapterDto.getChapterId());
bLessonPerson = this.dealBLessonPerson(bLessonPersonList.get(0),brStudentChapterDto,totalProgress,isFinish);
bLessonPerson.setPersonId(brStudentChapterDto.getStudentId());
bLessonPerson.setLessonId(brStudentChapterDto.getLessonId());
bLessonPerson.setLearnProgress(totalProgress); // 保存课程学习进度
bLessonPersonRepository.insertSelective(bLessonPerson);
}
// 查詢是否已經開始觀看此章節
List<BRStudentChapter> brStudentChapterList = bRStudentChapterRepository.queryByStuIdAndChapter(brStudentChapterDto.getChapterId(),brStudentChapterDto.getStudentId());
// 沒有開始看-新增信息
if (null != brStudentChapterList && brStudentChapterList.size() >0){
BRStudentChapter brStudentChapter = brStudentChapterList.get(0);
brStudentChapter.setCurrentLocation(brStudentChapterDto.getCurrent());
if (brStudentChapterDto.getCurrent() == brStudentChapterDto.getDuration()){
brStudentChapter.setProgress(1);
}else{
brStudentChapter.setProgress(new BigDecimal((float)brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
// 判断进度 是否大于数据库已经存在的进度
double old = brStudentChapterList.get(0).getProgress();
double now = brStudentChapter.getProgress();
if (old >= now){
line = bRStudentChapterRepository.updateById(brStudentChapter);
}
}else { // 更新
BRStudentChapter brStudentChapter = new BRStudentChapter();
brStudentChapter.setBusinessId(IdGen.uuid());
brStudentChapter.setStudentId(brStudentChapterDto.getStudentId());
brStudentChapter.setChapterId(brStudentChapterDto.getChapterId());
brStudentChapter.setCurrentLocation(brStudentChapterDto.getCurrent()); // 保存當前學習進度
if (brStudentChapterDto.getCurrent() == brStudentChapterDto.getDuration()){ // 判断是否已经完成
brStudentChapter.setIsComplete("1");
brStudentChapter.setProgress(1);
}else {
brStudentChapter.setIsComplete("0");
brStudentChapter.setProgress(new BigDecimal((float)brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
line = bRStudentChapterRepository.insertSelective(brStudentChapter);
// if ("2".equals(isFinish))
// bLessonPerson.setFinishDate(new Date());
// bLessonPerson.setIsFinish(isFinish);
// bLessonPerson.setChapterId(brStudentChapterDto.getChapterId());
// bLessonPerson.setLearnProgress(totalProgress); // 保存课程学习进度
line = bLessonPersonRepository.insertSelective(bLessonPerson) > line ? bLessonPersonRepository.insertSelective(bLessonPerson): line ;
}
// 获取章节总进度 存库
BChapter bChapter = bChapterRepository.selectByPrimaryKey(brStudentChapterDto.getChapterId());
if (null!=bChapter && StringUtils.isNotBlank(bChapter.getBusinessId())){
bChapter.setCourseTime(brStudentChapterDto.getDuration().toString());
bChapterRepository.updateByPrimaryKeySelective(bChapter);
line = bChapterRepository.updateByPrimaryKeySelective(bChapter) > line ? bChapterRepository.updateByPrimaryKeySelective(bChapter): line;
}
return new PersistModel(line);
}
// b_r_student_chapter
private BRStudentChapter dealBrstudentChapter(BRStudentChapter brStudentChapter, BRStudentChapterDto brStudentChapterDto){
brStudentChapter.setCurrentLocation(brStudentChapterDto.getCurrent());
if (brStudentChapterDto.getCurrent().equals(brStudentChapterDto.getDuration())){
brStudentChapter.setProgress(1);
}else{
float num = (float)(Math.floor((float)brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration()*10000))/10000;
brStudentChapter.setProgress(num);
}
return brStudentChapter;
}
// b_lesson_person
private BLessonPerson dealBLessonPerson(BLessonPerson bLessonPerson, BRStudentChapterDto brStudentChapterDto, String totalProgress, String isFinish){
bLessonPerson.setChapterId(brStudentChapterDto.getChapterId());
bLessonPerson.setLearnProgress(totalProgress); // 保存课程学习进度
if ("2".equals(isFinish))
bLessonPerson.setFinishDate(new Date());
bLessonPerson.setIsFinish(isFinish);
return bLessonPerson;
}
/**
* 根据id查询 bRStudentChapter
* @param id
......
......@@ -63,10 +63,11 @@ public class SysUserController extends PaginationController<SysUser> {
@GetMapping("/gets")
@ApiOperation(value = "|personnels|同步人员", notes = "同步人员信息")
public Result synchronizedUsers(@RequestParam String corpId) throws ParseException {
int line = userServiceImpl.synchronizedUsers(corpId);
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
userServiceImpl.synchronizedUsers(corpId));
"同步"+line+"条人员信息");
}
......
......@@ -23,6 +23,7 @@
<result column="course_description" jdbcType="VARCHAR" property="courseDescription"/>
<result column="view_range" jdbcType="VARCHAR" property="viewRange"/>
<result column="release_date" jdbcType="TIMESTAMP" property="releaseDate"/>
<result column="close_date" jdbcType="TIMESTAMP" property="closeDate"/>
<result column="lesson_type" jdbcType="VARCHAR" property="lessonType"/>
<result column="discuss_number" jdbcType="VARCHAR" property="discussNumber"/>
<result column="recommend" jdbcType="VARCHAR" property="recommend"/>
......@@ -66,6 +67,7 @@
<result column="course_description" jdbcType="VARCHAR" property="courseDescription"/>
<result column="view_range" jdbcType="VARCHAR" property="viewRange"/>
<result column="release_date" jdbcType="TIMESTAMP" property="releaseDate"/>
<result column="close_date" jdbcType="TIMESTAMP" property="closeDate"/>
<result column="lesson_type" jdbcType="VARCHAR" property="lessonType"/>
<result column="discuss_number" jdbcType="VARCHAR" property="discussNumber"/>
<result column="recommend" jdbcType="VARCHAR" property="recommend"/>
......
......@@ -41,6 +41,7 @@
<result column="is_apply" jdbcType="VARCHAR" property="isApply"/>
<result column="train_is_sign" jdbcType="VARCHAR" property="trainIsSign"/>
<result column="apply_date" jdbcType="VARCHAR" property="applyDate"/>
<result column="finish_date" jdbcType="VARCHAR" property="finishDate"/>
<result column="sign_date" jdbcType="VARCHAR" property="signDate"/>
</resultMap>
......
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