|
@@ -27,6 +27,14 @@ public class OperationRecordUtil {
|
|
|
private String userServiceUrl;
|
|
private String userServiceUrl;
|
|
|
|
|
|
|
|
public void recordLogoutAction(HttpServletRequest request){
|
|
public void recordLogoutAction(HttpServletRequest request){
|
|
|
|
|
+ doRecord(request, "Logout");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void recordUserOperation(HttpServletRequest request, String operation){
|
|
|
|
|
+ doRecord(request, operation);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void doRecord(HttpServletRequest request, String operation) {
|
|
|
Long userId = Long.parseLong((String)request.getSession().getAttribute("userId"));
|
|
Long userId = Long.parseLong((String)request.getSession().getAttribute("userId"));
|
|
|
String ip = getRequestIp(request);
|
|
String ip = getRequestIp(request);
|
|
|
HttpHeaders httpHeaders = new HttpHeaders();
|
|
HttpHeaders httpHeaders = new HttpHeaders();
|
|
@@ -34,7 +42,7 @@ public class OperationRecordUtil {
|
|
|
JSONObject params = new JSONObject();
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("ip", ip);
|
|
params.put("ip", ip);
|
|
|
params.put("userId", userId);
|
|
params.put("userId", userId);
|
|
|
- params.put("operation", "Logout");
|
|
|
|
|
|
|
+ params.put("operation", operation);
|
|
|
params.put("resource", "crowd-service");
|
|
params.put("resource", "crowd-service");
|
|
|
HttpEntity<String> entity = new HttpEntity<>(params.toString() , httpHeaders);
|
|
HttpEntity<String> entity = new HttpEntity<>(params.toString() , httpHeaders);
|
|
|
restTemplate.exchange(userServiceUrl + "/api/operation_record", HttpMethod.POST, entity, Object.class);
|
|
restTemplate.exchange(userServiceUrl + "/api/operation_record", HttpMethod.POST, entity, Object.class);
|