package cn.superdesk.uniorder.dubbo.consumer.organisation;

import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.dao.entity.organisation.SysOrganization;
import cn.superdesk.uniorder.dto.param.organisation.SysOrgQueryParam;
import cn.superdesk.uniorder.dto.param.organisation.SysVirtQueryParam;
import cn.superdesk.uniorder.dto.vo._function.select.SelectOptionOrg;
import cn.superdesk.uniorder.dto.vo.sys.SysOrgVo;
import cn.superdesk.uniorder.dto.vo.sys.SysSelectVo;
import cn.superdesk.uniorder.dto.vo.sys.SysVirtVo;
import cn.superdesk.uniorder.dubbo.facade.organisation.DubboSysOrganizationService;
import com.alibaba.dubbo.config.annotation.Reference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;


@Slf4j
@Component
public class SysOrganizationDubboConsumerService {


	@Reference(version = "1.0.0", timeout = 30000, retries = -1)
	private DubboSysOrganizationService dubboSysOrganizationService;


	public void add(SysOrganization t) {
		dubboSysOrganizationService.addObj(t);
	}

	public void update(SysOrganization t) {
		dubboSysOrganizationService.updateObj(t);
	}

	public List<SysOrganization> findByOrgId(Long outOrgId) {
		return dubboSysOrganizationService.findByOutOrgId(outOrgId);
	}

	public List<SysOrganization> findByOutOrgIds(List<Long> outOrgIds) {
		return dubboSysOrganizationService.findByOutOrgIds(outOrgIds);
	}

	public List<String> convertOutOrgIds2OrgNames(List<Long> outOrgIds) {
		return dubboSysOrganizationService.convertOutOrgIds2OrgNames(outOrgIds);
	}

	public List<SysOrganization> findByOutOrgName(String outOrgName) {
		return dubboSysOrganizationService.findByOutOrgName(outOrgName);
	}

	public R<List<SelectOptionOrg>> getProjectSelect(Map<String, Object> params, int pageNum, int pageSize) {

		return dubboSysOrganizationService.getProjectSelect(params, pageNum, pageSize);
	}

	public void delObj(Long id) {

		dubboSysOrganizationService.delObj(id);
	}

	/****************************************** 服务之窗-项目 start ******************************************/

	public void mergeReceiveOrganization(String message) {
		dubboSysOrganizationService.mergeReceiveOrganization(message);
	}

	public void deleteReceiveOrganization(String message) {
		dubboSysOrganizationService.deleteReceiveOrganization(message);
	}

	/****************************************** 服务之窗-项目   end ******************************************/


	public R<List<SysOrgVo>> getOrgList(SysOrgQueryParam param){
		return dubboSysOrganizationService.getOrgList(param);
	}

	public List<SysSelectVo> selectList(SysOrgQueryParam param){
		return dubboSysOrganizationService.selectList(param);
	}
}
