LogController.java 2.57 KB
package cn.com.glsx.merchants.controller;

import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.merchants.request.log.LogSearchRequest;
import cn.com.glsx.merchants.request.log.MerchantAndStaffLogRopRequest;
import cn.com.glsx.merchants.response.LogResponse;
import cn.com.glsx.merchants.service.MerchantLogService;
import cn.com.glsx.merchants.util.Pagination;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author zhouhaibao
 * @version 1.0
 * @description: 日志服务
 * @date 2021/7/16 10:49
 */
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
@Api("日志服务")
@Slf4j
public class LogController {

    @Autowired
    private MerchantLogService merchantLogService;

    /**
     * 查询日志列表
     *
     * @param logSearchRequest 入参
     * @return
     */
    @ServiceMethod(method = "merchants.api.menu.findLog", needInSession = NeedInSessionType.NO)
    @ApiOperation("查询字典类型")
    public RopResponse<Pagination<LogResponse>> findLog(LogSearchRequest logSearchRequest) {
        try {
            Pagination<LogResponse> list = merchantLogService.findLog(logSearchRequest);
            return RopResponse.success(list);
        } catch (RpcServiceException e) {
            log.info("=======LogController__invoke_findLog__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }


    /**
     * 查询商户、员工操作日志列表
     *
     * @param ropRequest 入参
     * @return
     */
    @ServiceMethod(method = "merchants.api.menu.findMerchantAndStaffLog", needInSession = NeedInSessionType.NO)
    @ApiOperation("查询商户、员工操作日志列表")
    public RopResponse<Pagination<LogResponse>> findMerchantAndStaffLog(MerchantAndStaffLogRopRequest ropRequest) {
        try {
            Pagination<LogResponse> list = merchantLogService.findMerchantAndStaffLog(ropRequest);
            return RopResponse.success(list);
        } catch (RpcServiceException e) {
            log.info("=======LogController__invoke_findMerchantAndStaffLog__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }
}