EntmicroStaffController.java 10.6 KB
package cn.com.glsx.entmicro.controller;

import cn.com.glsx.entmicro.request.staff.*;
import cn.com.glsx.entmicro.response.staff.BusinessTypeResponse;
import cn.com.glsx.entmicro.response.staff.FollowerStaffResponse;
import cn.com.glsx.entmicro.response.staff.FollowerTypeResponse;
import cn.com.glsx.entmicro.response.staff.IsOutSiderStaffResponse;
import cn.com.glsx.entmicro.service.EntimicroStaffService;
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/9/22 18:01
 */
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
@Api("员工服务")
@Slf4j
public class EntmicroStaffController {

    @Autowired
    private EntimicroStaffService entimicroStaffService;

    /**
     * 查询跟进员工列表
     *
     * @param listFollowerStaffRequest 入参
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.listFollowerStaffByPage", needInSession = NeedInSessionType.YES)
    @ApiOperation("查询跟进员工列表")
    public RopResponse<Pagination<FollowerStaffResponse>> listFollowerStaffByPage(ListFollowerStaffRequest listFollowerStaffRequest) {
        try {
            Pagination<FollowerStaffResponse> listPagination = entimicroStaffService.listFollowerStaffByPage(listFollowerStaffRequest);
            return RopResponse.success(listPagination);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__listFollowerStaffByPage__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 查询外部联系人权限员工
     *
     * @param selectIsOutsiderStaffRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.listEntmicroStaff", needInSession = NeedInSessionType.YES)
    @ApiOperation("查询外部联系人权限员工")
    public RopResponse<List<IsOutSiderStaffResponse>> listEntmicroStaff(SelectIsOutsiderStaffRequest selectIsOutsiderStaffRequest) {
        try {
            List<IsOutSiderStaffResponse> listRopResponse = entimicroStaffService.listEntmicroStaff(selectIsOutsiderStaffRequest);
            return RopResponse.success(listRopResponse);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__listEntmicroStaff__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 查询商户下面的跟进员工
     *
     * @param listStaffRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.findlistEntmicroStaff", needInSession = NeedInSessionType.YES)
    @ApiOperation("查询商户下面的跟进员工")
    public RopResponse<List<FollowerStaffResponse>> findlistEntmicroStaff(ListStaffRequest listStaffRequest) {
        try {
            List<FollowerStaffResponse> listRopResponse = entimicroStaffService.findlistEntmicroStaff(listStaffRequest);
            return RopResponse.success(listRopResponse);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__findlistEntmicroStaff__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 添加跟进员工
     *
     * @param saveFollowerStaffRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.saveFollowerStaff", needInSession = NeedInSessionType.YES)
    @ApiOperation("添加跟进员工")
    public RopResponse<Boolean> saveFollowerStaff(SaveFollowerStaffRequest saveFollowerStaffRequest) {
        try {
            entimicroStaffService.saveFollowerStaff(saveFollowerStaffRequest);
            return RopResponse.success(true);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__saveFollowerStaff__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 删除跟进员工
     *
     * @param deleteFollowerStaffRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.deleteFollowerStaff", needInSession = NeedInSessionType.YES)
    @ApiOperation("删除跟进员工")
    public RopResponse<Boolean> deleteFollowerStaff(DeleteFollowerStaffRequest deleteFollowerStaffRequest) {
        try {
            entimicroStaffService.deleteFollowerStaff(deleteFollowerStaffRequest);
            return RopResponse.success(true);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__deleteFollowerStaff__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 同步企微外部联系人权限员工
     *
     * @param sycIsOutsiderStaffRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.syncEntmicroIsOutsiderStaff", needInSession = NeedInSessionType.YES)
    @ApiOperation("同步企微外部联系人权限员工")
    public RopResponse<Boolean> syncEntmicroIsOutsiderStaff(SycIsOutsiderStaffRequest sycIsOutsiderStaffRequest) {
        try {
            entimicroStaffService.syncEntmicroIsOutsiderStaff(sycIsOutsiderStaffRequest);
            return RopResponse.success(true);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__syncEntmicroStaff__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 新增跟进类型
     *
     * @param saveFollowerTypeRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.saveFollowerType", needInSession = NeedInSessionType.YES)
    @ApiOperation("新增跟进类型")
    public RopResponse<Boolean> saveFollowerType(SaveFollowerTypeRequest saveFollowerTypeRequest) {
        try {
            entimicroStaffService.saveFollowerType(saveFollowerTypeRequest);
            return RopResponse.success(true);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__saveFollowerType__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 删除跟进类型
     *
     * @param deleteFollowerTypeRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.deleteFollowerType", needInSession = NeedInSessionType.YES)
    @ApiOperation("删除跟进类型")
    public RopResponse<Boolean> deleteFollowerType(DeleteFollowerTypeRequest deleteFollowerTypeRequest) {
        try {
            entimicroStaffService.deleteFollowerType(deleteFollowerTypeRequest);
            return RopResponse.success(true);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__deleteFollowerType__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 获取跟进类型列表
     *
     * @param listFollowerTypeRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.listEntFollowerType", needInSession = NeedInSessionType.YES)
    @ApiOperation("获取跟进类型列表")
    public RopResponse<List<FollowerTypeResponse>> listEntFollowerType(ListFollowerTypeRequest listFollowerTypeRequest) {
        try {
            List<FollowerTypeResponse> responses = entimicroStaffService.listEntFollowerType(listFollowerTypeRequest);
            return RopResponse.success(responses);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__listEntFollowerType__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }


    /**
     * 查询商户下面的群主列表
     *
     * @param lordCustomerGroupRopRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.findLordGroup", needInSession = NeedInSessionType.YES)
    @ApiOperation("查询商户下面的群主列表")
    public RopResponse<List<FollowerStaffResponse>> findLordGroup(LordCustomerGroupRopRequest lordCustomerGroupRopRequest) {
        try {
            List<FollowerStaffResponse> listRopResponse = entimicroStaffService.findLordGroup(lordCustomerGroupRopRequest);
            return RopResponse.success(listRopResponse);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__findLordGroup__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 查询当前商户下所有员工列表
     *
     * @param selectIsOutsiderStaffRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.findStaffByMerchantId", needInSession = NeedInSessionType.YES)
    @ApiOperation("查询当前商户下所有员工列表")
    public RopResponse<List<IsOutSiderStaffResponse>> findStaffByMerchantId(SelectIsOutsiderStaffRequest selectIsOutsiderStaffRequest) {
        try {
            List<IsOutSiderStaffResponse> listRopResponse = entimicroStaffService.findStaffByMerchantId(selectIsOutsiderStaffRequest);
            return RopResponse.success(listRopResponse);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__findStaffByMerchantId__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }

    /**
     * 获取业务类型列表
     *
     * @param listFollowerTypeRequest
     * @return
     */
    @ServiceMethod(method = "entmicro.api.staff.listEntBusinessType", needInSession = NeedInSessionType.YES)
    @ApiOperation("获取业务类型列表")
    public RopResponse<List<BusinessTypeResponse>> listEntBusinessType(ListFollowerTypeRequest listFollowerTypeRequest) {
        try {
            List<BusinessTypeResponse> responses = entimicroStaffService.listEntBusinessType(listFollowerTypeRequest);
            return RopResponse.success(responses);
        } catch (RpcServiceException e) {
            log.info("=======EntmicroStaffController__invoke__listEntBusinessType__exception:{}", e.getMessage());
            return RopResponse.error(e.getErrId(), e.getMessage());
        }
    }
}