SopTaskCustomerController.java 3.58 KB
package cn.com.glsx.stoassistant.controller.sop;


import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.stoassistant.request.sop.CustomerIdRopRequest;
import cn.com.glsx.stoassistant.request.sop.SaveSopTaskRopRequest;
import cn.com.glsx.stoassistant.request.sop.SopCustomerPageRopRequest;
import cn.com.glsx.stoassistant.request.sop.SopStageUpdateRopRequest;
import cn.com.glsx.stoassistant.response.sop.SopCustomerArchivesResponse;
import cn.com.glsx.stoassistant.response.sop.SopCustomerRopResponse;
import cn.com.glsx.stoassistant.service.sop.SopTaskCustomerService;
import cn.com.glsx.stoassistant.utils.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;

import java.util.List;

@Slf4j
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
@Api("Sop任务客户接口")
public class SopTaskCustomerController {

    @Autowired
    private SopTaskCustomerService sopTaskCustomerService;

    @ApiOperation("保存sop任务客户")
    @ServiceMethod(method = "scrm.api.sop.marketing.task.customer", needInSession = NeedInSessionType.NO)
    public RopResponse<Boolean> saveSopTaskCustomer(SaveSopTaskRopRequest request){
        try {
            return RopResponse.success(sopTaskCustomerService.saveSopTaskCustomer(request));
        }catch (RpcServiceException e){
            log.info("=======SopTaskCustomerControllerr__invoke__saveSopTaskCustomer__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ApiOperation("sop任务客户列表")
    @ServiceMethod(method = "scrm.api.sop.task.customer.page", needInSession = NeedInSessionType.NO)
    public RopResponse<Pagination<SopCustomerRopResponse>> sopTaskCustomerPage(SopCustomerPageRopRequest request){
        try {
            return RopResponse.success(sopTaskCustomerService.sopTaskCustomerPage(request));
        }catch (RpcServiceException e){
            log.info("=======SopTaskCustomerControllerr__invoke__sopTaskCustomerPage__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ApiOperation("sop客户智能档案")
    @ServiceMethod(method = "scrm.api.sop.task.customer.archives", needInSession = NeedInSessionType.NO)
    public RopResponse<List<SopCustomerArchivesResponse>> getCustomerArchives(CustomerIdRopRequest request){
        try {
            return RopResponse.success(sopTaskCustomerService.getCustomerArchives(request));
        }catch (RpcServiceException e){
            log.info("=======SopTaskCustomerControllerr__invoke__getCustomerArchives__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    @ApiOperation("sop客户-更改旅程阶段")
    @ServiceMethod(method = "scrm.api.sop.task.customer.stage.update", needInSession = NeedInSessionType.NO)
    public RopResponse<Boolean> changeCustomerStage(SopStageUpdateRopRequest request){
        try {
            return RopResponse.success(sopTaskCustomerService.changeCustomerStage(request));
        }catch (RpcServiceException e){
            log.info("=======SopTaskCustomerControllerr__invoke__changeCustomerStage__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }


}