ChannelCodeBillController.java 5.95 KB
package cn.com.glsx.entmicro.controller;

import cn.com.glsx.entmicro.request.code.*;
import cn.com.glsx.entmicro.response.code.DetailChannelCodeBillResponse;
import cn.com.glsx.entmicro.response.code.GetSubCodeChannelCodeBillResponse;
import cn.com.glsx.entmicro.response.code.ListChannelCodeBillListResponse;
import cn.com.glsx.entmicro.service.ChannelCodeBillService;
import cn.com.glsx.entmicro.utils.Pagination;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
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;

import java.util.List;

/**
 * @author Lichongyuan
 * @Description: 海报活码
 * @date 2021/11/14 10:28
 */
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
@Api("海报活码服务")
@Slf4j
public class ChannelCodeBillController {

    @Autowired
    private ChannelCodeBillService channelCodeBillService;

    /**
     * 保存海报活码
     *
     * @param saveChannelCodeBillRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.code.saveChannelCodeBill", needInSession = NeedInSessionType.YES)
    @ApiOperation("保存海报活码")
    public RopResponse<Boolean> saveChannelCodeBill(SaveChannelCodeBillRequest saveChannelCodeBillRequest) {
        try {
            channelCodeBillService.saveChannelCodeBill(saveChannelCodeBillRequest);
            return RopResponse.success(true);
        } catch (RpcServiceException e) {
            log.info("=======ChannelCodeController__invoke__saveChannelCodeBill__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 删除海报活码
     *
     * @param deleteChannelCodeBillRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.code.deleteChannelCodeBill", needInSession = NeedInSessionType.YES)
    @ApiOperation("删除海报活码")
    public RopResponse<Boolean> deleteChannelCodeBill(DeleteChannelCodeBillRequest deleteChannelCodeBillRequest) {
        try {
            channelCodeBillService.deleteChannelCodeBill(deleteChannelCodeBillRequest);
            return RopResponse.success(true);
        } catch (RpcServiceException e) {
            log.info("=======ChannelCodeController__invoke__deleteChannelCodeBill__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 当前活码的海报活码列表
     *
     * @param listChannelCodeBillRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.code.getSubCodeChannelCodeBill", needInSession = NeedInSessionType.YES)
    @ApiOperation("当前活码的海报活码列表")
    public RopResponse<GetSubCodeChannelCodeBillResponse> getSubCodeChannelCodeBill(ListChannelCodeBillRequest listChannelCodeBillRequest) {
        try {
            GetSubCodeChannelCodeBillResponse subCodeChannelCodeBill = channelCodeBillService.getSubCodeChannelCodeBill(listChannelCodeBillRequest);
            return RopResponse.success(subCodeChannelCodeBill);
        } catch (RpcServiceException e) {
            log.info("=======ChannelCodeController__invoke__getSubCodeChannelCodeBill__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 编辑海报活码
     * @param updateChannelCodeBillRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.code.updateChannelCodeBill", needInSession = NeedInSessionType.YES)
    @ApiOperation("编辑海报活码")
    public RopResponse<Boolean> updateChannelCodeBill(UpdateChannelCodeBillRequest updateChannelCodeBillRequest) {
        try {
            channelCodeBillService.updateChannelCodeBill(updateChannelCodeBillRequest);
            return RopResponse.success(true);
        } catch (RpcServiceException e) {
            log.info("=======ChannelCodeController__invoke__updateChannelCodeBill__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * id获取海报活码详情
     *
     * @param detailChannelCodeBillRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.code.getChannelCodeBill", needInSession = NeedInSessionType.YES)
    @ApiOperation("id获取海报活码详情")
    public RopResponse<DetailChannelCodeBillResponse> getChannelCodeBill(DetailChannelCodeBillRequest detailChannelCodeBillRequest) {
        try {
            DetailChannelCodeBillResponse responses = channelCodeBillService.getChannelCodeBill(detailChannelCodeBillRequest);
            return RopResponse.success(responses);
        } catch (RpcServiceException e) {
            log.info("=======ChannelCodeController__invoke__getChannelCodeBill__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 获取所有海报列表
     *
     * @param listChannelCodeBillRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.code.listChannelCodeBill", needInSession = NeedInSessionType.YES)
    @ApiOperation("获取所有海报列表")
    public RopResponse<Pagination<ListChannelCodeBillListResponse>> listChannelCodeBill(ListChannelCodeBillByPageRequest listChannelCodeBillRequest) {
        try {
            Pagination<ListChannelCodeBillListResponse> listChannelCodeBillListResponses = channelCodeBillService.listChannelCodeBill(listChannelCodeBillRequest);
            return RopResponse.success(listChannelCodeBillListResponses);
        } catch (RpcServiceException e) {
            log.info("=======ChannelCodeController__invoke__listChannelCodeBill__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

}