소스 검색

基础接口补缺

wangliang 4 년 전
부모
커밋
99f11937ad

+ 16 - 10
themis-exam/src/main/java/com/qmth/themis/exam/api/TEStudentController.java

@@ -1,6 +1,8 @@
 package com.qmth.themis.exam.api;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.qmth.themis.business.annotation.ApiJsonObject;
+import com.qmth.themis.business.annotation.ApiJsonProperty;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.AuthDto;
 import com.qmth.themis.business.entity.TBSession;
@@ -74,29 +76,33 @@ public class TEStudentController {
     @ApiOperation(value = "学生登录接口")
     @RequestMapping(value = "/login", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "学生信息", response = TEStudent.class)})
-    public Result login(@ApiParam(value = "学生信息", required = true) @RequestBody Map map) throws NoSuchAlgorithmException {
-        if (Objects.isNull(map)) {
+    public Result login(@ApiJsonObject(name = "loginAccount", value = {
+            @ApiJsonProperty(key = "identity", description = "证件号"),
+            @ApiJsonProperty(key = "password", description = "密码"),
+            @ApiJsonProperty(key = "orgId",type = "long",example = "1",description = "机构id")
+    }) @ApiParam(value = "学生信息", required = true) @RequestBody Map<String, Object> mapParameter) throws NoSuchAlgorithmException {
+        if (Objects.isNull(mapParameter)) {
             throw new BusinessException(ExceptionResultEnum.STUDENT_IS_NULL);
         }
-        if (Objects.isNull(map.get("identity")) || Objects.equals(map.get("identity"), "")) {
+        if (Objects.isNull(mapParameter.get("identity")) || Objects.equals(mapParameter.get("identity"), "")) {
             throw new BusinessException(ExceptionResultEnum.LOGIN_NAME_IS_NULL);
         }
-        if (Objects.isNull(map.get("password")) || Objects.equals(map.get("password"), "")) {
+        if (Objects.isNull(mapParameter.get("password")) || Objects.equals(mapParameter.get("password"), "")) {
             throw new BusinessException(ExceptionResultEnum.PASSWORD_IS_NULL);
         }
         Long orgId = null;
-        if (Objects.nonNull(map.get("orgId"))) {
-            orgId = Long.parseLong(String.valueOf(map.get("orgId")));
+        if (Objects.nonNull(mapParameter.get("orgId"))) {
+            orgId = Long.parseLong(String.valueOf(mapParameter.get("orgId")));
         }
         Long examId = null;
-        if (Objects.nonNull(map.get("examId"))) {
-            examId = Long.parseLong(String.valueOf(map.get("examId")));
+        if (Objects.nonNull(mapParameter.get("examId"))) {
+            examId = Long.parseLong(String.valueOf(mapParameter.get("examId")));
         }
         if (Objects.isNull(orgId) && Objects.isNull(examId)) {
             throw new BusinessException("机构id或考试id必须有一个");
         }
-        String identity = String.valueOf(map.get("identity"));
-        String password = String.valueOf(map.get("password"));
+        String identity = String.valueOf(mapParameter.get("identity"));
+        String password = String.valueOf(mapParameter.get("password"));
 
         QueryWrapper<TEStudent> wrapper = new QueryWrapper<>();
         wrapper.lambda().eq(TEStudent::getIdentity, identity);

+ 1 - 1
themis-mq/src/main/java/com/qmth/themis/mq/templete/impl/TaskConcurrentlyImpl.java

@@ -103,7 +103,7 @@ public class TaskConcurrentlyImpl implements Concurrently {
                         mqDto.setBody(JacksonUtil.parseJson(mqDto.getBody()));
                         TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
                         tmRocketMessageService.saveOrUpdate(tmRocketMessage);
-                        redisUtil.delete(SystemConstant.MQ_TOPIC_BUFFER_LIST + mqDto.getId());
+                        redisUtil.delete(SystemConstant.MQ_TOPIC_BUFFER_LIST, mqDto.getId());
                         return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
                     } else {
                         log.info(":{}-:{} 消息ack未确认,重发", threadId, threadName);

+ 17 - 15
themis-task/src/main/java/com/qmth/themis/task/listener/RocketQuartzConsumer.java

@@ -103,28 +103,30 @@ public class RocketQuartzConsumer implements MessageListenerOrderly {
                                     } else {
                                         calendar.setTime(finishTime);
                                     }
+                                    if (calendar.getTime().getTime() > System.currentTimeMillis()) {
 //                                    calendar.setTime(new Date());
-                                    int year = calendar.get(Calendar.YEAR);//获取年份
-                                    int month = calendar.get(Calendar.MONTH) + 1;//获取月份
-                                    int day = calendar.get(Calendar.DATE);//获取日
-                                    int hour = calendar.get(Calendar.HOUR_OF_DAY);//小时
-                                    int minute = calendar.get(Calendar.MINUTE);//分
-                                    int second = calendar.get(Calendar.SECOND);//秒
+                                        int year = calendar.get(Calendar.YEAR);//获取年份
+                                        int month = calendar.get(Calendar.MONTH) + 1;//获取月份
+                                        int day = calendar.get(Calendar.DATE);//获取日
+                                        int hour = calendar.get(Calendar.HOUR_OF_DAY);//小时
+                                        int minute = calendar.get(Calendar.MINUTE);//分
+                                        int second = calendar.get(Calendar.SECOND);//秒
 //                                    String cron = (second + 20) + " " + (minute) + " " + hour + " " + day + " " + month + " ? " + year;
-                                    String cron = second + " " + (minute + 1) + " " + hour + " " + day + " " + month + " ? " + year;
-                                    log.info("cron:{}", cron);
-                                    String activityCode = teExamActivity.getCode();
-                                    //执行一次性延时任务
-                                    Map mapJob = new HashMap();
-                                    mapJob.put("name", activityCode);
-                                    quartzService.deleteJob(activityCode, dictionaryConfig.quartzConfigDomain().getExamActivityJobGroupName());
-                                    quartzService.addJob(ExamActivityJob.class, activityCode, dictionaryConfig.quartzConfigDomain().getExamActivityJobGroupName(), cron, mapJob);
+                                        String cron = second + " " + (minute + 1) + " " + hour + " " + day + " " + month + " ? " + year;
+                                        log.info("cron:{}", cron);
+                                        String activityCode = teExamActivity.getCode();
+                                        //执行一次性延时任务
+                                        Map mapJob = new HashMap();
+                                        mapJob.put("name", activityCode);
+                                        quartzService.deleteJob(activityCode, dictionaryConfig.quartzConfigDomain().getExamActivityJobGroupName());
+                                        quartzService.addJob(ExamActivityJob.class, activityCode, dictionaryConfig.quartzConfigDomain().getExamActivityJobGroupName(), cron, mapJob);
+                                    }
                                 }
                             }
                         }
                         TMRocketMessage tmRocketMessage = gson.fromJson(gson.toJson(mqDto), TMRocketMessage.class);
                         tmRocketMessageService.saveOrUpdate(tmRocketMessage);
-                        redisUtil.delete(SystemConstant.MQ_TOPIC_BUFFER_LIST + mqDto.getId());
+                        redisUtil.delete(SystemConstant.MQ_TOPIC_BUFFER_LIST, mqDto.getId());
                         return ConsumeOrderlyStatus.SUCCESS;
                     } else {
                         log.info(":{}-:{} 消息ack未确认,重发", threadId, threadName);

+ 6 - 1
themis-task/src/main/resources/application.properties

@@ -170,4 +170,9 @@ rocketmq.producer.secret-key=SK
 #\u542F\u7528\u6D88\u606F\u8F68\u8FF9\uFF0C\u9ED8\u8BA4\u503Ctrue
 rocketmq.producer.enable-msg-trace=true
 #\u81EA\u5B9A\u4E49\u7684\u6D88\u606F\u8F68\u8FF9\u4E3B\u9898
-rocketmq.producer.customized-trace-topic=my-trace-topic
+rocketmq.producer.customized-trace-topic=my-trace-topic
+
+#quartz-\u8003\u8BD5\u573A\u6B21task
+mq.config.quartzTopic=themis-topic-quartz
+mq.config.quartzConsumerExamActivityGroup=themis-group-quartz-examActivity
+mq.config.quartzTopicExamActivityTag=examActivity