Kaynağa Gözat

更新附件下载日志记录

hejq 8 yıl önce
ebeveyn
işleme
5131d76c6b

+ 3 - 2
src/main/java/com/uas/platform/b2b/controller/FileController.java

@@ -7,6 +7,7 @@ import com.uas.platform.b2b.model.Attach;
 import com.uas.platform.b2b.model.PurchaseOrderAll;
 import com.uas.platform.b2b.model.PurchaseOrderAll;
 import com.uas.platform.b2b.service.AttachService;
 import com.uas.platform.b2b.service.AttachService;
 import com.uas.platform.b2b.service.PurchaseOrderService;
 import com.uas.platform.b2b.service.PurchaseOrderService;
+import com.uas.platform.b2b.support.SystemSession;
 import com.uas.platform.b2b.support.UsageBufferedLogger;
 import com.uas.platform.b2b.support.UsageBufferedLogger;
 import com.uas.platform.core.exception.NotFoundException;
 import com.uas.platform.core.exception.NotFoundException;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.logging.BufferedLoggerManager;
@@ -57,7 +58,7 @@ public class FileController {
 		if(attach == null) {
 		if(attach == null) {
             throw  new IllegalArgumentException("附件不存在");
             throw  new IllegalArgumentException("附件不存在");
         }
         }
-        logger.log("附件下载", attach.getName() + "下载", "关联附件id: " + attach.getId());
+        logger.log(SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu(), "附件下载", attach.getName() + "下载", "关联附件id: " + attach.getId());
         response.addHeader("Content-Disposition", "attachment;filename=" + new String(attach.getName().getBytes("utf-8"), "iso-8859-1"));
         response.addHeader("Content-Disposition", "attachment;filename=" + new String(attach.getName().getBytes("utf-8"), "iso-8859-1"));
 		response.setCharacterEncoding("utf-8");
 		response.setCharacterEncoding("utf-8");
 		response.setContentType("application/octec-stream");
 		response.setContentType("application/octec-stream");
@@ -110,7 +111,7 @@ public class FileController {
         StringBuffer idString = null;
         StringBuffer idString = null;
         String url = null;
         String url = null;
         if (!CollectionUtils.isEmpty(attaches)) {
         if (!CollectionUtils.isEmpty(attaches)) {
-            logger.log("附件下载", "采购单附件批量下载", "关联订单id: " + id);
+            logger.log(SystemSession.getUser().getUserUU(), SystemSession.getUser().getEnterprise().getUu(),"附件下载", "采购单附件批量下载", "关联订单id: " + id);
            for (Attach attach : attaches) {
            for (Attach attach : attaches) {
                if (attach.getPath().startsWith("http://dfs.ubtob.com")) {// 存储在dfs存储服务器,去dfs存储服务器下载
                if (attach.getPath().startsWith("http://dfs.ubtob.com")) {// 存储在dfs存储服务器,去dfs存储服务器下载
                 // TODO dfs服务器上打包下载
                 // TODO dfs服务器上打包下载

+ 8 - 0
src/main/java/com/uas/platform/b2b/model/UsageLog.java

@@ -245,4 +245,12 @@ public class UsageLog extends BufferedLogable implements Serializable {
 		return sb.toString();
 		return sb.toString();
 	}
 	}
 
 
+	public UsageLog(Long useruu, Long enuu, String title, String message, String description) {
+		this.enUU = enuu;
+		this.title = title;
+		this.message = message;
+		this.time = new Date().getTime();
+		this.userUU = useruu;
+		this.detail = description;
+	}
 }
 }

+ 13 - 0
src/main/java/com/uas/platform/b2b/support/UsageBufferedLogger.java

@@ -57,6 +57,19 @@ public class UsageBufferedLogger extends BufferedLogger<UsageLog> {
 		log(new UsageLog(title, message, description, null, null));
 		log(new UsageLog(title, message, description, null, null));
 	}
 	}
 
 
+	/**
+	 * 平台操作日志
+	 *
+	 * @param useruu 用户UU
+	 * @param enuu 企业UU
+	 * @param title 标题
+	 * @param message 消息
+	 * @param description 消息详情描述
+	 */
+	public void log(Long useruu, Long enuu, String title, String message, String description) {
+		log(new UsageLog(useruu, enuu, title, message, description));
+	}
+
 	/**
 	/**
 	 * 记录平台使用日志
 	 * 记录平台使用日志
 	 * 
 	 *