Commit 91cf2b29 authored by zhangqingle's avatar zhangqingle

修改接口

parent 3d3f8865
...@@ -18,6 +18,7 @@ import org.rcisoft.business.bchapter.service.BChapterService; ...@@ -18,6 +18,7 @@ import org.rcisoft.business.bchapter.service.BChapterService;
import org.rcisoft.business.bchapter.vo.StudentChapterScoreVO; import org.rcisoft.business.bchapter.vo.StudentChapterScoreVO;
import org.rcisoft.business.bfile.dto.uploadDTO; import org.rcisoft.business.bfile.dto.uploadDTO;
import org.rcisoft.business.bfile.util.GetVideoTime; import org.rcisoft.business.bfile.util.GetVideoTime;
import org.rcisoft.business.blesson.dao.BCollectRepository;
import org.rcisoft.business.blesson.dao.BLessonPersonRepository; import org.rcisoft.business.blesson.dao.BLessonPersonRepository;
import org.rcisoft.business.blesson.dao.BLessonRepository; import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
...@@ -84,6 +85,8 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -84,6 +85,8 @@ public class BChapterServiceImpl implements BChapterService {
@Autowired @Autowired
MTCotactApiRequestClient mtCotactApiRequestClient; MTCotactApiRequestClient mtCotactApiRequestClient;
@Autowired @Autowired
BCollectRepository bCollectRepository;
@Autowired
OfficeToPdf officeToPdf; OfficeToPdf officeToPdf;
@Override @Override
...@@ -133,7 +136,16 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -133,7 +136,16 @@ public class BChapterServiceImpl implements BChapterService {
DecimalFormat df = new DecimalFormat("0.00");//设置保留位数 DecimalFormat df = new DecimalFormat("0.00");//设置保留位数
map.put("chapterList", queryChapterListResDTOS); map.put("chapterList", queryChapterListResDTOS);
map.put("totalProgress", i == 0 ? "0%" : df.format((float) percent / i) + "%"); map.put("totalProgress", i == 0 ? "0%" : df.format((float) percent / i) + "%");
map.put("lessonInfo", bLessonRepository.selectByPrimaryKey(lessonId)); // 课程信息 BLesson bLesson = bLessonRepository.selectByPrimaryKey(lessonId);
//查询该课程是否收藏
int collectCount = bCollectRepository.selectCountbyLessonAndUser(curUser,bLesson.getBusinessId());
if (collectCount>0){
bLesson.setIsApply("1");
}else {
bLesson.setIsApply("0");
}
map.put("lessonInfo", bLesson); // 课程信息
QueryChapterListResDTO queryChapterListResDTO = bChapterRepository.getWithCurrentChapterBylessonId(lessonId, curUser.getUserId(), curUser.getCorpId()); QueryChapterListResDTO queryChapterListResDTO = bChapterRepository.getWithCurrentChapterBylessonId(lessonId, curUser.getUserId(), curUser.getCorpId());
if (null != queryChapterListResDTO && StringUtils.isNotBlank(queryChapterListResDTO.getPid())) { if (null != queryChapterListResDTO && StringUtils.isNotBlank(queryChapterListResDTO.getPid())) {
BChapter bChapter = bChapterRepository.selectByPrimaryKey(queryChapterListResDTO.getPid()); BChapter bChapter = bChapterRepository.selectByPrimaryKey(queryChapterListResDTO.getPid());
......
...@@ -8,6 +8,7 @@ import org.rcisoft.business.blesson.dto.AddMyLearnLessonDTO; ...@@ -8,6 +8,7 @@ import org.rcisoft.business.blesson.dto.AddMyLearnLessonDTO;
import org.rcisoft.business.blesson.entity.BCollect; import org.rcisoft.business.blesson.entity.BCollect;
import org.rcisoft.business.blesson.entity.BLessonPerson; import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -59,5 +60,13 @@ public interface BCollectRepository extends BaseMapper<BCollect> { ...@@ -59,5 +60,13 @@ public interface BCollectRepository extends BaseMapper<BCollect> {
int notColletLesson(@Param("personId") String personId,@Param("lessonId") String lessonId); int notColletLesson(@Param("personId") String personId,@Param("lessonId") String lessonId);
@Select("select count(1) from b_collect " +
" where 1=1 " +
" and person_id = #{curUser.userId} " +
" and lesson_id = #{lessonId} ")
int selectCountbyLessonAndUser(@Param("curUser")CurUser curUser, @Param("lessonId")String lessonId);
} }
...@@ -258,14 +258,14 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> { ...@@ -258,14 +258,14 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
BLessonPerson getAppointInTraining(@Param("lessonId")String lessonId ,@Param("personId")String personId ); BLessonPerson getAppointInTraining(@Param("lessonId")String lessonId ,@Param("personId")String personId );
@Select("<script>select blp.*,su.name PersonName, su.head_pic headPic " + @Select("<script>select * " +
" from b_lesson_person blp left join s_user su on blp.person_id = su.business_id " + " from b_lesson_person " +
" where 1=1 " + " where 1=1 " +
"and blp.del_flag = 0 and blp.flag = 1 " + "and del_flag = 0 and flag = 1 " +
"and su.del_flag = 0 and su.flag = 1 " + // "and su.del_flag = 0 and su.flag = 1 " +
"<if test= \" param.isApply != null and param.isApply != ''\">and blp.is_apply = #{param.isApply} </if> " + "<if test= \" param.isApply != null and param.isApply != ''\">and is_apply = #{param.isApply} </if> " +
"<if test= \" param.trainIsSign != null and param.trainIsSign != ''\">and blp.train_is_sign = #{param.trainIsSign} </if> " + "<if test= \" param.trainIsSign != null and param.trainIsSign != ''\">and train_is_sign = #{param.trainIsSign} </if> " +
"and blp.lesson_id = #{param.lessonId}</script>") "and lesson_id = #{param.lessonId}</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
List<BLessonPerson> trainPersons(@Param("param") FindTrainPersonDTO param); List<BLessonPerson> trainPersons(@Param("param") FindTrainPersonDTO param);
......
...@@ -30,4 +30,9 @@ public class ILessonCountDTO { ...@@ -30,4 +30,9 @@ public class ILessonCountDTO {
@ApiModelProperty(value = "我未开始课程数量(我报名待参加培训数量) (该培训待参加数量)") @ApiModelProperty(value = "我未开始课程数量(我报名待参加培训数量) (该培训待参加数量)")
private String notStartCount; private String notStartCount;
@ApiModelProperty(value = "0 未开始 1签到中 2已结束")
private String trainType;
} }
...@@ -12,6 +12,7 @@ import org.rcisoft.business.blesson.service.BLessonPersonService; ...@@ -12,6 +12,7 @@ import org.rcisoft.business.blesson.service.BLessonPersonService;
import org.rcisoft.common.util.feignDto.MTGetUserByDeptIdsRspDTO; import org.rcisoft.common.util.feignDto.MTGetUserByDeptIdsRspDTO;
import org.rcisoft.common.util.feignDto.MTUserGetsReqDTO; import org.rcisoft.common.util.feignDto.MTUserGetsReqDTO;
import org.rcisoft.common.util.feignDto.MTUserInfoRspDTO; import org.rcisoft.common.util.feignDto.MTUserInfoRspDTO;
import org.rcisoft.common.util.feignDto.UserGetPageListByDeptCascadeRspDTO;
import org.rcisoft.common.util.outClient.MTCotactApiRequestClient; import org.rcisoft.common.util.outClient.MTCotactApiRequestClient;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant; import org.rcisoft.core.constant.MessageConstant;
...@@ -80,11 +81,14 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -80,11 +81,14 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
public List<StudentTrackingRspDTO> studentTrackingByPagination(PageUtil pageUtil, StudentTrackingDTO studentTrackingDTO) { public List<StudentTrackingRspDTO> studentTrackingByPagination(PageUtil pageUtil, StudentTrackingDTO studentTrackingDTO) {
List<Long> deptIds = new ArrayList<>(); List<Long> deptIds = new ArrayList<>();
if(StringUtils.isNotEmpty(studentTrackingDTO.getDepartId())){ if(StringUtils.isNotEmpty(studentTrackingDTO.getDepartId())){
deptIds.add(Long.parseLong(studentTrackingDTO.getDepartId())); // deptIds.add(Long.parseLong(studentTrackingDTO.getDepartId()));
List<MTGetUserByDeptIdsRspDTO> datas = mtCotactApiRequestClient.userGetUserByDeptIds(studentTrackingDTO.getCorpId(),deptIds); // List<MTGetUserByDeptIdsRspDTO> datas = mtCotactApiRequestClient.userGetUserByDeptIds(studentTrackingDTO.getCorpId(),deptIds);
datas.forEach(data->{ List<UserGetPageListByDeptCascadeRspDTO> datas = mtCotactApiRequestClient.allUserListByDept(studentTrackingDTO.getCorpId(),studentTrackingDTO.getDepartId());
studentTrackingDTO.getUserIdsInDepart().add(data.getId()); if (datas != null && datas.size()>0){
}); datas.forEach(data->{
studentTrackingDTO.getUserIdsInDepart().add(data.getId());
});
}
} }
List<StudentTrackingRspDTO> studentTrackingRspDTOs = bLessonPersonRepository.studentTrackingByPagination(studentTrackingDTO); List<StudentTrackingRspDTO> studentTrackingRspDTOs = bLessonPersonRepository.studentTrackingByPagination(studentTrackingDTO);
List<String> uids = new ArrayList<>(); List<String> uids = new ArrayList<>();
......
...@@ -661,7 +661,17 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -661,7 +661,17 @@ public class BLessonServiceImpl implements BLessonService {
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public ILessonCountDTO trainPersonCount(String lessonId) { public ILessonCountDTO trainPersonCount(String lessonId) {
return bLessonRepository.trainPersonCount(lessonId); ILessonCountDTO iLessonCountDTO = bLessonRepository.trainPersonCount(lessonId);
BLesson bLesson = bLessonRepository.selectInfoById(lessonId);
Date now = new Date();
if (now.before( bLesson.getTrainStartDate())){
iLessonCountDTO.setTrainType("0");
}else if ( bLesson.getTrainOverDate().before(now) ){
iLessonCountDTO.setTrainType("2");
}else{
iLessonCountDTO.setTrainType("1");
}
return iLessonCountDTO;
} }
@Override @Override
...@@ -684,6 +694,8 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -684,6 +694,8 @@ public class BLessonServiceImpl implements BLessonService {
mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> { mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> {
if (mtUserInfoRspDTO.getId().equals(bLessonPerson.getPersonId())){ if (mtUserInfoRspDTO.getId().equals(bLessonPerson.getPersonId())){
//设置部门名 //设置部门名
bLessonPerson.setPersonName(mtUserInfoRspDTO.getName());
bLessonPerson.setHeadPic(mtUserInfoRspDTO.getAvatar());
bLessonPerson.setDepartName(mtUserInfoRspDTO.getDepts().get(0).getName()); bLessonPerson.setDepartName(mtUserInfoRspDTO.getDepts().get(0).getName());
} }
}); });
...@@ -847,36 +859,38 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -847,36 +859,38 @@ public class BLessonServiceImpl implements BLessonService {
public int toTraining(CurUser curUser, String lessonId) { public int toTraining(CurUser curUser, String lessonId) {
BLessonPerson person = new BLessonPerson(); BLessonPerson person = new BLessonPerson();
BLessonPerson bLessonPerson = new BLessonPerson(); BLessonPerson bLessonPerson = new BLessonPerson();
Map<String,Object> xy = bLessonPersonRepository.selecTraningNum(lessonId); //step 1 查询数 x 当前报名数 y 总数
synchronized (this) {
int x = Integer.parseInt(String.valueOf(xy.get("x"))); Map<String, Object> xy = bLessonPersonRepository.selecTraningNum(lessonId);
int y = Integer.parseInt(String.valueOf(xy.get("y")));
if( x >= y){ int x = Integer.parseInt(String.valueOf(xy.get("x")));
throw new ServiceException(ResultServiceEnums.PERSON_MAX); int y = Integer.parseInt(String.valueOf(xy.get("y")));
} if (x >= y) {
//tep2 判断该用户是否被指派该培训或已经报名 throw new ServiceException(ResultServiceEnums.PERSON_MAX);
person = bLessonPersonRepository.getAppointInTraining(lessonId, curUser.getUserId()); }
//step2 判断该用户是否被指派该培训或已经报名
if (person != null) { person = bLessonPersonRepository.getAppointInTraining(lessonId, curUser.getUserId());
if (person.getIsApply().equals("1")) { if (person != null) {
log.info("-----------该培训已报名-------------"); if (person.getIsApply().equals("1")) {
throw new ServiceException(ResultServiceEnums.TRAIN_APPLYED); log.info("-----------该培训已报名-------------");
throw new ServiceException(ResultServiceEnums.TRAIN_APPLYED);
}
person.setTrainIsSign("0");
person.setApplyDate(new Date());
person.setIsApply("1");
return bLessonPersonRepository.updateLessonPersonByUserId(person);
} else {
UserUtil.setCurrentPersistOperation(bLessonPerson);
bLessonPerson.setPersonId(curUser.getUserId());
bLessonPerson.setLessonId(lessonId);
bLessonPerson.setIsAppoint("0");
bLessonPerson.setIsApply("1");
bLessonPerson.setTrainIsSign("0");
bLessonPerson.setApplyDate(new Date());
bLessonPerson.setRemarks("");
//插入 用户id 、培训id、指派状态、报名状态、培训状态、报名时间 、通用字段
return bLessonPersonRepository.insert(bLessonPerson);
} }
person.setTrainIsSign("0");
person.setApplyDate(new Date());
person.setIsApply("1");
return bLessonPersonRepository.updateLessonPersonByUserId(person);
} else {
UserUtil.setCurrentPersistOperation(bLessonPerson);
bLessonPerson.setPersonId(curUser.getUserId());
bLessonPerson.setLessonId(lessonId);
bLessonPerson.setIsAppoint("0");
bLessonPerson.setIsApply("1");
bLessonPerson.setTrainIsSign("0");
bLessonPerson.setApplyDate(new Date());
bLessonPerson.setRemarks("");
//插入 用户id 、培训id、指派状态、报名状态、培训状态、报名时间 、通用字段
return bLessonPersonRepository.insert(bLessonPerson);
} }
} }
...@@ -923,6 +937,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -923,6 +937,12 @@ public class BLessonServiceImpl implements BLessonService {
}else { }else {
bLesson.setApplyIsFull("0"); bLesson.setApplyIsFull("0");
} }
int collectCount = bCollectRepository.selectCountbyLessonAndUser(curUser,bLesson.getBusinessId());
if (collectCount>0){
bLesson.setIsApply("1");
}else {
bLesson.setIsApply("0");
}
return bLesson; return bLesson;
} }
......
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