Browse Source

增加UsageLogController类

suntg 8 years ago
parent
commit
d2652ca92b

+ 56 - 0
src/main/java/com/uas/platform/b2c/common/account/controller/UsageLogController.java

@@ -0,0 +1,56 @@
+package com.uas.platform.b2c.common.account.controller;
+
+import com.uas.platform.b2c.common.account.model.UsageLog;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.service.UsageLogService;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Sort;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * 用户操作日志请求
+ * @author suntg
+ * @version 2017年11月8日16:38:52 初始化建立
+ */
+@RestController
+@RequestMapping(value = "/log/usage")
+public class UsageLogController {
+
+	@Autowired
+	private UsageLogService usageLogService;
+
+	private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+	/**
+	 * 根据分页信息获取
+	 * @return
+	 */
+	@RequestMapping(method = RequestMethod.GET)
+	public Page<UsageLog> getAllByPage(PageParams params) {
+		PageInfo info = new PageInfo(params);
+		if(info.getSort() == null)
+			info.sorting("time", Sort.Direction.DESC);
+		return usageLogService.findAllByPageInfo(info);
+	}
+
+	/**
+	 * 根据用户UU号分页获取
+	 * @return
+	 */
+	@RequestMapping(value = "/{uu}",method = RequestMethod.GET)
+	public Page<UsageLog> getByUserUuByPage(PageParams params, @PathVariable("uu") Long userUu) {
+		PageInfo info = new PageInfo(params);
+		info.filter("userUU", userUu);
+		if(info.getSort() == null)
+			info.sorting("time", Sort.Direction.DESC);
+		return usageLogService.findAllByPageInfo(info);
+	}
+
+}