|
@@ -1,10 +1,12 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
|
|
|
import com.ym.mec.biz.dal.dao.StudentAttendanceDao;
|
|
|
import com.ym.mec.biz.dal.dto.StudentPersonalAttendanceDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentStatusCountUtilEntity;
|
|
|
import com.ym.mec.biz.dal.entity.StudentAttendance;
|
|
|
import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
|
|
|
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
|
|
|
import com.ym.mec.biz.dal.page.StudentAttendanceQueryInfo;
|
|
|
import com.ym.mec.biz.service.StudentAttendanceService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
@@ -12,7 +14,6 @@ import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.page.QueryInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
-
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -26,6 +27,8 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
|
|
|
|
|
|
@Autowired
|
|
|
private StudentAttendanceDao studentAttendanceDao;
|
|
|
+ @Autowired
|
|
|
+ private MusicGroupStudentFeeDao studentFeeDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, StudentAttendance> getDAO() {
|
|
@@ -35,8 +38,28 @@ public class StudentAttendanceServiceImpl extends BaseServiceImpl<Long, StudentA
|
|
|
@Override
|
|
|
public void addStudentAttendances(List<StudentAttendance> studentAttendances) {
|
|
|
studentAttendances.forEach(studentAttendance -> {
|
|
|
+ StudentAttendance studentAttendanceInfo = studentAttendanceDao.getStudentAttendanceInfo(studentAttendance);
|
|
|
if (studentAttendance.getStatus() != StudentAttendanceStatusEnum.DROP_OUT) {
|
|
|
- studentAttendanceDao.insert(studentAttendanceDao.getStudentAttendanceInfo(studentAttendance));
|
|
|
+ //判断是否为连续旷课
|
|
|
+ if(StudentAttendanceStatusEnum.TRUANT.equals(studentAttendance.getStatus())
|
|
|
+ ||StudentAttendanceStatusEnum.LEAVE.equals(studentAttendance.getStatus())){
|
|
|
+ StudentAttendance studentLatestAttendanceInfo = studentAttendanceDao.getStudentLatestAttendanceInfo(studentAttendanceInfo);
|
|
|
+ if(StudentAttendanceStatusEnum.TRUANT.equals(studentLatestAttendanceInfo.getStatus())
|
|
|
+ ||StudentAttendanceStatusEnum.LEAVE.equals(studentLatestAttendanceInfo.getStatus())){
|
|
|
+ studentFeeDao.updateStudentAbsenteeismTimes(studentAttendanceInfo.getUserId(),
|
|
|
+ studentAttendanceInfo.getMusicGroupId(),
|
|
|
+ YesOrNoEnum.YES.getCode());
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ studentFeeDao.updateStudentAbsenteeismTimes(studentAttendanceInfo.getUserId(),
|
|
|
+ studentAttendanceInfo.getMusicGroupId(),
|
|
|
+ YesOrNoEnum.NO.getCode());
|
|
|
+ }
|
|
|
+ studentAttendanceDao.insert(studentAttendanceInfo);
|
|
|
+ }else{
|
|
|
+ studentFeeDao.updateStudentAbsenteeismTimes(studentAttendanceInfo.getUserId(),
|
|
|
+ studentAttendanceInfo.getMusicGroupId(),
|
|
|
+ YesOrNoEnum.NO.getCode());
|
|
|
}
|
|
|
});
|
|
|
}
|