1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package com.uas.cloud.mall.api;
- import com.uas.cloud.mall.model.UsageLog;
- import com.uas.cloud.mall.service.UsageLogService;
- import com.uas.cloud.mall.support.PageInfo;
- import com.uas.cloud.mall.support.ResultMap;
- import org.apache.log4j.Logger;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.http.MediaType;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- /**
- * 用户操作日志记录接口
- *
- * @author huxz
- * @version 2017-08-03 16:37:14 创建
- */
- @RestController
- @RequestMapping(value = "/api/service/log/usage")
- public class UsageLogController {
- private final Logger logger = Logger.getLogger(UsageLogController.class);
- private final UsageLogService usageLogService;
- @Autowired
- public UsageLogController(UsageLogService usageLogService) {
- this.usageLogService = usageLogService;
- }
- /**
- * 当用户操作时,记录用户的操作日志
- *
- * @param usageLog 操作日志
- * @return 操作结果
- */
- @PostMapping(produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- public ResultMap saveLogWhenUserOperate(@RequestBody UsageLog usageLog) {
- logger.info("Save log when user operates");
- return usageLogService.saveLogWhenUserOperate(usageLog);
- }
- /**
- * 当管理员分页获取操作日志时,返回分页结果
- *
- * @param pageInfo 分页信息
- * @return 操作结果
- */
- @GetMapping(params = "op=pageLogs", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- public ResultMap pageLogsWhenAdminSelect(PageInfo pageInfo) {
- logger.info("Page logs when admin select");
- return usageLogService.pageLogsWhenAdminSelect(pageInfo);
- }
- }
|