Commit 8bfce930 authored by luzhuang's avatar luzhuang

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

parents 52ecb146 3c28d038
......@@ -227,6 +227,15 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@ResultMap(value = "BaseResultMap")
List<BLessonPerson> selectByPersonAndLesson(AddMyLearnLessonDTO param);
/**
* 根据课程id PersonId查询(包括已删除,停用的)
*/
@Select("<script>select * from b_lesson_person where 1=1 " +
"AND person_id = #{userId} " +
"and lesson_id = #{lessonId}</script>")
@ResultMap(value = "BaseResultMap")
List<BLessonPerson> selectRealByPersonAndLesson(AddMyLearnLessonDTO param);
@Insert("<script>" +
" insert into b_lesson_person(" +
......
......@@ -964,10 +964,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@Select("<script>select bl.*, " +
" blp.is_apply isApply,blp.is_appoint isAppoint,blp.train_is_sign trainIsSign,blp.sign_date signDate , blp.is_collect isCollect, " +
" 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 " +
" left join s_user su on bl.lecturer_id = su.business_id " +
" left join b_course bc on bc.business_id = bl.course_id " +
" where 1=1 " +
"and blp.del_flag = 0 and blp.flag = 1 " +
"and bl.del_flag = 0 and bl.flag = 1 " +
......@@ -975,10 +976,11 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@ResultMap(value = "TrainBaseResultMap")
BLesson findOneMyTrain(@Param("curUser") CurUser curUser, @Param("businessId") String businessId);
@Select("<script>select bl.*, " +
@Select("<script>select bl.*,bc.c_name courseName, " +
" su.name lecturerName " +
" from b_lesson bl " +
" left join s_user su on bl.lecturer_id = su.business_id " +
" left join b_course bc on bc.business_id = bl.course_id " +
" where 1=1 " +
"and bl.del_flag = 0 and bl.flag = 1 " +
"and bl.business_id = #{lessonId} </script>")
......
......@@ -2,9 +2,11 @@ package org.rcisoft.business.blesson.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.blesson.dao.BAppointRepository;
import org.rcisoft.business.blesson.dao.BHotRepository;
import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.entity.BAppoint;
import org.rcisoft.business.blesson.entity.BHot;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.dao.BLessonPersonRepository;
import org.rcisoft.business.blesson.entity.BLessonPerson;
......@@ -17,6 +19,7 @@ import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultExceptionEnum;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -44,6 +47,9 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
@Autowired
private BAppointRepository bAppointRepository;
@Autowired
private BHotRepository bHotRepository;
@Autowired
MTCotactApiRequestClient mtCotactApiRequestClient;
......@@ -167,18 +173,36 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
line = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPerson);
//课程在学人数+1
bLessonRepository.personNumberReCount(addMyLearnLessonDTO.getLessonId());
}else if (bLessonPersons == null || bLessonPersons.size() < 1){ //未指派
return new PersistModel(line);
}
if (bLessonPersons == null || bLessonPersons.size() < 1){ //未指派
//查询是否已有已删除
List<BLessonPerson> bLessonPersonReals = bLessonPersonRepository.selectRealByPersonAndLesson(addMyLearnLessonDTO);
if (bLessonPersonReals != null && bLessonPersonReals.size()>0){
BLessonPerson bLessonPersonReal = bLessonPersonReals.get(0);
bLessonPersonReal.setFlag("1");
bLessonPersonReal.setDelFlag("0");
UserUtil.setCurrentMergeOperation(bLessonPersonReal);
line = bLessonPersonRepository.updateByPrimaryKeySelective(bLessonPersonReal);
return new PersistModel(line);
}
bLessonPerson = new BLessonPerson();
bLessonPerson.initModel();
bLessonPerson.setIsFinish("1");
bLessonPerson.setLessonId(addMyLearnLessonDTO.getLessonId());
bLessonPerson.setPersonId(addMyLearnLessonDTO.getUserId());
line = bLessonPersonRepository.insertBLessonPerson(bLessonPerson);
//课程在学人数+1
//重新统计在学人数
bLessonRepository.personNumberReCount(addMyLearnLessonDTO.getLessonId());
}else if (bLessonPersons != null && bLessonPersons.size()>0){
line = 1;
return new PersistModel(line);
}
return new PersistModel(line);
// if (bLessonPersons != null && bLessonPersons.size()>0){
// line = 1;
// return new PersistModel(line);
// }
//添加至b_hot表 并重新同级热度
bHotRepository.insertSelective(new BHot(IdGen.uuid(),addMyLearnLessonDTO.getUserId(),addMyLearnLessonDTO.getLessonId()));
bLessonRepository.hotNumberReCount(addMyLearnLessonDTO.getLessonId());
return new PersistModel(1);
}
}
......@@ -121,10 +121,10 @@ public class BLessonServiceImpl implements BLessonService {
}
//客户端 手机端 每次点击插入热度表 并重新统计课程热度
if ("1".equals(bLesson.getIsCollect())){
bHotRepository.insertSelective(new BHot(IdGen.uuid(),curUser.getUserId(),bLesson.getBusinessId()));
bLessonRepository.hotNumberReCount(bLesson.getBusinessId());
}
// if ("1".equals(bLesson.getIsCollect())){
bHotRepository.insertSelective(new BHot(IdGen.uuid(),curUser.getUserId(),bLesson.getBusinessId()));
bLessonRepository.hotNumberReCount(bLesson.getBusinessId());
// }
return bLesson;
}
......@@ -248,10 +248,9 @@ public class BLessonServiceImpl implements BLessonService {
// BMaterial bMaterial = new BMaterial();
// }
int line = 0;
if (model.getBusinessId() == null) {
if (StringUtils.isEmpty(model.getBusinessId())) {
if (StringUtils.isEmpty(model.getLessonType())) {
throw new ServiceException(ResultServiceEnums.MUST_NOT_FILLED);
}
......@@ -320,7 +319,6 @@ public class BLessonServiceImpl implements BLessonService {
bViewrangeRepository.insertBViewrangeSons(bViewrangeSons);
}
bLessonRepository.removeLabelByLessonId(model);
//删除原标签添,加课程标签表
if (StringUtils.isNotEmpty(model.getLabels())) {
......@@ -328,10 +326,8 @@ public class BLessonServiceImpl implements BLessonService {
List<BLessonLabel> bLessonLabels = addLabel(model);
bLessonRepository.insertLessonLabel(bLessonLabels);
}
//删除原有文件
bTrainFileRepository.deleteByLessonId(model.getBusinessId());
}
//转换json
if (StringUtils.isNotEmpty(addLessonDTO.getTrainFileJson())){
......@@ -388,9 +384,6 @@ public class BLessonServiceImpl implements BLessonService {
}
//更新
//获取
}
return new PersistModel(line, model);
}
......@@ -956,9 +949,9 @@ public class BLessonServiceImpl implements BLessonService {
}
int collectCount = bCollectRepository.selectCountbyLessonAndUser(curUser,bLesson.getBusinessId());
if (collectCount>0){
bLesson.setIsApply("1");
bLesson.setIsCollect("1");
}else {
bLesson.setIsApply("0");
bLesson.setIsCollect("0");
}
return bLesson;
}
......@@ -976,6 +969,12 @@ public class BLessonServiceImpl implements BLessonService {
}else {
bLesson.setApplyIsFull("0");
}
int collectCount = bCollectRepository.selectCountbyLessonAndUser(curUser,bLesson.getBusinessId());
if (collectCount>0){
bLesson.setIsCollect("1");
}else {
bLesson.setIsCollect("0");
}
return bLesson;
}
......
......@@ -511,6 +511,7 @@ public class MTCotactApiRequestClient {
return new ArrayList<>();
}
GetUserByDeptIdReqDTO getUserByDeptIdReqDTO = new GetUserByDeptIdReqDTO();
getUserByDeptIdReqDTO.setCorpId(Long.parseLong(corpId));
List<Long> deptIdList = new ArrayList<>();
for (String deptId : deptIdSet) {
deptIdList.add(Long.parseLong(deptId));
......
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