SystemSubscribeController.java 10.9 KB
package cn.com.glsx.entmicro.controller;

import cn.com.glsx.entmicro.model.request.subscription.MerchantIdRpcRequest;
import cn.com.glsx.entmicro.model.request.subscription.SubscribeServiceRpcRequest;
import cn.com.glsx.entmicro.model.response.subscribe.MerchantSubScribeRpcResponse;
import cn.com.glsx.entmicro.model.response.subscribe.SubscribeMerchantResponse;
import cn.com.glsx.entmicro.model.response.subscribe.SubscribeServiceRpcResponse;
import cn.com.glsx.entmicro.request.subscription.*;
import cn.com.glsx.entmicro.response.subscribe.*;
import cn.com.glsx.entmicro.service.subscribe.SystemSubscribeService;
import cn.com.glsx.entmicro.utils.Pagination;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
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 javax.annotation.Resource;
import java.util.List;

/**
 * @author chizw
 * @version ver.1.0.0
 * @Description
 * @create 2022/9/19 15:06
 */
@Slf4j
@Api("系统订阅")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
public class SystemSubscribeController {

    @Resource
    private SystemSubscribeService systemSubscribeService;

    @ServiceMethod(method = "entmicro.api.system.subscribe.open")
    @ApiOperation("开通订阅")
    public RopResponse<Boolean> openSubscribe(OpenSubscribeCreateRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.openSubscribe(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_openSubscribe_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.subscribe.view")
    @ApiOperation("服务订阅分页列表")
    public RopResponse<Pagination<SubscriptionViewRopResponse>> subscribeListView(SubscriptionQueryRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.subscribeListView(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_subscribeListView_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.subscribe.code.generate")
    @ApiOperation("生成挪车贴")
    public RopResponse<Boolean> generateMoveCode(OpenSubscribeRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.generateMoveCode(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_generateMoveCode_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.subscribe.activity.correlate")
    @ApiOperation("关联活动")
    public RopResponse<Boolean> correlateActivity(CorrelateActivityRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.correlateActivity(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_correlateActivity_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.subscribe.state.update")
    @ApiOperation("更改商户开通状态")
    public RopResponse<Boolean> updateSubscribeState(CorrelateActivityRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.updateSubscribeState(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_updateSubscribeState_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.accident.open.verify")
    @ApiOperation("验证开通事故车救援")
    public RopResponse<Boolean> verifyOpenAccident(OpenSubscribeRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.verifyOpenAccident(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_verifyOpenAccident_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.subscribe.merchant.page")
    @ApiOperation("订阅开通商户分页查询")
    public RopResponse<Pagination<SubscribeMerchantResponse>> findSubscribeMerchantList(SubscribeMerchantRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.findSubscribeMerchantList(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_findSubscribeMerchantList_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.withdrawal.of.points.merchant.page")
    @ApiOperation("积分提现白名单开通商户分页查询")
    public RopResponse<Pagination<SubscribeMerchantResponse>> withdrawalOfPointsMerchantList(SubscribeMerchantRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.withdrawalOfPointsMerchantList(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_withdrawalOfPointsMerchantList_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.subscribe.code.view")
    @ApiOperation("挪车贴分页查询")
    public RopResponse<Pagination<MoveCarCodeViewRopResponse>> moveCarCodeView(MoveCarCodeQueryRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.moveCarCodeView(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_moveCarCodeView_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.subscribe.rescue.generate")
    @ApiOperation("生成救援贴")
    public RopResponse<String> generateRescueSticker(MoveCarCodeQueryRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.generateRescueSticker(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_generateRescueSticker_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }


    @ServiceMethod(method = "entmicro.api.system.subscribe.findActivityIdList", needInSession = NeedInSessionType.NO)
    @ApiOperation("查询已订阅的活动id")
    public RopResponse<List<SubscribeActRopResponse>> findActivityIdList(FindActivityIdRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.findActivityIdList(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_findActivityIdList_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 根据商户号集合查询福利官详情
     *
     * @param request
     * @return
     */
    @ServiceMethod(method = "entmicro.api.system.subscribe.findMerchantWelfareInfo", needInSession = NeedInSessionType.NO)
    @ApiOperation("根据商户号集合查询福利官详情")
    public RopResponse<List<MerchantWelfareRopResponse>> findMerchantWelfareInfo(FindWelfareRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.findMerchantWelfareInfo(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_findMerchantWelfareInfo_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.subscribe.getOpenedMerchant", needInSession = NeedInSessionType.NO)
    @ApiOperation("查询商户订阅的服务")
    public RopResponse<List<MerchantSubServeRopResponse>> getOpenedMerchant(OpenedMerchantRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.getOpenedMerchant(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_getOpenedMerchant_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.subscribe.updateSubscribe", needInSession = NeedInSessionType.YES)
    @ApiOperation("更新商户订阅")
    public RopResponse<Boolean> updateSubscribe(UpdateSubScribeRopRequest request) {
        try {
            return RopResponse.success(systemSubscribeService.updateSubscribe(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_updateSubscribe_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ServiceMethod(method = "entmicro.api.system.subscribe.getMerchantSubscribeDetail", needInSession = NeedInSessionType.NO)
    @ApiOperation("查询订阅客户代运营状态")
    public RopResponse<MerchantSubScribeRopResponse> getMerchantSubscribeDetail(MerchantIdRopRequest request){
        try {
            return RopResponse.success(systemSubscribeService.getMerchantSubscribeDetail(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_getMerchantSubscribeDetail_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }


    @ServiceMethod(method = "entmicro.api.system.subscribe.openedMerchantPageByType", needInSession = NeedInSessionType.NO)
    @ApiOperation("分页查询已开通的商户")
    public RopResponse<Pagination<SubscribeServiceRopResponse>> openedMerchantPageByType(SubscribeServiceRopRequest request){
        try {
            return RopResponse.success(systemSubscribeService.openedMerchantPageByType(request));
        } catch (RpcServiceException e) {
            log.info("=======SystemSubscribeController_openedMerchantPageByType_invoke__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

}