Commit 26003b8b authored by luzhuang's avatar luzhuang

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

parents 3a3563f6 b6c166dc
...@@ -42,12 +42,12 @@ public interface BTrainFileRepository extends BaseMapper<BTrainFile> { ...@@ -42,12 +42,12 @@ public interface BTrainFileRepository extends BaseMapper<BTrainFile> {
@Insert("<script>INSERT INTO b_train_file " + @Insert("<script>INSERT INTO b_train_file " +
"(create_date,create_by,update_date,update_by," + "(create_date,create_by,update_date,update_by," +
"del_flag,flag,business_id,remarks, " + "del_flag,flag,business_id,remarks, " +
"lesson_id,file_name,video_url,file_url,file_size,type)VALUES" + "lesson_id,file_name,video_url,file_url,file_size,type,sort)VALUES" +
"<foreach collection=\"param\" item=\"item\" separator=\",\">" + "<foreach collection=\"param\" item=\"item\" separator=\",\">" +
"(#{item.createDate},#{item.createBy},#{item.updateDate},#{item.updateBy}," + "(#{item.createDate},#{item.createBy},#{item.updateDate},#{item.updateBy}," +
"#{item.delFlag},#{item.flag},#{item.businessId},#{item.remarks}," + "#{item.delFlag},#{item.flag},#{item.businessId},#{item.remarks}," +
"#{item.lessonId},#{item.fileName},#{item.videoUrl},#{item.fileUrl}," + "#{item.lessonId},#{item.fileName},#{item.videoUrl},#{item.fileUrl}," +
"#{item.fileSize},#{item.type})" + "#{item.fileSize},#{item.type},#{item.sort})" +
"</foreach></script>") "</foreach></script>")
int insertTrainFileList(@Param("param") List<BTrainFile> param); int insertTrainFileList(@Param("param") List<BTrainFile> param);
......
package org.rcisoft.business.blesson.dao; package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.rcisoft.business.blesson.entity.BHot; import org.rcisoft.business.blesson.entity.BHot;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -12,7 +14,9 @@ import org.springframework.stereotype.Repository; ...@@ -12,7 +14,9 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface BHotRepository extends BaseMapper<BHot> { public interface BHotRepository extends BaseMapper<BHot> {
@Select("<script>select count(1) from b_hot where person_id=#{userId} and lesson_id = #{lessonId} " +
"</script>")
int selectCountByPersonId(@Param("userId") String userId, @Param("lessonId") String lessonId);
} }
...@@ -82,5 +82,12 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> { ...@@ -82,5 +82,12 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> {
"</script>") "</script>")
List<BViewRangeSonDTO> selectPersonByLessonId(@Param("corpId") String corpId,@Param("lessonId")String lessonId); List<BViewRangeSonDTO> selectPersonByLessonId(@Param("corpId") String corpId,@Param("lessonId")String lessonId);
@Select("<script>select * from b_viewrange " +
" where 1=1 "+
" and lesson_id = #{lessonId} "+
"</script>")
@ResultMap(value = "BaseResultMap" )
List<BViewrange> selectByLessonId(String lessonId);
} }
...@@ -201,8 +201,11 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -201,8 +201,11 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
// return new PersistModel(line); // return new PersistModel(line);
// } // }
//添加至b_hot表 并重新同级热度 //添加至b_hot表 并重新同级热度
bHotRepository.insertSelective(new BHot(IdGen.uuid(),addMyLearnLessonDTO.getUserId(),addMyLearnLessonDTO.getLessonId())); int count = bHotRepository.selectCountByPersonId(addMyLearnLessonDTO.getUserId(),addMyLearnLessonDTO.getLessonId());
bLessonRepository.hotNumberReCount(addMyLearnLessonDTO.getLessonId()); if (count < 1){
bHotRepository.insertSelective(new BHot(IdGen.uuid(),addMyLearnLessonDTO.getUserId(),addMyLearnLessonDTO.getLessonId()));
bLessonRepository.hotNumberReCount(addMyLearnLessonDTO.getLessonId());
}
return new PersistModel(1); return new PersistModel(1);
} }
} }
...@@ -120,12 +120,13 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -120,12 +120,13 @@ public class BLessonServiceImpl implements BLessonService {
bLesson.setViewRangeDepartList(selectDepartByLessonIds); bLesson.setViewRangeDepartList(selectDepartByLessonIds);
} }
//客户端 手机端 每次点击插入热度表 并重新统计课程热度 // 每次点击插入热度表 并重新统计课程热度
// if ("1".equals(bLesson.getIsCollect())){ int count = bHotRepository.selectCountByPersonId(curUser.getUserId(),lessonId);
bHotRepository.insertSelective(new BHot(IdGen.uuid(),curUser.getUserId(),bLesson.getBusinessId())); if (count < 1){
bLessonRepository.hotNumberReCount(bLesson.getBusinessId()); bHotRepository.insertSelective(new BHot(IdGen.uuid(),curUser.getUserId(),bLesson.getBusinessId()));
// } bLessonRepository.hotNumberReCount(bLesson.getBusinessId());
}
return bLesson; return bLesson;
} }
...@@ -267,7 +268,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -267,7 +268,7 @@ public class BLessonServiceImpl implements BLessonService {
line = bLessonRepository.insertSelective(model); line = bLessonRepository.insertSelective(model);
//添加可见范围 //添加可见范围
if (StringUtils.isNotEmpty(model.getViewRangePerson()) || StringUtils.isNotEmpty(model.getViewRangeDepart())) { if (StringUtils.isNotEmpty(model.getViewRangePerson()) || StringUtils.isNotEmpty(model.getViewRangeDepart())) {
BViewrange bViewrange = setBViewrangeInfo(model); BViewrange bViewrange = setBViewrangeInfo(model,null);
//插入可见范围表 //插入可见范围表
bViewrangeRepository.insertSelective(bViewrange); bViewrangeRepository.insertSelective(bViewrange);
//插入可见范围子表 //插入可见范围子表
...@@ -282,7 +283,9 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -282,7 +283,9 @@ public class BLessonServiceImpl implements BLessonService {
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangeDepart, "1", bViewrange.getBusinessId()); bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangeDepart, "1", bViewrange.getBusinessId());
} }
//插入子表 //插入子表
bViewrangeRepository.insertBViewrangeSons(bViewrangeSons); if (bViewrangeSons != null && bViewrangeSons.size()>0){
bViewrangeRepository.insertBViewrangeSons(bViewrangeSons);
}
} }
//添加课程标签表 //添加课程标签表
...@@ -296,12 +299,21 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -296,12 +299,21 @@ public class BLessonServiceImpl implements BLessonService {
line = bLessonRepository.updateByPrimaryKeySelective(model); line = bLessonRepository.updateByPrimaryKeySelective(model);
if (StringUtils.isNotEmpty(model.getViewRangePerson()) || StringUtils.isNotEmpty(model.getViewRangeDepart())) { if (StringUtils.isNotEmpty(model.getViewRangePerson()) || StringUtils.isNotEmpty(model.getViewRangeDepart())) {
BViewrange bViewrange = new BViewrange();
BViewrange bViewrange = setBViewrangeInfo(model); List<BViewrange> bViewranges = bViewrangeRepository.selectByLessonId(model.getBusinessId());
//更新可见范围表 if (bViewranges != null && bViewranges.size() > 0){
bViewrangeRepository.updateByLessonId(bViewrange); bViewrange = bViewranges.get(0);
//删除可见范围子表 bViewrange = setBViewrangeInfo(model,bViewrange);
bViewrangeRepository.deleteViewrangeSon(bViewrange); //更新可见范围表
bViewrangeRepository.updateByLessonId(bViewrange);
//删除可见范围子表
bViewrangeRepository.deleteViewrangeSon(bViewrange);
}
if (bViewranges == null || bViewranges.size() < 1){
bViewrange = setBViewrangeInfo(model,null);
//添加可见范围表
bViewrangeRepository.insertSelective(bViewrange);
}
//获取所有可见人员和部门 //获取所有可见人员和部门
List<BViewrangeSon> bViewrangeSons = new ArrayList<>(); List<BViewrangeSon> bViewrangeSons = new ArrayList<>();
...@@ -311,12 +323,22 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -311,12 +323,22 @@ public class BLessonServiceImpl implements BLessonService {
String[] viewRangePerson = model.getViewRangePerson().split(","); String[] viewRangePerson = model.getViewRangePerson().split(",");
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangePerson, "0", bViewrange.getBusinessId()); bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangePerson, "0", bViewrange.getBusinessId());
} }
if (StringUtils.isNotEmpty(model.getViewRangePerson())) { if (StringUtils.isNotEmpty(model.getViewRangeDepart())) {
String[] viewRangeDepart = model.getViewRangeDepart().split(","); String[] viewRangeDepart = model.getViewRangeDepart().split(",");
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangeDepart, "1", bViewrange.getBusinessId()); bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangeDepart, "1", bViewrange.getBusinessId());
} }
//插入子表 //插入子表
bViewrangeRepository.insertBViewrangeSons(bViewrangeSons); if (bViewrangeSons != null && bViewrangeSons.size()>0){
bViewrangeRepository.insertBViewrangeSons(bViewrangeSons);
}
}else {
//可见范围设为空 所有人员均可见
List<BViewrange> bViewranges = bViewrangeRepository.selectByLessonId(model.getBusinessId());
//删除可见范围子表
if (bViewranges != null && bViewranges.size()>0){
bViewrangeRepository.deleteByPrimaryKey(bViewranges.get(0));
bViewrangeRepository.deleteViewrangeSon(bViewranges.get(0));
}
} }
bLessonRepository.removeLabelByLessonId(model); bLessonRepository.removeLabelByLessonId(model);
...@@ -823,14 +845,16 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -823,14 +845,16 @@ public class BLessonServiceImpl implements BLessonService {
if (recommendIds == null || recommendIds.size() < 1) { if (recommendIds == null || recommendIds.size() < 1) {
throw new ServiceException(ResultServiceEnums.NOT_RECOMMEND); throw new ServiceException(ResultServiceEnums.NOT_RECOMMEND);
} }
//修改推荐表 //删除推荐表
BRecommend bRecommend = new BRecommend(); BRecommend bRecommend = new BRecommend();
bRecommend.setLessonId(lessonId); // bRecommend.setLessonId(lessonId);
UserUtil.setCurrentMergeOperation(bRecommend); // UserUtil.setCurrentMergeOperation(bRecommend);
bRecommend.setBusinessId(recommendIds.get(0)); bRecommend.setBusinessId(recommendIds.get(0));
bRecommend.setDelFlag("1"); int line = bRecommendRepository.deleteByPrimaryKey(bRecommend);
int line = bRecommendRepository.updateByPrimaryKeySelective(bRecommend); // bRecommend.setDelFlag("1");
// int line = bRecommendRepository.updateByPrimaryKeySelective(bRecommend);
//删除推荐子表内容 //删除推荐子表内容
bRecommendRepository.deleteRecommendSon(bRecommend);
return new PersistModel(line); return new PersistModel(line);
} }
...@@ -1031,11 +1055,16 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -1031,11 +1055,16 @@ public class BLessonServiceImpl implements BLessonService {
} }
//设置BViewrange信息 //设置BViewrange信息
BViewrange setBViewrangeInfo(BLesson model) { BViewrange setBViewrangeInfo(BLesson model, BViewrange bViewrange) {
BViewrange bViewrange = new BViewrange(); if (bViewrange == null){
UserUtil.setCurrentPersistOperation(bViewrange); bViewrange = new BViewrange();
//设置课程id UserUtil.setCurrentPersistOperation(bViewrange);
bViewrange.setLessonId(model.getBusinessId()); //设置课程id
bViewrange.setLessonId(model.getBusinessId());
}else {
UserUtil.setCurrentMergeOperation(bViewrange);
}
//设置可见范围类型(0仅人 1仅部门 2人和部门) //设置可见范围类型(0仅人 1仅部门 2人和部门)
if (StringUtils.isNotEmpty(model.getViewRangePerson()) && StringUtils.isEmpty(model.getViewRangeDepart())) { if (StringUtils.isNotEmpty(model.getViewRangePerson()) && StringUtils.isEmpty(model.getViewRangeDepart())) {
......
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