|
@@ -2,11 +2,13 @@ package com.keao.edu.user.service.impl;
|
|
|
|
|
|
import com.keao.edu.auth.api.entity.SysUser;
|
|
|
import com.keao.edu.common.dal.BaseDAO;
|
|
|
+import com.keao.edu.common.enums.MessageTypeEnum;
|
|
|
import com.keao.edu.common.exception.BizException;
|
|
|
import com.keao.edu.common.page.PageInfo;
|
|
|
import com.keao.edu.common.service.SysMessageService;
|
|
|
import com.keao.edu.common.service.impl.BaseServiceImpl;
|
|
|
import com.keao.edu.common.tenant.TenantContextHolder;
|
|
|
+import com.keao.edu.thirdparty.message.provider.YimeiSmsPlugin;
|
|
|
import com.keao.edu.user.api.enums.ExamModeEnum;
|
|
|
import com.keao.edu.user.dao.*;
|
|
|
import com.keao.edu.user.dto.ExamRoomExamTimeDto;
|
|
@@ -28,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -58,6 +61,8 @@ public class ExaminationBasicServiceImpl extends BaseServiceImpl<Long, Examinati
|
|
|
private StudentExamResultService studentExamResultService;
|
|
|
@Autowired
|
|
|
private ExamRoomDao examRoomDao;
|
|
|
+ @Autowired
|
|
|
+ private TenantInfoDao tenantInfoDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, ExaminationBasic> getDAO() {
|
|
@@ -157,6 +162,28 @@ public class ExaminationBasicServiceImpl extends BaseServiceImpl<Long, Examinati
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public void examEndRemind() {
|
|
|
+ LocalDate today = LocalDate.now();
|
|
|
+ List<ExaminationBasic> endExams = examinationBasicDao.getEndExamsWithDayAndStatus(today.plusDays(-1).toString());
|
|
|
+ if(CollectionUtils.isEmpty(endExams)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Set<Integer> tenantIds = endExams.stream().map(e->Integer.valueOf(e.getTenantId())).collect(Collectors.toSet());
|
|
|
+ List<TenantInfo> tenants = tenantInfoDao.getTenants(new ArrayList<>(tenantIds));
|
|
|
+ Map<Integer, TenantInfo> idTenantMap = tenants.stream().collect(Collectors.toMap(TenantInfo::getId, e -> e));
|
|
|
+
|
|
|
+ for (ExaminationBasic endExam : endExams) {
|
|
|
+ TenantInfo tenantInfo = idTenantMap.get(Integer.valueOf(endExam.getTenantId()));
|
|
|
+ Map<Integer, String> userPhoneMap = new HashMap<>();
|
|
|
+ userPhoneMap.put(tenantInfo.getId(), tenantInfo.getContactPhone());
|
|
|
+
|
|
|
+ sysMessageService.batchSendMessage(MessageTypeEnum.EXAM_END_REMIND,
|
|
|
+ userPhoneMap, null, 0, null, YimeiSmsPlugin.PLUGIN_NAME,
|
|
|
+ tenantInfo.getName(), endExam.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateExamBasicStatus(Long examId, ExamStatusEnum statusEnum, Integer operatorId) {
|
|
|
if(Objects.isNull(examId)){
|