Search in sources :

Example 1 with OperateLog

use of org.mx.dal.entity.OperateLog in project main by JohnPeng739.

the class AbstractOperateLogService method writeLog.

/**
 * 写入日志
 *
 * @param system      系统
 * @param module      模块
 * @param operateType 操作类型
 * @param content     操作内容
 * @param accessor    具体化的数据库访问器
 * @throws UserInterfaceDalErrorException 操作过程中发生的异常
 */
protected void writeLog(String system, String module, OperateLog.OperateType operateType, String content, GeneralAccessor accessor) throws UserInterfaceDalErrorException {
    OperateLog log = EntityFactory.createEntity(OperateLog.class);
    log.setSystem(system);
    log.setModule(module);
    if (operateType != null) {
        log.setOperateType(operateType);
    }
    log.setContent(content);
    accessor.save(log);
}
Also used : OperateLog(org.mx.dal.entity.OperateLog)

Example 2 with OperateLog

use of org.mx.dal.entity.OperateLog in project main by JohnPeng739.

the class AccountManageResource method logs.

@Path("logs")
@POST
@AuthenticateAround(returnValueClass = PaginationDataVO.class)
public PaginationDataVO<List<OperateLogVO>> logs(Pagination pagination, @Context Request request) {
    if (pagination == null) {
        pagination = new Pagination();
    }
    try {
        List<OperateLog> logs = accessor.list(pagination, OperateLog.class);
        List<OperateLogVO> vos = OperateLogVO.transform(logs);
        return new PaginationDataVO(pagination, vos);
    } catch (UserInterfaceException ex) {
        return new PaginationDataVO<>(ex);
    } catch (Exception ex) {
        if (logger.isErrorEnabled()) {
            logger.error("List logs fail.", ex);
        }
        return new PaginationDataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
    }
}
Also used : Pagination(org.mx.dal.Pagination) PaginationDataVO(org.mx.service.rest.vo.PaginationDataVO) UserInterfaceException(org.mx.error.UserInterfaceException) UserInterfaceSystemErrorException(org.mx.error.UserInterfaceSystemErrorException) UserInterfaceException(org.mx.error.UserInterfaceException) UserInterfaceSystemErrorException(org.mx.error.UserInterfaceSystemErrorException) OperateLog(org.mx.dal.entity.OperateLog) AuthenticateAround(org.mx.comps.jwt.AuthenticateAround)

Aggregations

OperateLog (org.mx.dal.entity.OperateLog)2 AuthenticateAround (org.mx.comps.jwt.AuthenticateAround)1 Pagination (org.mx.dal.Pagination)1 UserInterfaceException (org.mx.error.UserInterfaceException)1 UserInterfaceSystemErrorException (org.mx.error.UserInterfaceSystemErrorException)1 PaginationDataVO (org.mx.service.rest.vo.PaginationDataVO)1