浏览代码

merge from release_v5.0.6

deason 2 月之前
父节点
当前提交
90d44c7d41

+ 2 - 1
examcloud-starters/examcloud-face-verify-starter/src/test/java/cn/com/qmth/examcloud/starters/face/verify/test/FaceApiTest.java

@@ -18,7 +18,8 @@ public class FaceApiTest {
         properties.setBaiduSecret("xxx");
         properties.setDefaultPrivateBaiduApi(true);
         properties.setPrivateBaiduAppId("test");
-        properties.setPrivateBaiduUrlPrefix("http://192.168.20.253");
+        // properties.setPrivateBaiduUrlPrefix("http://192.168.20.253");
+        properties.setPrivateBaiduUrlPrefix("https://baidu-face.qmth.com.cn");
         // properties.setPrivateBaiduUrlPrefix("http://192.168.12.241:8300");
         // properties.setBaiduExpectFaceCompareScore(70d);
         FaceVerifyServiceImpl faceVerifyService = new FaceVerifyServiceImpl();

+ 2 - 4
examcloud-support/src/main/java/cn/com/qmth/examcloud/reports/commons/bean/AdminOperateReport.java

@@ -1,7 +1,7 @@
 package cn.com.qmth.examcloud.reports.commons.bean;
 
 import cn.com.qmth.examcloud.reports.commons.enums.Tag;
-import cn.com.qmth.examcloud.reports.commons.enums.Topic;
+import cn.com.qmth.examcloud.reports.commons.util.ReportsUtil;
 
 public class AdminOperateReport extends BaseReport {
 
@@ -13,14 +13,13 @@ public class AdminOperateReport extends BaseReport {
 
     private Long rootOrgId;
 
-
     public AdminOperateReport(Long rootOrgId, Long operateUserId, String operate, String operateInfo) {
         super();
         this.rootOrgId = rootOrgId;
         this.operateUserId = operateUserId;
         this.operate = operate;
         this.operateInfo = operateInfo;
-        this.topic = Topic.REPORT_TOPIC.getCode();
+        this.topic = ReportsUtil.getReportTopic();
         this.tag = Tag.ADMIN_OPERATE_INFO.getCode();
     }
 
@@ -60,5 +59,4 @@ public class AdminOperateReport extends BaseReport {
         this.operateInfo = operateInfo;
     }
 
-
 }

+ 2 - 2
examcloud-support/src/main/java/cn/com/qmth/examcloud/reports/commons/bean/OnlineExamStudentReport.java

@@ -1,7 +1,7 @@
 package cn.com.qmth.examcloud.reports.commons.bean;
 
 import cn.com.qmth.examcloud.reports.commons.enums.Tag;
-import cn.com.qmth.examcloud.reports.commons.enums.Topic;
+import cn.com.qmth.examcloud.reports.commons.util.ReportsUtil;
 
 public class OnlineExamStudentReport extends BaseReport {
 
@@ -55,7 +55,7 @@ public class OnlineExamStudentReport extends BaseReport {
         this.studentId = studentId;
         this.examId = examId;
         this.examStudentId = examStudentId;
-        this.topic = Topic.REPORT_TOPIC.getCode();
+        this.topic = ReportsUtil.getReportTopic();
         this.tag = Tag.ONLINE_EXAM_STUDENT.getCode();
     }
 

+ 2 - 2
examcloud-support/src/main/java/cn/com/qmth/examcloud/reports/commons/bean/OnlineStudentReport.java

@@ -1,7 +1,7 @@
 package cn.com.qmth.examcloud.reports.commons.bean;
 
 import cn.com.qmth.examcloud.reports.commons.enums.Tag;
-import cn.com.qmth.examcloud.reports.commons.enums.Topic;
+import cn.com.qmth.examcloud.reports.commons.util.ReportsUtil;
 
 public class OnlineStudentReport extends BaseReport {
 
@@ -33,7 +33,7 @@ public class OnlineStudentReport extends BaseReport {
         super();
         this.rootOrgId = rootOrgId;
         this.studentId = studentId;
-        this.topic = Topic.REPORT_TOPIC.getCode();
+        this.topic = ReportsUtil.getReportTopic();
         this.tag = Tag.ONLINE_STUDENT.getCode();
     }
 

+ 2 - 2
examcloud-support/src/main/java/cn/com/qmth/examcloud/reports/commons/bean/OnlineUserReport.java

@@ -1,7 +1,7 @@
 package cn.com.qmth.examcloud.reports.commons.bean;
 
 import cn.com.qmth.examcloud.reports.commons.enums.Tag;
-import cn.com.qmth.examcloud.reports.commons.enums.Topic;
+import cn.com.qmth.examcloud.reports.commons.util.ReportsUtil;
 
 public class OnlineUserReport extends BaseReport {
 
@@ -33,7 +33,7 @@ public class OnlineUserReport extends BaseReport {
         super();
         this.rootOrgId = rootOrgId;
         this.userId = userId;
-        this.topic = Topic.REPORT_TOPIC.getCode();
+        this.topic = ReportsUtil.getReportTopic();
         this.tag = Tag.ONLINE_USER.getCode();
     }
 

+ 2 - 2
examcloud-support/src/main/java/cn/com/qmth/examcloud/reports/commons/bean/OperateReport.java

@@ -2,7 +2,7 @@ package cn.com.qmth.examcloud.reports.commons.bean;
 
 import cn.com.qmth.examcloud.api.commons.security.bean.UserType;
 import cn.com.qmth.examcloud.reports.commons.enums.Tag;
-import cn.com.qmth.examcloud.reports.commons.enums.Topic;
+import cn.com.qmth.examcloud.reports.commons.util.ReportsUtil;
 
 public class OperateReport extends BaseReport {
 
@@ -27,7 +27,7 @@ public class OperateReport extends BaseReport {
         this.examStudentId = examStudentId;
         this.operateUserType = operateClient;
         this.operate = operate;
-        this.topic = Topic.REPORT_TOPIC.getCode();
+        this.topic = ReportsUtil.getReportTopic();
         this.tag = Tag.OPERATE_INFO.getCode();
     }
 

+ 0 - 39
examcloud-support/src/main/java/cn/com/qmth/examcloud/reports/commons/enums/Topic.java

@@ -1,39 +0,0 @@
-package cn.com.qmth.examcloud.reports.commons.enums;
-
-public enum Topic {
-
-    /**
-     * 打点通用
-     */
-    REPORT_TOPIC("REPORT_TOPIC", "打点通用");
-
-    // ===========================================================================
-
-    /**
-     * 码
-     */
-    private String code;
-
-    /**
-     * 描述
-     */
-    private String desc;
-
-    /**
-     * 构造函数
-     *
-     * @param desc
-     */
-    private Topic(String code, String desc) {
-        this.code = code;
-        this.desc = desc;
-    }
-
-    public String getDesc() {
-        return desc;
-    }
-
-    public String getCode() {
-        return code;
-    }
-}

+ 10 - 1
examcloud-support/src/main/java/cn/com/qmth/examcloud/reports/commons/util/ReportsUtil.java

@@ -1,5 +1,6 @@
 package cn.com.qmth.examcloud.reports.commons.util;
 
+import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.commons.util.ThreadLocalUtil;
 import cn.com.qmth.examcloud.reports.commons.bean.BaseReport;
 import cn.com.qmth.examcloud.reports.commons.enums.MqType;
@@ -9,6 +10,7 @@ import cn.com.qmth.examcloud.web.support.ServletUtil;
 import com.alibaba.fastjson.JSON;
 import com.aliyun.openservices.ons.api.*;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -53,7 +55,6 @@ public class ReportsUtil {
         }
     }
 
-
     private static void sendReportRocket(Boolean onException) {
         @SuppressWarnings("unchecked")
         List<BaseReport> list = (List<BaseReport>) ThreadLocalUtil.get(KEY);
@@ -64,6 +65,7 @@ public class ReportsUtil {
                         String messageStr = JSON.toJSONString(b);
                         Message msg = new Message(b.getTopic(), b.getTag(), messageStr.getBytes("utf-8"));
                         producer.sendAsync(msg, new SendCallback() {
+
                             @Override
                             public void onSuccess(final SendResult sendResult) {
                                 // 消息发送成功。
@@ -121,4 +123,11 @@ public class ReportsUtil {
         report.setReportTime(new Date());
     }
 
+    public static String getReportTopic() {
+        String topic = PropertyHolder.getString("$report.mq-topic");
+        if (StringUtils.isBlank(topic)) {
+            throw new StatusException("$report.mq-topic 未配置");
+        }
+        return topic;
+    }
 }