Commit 57414d8b authored by zhangqingle's avatar zhangqingle

修改接口

parent 27b0428d
......@@ -59,10 +59,10 @@ public class BBanner extends IdEntity<BBanner> {
private Integer bannerSort;
@ApiModelProperty(value = "课程名")
// @Transient
@Transient
private String lessonName;
@ApiModelProperty(value = "课程")
// @Transient
@ApiModelProperty(value = "课程封面")
@Transient
private String lessonDefaultUrl;
}
\ No newline at end of file
......@@ -614,4 +614,23 @@ public class BLessonController extends PaginationController<BLesson> {
curUser.getUserId());
}
/**
* @param
* @return
* @author: zhangqingle
*/
@ApiOperation(value="637 分页查询我我关注", notes="分页查询我我关注", response = BLessonPerson.class)
@ApiImplicitParam(name = "lessonType", value = "课程类型 0 课程 1培训", required = false, dataType = "varchar")
@GetMapping(value = "/queryCollectByPagination")
public Result queryCollectByPagination(CurUser curUser, @Valid String lessonType, BindingResult bindingResult) {
bLessonService.queryCollectByPagination(getPaginationUtility(), lessonType, curUser);
GridModel gridModel = getGridModelResponse();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
gridModel);
}
}
......@@ -41,6 +41,7 @@ public interface BCollectRepository extends BaseMapper<BCollect> {
@ResultMap(value = "BaseResultMap")
List<BCollect> selectByPersonAndLesson(AddMyLearnLessonDTO param);
/**
* 查询关系表中是否已存在此关系
* @param personId
......
......@@ -290,6 +290,21 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@Select("select count(0) x ,(select max_apply_person from b_lesson where business_id = #{lessonId} ) y " +
"from b_lesson_person where lesson_id = #{lessonId} ")
Map<String,Object> selecTraningNum(@Param("lessonId") String lessonId);
@Update({"<script>",
"update b_lesson_person",
" <set>",
" train_is_sign = 1 ",
" </set>",
"where 1=1 ",
"<if test=\"lessonId!=null and lessonId != ''\">",
" and lesson_id in ",
" <foreach item='item' collection='lessonIds' open='(' separator=',' close=')'> #{item} </foreach> " ,
"</if>" ,
"and train_is_sign != 2 ",
"</script>"})
int selectByLessonIds(@Param("lessonId") List<String> lessonIds);
}
......@@ -4,14 +4,12 @@ import org.apache.ibatis.annotations.*;
import org.rcisoft.business.bchapter.entity.BChapter;
import org.rcisoft.business.blabel.dto.QueryLabelResDTO;
import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.entity.BLessonLabel;
import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.business.blesson.entity.BRecommend;
import org.rcisoft.business.blesson.entity.*;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
import java.util.Set;
......@@ -168,7 +166,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 AND lesson_id IS NOT NULL ))) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'ZXRS') + 0 " + //ZXRS 在学人数
" and bl.person_number >= (select `value` from b_dictionary where type = 'ZXRS') + 0 " + //ZXRS 在学人数
" order by bl.person_number,bl.release_date desc " +
"</script>")
@ResultMap(value = "BaseResultMap")
......@@ -256,7 +254,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" <foreach item='item' index='index' collection='departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 AND lesson_id IS NOT NULL ))) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'GZRS') + 0 " + //ZXRS 关注人数
" and bl.person_number >= (select `value` from b_dictionary where type = 'GZRS') + 0 " + //GZRS 关注人数
" order by bl.collect_number,bl.release_date desc " +
"</script>")
@ResultMap(value = "BaseResultMap")
......@@ -780,7 +778,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 AND lesson_id IS NOT NULL ))) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'ZXRS') + 0 " + //ZXRS 在学人数
" and bl.person_number >= (select `value` from b_dictionary where type = 'ZXRS') + 0 " + //ZXRS 在学人数
" <if test= \" model.viewParam !=null and model.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{model.viewParam},'%') " +
" or su.name like CONCAT('%',#{model.viewParam},'%'))</if> " +
" <if test= \" model.courseIds !=null and model.courseIds.size() > 0 \">and course_id in " +
......@@ -831,7 +829,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" <foreach item='item' index='index' collection='model.departs' open='(' separator=',' close=')'> #{item} </foreach>)" +
" </if> " +
" or (bl.business_id not in (select lesson_id from b_viewrange where del_flag != 1 and flag = 1 AND lesson_id IS NOT NULL ))) " +
" and bl.person_number > (select `value` from b_dictionary where type = 'GZRS') + 0 " + //ZXRS 关注人数
" and bl.person_number >= (select `value` from b_dictionary where type = 'GZRS') + 0 " + //GZRS 关注人数
" <if test= \" model.viewParam !=null and model.viewParam != ''\">and (bl.lesson_name like CONCAT('%',#{model.viewParam},'%') " +
" or su.name like CONCAT('%',#{model.viewParam},'%'))</if> " +
" <if test= \" model.courseIds !=null and model.courseIds.size() > 0 \">and course_id in " +
......@@ -963,7 +961,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
List<BRecommend> queryRecommendByLessonId(@Param("corpId") String corpId, @Param("lessonId")String lessonId);
@Select("<script>select bl.*, " +
@Select("<script>select bl.*, blp.business_id lessonPersonId," +
" blp.is_apply isApply,blp.is_appoint isAppoint,blp.train_is_sign trainIsSign,blp.sign_date signDate , blp.is_collect isCollect,bc.c_name courseName, " +
" su.name lecturerName " +
" from b_lesson bl left join b_lesson_person blp on bl.business_id = blp.lesson_id " +
......@@ -996,5 +994,30 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"</script>")
int trainApplyCount(String lessonId);
/**
* 分页查询我收藏
*/
@Select("<script>select * from b_lesson bl " +
"left join b_collect bc on bl.business_id = bc.lesson_id " +
"where 1=1 " +
"and bl.del_flag = 0 and bl.flag = 1 " +
"and bl.corp_id = #{curUser.corpId} " +
" <if test=\"lessonType!=null and lessonType != ''\">and bl.lesson_type = #{lessonType}</if>" +
"AND bc.person_id = #{curUser.userId} </script>")
@ResultMap(value = "BaseResultMap")
List<BLesson> selectMyCollect(@Param("lessonType") String lessonType, @Param("curUser")CurUser curUser);
/**
* 查询所有
*/
@Select("<script>select business_id from b_lesson " +
"where 1=1 " +
"and del_flag = 0 and flag = 1 " +
"and lesson_type = 1 " +
"AND #{nowDate} between SUBDATE(train_start_date,interval #{sec} second) and train_start_date </script>")
@ResultMap(value = "BaseResultMap")
List<String> selectByTrainStartBeforeNow(@Param("nowDate")Date newDate ,@Param("sec")String sec);
}
......@@ -274,4 +274,12 @@ public interface BLessonService{
*/
List<SysUser> findAppointPerson(CurUser curUser, String lessonId);
/**
*分页查询我收藏
* @param lessonType
* @param curUser
* @return
*/
List<BLesson> queryCollectByPagination(PageUtil pageUtil, String lessonType , CurUser curUser);
}
......@@ -135,10 +135,10 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
if (designatedIdRes.length() > 0) {
designatedIdRes = designatedIdRes.substring(0, designatedIdRes.length() - 1);
}
//更新b_appoint表
UserUtil.setCurrentMergeOperation(bAppoint);
bAppoint.setDesignatedId(designatedIdRes);
bAppointRepository.updateByPrimaryKeySelective(bAppoint);
//删除b_appoint表
// UserUtil.setCurrentMergeOperation(bAppoint);
// bAppoint.setDesignatedId(designatedIdRes);
bAppointRepository.deleteByPrimaryKey(bAppoint);
//查询是否在学习
String isFinish = bLessonPersonRepository.selectIsFinish(cancelAppointDTO);
int result = 0;
......
......@@ -420,8 +420,12 @@ public class BLessonServiceImpl implements BLessonService {
// if(bSlRepository.isUse(id) > 0){
// throw new ServiceException(ResultServiceEnums.LESSON_HAS_SL);
// }
BLesson bLesson = new BLesson();
bLesson.setBusinessId(id);
BLesson bl = new BLesson();
bl.setBusinessId(id);
BLesson bLesson = bLessonRepository.selectByPrimaryKey(bl);
if (bLesson == null){
throw new ServiceException(ResultServiceEnums.NOT_LESSON_ERROR);
}
bLesson.setDeleted();
UserUtil.setCurrentMergeOperation(bLesson);
int line = bLessonRepository.logicalDelete(bLesson);
......@@ -588,9 +592,9 @@ public class BLessonServiceImpl implements BLessonService {
}
//-------------
if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson()) && StringUtils.isEmpty(appointLessonDTO.getAppointDepart())) {
throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
}
// if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson()) && StringUtils.isEmpty(appointLessonDTO.getAppointDepart())) {
// throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
// }
//按课程查询指派表是否为空
List<BAppoint> bAppoints = bAppointRepository.selectByLessonId(appointLessonDTO.getLessonId());
//将指派人截取放入List中
......@@ -637,6 +641,9 @@ public class BLessonServiceImpl implements BLessonService {
UserUtil.setCurrentMergeOperation(bLessonPerson);
bLessonPersonRepository.cancelAppointByPersons(bLessonPerson);
}
if (userIds == null || userIds.size() < 1){
return new PersistModel(bAppointRepository.deleteByPrimaryKey(bAppoint), MessageConstant.MESSAGE_ALERT_SUCCESS);
}
//插入b_lesson_person表
appointLessonDTO.setAppointPersonList(userIdSet);
//查询已学该课程的学习business_id
......@@ -1044,9 +1051,17 @@ public class BLessonServiceImpl implements BLessonService {
}
BAppoint bAppoint = bAppoints.get(0);
List<String> ids = asList(org.apache.commons.lang.StringUtils.split(bAppoint.getDesignatedId(), ","));
if (ids == null || ids.size() < 1) {
return new ArrayList<>();
}
return sysUserMapper.selectByIds(ids);
}
@Override
public List<BLesson> queryCollectByPagination(PageUtil pageUtil, String lessonType, CurUser curUser) {
return bLessonRepository.selectMyCollect(lessonType, curUser);
}
//遍历标签放入List中
List<BLessonLabel> addLabel(BLesson model) {
//标签集合
......
......@@ -57,20 +57,20 @@ public class BMaterialController extends PaginationController<BMaterial> {
gridModel);
}
@ApiOperation(value="1303逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")})
@DeleteMapping("/delete")
public Result delete(CurUser curUser,@Valid String businessId, BindingResult bindingResult) {
BMaterial bMaterial = new BMaterial();
bMaterial.setBusinessId(businessId);
PersistModel data = bMaterialServiceImpl.remove(bMaterial);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
businessId);
}
// @ApiOperation(value="1303逻辑删除", notes="逻辑删除")
// @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")})
// @DeleteMapping("/delete")
// public Result delete(CurUser curUser,@Valid String businessId, BindingResult bindingResult) {
// BMaterial bMaterial = new BMaterial();
// bMaterial.setBusinessId(businessId);
// PersistModel data = bMaterialServiceImpl.remove(bMaterial);
// return Result.builder(data,
// MessageConstant.MESSAGE_ALERT_SUCCESS,
// MessageConstant.MESSAGE_ALERT_ERROR,
// businessId);
// }
@ApiOperation(value="1304批量删除", notes="批量删除")
@ApiOperation(value="1303批量删除", notes="批量删除")
@ApiImplicitParams({@ApiImplicitParam(name = "ids", value = "删除business 用逗号隔开", required = false, dataType = "varchar")})
@DeleteMapping("/deleteMore")
public Result deleteMore(CurUser curUser,@Valid String ids, BindingResult bindingResult) {
......
package org.rcisoft.config;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.blesson.dao.BLessonPersonRepository;
import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.validation.Valid;
import java.util.Date;
import java.util.List;
@Configuration
@ConditionalOnProperty(
prefix = "eduJob",
name = {"trainBegin"},
havingValue = "true"
)
@Component
@Slf4j
public class TrainSignConfig {
@Autowired
BLessonPersonRepository bLessonPersonRepository;
@Autowired
BLessonRepository bLessonRepository;
@Value("${eduJob.sec}")
private String sec;
@Scheduled(cron = "${eduJob.taskInterval}")
public void trainBegin() {
log.debug("--------------正在将未签到的人员置为缺勤------------");
Date newDate = new Date();
List<String> lessonIds = bLessonRepository.selectByTrainStartBeforeNow(newDate,sec);
if (lessonIds != null && lessonIds.size() > 0){
bLessonPersonRepository.selectByLessonIds(lessonIds);
}
}
}
......@@ -92,6 +92,11 @@ global:
is_server_linux: 5
cut_pdf_num: 30
eduJob:
taskInterval: 0 0/5 * * * ?
trainBegin: flase
sec: 300 #培训开始前 多少秒 之内的报名人员设置为缺勤
libreoffice:
ip: mt_libre
port: 8997
......
......@@ -85,6 +85,11 @@ global:
is_server_linux: 5
cut_pdf_num: 30
eduJob:
taskInterval: 0 0/5 * * * ?
trainBegin: flase
sec: 300 #培训开始前 多少秒 之内的报名人员设置为缺勤
libreoffice:
ip: 192.168.1.125
port: 8997
......
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