Commit 27b0428d authored by zhangqingle's avatar zhangqingle

修改接口

parent 330be126
...@@ -140,7 +140,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> { ...@@ -140,7 +140,7 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@Select("<script>select business_id,person_id from b_lesson_person where 1=1 " + @Select("<script>select business_id,person_id from b_lesson_person where 1=1 " +
"and del_flag = 0 and flag = 1 " + "and del_flag = 0 and flag = 1 " +
"AND person_id IN" + "AND person_id IN" +
"<foreach item='item' index='index' collection='appointPersonList' open='(' close=')' separator=','> " + "<foreach item='item' collection='appointPersonList' open='(' close=')' separator=','> " +
"#{item} " + "#{item} " +
"</foreach>" + "</foreach>" +
"and lesson_id = #{lessonId}</script>") "and lesson_id = #{lessonId}</script>")
...@@ -177,7 +177,6 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> { ...@@ -177,7 +177,6 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
" blp.appoint_id=#{appointId},"+ " blp.appoint_id=#{appointId},"+
" </set>"+ " </set>"+
" where 1=1 " + " where 1=1 " +
" and blp.is_finish != '0' " +
" and ba.lesson_id = #{lessonId} " + " and ba.lesson_id = #{lessonId} " +
"</script>") "</script>")
int cancelAppointByPersons(BLessonPerson param); int cancelAppointByPersons(BLessonPerson param);
......
...@@ -152,6 +152,10 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -152,6 +152,10 @@ public class BLesson extends IdEntity<BLesson> {
@Transient @Transient
private List<BTrainFile> bTrainFileList; private List<BTrainFile> bTrainFileList;
@ApiModelProperty(value = "时间状态 0 我开始签到 1 已开始签到 2课程结束")
@Transient
private String trainDateState;
//------------------------------------- //-------------------------------------
......
...@@ -581,9 +581,11 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -581,9 +581,11 @@ public class BLessonServiceImpl implements BLessonService {
//获取部门中人员 //获取部门中人员
List<String> inDepartPerson = new ArrayList<>(); List<String> inDepartPerson = new ArrayList<>();
List<GetAllRspDTO> departPersons = cotactApiRequestClient.getUserByDeptIds(appointLessonDTO.getCorpId(),appointLessonDTO.getAppointDepart()); List<GetAllRspDTO> departPersons = cotactApiRequestClient.getUserByDeptIds(appointLessonDTO.getCorpId(),appointLessonDTO.getAppointDepart());
departPersons.forEach(departPerson->{ if (departPersons != null && departPersons.size()>0){
inDepartPerson.add(departPerson.getId()); departPersons.forEach(departPerson->{
}); inDepartPerson.add(departPerson.getId());
});
}
//------------- //-------------
if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson()) && StringUtils.isEmpty(appointLessonDTO.getAppointDepart())) { if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson()) && StringUtils.isEmpty(appointLessonDTO.getAppointDepart())) {
...@@ -638,7 +640,10 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -638,7 +640,10 @@ public class BLessonServiceImpl implements BLessonService {
//插入b_lesson_person表 //插入b_lesson_person表
appointLessonDTO.setAppointPersonList(userIdSet); appointLessonDTO.setAppointPersonList(userIdSet);
//查询已学该课程的学习business_id //查询已学该课程的学习business_id
List<BLessonPerson> inLessonPersons = bLessonPersonRepository.selectPersonIdByLessonId(appointLessonDTO); List<BLessonPerson> inLessonPersons = new ArrayList<>();
if (appointLessonDTO.getAppointPersonList() !=null && appointLessonDTO.getAppointPersonList().size()>0){
inLessonPersons = bLessonPersonRepository.selectPersonIdByLessonId(appointLessonDTO);
}
if (inLessonPersons != null && inLessonPersons.size() > 0) { if (inLessonPersons != null && inLessonPersons.size() > 0) {
List<String> inLessonIds = new ArrayList<>(); List<String> inLessonIds = new ArrayList<>();
for (BLessonPerson inLessonPerson : inLessonPersons) { for (BLessonPerson inLessonPerson : inLessonPersons) {
...@@ -667,8 +672,13 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -667,8 +672,13 @@ public class BLessonServiceImpl implements BLessonService {
bLessonPerson.setPersonId(userId); bLessonPerson.setPersonId(userId);
bLessonPersonOthers.add(bLessonPerson); bLessonPersonOthers.add(bLessonPerson);
}); });
int line = bLessonPersonRepository.insertList(bLessonPersonOthers);
int line;
if (bLessonPersonOthers != null && bLessonPersonOthers.size() > 0){
line = bLessonPersonRepository.insertList(bLessonPersonOthers);
}else {
line = 1;
}
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
} }
...@@ -695,13 +705,15 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -695,13 +705,15 @@ public class BLessonServiceImpl implements BLessonService {
public ILessonCountDTO trainPersonCount(String lessonId) { public ILessonCountDTO trainPersonCount(String lessonId) {
ILessonCountDTO iLessonCountDTO = bLessonRepository.trainPersonCount(lessonId); ILessonCountDTO iLessonCountDTO = bLessonRepository.trainPersonCount(lessonId);
BLesson bLesson = bLessonRepository.selectInfoById(lessonId); BLesson bLesson = bLessonRepository.selectInfoById(lessonId);
Date now = new Date(); if (bLesson != null){
if (now.before( bLesson.getTrainStartDate())){ Date now = new Date();
iLessonCountDTO.setTrainType("0"); if (now.before( bLesson.getTrainStartDate())){
}else if ( bLesson.getTrainOverDate().before(now) ){ iLessonCountDTO.setTrainType("0");
iLessonCountDTO.setTrainType("2"); }else if ( bLesson.getTrainOverDate().before(now) ){
}else{ iLessonCountDTO.setTrainType("2");
iLessonCountDTO.setTrainType("1"); }else{
iLessonCountDTO.setTrainType("1");
}
} }
return iLessonCountDTO; return iLessonCountDTO;
} }
...@@ -1006,6 +1018,21 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -1006,6 +1018,21 @@ public class BLessonServiceImpl implements BLessonService {
}else { }else {
bLesson.setIsCollect("0"); bLesson.setIsCollect("0");
} }
//判断签到是否开始
if (bLesson.getTrainStartDate() != null && StringUtils.isNotEmpty(bLesson.getTrainSignTime())){
Date nowDate = new Date();
Long time = Long.parseLong(bLesson.getTrainSignTime()) * 60 * 1000;
Date signStart = new Date(bLesson.getTrainStartDate().getTime() - time);
if (signStart.before(nowDate) && nowDate.before(bLesson.getTrainOverDate())){
bLesson.setTrainDateState("1");
}
if (nowDate.before(signStart)){
bLesson.setTrainDateState("0");
}
if (bLesson.getTrainOverDate().before(nowDate)){
bLesson.setTrainDateState("2");
}
}
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