Commit 6d7692ea authored by luzhuang's avatar luzhuang

fix: lable计数

parent 1fc580d5
...@@ -6,6 +6,7 @@ import org.rcisoft.business.blabel.dao.BLabelRepository; ...@@ -6,6 +6,7 @@ import org.rcisoft.business.blabel.dao.BLabelRepository;
import org.rcisoft.business.blabel.dto.QueryLabelResDTO; import org.rcisoft.business.blabel.dto.QueryLabelResDTO;
import org.rcisoft.business.blabel.entity.BLabel; import org.rcisoft.business.blabel.entity.BLabel;
import org.rcisoft.business.blabel.service.BLabelService; import org.rcisoft.business.blabel.service.BLabelService;
import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.service.impl.BLessonServiceImpl; import org.rcisoft.business.blesson.service.impl.BLessonServiceImpl;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
...@@ -23,6 +24,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -23,6 +24,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static java.util.Arrays.asList;
@Service @Service
@Slf4j @Slf4j
public class BLabelServiceImpl implements BLabelService { public class BLabelServiceImpl implements BLabelService {
...@@ -31,6 +34,8 @@ public class BLabelServiceImpl implements BLabelService { ...@@ -31,6 +34,8 @@ public class BLabelServiceImpl implements BLabelService {
private BLabelRepository bLabelRepository; private BLabelRepository bLabelRepository;
@Autowired @Autowired
private BLessonServiceImpl bLessonService; private BLessonServiceImpl bLessonService;
@Autowired
private BLessonRepository bLessonRepository;
@Override @Override
public List<BLabel> queryBlabelsByPagination(PageUtil pageUtil, String lName, String corpId) { public List<BLabel> queryBlabelsByPagination(PageUtil pageUtil, String lName, String corpId) {
...@@ -40,7 +45,8 @@ public class BLabelServiceImpl implements BLabelService { ...@@ -40,7 +45,8 @@ public class BLabelServiceImpl implements BLabelService {
@Override @Override
public List<BLabel> queryBlabels(String lName, CurUser curUser) { public List<BLabel> queryBlabels(String lName, CurUser curUser) {
List<BLabel> labels = bLabelRepository.queryBlabels(lName, curUser.getCorpId()); List<BLabel> labels = bLabelRepository.queryBlabels(lName, curUser.getCorpId());
List<BLesson> lessons = bLessonService.queryHomeBLessons(curUser); List<BLesson> lessons = addPushLable(bLessonService.queryHomeBLessons(curUser),curUser);
log.info("-----------addNewLable----------首页所有课程总个数--"+lessons.size()+"--------------------"); log.info("-----------addNewLable----------首页所有课程总个数--"+lessons.size()+"--------------------");
//筛选 new lesson //筛选 new lesson
...@@ -53,7 +59,7 @@ public class BLabelServiceImpl implements BLabelService { ...@@ -53,7 +59,7 @@ public class BLabelServiceImpl implements BLabelService {
int num = 0; int num = 0;
for (BLesson lesson : newLessons) { for (BLesson lesson : newLessons) {
List<QueryLabelResDTO> labelResDTOS = lesson.getLabelList(); List<QueryLabelResDTO> labelResDTOS = lesson.getLabelList();
if (labelResDTOS.size() > 0) { if (labelResDTOS != null && labelResDTOS.size() > 0) {
for (QueryLabelResDTO dto : labelResDTOS) { for (QueryLabelResDTO dto : labelResDTOS) {
if (dto.getBusinessId().equals(label.getBusinessId())) if (dto.getBusinessId().equals(label.getBusinessId()))
num++; num++;
...@@ -101,4 +107,31 @@ public class BLabelServiceImpl implements BLabelService { ...@@ -101,4 +107,31 @@ public class BLabelServiceImpl implements BLabelService {
int line = bLabelRepository.removeLabel(id); int line = bLabelRepository.removeLabel(id);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
} }
/**
* 查询时 为知识广场的课程 添加 标签
* @param result
* @param curUser
* @return
*/
public List<BLesson> addPushLable(List<BLesson> result ,CurUser curUser){
result.forEach(lesson->{
List<String> list = new ArrayList<>();
String pushLable = bLessonRepository.getPushLable(lesson.getBusinessId());
// 获取 推荐课程的 企业自定义 标签
List<QueryLabelResDTO> lableList = new ArrayList<>();
if(!"###".equals(lesson.getCorpId())){
lableList = bLessonRepository.queryLabelByLessonId(lesson.getBusinessId());
}else {
lableList = bLessonRepository.queryLabelByLessonId2(lesson.getBusinessId(),curUser.getCorpId());
}
if(StringUtils.isNotEmpty(pushLable))
list.addAll(asList(pushLable.split(",")));
if( list != null && list.size() > 0){
// 加入平台推荐 标签
lableList.addAll(bLessonRepository.queryPushLabelByLessonId(list));
}
lesson.setLabelList(lableList);
});
return result;
}
} }
...@@ -420,23 +420,16 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -420,23 +420,16 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" ,suc.name createByName " + " ,suc.name createByName " +
" 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 " +
" and su.corp_id = #{param.corpId} "+ " and su.corp_id = #{param.corpId} "+
" left join s_user suc on suc.business_id = bl.create_by " + " left join s_user suc on suc.business_id = bl.create_by " +
" and suc.corp_id = #{param.corpId} "+ " and suc.corp_id = #{param.corpId} "+
" left join b_viewrange bv on bl.business_id = bv.lesson_id " + " left join b_viewrange bv on bl.business_id = bv.lesson_id " +
" and bv.del_flag != 1 and bv.flag = 1 " + " and bv.del_flag != 1 and bv.flag = 1 " +
" and bv.corp_id = #{param.corpId} "+ " and bv.corp_id = #{param.corpId} "+
" left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " + " left join b_viewrange_son bvs on bv.business_id = bvs.viewrange_id " +
" LEFT join b_lesson_corp blc on blc.lesson_id = bl.business_id and bl.corp_id = '###'" +
" where bl.del_flag != 1 and bl.flag = 1 " + " where bl.del_flag != 1 and bl.flag = 1 " +
" and (bl.corp_id = #{param.corpId} or blc.corp_id = #{param.corpId}) " +
" and bl.corp_id = #{param.corpId} "+
" and bl.release_state = 2 " + " and bl.release_state = 2 " +
" and ((bvs.type = 0 and bvs.target_id = #{param.userId}) " + " and ((bvs.type = 0 and bvs.target_id = #{param.userId}) " +
" or (bl.lecturer_id = #{param.userId}) " + " or (bl.lecturer_id = #{param.userId}) " +
......
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