Commit 27b0428d authored by zhangqingle's avatar zhangqingle

修改接口

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