Commit 4037015d authored by root's avatar root

修改接口

parent 2d77a449
package org.rcisoft.business.bbanner.common;
public class BannerExceptMessage {
public static final String NO_DATA = "该数据不存在";
public static final String MUST_NOT_FILLED = "必填未填写";
}
...@@ -32,7 +32,7 @@ import javax.validation.Valid; ...@@ -32,7 +32,7 @@ import javax.validation.Valid;
* @date 2019/9/11 * @date 2019/9/11
*/ */
@Api(tags = "1 Banner接口") @Api(tags = "01 Banner接口")
@RestController @RestController
@RequestMapping("/Banner") @RequestMapping("/Banner")
@Slf4j @Slf4j
...@@ -107,7 +107,7 @@ public class BBannerController extends PaginationController<BBanner> { ...@@ -107,7 +107,7 @@ public class BBannerController extends PaginationController<BBanner> {
topDownDTO); topDownDTO);
}*/ }*/
@ApiOperation(value = "107 Banner重新排序", notes = "Banner重新排序") @ApiOperation(value = "105 Banner重新排序", notes = "Banner重新排序")
@PostMapping(value = "/updateBannerOrder") @PostMapping(value = "/updateBannerOrder")
public Result updateBannerOrder(CurUser curUser, @Param("bannerOrderMap") String bannerOrderMap,BindingResult bindingResult){ public Result updateBannerOrder(CurUser curUser, @Param("bannerOrderMap") String bannerOrderMap,BindingResult bindingResult){
int data = bBannerService.updateBannerOrder(bannerOrderMap); int data = bBannerService.updateBannerOrder(bannerOrderMap);
......
...@@ -28,7 +28,7 @@ public interface BBannerRepository extends BaseMapper<BBanner> { ...@@ -28,7 +28,7 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
* @return * @return
*/ */
@Select("<script>select * from b_banner where del_flag='0' and flag = '1' " + @Select("<script>select * from b_banner where del_flag='0' and flag = '1' " +
" <if test=\"businessId!=null and businessId != ''\">and title business_id = #{businessId})</if>" + " <if test=\"businessId!=null and businessId != ''\">and business_id = #{businessId})</if>" +
" <if test=\"title!=null and title != ''\">and title like CONCAT('%',#{title},'%')</if>" + " <if test=\"title!=null and title != ''\">and title like CONCAT('%',#{title},'%')</if>" +
" <if test=\"isExternalLink!=null and isExternalLink != ''\">and is_external_link=#{isExternalLink}</if>" + " <if test=\"isExternalLink!=null and isExternalLink != ''\">and is_external_link=#{isExternalLink}</if>" +
" <if test=\"lineType!=null and lineType != ''\">and line_type=#{lineType}</if>" + " <if test=\"lineType!=null and lineType != ''\">and line_type=#{lineType}</if>" +
...@@ -47,6 +47,13 @@ public interface BBannerRepository extends BaseMapper<BBanner> { ...@@ -47,6 +47,13 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
"</script>") "</script>")
int selectCountById(String id); int selectCountById(String id);
/**
* 查询Banner个数
* @return
*/
@Select("<script>select count(1) from b_banner where " +
" del_flag = 0 and flag = 1 </script>")
int selectCountBanner();
/** /**
* 获取sort最大值 +1 * 获取sort最大值 +1
......
...@@ -19,4 +19,6 @@ public class FindBannerPaginDTO { ...@@ -19,4 +19,6 @@ public class FindBannerPaginDTO {
@ApiModelProperty(value = "类型(0:线下,1:线上)",required = false,dataType = "varchar") @ApiModelProperty(value = "类型(0:线下,1:线上)",required = false,dataType = "varchar")
private String lineType; private String lineType;
// private String corpId;
} }
package org.rcisoft.business.bbanner.service.impl; package org.rcisoft.business.bbanner.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bbanner.common.BannerExceptMessage;
import org.rcisoft.business.bbanner.dto.AddOrUpdateDTO; import org.rcisoft.business.bbanner.dto.AddOrUpdateDTO;
import org.rcisoft.business.bbanner.dto.BannerInfoRspDTO; import org.rcisoft.business.bbanner.dto.BannerInfoRspDTO;
import org.rcisoft.business.bbanner.dto.FindBannerPaginDTO; import org.rcisoft.business.bbanner.dto.FindBannerPaginDTO;
...@@ -10,6 +10,7 @@ import org.rcisoft.business.bbanner.dto.TopDownDTO; ...@@ -10,6 +10,7 @@ import org.rcisoft.business.bbanner.dto.TopDownDTO;
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;
import org.rcisoft.core.result.ResultExceptionEnum;
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;
...@@ -28,6 +29,7 @@ import java.util.Map; ...@@ -28,6 +29,7 @@ import java.util.Map;
* @author * @author
* @date 2019/9/10 * @date 2019/9/10
*/ */
@Slf4j
@Service @Service
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED) @Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public class BBannerServiceImpl implements BBannerService { public class BBannerServiceImpl implements BBannerService {
...@@ -45,18 +47,25 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -45,18 +47,25 @@ 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(BannerExceptMessage.MUST_NOT_FILLED); throw new ServiceException(ResultExceptionEnum.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(BannerExceptMessage.MUST_NOT_FILLED); throw new ServiceException(ResultExceptionEnum.MUST_NOT_FILLED);
if (model.getBusinessId() != null) { if (model.getBusinessId() != null) {
//按ID查询Banner个数
if (bBannerRepository.selectCountById(model.getBusinessId()) == 0){ if (bBannerRepository.selectCountById(model.getBusinessId()) == 0){
throw new ServiceException(BannerExceptMessage.NO_DATA); throw new ServiceException(ResultExceptionEnum.NO_DATA);
} }
UserUtil.setCurrentMergeOperation(model); UserUtil.setCurrentMergeOperation(model);
line = bBannerRepository.updateById(model); line = bBannerRepository.updateById(model);
} else { } else {
UserUtil.setCurrentPersistOperation(model); UserUtil.setCurrentPersistOperation(model);
//查询Banner是否大于等于5个,大于等于五个不允许添加
int countBanner = bBannerRepository.selectCountBanner();
if(countBanner >= 5){
throw new ServiceException(ResultExceptionEnum.NOT_MORE_COUNT);
}
//查询最大排序值+1后放入Banner中
int sort = bBannerRepository.selectMaxSort(); int sort = bBannerRepository.selectMaxSort();
model.setBannerSort(sort); model.setBannerSort(sort);
line = bBannerRepository.insertSelective(model); line = bBannerRepository.insertSelective(model);
...@@ -68,7 +77,7 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -68,7 +77,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(BannerExceptMessage.NO_DATA); throw new ServiceException(ResultExceptionEnum.NO_DATA);
} }
return new PersistModel(1, bBannerRepository.deleteBanner(id)); return new PersistModel(1, bBannerRepository.deleteBanner(id));
...@@ -84,6 +93,7 @@ public class BBannerServiceImpl implements BBannerService { ...@@ -84,6 +93,7 @@ public class BBannerServiceImpl implements BBannerService {
@Override @Override
public List<BBanner> queryBannerByPagination(PageUtil pageUtil, FindBannerPaginDTO model) { public List<BBanner> queryBannerByPagination(PageUtil pageUtil, FindBannerPaginDTO model) {
// log.info("------zql---------"+model.getCorpId());
return bBannerRepository.queryBanners(model); return bBannerRepository.queryBanners(model);
} }
......
...@@ -48,7 +48,7 @@ import java.util.Map; ...@@ -48,7 +48,7 @@ import java.util.Map;
/** /**
* Created by gwf on 2017-7-21 15:08:47. * Created by gwf on 2017-7-21 15:08:47.
*/ */
@Api(tags = "2 章节") @Api(tags = "02 章节")
@RestController @RestController
@RequestMapping("/BChapter") @RequestMapping("/BChapter")
@Slf4j @Slf4j
......
...@@ -30,7 +30,7 @@ import java.util.ArrayList; ...@@ -30,7 +30,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Api(tags = "3 课程分类") @Api(tags = "03 课程分类")
@RestController @RestController
@RequestMapping("/BCourse") @RequestMapping("/BCourse")
public class BCourseController extends PaginationController<BCourse> { public class BCourseController extends PaginationController<BCourse> {
...@@ -58,12 +58,15 @@ public class BCourseController extends PaginationController<BCourse> { ...@@ -58,12 +58,15 @@ public class BCourseController extends PaginationController<BCourse> {
@ApiOperation(value = "302 根据条件分页查询", notes = "根据条件分页查询标签") @ApiOperation(value = "302 根据条件分页查询", notes = "根据条件分页查询标签")
@ApiImplicitParam(name = "cName", value = "(课程名)模糊查询", required = false, dataType = "varchar") @ApiImplicitParam(name = "cName", value = "(课程名)模糊查询", required = false, dataType = "varchar")
@GetMapping(value = "/queryBCourseByPagination") @GetMapping(value = "/queryBCourseByPagination")
public GridModel queryBCourseByPagination(CurUser curUser, @Valid String cName, BindingResult br) { public Result queryBCourseByPagination(CurUser curUser, @Valid String cName, BindingResult br) {
BCourse bCourse = new BCourse(); BCourse bCourse = new BCourse();
bCourse.setCName(cName); bCourse.setCName(cName);
bCourseServiceImpl.queryBCourseByPagination(getPaginationUtility(), bCourse); bCourseServiceImpl.queryBCourseByPagination(getPaginationUtility(), bCourse);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return gridModel; return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
} }
@ApiOperation(value = "303 查询所有一级课程分类", notes = "查询所有一级课程分类") @ApiOperation(value = "303 查询所有一级课程分类", notes = "查询所有一级课程分类")
......
...@@ -30,7 +30,7 @@ import java.util.List; ...@@ -30,7 +30,7 @@ import java.util.List;
/** /**
* Created by on 2019-9-25 9:03:09. * Created by on 2019-9-25 9:03:09.
*/ */
@Api(tags = "8 课程评论") @Api(tags = "08 课程评论")
@RestController @RestController
@RequestMapping("bdiscuss") @RequestMapping("bdiscuss")
public class BDiscussController extends PaginationController<BDiscuss> { public class BDiscussController extends PaginationController<BDiscuss> {
......
...@@ -29,7 +29,7 @@ import java.util.List; ...@@ -29,7 +29,7 @@ import java.util.List;
/** /**
* Created by gaowenfneg on 2017-10-9 14:34:56. * Created by gaowenfneg on 2017-10-9 14:34:56.
*/ */
@Api(tags = "4 文件") @Api(tags = "04 文件")
@RestController @RestController
@RequestMapping("/BVideo") @RequestMapping("/BVideo")
public class BFileController extends PaginationController<BFile> { public class BFileController extends PaginationController<BFile> {
......
...@@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid; import javax.validation.Valid;
@Api(tags = "5 标签") @Api(tags = "05 标签")
@RestController @RestController
@RequestMapping("/BLabel") @RequestMapping("/BLabel")
public class BLabelController extends PaginationController<BLabel> { public class BLabelController extends PaginationController<BLabel> {
......
...@@ -34,7 +34,7 @@ import java.util.List; ...@@ -34,7 +34,7 @@ import java.util.List;
/** /**
* Created by CodeGenerator on 2017/07/12. * Created by CodeGenerator on 2017/07/12.
*/ */
@Api(tags = "6 课程") @Api(tags = "06 课程")
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/BLesson") @RequestMapping("/BLesson")
...@@ -93,7 +93,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -93,7 +93,7 @@ public class BLessonController extends PaginationController<BLesson> {
@GetMapping(value = "/queryBLessonsByPagination") @GetMapping(value = "/queryBLessonsByPagination")
public Result queryBLessonsByPagination(CurUser curUser, String releaseState, BindingResult bindingResult) { public Result queryBLessonsByPagination(CurUser curUser, String releaseState, BindingResult bindingResult) {
String userId = curUser.getUserId(); String userId = curUser.getUserId();
bLessonService.queryBLessonsByPagination(getPaginationUtility(),releaseState,userId); bLessonService.queryBLessonsByPagination(getPaginationUtility(),releaseState,curUser);
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,
...@@ -105,7 +105,8 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -105,7 +105,8 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="605 根据条件分页查询全部课程", notes="根据条件分页查询全部课程") @ApiOperation(value="605 根据条件分页查询全部课程", notes="根据条件分页查询全部课程")
@GetMapping(value = "/queryAllBLessonsByPagination") @GetMapping(value = "/queryAllBLessonsByPagination")
public Result queryBLessonsByPagination(CurUser curUser, @Valid FindAllLessonDTO findAllLessonDTO, BindingResult bindingResult) { public Result queryAllBLessonsByPagination(CurUser curUser, @Valid FindAllLessonDTO findAllLessonDTO, BindingResult bindingResult) {
findAllLessonDTO.setCropId(curUser.getCorpId());
bLessonService.queryAllBLessonsByPagination(getPaginationUtility(),findAllLessonDTO); bLessonService.queryAllBLessonsByPagination(getPaginationUtility(),findAllLessonDTO);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1), return Result.builder(new PersistModel(1),
...@@ -117,8 +118,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -117,8 +118,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="606 分页查询大家都在学", notes="分页查询大家都在学") @ApiOperation(value="606 分页查询大家都在学", notes="分页查询大家都在学")
@GetMapping(value = "/queryPersonMoreByPagination") @GetMapping(value = "/queryPersonMoreByPagination")
public Result queryPersonMoreByPagination(CurUser curUser) { public Result queryPersonMoreByPagination(CurUser curUser) {
String userId = curUser.getUserId(); bLessonService.queryPersonMoreByPagination(getPaginationUtility(),curUser);
bLessonService.queryPersonMoreByPagination(getPaginationUtility(),userId);
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,
...@@ -129,8 +129,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -129,8 +129,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="607 分页查询企业推荐", notes="分页查询企业推荐") @ApiOperation(value="607 分页查询企业推荐", notes="分页查询企业推荐")
@GetMapping(value = "/queryRecommendByPagination") @GetMapping(value = "/queryRecommendByPagination")
public Result queryRecommendByPagination(CurUser curUser) { public Result queryRecommendByPagination(CurUser curUser) {
String userId = curUser.getUserId(); bLessonService.queryRecommendByPagination(getPaginationUtility(),curUser);
bLessonService.queryRecommendByPagination(getPaginationUtility(),userId);
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,
...@@ -141,8 +140,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -141,8 +140,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="608 分页查询最受关注", notes="分页查询最受关注") @ApiOperation(value="608 分页查询最受关注", notes="分页查询最受关注")
@GetMapping(value = "/queryConcernByPagination") @GetMapping(value = "/queryConcernByPagination")
public Result queryConcernByPagination(CurUser curUser) { public Result queryConcernByPagination(CurUser curUser) {
String userId = curUser.getUserId(); bLessonService.queryConcernByPagination(getPaginationUtility(),curUser);
bLessonService.queryConcernByPagination(getPaginationUtility(),userId);
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,
...@@ -154,8 +152,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -154,8 +152,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value="609 分页查询可能感兴趣", notes="分页查询可能感兴趣") @ApiOperation(value="609 分页查询可能感兴趣", notes="分页查询可能感兴趣")
@GetMapping(value = "/queryInterestedByPagination") @GetMapping(value = "/queryInterestedByPagination")
public Result queryInterestedByPagination(CurUser curUser) { public Result queryInterestedByPagination(CurUser curUser) {
String userId = curUser.getUserId(); bLessonService.queryInterestedByPagination(getPaginationUtility(),curUser);
bLessonService.queryInterestedByPagination(getPaginationUtility(),userId);
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,
...@@ -201,7 +198,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -201,7 +198,7 @@ public class BLessonController extends PaginationController<BLesson> {
gridModel); gridModel);
} }
@ApiOperation(value="613 我发布的课程总数", notes="我发布的课程总数") @ApiOperation(value="613 我的课程总数(学习和发布)", notes="我的课程总数")
@GetMapping(value = "/iLessonCount") @GetMapping(value = "/iLessonCount")
public Result ILessonCountDTO(CurUser curUser) { public Result ILessonCountDTO(CurUser curUser) {
String userId = curUser.getUserId(); String userId = curUser.getUserId();
...@@ -211,18 +208,15 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -211,18 +208,15 @@ public class BLessonController extends PaginationController<BLesson> {
bLessonService.iLessonCount(userId)); bLessonService.iLessonCount(userId));
} }
@ApiOperation(value="614 退出课程", notes="根据ID停用一条记录") @ApiOperation(value="614 退出课程", notes="根据ID停用一条记录")
@ApiImplicitParam(name = "businessId", value = "退出课程的选课id", required = true, dataType = "varchar") @ApiImplicitParam(name = "businessId", value = "退出课程的选课id", required = true, dataType = "varchar")
@PostMapping(value = "/quit") @PostMapping(value = "/quit")
public Result quit(CurUser curUser, String businessId, BindingResult bindingResult) { public Result quit(CurUser curUser, @Valid QuitLessonDTO quitLessonDTO, BindingResult bindingResult) {
PersistModel data = bLessonPersonService.quit(businessId); PersistModel data = bLessonPersonService.quit(quitLessonDTO);
return Result.builder(data, return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
businessId); quitLessonDTO);
} }
@ApiOperation(value="615 分页查询我学习", notes="分页查询我学习") @ApiOperation(value="615 分页查询我学习", notes="分页查询我学习")
...@@ -237,4 +231,20 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -237,4 +231,20 @@ public class BLessonController extends PaginationController<BLesson> {
gridModel); gridModel);
} }
@ApiOperation(value="616 分页查询列表页全部", notes="分页查询列表页全部")
@GetMapping(value = "/queryListAllLessonByPagination")
public Result queryListAllLessonByPagination(CurUser curUser, @Valid FindListLessonDTO param, BindingResult bindingResult) {
List<AllCourseDTO> allCourse = null;
if (StringUtils.isNotEmpty(param.getCourse())){
allCourse = bCourseService.findAllCourse(curUser.getCorpId());
}
bLessonService.queryListAllLessonByPagination(getPaginationUtility(),param,allCourse);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
} }
...@@ -4,13 +4,14 @@ import org.apache.ibatis.annotations.*; ...@@ -4,13 +4,14 @@ import org.apache.ibatis.annotations.*;
import org.rcisoft.business.blabel.entity.BLabel; import org.rcisoft.business.blabel.entity.BLabel;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.dto.ILearnLessonDTO; import org.rcisoft.business.blesson.dto.ILearnLessonDTO;
import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@Repository @Repository
public interface BLessonPersonRepository extends BaseMapper<BLabel> { public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
//我学习的课程 //我学习的课程
@Select("<script> select blp.*,bl.lesson_name lessonName,bl.default_url defaultUrl,bl.person_number personNumber, " + @Select("<script> select blp.*,bl.lesson_name lessonName,bl.default_url defaultUrl,bl.person_number personNumber, " +
...@@ -37,7 +38,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLabel> { ...@@ -37,7 +38,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLabel> {
// 退出课程 // 退出课程
@Update("update b_lesson_label set flag = 0 where business_id = #{id}") @Update("update b_lesson_person set flag = 0 where business_id = #{id}")
int quit(String id); int quit(String id);
......
package org.rcisoft.business.blesson.dao;
import org.apache.ibatis.annotations.*;
import org.rcisoft.business.blesson.entity.BViewrangeSon;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.blesson.entity.BViewrange;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with on 2019-9-28 14:19:05.
*/
@Repository
public interface BViewrangeRepository extends BaseMapper<BViewrange> {
/**
* 分页查询 bViewrange
*
*/
@Select("<script>select * from b_viewrange where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BViewrange> queryBViewranges(BViewrange bViewrange);
@Update({"<script>",
"update b_banner",
" <set>",
" <if test='updateBy != null'>update_by=#{updateBy},</if>",
" <if test='updateDate != null'>update_date=#{updateDate},</if>",
" <if test='delFlag != null'>del_flag=#{delFlag},</if>",
" <if test='flag != null'>flag=#{flag},</if>",
" <if test='remarks != null'>remarks=#{remarks},</if>",
" <if test='type != null'>title=#{type},</if>",
" </set>",
"where lesson_id=#{lessonId}",
"</script>"})
int updateByLessonId(BViewrange bViewrange);
@Delete("<script>DELETE from b_viewrange_son where viewrange_id=#{businessId}</script>")
int deleteViewrangeSon(BViewrange bViewrange);
@Insert("<script>INSERT INTO b_viewrange_son" +
"(business_id,viewrange_id,type,target_id)VALUES" +
"<foreach collection=\"list\" item=\"item\" separator=\",\">" +
"(#{item.businessId},#{item.viewrangeId},#{item.type},#{item.targetId})" +
"</foreach></script>")
int insertBViewrangeSons(List<BViewrangeSon> bViewrangeSons);
}
...@@ -44,4 +44,6 @@ public class FindAllLessonDTO { ...@@ -44,4 +44,6 @@ public class FindAllLessonDTO {
@ApiModelProperty(value = "创建人姓名") @ApiModelProperty(value = "创建人姓名")
private String createByName; private String createByName;
private String cropId;
} }
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
public class FindListLessonDTO {
@ApiModelProperty(value = "查询参数",required = false)
private String viewParam;
@ApiModelProperty(value = "分类",required = false)
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String course;
@ApiModelProperty(value = "接收标签id")
private String labelId;
@ApiModelProperty(value = "发布时间排序(1升序 0降序)",required = true)
@NotNull
private String releaseDateSort;
@ApiModelProperty(value = "课程类型",required = true)
private String lessonType;
private List<String> courseIds;
private String userId;
private String corpId;
private List<String> departs;
}
...@@ -19,6 +19,8 @@ public class FirstPageQueryDTO { ...@@ -19,6 +19,8 @@ public class FirstPageQueryDTO {
private String userId; private String userId;
private String corpId;
//部门id //部门id
private List<String> departs; private List<String> departs;
......
package org.rcisoft.business.blesson.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;
@Data
public class QuitLessonDTO {
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@ApiModelProperty(value = "选课主键id")
@NotNull
private String businessId;
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@ApiModelProperty(value = "课程id")
@NotNull
private String lessonId;
private String cropId;
}
...@@ -6,7 +6,10 @@ import lombok.Data; ...@@ -6,7 +6,10 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.rcisoft.business.blabel.dto.QueryLabelResDTO; import org.rcisoft.business.blabel.dto.QueryLabelResDTO;
import org.rcisoft.common.component.Global;
import org.rcisoft.core.entity.IdEntity; import org.rcisoft.core.entity.IdEntity;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
...@@ -26,6 +29,11 @@ import java.util.List; ...@@ -26,6 +29,11 @@ import java.util.List;
public class BLesson extends IdEntity<BLesson> { public class BLesson extends IdEntity<BLesson> {
private static final long serialVersionUID = -4327021174023243830L; private static final long serialVersionUID = -4327021174023243830L;
// @Transient
// @Autowired
// private Global global;
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@ApiModelProperty(value = "课程编号") @ApiModelProperty(value = "课程编号")
private String code; private String code;
...@@ -129,5 +137,28 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -129,5 +137,28 @@ public class BLesson extends IdEntity<BLesson> {
@ApiModelProperty(value = "可见范围(部门)多人之间用','隔开") @ApiModelProperty(value = "可见范围(部门)多人之间用','隔开")
@Transient @Transient
private String viewRangeDepart; private String viewRangeDepart;
public void initModel(){
// this.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
UserUtil.setCurrentPersistOperation(this);
//设置状态为待发布
this.setReleaseState("0");
//设置讲师为登录人
this.setLecturerId(this.getCreateBy());
//设置初始报名人数为0
this.setPersonNumber("0");
//设置初始评论人数为0
this.setDiscussNumber("0");
//设置初始课时数为0
this.setClassHour("0");
//设置热度为0
this.setHotNumber("0");
//设置初始不推荐
this.setRecommend("0");
//设置初始关注数为0
this.setCollectNumber("0");
}
} }
...@@ -15,7 +15,7 @@ import javax.persistence.Transient; ...@@ -15,7 +15,7 @@ import javax.persistence.Transient;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@Entity @Entity
@Table(name = "b_lesson_label") @Table(name = "b_lesson_person")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
......
package org.rcisoft.business.blesson.entity; package org.rcisoft.business.blesson.entity;
import io.swagger.annotations.ApiModelProperty; import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Entity; import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Table; import javax.persistence.*;
/**
* Created with on 2019-9-28 14:19:05.
*/
@Entity @Entity
@Table(name = "b_viewrange")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class BViewrange extends IdEntity<BViewrange> { @Table(name = "b_viewrange")
public class BViewrange extends IdEntity<BViewrange> {
@ApiModelProperty(value = "课程id")
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String lessonId;
@ApiModelProperty(value = "可视范围类型(0 人 1 部门 2 人和部门)") private String lessonId;
@Length(min = 1,max = 1,message = "长度最小为1,最大为50")
private String type; private String type;
} }
package org.rcisoft.business.blesson.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* Created with on 2019-9-28 14:19:05.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "b_viewrange_son")
public class BViewrangeSon {
private String businessId;
private String viewrangeId;
private String type;
private String targetId;
}
package org.rcisoft.business.blesson.service; package org.rcisoft.business.blesson.service;
import org.rcisoft.business.blesson.dto.FindListLessonDTO;
import org.rcisoft.business.blesson.dto.QuitLessonDTO;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.dto.ILearnLessonDTO; import org.rcisoft.business.blesson.dto.ILearnLessonDTO;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
...@@ -12,10 +14,10 @@ public interface BLessonPersonService { ...@@ -12,10 +14,10 @@ public interface BLessonPersonService {
/** /**
* 退出课程 * 退出课程
* @param id * @param quitLessonDTO
* @return * @return
*/ */
PersistModel quit(String id); PersistModel quit(QuitLessonDTO quitLessonDTO);
/** /**
......
...@@ -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;
...@@ -34,7 +35,7 @@ public interface BLessonService{ ...@@ -34,7 +35,7 @@ public interface BLessonService{
* @param releaseState * @param releaseState
* @return * @return
*/ */
List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, String releaseState, String userId); List<BLesson> queryBLessonsByPagination(PageUtil pageUtil, String releaseState, CurUser curUser);
/** /**
* 根据条件分页查找 * 根据条件分页查找
...@@ -50,7 +51,7 @@ public interface BLessonService{ ...@@ -50,7 +51,7 @@ public interface BLessonService{
* @param * @param
* @return * @return
*/ */
List<BLesson> queryPersonMoreByPagination(PageUtil pageUtil,String userId); List<BLesson> queryPersonMoreByPagination(PageUtil pageUtil,CurUser curUser);
/** /**
* 分页查找推荐 * 分页查找推荐
...@@ -58,7 +59,7 @@ public interface BLessonService{ ...@@ -58,7 +59,7 @@ public interface BLessonService{
* @param * @param
* @return * @return
*/ */
List<BLesson> queryRecommendByPagination(PageUtil pageUtil,String userId); List<BLesson> queryRecommendByPagination(PageUtil pageUtil,CurUser curUser);
/** /**
* 分页查找最受关注 * 分页查找最受关注
...@@ -66,7 +67,7 @@ public interface BLessonService{ ...@@ -66,7 +67,7 @@ public interface BLessonService{
* @param * @param
* @return * @return
*/ */
List<BLesson> queryConcernByPagination(PageUtil pageUtil,String userId); List<BLesson> queryConcernByPagination(PageUtil pageUtil,CurUser curUser);
/** /**
* 分页查找可能感兴趣的 * 分页查找可能感兴趣的
...@@ -74,7 +75,7 @@ public interface BLessonService{ ...@@ -74,7 +75,7 @@ public interface BLessonService{
* @param * @param
* @return * @return
*/ */
List<BLesson> queryInterestedByPagination(PageUtil pageUtil,String userId); List<BLesson> queryInterestedByPagination(PageUtil pageUtil,CurUser curUser);
/** /**
* 插入 * 插入
...@@ -118,4 +119,12 @@ public interface BLessonService{ ...@@ -118,4 +119,12 @@ public interface BLessonService{
*/ */
ILessonCountDTO iLessonCount(String userId); ILessonCountDTO iLessonCount(String userId);
/**
* 分页查询列表页全部
* @param pageUtil
* @param model
* @return
*/
List<BLesson> queryListAllLessonByPagination(PageUtil pageUtil, FindListLessonDTO model, List<AllCourseDTO> allCourse);
} }
package org.rcisoft.business.blesson.service.impl; package org.rcisoft.business.blesson.service.impl;
import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.dto.QuitLessonDTO;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.dao.BLessonPersonRepository; import org.rcisoft.business.blesson.dao.BLessonPersonRepository;
import org.rcisoft.business.blesson.dto.ILearnLessonDTO; import org.rcisoft.business.blesson.dto.ILearnLessonDTO;
import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.business.blesson.service.BLessonPersonService; import org.rcisoft.business.blesson.service.BLessonPersonService;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
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.ResultServiceEnums;
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;
...@@ -22,14 +28,23 @@ import java.util.List; ...@@ -22,14 +28,23 @@ import java.util.List;
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED) @Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
public class BLessonPersonServiceImpl implements BLessonPersonService { public class BLessonPersonServiceImpl implements BLessonPersonService {
@Autowired
private BLessonRepository bLessonRepository;
@Autowired @Autowired
private BLessonPersonRepository bLessonPersonRepository; private BLessonPersonRepository bLessonPersonRepository;
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override @Override
public PersistModel quit(String id) { public PersistModel quit(QuitLessonDTO quitLessonDTO) {
return new PersistModel(1,bLessonPersonRepository.quit(id)); BLessonPerson bLessonPerson = bLessonPersonRepository.selectByPrimaryKey(quitLessonDTO.getBusinessId());
if ("1".equals(bLessonPerson.getIsAppoint())){
throw new ServiceException(ResultExceptionEnum.APPOINT_NOT_CLOSE);
}
//课程在学人数-1
bLessonRepository.personNumberMinusOne(quitLessonDTO.getLessonId());
return new PersistModel(1,bLessonPersonRepository.quit(quitLessonDTO.getBusinessId()));
} }
@Override @Override
......
package org.rcisoft.common.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.common.component.Global;
import org.rcisoft.common.model.FileUpload;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.UploadUtil;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import java.util.Map;
@Api(tags = "09 公共上传图片")
@RestController
@RequestMapping("/file")
@Slf4j
public class FileUploadController extends FileController {
@Autowired
private Global global;
@ApiOperation(value="上传图片", notes="上传图片到服务器")
@ApiImplicitParams({@ApiImplicitParam(name = "importFile", value = "图片文件", required = true, dataType = "MultipartFile"),
// @ApiImplicitParam(name = "businessId", value = "课程id", required = true, dataType = "varchar")
})
@PostMapping(value = "upload")
public Result upload(CurUser curUser, @Valid MultipartFile importFile, BindingResult bindingResult) throws Exception {
Result result = new Result();
//获取文件名称
String originalName = importFile.getOriginalFilename();
String path = global.getBASE_UPLOAD_SERVER_LOCATION();
String course_logo_path =global.getIMAGE_LOCATION()+global.getCOURSE_LOGO_LOCATION();
boolean type = false;
if("1".equals(global.getIS_SERVER_LINUX())){
type = true;
}
Map<String,Object> map= UploadUtil.picImport(path,course_logo_path,importFile,type);
if(map.get(UploadUtil.IS_SUCCESSS).equals(true))
{
// BLesson bL=new BLesson();
// bL.setCode(code);
// BLesson bLesson=bLessonService.selectOne(bL);
// if(bLesson!=null){
// bLesson.setDefaultUrl(map.get(UploadUtil.URL).toString());
// UserUtil.setCurrentMergeOperation(bLesson);
// int line = bLessonService.updateByPrimaryKeySelective(bLesson);
// return Result.builder(new PersistModel(line),
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// bLessonService.selectOne(code));
// }else{
//
// throw new ServiceException(ResultServiceEnums.UPLOAD_FILE_ERROR);
// }
FileUpload fileUpload = new FileUpload();
fileUpload.setFileName(originalName);
fileUpload.setFilePath("https://img.zcool.cn/community/01a949581aeb9fa84a0d304fd05eeb.jpg@1280w_1l_2o_100sh.jpg");
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
fileUpload);
}
else
{
throw new ServiceException(ResultServiceEnums.ADD_ERROR);
}
}
}
package org.rcisoft.common.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FileUpload {
private String fileName;
private String filePath;
}
...@@ -24,6 +24,10 @@ public enum ResultExceptionEnum { ...@@ -24,6 +24,10 @@ 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,"必修不能退出")
; ;
private Integer code; private Integer code;
......
...@@ -34,7 +34,7 @@ import java.util.List; ...@@ -34,7 +34,7 @@ import java.util.List;
/** /**
* Created by Andrew on 2017/7/6. * Created by Andrew on 2017/7/6.
*/ */
@Api(tags = "7 用户管理") @Api(tags = "07 用户管理")
@RestController @RestController
@RequestMapping(value = "/user") @RequestMapping(value = "/user")
public class SysUserController extends PaginationController<SysUser> { public class SysUserController extends PaginationController<SysUser> {
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.blesson.dao.BViewrangeRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.blesson.entity.BViewrange">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="lesson_id" jdbcType="VARCHAR" property="lessonId"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
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