Joburgess 5 rokov pred
rodič
commit
b55f70ca44

+ 3 - 3
edu-task/src/main/java/com/keao/edu/task/jobs/ExamStatusUpdateTask.java

@@ -1,7 +1,7 @@
 package com.keao.edu.task.jobs;
 
 import com.keao.edu.task.core.BaseTask;
-import com.keao.edu.user.api.client.EduUserFeignService;
+import com.keao.edu.user.api.client.TaskRemoteService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -13,10 +13,10 @@ import org.springframework.stereotype.Service;
 public class ExamStatusUpdateTask extends BaseTask {
 
     @Autowired
-    private EduUserFeignService eduUserFeignService;
+    private TaskRemoteService taskRemoteService;
 
     @Override
     public void execute(){
-        eduUserFeignService.updateExamStatus();
+        taskRemoteService.updateExamStatus();
     }
 }

+ 3 - 3
edu-task/src/main/java/com/keao/edu/task/jobs/QueryPaymentStatusTask.java

@@ -1,7 +1,7 @@
 package com.keao.edu.task.jobs;
 
 import com.keao.edu.task.core.BaseTask;
-import com.keao.edu.user.api.client.EduUserFeignService;
+import com.keao.edu.user.api.client.TaskRemoteService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -9,10 +9,10 @@ import org.springframework.stereotype.Service;
 public class QueryPaymentStatusTask extends BaseTask {
 
 	@Autowired
-	private EduUserFeignService eduUserFeignService;
+	private TaskRemoteService taskRemoteService;
 
 	@Override
 	public void execute(){
-		eduUserFeignService.queryPaymentStatus();
+		taskRemoteService.queryPaymentStatus();
 	}
 }

+ 22 - 0
edu-task/src/main/java/com/keao/edu/task/jobs/TomorrowExamPlanRemindTask.java

@@ -0,0 +1,22 @@
+package com.keao.edu.task.jobs;
+
+import com.keao.edu.task.core.BaseTask;
+import com.keao.edu.user.api.client.TaskRemoteService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.07.23
+ */
+@Service
+public class TomorrowExamPlanRemindTask extends BaseTask {
+
+    @Autowired
+    private TaskRemoteService taskRemoteService;
+
+    @Override
+    public void execute() {
+        taskRemoteService.tomorrowExamPlanRemind();
+    }
+}

+ 0 - 13
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/client/EduUserFeignService.java

@@ -64,17 +64,4 @@ public interface EduUserFeignService {
 	 */
 	@PostMapping(value = "examRoomStudentRelation/api/getExamRoomStudentRelation")
 	ExamRoomStudentRelation getExamRoomStudentRelation(@RequestParam("registrationId") Long registrationId);
-
-	@GetMapping("task/queryPaymentStatus")
-	// 订单支付状态查询
-	void queryPaymentStatus();
-
-	/**
-	 * @describe 更新考级项目状态
-	 * @author Joburgess
-	 * @date 2020.07.10
-	 * @return void
-	 */
-	@GetMapping("task/updateExamStatus")
-	void updateExamStatus();
 }

+ 35 - 0
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/client/TaskRemoteService.java

@@ -0,0 +1,35 @@
+package com.keao.edu.user.api.client;
+
+import com.keao.edu.common.config.FeignConfiguration;
+import com.keao.edu.user.api.client.fallback.TaskRemoteServiceFallback;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@FeignClient(name = "web-server", contextId = "TaskRemoteService", configuration = { FeignConfiguration.class }, fallback = TaskRemoteServiceFallback.class)
+public interface TaskRemoteService {
+
+
+
+	// 订单支付状态查询
+	@GetMapping("task/queryPaymentStatus")
+	void queryPaymentStatus();
+
+	/**
+	 * @describe 更新考级项目状态
+	 * @author Joburgess
+	 * @date 2020.07.10
+	 * @return void
+	 */
+	@GetMapping("task/updateExamStatus")
+	void updateExamStatus();
+
+	/**
+	 * @describe 明日考试安排提醒
+	 * @author Joburgess
+	 * @date 2020.07.23
+	 * @return void
+	 */
+	@GetMapping("/tomorrowExamPlanRemind")
+	void tomorrowExamPlanRemind();
+
+}

+ 0 - 10
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/client/fallback/EduUserFeignServiceFallback.java

@@ -39,14 +39,4 @@ public class EduUserFeignServiceFallback implements EduUserFeignService {
 	public ExamRoomStudentRelation getExamRoomStudentRelation(Long registrationId) {
 		return null;
 	}
-
-	@Override
-	public void queryPaymentStatus() {
-		return;
-	}
-
-	@Override
-	public void updateExamStatus() {
-		return;
-	}
 }

+ 27 - 0
edu-user/edu-user-client-api/src/main/java/com/keao/edu/user/api/client/fallback/TaskRemoteServiceFallback.java

@@ -0,0 +1,27 @@
+package com.keao.edu.user.api.client.fallback;
+
+import com.keao.edu.user.api.client.TaskRemoteService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class TaskRemoteServiceFallback implements TaskRemoteService {
+
+	private final static Logger logger = LoggerFactory.getLogger(TaskRemoteServiceFallback.class);
+
+	@Override
+	public void queryPaymentStatus() {
+		return;
+	}
+
+	@Override
+	public void updateExamStatus() {
+		return;
+	}
+
+	@Override
+	public void tomorrowExamPlanRemind() {
+		return;
+	}
+}

+ 10 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/TaskController.java

@@ -2,6 +2,7 @@ package com.keao.edu.user.controller;
 
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.user.service.ExamRegistrationPaymentService;
+import com.keao.edu.user.service.ExamRoomService;
 import com.keao.edu.user.service.ExaminationBasicService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -16,6 +17,8 @@ public class TaskController extends BaseController {
     private ExamRegistrationPaymentService examRegistrationPaymentService;
     @Autowired
     private ExaminationBasicService examinationBasicService;
+    @Autowired
+    private ExamRoomService examRoomService;
 
     // 查询订单状态
     @GetMapping("/queryPaymentStatus")
@@ -27,8 +30,15 @@ public class TaskController extends BaseController {
         }
     }
 
+    //更新考级项目状态
     @GetMapping("/updateExamStatus")
     public void updateExamStatus(){
         examinationBasicService.updateExamStatus();
     }
+
+    //明日考试安排推送
+    @GetMapping("/tomorrowExamPlanRemind")
+    public void tomorrowExamPlanRemind(String day){
+        examRoomService.tomorrowExamPlanRemind(day);
+    }
 }

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRoomService.java

@@ -68,7 +68,7 @@ public interface ExamRoomService extends BaseService<Long, ExamRoom> {
      * @date 2020.07.22
      * @return void
      */
-    void tomorrowExamPlanRemind();
+    void tomorrowExamPlanRemind(String day);
 
     /**
      * @describe 获取考场统计信息

+ 12 - 4
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomServiceImpl.java

@@ -41,6 +41,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -419,9 +420,13 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 	}
 
 	@Override
-	public void tomorrowExamPlanRemind() {
+	public void tomorrowExamPlanRemind(String day) {
 		LocalDate tomorrowDate = LocalDate.now().plusDays(1);
-		List<ExamRoomStudentRelation> tomorrowExamStudents = examRoomStudentRelationDao.getTomorrowExamStudents(tomorrowDate.toString());
+		String tomorrowDateStr = tomorrowDate.toString();
+		if(StringUtils.isNotBlank(day)){
+			tomorrowDateStr = day;
+		}
+		List<ExamRoomStudentRelation> tomorrowExamStudents = examRoomStudentRelationDao.getTomorrowExamStudents(tomorrowDateStr);
 		if(CollectionUtils.isEmpty(tomorrowExamStudents)){
 			return;
 		}
@@ -472,17 +477,20 @@ public class ExamRoomServiceImpl extends BaseServiceImpl<Long, ExamRoom> impleme
 					examDayStr, examTimeStr.toString());
 		}
 
+		String tomorrowDayStr=tomorrowDate.format(DateTimeFormatter.ofPattern("MM月dd日"));
 		Map<Integer, String> idTeacherPhoneMap = this.getMap("sys_user", "id_", "phone_", new ArrayList(teacherExamRoomsMap.keySet()), Integer.class, String.class);
 		for (Map.Entry<Integer, List<ExamRoom>> teacherRoomEntry : teacherExamRoomsMap.entrySet()) {
 			String teacherPhone = idTeacherPhoneMap.get(teacherRoomEntry.getKey());
 			Date examStartTime = teacherRoomEntry.getValue().stream().min(Comparator.comparing(ExamRoom::getExamStartTime)).get().getExamStartTime();
-			String examStartTimeStr = DateUtil.dateToString(examStartTime, "MM月dd日 HH时mm分");
+			String examStartTimeStr = DateUtil.dateToString(examStartTime, "HH时mm分");
+			Date examEndTime = teacherRoomEntry.getValue().stream().max(Comparator.comparing(ExamRoom::getExamStartTime)).get().getExamStartTime();
+			String examEndTimeStr = DateUtil.dateToString(examEndTime, "HH时mm分");
 			int examRoomNum = teacherRoomEntry.getValue().size();
 			Map<Integer, String> phoneMap = new HashMap<>();
 			phoneMap.put(teacherRoomEntry.getKey(), teacherPhone);
 			sysMessageService.batchSendMessage(MessageTypeEnum.BEFORE_EXAM_TEACHER_REMIND_SMS,
 					phoneMap, null, 0, null, YimeiSmsPlugin.PLUGIN_NAME,
-					examStartTimeStr, examRoomNum);
+					tomorrowDayStr, examStartTimeStr, examEndTimeStr, examRoomNum);
 		}
 	}