Commit bdbc9f4e authored by luzhuang's avatar luzhuang

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

parents c97e8310 c02afc9b
...@@ -11,6 +11,7 @@ import org.rcisoft.core.aop.PageUtil; ...@@ -11,6 +11,7 @@ import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultExceptionEnum; import org.rcisoft.core.result.ResultExceptionEnum;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.business.bbanner.dao.BBannerRepository; import org.rcisoft.business.bbanner.dao.BBannerRepository;
import org.rcisoft.business.bbanner.entity.BBanner; import org.rcisoft.business.bbanner.entity.BBanner;
...@@ -47,14 +48,14 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -47,14 +48,14 @@ public class BBannerServiceImpl implements BBannerService {
int line = 0; int line = 0;
//外部链接但外部URL为空或长度为0 抛异常 //外部链接但外部URL为空或长度为0 抛异常
if ("1".equals(model.getIsExternalLink()) && StringUtils.isEmpty(model.getExternalUrl())) if ("1".equals(model.getIsExternalLink()) && StringUtils.isEmpty(model.getExternalUrl()))
throw new ServiceException(ResultExceptionEnum.MUST_NOT_FILLED); throw new ServiceException(ResultServiceEnums.MUST_NOT_FILLED);
//内部链接但类型或课程ID为空或长度为0 抛异常 //内部链接但类型或课程ID为空或长度为0 抛异常
if ("0".equals(model.getIsExternalLink()) && (StringUtils.isEmpty(model.getLineType()) || StringUtils.isEmpty(model.getCourseId()))) if ("0".equals(model.getIsExternalLink()) && (StringUtils.isEmpty(model.getLineType()) || StringUtils.isEmpty(model.getCourseId())))
throw new ServiceException(ResultExceptionEnum.MUST_NOT_FILLED); throw new ServiceException(ResultServiceEnums.MUST_NOT_FILLED);
if (model.getBusinessId() != null) { if (model.getBusinessId() != null) {
//按ID查询Banner个数 //按ID查询Banner个数
if (bBannerRepository.selectCountById(model.getBusinessId()) == 0){ if (bBannerRepository.selectCountById(model.getBusinessId()) == 0){
throw new ServiceException(ResultExceptionEnum.NO_DATA); throw new ServiceException(ResultServiceEnums.NO_DATA);
} }
UserUtil.setCurrentMergeOperation(model); UserUtil.setCurrentMergeOperation(model);
line = bBannerRepository.updateById(model); line = bBannerRepository.updateById(model);
...@@ -63,7 +64,7 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -63,7 +64,7 @@ public class BBannerServiceImpl implements BBannerService {
//查询Banner是否大于等于5个,大于等于五个不允许添加 //查询Banner是否大于等于5个,大于等于五个不允许添加
int countBanner = bBannerRepository.selectCountBanner(addOrUpdateDTO); int countBanner = bBannerRepository.selectCountBanner(addOrUpdateDTO);
if(countBanner >= 5){ if(countBanner >= 5){
throw new ServiceException(ResultExceptionEnum.NOT_MORE_COUNT); throw new ServiceException(ResultServiceEnums.NOT_MORE_COUNT);
} }
//查询最大排序值+1后放入Banner中 //查询最大排序值+1后放入Banner中
int sort = bBannerRepository.selectMaxSort(); int sort = bBannerRepository.selectMaxSort();
...@@ -77,7 +78,7 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -77,7 +78,7 @@ public class BBannerServiceImpl implements BBannerService {
@Override @Override
public PersistModel removeBanner(String id) { public PersistModel removeBanner(String id) {
if (bBannerRepository.selectCountById(id) == 0){ if (bBannerRepository.selectCountById(id) == 0){
throw new ServiceException(ResultExceptionEnum.NO_DATA); throw new ServiceException(ResultServiceEnums.NO_DATA);
} }
return new PersistModel(1, bBannerRepository.deleteBanner(id)); return new PersistModel(1, bBannerRepository.deleteBanner(id));
......
...@@ -49,6 +49,9 @@ public class QueryChapterListResDTO { ...@@ -49,6 +49,9 @@ public class QueryChapterListResDTO {
@ApiModelProperty(value = "进度") @ApiModelProperty(value = "进度")
private String progress; private String progress;
@ApiModelProperty(value = "最近进度")
private int currentLocation;
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private String businessId; private String businessId;
......
...@@ -111,6 +111,7 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -111,6 +111,7 @@ public class BChapterServiceImpl implements BChapterService {
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(childList.getBusinessId(), curUser.getUserId()); List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(childList.getBusinessId(), curUser.getUserId());
if (null != brStudentChapterList && brStudentChapterList.size() > 0) { if (null != brStudentChapterList && brStudentChapterList.size() > 0) {
childList.setProgress(brStudentChapterList.get(0).getProgress()*100 + "%"); childList.setProgress(brStudentChapterList.get(0).getProgress()*100 + "%");
childList.setCurrentLocation(brStudentChapterList.get(0).getCurrentLocation());
percent += brStudentChapterList.get(0).getProgress(); percent += brStudentChapterList.get(0).getProgress();
} }
i++; i++;
...@@ -129,9 +130,6 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -129,9 +130,6 @@ public class BChapterServiceImpl implements BChapterService {
map.put("chapterList", queryChapterListResDTOS); map.put("chapterList", queryChapterListResDTOS);
map.put("totalProgress", df.format((float)percent/i) + "%"); map.put("totalProgress", df.format((float)percent/i) + "%");
map.put("lessonInfo", bLessonRepository.selectByPrimaryKey(lessonId)); // 课程信息 map.put("lessonInfo", bLessonRepository.selectByPrimaryKey(lessonId)); // 课程信息
BLessonPerson bLessonPerson = bLessonPersonRepository.selectByPrimaryKey(lessonId);
if (null != bLessonPerson){
}
map.put("currentChapter", bChapterRepository.getWithCurrentChapterBylessonId(lessonId)); map.put("currentChapter", bChapterRepository.getWithCurrentChapterBylessonId(lessonId));
return map; return map;
......
...@@ -9,6 +9,8 @@ import org.rcisoft.core.entity.IdEntity; ...@@ -9,6 +9,8 @@ import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Entity @Entity
@Table(name = "b_label") @Table(name = "b_label")
...@@ -18,7 +20,7 @@ import javax.persistence.Transient; ...@@ -18,7 +20,7 @@ import javax.persistence.Transient;
public class BLabel extends IdEntity<BLabel> { public class BLabel extends IdEntity<BLabel> {
/*标签名称*/ /*标签名称*/
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "标签名称过长")
private String lName; private String lName;
} }
package org.rcisoft.business.blabel.service.impl; package org.rcisoft.business.blabel.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.blabel.dao.BLabelRepository; import org.rcisoft.business.blabel.dao.BLabelRepository;
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;
...@@ -34,7 +35,9 @@ public class BLabelServiceImpl implements BLabelService { ...@@ -34,7 +35,9 @@ public class BLabelServiceImpl implements BLabelService {
@Override @Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel insertLabel(BLabel bLabel) { public PersistModel insertLabel(BLabel bLabel) {
if(StringUtils.isBlank(bLabel.getLName())){
throw new ServiceException("标签名称不能为空");
}
List<BLabel> line = bLabelRepository.checknameByName(bLabel); List<BLabel> line = bLabelRepository.checknameByName(bLabel);
if(line.size()>0){ if(line.size()>0){
throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS); throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS);
...@@ -46,6 +49,9 @@ public class BLabelServiceImpl implements BLabelService { ...@@ -46,6 +49,9 @@ public class BLabelServiceImpl implements BLabelService {
@Override @Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel updateLabel(BLabel bLabel) { public PersistModel updateLabel(BLabel bLabel) {
if(StringUtils.isBlank(bLabel.getLName())){
throw new ServiceException("标签名称不能为空");
}
List<BLabel> line = bLabelRepository.checknameByName(bLabel); List<BLabel> line = bLabelRepository.checknameByName(bLabel);
if(line.size()>0){ if(line.size()>0){
throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS); throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS);
......
...@@ -17,6 +17,7 @@ import org.rcisoft.common.model.GridModel; ...@@ -17,6 +17,7 @@ import org.rcisoft.common.model.GridModel;
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.result.Result; import org.rcisoft.core.result.Result;
import org.rcisoft.sys.role.service.SysRoleService;
import org.rcisoft.sys.user.bean.CurUser; import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
...@@ -46,6 +47,9 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -46,6 +47,9 @@ public class BLessonController extends PaginationController<BLesson> {
@Autowired @Autowired
private BLessonPersonService bLessonPersonService; private BLessonPersonService bLessonPersonService;
@Autowired
private SysRoleService sysRoleService;
@Autowired @Autowired
private Global global; private Global global;
...@@ -332,7 +336,8 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -332,7 +336,8 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value = "617课程管理显示的全部课程", notes="课程管理显示的全部课程", response = BLesson.class) @ApiOperation(value = "617课程管理显示的全部课程", notes="课程管理显示的全部课程", response = BLesson.class)
@GetMapping(value = "theLessonManage") @GetMapping(value = "theLessonManage")
public Result theLessonManage(CurUser curUser, @Valid BLesson bLesson, BindingResult bindingResult){ public Result theLessonManage(CurUser curUser, @Valid BLesson bLesson, BindingResult bindingResult){
List<BLesson> bLessons = bLessonService.theLessonMangageByPagination(getPaginationUtility(), curUser, bLesson); List<RoleTypeDepartDTO> roleList = sysRoleService.queryRoleTypeByUserId(curUser);
List<BLesson> bLessons = bLessonService.theLessonMangageByPagination(getPaginationUtility(), curUser, bLesson ,roleList);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
...@@ -469,4 +474,20 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -469,4 +474,20 @@ public class BLessonController extends PaginationController<BLesson> {
lessonId); lessonId);
} }
// /**
// * @author: zhangqingle
// * @param
// * @return
// */
// @ApiOperation(value="626 收藏课程", notes="收藏课程")
// @ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")
// @PostMapping(value = "/addCollect")
// public Result addCollect(CurUser curUser, @Valid String lessonId, BindingResult bindingResult) {
// PersistModel data = bLessonService.addCollect(curUser,lessonId);
// return Result.builder(data,
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// lessonId);
// }
} }
...@@ -509,20 +509,29 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -509,20 +509,29 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
ILessonCountDTO iLessonCount(String userId); ILessonCountDTO iLessonCount(String userId);
/** /**
* 在学人数加一 * 重新统计在学人数
* @param BusinessId * @param lessonId
* @return * @return
*/ */
@Update("update b_lesson set person_number = person_number+1 where business_id = #{BusinessId}") @Update("<script>update b_lesson set person_number = " +
int personNumberPlusOne(String BusinessId); "(select count(1) from b_lesson_person where 1=1 " +
" and del_flag != 1 and flag = 1 " +
" and lesson_id = #{lessonId})" +
" where business_id = #{lessonId} </script>" )
int personNumberReCount(String lessonId);
/** /**
* 在学人数减一 * 重新统计收藏人数
* @param BusinessId * @param lessonId
* @return * @return
*/ */
@Update("update b_lesson set person_number = person_number-1 where business_id = #{BusinessId}") @Update("<script>update b_lesson set collect_number = " +
int personNumberMinusOne(String BusinessId); "(select count(1) from b_lesson_person where 1=1 " +
" and del_flag != 1 and flag = 1 " +
" and is_collect = '1' " +
" and lesson_id = #{lessonId})" +
" where business_id = #{lessonId} </script>" )
int collectNumberReCount(String lessonId);
/** /**
* 列表页分页查询全部课程 * 列表页分页查询全部课程
...@@ -829,7 +838,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -829,7 +838,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"<if test='!isAdmin'>" + "<if test='!isAdmin'>" +
"AND les.lecturer_id IN" + "AND les.lecturer_id IN" +
"<foreach item='item' index='index' collection='CurUserSet' open='(' close=')' separator=','> " + "<foreach item='item' index='index' collection='CurUserSet' open='(' close=')' separator=','> " +
"#{item.userId} " + "#{item} " +
"</foreach>" + "</foreach>" +
"</if> " + "</if> " +
"<if test=\"bLesson.lessonName!=null and bLesson.lessonName!=''\">AND les.lesson_name like '%${bLesson.lessonName}%' </if>" + "<if test=\"bLesson.lessonName!=null and bLesson.lessonName!=''\">AND les.lesson_name like '%${bLesson.lessonName}%' </if>" +
...@@ -837,8 +846,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -837,8 +846,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"<if test=\"bLesson.releaseState!=null and bLesson.releaseState!=''\">AND les.release_state = #{bLesson.releaseState} </if>" + "<if test=\"bLesson.releaseState!=null and bLesson.releaseState!=''\">AND les.release_state = #{bLesson.releaseState} </if>" +
" order by les.release_date desc </script>") " order by les.release_date desc </script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLesson> selectAllManageLesson(@Param("C" + List<BLesson> selectAllManageLesson(@Param("CurUserSet") Set<String> CurUserSet, @Param("bLesson") BLesson bLesson, @Param("isAdmin") boolean isAdmin, @Param("corpId") String corpId) ;
"urUserSet") Set<CurUser> CurUserSet, @Param("bLesson") BLesson bLesson, @Param("isAdmin") boolean isAdmin, @Param("corpId") String corpId) ;
@Select("<script>" + @Select("<script>" +
......
package org.rcisoft.business.blesson.dto; package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
public class AddMyLearnLessonDTO { public class AddMyLearnLessonDTO {
@ApiModelProperty(value = "课程Id",required = true) @ApiModelProperty(value = "课程Id",required = true)
......
package org.rcisoft.business.blesson.dto;
import lombok.Data;
import java.util.List;
@Data
public class RoleTypeDepartDTO {
private String type;
private String departs;
private List<String> departList;
}
...@@ -179,7 +179,7 @@ public interface BLessonService{ ...@@ -179,7 +179,7 @@ public interface BLessonService{
* @param * @param
* @return * @return
*/ */
List<BLesson> theLessonMangageByPagination(PageUtil pageUtil,CurUser curUser,BLesson bLesson); List<BLesson> theLessonMangageByPagination(PageUtil pageUtil,CurUser curUser,BLesson bLesson,List<RoleTypeDepartDTO> roleList);
/** /**
* 分页查询列表页全部 * 分页查询列表页全部
...@@ -189,4 +189,13 @@ public interface BLessonService{ ...@@ -189,4 +189,13 @@ public interface BLessonService{
*/ */
PersistModel deleteRecommend(String lessonId); PersistModel deleteRecommend(String lessonId);
/**
* 分页查询列表页全部
* @author: zhangqingle
* @param curUser
* @param lessonId
* @return
*/
PersistModel addCollect(CurUser curUser,String lessonId);
} }
...@@ -47,10 +47,10 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -47,10 +47,10 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
public PersistModel quit(QuitLessonDTO quitLessonDTO) { public PersistModel quit(QuitLessonDTO quitLessonDTO) {
BLessonPerson bLessonPerson = bLessonPersonRepository.selectById(quitLessonDTO.getBusinessId()); BLessonPerson bLessonPerson = bLessonPersonRepository.selectById(quitLessonDTO.getBusinessId());
if ("1".equals(bLessonPerson.getIsAppoint())){ if ("1".equals(bLessonPerson.getIsAppoint())){
throw new ServiceException(ResultExceptionEnum.APPOINT_NOT_CLOSE); throw new ServiceException(ResultServiceEnums.APPOINT_NOT_CLOSE);
} }
//课程在学人数-1 //重新统计在学人数
bLessonRepository.personNumberMinusOne(quitLessonDTO.getLessonId()); bLessonRepository.personNumberReCount(quitLessonDTO.getLessonId());
return new PersistModel(1,bLessonPersonRepository.quit(quitLessonDTO.getBusinessId())); return new PersistModel(1,bLessonPersonRepository.quit(quitLessonDTO.getBusinessId()));
} }
...@@ -74,7 +74,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -74,7 +74,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
public PersistModel cancelAppoint(CancelAppointDTO cancelAppointDTO) { public PersistModel cancelAppoint(CancelAppointDTO cancelAppointDTO) {
String bAppointId = bLessonPersonRepository.selectAppointIdById(cancelAppointDTO); String bAppointId = bLessonPersonRepository.selectAppointIdById(cancelAppointDTO);
if (StringUtils.isEmpty(bAppointId)){ if (StringUtils.isEmpty(bAppointId)){
throw new ServiceException(ResultExceptionEnum.APPOINT_NOT_CANCEL); throw new ServiceException(ResultServiceEnums.APPOINT_NOT_CANCEL);
} }
BAppoint bAppoint = bAppointRepository.selectById(bAppointId); BAppoint bAppoint = bAppointRepository.selectById(bAppointId);
...@@ -128,15 +128,16 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -128,15 +128,16 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
bLessonPerson.setIsFinish("1"); bLessonPerson.setIsFinish("1");
line = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson); line = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
//课程在学人数+1 //课程在学人数+1
bLessonRepository.personNumberPlusOne(addMyLearnLessonDTO.getLessonId()); bLessonRepository.personNumberReCount(addMyLearnLessonDTO.getLessonId());
}else if (bLessonPersons == null || bLessonPersons.size() < 1){ //未指派 }else if (bLessonPersons == null || bLessonPersons.size() < 1){ //未指派
bLessonPerson = new BLessonPerson(); bLessonPerson = new BLessonPerson();
bLessonPerson.initModel(); bLessonPerson.initModel();
bLessonPerson.setIsFinish("1");
bLessonPerson.setLessonId(addMyLearnLessonDTO.getLessonId()); bLessonPerson.setLessonId(addMyLearnLessonDTO.getLessonId());
bLessonPerson.setPersonId(addMyLearnLessonDTO.getUserId()); bLessonPerson.setPersonId(addMyLearnLessonDTO.getUserId());
line = bLessonPersonRepository.insertBLessonPerson(bLessonPerson); line = bLessonPersonRepository.insertBLessonPerson(bLessonPerson);
//课程在学人数+1 //课程在学人数+1
bLessonRepository.personNumberPlusOne(addMyLearnLessonDTO.getLessonId()); bLessonRepository.personNumberReCount(addMyLearnLessonDTO.getLessonId());
}else if (bLessonPersons != null && bLessonPersons.size()>0){ }else if (bLessonPersons != null && bLessonPersons.size()>0){
line = 1; line = 1;
} }
......
...@@ -11,6 +11,7 @@ import org.rcisoft.business.blesson.service.BLessonService; ...@@ -11,6 +11,7 @@ import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.business.blesson.util.recursion; import org.rcisoft.business.blesson.util.recursion;
import org.rcisoft.business.blesson.dao.BViewrangeRepository; import org.rcisoft.business.blesson.dao.BViewrangeRepository;
import org.rcisoft.common.util.feignDto.DeptGetRspDTO; import org.rcisoft.common.util.feignDto.DeptGetRspDTO;
import org.rcisoft.common.util.feignDto.GetAllRspDTO;
import org.rcisoft.common.util.feignDto.MTUserGetsReqDTO; import org.rcisoft.common.util.feignDto.MTUserGetsReqDTO;
import org.rcisoft.common.util.feignDto.MTUserInfoRspDTO; import org.rcisoft.common.util.feignDto.MTUserInfoRspDTO;
import org.rcisoft.common.util.outClient.MTCotactApiRequestClient; import org.rcisoft.common.util.outClient.MTCotactApiRequestClient;
...@@ -19,6 +20,7 @@ import org.rcisoft.core.constant.MessageConstant; ...@@ -19,6 +20,7 @@ import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultExceptionEnum; import org.rcisoft.core.result.ResultExceptionEnum;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.IdGen; import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.user.bean.CurUser; import org.rcisoft.sys.user.bean.CurUser;
...@@ -336,7 +338,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -336,7 +338,7 @@ public class BLessonServiceImpl implements BLessonService {
int state = bLessonRepository.findLessonReleaseState(id); int state = bLessonRepository.findLessonReleaseState(id);
if (state != 0){ if (state != 0){
throw new ServiceException(ResultExceptionEnum.STATE_NOT_RELEASE); throw new ServiceException(ResultServiceEnums.STATE_NOT_RELEASE);
} }
BLesson bLesson = new BLesson(); BLesson bLesson = new BLesson();
...@@ -398,7 +400,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -398,7 +400,7 @@ public class BLessonServiceImpl implements BLessonService {
int line = bRecommendRepository.insertBRecommendSons(bRecommendSons); int line = bRecommendRepository.insertBRecommendSons(bRecommendSons);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
}else { }else {
throw new ServiceException(ResultExceptionEnum.INVALID_PARAMETER_VALUE); throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
} }
} }
...@@ -435,7 +437,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -435,7 +437,7 @@ public class BLessonServiceImpl implements BLessonService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel appointLessonToPerson(AppointLessonDTO appointLessonDTO) { public PersistModel appointLessonToPerson(AppointLessonDTO appointLessonDTO) {
if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson())){ if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson())){
throw new ServiceException(ResultExceptionEnum.INVALID_PARAMETER_VALUE); throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
} }
//按课程查询指派表是否为空 //按课程查询指派表是否为空
List<BAppoint> bAppoints = bAppointRepository.selectByLessonId(appointLessonDTO); List<BAppoint> bAppoints = bAppointRepository.selectByLessonId(appointLessonDTO);
...@@ -563,7 +565,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -563,7 +565,7 @@ public class BLessonServiceImpl implements BLessonService {
ListAllLesson = bLessonRepository.queryInterestedListByPagination(model); ListAllLesson = bLessonRepository.queryInterestedListByPagination(model);
break; break;
default: default:
throw new ServiceException(ResultExceptionEnum.INVALID_PARAMETER_VALUE); throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
} }
return ListAllLesson; return ListAllLesson;
...@@ -571,25 +573,35 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -571,25 +573,35 @@ public class BLessonServiceImpl implements BLessonService {
@Override @Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public List<BLesson> theLessonMangageByPagination(PageUtil pageUtil, CurUser curUser, BLesson bLesson) { public List<BLesson> theLessonMangageByPagination(PageUtil pageUtil, CurUser curUser, BLesson bLesson,List<RoleTypeDepartDTO> roleList) {
//查询当前登录人所在的企业 //查询当前登录人所在的企业
String corpId = curUser.getCorpId(); String corpId = curUser.getCorpId();
String userId = curUser.getUserId(); String userId = curUser.getUserId();
//查询当前登录人有什么角色 //查询当前登录人有什么角色
List<String> roleList = sysUserMapper.queryRoleTypeByUserId(userId); // List<RoleTypeDepartDTO> roleList = sysUserMapper.queryRoleTypeByUserId(userId);
if (roleList == null || roleList.size()<1){
return new ArrayList<>();
}
boolean isAdmin = false; boolean isAdmin = false;
Set<CurUser> uids = new HashSet<>(); Set<String> uids = new HashSet<>();
for (String role : roleList) { Set<String> departIds = new HashSet<>();
if ("1".equals(role)) { for (RoleTypeDepartDTO role : roleList) {
if ("1".equals(role.getType())) {
isAdmin = true; isAdmin = true;
break; break;
} else if ("2".equals(role)) { } else if ("2".equals(role.getType())) {
List<String> departs = asList(StringUtils.split(role.getDeparts(), ","));
departIds.addAll(departs);
// 调用 feign 获取当前部门及子部门 --->所有人 // 调用 feign 获取当前部门及子部门 --->所有人
uids.addAll(Arrays.asList(new CurUser(), new CurUser())); // uids.addAll(Arrays.asList(new CurUser(), new CurUser()));
} }
} }
List<GetAllRspDTO> GetAllRspDTOList = cotactApiRequestClient.getUserByDeptIdSet(corpId,departIds);
for (GetAllRspDTO getAllRspDTO : GetAllRspDTOList) {
uids.add(getAllRspDTO.getId());
}
//自己 //自己
uids.add(curUser); uids.add(userId);
//查讯课程的语句 //查讯课程的语句
List<BLesson> bLessons = bLessonRepository.selectAllManageLesson(uids,bLesson, isAdmin,corpId); List<BLesson> bLessons = bLessonRepository.selectAllManageLesson(uids,bLesson, isAdmin,corpId);
return bLessons; return bLessons;
...@@ -600,7 +612,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -600,7 +612,7 @@ public class BLessonServiceImpl implements BLessonService {
List<String> recommendIds = bRecommendRepository.selectIdByLessonId(lessonId); List<String> recommendIds = bRecommendRepository.selectIdByLessonId(lessonId);
if (recommendIds == null || recommendIds.size()<1){ if (recommendIds == null || recommendIds.size()<1){
throw new ServiceException(ResultExceptionEnum.NOT_RECOMMEND); throw new ServiceException(ResultServiceEnums.NOT_RECOMMEND);
} }
//修改推荐表 //修改推荐表
BRecommend bRecommend = new BRecommend(); BRecommend bRecommend = new BRecommend();
...@@ -613,6 +625,20 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -613,6 +625,20 @@ public class BLessonServiceImpl implements BLessonService {
return new PersistModel(line); return new PersistModel(line);
} }
@Override
public PersistModel addCollect(CurUser curUser,String lessonId) {
AddMyLearnLessonDTO param = new AddMyLearnLessonDTO(lessonId,curUser.getCorpId(),curUser.getUserId());
List<BLessonPerson> bLessonPersons = bLessonPersonRepository.selectByPersonAndLesson(param);
if (bLessonPersons == null || bLessonPersons.size()<1){
throw new ServiceException(ResultServiceEnums.B_R_SL_STUDENT_NOT_EXISTS);
}
BLessonPerson bLessonPerson = bLessonPersons.get(0);
bLessonPerson.setIsCollect("1");
int line = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
bLessonRepository.collectNumberReCount(lessonId);
return new PersistModel(line);
}
//遍历标签放入List中 //遍历标签放入List中
List<BLessonLabel> addLabel(BLesson model){ List<BLessonLabel> addLabel(BLesson model){
//标签集合 //标签集合
......
...@@ -476,6 +476,25 @@ public class MTCotactApiRequestClient { ...@@ -476,6 +476,25 @@ public class MTCotactApiRequestClient {
return contactFeignClient.getUserByDeptIds(getUserByDeptIdReqDTO,zxClientType,zxAccountId).getData(); return contactFeignClient.getUserByDeptIds(getUserByDeptIdReqDTO,zxClientType,zxAccountId).getData();
} }
/**
* 根据多个部门id的Set集合获取部门内人员
* @param corpId
* @param deptIdSet
* @return
*/
public List<GetAllRspDTO> getUserByDeptIdSet(String corpId,Set<String> deptIdSet){
if(deptIdSet == null || deptIdSet.size() < 1){
return new ArrayList<>();
}
GetUserByDeptIdReqDTO getUserByDeptIdReqDTO = new GetUserByDeptIdReqDTO();
List<Long> deptIdList = new ArrayList<>();
for (String deptId : deptIdSet) {
deptIdList.add(Long.parseLong(deptId));
}
getUserByDeptIdReqDTO.setDeptIds(deptIdList);
return contactFeignClient.getUserByDeptIds(getUserByDeptIdReqDTO,zxClientType,zxAccountId).getData();
}
public List<DeptGetRspDTO> deptListDeptInfoByName(String corpId,String name){ public List<DeptGetRspDTO> deptListDeptInfoByName(String corpId,String name){
return contactFeignClient.deptListDeptInfoByName(corpId,name,zxClientType,zxAccountId).getData(); return contactFeignClient.deptListDeptInfoByName(corpId,name,zxClientType,zxAccountId).getData();
} }
......
...@@ -24,14 +24,8 @@ public enum ResultExceptionEnum { ...@@ -24,14 +24,8 @@ public enum ResultExceptionEnum {
OS_HAS_SERVER(4008,"操作系统仍有关联服务器,不可删除"), OS_HAS_SERVER(4008,"操作系统仍有关联服务器,不可删除"),
START_LXC_SERVER(4009,"启动容器失败"), START_LXC_SERVER(4009,"启动容器失败"),
EXIST_LXC_SERVER(4010,"已开始其他课程实验,请先关闭其他课程实验"), EXIST_LXC_SERVER(4010,"已开始其他课程实验,请先关闭其他课程实验"),
NO_DATA(4011,"该数据不存在"),
MUST_NOT_FILLED(4012,"必填未填写"),
NOT_MORE_COUNT(4013,"添加超过规定个数"),
APPOINT_NOT_CLOSE(4014,"必修不能退出"),
STATE_NOT_RELEASE(4015,"该课程状态不能发布"),
APPOINT_NOT_CANCEL(4016,"该课程不能取消指派"),
INVALID_PARAMETER_VALUE(4017,"参数值无效"),
NOT_RECOMMEND(4018,"该课程未推荐")
; ;
private Integer code; private Integer code;
......
...@@ -210,6 +210,15 @@ public enum ResultServiceEnums { ...@@ -210,6 +210,15 @@ public enum ResultServiceEnums {
ZX_FAILED(111,"调用智信接口失败"), ZX_FAILED(111,"调用智信接口失败"),
MUST_NOT_FILLED(112,"必填未填写"),
NOT_MORE_COUNT(113,"添加超过规定个数"),
APPOINT_NOT_CLOSE(114,"必修不能退出"),
STATE_NOT_RELEASE(115,"该课程状态不能发布"),
APPOINT_NOT_CANCEL(116,"该课程不能取消指派"),
INVALID_PARAMETER_VALUE(117,"参数值无效"),
NOT_RECOMMEND(118,"该课程未推荐"),
NO_DATA(4011,"该数据不存在"),
; ;
private Integer code; private Integer code;
......
...@@ -2,6 +2,7 @@ package org.rcisoft.sys.role.service; ...@@ -2,6 +2,7 @@ package org.rcisoft.sys.role.service;
import org.rcisoft.business.blesson.dto.RoleTypeDepartDTO;
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.dept.entity.DeptRole; import org.rcisoft.sys.dept.entity.DeptRole;
...@@ -82,4 +83,6 @@ public interface SysRoleService { ...@@ -82,4 +83,6 @@ public interface SysRoleService {
int addAdminRoleMenuUser(InitAddAdminDTO initAddAdminDTO,List<RoleMenuDTO> roleMenuDTOs,UserRoleDTO userRoleDTO); int addAdminRoleMenuUser(InitAddAdminDTO initAddAdminDTO,List<RoleMenuDTO> roleMenuDTOs,UserRoleDTO userRoleDTO);
List<RoleTypeDepartDTO> queryRoleTypeByUserId(CurUser curUser);
} }
...@@ -2,6 +2,7 @@ package org.rcisoft.sys.role.service.impl; ...@@ -2,6 +2,7 @@ package org.rcisoft.sys.role.service.impl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.blesson.dto.RoleTypeDepartDTO;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
...@@ -181,4 +182,9 @@ public class SysRoleServiceImpl implements SysRoleService { ...@@ -181,4 +182,9 @@ public class SysRoleServiceImpl implements SysRoleService {
sysRoleRepository.addRoleMenu(roleMenuDTOs); sysRoleRepository.addRoleMenu(roleMenuDTOs);
return sysRoleRepository.addUserRole(userRoleDTO); return sysRoleRepository.addUserRole(userRoleDTO);
} }
@Override
public List<RoleTypeDepartDTO> queryRoleTypeByUserId(CurUser curUser) {
return sysUserMapper.queryRoleTypeByUserId(curUser.getUserId());
}
} }
...@@ -2,6 +2,7 @@ package org.rcisoft.sys.user.dao; ...@@ -2,6 +2,7 @@ package org.rcisoft.sys.user.dao;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.rcisoft.business.blesson.dto.RoleTypeDepartDTO;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.sys.user.bean.CurUser; import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dto.MyInfoDTO; import org.rcisoft.sys.user.dto.MyInfoDTO;
...@@ -169,13 +170,14 @@ public interface SysUserMapper extends BaseMapper<SysUser> { ...@@ -169,13 +170,14 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
int deleteCompanyUserRole(List<SysUser> userCompanyList); int deleteCompanyUserRole(List<SysUser> userCompanyList);
@Select("<script>SELECT sr.type AS roleList " + @Select("<script>SELECT sr.type AS type,sr.depart_ids departs " +
"FROM s_user AS su " + "FROM s_user AS su " +
"LEFT JOIN s_r_user_role AS ru ON su.business_id = ru.user_id " + "LEFT JOIN s_r_user_role AS ru ON su.business_id = ru.user_id " +
"LEFT JOIN tm_admin_role AS sr ON ru.role_id = sr.r_id " + "LEFT JOIN tm_admin_role AS sr ON ru.role_id = sr.r_id " +
"WHERE su.del_flag = 0 " + "WHERE su.del_flag = 0 " +
"and sr.r_status !=0 " +
"AND su.business_id = #{userId}</script>") "AND su.business_id = #{userId}</script>")
List<String> queryRoleTypeByUserId(@Param("userId")String userId); List<RoleTypeDepartDTO> queryRoleTypeByUserId(@Param("userId")String userId);
/** /**
* 查询用户 menu 19-09-30 * 查询用户 menu 19-09-30
......
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