Commit 5f3d92c8 authored by jiangpengpeng's avatar jiangpengpeng

banner排序

parent babf58be
...@@ -246,4 +246,22 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -246,4 +246,22 @@ public class BLessonController extends PaginationController<BLesson> {
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
bLessonPersonService.iLearnLessonCount(userId)); bLessonPersonService.iLearnLessonCount(userId));
} }
/**
* @author: jiangpengpeng
* @description: TODO
* @date: 2019/9/27 14:37
* @param
* @return
*/
@ApiOperation(value = "617课程管理显示的全部课程", notes="课程管理显示的全部课程")
@GetMapping(value = "theLessonManage")
public Result theLessonManage(CurUser curUser, @Valid BLesson bLesson, BindingResult bindingResult){
List<BLesson> bLessons = bLessonService.theLessonMangageByPagination(getPaginationUtility(), curUser, bLesson);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
} }
...@@ -71,7 +71,7 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -71,7 +71,7 @@ public class BLesson extends IdEntity<BLesson> {
private String viewRange; private String viewRange;
@ApiModelProperty(value = "发布时间") @ApiModelProperty(value = "发布时间")
@Length(min = 1,max = 1,message = "长度最小为1,最大为1") //@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private Date releaseDate; private Date releaseDate;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)") @ApiModelProperty(value = "课程类型(0:课程 1:培训)")
...@@ -121,5 +121,10 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -121,5 +121,10 @@ public class BLesson extends IdEntity<BLesson> {
@ApiModelProperty(value = "分类名") @ApiModelProperty(value = "分类名")
@Transient @Transient
private String courseName; private String courseName;
} }
...@@ -5,6 +5,7 @@ import org.rcisoft.business.blesson.dto.*; ...@@ -5,6 +5,7 @@ import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.sys.user.bean.CurUser;
import java.util.List; import java.util.List;
...@@ -118,4 +119,12 @@ public interface BLessonService{ ...@@ -118,4 +119,12 @@ public interface BLessonService{
*/ */
ILessonCountDTO iLessonCount(String userId); ILessonCountDTO iLessonCount(String userId);
/**
* @author: jiangpengpeng
* @description: 分页查找课程管理数据
* @date: 2019/9/27 14:44
* @param
* @return
*/
List<BLesson> theLessonMangageByPagination(PageUtil pageUtil,CurUser curUser,BLesson bLesson);
} }
package org.rcisoft.business.blesson.service.impl; package org.rcisoft.business.blesson.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.sun.org.apache.regexp.internal.RE;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
...@@ -17,16 +18,16 @@ import org.rcisoft.core.aop.PageUtil; ...@@ -17,16 +18,16 @@ import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant; import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dao.SysUserMapper;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.lang.reflect.Array;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
/** /**
...@@ -34,7 +35,7 @@ import java.util.Map; ...@@ -34,7 +35,7 @@ import java.util.Map;
*/ */
@Slf4j @Slf4j
@Service @Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED) @Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public class BLessonServiceImpl implements BLessonService { public class BLessonServiceImpl implements BLessonService {
@Autowired @Autowired
private BLessonRepository bLessonRepository; private BLessonRepository bLessonRepository;
...@@ -42,12 +43,15 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -42,12 +43,15 @@ public class BLessonServiceImpl implements BLessonService {
@Autowired @Autowired
private BCourseRepository bCourseRepository; private BCourseRepository bCourseRepository;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired @Autowired
private Global global; private Global global;
@Override @Override
public BLesson selectOne(String businessId){ public BLesson selectOne(String businessId) {
return bLessonRepository.selectInfoById(businessId); return bLessonRepository.selectInfoById(businessId);
} }
...@@ -56,9 +60,9 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -56,9 +60,9 @@ public class BLessonServiceImpl implements BLessonService {
return bLessonRepository.selectOne(bLesson); return bLessonRepository.selectOne(bLesson);
} }
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override @Override
public int updateByPrimaryKeySelective(BLesson bLesson) { public int updateByPrimaryKeySelective(BLesson bLesson) {
return bLessonRepository.updateByPrimaryKeySelective(bLesson); return bLessonRepository.updateByPrimaryKeySelective(bLesson);
} }
...@@ -78,43 +82,45 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -78,43 +82,45 @@ public class BLessonServiceImpl implements BLessonService {
departs.add("1"); departs.add("1");
departs.add("2"); departs.add("2");
departs.add("3"); departs.add("3");
return bLessonRepository.queryPersonMore(userId,departs); return bLessonRepository.queryPersonMore(userId, departs);
} }
@Override @Override
public List<BLesson> queryRecommendByPagination(PageUtil pageUtil,String userId) { public List<BLesson> queryRecommendByPagination(PageUtil pageUtil, String userId) {
List<String> departs = new ArrayList<>(); List<String> departs = new ArrayList<>();
departs.add("1"); departs.add("1");
departs.add("2"); departs.add("2");
departs.add("3"); departs.add("3");
return bLessonRepository.queryRecommend(userId,departs); return bLessonRepository.queryRecommend(userId, departs);
} }
@Override @Override
public List<BLesson> queryConcernByPagination(PageUtil pageUtil,String userId) { public List<BLesson> queryConcernByPagination(PageUtil pageUtil, String userId) {
List<String> departs = new ArrayList<>(); List<String> departs = new ArrayList<>();
departs.add("1"); departs.add("1");
departs.add("2"); departs.add("2");
departs.add("3"); departs.add("3");
return bLessonRepository.queryConcern(userId,departs); return bLessonRepository.queryConcern(userId, departs);
} }
@Override @Override
public List<BLesson> queryInterestedByPagination(PageUtil pageUtil,String userId) { public List<BLesson> queryInterestedByPagination(PageUtil pageUtil, String userId) {
List<String> departs = new ArrayList<>(); List<String> departs = new ArrayList<>();
departs.add("1"); departs.add("1");
departs.add("2"); departs.add("2");
departs.add("3"); departs.add("3");
return bLessonRepository.queryInterested(userId,departs); return bLessonRepository.queryInterested(userId, departs);
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel persist(AddLessonDTO addLessonDTO){ public PersistModel persist(AddLessonDTO addLessonDTO) {
BLesson model = new BLesson(); BLesson model = new BLesson();
BeanUtils.copyProperties(addLessonDTO,model); BeanUtils.copyProperties(addLessonDTO, model);
int line = 0; int line = 0;
List<BLessonLabel> bLessonLabels = new ArrayList<>(); List<BLessonLabel> bLessonLabels = new ArrayList<>();
if(model.getBusinessId()==null) { if (model.getBusinessId() == null) {
model.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION()); model.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
UserUtil.setCurrentPersistOperation(model); UserUtil.setCurrentPersistOperation(model);
//设置状态为待发布 //设置状态为待发布
...@@ -136,9 +142,9 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -136,9 +142,9 @@ public class BLessonServiceImpl implements BLessonService {
//添加课程表 //添加课程表
line = bLessonRepository.insertSelective(model); line = bLessonRepository.insertSelective(model);
//添加课程标签表 //添加课程标签表
if (StringUtils.isNotEmpty(model.getLabels())){ if (StringUtils.isNotEmpty(model.getLabels())) {
String[] labels = model.getLabels().split(","); String[] labels = model.getLabels().split(",");
for (int index = 0 ; index<labels.length;index++){ for (int index = 0; index < labels.length; index++) {
BLessonLabel bLessonLabel = new BLessonLabel(); BLessonLabel bLessonLabel = new BLessonLabel();
UserUtil.setCurrentPersistOperation(bLessonLabel); UserUtil.setCurrentPersistOperation(bLessonLabel);
bLessonLabel.setLabelId(labels[index]); bLessonLabel.setLabelId(labels[index]);
...@@ -147,14 +153,14 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -147,14 +153,14 @@ public class BLessonServiceImpl implements BLessonService {
} }
bLessonRepository.insertLessonLabel(bLessonLabels); bLessonRepository.insertLessonLabel(bLessonLabels);
} }
}else { } else {
UserUtil.setCurrentMergeOperation(model); UserUtil.setCurrentMergeOperation(model);
line = bLessonRepository.updateByPrimaryKeySelective(model); line = bLessonRepository.updateByPrimaryKeySelective(model);
bLessonRepository.removeLabelByLessonId(model); bLessonRepository.removeLabelByLessonId(model);
//删除原标签添,加课程标签表 //删除原标签添,加课程标签表
if (StringUtils.isNotEmpty(model.getLabels())){ if (StringUtils.isNotEmpty(model.getLabels())) {
String[] labels = model.getLabels().split(","); String[] labels = model.getLabels().split(",");
for (int index = 0 ; index<labels.length;index++){ for (int index = 0; index < labels.length; index++) {
BLessonLabel bLessonLabel = new BLessonLabel(); BLessonLabel bLessonLabel = new BLessonLabel();
UserUtil.setCurrentPersistOperation(bLessonLabel); UserUtil.setCurrentPersistOperation(bLessonLabel);
bLessonLabel.setLabelId(labels[index]); bLessonLabel.setLabelId(labels[index]);
...@@ -168,7 +174,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -168,7 +174,7 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override @Override
public PersistModel removeBLesson(String id) { public PersistModel removeBLesson(String id) {
// if(bSlRepository.selectslNumByLesson(id)>0) { // if(bSlRepository.selectslNumByLesson(id)>0) {
...@@ -188,12 +194,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -188,12 +194,12 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override @Override
public List<BLesson> queryHomeBLessonsByPagination(PageUtil pageUtil, FirstPageQueryDTO firstPageQueryDTO,List<AllCourseDTO> allCourse) { public List<BLesson> queryHomeBLessonsByPagination(PageUtil pageUtil, FirstPageQueryDTO firstPageQueryDTO, List<AllCourseDTO> allCourse) {
List<String> sonCourseIds = null; List<String> sonCourseIds = null;
if (allCourse != null){ if (allCourse != null) {
sonCourseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(),allCourse); sonCourseIds = recursion.FindSons(firstPageQueryDTO.getCourseLevelOne(), allCourse);
} }
return bLessonRepository.queryHomeBLesson(firstPageQueryDTO,sonCourseIds); return bLessonRepository.queryHomeBLesson(firstPageQueryDTO, sonCourseIds);
} }
@Override @Override
...@@ -216,4 +222,26 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -216,4 +222,26 @@ public class BLessonServiceImpl implements BLessonService {
return bLessonRepository.iLessonCount(userId); return bLessonRepository.iLessonCount(userId);
} }
@Override
public List<BLesson> theLessonMangageByPagination(PageUtil pageUtil, CurUser curUser, BLesson bLesson) {
String userId = curUser.getUserId();
//查询当前登录人有什么角色
List<String> roleList = sysUserMapper.queryRoleTypeByUserId(userId);
boolean isAdmin = false;
Set<CurUser> uids = new HashSet<>();
for (String role : roleList) {
if ("1".equals(role)) {
isAdmin = true;
break;
} else if ("2".equals(role)) {
// 调用 feign 获取当前部门及子部门 --->所有人
uids.addAll(Arrays.asList(new CurUser(), new CurUser()));
}
}
//自己
uids.add(curUser);
//查讯课程的语句
List<BLesson> bLessons = bLessonRepository.selectAllManageLesson(uids,bLesson, isAdmin);
return bLessons;
}
} }
...@@ -160,4 +160,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> { ...@@ -160,4 +160,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
int deleteTeacherUserRole(List<SysUser> userTeacherList); int deleteTeacherUserRole(List<SysUser> userTeacherList);
int deleteCompanyUserRole(List<SysUser> userCompanyList); int deleteCompanyUserRole(List<SysUser> userCompanyList);
@Select("<script>SELECT sr.type AS roleList " +
"FROM s_user AS su " +
"LEFT JOIN s_r_user_role AS ru ON su.business_id = ru.user_id " +
"LEFT JOIN s_role AS sr ON ru.role_id = sr.business_id " +
"WHERE su.del_flag = 0 " +
"AND su.business_id = #{userId}</script>")
List<String> queryRoleTypeByUserId(@Param("userId")String 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