EntmicroFollowerStaffRemoteImpl.java 3 KB
package cn.com.glsx.entmicro.remote;

import cn.com.glsx.entmicro.model.request.EntmicroFollowerStaffRequest;
import cn.com.glsx.entmicro.model.response.EntmicroFollowerStaffResponse;
import cn.com.glsx.entmicro.service.EntmicroFollowerStaffService;
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 com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author Lichongyuan
 * @Description:
 * @date 2021/9/18 11:52
 */
@Component
@Service(version = "1.0.0", protocol = "dubbo", timeout = 10000)
public class EntmicroFollowerStaffRemoteImpl implements EntmicroFollowerStaffRemote {

    @Autowired
    private EntmicroFollowerStaffService entmicroFollowerStaffService;

    /**
     * 添加跟进专员
     *
     * @param entmicroFollowerStaffRequest
     * @return
     */
    @Override
    public RpcResponse<Boolean> saveFollowerStaff(EntmicroFollowerStaffRequest entmicroFollowerStaffRequest) {
        try {
            entmicroFollowerStaffService.saveFollowerStaff(entmicroFollowerStaffRequest);
            return RpcResponse.success(true);
        } catch (RpcServiceException e) {
            return RpcResponse.error(e);
        }
    }

    /**
     * 删除跟进专员
     *
     * @param entmicroFollowerStaffRequest
     * @return
     */
    @Override
    public RpcResponse<Boolean> deleteFollowerStaff(EntmicroFollowerStaffRequest entmicroFollowerStaffRequest) {
        try {
            entmicroFollowerStaffService.deleteFollowerStaff(entmicroFollowerStaffRequest);
            return RpcResponse.success(true);
        } catch (RpcServiceException e) {
            return RpcResponse.error(e);
        }
    }

    /**
     * 查询跟进专员列表
     *
     * @param pagination
     * @return
     */
    @Override
    public RpcResponse<RpcPagination<EntmicroFollowerStaffResponse>> listFollowerStaffByPage(RpcPagination<EntmicroFollowerStaffRequest> pagination) {
        try {
            Page<EntmicroFollowerStaffResponse> entmicroFollowerStaffResponses = entmicroFollowerStaffService.listFollowerStaffByPage(pagination);
            return RpcResponse.success(RpcPagination.copyPage(entmicroFollowerStaffResponses));
        } catch (RpcServiceException e) {
            return RpcResponse.error(e);
        }
    }

    @Override
    public RpcResponse<List<EntmicroFollowerStaffResponse>> findEntFollowStaffSpec(EntmicroFollowerStaffRequest entmicroFollowerStaffRequest) {
        try {
            List<EntmicroFollowerStaffResponse> entmicroFollowerStaffResponses = entmicroFollowerStaffService.findEntFollowStaffSpec(entmicroFollowerStaffRequest);
            return RpcResponse.success(entmicroFollowerStaffResponses);
        } catch (RpcServiceException e) {
            return RpcResponse.error(e);
        }
    }
}