|
|
@@ -0,0 +1,234 @@
|
|
|
+package com.uas.platform.b2c.core.support.log;
|
|
|
+
|
|
|
+import com.uas.platform.b2c.core.support.SystemSession;
|
|
|
+import com.uas.platform.core.logging.BufferedLogable;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 用户操作日志
|
|
|
+ * @author
|
|
|
+ * @version 2017年8月3日15:04:38 suntg 创建
|
|
|
+ */
|
|
|
+public class UsageAopLog extends BufferedLogable {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * id
|
|
|
+ */
|
|
|
+ private Long id;
|
|
|
+ /**
|
|
|
+ * 客户端IP地址
|
|
|
+ */
|
|
|
+ private String ip;
|
|
|
+ /**
|
|
|
+ * 发起时间
|
|
|
+ */
|
|
|
+ private Long date;
|
|
|
+ /**
|
|
|
+ * 操作请求uri
|
|
|
+ */
|
|
|
+ private String uri;
|
|
|
+ /**
|
|
|
+ * 操作请求对应的实现方法
|
|
|
+ */
|
|
|
+ private String method;
|
|
|
+ /**
|
|
|
+ * 请求参数
|
|
|
+ */
|
|
|
+ private String params;
|
|
|
+ /**
|
|
|
+ * 从开始到完成所用时间,毫秒
|
|
|
+ */
|
|
|
+ private long time;
|
|
|
+ /**
|
|
|
+ * 个人UU号,可以为空
|
|
|
+ */
|
|
|
+ private Long userUu;
|
|
|
+ /**
|
|
|
+ * 个人名字,可以为空
|
|
|
+ */
|
|
|
+ private String userName;
|
|
|
+ /**
|
|
|
+ * 企业UU号,可以为空
|
|
|
+ */
|
|
|
+ private Long enUu;
|
|
|
+ /**
|
|
|
+ * 企业名称,可以为空
|
|
|
+ */
|
|
|
+ private String enName;
|
|
|
+ /**
|
|
|
+ * 模块名称
|
|
|
+ */
|
|
|
+ private String module;
|
|
|
+ /**
|
|
|
+ * 操作详情
|
|
|
+ */
|
|
|
+ private String detail;
|
|
|
+
|
|
|
+ public Long getId() {
|
|
|
+ return id;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setId(Long id) {
|
|
|
+ this.id = id;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public String getIp() {
|
|
|
+ return ip;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setIp(String ip) {
|
|
|
+ this.ip = ip;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long getDate() {
|
|
|
+ return date;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setDate(Long date) {
|
|
|
+ this.date = date;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getUri() {
|
|
|
+ return uri;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setUri(String uri) {
|
|
|
+ this.uri = uri;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getMethod() {
|
|
|
+ return method;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setMethod(String method) {
|
|
|
+ this.method = method;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getParams() {
|
|
|
+ return params;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setParams(String params) {
|
|
|
+ this.params = params;
|
|
|
+ }
|
|
|
+
|
|
|
+ public long getTime() {
|
|
|
+ return time;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTime(long time) {
|
|
|
+ this.time = time;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long getUserUu() {
|
|
|
+ return userUu;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setUserUu(Long userUu) {
|
|
|
+ this.userUu = userUu;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getUserName() {
|
|
|
+ return userName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setUserName(String userName) {
|
|
|
+ this.userName = userName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long getEnUu() {
|
|
|
+ return enUu;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setEnUu(Long enUu) {
|
|
|
+ this.enUu = enUu;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getEnName() {
|
|
|
+ return enName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setEnName(String enName) {
|
|
|
+ this.enName = enName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getModule() {
|
|
|
+ return module;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setModule(String module) {
|
|
|
+ this.module = module;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getDetail() {
|
|
|
+ return detail;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setDetail(String detail) {
|
|
|
+ this.detail = detail;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String bufferedMessage() {
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ sb.append(this.ip).append(separator);
|
|
|
+ sb.append(this.date).append(separator);
|
|
|
+ sb.append(this.uri).append(separator);
|
|
|
+ sb.append(this.method).append(separator);
|
|
|
+ sb.append(this.params).append(separator);
|
|
|
+ sb.append(this.time).append(separator);
|
|
|
+ sb.append(this.userUu == null ? " " : this.userUu).append(separator);
|
|
|
+ sb.append(this.userName == null ? " " : this.userName).append(separator);
|
|
|
+ sb.append(this.enUu == null ? " " : this.enUu).append(separator);
|
|
|
+ sb.append(this.enName == null ? " " : this.enName).append(separator);
|
|
|
+ sb.append(this.module == null ? " " : this.module).append(separator);
|
|
|
+ sb.append(this.detail == null ? " " : this.detail);
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void bufferedLog(String bufferedMessage) {
|
|
|
+ String[] strArray = bufferedMessage.split(separator);
|
|
|
+ if (strArray.length == 12) {
|
|
|
+ this.ip = strArray[0];
|
|
|
+ if (!strArray[1].equals("null"))
|
|
|
+ this.date = Long.parseLong(strArray[1]);
|
|
|
+ this.uri = strArray[2];
|
|
|
+ this.method = strArray[3];
|
|
|
+ this.params = strArray[4];
|
|
|
+ if (!strArray[5].equals("null"))
|
|
|
+ this.time = Long.parseLong(strArray[5]);
|
|
|
+ if (!strArray[6].equals(" "))
|
|
|
+ this.userUu = Long.parseLong(strArray[6]);
|
|
|
+ this.userName = StringUtils.hasText(strArray[7]) ? strArray[7] : null;
|
|
|
+ if (!strArray[8].equals(" "))
|
|
|
+ this.enUu = Long.parseLong(strArray[8]);
|
|
|
+ this.enName = StringUtils.hasText(strArray[9]) ? strArray[9] : null;
|
|
|
+ this.module = StringUtils.hasText(strArray[10]) ? strArray[10] : null;
|
|
|
+ this.detail = StringUtils.hasText(strArray[11]) ? strArray[11] : null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public UsageAopLog() {
|
|
|
+ }
|
|
|
+
|
|
|
+ public UsageAopLog(String ip, Long date, String uri, String method, String params, long time, String module, String detail) {
|
|
|
+ this.ip = ip;
|
|
|
+ this.uri = uri;
|
|
|
+ this.method = method;
|
|
|
+ this.date = date;
|
|
|
+ this.params = params;
|
|
|
+ this.time = time;
|
|
|
+ this.module = module;
|
|
|
+ this.detail = detail;
|
|
|
+ if(SystemSession.getUser() != null) {
|
|
|
+ this.userUu = SystemSession.getUser().getUserUU();
|
|
|
+ this.userName = SystemSession.getUser().getUserName();
|
|
|
+ if(SystemSession.getUser().getEnterprise() != null) {
|
|
|
+ this.enName = SystemSession.getUser().getEnterprise().getEnName();
|
|
|
+ this.enUu = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|