Browse Source

统一添加操作日志工具类

tags/正式3.13.0
王宁 1 year ago
parent
commit
87fcf5c450
100 changed files with 1299 additions and 165 deletions
  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 View File

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 View File

112
     public void setBuildnum(Integer buildnum){
112
     public void setBuildnum(Integer buildnum){
113
         this.buildnum = buildnum;
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 View File

54
     public Queue resourceDelQueue2() {
54
     public Queue resourceDelQueue2() {
55
         return new Queue(resourceDelQueue2);
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 View File

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 View File

2
 
2
 
3
 import com.xhkjedu.base.TkMapper;
3
 import com.xhkjedu.base.TkMapper;
4
 import com.xhkjedu.sapi.model.system.TUser;
4
 import com.xhkjedu.sapi.model.system.TUser;
5
-import com.xhkjedu.sapi.vo.system.UserVo;
5
+import com.xhkjedu.vo.system.UserVo;
6
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
7
 import org.springframework.stereotype.Repository;
7
 import org.springframework.stereotype.Repository;
8
 
8
 
42
 
42
 
43
     //获取用户信息
43
     //获取用户信息
44
     TUser getUserTypeAndSchool(@Param("userid") Integer userid);
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 View File

5
 import com.xhkjedu.sapi.mapper.system.SchoolMapper;
5
 import com.xhkjedu.sapi.mapper.system.SchoolMapper;
6
 import com.xhkjedu.sapi.mapper.system.UserMapper;
6
 import com.xhkjedu.sapi.mapper.system.UserMapper;
7
 import com.xhkjedu.sapi.model.system.TSchool;
7
 import com.xhkjedu.sapi.model.system.TSchool;
8
-import com.xhkjedu.utils.N_Utils;
9
-import com.xhkjedu.vo.ResultVo;
10
 import com.xhkjedu.sapi.vo.dock.LcAdminVo;
8
 import com.xhkjedu.sapi.vo.dock.LcAdminVo;
11
 import com.xhkjedu.sapi.vo.dock.LcResultVo;
9
 import com.xhkjedu.sapi.vo.dock.LcResultVo;
12
 import com.xhkjedu.sapi.vo.dock.LcSchoolVo;
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
 import lombok.extern.slf4j.Slf4j;
14
 import lombok.extern.slf4j.Slf4j;
15
 import org.springframework.stereotype.Service;
15
 import org.springframework.stereotype.Service;
16
 
16
 

+ 8
- 0
sapi/src/main/resources/application.properties View File

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

28
         </foreach>
28
         </foreach>
29
     </update>
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
         select userid,username,loginname,loginpwd from t_user where schoolid=#{schoolid}
33
         select userid,username,loginname,loginpwd from t_user where schoolid=#{schoolid}
35
         and usertype=0 and userstate=1 order by userid limit 1
34
         and usertype=0 and userstate=1 order by userid limit 1
36
     </select>
35
     </select>
48
     <select id="getUserTypeAndSchool" resultType="com.xhkjedu.sapi.model.system.TUser">
47
     <select id="getUserTypeAndSchool" resultType="com.xhkjedu.sapi.model.system.TUser">
49
         select usertype,schoolid from t_user where userid=#{userid}
48
         select usertype,schoolid from t_user where userid=#{userid}
50
     </select>
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
 </mapper>
56
 </mapper>

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/SclassApplication.java View File

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
 import org.springframework.boot.SpringApplication;
4
 import org.springframework.boot.SpringApplication;
5
 import org.springframework.boot.autoconfigure.SpringBootApplication;
5
 import org.springframework.boot.autoconfigure.SpringBootApplication;
6
 import tk.mybatis.spring.annotation.MapperScan;
6
 import tk.mybatis.spring.annotation.MapperScan;

+ 218
- 0
sclass/src/main/java/com/xhkjedu/sclass/aop/WebControllerAop.java View File

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 View File

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

+ 24
- 0
sclass/src/main/java/com/xhkjedu/sclass/config/RabbitConfig.java View File

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 View File

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

+ 11
- 11
sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomController.java View File

1
-package com.xhkjedu.slog.controller.classroom;
1
+package com.xhkjedu.sclass.controller.classroom;
2
 
2
 
3
 import com.alibaba.fastjson.JSON;
3
 import com.alibaba.fastjson.JSON;
4
 import com.github.pagehelper.PageHelper;
4
 import com.github.pagehelper.PageHelper;
5
 import com.github.pagehelper.PageInfo;
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
 import com.xhkjedu.utils.N_Utils;
16
 import com.xhkjedu.utils.N_Utils;
17
 import com.xhkjedu.utils.PageUtil;
17
 import com.xhkjedu.utils.PageUtil;
18
 import com.xhkjedu.vo.PageResult;
18
 import com.xhkjedu.vo.PageResult;

+ 3
- 3
sclass/src/main/java/com/xhkjedu/sclass/controller/classroom/ClassroomVideoController.java View File

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
 import com.xhkjedu.utils.N_Utils;
5
 import com.xhkjedu.utils.N_Utils;
6
 import com.xhkjedu.vo.ResultVo;
6
 import com.xhkjedu.vo.ResultVo;
7
 import org.springframework.web.bind.annotation.PostMapping;
7
 import org.springframework.web.bind.annotation.PostMapping;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/controller/status/StatusController.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/interceptors/HttpServletFilter.java View File

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

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestInterceptor.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/interceptors/RequestWrapper.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/interceptors/WebMvcConfg.java View File

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

+ 3
- 3
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomActivestudentMapper.java View File

1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2
 
2
 
3
 import com.xhkjedu.base.TkMapper;
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
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
7
 
7
 
8
 import java.util.List;
8
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomAskstudentMapper.java View File

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

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomAskteacherMapper.java View File

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

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomFileMapper.java View File

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

+ 10
- 10
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomMapper.java View File

1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2
 
2
 
3
 import com.xhkjedu.base.TkMapper;
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
 import org.apache.ibatis.annotations.Param;
13
 import org.apache.ibatis.annotations.Param;
14
 
14
 
15
 import java.util.List;
15
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperFileMapper.java View File

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

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperMapper.java View File

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

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperQtypeMapper.java View File

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

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperScantronMapper.java View File

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

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperStudentMapper.java View File

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

+ 3
- 3
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomPaperStudentScantronMapper.java View File

1
-package com.xhkjedu.slog.mapper.classroom;
1
+package com.xhkjedu.sclass.mapper.classroom;
2
 
2
 
3
 import com.xhkjedu.base.TkMapper;
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
 import org.apache.ibatis.annotations.Param;
6
 import org.apache.ibatis.annotations.Param;
7
 
7
 
8
 import java.util.List;
8
 import java.util.List;

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomSignMapper.java View File

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

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/mapper/classroom/ClassroomVideoMapper.java View File

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

+ 10
- 0
sclass/src/main/java/com/xhkjedu/sclass/mapper/system/UserMapper.java View File

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 View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomActivestudent.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomAskstudent.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomAskteacher.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomFile.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaper.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperFile.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperQtype.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperScantron.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperStudent.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomPaperStudentScantron.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomSign.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/classroom/TClassroomVideo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/paperstudent/TPaperStudent.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/model/paperstudent/TPaperStudentScantron.java View File

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

+ 28
- 0
sclass/src/main/java/com/xhkjedu/sclass/mq/HandleLogSender.java View File

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 View File

1
-package com.xhkjedu.slog.service.classroom;
1
+package com.xhkjedu.sclass.service.classroom;
2
 
2
 
3
 import com.alibaba.fastjson.JSON;
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
 import com.xhkjedu.utils.N_Utils;
18
 import com.xhkjedu.utils.N_Utils;
19
 import lombok.extern.slf4j.Slf4j;
19
 import lombok.extern.slf4j.Slf4j;
20
 import org.springframework.stereotype.Service;
20
 import org.springframework.stereotype.Service;

+ 7
- 7
sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomService.java View File

1
-package com.xhkjedu.slog.service.classroom;
1
+package com.xhkjedu.sclass.service.classroom;
2
 
2
 
3
 import com.alibaba.fastjson.JSON;
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
 import com.xhkjedu.utils.N_Utils;
10
 import com.xhkjedu.utils.N_Utils;
11
 import com.xhkjedu.vo.ResultVo;
11
 import com.xhkjedu.vo.ResultVo;
12
 import lombok.extern.slf4j.Slf4j;
12
 import lombok.extern.slf4j.Slf4j;

+ 3
- 3
sclass/src/main/java/com/xhkjedu/sclass/service/classroom/ClassroomVideoService.java View File

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
 import com.xhkjedu.utils.N_Utils;
5
 import com.xhkjedu.utils.N_Utils;
6
 import org.springframework.stereotype.Service;
6
 import org.springframework.stereotype.Service;
7
 
7
 

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/task/UriMapTask.java View File

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
 import org.springframework.scheduling.annotation.Scheduled;
4
 import org.springframework.scheduling.annotation.Scheduled;
5
 import org.springframework.stereotype.Component;
5
 import org.springframework.stereotype.Component;
6
 
6
 

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/utils/ArithUtil.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/utils/ClassUtil.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ObjectiveAnswerVo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ObjectiveVo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportEQuestionVo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportExamVo.java View File

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

+ 2
- 2
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/ReportRoomVo.java View File

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
 import lombok.Data;
4
 import lombok.Data;
5
 
5
 
6
 import java.util.List;
6
 import java.util.List;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomAskTeacherVo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectCallVo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectExamVo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomCorrectVo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/RoomVo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/classroom/SubjectiveVo.java View File

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

+ 3
- 3
sclass/src/main/java/com/xhkjedu/sclass/vo/paper/CheckClassVo.java View File

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
 import lombok.Data;
5
 import lombok.Data;
6
 
6
 
7
 import java.util.List;
7
 import java.util.List;

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/paper/PaperVo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/paperstudent/StudentVo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/room/RoomPVo.java View File

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

+ 1
- 1
sclass/src/main/java/com/xhkjedu/sclass/vo/room/RoomParamVo.java View File

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

+ 22
- 1
sclass/src/main/resources/application.properties View File

37
 mybatis.configuration.call-setters-on-nulls=true
37
 mybatis.configuration.call-setters-on-nulls=true
38
 mapper.identity=MYSQL
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
 spring.pagehelper.helper-dialect=mysql
42
 spring.pagehelper.helper-dialect=mysql
43
 
43
 
57
 #secretKey必须为24位
57
 #secretKey必须为24位
58
 secretKey=nanhuakaizhangjianwangni
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
 #默认为false,不开启定时任务
79
 #默认为false,不开启定时任务
62
 enable.scheduled=false
80
 enable.scheduled=false
63
 #每隔3s清除一下请求地址map
81
 #每隔3s清除一下请求地址map
64
 cron.deleteUriMap=0/3 * * * * ?
82
 cron.deleteUriMap=0/3 * * * * ?
65
 
83
 
84
+#解析ip归属地数据
85
+ipregiondb=D:\\school\\ip2region.xdb
86
+
66
 #白名单接口
87
 #白名单接口
67
 whitelistAPI=/status/info
88
 whitelistAPI=/status/info
68
 
89
 

+ 1
- 1
sclass/src/main/resources/mapper/classroom/ClassroomActivestudentMapper.xml View File

48
         select group_concat(asktid) from t_classroom_askteacher where roomid=#{roomid}
48
         select group_concat(asktid) from t_classroom_askteacher where roomid=#{roomid}
49
     </select>
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
         select cs.studentid,(
52
         select cs.studentid,(
53
             (select count(distinct s.userid) from t_classroom_sign s where s.roomid=#{roomid} and s.userid=cs.studentid)
53
             (select count(distinct s.userid) from t_classroom_sign s where s.roomid=#{roomid} and s.userid=cs.studentid)
54
         <if test="asktids!=null and asktids!=''">
54
         <if test="asktids!=null and asktids!=''">

+ 19
- 19
sclass/src/main/resources/mapper/classroom/ClassroomMapper.xml View File

16
         where r.roomid=#{roomid};
16
         where r.roomid=#{roomid};
17
     </select>
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
         <result property="roomid" column="roomid"></result>
20
         <result property="roomid" column="roomid"></result>
21
         <result property="roomname" column="roomname"></result>
21
         <result property="roomname" column="roomname"></result>
22
         <result property="createtime" column="createtime"></result>
22
         <result property="createtime" column="createtime"></result>
24
         <result property="classname" column="classname"></result>
24
         <result property="classname" column="classname"></result>
25
         <result property="gradeid" column="gradeid"></result>
25
         <result property="gradeid" column="gradeid"></result>
26
         <result property="teachername" column="teachername"></result>
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
                     select="listCall" column="{roomid=roomid,realstunum=realstunum}">
28
                     select="listCall" column="{roomid=roomid,realstunum=realstunum}">
29
         </collection>
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
                     select="listExam" column="{roomid=roomid,realstunum=realstunum}">
31
                     select="listExam" column="{roomid=roomid,realstunum=realstunum}">
32
         </collection>
32
         </collection>
33
     </resultMap>
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
         select s.asktid,count(*)commitnum,count(*) stunum
35
         select s.asktid,count(*)commitnum,count(*) stunum
36
         ,sum(case when s.radiocorrect!=0 then 1 else 0 end)correctnum
36
         ,sum(case when s.radiocorrect!=0 then 1 else 0 end)correctnum
37
         from t_classroom_askstudent s left join t_classroom_askteacher rt on s.asktid=rt.asktid
37
         from t_classroom_askstudent s left join t_classroom_askteacher rt on s.asktid=rt.asktid
38
         where rt.roomid=#{roomid} and rt.asktype between 32 and 33
38
         where rt.roomid=#{roomid} and rt.asktype between 32 and 33
39
         group by s.asktid order by rt.createtime
39
         group by s.asktid order by rt.createtime
40
     </select>
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
         select s.paperid,p.papername,count(*)commitnum,count(*) stunum
42
         select s.paperid,p.papername,count(*)commitnum,count(*) stunum
43
         ,sum(case when s.pschecked!=0 then 1 else 0 end)correctnum
43
         ,sum(case when s.pschecked!=0 then 1 else 0 end)correctnum
44
         from t_classroom_paper_student s left join t_classroom_paper p on s.paperid=p.paperid
44
         from t_classroom_paper_student s left join t_classroom_paper p on s.paperid=p.paperid
55
     </select>
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
         <result property="classid" column="classid"></result>
59
         <result property="classid" column="classid"></result>
60
         <result property="classnum" column="classnum"></result>
60
         <result property="classnum" column="classnum"></result>
61
         <result property="ytjnum" column="ytjnum"></result>
61
         <result property="ytjnum" column="ytjnum"></result>
62
         <result property="ypynum" column="ypynum"></result>
62
         <result property="ypynum" column="ypynum"></result>
63
         <result property="teacherpic" column="teacherpic"></result>
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
             <result property="psid" column="psid"></result>
65
             <result property="psid" column="psid"></result>
66
             <result property="studentid" column="studentid"></result>
66
             <result property="studentid" column="studentid"></result>
67
             <result property="studentname" column="studentname"></result>
67
             <result property="studentname" column="studentname"></result>
90
         group by ps.psid order by ps.studentid
90
         group by ps.psid order by ps.studentid
91
     </select>
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
         <result property="typename" column="typename"></result>
94
         <result property="typename" column="typename"></result>
95
         <result property="answer" column="answer"></result>
95
         <result property="answer" column="answer"></result>
96
         <result property="correctrate" column="correctrate"></result>
96
         <result property="correctrate" column="correctrate"></result>
98
         <result property="psscore" column="psscore"></result>
98
         <result property="psscore" column="psscore"></result>
99
         <result property="avgscore" column="avgscore"></result>
99
         <result property="avgscore" column="avgscore"></result>
100
         <result property="maxscore" column="maxscore"></result>
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
             <result property="section" column="section"></result>
102
             <result property="section" column="section"></result>
103
             <result property="stunum" column="stunum"></result>
103
             <result property="stunum" column="stunum"></result>
104
             <result property="stuscore" column="stuscore"></result>
104
             <result property="stuscore" column="stuscore"></result>
132
         group by pss.useranswer
132
         group by pss.useranswer
133
     </select>
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
         <result property="typename" column="typename"></result>
136
         <result property="typename" column="typename"></result>
137
         <result property="correctrate" column="correctrate"></result>
137
         <result property="correctrate" column="correctrate"></result>
138
         <result property="psorder" column="psorder"></result>
138
         <result property="psorder" column="psorder"></result>
222
         <collection property="asks" ofType="java.util.Map"
222
         <collection property="asks" ofType="java.util.Map"
223
                     select="listStuAsk" column="{roomid=roomid,studentid=studentid}">
223
                     select="listStuAsk" column="{roomid=roomid,studentid=studentid}">
224
         </collection>
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
                     select="listFile" column="{roomid=roomid}">
226
                     select="listFile" column="{roomid=roomid}">
227
         </collection>
227
         </collection>
228
     </resultMap>
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
         select * from t_classroom_file where roomid=#{roomid}
230
         select * from t_classroom_file where roomid=#{roomid}
231
     </select>
231
     </select>
232
     <select id="getReportStu" resultMap="stuRoomResult">
232
     <select id="getReportStu" resultMap="stuRoomResult">
324
         <result property="wpynum" column="wpynum"></result>
324
         <result property="wpynum" column="wpynum"></result>
325
         <result property="classnum" column="classnum"></result>
325
         <result property="classnum" column="classnum"></result>
326
         <result property="signstate" column="signstate"></result>
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
                     select="listAskTeachersForRoom" column="{roomid=roomid}">
328
                     select="listAskTeachersForRoom" column="{roomid=roomid}">
329
             <result property="asktid" column="asktid"></result>
329
             <result property="asktid" column="asktid"></result>
330
             <result property="asktype" column="asktype"></result>
330
             <result property="asktype" column="asktype"></result>
362
         </if>
362
         </if>
363
         ORDER BY c.createtime DESC
363
         ORDER BY c.createtime DESC
364
     </select>
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
         select asktid,asktype from t_classroom_askteacher where roomid=#{roomid}
366
         select asktid,asktype from t_classroom_askteacher where roomid=#{roomid}
367
     </select>
367
     </select>
368
     <select id="listFilesForRoom" resultType="java.util.Map">
368
     <select id="listFilesForRoom" resultType="java.util.Map">
386
         </foreach>
386
         </foreach>
387
     </update>
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
         select r.roomname,r.classnum,r.realstunum,r.createtime,r.endtime,c.classname,c.gradeid,u.username createname
390
         select r.roomname,r.classnum,r.realstunum,r.createtime,r.endtime,c.classname,c.gradeid,u.username createname
391
         ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=20)asknum
391
         ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=20)asknum
392
         ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=21)callnum
392
         ,(select count(*) from t_classroom_askteacher ct where ct.roomid=r.roomid and ct.asktype=21)callnum
426
         order by convert(u.username using gbk)
426
         order by convert(u.username using gbk)
427
     </select>
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
         select * from t_classroom_file f where f.roomid=#{roomid} order by f.createtime
430
         select * from t_classroom_file f where f.roomid=#{roomid} order by f.createtime
431
     </select>
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
         select ps.paperid,ps.psorder,ps.psanswer,ps.psscore,ps.ctypename,ps.ctype,ps.pscaid
434
         select ps.paperid,ps.psorder,ps.psanswer,ps.psscore,ps.ctypename,ps.ctype,ps.pscaid
435
         ,sum(case when q.answered=1 then 1 else 0 end)commitrate
435
         ,sum(case when q.answered=1 then 1 else 0 end)commitrate
436
         ,sum(case when q.stuscore=ps.psscore then 1 else 0 end)correctrate
436
         ,sum(case when q.stuscore=ps.psscore then 1 else 0 end)correctrate
443
         group by ps.pscaid order by ps.psorder
443
         group by ps.pscaid order by ps.psorder
444
     </select>
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
         SELECT p.paperid,p.papername,c.classid,ifnull(truncate(SUM(ps.stuscore)*100/(p.paperscore*COUNT(ps.psid)),2),0)scorerate
447
         SELECT p.paperid,p.papername,c.classid,ifnull(truncate(SUM(ps.stuscore)*100/(p.paperscore*COUNT(ps.psid)),2),0)scorerate
448
         ,ifnull(truncate(SUM(ps.stuscore)/COUNT(ps.psid),2),0)avgscore,ifnull(MAX(ps.stuscore),0)maxscore,COUNT(ps.psid)ytjnum
448
         ,ifnull(truncate(SUM(ps.stuscore)/COUNT(ps.psid),2),0)avgscore,ifnull(MAX(ps.stuscore),0)maxscore,COUNT(ps.psid)ytjnum
449
         FROM t_classroom_paper p
449
         FROM t_classroom_paper p
490
         </foreach>
490
         </foreach>
491
     </update>
491
     </update>
492
     <!--根据班级ids获取学生数量-->
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
         SELECT classid,classnum FROM t_class WHERE classid in
494
         SELECT classid,classnum FROM t_class WHERE classid in
495
         <foreach collection="classids" item="classid" open="(" close=")" separator=",">
495
         <foreach collection="classids" item="classid" open="(" close=")" separator=",">
496
             ${classid}
496
             ${classid}

+ 2
- 2
sclass/src/main/resources/mapper/classroom/ClassroomPaperFileMapper.xml View File

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

+ 1
- 1
sclass/src/main/resources/mapper/classroom/ClassroomPaperScantronMapper.xml View File

13
     </insert>
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
         select pscaid,psanswer,ctype from t_classroom_paper_scantron where pscaid in
17
         select pscaid,psanswer,ctype from t_classroom_paper_scantron where pscaid in
18
         <foreach collection="pscaids" item="pscaid" index="index" open="(" separator="," close=")">
18
         <foreach collection="pscaids" item="pscaid" index="index" open="(" separator="," close=")">
19
             ${pscaid}
19
             ${pscaid}

+ 1
- 1
sclass/src/main/resources/mapper/classroom/ClassroomPaperStudentMapper.xml View File

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
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.classroom.ClassroomPaperStudentMapper">
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
         select s.*,p.subjectid,p.papername from t_classroom_paper_student s
6
         select s.*,p.subjectid,p.papername from t_classroom_paper_student s
7
         left join t_classroom_paper p on p.paperid=s.paperid
7
         left join t_classroom_paper p on p.paperid=s.paperid
8
         where s.psid=#{psid} limit 1
8
         where s.psid=#{psid} limit 1

+ 9
- 0
sclass/src/main/resources/mapper/system/UserMapper.xml View File

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 View File

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

+ 4
- 1
scommons/src/main/java/com/xhkjedu/vo/system/UserVo.java View File

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

+ 218
- 0
sexam/src/main/java/com/xhkjedu/sexam/aop/WebControllerAop.java View File

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 View File

69
         this.buildnum = buildnum;
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 View File

92
     public Queue examBaseToScanImgQueue2(){ return new Queue(examBaseToScanImgQueue2);}
92
     public Queue examBaseToScanImgQueue2(){ return new Queue(examBaseToScanImgQueue2);}
93
     @Bean
93
     @Bean
94
     public Queue examImgToPdfQueue2(){ return new Queue(examImgToPdfQueue2);}
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 View File

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

+ 28
- 0
sexam/src/main/java/com/xhkjedu/sexam/listener/HandleLogSender.java View File

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 View File

1
 package com.xhkjedu.sexam.mapper.system;
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
 import org.apache.ibatis.annotations.Param;
4
 import org.apache.ibatis.annotations.Param;
5
 
5
 
6
 import java.util.List;
6
 import java.util.List;
36
 
36
 
37
     //根据用户id获取用户所属学校id
37
     //根据用户id获取用户所属学校id
38
     Integer getSchoolidByUserid(@Param("userid")Integer userid);
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 View File

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

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/notice/NoticeService.java View File

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

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/paper/EPaperCorrectTeacherService.java View File

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

+ 1
- 1
sexam/src/main/java/com/xhkjedu/sexam/service/report/EReportGenerateService.java View File

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

+ 6
- 0
sexam/src/main/resources/application.properties View File

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

+ 8
- 3
sexam/src/main/resources/mapper/system/UserMapper.xml View File

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.xhkjedu.sexam.mapper.system.UserMapper">
3
 <mapper namespace="com.xhkjedu.sexam.mapper.system.UserMapper">
4
     <!--根据用户ids查找手机号-->
4
     <!--根据用户ids查找手机号-->
5
-    <select id="listPhoneByUserIds" resultType="com.xhkjedu.sexam.vo.system.UserVo">
5
+    <select id="listPhoneByUserIds" resultType="com.xhkjedu.vo.system.UserVo">
6
         select userid,userphone from t_user where userid in
6
         select userid,userphone from t_user where userid in
7
         <foreach collection="userids" item="userid" open="(" separator="," close=")">
7
         <foreach collection="userids" item="userid" open="(" separator="," close=")">
8
             ${userid}
8
             ${userid}
16
         where ec.examid=#{examid}
16
         where ec.examid=#{examid}
17
     </select>
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
         select u.userid,u.userphone
20
         select u.userid,u.userphone
21
         from t_class_teacher ct left join t_user u on ct.teacherid = u.userid
21
         from t_class_teacher ct left join t_user u on ct.teacherid = u.userid
22
         where ct.classid in(${classids}) and u.userstate=1
22
         where ct.classid in(${classids}) and u.userstate=1
47
         select userid from t_user where examno=#{examno}
47
         select userid from t_user where examno=#{examno}
48
     </select>
48
     </select>
49
     <!--根据用户ids查找用户姓名-->
49
     <!--根据用户ids查找用户姓名-->
50
-    <select id="listNameByUserIds" resultType="com.xhkjedu.sexam.vo.system.UserVo">
50
+    <select id="listNameByUserIds" resultType="com.xhkjedu.vo.system.UserVo">
51
         select userid,username,loginname from t_user where userid in
51
         select userid,username,loginname from t_user where userid in
52
         <foreach collection="userids" item="userid" open="(" separator="," close=")">
52
         <foreach collection="userids" item="userid" open="(" separator="," close=")">
53
             ${userid}
53
             ${userid}
69
     <select id="getSchoolidByUserid" resultType="java.lang.Integer">
69
     <select id="getSchoolidByUserid" resultType="java.lang.Integer">
70
         select schoolid from t_user where userid=#{userid}
70
         select schoolid from t_user where userid=#{userid}
71
     </select>
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
 </mapper>
77
 </mapper>

+ 218
- 0
slive/src/main/java/com/xhkjedu/slive/aop/WebControllerAop.java View File

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 View File

20
     public Queue queueA() {
20
     public Queue queueA() {
21
         return new Queue(rabbitmqQueue); //队列持久
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 View File

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 View File

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

+ 2
- 0
slive/src/main/resources/application.properties View File

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

+ 5
- 0
slive/src/main/resources/mapper/system/UserMapper.xml View File

30
         select u.userid,u.username,u.loginname,u.usertype,u.userstate,u.schoolid
30
         select u.userid,u.username,u.loginname,u.usertype,u.userstate,u.schoolid
31
         from t_user u where u.userid=#{userid} limit 1
31
         from t_user u where u.userid=#{userid} limit 1
32
     </select>
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
 </mapper>
38
 </mapper>

+ 0
- 0
slog/src/main/java/com/xhkjedu/slog/SlogApplication.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save