Search in sources :

Example 1 with OperationLog

use of com.ikoori.vip.common.persistence.model.OperationLog in project vip by guangdada.

the class LogController method list.

/**
 * 查询操作日志列表
 */
@RequestMapping("/list")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object list(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String logName, @RequestParam(required = false) Integer logType) {
    Page<OperationLog> page = new PageFactory<OperationLog>().defaultPage();
    List<Map<String, Object>> result = logDao.getOperationLogs(page, beginTime, endTime, logName, BizLogType.valueOf(logType), page.getOrderByField(), page.isAsc());
    page.setRecords((List<OperationLog>) new LogWarpper(result).warp());
    return super.packForBT(page);
}
Also used : LogWarpper(com.ikoori.vip.server.modular.system.warpper.LogWarpper) OperationLog(com.ikoori.vip.common.persistence.model.OperationLog) Map(java.util.Map) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with OperationLog

use of com.ikoori.vip.common.persistence.model.OperationLog in project vip by guangdada.

the class LoginLogController method list.

/**
 * 查询登录日志列表
 */
@RequestMapping("/list")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object list(@RequestParam(required = false) String beginTime, @RequestParam(required = false) String endTime, @RequestParam(required = false) String logName) {
    Page<OperationLog> page = new PageFactory<OperationLog>().defaultPage();
    List<Map<String, Object>> result = logDao.getLoginLogs(page, beginTime, endTime, logName, page.getOrderByField(), page.isAsc());
    page.setRecords((List<OperationLog>) new LogWarpper(result).warp());
    return super.packForBT(page);
}
Also used : LogWarpper(com.ikoori.vip.server.modular.system.warpper.LogWarpper) OperationLog(com.ikoori.vip.common.persistence.model.OperationLog) Map(java.util.Map) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with OperationLog

use of com.ikoori.vip.common.persistence.model.OperationLog in project vip by guangdada.

the class LogTaskFactory method exceptionLog.

public static TimerTask exceptionLog(final Integer userId, final Exception exception) {
    return new TimerTask() {

        @Override
        public void run() {
            String msg = ToolUtil.getExceptionMsg(exception);
            OperationLog operationLog = LogFactory.createOperationLog(LogType.EXCEPTION, userId, "", null, null, msg, LogSucceed.FAIL);
            try {
                operationLogMapper.insert(operationLog);
            } catch (Exception e) {
                logger.error("创建异常日志异常!", e);
            }
        }
    };
}
Also used : TimerTask(java.util.TimerTask) OperationLog(com.ikoori.vip.common.persistence.model.OperationLog)

Example 4 with OperationLog

use of com.ikoori.vip.common.persistence.model.OperationLog in project vip by guangdada.

the class LogFactory method createOperationLog.

/**
 * 创建操作日志
 *
 * @author fengshuonan
 * @Date 2017/3/30 18:45
 */
public static OperationLog createOperationLog(LogType logType, Integer userId, String bussinessName, String clazzName, String methodName, String msg, LogSucceed succeed) {
    OperationLog operationLog = new OperationLog();
    operationLog.setLogtype(logType.getMessage());
    operationLog.setLogname(bussinessName);
    operationLog.setUserid(userId);
    operationLog.setClassname(clazzName);
    operationLog.setMethod(methodName);
    operationLog.setCreatetime(new Date());
    operationLog.setSucceed(succeed.getMessage());
    operationLog.setMessage(msg);
    return operationLog;
}
Also used : OperationLog(com.ikoori.vip.common.persistence.model.OperationLog) Date(java.util.Date)

Example 5 with OperationLog

use of com.ikoori.vip.common.persistence.model.OperationLog in project vip by guangdada.

the class LogController method detail.

/**
 * 查询操作日志详情
 */
@RequestMapping("/detail/{id}")
@Permission(Const.ADMIN_NAME)
@ResponseBody
public Object detail(@PathVariable Integer id) {
    OperationLog operationLog = operationLogMapper.selectById(id);
    Map<String, Object> stringObjectMap = BeanKit.beanToMap(operationLog);
    return super.warpObject(new LogWarpper(stringObjectMap));
}
Also used : LogWarpper(com.ikoori.vip.server.modular.system.warpper.LogWarpper) OperationLog(com.ikoori.vip.common.persistence.model.OperationLog) Permission(com.ikoori.vip.common.annotion.Permission) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

OperationLog (com.ikoori.vip.common.persistence.model.OperationLog)5 Permission (com.ikoori.vip.common.annotion.Permission)3 LogWarpper (com.ikoori.vip.server.modular.system.warpper.LogWarpper)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 Map (java.util.Map)2 Date (java.util.Date)1 TimerTask (java.util.TimerTask)1