|
|
@@ -0,0 +1,163 @@
|
|
|
+package com.uas.platform.b2b.erp.model;
|
|
|
+
|
|
|
+import java.io.Serializable;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+import javax.persistence.Column;
|
|
|
+import javax.persistence.Entity;
|
|
|
+import javax.persistence.GeneratedValue;
|
|
|
+import javax.persistence.GenerationType;
|
|
|
+import javax.persistence.Id;
|
|
|
+import javax.persistence.SequenceGenerator;
|
|
|
+import javax.persistence.Table;
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
+
|
|
|
+import org.codehaus.jackson.annotate.JsonIgnore;
|
|
|
+
|
|
|
+import com.uas.platform.b2b.support.SystemSession;
|
|
|
+import com.uas.platform.core.logging.BufferedLogable;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 与ERP交互的日志
|
|
|
+ *
|
|
|
+ * @author yingp
|
|
|
+ *
|
|
|
+ */
|
|
|
+@Entity
|
|
|
+@Table(name = "log$erp")
|
|
|
+public class ErpLog extends BufferedLogable implements Serializable {
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private static final long serialVersionUID = 1L;
|
|
|
+
|
|
|
+ @Id
|
|
|
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "log$erp_gen")
|
|
|
+ @SequenceGenerator(name = "log$erp_gen", sequenceName = "log$erp_seq", allocationSize = 1)
|
|
|
+ @Column(name = "log_id")
|
|
|
+ private Long id;
|
|
|
+
|
|
|
+ @Column(name = "log_enuu")
|
|
|
+ private Long enUU;
|
|
|
+
|
|
|
+ @NotNull
|
|
|
+ @Column(name = "log_useruu")
|
|
|
+ private Long userUU;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 日志时间
|
|
|
+ */
|
|
|
+ @Column(name = "log_time")
|
|
|
+ private Long time;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * ip
|
|
|
+ */
|
|
|
+ @Column(name = "log_ip")
|
|
|
+ private String ip;
|
|
|
+
|
|
|
+ @Column(name = "log_message")
|
|
|
+ private String message;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 传输的总数据量
|
|
|
+ */
|
|
|
+ @Column(name = "log_total")
|
|
|
+ private Integer total;
|
|
|
+
|
|
|
+ @JsonIgnore
|
|
|
+ public Long getId() {
|
|
|
+ return id;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setId(Long id) {
|
|
|
+ this.id = id;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long getEnUU() {
|
|
|
+ return enUU;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setEnUU(Long enUU) {
|
|
|
+ this.enUU = enUU;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long getUserUU() {
|
|
|
+ return userUU;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setUserUU(Long userUU) {
|
|
|
+ this.userUU = userUU;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long getTime() {
|
|
|
+ return time;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTime(Long time) {
|
|
|
+ this.time = time;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getIp() {
|
|
|
+ return ip;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setIp(String ip) {
|
|
|
+ this.ip = ip;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getMessage() {
|
|
|
+ return message;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setMessage(String message) {
|
|
|
+ this.message = message;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Integer getTotal() {
|
|
|
+ return total;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTotal(Integer total) {
|
|
|
+ this.total = total;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ErpLog() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public ErpLog(String message, int total) {
|
|
|
+ this.enUU = SystemSession.getUser().getEnterprise().getUu();
|
|
|
+ this.message = message;
|
|
|
+ this.time = new Date().getTime();
|
|
|
+ this.total = total;
|
|
|
+ this.userUU = SystemSession.getUser().getUserUU();
|
|
|
+ this.ip = SystemSession.getUser().getIp();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void bufferedLog(String bufferedMessage) {
|
|
|
+ String[] strArray = bufferedMessage.split(separator);
|
|
|
+ if (strArray.length == 6) {
|
|
|
+ this.time = Long.parseLong(strArray[0]);
|
|
|
+ this.ip = strArray[1];
|
|
|
+ this.enUU = Long.parseLong(strArray[2]);
|
|
|
+ this.userUU = Long.parseLong(strArray[3]);
|
|
|
+ this.message = strArray[4];
|
|
|
+ this.total = Integer.parseInt(strArray[5]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String bufferedMessage() {
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ sb.append(this.time).append(separator);
|
|
|
+ sb.append(this.ip).append(separator);
|
|
|
+ sb.append(this.enUU).append(separator);
|
|
|
+ sb.append(this.userUU).append(separator);
|
|
|
+ sb.append(this.message).append(separator);
|
|
|
+ sb.append(this.total);
|
|
|
+ return sb.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|