浏览代码

增加操作日志

liuam 7 年之前
父节点
当前提交
528d789eaf

+ 6 - 5
src/main/java/com/uas/credit/controller/ErpQueryController.java

@@ -1,9 +1,6 @@
 package com.uas.credit.controller;
 package com.uas.credit.controller;
 
 
-import com.uas.credit.model.EnterpriseJson;
-import com.uas.credit.model.EnterpriseQuery;
-import com.uas.credit.model.PersonJson;
-import com.uas.credit.model.PersonQuery;
+import com.uas.credit.model.*;
 import com.uas.credit.service.*;
 import com.uas.credit.service.*;
 import com.uas.credit.util.FlexJsonUtils;
 import com.uas.credit.util.FlexJsonUtils;
 import org.apache.commons.lang3.StringEscapeUtils;
 import org.apache.commons.lang3.StringEscapeUtils;
@@ -46,13 +43,16 @@ public class ErpQueryController {
     @Autowired
     @Autowired
     private EnterpriseJsonService enterpriseJsonService;
     private EnterpriseJsonService enterpriseJsonService;
 
 
+    @Autowired
+    private CreditLogService creditLogService;
+
     /**
     /**
      * ERP对企业进行查询
      * ERP对企业进行查询
      */
      */
     @RequestMapping(value = "/queryEn", method = RequestMethod.POST)
     @RequestMapping(value = "/queryEn", method = RequestMethod.POST)
     public EnterpriseJson queryEn(String data) {
     public EnterpriseJson queryEn(String data) {
         EnterpriseQuery erpQuery = FlexJsonUtils.fromJson(data, EnterpriseQuery.class);
         EnterpriseQuery erpQuery = FlexJsonUtils.fromJson(data, EnterpriseQuery.class);
-
+        creditLogService.save(new CreditLog("enterprise", new Date()));
         EnterpriseJson enterpriseJson = enterpriseJsonService.findByCreateTime(new Date());
         EnterpriseJson enterpriseJson = enterpriseJsonService.findByCreateTime(new Date());
         if (enterpriseJson != null && enterpriseJson.getEndept() != null) {
         if (enterpriseJson != null && enterpriseJson.getEndept() != null) {
             return enterpriseJson;
             return enterpriseJson;
@@ -79,6 +79,7 @@ public class ErpQueryController {
     @RequestMapping(value = "/queryPe", method = RequestMethod.POST)
     @RequestMapping(value = "/queryPe", method = RequestMethod.POST)
     public PersonJson queryPerson(String data) {
     public PersonJson queryPerson(String data) {
         PersonQuery erpQuery = FlexJsonUtils.fromJson(data, PersonQuery.class);
         PersonQuery erpQuery = FlexJsonUtils.fromJson(data, PersonQuery.class);
+        creditLogService.save(new CreditLog("person", new Date()));
         PersonJson personJson = personJsonService.findByCreateTime(new Date());
         PersonJson personJson = personJsonService.findByCreateTime(new Date());
         if (personJson != null && personJson.getPnidentity() != null) {
         if (personJson != null && personJson.getPnidentity() != null) {
             return personJson;
             return personJson;

+ 13 - 0
src/main/java/com/uas/credit/dao/CreditLogDao.java

@@ -0,0 +1,13 @@
+package com.uas.credit.dao;
+
+import com.uas.credit.model.CreditLog;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author liuam
+ * @since 2018/7/18 0018 上午 11:34
+ */
+@Repository
+public interface CreditLogDao extends JpaRepository<CreditLog, Long> {
+}

+ 25 - 20
src/main/java/com/uas/credit/model/CreditLog.java

@@ -1,13 +1,15 @@
 package com.uas.credit.model;
 package com.uas.credit.model;
 
 
 import javax.persistence.*;
 import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
 
 
 /**
 /**
  * created by shicr on 2018/6/8
  * created by shicr on 2018/6/8
  **/
  **/
 @Entity
 @Entity
 @Table(name = "log$log")
 @Table(name = "log$log")
-public class CreditLog {
+public class CreditLog implements Serializable {
 
 
     /**
     /**
      * default serialVersionUID
      * default serialVersionUID
@@ -20,16 +22,24 @@ public class CreditLog {
     private Long id;
     private Long id;
 
 
     /**
     /**
-     * 日志标题
+     * 日志类型
      */
      */
-    @Column(name = "log_title")
-    private String title;
+    @Column(name = "log_type")
+    private String type;
 
 
     /**
     /**
-     * 日志消息
+     * 日志时间
      */
      */
-    @Column(name = "log_message")
-    private String message;
+    @Column(name = "log_time")
+    private Date queryTime;
+
+    public CreditLog() {
+    }
+
+    public CreditLog(String type, Date queryTime) {
+        this.type = type;
+        this.queryTime = queryTime;
+    }
 
 
     public Long getId() {
     public Long getId() {
         return id;
         return id;
@@ -39,24 +49,19 @@ public class CreditLog {
         this.id = id;
         this.id = id;
     }
     }
 
 
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
+    public String getType() {
+        return type;
     }
     }
 
 
-    public String getMessage() {
-        return message;
+    public void setType(String type) {
+        this.type = type;
     }
     }
 
 
-    public void setMessage(String message) {
-        this.message = message;
+    public Date getQueryTime() {
+        return queryTime;
     }
     }
 
 
-    public CreditLog(String title,String message) {
-        this.title = title;
-        this.message = message;
+    public void setQueryTime(Date queryTime) {
+        this.queryTime = queryTime;
     }
     }
 }
 }

+ 13 - 0
src/main/java/com/uas/credit/service/CreditLogService.java

@@ -0,0 +1,13 @@
+package com.uas.credit.service;
+
+import com.uas.credit.model.CreditLog;
+
+/**
+ * @author liuam
+ * @since 2018/7/18 0018 上午 11:32
+ */
+public interface CreditLogService {
+
+    void save(CreditLog log);
+
+}

+ 23 - 0
src/main/java/com/uas/credit/service/impl/CreditLogServiceImpl.java

@@ -0,0 +1,23 @@
+package com.uas.credit.service.impl;
+
+import com.uas.credit.dao.CreditLogDao;
+import com.uas.credit.model.CreditLog;
+import com.uas.credit.service.CreditLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author liuam
+ * @since 2018/7/18 0018 上午 11:33
+ */
+@Service
+public class CreditLogServiceImpl implements CreditLogService {
+
+    @Autowired
+    private CreditLogDao creditLogDao;
+
+    @Override
+    public void save(CreditLog log) {
+        creditLogDao.save(log);
+    }
+}

文件差异内容过多而无法显示
+ 3 - 0
src/main/test/NormalTest.java


部分文件因为文件数量过多而无法显示