MerchantStaffService.java 1.33 KB
package cn.com.glsx.busassistant.service;

import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.merchants.model.request.MerchantStaffRequest;
import cn.com.glsx.merchants.model.response.MerchantStaffResponse;
import cn.com.glsx.merchants.remote.MerchantStaffRemote;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class MerchantStaffService {
    @Autowired
    private MerchantStaffRemote merchantStaffRemote;

    public List<MerchantStaffResponse> listMerchantStaffsByMerchantIds(List<Integer> merchantIds){
        log.debug("查询商户员工列表,merchantIds:{}", merchantIds);
        MerchantStaffRequest request = new MerchantStaffRequest();
        request.setMerchantNoList(merchantIds);
        RpcResponse<List<MerchantStaffResponse>> res = merchantStaffRemote.findMerchantStaffListRemote(request);
        if(res.isSuccess()){
            return res.getResult();
        }else{
            log.error("失败,res:{}", res);
            throw new RpcServiceException(DefaultErrorEnum.SERVICE_ERROR, "查询商户员工列表失败");
        }
    }
}