1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package com.fuzamei.web;
- import java.util.Map;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import com.fuzamei.constant.HintMSG;
- import com.fuzamei.constant.Role;
- import com.fuzamei.entity.Param;
- import com.fuzamei.service.OperationHistoryService;
- import com.fuzamei.service.UserAuthoricationService;
- import com.fuzamei.util.JSONUtil;
- import com.fuzamei.util.PageDTO;
- import com.fuzamei.util.ReadConfUtil;
- import com.fuzamei.util.ValidationUtil;
- @RestController
- @RequestMapping(value="/operationHistory")
- public class OperationHistoryAction {
- @Autowired
- private OperationHistoryService operationHistoryService;
-
- @Autowired
- private UserAuthoricationService userAuthoricationService;
-
- private static final Integer ROWNUM=Integer.parseInt(ReadConfUtil.getProperty("rowNum"));
-
- /**
- *
- * @Title: queryOperationHistory
- * @Description: TODO(管理员查看操作历史)
- {
- "userId":"",
- "page":"1",
- "startTime":"",
- "endTime":""
- }
- * @param @return 设定文件
- * @return Map<String,Object> 返回类型
- * @author ylx
- * @date 2018年1月26日 下午6:34:22
- * @throws
- */
- @RequestMapping(value="/queryOperationHistory",method=RequestMethod.POST)
- public Map<String, Object> queryOperationHistory(@RequestBody Param param){
- try {
- userAuthoricationService.queryUserAuthority(ValidationUtil.checkAndAssignInt(param.getUserId()), Role.ADMIN);
- int page = ValidationUtil.checkMinAndAssignInt(param.getPage(), 1);
- Long startTime=ValidationUtil.checkAndAssignDefaultLong(param.getStartTime(), 0L);
- Long endTime=ValidationUtil.checkAndAssignDefaultLong(param.getEndTime(), Long.MAX_VALUE);
- param.setStartTime(startTime);
- if(startTime<=endTime) param.setEndTime(endTime);
- else param.setEndTime(Long.MAX_VALUE);
- param.setStartPage((page - 1) * ROWNUM);
- param.setRowNum(ROWNUM);
- PageDTO pageDto = operationHistoryService.queryOperationHistory(param);
- return JSONUtil.getJsonMap(200, true, HintMSG.QUERY_SUCCESS, pageDto);
- } catch (Exception e) {
- return JSONUtil.getJsonMap(500, false, HintMSG.QUERY_FAIL+":"+e.getMessage(), null);
- }
- }
- }
|