package cn.superdesk.uniorder.service.organisation;

import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.security.dto.LoginSysUser;
import cn.superdesk.uniorder.dao.entity.organisation.SysEnterprise;
import cn.superdesk.uniorder.dao.entity.organisation.SysOrganization;
import cn.superdesk.uniorder.dto.param.organisation.SysEnterpriseQueryCriteria;
import cn.superdesk.uniorder.dto.param.organisation.SysVirtQueryParam;
import cn.superdesk.uniorder.dto.vo._function.select.SelectOptionVirt;
import cn.superdesk.uniorder.dto.vo.sys.SysOrganizationXEnterpriseVo;
import cn.superdesk.uniorder.dto.vo.sys.SysSelectVo;
import cn.superdesk.uniorder.dto.vo.sys.SysVirtVo;
import cn.superdesk.uniorder.dto.vo.sys.sysPlatformVo;
import cn.superdesk.uniorder.service.base.BaseService;
import com.github.pagehelper.PageInfo;

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

/**
 * @Description: 从服务之窗同步过来的 企业信息
 * @Author: linjinyu 补充与修改
 * @CreateDate: 5/21/20 4:32 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 5/21/20 4:32 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public interface SysEnterpriseService extends BaseService<SysEnterprise> {


    /****************************************** extends BaseService 部分 start ******************************************/

    int insertSelective(SysEnterprise entity);

    int updateByPrimaryKeySelective(SysEnterprise entity);

    @Deprecated
    void deleteObj(Long id);

    /**
     * 统一订单 的 id
     *
     * @param id
     * @return
     */
    @Deprecated
    SysEnterprise findById(Long id);

    @Deprecated
    PageInfo<SysEnterprise> findByPaging(Map<String, Object> conditions, Integer pageNun, Integer pageSize);

    @Deprecated
    List<SysEnterprise> findAll(Map<String, Object> queryMap);

    List<SysOrganizationXEnterpriseVo> findSysOrganizationXEnterprise(Map<String, Object> queryMap);

    /****************************************** extends BaseService 部分   end ******************************************/


    int addSysEnterprise(SysEnterprise entity);

    int updateSysEnterprise(SysEnterprise entity);

    int updateByPrimaryKeySelectiveWithRet(SysEnterprise entity);

    int deleteSysEnterprise(Long id);

    /**
     * 统一订单 的 id
     *
     * @param id
     * @return
     */
    SysEnterprise findSysEnterpriseById(Long id);

    @Deprecated
    R<List<SysEnterprise>> pageQuery(Map<String, Object> conditions, int pageNun, int pageSize);

    R<List<SysOrganizationXEnterpriseVo>> pageQuery(SysEnterpriseQueryCriteria queryCriteria, LoginSysUser loginSysUser);


    /****************************************** 之前的 要合并 start ******************************************/

    /**
     * 企业ID 数据库字段为 enterprise_id
     *
     * @param outVirtId
     * @return
     */
    SysEnterprise findByOutVirtId(Long outVirtId);

    SysEnterprise findByOutVirtName(String outVirtName);

    List<SysEnterprise> findByOutVirtIds(List<Long> outVirtIds);

    Map<Long, SysEnterprise> findByOutVirtIdsConvertKV(List<Long> outVirtIds);

    List<String> convertOutVirtIds2VirtNames(List<Long> outVirtIds);

    /**
     * 企业名称 数据库字段为 enterprise_name
     *
     * @param orgId
     * @param enterpriseName
     * @return
     */
    List<SysEnterprise> findByVirtName(Long orgId, String enterpriseName);

    /**
     * 这是个通用
     *
     * @param params
     * @param pageNum
     * @param pageSize
     * @return
     */
    R<List<SelectOptionVirt>> getVirtSelect(Map<String, Object> params, int pageNum, int pageSize);

    List<SelectOptionVirt> getVirtSelectByOutOrgId(Long outOrgId);

    R<List<SelectOptionVirt>> getVirtSelectByOutOrgId(Long outOrgId, int pageNum, int pageSize);


    List<Long> getOutVirtIdsByOutOrgId(Long outOrgId);


    void addSpecDaiDeLiangHang(Long id);

    void deleteDaiDeLiangHang(Long id);

    /****************************************** kafka start ******************************************/

    void mergeReceiveVirtualarchitecture4SuperdeskMall(String message);

    void deleteReceiveVirtualarchitecture4SuperdeskMall(String message);


    void mergeReceiveVirtualarchitecture4SuperdeskTransfer(String message);

    void deleteReceiveVirtualarchitecture4SuperdeskTransfer(String message);

    /****************************************** kafka   end ******************************************/

    /****************************************** 之前的 要合并   end ******************************************/


    /****************************************** 关于游客问题 start ******************************************/

    SysEnterprise touchByOutOrgId(Long outOrgId);

    SysEnterprise renameByOutOrgId(SysOrganization sysOrganization);

    SysEnterprise createByBizVisitorLogic(Long outOrgId);

    /****************************************** 关于游客问题   end ******************************************/

    /****************************************** 工具方法  start ******************************************/

    Map<Long, SysEnterprise> convertOutVirtIds2MapOutVirtId2Entity(List<Long> outVirtIds);

    /****************************************** 工具方法   end ******************************************/

    Long countOutVirt();

    void mergeReceiveVirtualarchitecture4Qchjc(String message);

    List<SysVirtVo> getVirtList(SysVirtQueryParam param);

    List<SysSelectVo> selectList(Map<String,Object> params);

    List<sysPlatformVo> getvirtBizIdById(String enterpriseIds);
}
