Commit 2d77a449 authored by root's avatar root

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

parents 61830035 e39e29cf
......@@ -344,11 +344,11 @@
<version>2.1</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.ganymed.ssh2</groupId>-->
<!--<artifactId>ganymed-ssh2-build</artifactId>-->
<!--<version>210</version>-->
<!--</dependency>-->
<dependency>
<groupId>com.ganymed.ssh2</groupId>
<artifactId>ganymed-ssh2-build</artifactId>
<version>210</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
......@@ -383,11 +383,11 @@
<version>5.5.13</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.yxyqcy</groupId>-->
<!--<artifactId>eduLk</artifactId>-->
<!--<version>1.0-SNAPSHOT</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.yxyqcy</groupId>
<artifactId>eduLk</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
......
......@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.bbanner.dto.AddOrUpdateDTO;
import org.rcisoft.business.bbanner.dto.FindBannerPaginDTO;
import org.rcisoft.business.bbanner.dto.TopDownDTO;
......@@ -40,7 +41,7 @@ public class BBannerController extends PaginationController<BBanner> {
@Autowired
private BBannerService bBannerService;
@ApiOperation(value="101 添加/编辑Banner", notes="businessId为空时是添加方法,不为空时是修改方法")
@ApiOperation(value = "101 添加/编辑Banner", notes = "businessId为空时是添加方法,不为空时是修改方法")
@PostMapping(value = "/add")
public Result add(CurUser curUser, @Valid AddOrUpdateDTO addOrUpdateDTO, BindingResult bindingResult) {
PersistModel data = bBannerService.persist(addOrUpdateDTO);
......@@ -51,7 +52,7 @@ public class BBannerController extends PaginationController<BBanner> {
}
@ApiOperation(value="102 删除Banner", notes="根据ID删除一条记录")
@ApiOperation(value = "102 删除Banner", notes = "根据ID删除一条记录")
@ApiImplicitParam(name = "businessId", value = "主键id", required = true, dataType = "varchar")
@PostMapping(value = "/remove")
public Result remove(CurUser curUser, String businessId, BindingResult bindingResult) {
......@@ -63,10 +64,10 @@ public class BBannerController extends PaginationController<BBanner> {
}
@ApiOperation(value="103 唯一查找", notes="根据ID查找一条记录")
@ApiOperation(value = "103 唯一查找", notes = "根据ID查找一条记录")
@ApiImplicitParam(name = "businessId", value = "主键id", required = true, dataType = "varchar")
@GetMapping(value = "/one")
public Result queryOne(CurUser curUser,String businessId, BindingResult bindingResult) {
public Result queryOne(CurUser curUser, String businessId, BindingResult bindingResult) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
......@@ -74,18 +75,18 @@ public class BBannerController extends PaginationController<BBanner> {
}
@ApiOperation(value="104 分页获取banner", notes="根据条件分页查询")
@ApiOperation(value = "104 分页获取banner", notes = "根据条件分页查询")
@GetMapping(value = "/queryBBannerByPagination")
public Result queryBBannerByPagination(CurUser curUser, @Valid FindBannerPaginDTO param, BindingResult bindingResult) {
bBannerService.queryBannerByPagination(getPaginationUtility(),param);
bBannerService.queryBannerByPagination(getPaginationUtility(), param);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
/*
@ApiOperation(value="105 Banner向上调顺序", notes="Banner向上调顺序")
@PostMapping(value = "/updateTopBanner")
public Result updateTopBanner(CurUser curUser, @Valid TopDownDTO topDownDTO, BindingResult bindingResult){
......@@ -94,10 +95,9 @@ public class BBannerController extends PaginationController<BBanner> {
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
topDownDTO);
}
}*/
@ApiOperation(value="106 Banner向下调顺序", notes="Banner向下调顺序")
/*@ApiOperation(value="106 Banner向下调顺序", notes="Banner向下调顺序")
@PostMapping(value = "/updateDownBanner")
public Result updateDownBanner( CurUser curUser, @Valid TopDownDTO topDownDTO, BindingResult bindingResult){
int data = bBannerService.updateDownChapter(topDownDTO);
......@@ -105,6 +105,15 @@ public class BBannerController extends PaginationController<BBanner> {
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
topDownDTO);
}
}*/
@ApiOperation(value = "107 Banner重新排序", notes = "Banner重新排序")
@PostMapping(value = "/updateBannerOrder")
public Result updateBannerOrder(CurUser curUser, @Param("bannerOrderMap") String bannerOrderMap,BindingResult bindingResult){
int data = bBannerService.updateBannerOrder(bannerOrderMap);
return Result.builder(new PersistModel(data),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bannerOrderMap);
}
}
......@@ -105,4 +105,13 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
"ORDER BY banner_sort desc LIMIT 1</script>")
@ResultMap(value = "BaseResultMap" )
BBanner getlessChapter(TopDownDTO param);
//重新排序
@Update("<script> <foreach collection=\"bannerOrderMap.entrySet()\" index=\"key\" item=\"value\" separator=\";\">" +
"update b_banner " +
"set banner_sort = #{value}" +
"WHERE business_id = #{key}" +
"</foreach></script>")
int updateBannerOrderByid(@Param("bannerOrderMap") Map<String,Object> bannerOrderMap);
}
package org.rcisoft.business.bbanner.service;
import org.rcisoft.business.bbanner.dto.AddOrUpdateDTO;
import org.rcisoft.business.bbanner.dto.BannerInfoRspDTO;
import org.rcisoft.business.bbanner.dto.FindBannerPaginDTO;
......@@ -57,4 +60,15 @@ public interface BBannerService {
* @return
*/
int updateDownChapter(TopDownDTO topDownDTO);
/**
* @author: jiangpengpeng
* @description: TODO
* @date: 2019/9/26 16:25
* @param bannerOrderMap
* @return
*/
int updateBannerOrder(String bannerOrderMap);
}
package org.rcisoft.business.bbanner.service.impl;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bbanner.common.BannerExceptMessage;
import org.rcisoft.business.bbanner.dto.AddOrUpdateDTO;
......@@ -20,6 +21,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
......@@ -38,7 +40,7 @@ public class BBannerServiceImpl implements BBannerService {
public PersistModel persist(AddOrUpdateDTO addOrUpdateDTO) {
BBanner model = new BBanner();
BeanUtils.copyProperties(addOrUpdateDTO,model);
BeanUtils.copyProperties(addOrUpdateDTO, model);
int line = 0;
//外部链接但外部URL为空或长度为0 抛异常
......@@ -69,7 +71,7 @@ public class BBannerServiceImpl implements BBannerService {
throw new ServiceException(BannerExceptMessage.NO_DATA);
}
return new PersistModel(1,bBannerRepository.deleteBanner(id));
return new PersistModel(1, bBannerRepository.deleteBanner(id));
}
@Override
......@@ -85,35 +87,49 @@ public class BBannerServiceImpl implements BBannerService {
return bBannerRepository.queryBanners(model);
}
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override
public int updateTopChapter(TopDownDTO topDownDTO) {
int result = 0;
BBanner lessBanner = bBannerRepository.getlessChapter(topDownDTO);
int sort = topDownDTO.getBannerSort();
int lessSort = lessBanner.getBannerSort();
int data = bBannerRepository.updateSortById(topDownDTO.getBusinessId(),lessSort);
int data2 = bBannerRepository.updateSortById(lessBanner.getBusinessId(),sort);
if(data==data2){
int data = bBannerRepository.updateSortById(topDownDTO.getBusinessId(), lessSort);
int data2 = bBannerRepository.updateSortById(lessBanner.getBusinessId(), sort);
if (data == data2) {
result = 1;
}
return result;
}
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override
public int updateDownChapter(TopDownDTO topDownDTO) {
int result = 0;
BBanner bigBanner = bBannerRepository.getBigChapter(topDownDTO);
int sort = topDownDTO.getBannerSort();
int bigSort = bigBanner.getBannerSort();
int data = bBannerRepository.updateSortById(topDownDTO.getBusinessId(),bigSort);
int data2 = bBannerRepository.updateSortById(bigBanner.getBusinessId(),sort);
if(data==data2){
int data = bBannerRepository.updateSortById(topDownDTO.getBusinessId(), bigSort);
int data2 = bBannerRepository.updateSortById(bigBanner.getBusinessId(), sort);
if (data == data2) {
result = 1;
}
return result;
}
/**
* @param bannerOrderMap
* @return
* @author: jiangpengpeng
* @description: 更新banner顺序
* @date: 2019/9/26 16:27
*/
@Override
public int updateBannerOrder(String bannerOrderMap) {
//获取将字符串中的主键和位置对应关系转成Map
Map parse = (Map) JSON.parse(bannerOrderMap);
int i = bBannerRepository.updateBannerOrderByid(parse);
return i;
}
}
......@@ -309,9 +309,9 @@ public interface BChapterRepository extends BaseMapper<BChapter> {
List<BChapter> queryBchapterStudentById(String chapterId);
@Select("<script>SELECT brc.student_id as studentId from b_r_student_chapter brc\n" +
"LEFT JOIN b_student bs ON brc.student_id = bs.business_id\n" +
"where bs.`code` = #{studentCode}\n" +
@Select("<script>SELECT brc.student_id as studentId from b_r_student_chapter brc" +
"LEFT JOIN b_student bs ON brc.student_id = bs.business_id" +
"where bs.`code` = #{studentCode}" +
"AND brc.chapter_id = #{chapterId}</script>")
ScoreInfoDTO queryScoreByChapterId(@Param("chapterId") String chapterId, @Param("studentCode") String studentCode);
......
......@@ -15,6 +15,7 @@ import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
......@@ -29,7 +30,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Api(tags = "3 分类接口")
@Api(tags = "3 课程分类")
@RestController
@RequestMapping("/BCourse")
public class BCourseController extends PaginationController<BCourse> {
......@@ -45,6 +46,7 @@ public class BCourseController extends PaginationController<BCourse> {
public Result queryBCourse(CurUser curUser, @Valid String cName, BindingResult br) {
BCourse bCourse = new BCourse();
bCourse.setCName(cName);
bCourse.setCorpId(curUser.getCorpId());
Map<String, Object> map = new HashedMap();
map.put("courseList", bCourseServiceImpl.queryBCourse(bCourse));
return Result.builder(new PersistModel(1),
......@@ -65,15 +67,16 @@ public class BCourseController extends PaginationController<BCourse> {
}
@ApiOperation(value = "303 查询所有一级课程分类", notes = "查询所有一级课程分类")
@ApiImplicitParam(name = "num", value = "查询一级分类数量", required = true, dataType = "int")
@PostMapping(value = "/queryFirstBCourse")
public Result queryFirstBCourse(CurUser curUser) {
public Result queryFirstBCourse(CurUser curUser,int num) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bCourseRepository.queryFirstLevel());
bCourseRepository.queryFirstLevel(curUser.getCorpId(),num));
}
@ApiOperation(value = "304 物理删除", notes = "根据ID删除一条记录")
@ApiOperation(value = "304 逻辑删除", notes = "根据ID删除一条记录")
@ApiImplicitParam(name = "businessId", value = "课程分类id", required = true, dataType = "varchar")
@PostMapping(value = "/remove")
public Result remove(CurUser curUser, @Valid String businessId, BindingResult br) {
......@@ -96,11 +99,12 @@ public class BCourseController extends PaginationController<BCourse> {
bCourse.getBusinessId());
}
@ApiOperation(value = "306 添加课程分类", notes = "添加课程分类,不填parentId添加一级课程分类")
@ApiOperation(value = "306 添加课程分类", notes = "添加课程分类,不填pid添加一级课程分类")
@ApiImplicitParams({@ApiImplicitParam(name = "pid", value = "上一级", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "cName", value = "课程分类名", required = true, dataType = "varchar")})
@PostMapping(value = "/add")
public Result insert(CurUser curUser, @Valid BCourse bCourse, BindingResult br) {
UserUtil.setCurrentPersistOperation(bCourse);
PersistModel data = bCourseServiceImpl.insertCourse(bCourse);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
......@@ -108,4 +112,14 @@ public class BCourseController extends PaginationController<BCourse> {
bCourse.getPid());
}
@ApiOperation(value = "307 课程分类排序",notes = "拼接格式{\"businessid\":\"pid,sort,level\",\"businessid\":\"pid,sort,level\"}")
@ApiImplicitParam(name = "json", value = "前台将所有课程的id,pid,sort,level拼成json", required = true, dataType = "varchar")
@PostMapping(value = "/sort")
public Result sort(CurUser curUser, String json) {
return Result.builder(bCourseServiceImpl.sortCourse(json),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
json);
}
}
......@@ -7,6 +7,7 @@ import org.rcisoft.business.bcourse.entity.BCourse;
import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -15,7 +16,10 @@ import java.util.Map;
public interface BCourseRepository extends BaseMapper<BCourse> {
@Select("<script>SELECT * FROM b_course where del_flag != 1 and flag = 1 " +
@Select("<script>SELECT * FROM b_course where del_flag != 1 and flag = 1 and course_level = 1 " +
"and corp_id = #{corpId}" +
"<if test=\"cName!=null and cName != ''\"> and c_name like CONCAT('%',#{cName},'%') </if>" +
"ORDER BY sort</script>")
@ResultMap(value = "ChildListResultMap")
......@@ -25,8 +29,12 @@ public interface BCourseRepository extends BaseMapper<BCourse> {
@ResultMap(value = "ChildListResultMap")
List<QueryCourseResDTO> queryCoursesByPid(String parentId);
@Select("SELECT * from b_course WHERE del_flag='0' AND flag='1'AND c_name=#{cName}")
List<BCourse> selectOneByName(@Param("cName") String id);
@Select("SELECT * from b_course WHERE del_flag='0' AND flag='1'" +
"and corp_id = #{corpId}" +
"AND c_name=#{cName}")
List<BCourse> selectOneByName(@Param("cName") String id, @Param("corpId") String corpId);
@Update("UPDATE b_course SET del_flag='1' WHERE business_id = #{businessId}")
int removeCourse(@Param("businessId") String id);
......@@ -34,18 +42,50 @@ public interface BCourseRepository extends BaseMapper<BCourse> {
@Update("UPDATE b_course SET c_name = #{cName} WHERE business_id = #{businessId}")
int updateCourse(BCourse bCourse);
@Select("select DISTINCT course_level from b_course where business_id =#{pid}")
int queryParentLevel(@Param("pid") String pid);
@Select("select DISTINCT course_level from b_course where business_id = #{pid} " +
"and corp_id = #{corpId}"
)
int queryParentLevel(@Param("pid") String pid, @Param("corpId") String corpId);
@Select("select * from b_course where course_level = 1 and del_flag != '1' and flag ='1' " +
"and corp_id = #{corpId}" +
@Select("select * from b_course where course_level = 1 and del_flag != '1' and flag ='1'")
"ORDER BY sort limit #{num}")
@ResultMap(value = "BaseResultMapDTO")
List<QueryCourseResDTO> queryFirstLevel();
List<QueryCourseResDTO> queryFirstLevel(@Param("corpId") String corpId,@Param("num") int num);
@Select("select DISTINCT IFNULL((" +
"select max(sort) from b_course where pid = #{pid} " +
"and corp_id = #{corpId}" +
"and del_flag = 0 and flag = 1),0)+1 as sort")
int getSort(@Param("pid") String pid,@Param("corpId") String corpId);
/**
* 查询所有分类存到List中
*
* @return
*/
@Select("select * from b_course where del_flag != '1' and flag ='1'")
@Select("select * from b_course where del_flag != '1' " +
"and corp_id = #{corpId} " +
"and flag ='1'")
@ResultMap(value = "AllCourseResultMap")
List<AllCourseDTO> findAllCourse();
List<AllCourseDTO> findAllCourse(@Param("corpId") String corpId);
@Update("<script>" +
"<foreach collection=\"map\" item=\"item\" separator=\";\">" +
"update b_course " +
"set " +
"pid = #{item.pid}, " +
"sort = #{item.sort}, " +
"course_level = #{item.courseLevel} " +
"where business_id = #{item.businessId} " +
"</foreach>" +
"</script>")
int sortCourser(@Param("map") List<BCourse> map);
}
......@@ -25,8 +25,7 @@ public class BCourse extends IdEntity<BCourse> {
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String pid;
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String sort;
private int sort;
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
private String courseLevel;
......
......@@ -10,7 +10,6 @@ import java.util.List;
public interface BCourseService {
// String getCourse(BCourse bCourse);
List<QueryCourseResDTO> queryBCourse(BCourse bCourse);
......@@ -22,11 +21,13 @@ public interface BCourseService {
PersistModel updateCourse(BCourse bCoursee);
PersistModel sortCourse(String json);
/**
* 查询所有分类放入List中
* @return
*/
List<AllCourseDTO> findAllCourse();
List<AllCourseDTO> findAllCourse(String corpId);
}
package org.rcisoft.business.bcourse.service.impl;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang.StringUtils;
import org.rcisoft.business.bcourse.dao.BCourseRepository;
import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.bcourse.dto.QueryCourseResDTO;
......@@ -14,10 +16,13 @@ import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static java.util.Arrays.asList;
@Service
public class BCourseServiceImpl implements BCourseService {
......@@ -31,6 +36,7 @@ public class BCourseServiceImpl implements BCourseService {
if (model.getCName() != null && !"".equals(model.getCName())) {
param.put("cName", model.getCName());
}
param.put("corpId", model.getCorpId());
return bCourseRepository.queryCourses(param);
}
......@@ -46,19 +52,31 @@ public class BCourseServiceImpl implements BCourseService {
@Override
public PersistModel insertCourse(BCourse bCourse) {
List<BCourse> list = bCourseRepository.selectOneByName(bCourse.getCName());
if(bCourse.getCName()==null||bCourse.getCName().equals("")){
throw new ServiceException(ResultServiceEnums.NAME_IS_NULL);
}
List<BCourse> list = bCourseRepository.selectOneByName(bCourse.getCName(),bCourse.getCorpId());
if (list.size() > 0) {
throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS);
}
if (bCourse.getPid() == null || "".equals(bCourse.getPid())) {
bCourse.setPid("00000000");
bCourse.setCourseLevel("1");
int sort = bCourseRepository.getSort(bCourse.getPid(),bCourse.getCorpId());
bCourse.setSort(sort);
} else if ("00000000".equals(bCourse.getPid())) {
bCourse.setCourseLevel("1");
} else if (bCourseRepository.queryParentLevel(bCourse.getPid()) == 1) {//通过getpid 获取上一级的level
int sort = bCourseRepository.getSort(bCourse.getPid(),bCourse.getCorpId());
bCourse.setSort(sort);
} else if (bCourseRepository.queryParentLevel(bCourse.getPid(),bCourse.getCorpId()) == 1) {//通过getpid 获取上一级的level
bCourse.setCourseLevel("2");
} else if (bCourseRepository.queryParentLevel(bCourse.getPid()) == 2) {
int sort = bCourseRepository.getSort(bCourse.getPid(),bCourse.getCorpId());
bCourse.setSort(sort);
} else if (bCourseRepository.queryParentLevel(bCourse.getPid(),bCourse.getCorpId()) == 2) {
bCourse.setCourseLevel("3");
int sort = bCourseRepository.getSort(bCourse.getPid(),bCourse.getCorpId());
bCourse.setSort(sort);
} else {
throw new ServiceException(ResultServiceEnums.COURSE_ERROR);
}
......@@ -74,7 +92,7 @@ public class BCourseServiceImpl implements BCourseService {
@Override
public PersistModel updateCourse(BCourse bCourse) {
List<BCourse> list = bCourseRepository.selectOneByName(bCourse.getCName());
List<BCourse> list = bCourseRepository.selectOneByName(bCourse.getCName(),bCourse.getCorpId());
if (list.size() > 0) {
throw new ServiceException(ResultServiceEnums.NAME_IS_EXISTS);
}
......@@ -83,8 +101,26 @@ public class BCourseServiceImpl implements BCourseService {
}
@Override
public List<AllCourseDTO> findAllCourse() {
return bCourseRepository.findAllCourse();
public PersistModel sortCourse(String json) {
Map<String,Object> maps = (Map) JSON.parse(json);
List<BCourse> bCourses = new ArrayList<>();
for (String obj : maps.keySet()) {
BCourse bCourse = new BCourse();
String value = maps.get(obj).toString();
bCourse.setBusinessId(obj.toString());
String[] split = StringUtils.split(value, ",");
bCourse.setPid(split[0]);
bCourse.setSort(Integer.parseInt(split[1]));
bCourse.setCourseLevel(split[2]);
bCourses.add(bCourse);
}
int line = bCourseRepository.sortCourser(bCourses);
return new PersistModel(line);
}
@Override
public List<AllCourseDTO> findAllCourse(String corpId) {
return bCourseRepository.findAllCourse(corpId);
}
}
......@@ -30,7 +30,7 @@ import java.util.List;
/**
* Created by on 2019-9-25 9:03:09.
*/
@Api(tags = "8 章节")
@Api(tags = "8 课程评论")
@RestController
@RequestMapping("bdiscuss")
public class BDiscussController extends PaginationController<BDiscuss> {
......
......@@ -52,5 +52,4 @@ public interface BDiscussService {
List<BDiscussDto> getDiscussByLessonId(String lessonId,String corpId);
}
......@@ -5,12 +5,16 @@ import java.io.File;
import it.sauronsoftware.jave.Encoder;
import it.sauronsoftware.jave.EncoderException;
import it.sauronsoftware.jave.MultimediaInfo;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.ResultCode;
import org.rcisoft.core.result.ResultExceptionEnum;
@Slf4j
public class GetVideoTime {
/**
* 获取视频的时长
* @param path
* @return
*/
public String getVideoDuration(String path) {
// get file in specified "path"
File file = new File(path);
......@@ -39,6 +43,6 @@ public class GetVideoTime {
String filePath = "E:\\迅雷下载\\CHS.mp4";
GetVideoTime getVideoTime = new GetVideoTime();
System.out.println( getVideoTime.getVideoDuration(filePath));
log.info( getVideoTime.getVideoDuration(filePath));
}
}
\ No newline at end of file
......@@ -168,7 +168,7 @@ public class BLessonController extends PaginationController<BLesson> {
public Result queryHomeBLessonsByPagination(CurUser curUser, @Valid FirstPageQueryDTO firstPageQueryDTO, BindingResult bindingResult) {
List<AllCourseDTO> allCourse = null;
if (StringUtils.isNotEmpty(firstPageQueryDTO.getCourseLevelOne())){
allCourse = bCourseService.findAllCourse();
allCourse = bCourseService.findAllCourse(curUser.getCorpId());
}
bLessonService.queryHomeBLessonsByPagination(getPaginationUtility(),firstPageQueryDTO,allCourse);
GridModel gridModel = getGridModelResponse();
......
......@@ -204,7 +204,9 @@ public enum ResultServiceEnums {
EDU_CLASS_HAS_USED(108,"此教学班已开课,不可删除"),
COURSE_ERROR(109,"三级分类不允许添加子分类")
COURSE_ERROR(109,"三级分类不允许添加子分类"),
NAME_IS_NULL(110,"名称为空")
;
private Integer code;
......
......@@ -24,8 +24,8 @@ import java.util.List;
/**
* Created by lcy on 16/7/30.
*/
@RestController
@RequestMapping("/dept")
//@RestController
//@RequestMapping("/dept")
public class SysDeptController extends ResponseController {
@Autowired
......
package org.rcisoft.sys.excel;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.common.component.Global;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
/**
* Created by gaowenfeng on 2017/8/2.
*/
@RestController
@RequestMapping("/excelUtil")
public class ExcelDownloadController {
private static final String STUDNET_FILE_NAME = "student.xls";
private static final String TEACHER_FILE_NAME = "teacher.xls";
private static final String CLASS_FILE_NAME = "class.xls";
private static final String STUDENT_CLASS_FILE_NAME = "student-class.xls";
private static final String STUDNET_SL_FILE_NAME = "student-sl.xls";
private static final String LESSON_FILE_NAME = "lesson.xls";
private static final String SL_FILE_NAME = "sl.xls";
private static final String ROOM_FILE_NAME = "room.xls";
private static final String BUSINESS_CLASS = "business-class.xls";
private static final String IMPORT_DTO = "schedule-task.xls";
@Autowired
private Global global;
@ApiOperation(value="下载excel模板", notes="下载excel模板")
@ApiImplicitParam(name = "type", value = "模板类型", required = false, dataType = "varchar")
@GetMapping("excelWithoutAuth")
public void excelDownLoad(HttpServletRequest request,
HttpServletResponse response,
@RequestParam("type") String type)
throws Exception {
InputStream in = null;
OutputStream out = null;
//File file = getDownLoadFile(type);
String name = getDownLoadFile(type);
in = getClass().getClassLoader().getResourceAsStream(global.getEXCEL_TEMPLATE_LOCATION()+name);
/*if (file == null)
throw new ServiceException(ResultServiceEnums.TEMPLAGE_NOT_EXISTS);
in = new BufferedInputStream(new FileInputStream(file));*/
out = new BufferedOutputStream(response.getOutputStream());
response.setContentType("application/octet-stream");
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(name, "UTF-8"));//如果输出的是中文名的文件,在此处就要用URLEncoder.encode方法进行处理
byte[] buffer = new byte[in.available()];
in.read(buffer);
out.write(buffer);
}
@GetMapping("excel")
public void excel(HttpServletRequest request,
HttpServletResponse response,
@RequestParam("type") String type)
throws Exception {
excelDownLoad(request,response,type);
}
private String getDownLoadFile(String type) throws Exception {
String name = "";
switch (type) {
case "1":
name = STUDNET_FILE_NAME;
break;
case "2":
name = TEACHER_FILE_NAME;
break;
case "3":
name = CLASS_FILE_NAME;
break;
case "4":
name = STUDENT_CLASS_FILE_NAME;
break;
case "5":
name = STUDNET_SL_FILE_NAME;
break;
case "6":
name = LESSON_FILE_NAME;
break;
case "7":
name = SL_FILE_NAME;
break;
case "8":
name = ROOM_FILE_NAME;
break;
case "9":
name = BUSINESS_CLASS;
break;
case "10":
name = IMPORT_DTO;
break;
}
return name;
}
}
package org.rcisoft.sys.role.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
......@@ -24,6 +25,7 @@ import java.util.List;
/**
* Created by lcy on 16/7/30.
*/
@Api(tags = "10 用户角色")
@RestController
@RequestMapping("/role")
public class SysRoleController extends PaginationController<SysRole> {
......@@ -32,7 +34,7 @@ public class SysRoleController extends PaginationController<SysRole> {
private SysRoleService sysRoleServiceImpl;
@ApiOperation(value="分页查询角色", notes="分页查询角色")
@ApiOperation(value="1001 分页查询角色", notes="分页查询角色")
@GetMapping(value = "/queryRoles")
public GridModel queryRolesByPagination(CurUser curUser, @Valid FindRolePaginDTO findRolePaginDTO, BindingResult bindingResult){
sysRoleServiceImpl.queryRolesByPagination(getPaginationUtility(), findRolePaginDTO);
......@@ -40,20 +42,17 @@ public class SysRoleController extends PaginationController<SysRole> {
return gridModel;
}
@ApiOperation(value="查询全部角色", notes="查询全部角色")
@ApiOperation(value="1002 查询全部角色", notes="查询全部角色")
@GetMapping(value = "/queryRolesAll")
public Result queryRolesAll(CurUser curUser, @Valid FindRolePaginDTO findRolePaginDTO, BindingResult bindingResult){
sysRoleServiceImpl.queryRolesAll(findRolePaginDTO);
GridModel gridModel = getGridModelResponse();
// return gridModel;
public Result queryRolesAll(CurUser curUser){
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
sysRoleServiceImpl.queryRolesAll(findRolePaginDTO));
sysRoleServiceImpl.queryRolesAll());
}
@ApiOperation(value="增加/修改角色", notes="增加/修改角色")
@ApiOperation(value="1003 增加/修改角色", notes="增加/修改角色")
@PostMapping(value = "/add")
public Result roleAdd(CurUser curUser, @Valid AddOrUpdateRoleDTO addOrUpdateRoleDTO, BindingResult bindingResult){
int line = sysRoleServiceImpl.persistRole(addOrUpdateRoleDTO);
......@@ -64,7 +63,7 @@ public class SysRoleController extends PaginationController<SysRole> {
}
@ApiOperation(value="删除角色", notes="删除角色")
@ApiOperation(value="1004 删除角色", notes="删除角色")
@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar", paramType = "path")
@PostMapping(value = "/delete")
public Result roleDelete(CurUser curUser, String businessId, BindingResult bindingResult){
......
......@@ -23,38 +23,39 @@ import java.util.Map;
public interface SysRoleRepository extends BaseMapper<SysRole> {
/**
* 分页查询 roles
* @param sysRole
*
* @param
* @return
*/
@Select("<script>select * from s_role where flag = '1' and del_flag = '0' "
+ " <if test=\"code !=null and code != ''\">and code = #{code} </if> "
+ " <if test=\"roleName !=null and roleName != ''\">and role_name = #{roleName} </if> "
+" and code NOT in ('ROLE_1001','ROLE_1002','ROLE_1003')"
+ " order by create_date desc"
+ "</script>")
@ResultMap(value = "SelectAllAndUserNum" )
List<SysRole> queryRoles(SysRole sysRole);
@Select("<script>select * from s_role where flag = '1' and del_flag = '0' " +
"AND role_name not in('主管理员','子管理员')" +
" order by create_date desc" +
"</script>")
@ResultMap(value = "SelectAllAndUserNum")
List<SysRole> queryRoles();
//获得此角色的用户数
int countUserNum(String roleId);
@Select("<script>select * from s_role where "
+ "DEL_FLAG='0' "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
+ "DEL_FLAG='0' "
+ "</script>")
@ResultMap(value = "BaseResultMap")
List<SysRole> queryRolesSelect(SysRole sysRole);
/**
* 根据角色id 删除对应权限
*
* @param roleId
* @return
*/
@Delete("<script>delete from s_role_menu where role_id = #{roleId}</script>")
int deleteRoleMenus(@Param("roleId") String roleId);
/**
* 根据角色id 删除对应部门
*
* @param roleId
* @return
*/
......@@ -63,38 +64,43 @@ public interface SysRoleRepository extends BaseMapper<SysRole> {
/**
* 批量插入 角色_权限
*
* @param menuRole
* @return
*/
int insertBatchRoleMenu(List<Map> menuRole);
/**
* 批量插入 角色_部门
* @param deptRole
*
* @param deptRole
* @return
*/
int insertBatchRoleDept(List<Map> deptRole);
/**
* 分页查询 roles
*
* @param sysRole
* @return
*/
@Select(" <script>select "
+ " dr.BUSINESS_ID drid,r.BUSINESS_ID rid,r.name rname,r.code rcode,d.BUSINESS_ID did,d.name dname,d.dept_code deptcode, "
+ " IF(( "
+ " SELECT count(*) from s_dept_role_user dru where dru.USER_ID=#{userId} "
+ " and dru.DEPT_ROLE_ID=dr.BUSINESS_ID"
+ " )>0,'1','0') as checked "
+ " FROM s_dept_role dr "
+ " LEFT JOIN s_dept d ON d.BUSINESS_ID = dr.DEPT_ID "
+ " LEFT JOIN s_role r on dr.ROLE_ID = r.BUSINESS_ID</script>")
@ResultMap(value = "drResultMap" )
List<DeptRole> queryUserRolesByPagination(@Param("userId") String userId, SysRole sysRole) ;
+ " dr.BUSINESS_ID drid,r.BUSINESS_ID rid,r.name rname,r.code rcode,d.BUSINESS_ID did,d.name dname,d.dept_code deptcode, "
+ " IF(( "
+ " SELECT count(*) from s_dept_role_user dru where dru.USER_ID=#{userId} "
+ " and dru.DEPT_ROLE_ID=dr.BUSINESS_ID"
+ " )>0,'1','0') as checked "
+ " FROM s_dept_role dr "
+ " LEFT JOIN s_dept d ON d.BUSINESS_ID = dr.DEPT_ID "
+ " LEFT JOIN s_role r on dr.ROLE_ID = r.BUSINESS_ID</script>")
@ResultMap(value = "drResultMap")
List<DeptRole> queryUserRolesByPagination(@Param("userId") String userId, SysRole sysRole);
/**
* 分页查询 roles
*
* @param sysRole
* @return
*/
......@@ -124,18 +130,19 @@ public interface SysRoleRepository extends BaseMapper<SysRole> {
" s_role sysRole " +
"WHERE " +
" DEL_FLAG = '0' and FLAG = '1'</script>")
@ResultMap(value = "BaseResultMap" )
@ResultMap(value = "BaseResultMap")
List<SysRole> queryDeptRolesByPagination(@Param("deptId") String deptId, SysRole sysRole);
@Delete("<script>DELETE from s_dept_role_user where DEPT_ROLE_ID="
+ "("
+ "SELECT BUSINESS_ID from s_dept_role where ROLE_ID=#{roleId}"
+ ")</script>")
+ "("
+ "SELECT BUSINESS_ID from s_dept_role where ROLE_ID=#{roleId}"
+ ")</script>")
int deleteDeptRoleUserByroleId(@Param("roleId") String roleId);
/**
* 删除岗位
* @param roleId
*
* @param roleId
* @return
*/
@Delete("<script>DELETE from s_dept_role where ROLE_ID=#{roleId}</script>")
......@@ -143,6 +150,7 @@ public interface SysRoleRepository extends BaseMapper<SysRole> {
/**
* 删除权限
*
* @param roleId
* @return
*/
......@@ -180,7 +188,7 @@ public interface SysRoleRepository extends BaseMapper<SysRole> {
@Select("<script>select * from s_role where flag = '1' and del_flag = '0' "
+ "and (code = #{code} or role_name = #{roleName}) "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
@ResultMap(value = "BaseResultMap")
List<SysRole> queryRolesByCodeOrName(SysRole sysRole);
@Delete("<script>DELETE from s_r_user_role where role_id=#{id}</script>")
......@@ -189,7 +197,7 @@ public interface SysRoleRepository extends BaseMapper<SysRole> {
@Select("<script>select * from s_role where flag = '1' and del_flag = '0' "
+ "and role_name = #{roleName}"
+ "</script>")
@ResultMap(value = "BaseResultMap" )
@ResultMap(value = "BaseResultMap")
List<SysRole> queryRolesByName(SysRole sysRole);
// @Select("SELECT COUNT(*) FROM s_menu sm \n" +
......@@ -206,6 +214,7 @@ public interface SysRoleRepository extends BaseMapper<SysRole> {
/**
* 根据子表id 删除 s_r_user_role
*
* @param tableByKey
* @param businessId
* @return
......@@ -229,5 +238,5 @@ public interface SysRoleRepository extends BaseMapper<SysRole> {
"\t\t\t\t\t${tb}.business_id = #{cid}\n" +
"\t\t\t) ab\n" +
"\t)")
int deleteUserRoleByChildrenId(@Param("tb") String tableByKey,@Param("cid") String businessId);
int deleteUserRoleByChildrenId(@Param("tb") String tableByKey, @Param("cid") String businessId);
}
......@@ -44,7 +44,7 @@ public interface SysRoleService {
List<SysRole> queryRolesByPagination(PageUtil pageUtil, FindRolePaginDTO findRolePaginDTO);
List<SysRole> queryRolesAll(FindRolePaginDTO findRolePaginDTO);
List<SysRole> queryRolesAll();
//select
List<SysRole> queryRolesSelect(SysRole sysRole);
......
......@@ -85,20 +85,20 @@ public class SysRoleServiceImpl implements SysRoleService {
@Override
public List<SysRole> queryRolesByPagination(PageUtil pageUtil, FindRolePaginDTO findRolePaginDTO) {
SysRole sysRole = new SysRole();
BeanUtils.copyProperties(findRolePaginDTO,sysRole);
sysRole.setNotDeleted();
sysRole.setStart();
return sysRoleRepository.queryRoles(sysRole);
// SysRole sysRole = new SysRole();
// BeanUtils.copyProperties(findRolePaginDTO,sysRole);
// sysRole.setNotDeleted();
// sysRole.setStart();
return sysRoleRepository.queryRoles();
}
@Override
public List<SysRole> queryRolesAll(FindRolePaginDTO findRolePaginDTO) {
SysRole sysRole = new SysRole();
BeanUtils.copyProperties(findRolePaginDTO,sysRole);
sysRole.setNotDeleted();
sysRole.setStart();
return sysRoleRepository.queryRoles(sysRole);
public List<SysRole> queryRolesAll() {
// SysRole sysRole = new SysRole();
// BeanUtils.copyProperties(findRolePaginDTO,sysRole);
// sysRole.setNotDeleted();
// sysRole.setStart();
return sysRoleRepository.queryRoles();
}
@Override
......
......@@ -14,10 +14,11 @@ server:
druid:
# url: jdbc:mysql://127.0.0.1:3306/edu_db0917?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://127.0.0.1:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://10.96.131.16:55558/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
#url: jdbc:mysql://120.52.179.75:13318/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username: root
password: root
password: 91isoft
# password: root
initial-size: 1
min-idle: 1
max-active: 20
......
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