From 85ae68bdbd7e373fb6f3e6f5eb04c57e3d86efd0 Mon Sep 17 00:00:00 2001
From: kongzy <kongzy>
Date: 星期三, 16 十月 2024 10:28:33 +0800
Subject: [PATCH] 补全缺失字段
---
exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java | 70 ++++++++++++++++++++++++++++++++---
1 files changed, 64 insertions(+), 6 deletions(-)
diff --git a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java
index 2c4f659..be08ff3 100644
--- a/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java
+++ b/exam-system/src/main/java/com/gkhy/exam/institutionalaccess/service/serviceImpl/ThBatchManagerServiceImpl.java
@@ -1,19 +1,17 @@
package com.gkhy.exam.institutionalaccess.service.serviceImpl;
-import com.gkhy.exam.institutionalaccess.entity.ThBatchCourse;
-import com.gkhy.exam.institutionalaccess.entity.ThBatchCourseChapter;
-import com.gkhy.exam.institutionalaccess.entity.ThStudentBatch;
-import com.gkhy.exam.institutionalaccess.entity.ThStudyDetail;
+import com.gkhy.exam.institutionalaccess.entity.*;
import com.gkhy.exam.institutionalaccess.enums.FinishStatus;
import com.gkhy.exam.institutionalaccess.model.query.ThBatchQuery;
import com.gkhy.exam.institutionalaccess.model.resp.ThBatchCourseRespDTO;
-import com.gkhy.exam.institutionalaccess.model.resp.ThCourseChapterRespDTO;
import com.gkhy.exam.institutionalaccess.model.resp.ThStudentCourseRespDTO;
import com.gkhy.exam.institutionalaccess.model.resp.ThStudentStudyRespDTO;
import com.gkhy.exam.institutionalaccess.model.vo.*;
import com.gkhy.exam.institutionalaccess.service.*;
import com.gkhy.exam.institutionalaccess.utils.ConvertTimeUtils;
+import com.gkhy.exam.institutionalaccess.utils.SendMessageUtil;
+import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -22,8 +20,8 @@
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@Service("ThBatchManagerService")
@@ -38,6 +36,13 @@
private ThStudyDetailService thStudyDetailService;
@Autowired
private ThBatchCourseChapterService thBatchCourseChapterService;
+ @Autowired
+ private ThSubjectTypeService subjectTypeService;
+ @Autowired
+ private ThStudentManagerService thStudentManagerService;
+
+ @Autowired
+ private SendMessageUtil sendMessageUtil;
@Override
public List<ThBatchVO> listByPage(ThBatchQuery query) {
@@ -51,6 +56,7 @@
List<ThBatchCourseChapter> chapterList = thBatchCourseChapterService.getListByBatchUuids(batchUuids);
for (ThBatchVO thBatchVO : thBatchVOS) {
+ thBatchVO.setSubjectName(getObtainSuperiors(thBatchVO.getSubjectCode()));
//课程
List<ThBatchCourseVO> collect = batchCourseList.stream()
.filter(bc -> bc.getBatchUuid().equals(thBatchVO.getUuid()))
@@ -181,4 +187,56 @@
}
return respDTOS;
}
+
+ //短信提醒
+ @Override
+ public AjaxResult sendMes(String idcard) {
+ ThStudent thStudent = thStudentManagerService.findByIdCard(idcard);
+ if (StringUtils.isEmpty(thStudent.getPhone()) || thStudent.getPhone().equals("-")){
+ return AjaxResult.error("该学员未绑定手机号");
+ }
+ //调用短信接口
+ String[] phone={thStudent.getPhone()};
+ HashMap<String, String> map = new HashMap<>();
+ map.put("name",thStudent.getName());
+ map.put("platform",thStudent.getInstitutionName());
+ sendMessageUtil.sendMessageCheck(phone,map);
+ return AjaxResult.success();
+ }
+
+ public String getObtainSuperiors(String code){
+ List<ThSubjectType> subjectTypeList = subjectTypeService.getSubjectTypeList();
+ if(StringUtils.isEmpty(code)){
+ return "未知";
+ }
+ StringBuffer stringBuffer = new StringBuffer();
+ String subjectName = "未知";
+ ThSubjectType currentSubject = getThSubejctInfoByCode(subjectTypeList,code);
+ if(currentSubject != null){
+ subjectName = currentSubject.getName();
+ }
+ //一级
+ if(code.length() == 1){
+ stringBuffer.append(subjectName);
+ }
+ //二级
+ if(code.length() == 3){
+ ThSubjectType parentSubject = getThSubejctInfoByCode(subjectTypeList,currentSubject.getParentCode());
+ stringBuffer.append(parentSubject.getName()).append("/").append(subjectName);
+ }
+ //三级
+ if(code.length() == 5){
+ ThSubjectType parentSubject = getThSubejctInfoByCode(subjectTypeList,currentSubject.getParentCode());
+ ThSubjectType grandpaSubject = getThSubejctInfoByCode(subjectTypeList,parentSubject.getParentCode());
+ stringBuffer.append(grandpaSubject.getName()).append("/").append(parentSubject.getName()).append("/").append(subjectName);
+ }
+ return stringBuffer.toString();
+ }
+ public ThSubjectType getThSubejctInfoByCode(List<ThSubjectType> list, String code){
+ List<ThSubjectType> selectList = list.stream().filter(subjectType -> subjectType.getCode().equals(code)).collect(Collectors.toList());
+ if(selectList.size() > 0){
+ return selectList.get(0);
+ }
+ return null;
+ }
}
--
Gitblit v1.9.2