Kaynağa Gözat

统一添加操作日志工具类

tags/正式3.13.0
王宁 1 yıl önce
ebeveyn
işleme
87fcf5c450
100 değiştirilmiş dosya ile 1299 ekleme ve 165 silme
  1. 218
    0
      sapi/src/main/java/com/xhkjedu/sapi/aop/WebControllerAop.java
  2. 7
    0
      sapi/src/main/java/com/xhkjedu/sapi/config/ConfigKey.java
  3. 9
    0
      sapi/src/main/java/com/xhkjedu/sapi/config/RabbitConfig.java
  4. 28
    0
      sapi/src/main/java/com/xhkjedu/sapi/listener/HandleLogSender.java
  5. 4
    1
      sapi/src/main/java/com/xhkjedu/sapi/mapper/system/UserMapper.java
  6. 3
    3
      sapi/src/main/java/com/xhkjedu/sapi/service/dock/LcService.java
  7. 8
    0
      sapi/src/main/resources/application.properties
  8. 7
    2
      sapi/src/main/resources/mapper/system/UserMapper.xml
  9. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/SclassApplication.java
  10. 218
    0
      sclass/src/main/java/com/xhkjedu/sclass/aop/WebControllerAop.java
  11. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/config/ConfigKey.java
  12. 24
    0
      sclass/src/main/java/com/xhkjedu/sclass/config/RabbitConfig.java
  13. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/config/ScheduledConfig.java
  14. 11
    11
      sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomController.java
  15. 3
    3
      sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomVideoController.java
  16. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/controller/status/StatusController.java
  17. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/interceptors/HttpServletFilter.java
  18. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestInterceptor.java
  19. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestWrapper.java
  20. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/interceptors/WebMvcConfg.java
  21. 3
    3
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomActivestudentMapper.java
  22. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomAskstudentMapper.java
  23. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomAskteacherMapper.java
  24. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomFileMapper.java
  25. 10
    10
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomMapper.java
  26. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperFileMapper.java
  27. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperMapper.java
  28. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperQtypeMapper.java
  29. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperScantronMapper.java
  30. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperStudentMapper.java
  31. 3
    3
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperStudentScantronMapper.java
  32. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomSignMapper.java
  33. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomVideoMapper.java
  34. 10
    0
      sclass/src/main/java/com/xhkjedu/sclass/mapper/system/UserMapper.java
  35. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroom.java
  36. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomActivestudent.java
  37. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomAskstudent.java
  38. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomAskteacher.java
  39. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomFile.java
  40. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaper.java
  41. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperFile.java
  42. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperQtype.java
  43. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperScantron.java
  44. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperStudent.java
  45. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperStudentScantron.java
  46. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomSign.java
  47. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomVideo.java
  48. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/paperstudent/TPaperStudent.java
  49. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/model/paperstudent/TPaperStudentScantron.java
  50. 28
    0
      sclass/src/main/java/com/xhkjedu/sclass/mq/HandleLogSender.java
  51. 15
    15
      sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomPaperService.java
  52. 7
    7
      sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomService.java
  53. 3
    3
      sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomVideoService.java
  54. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/task/UriMapTask.java
  55. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/utils/ArithUtil.java
  56. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/utils/ClassUtil.java
  57. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ObjectiveAnswerVo.java
  58. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ObjectiveVo.java
  59. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportEQuestionVo.java
  60. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportExamVo.java
  61. 2
    2
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportRoomVo.java
  62. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomAskTeacherVo.java
  63. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectCallVo.java
  64. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectExamVo.java
  65. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectVo.java
  66. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomVo.java
  67. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/SubjectiveVo.java
  68. 3
    3
      sclass/src/main/java/com/xhkjedu/sclass/vo/paper/CheckClassVo.java
  69. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/paper/PaperVo.java
  70. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/paperstudent/StudentVo.java
  71. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/room/RoomPVo.java
  72. 1
    1
      sclass/src/main/java/com/xhkjedu/sclass/vo/room/RoomParamVo.java
  73. 22
    1
      sclass/src/main/resources/application.properties
  74. 1
    1
      sclass/src/main/resources/mapper/classroom/ClassroomActivestudentMapper.xml
  75. 19
    19
      sclass/src/main/resources/mapper/classroom/ClassroomMapper.xml
  76. 2
    2
      sclass/src/main/resources/mapper/classroom/ClassroomPaperFileMapper.xml
  77. 1
    1
      sclass/src/main/resources/mapper/classroom/ClassroomPaperScantronMapper.xml
  78. 1
    1
      sclass/src/main/resources/mapper/classroom/ClassroomPaperStudentMapper.xml
  79. 9
    0
      sclass/src/main/resources/mapper/system/UserMapper.xml
  80. 1
    1
      sclass/src/test/java/com/xhkjedu/sclass/SclassApplicationTests.java
  81. 4
    1
      scommons/src/main/java/com/xhkjedu/vo/system/UserVo.java
  82. 218
    0
      sexam/src/main/java/com/xhkjedu/sexam/aop/WebControllerAop.java
  83. 7
    0
      sexam/src/main/java/com/xhkjedu/sexam/config/ConfigKey.java
  84. 9
    0
      sexam/src/main/java/com/xhkjedu/sexam/config/RabbitConfig.java
  85. 1
    1
      sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java
  86. 28
    0
      sexam/src/main/java/com/xhkjedu/sexam/listener/HandleLogSender.java
  87. 4
    1
      sexam/src/main/java/com/xhkjedu/sexam/mapper/system/UserMapper.java
  88. 1
    1
      sexam/src/main/java/com/xhkjedu/sexam/service/exam/EBaseService.java
  89. 1
    1
      sexam/src/main/java/com/xhkjedu/sexam/service/notice/NoticeService.java
  90. 1
    1
      sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperCorrectTeacherService.java
  91. 1
    1
      sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java
  92. 6
    0
      sexam/src/main/resources/application.properties
  93. 8
    3
      sexam/src/main/resources/mapper/system/UserMapper.xml
  94. 218
    0
      slive/src/main/java/com/xhkjedu/slive/aop/WebControllerAop.java
  95. 9
    0
      slive/src/main/java/com/xhkjedu/slive/config/RabbitConfig.java
  96. 28
    0
      slive/src/main/java/com/xhkjedu/slive/listener/HandleLogSender.java
  97. 5
    0
      slive/src/main/java/com/xhkjedu/slive/mapper/system/UserMapper.java
  98. 2
    0
      slive/src/main/resources/application.properties
  99. 5
    0
      slive/src/main/resources/mapper/system/UserMapper.xml
  100. 0
    0
      slog/src/main/java/com/xhkjedu/slog/SlogApplication.java

+ 218
- 0
sapi/src/main/java/com/xhkjedu/sapi/aop/WebControllerAop.java Dosyayı Görüntüle

@@ -0,0 +1,218 @@
1
+package com.xhkjedu.sapi.aop;
2
+
3
+import com.xhkjedu.annotation.Action;
4
+import com.xhkjedu.constant.PlatformConstant;
5
+import com.xhkjedu.exception.ServiceException;
6
+import com.xhkjedu.model.slog.THandleLog;
7
+import com.xhkjedu.sapi.config.ConfigKey;
8
+import com.xhkjedu.sapi.interceptors.RequestWrapper;
9
+import com.xhkjedu.sapi.mapper.system.UserMapper;
10
+import com.xhkjedu.sapi.listener.HandleLogSender;
11
+import com.xhkjedu.utils.IpRegionUtil;
12
+import com.xhkjedu.utils.N_Utils;
13
+import com.xhkjedu.vo.ResultVo;
14
+import com.xhkjedu.vo.system.UserVo;
15
+import lombok.extern.slf4j.Slf4j;
16
+import org.aspectj.lang.JoinPoint;
17
+import org.aspectj.lang.ProceedingJoinPoint;
18
+import org.aspectj.lang.annotation.*;
19
+import org.aspectj.lang.reflect.MethodSignature;
20
+import org.springframework.stereotype.Component;
21
+import org.springframework.web.context.request.RequestContextHolder;
22
+import org.springframework.web.context.request.ServletRequestAttributes;
23
+
24
+import javax.annotation.Resource;
25
+import javax.servlet.http.HttpServletRequest;
26
+import java.lang.reflect.Method;
27
+
28
+/*
29
+ * @Description: AOP 操作日志
30
+ * @Author: WN
31
+ * @Date: 2023/11/15 18:52:24
32
+ **/
33
+@Aspect
34
+@Component
35
+@Slf4j
36
+public class WebControllerAop {
37
+    @Resource
38
+    private HandleLogSender handleLogSender;
39
+    @Resource
40
+    private UserMapper userMapper;
41
+
42
+    private THandleLog handleLog;
43
+
44
+    /*
45
+     * @Description 指定切点 匹配 使用@Action修饰所有方法
46
+     * @Date 2023/11/15 18:52:48
47
+     * @Author WN
48
+     * @Return void
49
+     **/
50
+    @Pointcut("execution(public * com.xhkjedu.sapi.controller..*.*(..))")
51
+    public void handleLog() {
52
+    }
53
+
54
+    /*
55
+     * @Description 前置通知,方法调用前被调用
56
+     * @Date 2023/11/15 17:46:51
57
+     * @Param [joinPoint]
58
+     **/
59
+    @Before("handleLog()")
60
+    public void doBefore(JoinPoint joinPoint){
61
+
62
+        //获取方法
63
+        Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
64
+        // 获取AspectAnnotation注解
65
+        Action action = method.getAnnotation(Action.class);
66
+        if (action == null) {
67
+            handleLog = null;
68
+            return;
69
+        }
70
+        // 在此处初始化,避免某些方法不用记录报错
71
+        handleLog = new THandleLog();
72
+
73
+        // 获取方法名字
74
+        String value = action.value();
75
+        String[] valueStr = value.split("-");
76
+        // 操作名称
77
+        handleLog.setHandlemodel(valueStr[0]);
78
+        handleLog.setHandleaction(valueStr[1]);
79
+
80
+        if(joinPoint.getArgs() != null && joinPoint.getArgs().length > 0){
81
+            Object[] args = joinPoint.getArgs();
82
+            RequestWrapper st = (RequestWrapper) args[1];
83
+            // 设置请求参数
84
+            handleLog.setHandleparas(st.getBody());
85
+        }
86
+
87
+        try {
88
+            ServletRequestAttributes ss = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
89
+            if (ss != null) {
90
+                HttpServletRequest request = ss.getRequest();
91
+                Integer userid = request.getIntHeader(PlatformConstant.XH_USER_ID);
92
+                // 用户名
93
+                handleLog.setUserid(request.getIntHeader(PlatformConstant.XH_USER_ID));
94
+                handleLog.setDevicetype(request.getHeader(PlatformConstant.XH_DEVICE));
95
+                handleLog.setVersionnum(request.getHeader(PlatformConstant.XH_VERSION));
96
+                // 请求地址
97
+                handleLog.setHandleurl("/sapi" + request.getRequestURI());
98
+
99
+                //获取请求ip并解析区域
100
+                String ip = N_Utils.getIpAddress(request);
101
+                String region = null;
102
+                if (N_Utils.isNotEmpty(ip)) {
103
+                    IpRegionUtil ipRegionUtil = new IpRegionUtil();
104
+                    region = ipRegionUtil.getIpForAddress(ip, ConfigKey.ipregiondb);
105
+                }
106
+                handleLog.setHandleip(ip);
107
+                handleLog.setHandleaddress(region);
108
+                if(N_Utils.isTrueInteger(userid)){
109
+                    UserVo user = userMapper.getUserInfoForHandleLog(userid);
110
+                    if(user != null){
111
+                        handleLog.setUsertype(user.getUsertype());
112
+                        handleLog.setSchoolid(user.getSchoolid());
113
+                        handleLog.setUsername(user.getUsername());
114
+                        handleLog.setLoginname(user.getLoginname());
115
+                        if(N_Utils.isNotEmpty(handleLog.getDevicetype()) && "p_web".equals(handleLog.getDevicetype())){
116
+                            if(user.getUsertype() == 2){
117
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_s");
118
+                            }else{
119
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_t");
120
+                            }
121
+                        }
122
+                    }
123
+                }
124
+            }
125
+        } catch (Exception e) {
126
+            e.printStackTrace();
127
+            throw new ServiceException(e.getMessage());
128
+        }
129
+    }
130
+
131
+    /*
132
+     * @Description 处理完请求返回内容 发送mq消息
133
+     * @Date 2023/11/15 17:47:12
134
+     * @Author WN
135
+     * @Param [ret]
136
+     **/
137
+    @AfterReturning(returning = "ret", pointcut = "handleLog()")
138
+    public void doAfterReturning(Object ret){
139
+        if (ret == null) {
140
+            return;
141
+        }
142
+        if (handleLog == null) {
143
+            return;
144
+        }
145
+
146
+        if (ret instanceof ResultVo) {
147
+            ResultVo result = (ResultVo) ret;
148
+            if (result.getCode() == 0) {
149
+                handleLog.setHandlestate(1);
150
+            } else {
151
+                handleLog.setHandlestate(2);
152
+            }
153
+        }
154
+    }
155
+
156
+    /*
157
+     * @Description  后置异常
158
+     * @Date 2023/11/15 17:47:28
159
+     * @Author WN
160
+     * @Param [jp, e] (JoinPoint jp, Exception e)
161
+     **/
162
+    @AfterThrowing(pointcut = "handleLog()", throwing = "e")
163
+    public void throwss(Exception e) {
164
+
165
+        if (handleLog == null) {
166
+            return;
167
+        }
168
+
169
+        handleLog.setHandlestate(2);
170
+
171
+        log.info("方法异常时执行....." + e.getMessage());
172
+    }
173
+
174
+    /*
175
+     * @Description 后置最终通知,final增强,不管是抛出异常或者正常退出都会执行
176
+     * @Date 2023/11/15 17:49:15
177
+     * @Author WN
178
+     * @Param [jp](JoinPoint jp)
179
+     **/
180
+    @After("handleLog()")
181
+    public void after() {
182
+        if (handleLog == null) {
183
+            return;
184
+        }
185
+        sendOut();
186
+        log.info("后置最终通知");
187
+    }
188
+
189
+    /*
190
+     * @Description 环绕通知,环绕增强,相当于MethodInterceptor
191
+     * @Date 2023/11/15 17:49:34
192
+     * @Author WN
193
+     * @Param [pjp]
194
+     * @Return java.lang.Object
195
+     **/
196
+    @Around("handleLog()")
197
+    public Object arround(ProceedingJoinPoint pjp) {
198
+        try {
199
+            return pjp.proceed();
200
+        } catch (Throwable e) {
201
+            e.printStackTrace();
202
+            if (e instanceof Exception) {
203
+                throw new ServiceException(e.getMessage());
204
+            }
205
+            throw new ServiceException(e.getMessage());
206
+        }
207
+    }
208
+
209
+    /**
210
+     * 发送消息
211
+     */
212
+    public void sendOut() {
213
+        THandleLog logHandlelogNew = handleLog;
214
+        log.info("记录操作日志,给rabbitmq发送消息:" + logHandlelogNew.toString());
215
+        handleLogSender.handleLogSend(handleLog);
216
+    }
217
+
218
+}

+ 7
- 0
sapi/src/main/java/com/xhkjedu/sapi/config/ConfigKey.java Dosyayı Görüntüle

@@ -112,4 +112,11 @@ public class ConfigKey {
112 112
     public void setBuildnum(Integer buildnum){
113 113
         this.buildnum = buildnum;
114 114
     }
115
+
116
+    public static String ipregiondb;//解析ip地址归属地
117
+
118
+    @Value("${ipregiondb}")
119
+    public void setIpregiondb(String ipregiondb){
120
+        ConfigKey.ipregiondb = ipregiondb;
121
+    }
115 122
 }

+ 9
- 0
sapi/src/main/java/com/xhkjedu/sapi/config/RabbitConfig.java Dosyayı Görüntüle

@@ -54,4 +54,13 @@ public class RabbitConfig {
54 54
     public Queue resourceDelQueue2() {
55 55
         return new Queue(resourceDelQueue2);
56 56
     }
57
+
58
+    //生产者mq-操作日志
59
+    @Value("${rabbitmq.handleLogQueue}")
60
+    private String handleLogQueue;
61
+
62
+    @Bean
63
+    public Queue handleLogQueue() {
64
+        return new Queue(handleLogQueue);
65
+    }
57 66
 }

+ 28
- 0
sapi/src/main/java/com/xhkjedu/sapi/listener/HandleLogSender.java Dosyayı Görüntüle

@@ -0,0 +1,28 @@
1
+package com.xhkjedu.sapi.listener;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.model.slog.THandleLog;
5
+import org.springframework.amqp.core.AmqpTemplate;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.beans.factory.annotation.Value;
8
+import org.springframework.stereotype.Component;
9
+
10
+/*
11
+ * @Description: 操作日志
12
+ * @Author: WN
13
+ * @Date: 2023/11/15 16:20:25
14
+ **/
15
+@Component
16
+public class HandleLogSender {
17
+    @Autowired
18
+    private AmqpTemplate rabbitTemplate;
19
+    //生产者mq
20
+    @Value("${rabbitmq.handleLogQueue}")
21
+    private String handleLogQueue;
22
+
23
+    //操作日志
24
+    public void handleLogSend(THandleLog handleLog) {
25
+        rabbitTemplate.convertAndSend(handleLogQueue, JSON.toJSONString(handleLog));
26
+    }
27
+
28
+}

+ 4
- 1
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/UserMapper.java Dosyayı Görüntüle

@@ -2,7 +2,7 @@ package com.xhkjedu.sapi.mapper.system;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4 4
 import com.xhkjedu.sapi.model.system.TUser;
5
-import com.xhkjedu.sapi.vo.system.UserVo;
5
+import com.xhkjedu.vo.system.UserVo;
6 6
 import org.apache.ibatis.annotations.Param;
7 7
 import org.springframework.stereotype.Repository;
8 8
 
@@ -42,4 +42,7 @@ public interface UserMapper extends TkMapper<TUser> {
42 42
 
43 43
     //获取用户信息
44 44
     TUser getUserTypeAndSchool(@Param("userid") Integer userid);
45
+
46
+    //获取用户信息用于操作日志
47
+    UserVo getUserInfoForHandleLog(@Param("userid") Integer userid);
45 48
 }

+ 3
- 3
sapi/src/main/java/com/xhkjedu/sapi/service/dock/LcService.java Dosyayı Görüntüle

@@ -5,12 +5,12 @@ import com.xhkjedu.sapi.config.ConfigKey;
5 5
 import com.xhkjedu.sapi.mapper.system.SchoolMapper;
6 6
 import com.xhkjedu.sapi.mapper.system.UserMapper;
7 7
 import com.xhkjedu.sapi.model.system.TSchool;
8
-import com.xhkjedu.utils.N_Utils;
9
-import com.xhkjedu.vo.ResultVo;
10 8
 import com.xhkjedu.sapi.vo.dock.LcAdminVo;
11 9
 import com.xhkjedu.sapi.vo.dock.LcResultVo;
12 10
 import com.xhkjedu.sapi.vo.dock.LcSchoolVo;
13
-import com.xhkjedu.sapi.vo.system.UserVo;
11
+import com.xhkjedu.utils.N_Utils;
12
+import com.xhkjedu.vo.ResultVo;
13
+import com.xhkjedu.vo.system.UserVo;
14 14
 import lombok.extern.slf4j.Slf4j;
15 15
 import org.springframework.stereotype.Service;
16 16
 

+ 8
- 0
sapi/src/main/resources/application.properties Dosyayı Görüntüle

@@ -50,6 +50,7 @@ spring.redis.jedis.pool.max-active=60000
50 50
 redisdatatime=18000
51 51
 #secretKey必须为24位
52 52
 secretKey=nanhuakaizhangjianwangni
53
+
53 54
 #消费者mq
54 55
 rabbitmq.researchHandleQueue=xhkjedutest.xhschool.researchHandleQueue_dev
55 56
 #负载一生产者mq
@@ -58,6 +59,10 @@ rabbitmq.resourceDelQueue=xhkjedutest.xhschool.resourceDelQueue_node01_dev
58 59
 #负载二生产者mq
59 60
 rabbitmq.researchTransferQueue2=xhkjedutest.xhschool.researchTransferQueue_node02_dev
60 61
 rabbitmq.resourceDelQueue2=xhkjedutest.xhschool.resourceDelQueue_node02_dev
62
+
63
+#操作日志生产者
64
+rabbitmq.handleLogQueue=xhkjedutest.xhschool.handleLogQueue_dev
65
+
61 66
 spring.rabbitmq.host=49.4.26.249
62 67
 spring.rabbitmq.port=5672
63 68
 spring.rabbitmq.username=xhkjedu
@@ -106,6 +111,9 @@ cron.syncnum=100
106 111
 #每隔3s清除一下请求地址map
107 112
 cron.deleteUriMap=0/3 * * * * ?
108 113
 
114
+#解析ip归属地数据
115
+ipregiondb=D:\\school\\ip2region.xdb
116
+
109 117
 #白名单接口
110 118
 whitelistAPI=/get_new,/stype/list,/cloud/detail,/school/detail,/sanalyze/,/sr/,/ranalyze/,/rr/,/status/info
111 119
 

+ 7
- 2
sapi/src/main/resources/mapper/system/UserMapper.xml Dosyayı Görüntüle

@@ -28,9 +28,8 @@
28 28
         </foreach>
29 29
     </update>
30 30
 
31
-
32 31
     <!--获取学校管理员-->
33
-    <select id="getSchoolAdminBySchoolid" resultType="com.xhkjedu.sapi.vo.system.UserVo">
32
+    <select id="getSchoolAdminBySchoolid" resultType="com.xhkjedu.vo.system.UserVo">
34 33
         select userid,username,loginname,loginpwd from t_user where schoolid=#{schoolid}
35 34
         and usertype=0 and userstate=1 order by userid limit 1
36 35
     </select>
@@ -48,4 +47,10 @@
48 47
     <select id="getUserTypeAndSchool" resultType="com.xhkjedu.sapi.model.system.TUser">
49 48
         select usertype,schoolid from t_user where userid=#{userid}
50 49
     </select>
50
+
51
+    <!--获取用户信息用于操作日志-->
52
+    <select id="getUserInfoForHandleLog" resultType="com.xhkjedu.vo.system.UserVo">
53
+        select userid,username,loginname,usertype,schoolid from t_user where userid=#{userid}
54
+    </select>
55
+
51 56
 </mapper>

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/SclassApplication.java Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1
-package com.xhkjedu.slog;
1
+package com.xhkjedu.sclass;
2 2
 
3
-import com.xhkjedu.slog.config.ConfigKey;
3
+import com.xhkjedu.sclass.config.ConfigKey;
4 4
 import org.springframework.boot.SpringApplication;
5 5
 import org.springframework.boot.autoconfigure.SpringBootApplication;
6 6
 import tk.mybatis.spring.annotation.MapperScan;

+ 218
- 0
sclass/src/main/java/com/xhkjedu/sclass/aop/WebControllerAop.java Dosyayı Görüntüle

@@ -0,0 +1,218 @@
1
+package com.xhkjedu.sclass.aop;
2
+
3
+import com.xhkjedu.annotation.Action;
4
+import com.xhkjedu.constant.PlatformConstant;
5
+import com.xhkjedu.exception.ServiceException;
6
+import com.xhkjedu.model.slog.THandleLog;
7
+import com.xhkjedu.sclass.config.ConfigKey;
8
+import com.xhkjedu.sclass.interceptors.RequestWrapper;
9
+import com.xhkjedu.sclass.mq.HandleLogSender;
10
+import com.xhkjedu.sclass.mapper.system.UserMapper;
11
+import com.xhkjedu.utils.IpRegionUtil;
12
+import com.xhkjedu.utils.N_Utils;
13
+import com.xhkjedu.vo.ResultVo;
14
+import com.xhkjedu.vo.system.UserVo;
15
+import lombok.extern.slf4j.Slf4j;
16
+import org.aspectj.lang.JoinPoint;
17
+import org.aspectj.lang.ProceedingJoinPoint;
18
+import org.aspectj.lang.annotation.*;
19
+import org.aspectj.lang.reflect.MethodSignature;
20
+import org.springframework.stereotype.Component;
21
+import org.springframework.web.context.request.RequestContextHolder;
22
+import org.springframework.web.context.request.ServletRequestAttributes;
23
+
24
+import javax.annotation.Resource;
25
+import javax.servlet.http.HttpServletRequest;
26
+import java.lang.reflect.Method;
27
+
28
+/*
29
+ * @Description: AOP 操作日志
30
+ * @Author: WN
31
+ * @Date: 2023/11/15 18:52:24
32
+ **/
33
+@Aspect
34
+@Component
35
+@Slf4j
36
+public class WebControllerAop {
37
+    @Resource
38
+    private HandleLogSender handleLogSender;
39
+    @Resource
40
+    private UserMapper userMapper;
41
+
42
+    private THandleLog handleLog;
43
+
44
+    /*
45
+     * @Description 指定切点 匹配 使用@Action修饰所有方法
46
+     * @Date 2023/11/15 18:52:48
47
+     * @Author WN
48
+     * @Return void
49
+     **/
50
+    @Pointcut("execution(public * com.xhkjedu.sclass.controller..*.*(..))")
51
+    public void handleLog() {
52
+    }
53
+
54
+    /*
55
+     * @Description 前置通知,方法调用前被调用
56
+     * @Date 2023/11/15 17:46:51
57
+     * @Param [joinPoint]
58
+     **/
59
+    @Before("handleLog()")
60
+    public void doBefore(JoinPoint joinPoint){
61
+
62
+        //获取方法
63
+        Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
64
+        // 获取AspectAnnotation注解
65
+        Action action = method.getAnnotation(Action.class);
66
+        if (action == null) {
67
+            handleLog = null;
68
+            return;
69
+        }
70
+        // 在此处初始化,避免某些方法不用记录报错
71
+        handleLog = new THandleLog();
72
+
73
+        // 获取方法名字
74
+        String value = action.value();
75
+        String[] valueStr = value.split("-");
76
+        // 操作名称
77
+        handleLog.setHandlemodel(valueStr[0]);
78
+        handleLog.setHandleaction(valueStr[1]);
79
+
80
+        if(joinPoint.getArgs() != null && joinPoint.getArgs().length > 0){
81
+            Object[] args = joinPoint.getArgs();
82
+            RequestWrapper st = (RequestWrapper) args[1];
83
+            // 设置请求参数
84
+            handleLog.setHandleparas(st.getBody());
85
+        }
86
+
87
+        try {
88
+            ServletRequestAttributes ss = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
89
+            if (ss != null) {
90
+                HttpServletRequest request = ss.getRequest();
91
+                Integer userid = request.getIntHeader(PlatformConstant.XH_USER_ID);
92
+                // 用户名
93
+                handleLog.setUserid(request.getIntHeader(PlatformConstant.XH_USER_ID));
94
+                handleLog.setDevicetype(request.getHeader(PlatformConstant.XH_DEVICE));
95
+                handleLog.setVersionnum(request.getHeader(PlatformConstant.XH_VERSION));
96
+                // 请求地址
97
+                handleLog.setHandleurl("/sclass" + request.getRequestURI());
98
+
99
+                //获取请求ip并解析区域
100
+                String ip = N_Utils.getIpAddress(request);
101
+                String region = null;
102
+                if (N_Utils.isNotEmpty(ip)) {
103
+                    IpRegionUtil ipRegionUtil = new IpRegionUtil();
104
+                    region = ipRegionUtil.getIpForAddress(ip, ConfigKey.ipregiondb);
105
+                }
106
+                handleLog.setHandleip(ip);
107
+                handleLog.setHandleaddress(region);
108
+                if(N_Utils.isTrueInteger(userid)){
109
+                    UserVo user = userMapper.getUserInfoForHandleLog(userid);
110
+                    if(user != null){
111
+                        handleLog.setUsertype(user.getUsertype());
112
+                        handleLog.setSchoolid(user.getSchoolid());
113
+                        handleLog.setUsername(user.getUsername());
114
+                        handleLog.setLoginname(user.getLoginname());
115
+                        if(N_Utils.isNotEmpty(handleLog.getDevicetype()) && "p_web".equals(handleLog.getDevicetype())){
116
+                            if(user.getUsertype() == 2){
117
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_s");
118
+                            }else{
119
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_t");
120
+                            }
121
+                        }
122
+                    }
123
+                }
124
+            }
125
+        } catch (Exception e) {
126
+            e.printStackTrace();
127
+            throw new ServiceException(e.getMessage());
128
+        }
129
+    }
130
+
131
+    /*
132
+     * @Description 处理完请求返回内容 发送mq消息
133
+     * @Date 2023/11/15 17:47:12
134
+     * @Author WN
135
+     * @Param [ret]
136
+     **/
137
+    @AfterReturning(returning = "ret", pointcut = "handleLog()")
138
+    public void doAfterReturning(Object ret){
139
+        if (ret == null) {
140
+            return;
141
+        }
142
+        if (handleLog == null) {
143
+            return;
144
+        }
145
+
146
+        if (ret instanceof ResultVo) {
147
+            ResultVo result = (ResultVo) ret;
148
+            if (result.getCode() == 0) {
149
+                handleLog.setHandlestate(1);
150
+            } else {
151
+                handleLog.setHandlestate(2);
152
+            }
153
+        }
154
+    }
155
+
156
+    /*
157
+     * @Description  后置异常
158
+     * @Date 2023/11/15 17:47:28
159
+     * @Author WN
160
+     * @Param [jp, e] (JoinPoint jp, Exception e)
161
+     **/
162
+    @AfterThrowing(pointcut = "handleLog()", throwing = "e")
163
+    public void throwss(Exception e) {
164
+
165
+        if (handleLog == null) {
166
+            return;
167
+        }
168
+
169
+        handleLog.setHandlestate(2);
170
+
171
+        log.info("方法异常时执行....." + e.getMessage());
172
+    }
173
+
174
+    /*
175
+     * @Description 后置最终通知,final增强,不管是抛出异常或者正常退出都会执行
176
+     * @Date 2023/11/15 17:49:15
177
+     * @Author WN
178
+     * @Param [jp](JoinPoint jp)
179
+     **/
180
+    @After("handleLog()")
181
+    public void after() {
182
+        if (handleLog == null) {
183
+            return;
184
+        }
185
+        sendOut();
186
+        log.info("后置最终通知");
187
+    }
188
+
189
+    /*
190
+     * @Description 环绕通知,环绕增强,相当于MethodInterceptor
191
+     * @Date 2023/11/15 17:49:34
192
+     * @Author WN
193
+     * @Param [pjp]
194
+     * @Return java.lang.Object
195
+     **/
196
+    @Around("handleLog()")
197
+    public Object arround(ProceedingJoinPoint pjp) {
198
+        try {
199
+            return pjp.proceed();
200
+        } catch (Throwable e) {
201
+            e.printStackTrace();
202
+            if (e instanceof Exception) {
203
+                throw new ServiceException(e.getMessage());
204
+            }
205
+            throw new ServiceException(e.getMessage());
206
+        }
207
+    }
208
+
209
+    /**
210
+     * 发送消息
211
+     */
212
+    public void sendOut() {
213
+        THandleLog logHandlelogNew = handleLog;
214
+        log.info("记录操作日志,给rabbitmq发送消息:" + logHandlelogNew.toString());
215
+        handleLogSender.handleLogSend(handleLog);
216
+    }
217
+
218
+}

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/config/ConfigKey.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.config;
1
+package com.xhkjedu.sclass.config;
2 2
 
3 3
 import org.springframework.beans.factory.annotation.Value;
4 4
 import org.springframework.stereotype.Component;

+ 24
- 0
sclass/src/main/java/com/xhkjedu/sclass/config/RabbitConfig.java Dosyayı Görüntüle

@@ -0,0 +1,24 @@
1
+package com.xhkjedu.sclass.config;
2
+
3
+import org.springframework.amqp.core.Queue;
4
+import org.springframework.beans.factory.annotation.Value;
5
+import org.springframework.context.annotation.Bean;
6
+import org.springframework.context.annotation.Configuration;
7
+
8
+/*
9
+ * @Description: mq配置
10
+ * @Author: WN
11
+ * @Date: 2023/11/16 9:28:45
12
+ **/
13
+@Configuration
14
+public class RabbitConfig {
15
+
16
+    //生产者mq-操作日志
17
+    @Value("${rabbitmq.handleLogQueue}")
18
+    private String handleLogQueue;
19
+
20
+    @Bean
21
+    public Queue handleLogQueue() {
22
+        return new Queue(handleLogQueue);
23
+    }
24
+}

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/config/ScheduledConfig.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.config;
1
+package com.xhkjedu.sclass.config;
2 2
 
3 3
 import org.springframework.context.annotation.Bean;
4 4
 import org.springframework.context.annotation.Condition;

+ 11
- 11
sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomController.java Dosyayı Görüntüle

@@ -1,18 +1,18 @@
1
-package com.xhkjedu.slog.controller.classroom;
1
+package com.xhkjedu.sclass.controller.classroom;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4 4
 import com.github.pagehelper.PageHelper;
5 5
 import com.github.pagehelper.PageInfo;
6
-import com.xhkjedu.slog.model.classroom.*;
7
-import com.xhkjedu.slog.model.paperstudent.TPaperStudent;
8
-import com.xhkjedu.slog.model.paperstudent.TPaperStudentScantron;
9
-import com.xhkjedu.slog.service.classroom.ClassroomPaperService;
10
-import com.xhkjedu.slog.service.classroom.ClassroomService;
11
-import com.xhkjedu.slog.vo.classroom.*;
12
-import com.xhkjedu.slog.vo.paper.CheckClassVo;
13
-import com.xhkjedu.slog.vo.paperstudent.StudentVo;
14
-import com.xhkjedu.slog.vo.room.RoomPVo;
15
-import com.xhkjedu.slog.vo.room.RoomParamVo;
6
+import com.xhkjedu.sclass.model.classroom.*;
7
+import com.xhkjedu.sclass.model.paperstudent.TPaperStudent;
8
+import com.xhkjedu.sclass.model.paperstudent.TPaperStudentScantron;
9
+import com.xhkjedu.sclass.service.classroom.ClassroomPaperService;
10
+import com.xhkjedu.sclass.service.classroom.ClassroomService;
11
+import com.xhkjedu.sclass.vo.classroom.*;
12
+import com.xhkjedu.sclass.vo.paper.CheckClassVo;
13
+import com.xhkjedu.sclass.vo.paperstudent.StudentVo;
14
+import com.xhkjedu.sclass.vo.room.RoomPVo;
15
+import com.xhkjedu.sclass.vo.room.RoomParamVo;
16 16
 import com.xhkjedu.utils.N_Utils;
17 17
 import com.xhkjedu.utils.PageUtil;
18 18
 import com.xhkjedu.vo.PageResult;

+ 3
- 3
sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomVideoController.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.controller.classroom;
1
+package com.xhkjedu.sclass.controller.classroom;
2 2
 
3
-import com.xhkjedu.slog.model.classroom.TClassroomVideo;
4
-import com.xhkjedu.slog.service.classroom.ClassroomVideoService;
3
+import com.xhkjedu.sclass.model.classroom.TClassroomVideo;
4
+import com.xhkjedu.sclass.service.classroom.ClassroomVideoService;
5 5
 import com.xhkjedu.utils.N_Utils;
6 6
 import com.xhkjedu.vo.ResultVo;
7 7
 import org.springframework.web.bind.annotation.PostMapping;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/controller/status/StatusController.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.controller.status;
1
+package com.xhkjedu.sclass.controller.status;
2 2
 
3 3
 import com.xhkjedu.vo.ResultVo;
4 4
 import org.springframework.web.bind.annotation.GetMapping;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/interceptors/HttpServletFilter.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.interceptors;
1
+package com.xhkjedu.sclass.interceptors;
2 2
 
3 3
 import org.springframework.stereotype.Component;
4 4
 

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestInterceptor.java Dosyayı Görüntüle

@@ -1,8 +1,8 @@
1
-package com.xhkjedu.slog.interceptors;
1
+package com.xhkjedu.sclass.interceptors;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4 4
 import com.xhkjedu.exception.MissingParametersException;
5
-import com.xhkjedu.slog.utils.ClassUtil;
5
+import com.xhkjedu.sclass.utils.ClassUtil;
6 6
 import com.xhkjedu.utils.JedisUtil;
7 7
 import com.xhkjedu.utils.N_Utils;
8 8
 import com.xhkjedu.vo.ResultVo;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestWrapper.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.interceptors;
1
+package com.xhkjedu.sclass.interceptors;
2 2
 
3 3
 import lombok.extern.slf4j.Slf4j;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/interceptors/WebMvcConfg.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.interceptors;
1
+package com.xhkjedu.sclass.interceptors;
2 2
 
3 3
 import org.springframework.beans.factory.annotation.Autowired;
4 4
 import org.springframework.boot.web.servlet.FilterRegistrationBean;

+ 3
- 3
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomActivestudentMapper.java Dosyayı Görüntüle

@@ -1,8 +1,8 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroom;
5
-import com.xhkjedu.slog.model.classroom.TClassroomActivestudent;
4
+import com.xhkjedu.sclass.model.classroom.TClassroom;
5
+import com.xhkjedu.sclass.model.classroom.TClassroomActivestudent;
6 6
 import org.apache.ibatis.annotations.Param;
7 7
 
8 8
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomAskstudentMapper.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomAskstudent;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomAskstudent;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 public interface ClassroomAskstudentMapper extends TkMapper<TClassroomAskstudent> {

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomAskteacherMapper.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomAskteacher;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomAskteacher;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomFileMapper.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomFile;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomFile;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 public interface ClassroomFileMapper extends TkMapper<TClassroomFile> {

+ 10
- 10
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomMapper.java Dosyayı Görüntüle

@@ -1,15 +1,15 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroom;
5
-import com.xhkjedu.slog.model.classroom.TClassroomFile;
6
-import com.xhkjedu.slog.vo.classroom.ObjectiveVo;
7
-import com.xhkjedu.slog.vo.classroom.ReportEQuestionVo;
8
-import com.xhkjedu.slog.vo.classroom.ReportExamVo;
9
-import com.xhkjedu.slog.vo.classroom.ReportRoomVo;
10
-import com.xhkjedu.slog.vo.classroom.RoomCorrectVo;
11
-import com.xhkjedu.slog.vo.classroom.SubjectiveVo;
12
-import com.xhkjedu.slog.vo.paper.CheckClassVo;
4
+import com.xhkjedu.sclass.model.classroom.TClassroom;
5
+import com.xhkjedu.sclass.model.classroom.TClassroomFile;
6
+import com.xhkjedu.sclass.vo.classroom.ObjectiveVo;
7
+import com.xhkjedu.sclass.vo.classroom.ReportEQuestionVo;
8
+import com.xhkjedu.sclass.vo.classroom.ReportExamVo;
9
+import com.xhkjedu.sclass.vo.classroom.ReportRoomVo;
10
+import com.xhkjedu.sclass.vo.classroom.RoomCorrectVo;
11
+import com.xhkjedu.sclass.vo.classroom.SubjectiveVo;
12
+import com.xhkjedu.sclass.vo.paper.CheckClassVo;
13 13
 import org.apache.ibatis.annotations.Param;
14 14
 
15 15
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperFileMapper.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomPaperFile;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperFile;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperMapper.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomPaper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaper;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperQtypeMapper.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomPaperQtype;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperQtype;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperScantronMapper.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomPaperScantron;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperScantron;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperStudentMapper.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomPaperStudent;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperStudent;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 import java.util.List;

+ 3
- 3
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperStudentScantronMapper.java Dosyayı Görüntüle

@@ -1,8 +1,8 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomPaperStudentScantron;
5
-import com.xhkjedu.slog.model.paperstudent.TPaperStudentScantron;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperStudentScantron;
5
+import com.xhkjedu.sclass.model.paperstudent.TPaperStudentScantron;
6 6
 import org.apache.ibatis.annotations.Param;
7 7
 
8 8
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomSignMapper.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomSign;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomSign;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomVideoMapper.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2 2
 
3 3
 import com.xhkjedu.base.TkMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomVideo;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomVideo;
5 5
 import org.apache.ibatis.annotations.Param;
6 6
 
7 7
 import java.util.List;

+ 10
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/system/UserMapper.java Dosyayı Görüntüle

@@ -0,0 +1,10 @@
1
+package com.xhkjedu.sclass.mapper.system;
2
+
3
+import com.xhkjedu.vo.system.UserVo;
4
+import org.apache.ibatis.annotations.Param;
5
+
6
+public interface UserMapper {
7
+
8
+    //获取用户信息用于操作日志
9
+    UserVo getUserInfoForHandleLog(@Param("userid") Integer userid);
10
+}

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroom.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomActivestudent.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomAskstudent.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomAskteacher.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomFile.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaper.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperFile.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperQtype.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperScantron.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperStudent.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperStudentScantron.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomSign.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomVideo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.classroom;
1
+package com.xhkjedu.sclass.model.classroom;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/paperstudent/TPaperStudent.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.paperstudent;
1
+package com.xhkjedu.sclass.model.paperstudent;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/paperstudent/TPaperStudentScantron.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.model.paperstudent;
1
+package com.xhkjedu.sclass.model.paperstudent;
2 2
 
3 3
 import com.xhkjedu.model.BaseBean;
4 4
 import lombok.Data;

+ 28
- 0
sclass/src/main/java/com/xhkjedu/sclass/mq/HandleLogSender.java Dosyayı Görüntüle

@@ -0,0 +1,28 @@
1
+package com.xhkjedu.sclass.mq;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.model.slog.THandleLog;
5
+import org.springframework.amqp.core.AmqpTemplate;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.beans.factory.annotation.Value;
8
+import org.springframework.stereotype.Component;
9
+
10
+/*
11
+ * @Description: 操作日志
12
+ * @Author: WN
13
+ * @Date: 2023/11/15 16:20:25
14
+ **/
15
+@Component
16
+public class HandleLogSender {
17
+    @Autowired
18
+    private AmqpTemplate rabbitTemplate;
19
+    //生产者mq
20
+    @Value("${rabbitmq.handleLogQueue}")
21
+    private String handleLogQueue;
22
+
23
+    //操作日志
24
+    public void handleLogSend(THandleLog handleLog) {
25
+        rabbitTemplate.convertAndSend(handleLogQueue, JSON.toJSONString(handleLog));
26
+    }
27
+
28
+}

+ 15
- 15
sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomPaperService.java Dosyayı Görüntüle

@@ -1,20 +1,20 @@
1
-package com.xhkjedu.slog.service.classroom;
1
+package com.xhkjedu.sclass.service.classroom;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4
-import com.xhkjedu.slog.mapper.classroom.ClassroomPaperFileMapper;
5
-import com.xhkjedu.slog.mapper.classroom.ClassroomPaperMapper;
6
-import com.xhkjedu.slog.mapper.classroom.ClassroomPaperQtypeMapper;
7
-import com.xhkjedu.slog.mapper.classroom.ClassroomPaperScantronMapper;
8
-import com.xhkjedu.slog.mapper.classroom.ClassroomPaperStudentMapper;
9
-import com.xhkjedu.slog.mapper.classroom.ClassroomPaperStudentScantronMapper;
10
-import com.xhkjedu.slog.model.classroom.TClassroomPaper;
11
-import com.xhkjedu.slog.model.classroom.TClassroomPaperFile;
12
-import com.xhkjedu.slog.model.classroom.TClassroomPaperQtype;
13
-import com.xhkjedu.slog.model.classroom.TClassroomPaperScantron;
14
-import com.xhkjedu.slog.model.classroom.TClassroomPaperStudent;
15
-import com.xhkjedu.slog.model.classroom.TClassroomPaperStudentScantron;
16
-import com.xhkjedu.slog.model.paperstudent.TPaperStudentScantron;
17
-import com.xhkjedu.slog.utils.ArithUtil;
4
+import com.xhkjedu.sclass.mapper.classroom.ClassroomPaperFileMapper;
5
+import com.xhkjedu.sclass.mapper.classroom.ClassroomPaperMapper;
6
+import com.xhkjedu.sclass.mapper.classroom.ClassroomPaperQtypeMapper;
7
+import com.xhkjedu.sclass.mapper.classroom.ClassroomPaperScantronMapper;
8
+import com.xhkjedu.sclass.mapper.classroom.ClassroomPaperStudentMapper;
9
+import com.xhkjedu.sclass.mapper.classroom.ClassroomPaperStudentScantronMapper;
10
+import com.xhkjedu.sclass.model.classroom.TClassroomPaper;
11
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperFile;
12
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperQtype;
13
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperScantron;
14
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperStudent;
15
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperStudentScantron;
16
+import com.xhkjedu.sclass.model.paperstudent.TPaperStudentScantron;
17
+import com.xhkjedu.sclass.utils.ArithUtil;
18 18
 import com.xhkjedu.utils.N_Utils;
19 19
 import lombok.extern.slf4j.Slf4j;
20 20
 import org.springframework.stereotype.Service;

+ 7
- 7
sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomService.java Dosyayı Görüntüle

@@ -1,12 +1,12 @@
1
-package com.xhkjedu.slog.service.classroom;
1
+package com.xhkjedu.sclass.service.classroom;
2 2
 
3 3
 import com.alibaba.fastjson.JSON;
4
-import com.xhkjedu.slog.mapper.classroom.*;
5
-import com.xhkjedu.slog.model.classroom.*;
6
-import com.xhkjedu.slog.utils.ArithUtil;
7
-import com.xhkjedu.slog.vo.classroom.*;
8
-import com.xhkjedu.slog.vo.paper.CheckClassVo;
9
-import com.xhkjedu.slog.vo.room.RoomParamVo;
4
+import com.xhkjedu.sclass.mapper.classroom.*;
5
+import com.xhkjedu.sclass.model.classroom.*;
6
+import com.xhkjedu.sclass.utils.ArithUtil;
7
+import com.xhkjedu.sclass.vo.classroom.*;
8
+import com.xhkjedu.sclass.vo.paper.CheckClassVo;
9
+import com.xhkjedu.sclass.vo.room.RoomParamVo;
10 10
 import com.xhkjedu.utils.N_Utils;
11 11
 import com.xhkjedu.vo.ResultVo;
12 12
 import lombok.extern.slf4j.Slf4j;

+ 3
- 3
sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomVideoService.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.service.classroom;
1
+package com.xhkjedu.sclass.service.classroom;
2 2
 
3
-import com.xhkjedu.slog.mapper.classroom.ClassroomVideoMapper;
4
-import com.xhkjedu.slog.model.classroom.TClassroomVideo;
3
+import com.xhkjedu.sclass.mapper.classroom.ClassroomVideoMapper;
4
+import com.xhkjedu.sclass.model.classroom.TClassroomVideo;
5 5
 import com.xhkjedu.utils.N_Utils;
6 6
 import org.springframework.stereotype.Service;
7 7
 

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/task/UriMapTask.java Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1
-package com.xhkjedu.slog.task;
1
+package com.xhkjedu.sclass.task;
2 2
 
3
-import com.xhkjedu.slog.utils.ClassUtil;
3
+import com.xhkjedu.sclass.utils.ClassUtil;
4 4
 import org.springframework.scheduling.annotation.Scheduled;
5 5
 import org.springframework.stereotype.Component;
6 6
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/utils/ArithUtil.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.utils;
1
+package com.xhkjedu.sclass.utils;
2 2
 
3 3
 import java.math.BigDecimal;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/utils/ClassUtil.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.utils;
1
+package com.xhkjedu.sclass.utils;
2 2
 
3 3
 import java.util.Map;
4 4
 import java.util.concurrent.ConcurrentHashMap;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ObjectiveAnswerVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.classroom;
1
+package com.xhkjedu.sclass.vo.classroom;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ObjectiveVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.classroom;
1
+package com.xhkjedu.sclass.vo.classroom;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportEQuestionVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.classroom;
1
+package com.xhkjedu.sclass.vo.classroom;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportExamVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.classroom;
1
+package com.xhkjedu.sclass.vo.classroom;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportRoomVo.java Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1
-package com.xhkjedu.slog.vo.classroom;
1
+package com.xhkjedu.sclass.vo.classroom;
2 2
 
3
-import com.xhkjedu.slog.model.classroom.TClassroomFile;
3
+import com.xhkjedu.sclass.model.classroom.TClassroomFile;
4 4
 import lombok.Data;
5 5
 
6 6
 import java.util.List;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomAskTeacherVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.classroom;
1
+package com.xhkjedu.sclass.vo.classroom;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectCallVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.classroom;
1
+package com.xhkjedu.sclass.vo.classroom;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectExamVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.classroom;
1
+package com.xhkjedu.sclass.vo.classroom;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.classroom;
1
+package com.xhkjedu.sclass.vo.classroom;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.classroom;
1
+package com.xhkjedu.sclass.vo.classroom;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/SubjectiveVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.classroom;
1
+package com.xhkjedu.sclass.vo.classroom;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 3
- 3
sclass/src/main/java/com/xhkjedu/sclass/vo/paper/CheckClassVo.java Dosyayı Görüntüle

@@ -1,7 +1,7 @@
1
-package com.xhkjedu.slog.vo.paper;
1
+package com.xhkjedu.sclass.vo.paper;
2 2
 
3
-import com.xhkjedu.slog.model.classroom.TClassroomPaperFile;
4
-import com.xhkjedu.slog.vo.paperstudent.StudentVo;
3
+import com.xhkjedu.sclass.model.classroom.TClassroomPaperFile;
4
+import com.xhkjedu.sclass.vo.paperstudent.StudentVo;
5 5
 import lombok.Data;
6 6
 
7 7
 import java.util.List;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/paper/PaperVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.paper;
1
+package com.xhkjedu.sclass.vo.paper;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/paperstudent/StudentVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.paperstudent;
1
+package com.xhkjedu.sclass.vo.paperstudent;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/room/RoomPVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.room;
1
+package com.xhkjedu.sclass.vo.room;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/room/RoomParamVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog.vo.room;
1
+package com.xhkjedu.sclass.vo.room;
2 2
 
3 3
 import lombok.Data;
4 4
 

+ 22
- 1
sclass/src/main/resources/application.properties Dosyayı Görüntüle

@@ -37,7 +37,7 @@ mapper.mappers=com.xhkjedu.base.TkMapper
37 37
 mybatis.configuration.call-setters-on-nulls=true
38 38
 mapper.identity=MYSQL
39 39
 #打印日志
40
-logging.level.com.xhkjedu.slog.mapper=debug
40
+logging.level.com.xhkjedu.sclass.mapper=debug
41 41
 #分页
42 42
 spring.pagehelper.helper-dialect=mysql
43 43
 
@@ -57,12 +57,33 @@ redisdatatime=18000
57 57
 #secretKey必须为24位
58 58
 secretKey=nanhuakaizhangjianwangni
59 59
 
60
+#操作日志生产者
61
+rabbitmq.handleLogQueue=xhkjedutest.xhschool.handleLogQueue_dev
62
+spring.rabbitmq.host=49.4.26.249
63
+spring.rabbitmq.port=5672
64
+spring.rabbitmq.username=xhkjedu
65
+spring.rabbitmq.password=xhkjedud07
66
+spring.rabbitmq.connection-timeout=15000
67
+#rabbitmq自动签收
68
+spring.rabbitmq.listener.simple.acknowledge-mode=auto
69
+# 是否开启消费者重试(为false时关闭消费者重试)
70
+spring.rabbitmq.listener.simple.retry.enabled=true
71
+# 最大重试重新投递消息次数
72
+spring.rabbitmq.listener.simple.retry.max-attempts=3
73
+# 重试重新投递消息的间隔时间(单位毫秒)
74
+spring.rabbitmq.listener.simple.retry.initial-interval=30000ms
75
+#重试次数超过上面的设置之后,是否丢弃(消费者listener抛出异常,是否重回队列(默认true:重回队列,false:不重回队列(可结合死信交换机))
76
+spring.rabbitmq.listener.simple.default-requeue-rejected=false
77
+
60 78
 #定时任务
61 79
 #默认为false,不开启定时任务
62 80
 enable.scheduled=false
63 81
 #每隔3s清除一下请求地址map
64 82
 cron.deleteUriMap=0/3 * * * * ?
65 83
 
84
+#解析ip归属地数据
85
+ipregiondb=D:\\school\\ip2region.xdb
86
+
66 87
 #白名单接口
67 88
 whitelistAPI=/status/info
68 89
 

+ 1
- 1
sclass/src/main/resources/mapper/classroom/ClassroomActivestudentMapper.xml Dosyayı Görüntüle

@@ -48,7 +48,7 @@
48 48
         select group_concat(asktid) from t_classroom_askteacher where roomid=#{roomid}
49 49
     </select>
50 50
     <!--课堂学生-->
51
-    <select id="listRoomStu" resultType="com.xhkjedu.slog.model.classroom.TClassroomActivestudent">
51
+    <select id="listRoomStu" resultType="com.xhkjedu.sclass.model.classroom.TClassroomActivestudent">
52 52
         select cs.studentid,(
53 53
             (select count(distinct s.userid) from t_classroom_sign s where s.roomid=#{roomid} and s.userid=cs.studentid)
54 54
         <if test="asktids!=null and asktids!=''">

+ 19
- 19
sclass/src/main/resources/mapper/classroom/ClassroomMapper.xml Dosyayı Görüntüle

@@ -16,7 +16,7 @@
16 16
         where r.roomid=#{roomid};
17 17
     </select>
18 18
     <!--获取批阅信息-->
19
-    <resultMap id="correctResult" type="com.xhkjedu.slog.vo.classroom.RoomCorrectVo">
19
+    <resultMap id="correctResult" type="com.xhkjedu.sclass.vo.classroom.RoomCorrectVo">
20 20
         <result property="roomid" column="roomid"></result>
21 21
         <result property="roomname" column="roomname"></result>
22 22
         <result property="createtime" column="createtime"></result>
@@ -24,21 +24,21 @@
24 24
         <result property="classname" column="classname"></result>
25 25
         <result property="gradeid" column="gradeid"></result>
26 26
         <result property="teachername" column="teachername"></result>
27
-        <collection property="calls" ofType="com.xhkjedu.slog.vo.classroom.RoomCorrectCallVo"
27
+        <collection property="calls" ofType="com.xhkjedu.sclass.vo.classroom.RoomCorrectCallVo"
28 28
                     select="listCall" column="{roomid=roomid,realstunum=realstunum}">
29 29
         </collection>
30
-        <collection property="exams" ofType="com.xhkjedu.slog.vo.classroom.RoomCorrectExamVo"
30
+        <collection property="exams" ofType="com.xhkjedu.sclass.vo.classroom.RoomCorrectExamVo"
31 31
                     select="listExam" column="{roomid=roomid,realstunum=realstunum}">
32 32
         </collection>
33 33
     </resultMap>
34
-    <select id="listCall" resultType="com.xhkjedu.slog.vo.classroom.RoomCorrectCallVo">
34
+    <select id="listCall" resultType="com.xhkjedu.sclass.vo.classroom.RoomCorrectCallVo">
35 35
         select s.asktid,count(*)commitnum,count(*) stunum
36 36
         ,sum(case when s.radiocorrect!=0 then 1 else 0 end)correctnum
37 37
         from t_classroom_askstudent s left join t_classroom_askteacher rt on s.asktid=rt.asktid
38 38
         where rt.roomid=#{roomid} and rt.asktype between 32 and 33
39 39
         group by s.asktid order by rt.createtime
40 40
     </select>
41
-    <select id="listExam" resultType="com.xhkjedu.slog.vo.classroom.RoomCorrectExamVo">
41
+    <select id="listExam" resultType="com.xhkjedu.sclass.vo.classroom.RoomCorrectExamVo">
42 42
         select s.paperid,p.papername,count(*)commitnum,count(*) stunum
43 43
         ,sum(case when s.pschecked!=0 then 1 else 0 end)correctnum
44 44
         from t_classroom_paper_student s left join t_classroom_paper p on s.paperid=p.paperid
@@ -55,13 +55,13 @@
55 55
     </select>
56 56
 
57 57
     <!--获取提问批改学生列表-->
58
-    <resultMap id="checkResult" type="com.xhkjedu.slog.vo.paper.CheckClassVo">
58
+    <resultMap id="checkResult" type="com.xhkjedu.sclass.vo.paper.CheckClassVo">
59 59
         <result property="classid" column="classid"></result>
60 60
         <result property="classnum" column="classnum"></result>
61 61
         <result property="ytjnum" column="ytjnum"></result>
62 62
         <result property="ypynum" column="ypynum"></result>
63 63
         <result property="teacherpic" column="teacherpic"></result>
64
-        <collection property="students" ofType="com.xhkjedu.slog.vo.paperstudent.StudentVo">
64
+        <collection property="students" ofType="com.xhkjedu.sclass.vo.paperstudent.StudentVo">
65 65
             <result property="psid" column="psid"></result>
66 66
             <result property="studentid" column="studentid"></result>
67 67
             <result property="studentname" column="studentname"></result>
@@ -90,7 +90,7 @@
90 90
         group by ps.psid order by ps.studentid
91 91
     </select>
92 92
 
93
-    <resultMap id="objectiveResult" type="com.xhkjedu.slog.vo.classroom.ObjectiveVo">
93
+    <resultMap id="objectiveResult" type="com.xhkjedu.sclass.vo.classroom.ObjectiveVo">
94 94
         <result property="typename" column="typename"></result>
95 95
         <result property="answer" column="answer"></result>
96 96
         <result property="correctrate" column="correctrate"></result>
@@ -98,7 +98,7 @@
98 98
         <result property="psscore" column="psscore"></result>
99 99
         <result property="avgscore" column="avgscore"></result>
100 100
         <result property="maxscore" column="maxscore"></result>
101
-        <collection property="answers" ofType="com.xhkjedu.slog.vo.classroom.ObjectiveAnswerVo">
101
+        <collection property="answers" ofType="com.xhkjedu.sclass.vo.classroom.ObjectiveAnswerVo">
102 102
             <result property="section" column="section"></result>
103 103
             <result property="stunum" column="stunum"></result>
104 104
             <result property="stuscore" column="stuscore"></result>
@@ -132,7 +132,7 @@
132 132
         group by pss.useranswer
133 133
     </select>
134 134
 
135
-    <resultMap id="subjectiveResult" type="com.xhkjedu.slog.vo.classroom.SubjectiveVo">
135
+    <resultMap id="subjectiveResult" type="com.xhkjedu.sclass.vo.classroom.SubjectiveVo">
136 136
         <result property="typename" column="typename"></result>
137 137
         <result property="correctrate" column="correctrate"></result>
138 138
         <result property="psorder" column="psorder"></result>
@@ -222,11 +222,11 @@
222 222
         <collection property="asks" ofType="java.util.Map"
223 223
                     select="listStuAsk" column="{roomid=roomid,studentid=studentid}">
224 224
         </collection>
225
-        <collection property="files" ofType="com.xhkjedu.slog.model.classroom.TClassroomFile"
225
+        <collection property="files" ofType="com.xhkjedu.sclass.model.classroom.TClassroomFile"
226 226
                     select="listFile" column="{roomid=roomid}">
227 227
         </collection>
228 228
     </resultMap>
229
-    <select id="listFile" resultType="com.xhkjedu.slog.model.classroom.TClassroomFile">
229
+    <select id="listFile" resultType="com.xhkjedu.sclass.model.classroom.TClassroomFile">
230 230
         select * from t_classroom_file where roomid=#{roomid}
231 231
     </select>
232 232
     <select id="getReportStu" resultMap="stuRoomResult">
@@ -324,7 +324,7 @@
324 324
         <result property="wpynum" column="wpynum"></result>
325 325
         <result property="classnum" column="classnum"></result>
326 326
         <result property="signstate" column="signstate"></result>
327
-        <collection property="hdlist" ofType="com.xhkjedu.slog.vo.classroom.RoomAskTeacherVo"
327
+        <collection property="hdlist" ofType="com.xhkjedu.sclass.vo.classroom.RoomAskTeacherVo"
328 328
                     select="listAskTeachersForRoom" column="{roomid=roomid}">
329 329
             <result property="asktid" column="asktid"></result>
330 330
             <result property="asktype" column="asktype"></result>
@@ -362,7 +362,7 @@
362 362
         </if>
363 363
         ORDER BY c.createtime DESC
364 364
     </select>
365
-    <select id="listAskTeachersForRoom" resultType="com.xhkjedu.slog.vo.classroom.RoomAskTeacherVo">
365
+    <select id="listAskTeachersForRoom" resultType="com.xhkjedu.sclass.vo.classroom.RoomAskTeacherVo">
366 366
         select asktid,asktype from t_classroom_askteacher where roomid=#{roomid}
367 367
     </select>
368 368
     <select id="listFilesForRoom" resultType="java.util.Map">
@@ -386,7 +386,7 @@
386 386
         </foreach>
387 387
     </update>
388 388
     <!--课堂回顾详情-->
389
-    <select id="getReport" resultType="com.xhkjedu.slog.vo.classroom.ReportRoomVo">
389
+    <select id="getReport" resultType="com.xhkjedu.sclass.vo.classroom.ReportRoomVo">
390 390
         select r.roomname,r.classnum,r.realstunum,r.createtime,r.endtime,c.classname,c.gradeid,u.username createname
391 391
         ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=20)asknum
392 392
         ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=21)callnum
@@ -426,11 +426,11 @@
426 426
         order by convert(u.username using gbk)
427 427
     </select>
428 428
     <!--课堂截图列表-->
429
-    <select id="listFileReport" resultType="com.xhkjedu.slog.model.classroom.TClassroomFile">
429
+    <select id="listFileReport" resultType="com.xhkjedu.sclass.model.classroom.TClassroomFile">
430 430
         select * from t_classroom_file f where f.roomid=#{roomid} order by f.createtime
431 431
     </select>
432 432
     <!--课堂考试列表-->
433
-    <select id="listExamReport" resultType="com.xhkjedu.slog.vo.classroom.ReportEQuestionVo">
433
+    <select id="listExamReport" resultType="com.xhkjedu.sclass.vo.classroom.ReportEQuestionVo">
434 434
         select ps.paperid,ps.psorder,ps.psanswer,ps.psscore,ps.ctypename,ps.ctype,ps.pscaid
435 435
         ,sum(case when q.answered=1 then 1 else 0 end)commitrate
436 436
         ,sum(case when q.stuscore=ps.psscore then 1 else 0 end)correctrate
@@ -443,7 +443,7 @@
443 443
         group by ps.pscaid order by ps.psorder
444 444
     </select>
445 445
     <!--获取课堂考试列表-->
446
-    <select id="listPaper" resultType="com.xhkjedu.slog.vo.classroom.ReportExamVo">
446
+    <select id="listPaper" resultType="com.xhkjedu.sclass.vo.classroom.ReportExamVo">
447 447
         SELECT p.paperid,p.papername,c.classid,ifnull(truncate(SUM(ps.stuscore)*100/(p.paperscore*COUNT(ps.psid)),2),0)scorerate
448 448
         ,ifnull(truncate(SUM(ps.stuscore)/COUNT(ps.psid),2),0)avgscore,ifnull(MAX(ps.stuscore),0)maxscore,COUNT(ps.psid)ytjnum
449 449
         FROM t_classroom_paper p
@@ -490,7 +490,7 @@
490 490
         </foreach>
491 491
     </update>
492 492
     <!--根据班级ids获取学生数量-->
493
-    <select id="listStudentNumByClassIds" resultType="com.xhkjedu.slog.model.classroom.TClassroom">
493
+    <select id="listStudentNumByClassIds" resultType="com.xhkjedu.sclass.model.classroom.TClassroom">
494 494
         SELECT classid,classnum FROM t_class WHERE classid in
495 495
         <foreach collection="classids" item="classid" open="(" close=")" separator=",">
496 496
             ${classid}

+ 2
- 2
sclass/src/main/resources/mapper/classroom/ClassroomPaperFileMapper.xml Dosyayı Görüntüle

@@ -2,14 +2,14 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.xhkjedu.sclass.mapper.classroom.ClassroomPaperFileMapper">
4 4
     <!-- 根据作业id获取作业附件 -->
5
-    <select id="listObjsByPaperid" resultType="com.xhkjedu.slog.model.classroom.TClassroomPaperFile">
5
+    <select id="listObjsByPaperid" resultType="com.xhkjedu.sclass.model.classroom.TClassroomPaperFile">
6 6
         SELECT pfid,paperid,filepath,fileclass,fileorder,createtime
7 7
         FROM
8 8
         <if test="qctype==2">t_paper_file</if>
9 9
         <if test="qctype==3">t_classroom_paper_file</if>
10 10
         WHERE paperid=#{paperid} ORDER BY fileorder asc
11 11
     </select>
12
-    <select id="listFilepath" resultType="com.xhkjedu.slog.model.classroom.TClassroomPaperFile">
12
+    <select id="listFilepath" resultType="com.xhkjedu.sclass.model.classroom.TClassroomPaperFile">
13 13
         SELECT paperid,filepath FROM t_classroom_paper_file
14 14
         WHERE paperid in
15 15
         <foreach collection="paperids" item="paperid" index="index" open="(" separator="," close=")">

+ 1
- 1
sclass/src/main/resources/mapper/classroom/ClassroomPaperScantronMapper.xml Dosyayı Görüntüle

@@ -13,7 +13,7 @@
13 13
     </insert>
14 14
 
15 15
     <!--获取试题详情-->
16
-    <select id="listByIds" resultType="com.xhkjedu.slog.model.classroom.TClassroomPaperScantron">
16
+    <select id="listByIds" resultType="com.xhkjedu.sclass.model.classroom.TClassroomPaperScantron">
17 17
         select pscaid,psanswer,ctype from t_classroom_paper_scantron where pscaid in
18 18
         <foreach collection="pscaids" item="pscaid" index="index" open="(" separator="," close=")">
19 19
             ${pscaid}

+ 1
- 1
sclass/src/main/resources/mapper/classroom/ClassroomPaperStudentMapper.xml Dosyayı Görüntüle

@@ -2,7 +2,7 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.xhkjedu.sclass.mapper.classroom.ClassroomPaperStudentMapper">
4 4
     <!--获取考试学生信息-->
5
-    <select id="findById" resultType="com.xhkjedu.slog.model.classroom.TClassroomPaperStudent">
5
+    <select id="findById" resultType="com.xhkjedu.sclass.model.classroom.TClassroomPaperStudent">
6 6
         select s.*,p.subjectid,p.papername from t_classroom_paper_student s
7 7
         left join t_classroom_paper p on p.paperid=s.paperid
8 8
         where s.psid=#{psid} limit 1

+ 9
- 0
sclass/src/main/resources/mapper/system/UserMapper.xml Dosyayı Görüntüle

@@ -0,0 +1,9 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sclass.mapper.system.UserMapper">
4
+
5
+    <!--获取用户信息用于操作日志-->
6
+    <select id="getUserInfoForHandleLog" resultType="com.xhkjedu.vo.system.UserVo">
7
+        select userid,username,loginname,usertype,schoolid from t_user where userid=#{userid}
8
+    </select>
9
+</mapper>

+ 1
- 1
sclass/src/test/java/com/xhkjedu/sclass/SclassApplicationTests.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.slog;
1
+package com.xhkjedu.sclass;
2 2
 
3 3
 import org.junit.jupiter.api.Test;
4 4
 import org.springframework.boot.test.context.SpringBootTest;

+ 4
- 1
scommons/src/main/java/com/xhkjedu/vo/system/UserVo.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-package com.xhkjedu.suser.vo.system;
1
+package com.xhkjedu.vo.system;
2 2
 
3 3
 import lombok.Data;
4 4
 
@@ -120,6 +120,9 @@ public class UserVo {
120 120
     //科目id
121 121
     private String subjectid;
122 122
 
123
+    //班级id
124
+    private Integer classid;
125
+
123 126
     //有效期
124 127
     private String usertime;
125 128
     private String token_key;

+ 218
- 0
sexam/src/main/java/com/xhkjedu/sexam/aop/WebControllerAop.java Dosyayı Görüntüle

@@ -0,0 +1,218 @@
1
+package com.xhkjedu.sexam.aop;
2
+
3
+import com.xhkjedu.annotation.Action;
4
+import com.xhkjedu.constant.PlatformConstant;
5
+import com.xhkjedu.exception.ServiceException;
6
+import com.xhkjedu.model.slog.THandleLog;
7
+import com.xhkjedu.sexam.config.ConfigKey;
8
+import com.xhkjedu.sexam.interceptors.RequestWrapper;
9
+import com.xhkjedu.sexam.listener.HandleLogSender;
10
+import com.xhkjedu.sexam.mapper.system.UserMapper;
11
+import com.xhkjedu.utils.IpRegionUtil;
12
+import com.xhkjedu.utils.N_Utils;
13
+import com.xhkjedu.vo.ResultVo;
14
+import com.xhkjedu.vo.system.UserVo;
15
+import lombok.extern.slf4j.Slf4j;
16
+import org.aspectj.lang.JoinPoint;
17
+import org.aspectj.lang.ProceedingJoinPoint;
18
+import org.aspectj.lang.annotation.*;
19
+import org.aspectj.lang.reflect.MethodSignature;
20
+import org.springframework.stereotype.Component;
21
+import org.springframework.web.context.request.RequestContextHolder;
22
+import org.springframework.web.context.request.ServletRequestAttributes;
23
+
24
+import javax.annotation.Resource;
25
+import javax.servlet.http.HttpServletRequest;
26
+import java.lang.reflect.Method;
27
+
28
+/*
29
+ * @Description: AOP 操作日志
30
+ * @Author: WN
31
+ * @Date: 2023/11/15 18:52:24
32
+ **/
33
+@Aspect
34
+@Component
35
+@Slf4j
36
+public class WebControllerAop {
37
+    @Resource
38
+    private HandleLogSender handleLogSender;
39
+    @Resource
40
+    private UserMapper userMapper;
41
+
42
+    private THandleLog handleLog;
43
+
44
+    /*
45
+     * @Description 指定切点 匹配 使用@Action修饰所有方法
46
+     * @Date 2023/11/15 18:52:48
47
+     * @Author WN
48
+     * @Return void
49
+     **/
50
+    @Pointcut("execution(public * com.xhkjedu.sexam.controller..*.*(..))")
51
+    public void handleLog() {
52
+    }
53
+
54
+    /*
55
+     * @Description 前置通知,方法调用前被调用
56
+     * @Date 2023/11/15 17:46:51
57
+     * @Param [joinPoint]
58
+     **/
59
+    @Before("handleLog()")
60
+    public void doBefore(JoinPoint joinPoint){
61
+
62
+        //获取方法
63
+        Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
64
+        // 获取AspectAnnotation注解
65
+        Action action = method.getAnnotation(Action.class);
66
+        if (action == null) {
67
+            handleLog = null;
68
+            return;
69
+        }
70
+        // 在此处初始化,避免某些方法不用记录报错
71
+        handleLog = new THandleLog();
72
+
73
+        // 获取方法名字
74
+        String value = action.value();
75
+        String[] valueStr = value.split("-");
76
+        // 操作名称
77
+        handleLog.setHandlemodel(valueStr[0]);
78
+        handleLog.setHandleaction(valueStr[1]);
79
+
80
+        if(joinPoint.getArgs() != null && joinPoint.getArgs().length > 0){
81
+            Object[] args = joinPoint.getArgs();
82
+            RequestWrapper st = (RequestWrapper) args[1];
83
+            // 设置请求参数
84
+            handleLog.setHandleparas(st.getBody());
85
+        }
86
+
87
+        try {
88
+            ServletRequestAttributes ss = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
89
+            if (ss != null) {
90
+                HttpServletRequest request = ss.getRequest();
91
+                Integer userid = request.getIntHeader(PlatformConstant.XH_USER_ID);
92
+                // 用户名
93
+                handleLog.setUserid(request.getIntHeader(PlatformConstant.XH_USER_ID));
94
+                handleLog.setDevicetype(request.getHeader(PlatformConstant.XH_DEVICE));
95
+                handleLog.setVersionnum(request.getHeader(PlatformConstant.XH_VERSION));
96
+                // 请求地址
97
+                handleLog.setHandleurl("/sexam" + request.getRequestURI());
98
+
99
+                //获取请求ip并解析区域
100
+                String ip = N_Utils.getIpAddress(request);
101
+                String region = null;
102
+                if (N_Utils.isNotEmpty(ip)) {
103
+                    IpRegionUtil ipRegionUtil = new IpRegionUtil();
104
+                    region = ipRegionUtil.getIpForAddress(ip, ConfigKey.ipregiondb);
105
+                }
106
+                handleLog.setHandleip(ip);
107
+                handleLog.setHandleaddress(region);
108
+                if(N_Utils.isTrueInteger(userid)){
109
+                    UserVo user = userMapper.getUserInfoForHandleLog(userid);
110
+                    if(user != null){
111
+                        handleLog.setUsertype(user.getUsertype());
112
+                        handleLog.setSchoolid(user.getSchoolid());
113
+                        handleLog.setUsername(user.getUsername());
114
+                        handleLog.setLoginname(user.getLoginname());
115
+                        if(N_Utils.isNotEmpty(handleLog.getDevicetype()) && "p_web".equals(handleLog.getDevicetype())){
116
+                            if(user.getUsertype() == 2){
117
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_s");
118
+                            }else{
119
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_t");
120
+                            }
121
+                        }
122
+                    }
123
+                }
124
+            }
125
+        } catch (Exception e) {
126
+            e.printStackTrace();
127
+            throw new ServiceException(e.getMessage());
128
+        }
129
+    }
130
+
131
+    /*
132
+     * @Description 处理完请求返回内容 发送mq消息
133
+     * @Date 2023/11/15 17:47:12
134
+     * @Author WN
135
+     * @Param [ret]
136
+     **/
137
+    @AfterReturning(returning = "ret", pointcut = "handleLog()")
138
+    public void doAfterReturning(Object ret){
139
+        if (ret == null) {
140
+            return;
141
+        }
142
+        if (handleLog == null) {
143
+            return;
144
+        }
145
+
146
+        if (ret instanceof ResultVo) {
147
+            ResultVo result = (ResultVo) ret;
148
+            if (result.getCode() == 0) {
149
+                handleLog.setHandlestate(1);
150
+            } else {
151
+                handleLog.setHandlestate(2);
152
+            }
153
+        }
154
+    }
155
+
156
+    /*
157
+     * @Description  后置异常
158
+     * @Date 2023/11/15 17:47:28
159
+     * @Author WN
160
+     * @Param [jp, e] (JoinPoint jp, Exception e)
161
+     **/
162
+    @AfterThrowing(pointcut = "handleLog()", throwing = "e")
163
+    public void throwss(Exception e) {
164
+
165
+        if (handleLog == null) {
166
+            return;
167
+        }
168
+
169
+        handleLog.setHandlestate(2);
170
+
171
+        log.info("方法异常时执行....." + e.getMessage());
172
+    }
173
+
174
+    /*
175
+     * @Description 后置最终通知,final增强,不管是抛出异常或者正常退出都会执行
176
+     * @Date 2023/11/15 17:49:15
177
+     * @Author WN
178
+     * @Param [jp](JoinPoint jp)
179
+     **/
180
+    @After("handleLog()")
181
+    public void after() {
182
+        if (handleLog == null) {
183
+            return;
184
+        }
185
+        sendOut();
186
+        log.info("后置最终通知");
187
+    }
188
+
189
+    /*
190
+     * @Description 环绕通知,环绕增强,相当于MethodInterceptor
191
+     * @Date 2023/11/15 17:49:34
192
+     * @Author WN
193
+     * @Param [pjp]
194
+     * @Return java.lang.Object
195
+     **/
196
+    @Around("handleLog()")
197
+    public Object arround(ProceedingJoinPoint pjp) {
198
+        try {
199
+            return pjp.proceed();
200
+        } catch (Throwable e) {
201
+            e.printStackTrace();
202
+            if (e instanceof Exception) {
203
+                throw new ServiceException(e.getMessage());
204
+            }
205
+            throw new ServiceException(e.getMessage());
206
+        }
207
+    }
208
+
209
+    /**
210
+     * 发送消息
211
+     */
212
+    public void sendOut() {
213
+        THandleLog logHandlelogNew = handleLog;
214
+        log.info("记录操作日志,给rabbitmq发送消息:" + logHandlelogNew.toString());
215
+        handleLogSender.handleLogSend(handleLog);
216
+    }
217
+
218
+}

+ 7
- 0
sexam/src/main/java/com/xhkjedu/sexam/config/ConfigKey.java Dosyayı Görüntüle

@@ -69,4 +69,11 @@ public class ConfigKey {
69 69
         this.buildnum = buildnum;
70 70
     }
71 71
 
72
+    public static String ipregiondb;//解析ip地址归属地
73
+
74
+    @Value("${ipregiondb}")
75
+    public void setIpregiondb(String ipregiondb){
76
+        ConfigKey.ipregiondb = ipregiondb;
77
+    }
78
+
72 79
 }

+ 9
- 0
sexam/src/main/java/com/xhkjedu/sexam/config/RabbitConfig.java Dosyayı Görüntüle

@@ -92,4 +92,13 @@ public class RabbitConfig {
92 92
     public Queue examBaseToScanImgQueue2(){ return new Queue(examBaseToScanImgQueue2);}
93 93
     @Bean
94 94
     public Queue examImgToPdfQueue2(){ return new Queue(examImgToPdfQueue2);}
95
+
96
+    //生产者mq-操作日志
97
+    @Value("${rabbitmq.handleLogQueue}")
98
+    private String handleLogQueue;
99
+
100
+    @Bean
101
+    public Queue handleLogQueue() {
102
+        return new Queue(handleLogQueue);
103
+    }
95 104
 }

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/controller/exam/EBaseController.java Dosyayı Görüntüle

@@ -15,12 +15,12 @@ import com.xhkjedu.sexam.service.report.EReportGenerateService;
15 15
 import com.xhkjedu.sexam.vo.exam.EBaseVo;
16 16
 import com.xhkjedu.sexam.vo.exam.ExamVo;
17 17
 import com.xhkjedu.sexam.vo.paper.EPaperVo;
18
-import com.xhkjedu.sexam.vo.system.UserVo;
19 18
 import com.xhkjedu.utils.DatesUtil;
20 19
 import com.xhkjedu.utils.N_Utils;
21 20
 import com.xhkjedu.utils.PageUtil;
22 21
 import com.xhkjedu.vo.PageResult;
23 22
 import com.xhkjedu.vo.ResultVo;
23
+import com.xhkjedu.vo.system.UserVo;
24 24
 import lombok.extern.slf4j.Slf4j;
25 25
 import org.springframework.web.bind.annotation.*;
26 26
 

+ 28
- 0
sexam/src/main/java/com/xhkjedu/sexam/listener/HandleLogSender.java Dosyayı Görüntüle

@@ -0,0 +1,28 @@
1
+package com.xhkjedu.sexam.listener;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.model.slog.THandleLog;
5
+import org.springframework.amqp.core.AmqpTemplate;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.beans.factory.annotation.Value;
8
+import org.springframework.stereotype.Component;
9
+
10
+/*
11
+ * @Description: 操作日志
12
+ * @Author: WN
13
+ * @Date: 2023/11/15 16:20:25
14
+ **/
15
+@Component
16
+public class HandleLogSender {
17
+    @Autowired
18
+    private AmqpTemplate rabbitTemplate;
19
+    //生产者mq
20
+    @Value("${rabbitmq.handleLogQueue}")
21
+    private String handleLogQueue;
22
+
23
+    //操作日志
24
+    public void handleLogSend(THandleLog handleLog) {
25
+        rabbitTemplate.convertAndSend(handleLogQueue, JSON.toJSONString(handleLog));
26
+    }
27
+
28
+}

+ 4
- 1
sexam/src/main/java/com/xhkjedu/sexam/mapper/system/UserMapper.java Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1 1
 package com.xhkjedu.sexam.mapper.system;
2 2
 
3
-import com.xhkjedu.sexam.vo.system.UserVo;
3
+import com.xhkjedu.vo.system.UserVo;
4 4
 import org.apache.ibatis.annotations.Param;
5 5
 
6 6
 import java.util.List;
@@ -36,4 +36,7 @@ public interface UserMapper {
36 36
 
37 37
     //根据用户id获取用户所属学校id
38 38
     Integer getSchoolidByUserid(@Param("userid")Integer userid);
39
+
40
+    //获取用户信息用户操作日志
41
+    UserVo getUserInfoForHandleLog(@Param("userid") Integer userid);
39 42
 }

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/exam/EBaseService.java Dosyayı Görüntüle

@@ -14,9 +14,9 @@ import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestion;
14 14
 import com.xhkjedu.sexam.service.report.EReportGenerateService;
15 15
 import com.xhkjedu.sexam.utils.ExamUtil;
16 16
 import com.xhkjedu.sexam.vo.exam.EBaseVo;
17
-import com.xhkjedu.sexam.vo.system.UserVo;
18 17
 import com.xhkjedu.utils.N_Utils;
19 18
 import com.xhkjedu.vo.ResultVo;
19
+import com.xhkjedu.vo.system.UserVo;
20 20
 import lombok.extern.slf4j.Slf4j;
21 21
 import org.springframework.stereotype.Service;
22 22
 import org.springframework.transaction.annotation.Transactional;

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/notice/NoticeService.java Dosyayı Görüntüle

@@ -8,8 +8,8 @@ import com.xhkjedu.sexam.utils.ExamUtil;
8 8
 import com.xhkjedu.sexam.utils.SMSSender;
9 9
 import com.xhkjedu.sexam.vo.exam.ExamVo;
10 10
 import com.xhkjedu.sexam.vo.exam.ZtMsgVo;
11
-import com.xhkjedu.sexam.vo.system.UserVo;
12 11
 import com.xhkjedu.utils.N_Utils;
12
+import com.xhkjedu.vo.system.UserVo;
13 13
 import lombok.extern.slf4j.Slf4j;
14 14
 import org.springframework.scheduling.annotation.Async;
15 15
 import org.springframework.stereotype.Service;

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperCorrectTeacherService.java Dosyayı Görüntüle

@@ -10,9 +10,9 @@ import com.xhkjedu.sexam.model.paperstudent.EPaperStudentQuestion;
10 10
 import com.xhkjedu.sexam.vo.paper.EPCTeacherVo;
11 11
 import com.xhkjedu.sexam.vo.paper.EPaperSQuestionVo;
12 12
 import com.xhkjedu.sexam.vo.paper.EPaperVo;
13
-import com.xhkjedu.sexam.vo.system.UserVo;
14 13
 import com.xhkjedu.utils.N_Utils;
15 14
 import com.xhkjedu.vo.ResultVo;
15
+import com.xhkjedu.vo.system.UserVo;
16 16
 import lombok.extern.slf4j.Slf4j;
17 17
 import org.springframework.scheduling.annotation.Async;
18 18
 import org.springframework.scheduling.annotation.AsyncResult;

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java Dosyayı Görüntüle

@@ -25,8 +25,8 @@ import com.xhkjedu.sexam.utils.ConvertUtil;
25 25
 import com.xhkjedu.sexam.utils.ExamUtil;
26 26
 import com.xhkjedu.sexam.vo.paper.QuestionPointVo;
27 27
 import com.xhkjedu.sexam.vo.report.*;
28
-import com.xhkjedu.sexam.vo.system.UserVo;
29 28
 import com.xhkjedu.utils.N_Utils;
29
+import com.xhkjedu.vo.system.UserVo;
30 30
 import lombok.extern.slf4j.Slf4j;
31 31
 import org.springframework.beans.factory.annotation.Autowired;
32 32
 import org.springframework.scheduling.annotation.Async;

+ 6
- 0
sexam/src/main/resources/application.properties Dosyayı Görüntüle

@@ -69,6 +69,9 @@ rabbitmq.examBaseToPdfQueue2=xhkjedutest.xhschool.examBaseToPdfQueue_node02_dev
69 69
 rabbitmq.examBaseToScanImgQueue2=xhkjedutest.xhschool.examBaseToScanImgQueue_node02_dev
70 70
 rabbitmq.examImgToPdfQueue2=xhkjedutest.xhschool.examImgToPdfQueue_node02_dev
71 71
 
72
+#操作日志生产者
73
+rabbitmq.handleLogQueue=xhkjedutest.xhschool.handleLogQueue_dev
74
+
72 75
 spring.rabbitmq.host=49.4.26.249
73 76
 spring.rabbitmq.port=5672
74 77
 spring.rabbitmq.username=xhkjedu
@@ -108,6 +111,9 @@ exam.face=https://face.xhkjedu.com/
108 111
 #配置考试结束时间范围
109 112
 exam.endtime=30
110 113
 
114
+#解析ip归属地数据
115
+ipregiondb=D:\\school\\ip2region.xdb
116
+
111 117
 #白名单接口
112 118
 whitelistAPI=/pdf,/status/info
113 119
 

+ 8
- 3
sexam/src/main/resources/mapper/system/UserMapper.xml Dosyayı Görüntüle

@@ -2,7 +2,7 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.xhkjedu.sexam.mapper.system.UserMapper">
4 4
     <!--根据用户ids查找手机号-->
5
-    <select id="listPhoneByUserIds" resultType="com.xhkjedu.sexam.vo.system.UserVo">
5
+    <select id="listPhoneByUserIds" resultType="com.xhkjedu.vo.system.UserVo">
6 6
         select userid,userphone from t_user where userid in
7 7
         <foreach collection="userids" item="userid" open="(" separator="," close=")">
8 8
             ${userid}
@@ -16,7 +16,7 @@
16 16
         where ec.examid=#{examid}
17 17
     </select>
18 18
     <!--获取考试班级任教老师-->
19
-    <select id="listTeacherByClassIds" resultType="com.xhkjedu.sexam.vo.system.UserVo">
19
+    <select id="listTeacherByClassIds" resultType="com.xhkjedu.vo.system.UserVo">
20 20
         select u.userid,u.userphone
21 21
         from t_class_teacher ct left join t_user u on ct.teacherid = u.userid
22 22
         where ct.classid in(${classids}) and u.userstate=1
@@ -47,7 +47,7 @@
47 47
         select userid from t_user where examno=#{examno}
48 48
     </select>
49 49
     <!--根据用户ids查找用户姓名-->
50
-    <select id="listNameByUserIds" resultType="com.xhkjedu.sexam.vo.system.UserVo">
50
+    <select id="listNameByUserIds" resultType="com.xhkjedu.vo.system.UserVo">
51 51
         select userid,username,loginname from t_user where userid in
52 52
         <foreach collection="userids" item="userid" open="(" separator="," close=")">
53 53
             ${userid}
@@ -69,4 +69,9 @@
69 69
     <select id="getSchoolidByUserid" resultType="java.lang.Integer">
70 70
         select schoolid from t_user where userid=#{userid}
71 71
     </select>
72
+
73
+    <!--获取用户信息用于操作日志-->
74
+    <select id="getUserInfoForHandleLog" resultType="com.xhkjedu.vo.system.UserVo">
75
+        select userid,username,loginname,usertype,schoolid from t_user where userid=#{userid}
76
+    </select>
72 77
 </mapper>

+ 218
- 0
slive/src/main/java/com/xhkjedu/slive/aop/WebControllerAop.java Dosyayı Görüntüle

@@ -0,0 +1,218 @@
1
+package com.xhkjedu.slive.aop;
2
+
3
+import com.xhkjedu.annotation.Action;
4
+import com.xhkjedu.constant.PlatformConstant;
5
+import com.xhkjedu.exception.ServiceException;
6
+import com.xhkjedu.model.slog.THandleLog;
7
+import com.xhkjedu.slive.config.ConfigKey;
8
+import com.xhkjedu.slive.interceptors.RequestWrapper;
9
+import com.xhkjedu.slive.listener.HandleLogSender;
10
+import com.xhkjedu.slive.mapper.system.UserMapper;
11
+import com.xhkjedu.utils.IpRegionUtil;
12
+import com.xhkjedu.utils.N_Utils;
13
+import com.xhkjedu.vo.ResultVo;
14
+import com.xhkjedu.vo.system.UserVo;
15
+import lombok.extern.slf4j.Slf4j;
16
+import org.aspectj.lang.JoinPoint;
17
+import org.aspectj.lang.ProceedingJoinPoint;
18
+import org.aspectj.lang.annotation.*;
19
+import org.aspectj.lang.reflect.MethodSignature;
20
+import org.springframework.stereotype.Component;
21
+import org.springframework.web.context.request.RequestContextHolder;
22
+import org.springframework.web.context.request.ServletRequestAttributes;
23
+
24
+import javax.annotation.Resource;
25
+import javax.servlet.http.HttpServletRequest;
26
+import java.lang.reflect.Method;
27
+
28
+/*
29
+ * @Description: AOP 操作日志
30
+ * @Author: WN
31
+ * @Date: 2023/11/15 18:52:24
32
+ **/
33
+@Aspect
34
+@Component
35
+@Slf4j
36
+public class WebControllerAop {
37
+    @Resource
38
+    private HandleLogSender handleLogSender;
39
+    @Resource
40
+    private UserMapper userMapper;
41
+
42
+    private THandleLog handleLog;
43
+
44
+    /*
45
+     * @Description 指定切点 匹配 使用@Action修饰所有方法
46
+     * @Date 2023/11/15 18:52:48
47
+     * @Author WN
48
+     * @Return void
49
+     **/
50
+    @Pointcut("execution(public * com.xhkjedu.slive.controller..*.*(..))")
51
+    public void handleLog() {
52
+    }
53
+
54
+    /*
55
+     * @Description 前置通知,方法调用前被调用
56
+     * @Date 2023/11/15 17:46:51
57
+     * @Param [joinPoint]
58
+     **/
59
+    @Before("handleLog()")
60
+    public void doBefore(JoinPoint joinPoint){
61
+
62
+        //获取方法
63
+        Method method = ((MethodSignature) joinPoint.getSignature()).getMethod();
64
+        // 获取AspectAnnotation注解
65
+        Action action = method.getAnnotation(Action.class);
66
+        if (action == null) {
67
+            handleLog = null;
68
+            return;
69
+        }
70
+        // 在此处初始化,避免某些方法不用记录报错
71
+        handleLog = new THandleLog();
72
+
73
+        // 获取方法名字
74
+        String value = action.value();
75
+        String[] valueStr = value.split("-");
76
+        // 操作名称
77
+        handleLog.setHandlemodel(valueStr[0]);
78
+        handleLog.setHandleaction(valueStr[1]);
79
+
80
+        if(joinPoint.getArgs() != null && joinPoint.getArgs().length > 0){
81
+            Object[] args = joinPoint.getArgs();
82
+            RequestWrapper st = (RequestWrapper) args[1];
83
+            // 设置请求参数
84
+            handleLog.setHandleparas(st.getBody());
85
+        }
86
+
87
+        try {
88
+            ServletRequestAttributes ss = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
89
+            if (ss != null) {
90
+                HttpServletRequest request = ss.getRequest();
91
+                Integer userid = request.getIntHeader(PlatformConstant.XH_USER_ID);
92
+                // 用户名
93
+                handleLog.setUserid(request.getIntHeader(PlatformConstant.XH_USER_ID));
94
+                handleLog.setDevicetype(request.getHeader(PlatformConstant.XH_DEVICE));
95
+                handleLog.setVersionnum(request.getHeader(PlatformConstant.XH_VERSION));
96
+                // 请求地址
97
+                handleLog.setHandleurl("/slive" + request.getRequestURI());
98
+
99
+                //获取请求ip并解析区域
100
+                String ip = N_Utils.getIpAddress(request);
101
+                String region = null;
102
+                if (N_Utils.isNotEmpty(ip)) {
103
+                    IpRegionUtil ipRegionUtil = new IpRegionUtil();
104
+                    region = ipRegionUtil.getIpForAddress(ip, ConfigKey.ipregiondb);
105
+                }
106
+                handleLog.setHandleip(ip);
107
+                handleLog.setHandleaddress(region);
108
+                if(N_Utils.isTrueInteger(userid)){
109
+                    UserVo user = userMapper.getUserInfoForHandleLog(userid);
110
+                    if(user != null){
111
+                        handleLog.setUsertype(user.getUsertype());
112
+                        handleLog.setSchoolid(user.getSchoolid());
113
+                        handleLog.setUsername(user.getUsername());
114
+                        handleLog.setLoginname(user.getLoginname());
115
+                        if(N_Utils.isNotEmpty(handleLog.getDevicetype()) && "p_web".equals(handleLog.getDevicetype())){
116
+                            if(user.getUsertype() == 2){
117
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_s");
118
+                            }else{
119
+                                handleLog.setDevicetype(handleLog.getDevicetype()+"_t");
120
+                            }
121
+                        }
122
+                    }
123
+                }
124
+            }
125
+        } catch (Exception e) {
126
+            e.printStackTrace();
127
+            throw new ServiceException(e.getMessage());
128
+        }
129
+    }
130
+
131
+    /*
132
+     * @Description 处理完请求返回内容 发送mq消息
133
+     * @Date 2023/11/15 17:47:12
134
+     * @Author WN
135
+     * @Param [ret]
136
+     **/
137
+    @AfterReturning(returning = "ret", pointcut = "handleLog()")
138
+    public void doAfterReturning(Object ret){
139
+        if (ret == null) {
140
+            return;
141
+        }
142
+        if (handleLog == null) {
143
+            return;
144
+        }
145
+
146
+        if (ret instanceof ResultVo) {
147
+            ResultVo result = (ResultVo) ret;
148
+            if (result.getCode() == 0) {
149
+                handleLog.setHandlestate(1);
150
+            } else {
151
+                handleLog.setHandlestate(2);
152
+            }
153
+        }
154
+    }
155
+
156
+    /*
157
+     * @Description  后置异常
158
+     * @Date 2023/11/15 17:47:28
159
+     * @Author WN
160
+     * @Param [jp, e] (JoinPoint jp, Exception e)
161
+     **/
162
+    @AfterThrowing(pointcut = "handleLog()", throwing = "e")
163
+    public void throwss(Exception e) {
164
+
165
+        if (handleLog == null) {
166
+            return;
167
+        }
168
+
169
+        handleLog.setHandlestate(2);
170
+
171
+        log.info("方法异常时执行....." + e.getMessage());
172
+    }
173
+
174
+    /*
175
+     * @Description 后置最终通知,final增强,不管是抛出异常或者正常退出都会执行
176
+     * @Date 2023/11/15 17:49:15
177
+     * @Author WN
178
+     * @Param [jp](JoinPoint jp)
179
+     **/
180
+    @After("handleLog()")
181
+    public void after() {
182
+        if (handleLog == null) {
183
+            return;
184
+        }
185
+        sendOut();
186
+        log.info("后置最终通知");
187
+    }
188
+
189
+    /*
190
+     * @Description 环绕通知,环绕增强,相当于MethodInterceptor
191
+     * @Date 2023/11/15 17:49:34
192
+     * @Author WN
193
+     * @Param [pjp]
194
+     * @Return java.lang.Object
195
+     **/
196
+    @Around("handleLog()")
197
+    public Object arround(ProceedingJoinPoint pjp) {
198
+        try {
199
+            return pjp.proceed();
200
+        } catch (Throwable e) {
201
+            e.printStackTrace();
202
+            if (e instanceof Exception) {
203
+                throw new ServiceException(e.getMessage());
204
+            }
205
+            throw new ServiceException(e.getMessage());
206
+        }
207
+    }
208
+
209
+    /**
210
+     * 发送消息
211
+     */
212
+    public void sendOut() {
213
+        THandleLog logHandlelogNew = handleLog;
214
+        log.info("记录操作日志,给rabbitmq发送消息:" + logHandlelogNew.toString());
215
+        handleLogSender.handleLogSend(handleLog);
216
+    }
217
+
218
+}

+ 9
- 0
slive/src/main/java/com/xhkjedu/slive/config/RabbitConfig.java Dosyayı Görüntüle

@@ -20,4 +20,13 @@ public class RabbitConfig {
20 20
     public Queue queueA() {
21 21
         return new Queue(rabbitmqQueue); //队列持久
22 22
     }
23
+
24
+    //生产者mq-操作日志
25
+    @Value("${rabbitmq.handleLogQueue}")
26
+    private String handleLogQueue;
27
+
28
+    @Bean
29
+    public Queue handleLogQueue() {
30
+        return new Queue(handleLogQueue);
31
+    }
23 32
 }

+ 28
- 0
slive/src/main/java/com/xhkjedu/slive/listener/HandleLogSender.java Dosyayı Görüntüle

@@ -0,0 +1,28 @@
1
+package com.xhkjedu.slive.listener;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.model.slog.THandleLog;
5
+import org.springframework.amqp.core.AmqpTemplate;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.beans.factory.annotation.Value;
8
+import org.springframework.stereotype.Component;
9
+
10
+/*
11
+ * @Description: 操作日志
12
+ * @Author: WN
13
+ * @Date: 2023/11/15 16:20:25
14
+ **/
15
+@Component
16
+public class HandleLogSender {
17
+    @Autowired
18
+    private AmqpTemplate rabbitTemplate;
19
+    //生产者mq
20
+    @Value("${rabbitmq.handleLogQueue}")
21
+    private String handleLogQueue;
22
+
23
+    //操作日志
24
+    public void handleLogSend(THandleLog handleLog) {
25
+        rabbitTemplate.convertAndSend(handleLogQueue, JSON.toJSONString(handleLog));
26
+    }
27
+
28
+}

+ 5
- 0
slive/src/main/java/com/xhkjedu/slive/mapper/system/UserMapper.java Dosyayı Görüntüle

@@ -1,5 +1,7 @@
1 1
 package com.xhkjedu.slive.mapper.system;
2 2
 
3
+import com.xhkjedu.vo.system.UserVo;
4
+import org.apache.ibatis.annotations.Param;
3 5
 import org.springframework.stereotype.Repository;
4 6
 
5 7
 import java.util.Map;
@@ -30,4 +32,7 @@ public interface UserMapper {
30 32
 
31 33
     //根据用户id获取用户信息
32 34
     Map getObjById(Integer userid);
35
+
36
+    //获取用户信息用于操作日志
37
+    UserVo getUserInfoForHandleLog(@Param("userid") Integer userid);
33 38
 }

+ 2
- 0
slive/src/main/resources/application.properties Dosyayı Görüntüle

@@ -59,6 +59,8 @@ redisdatatime=18000
59 59
 secretKey=nanhuakaizhangjianwangni
60 60
 
61 61
 rabbitmq.queue=xhkjedutest.xhschool.livequeue_dev
62
+#操作日志生产者
63
+rabbitmq.handleLogQueue=xhkjedutest.xhschool.handleLogQueue_dev
62 64
 spring.rabbitmq.host=49.4.26.249
63 65
 spring.rabbitmq.port=5672
64 66
 spring.rabbitmq.username=xhkjedu

+ 5
- 0
slive/src/main/resources/mapper/system/UserMapper.xml Dosyayı Görüntüle

@@ -30,4 +30,9 @@
30 30
         select u.userid,u.username,u.loginname,u.usertype,u.userstate,u.schoolid
31 31
         from t_user u where u.userid=#{userid} limit 1
32 32
     </select>
33
+
34
+    <!--获取用户信息用于操作日志-->
35
+    <select id="getUserInfoForHandleLog" resultType="com.xhkjedu.vo.system.UserVo">
36
+        select userid,username,loginname,usertype,schoolid from t_user where userid=#{userid}
37
+    </select>
33 38
 </mapper>

+ 0
- 0
slog/src/main/java/com/xhkjedu/slog/SlogApplication.java Dosyayı Görüntüle


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor

Loading…
İptal
Kaydet