404 lines
8.2 KiB
Java
404 lines
8.2 KiB
Java
|
package com.bocloud.sms.interfaces;
|
||
|
|
||
|
import com.bocloud.sms.entity.*;
|
||
|
import com.bocloud.sms.model.*;
|
||
|
import com.megatron.common.exception.InternalServerException;
|
||
|
import com.megatron.common.model.*;
|
||
|
import jakarta.servlet.http.HttpServletResponse;
|
||
|
import org.springframework.web.multipart.MultipartFile;
|
||
|
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
|
||
|
/**
|
||
|
* 租户抽象Service接口
|
||
|
*
|
||
|
* @author wei wei
|
||
|
* @version 1.0
|
||
|
* @since 2016.08.05
|
||
|
*/
|
||
|
public interface TenantService {
|
||
|
|
||
|
/**
|
||
|
* 创建租户
|
||
|
*
|
||
|
* @param params
|
||
|
* @param requestContext
|
||
|
* @return
|
||
|
* @throws InternalServerException
|
||
|
*/
|
||
|
Result create(TenantModel params, RequestContext requestContext) throws InternalServerException;
|
||
|
|
||
|
/**
|
||
|
* 更新租户
|
||
|
*
|
||
|
* @param id
|
||
|
* @param tenant
|
||
|
* @param requestContext
|
||
|
* @return
|
||
|
* @throws InternalServerException
|
||
|
*/
|
||
|
Result modify(Long id, TenantModel tenant, RequestContext requestContext) throws InternalServerException;
|
||
|
|
||
|
/**
|
||
|
* 删除租户
|
||
|
*
|
||
|
* @param id
|
||
|
* @param requestContext
|
||
|
* @return
|
||
|
* @throws InternalServerException
|
||
|
*/
|
||
|
Result remove(Long id, RequestContext requestContext) throws InternalServerException;
|
||
|
|
||
|
/**
|
||
|
* 查看租户详情
|
||
|
*
|
||
|
* @param id
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<Tenant> detail(Long id);
|
||
|
|
||
|
/**
|
||
|
* 分页查询
|
||
|
*
|
||
|
* @param pager
|
||
|
* @param user
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<GridBean<Tenant>> list(Pager pager, RequestContext user);
|
||
|
|
||
|
/**
|
||
|
* 根据资源池id删除租户资源池关系
|
||
|
*
|
||
|
* @param poolId
|
||
|
* @return
|
||
|
*/
|
||
|
Result deleteByPoolId(Long poolId);
|
||
|
|
||
|
/**
|
||
|
* 租户配置资源池
|
||
|
*
|
||
|
* @param id
|
||
|
* @param category
|
||
|
* @param poolIds
|
||
|
* @param requestContext
|
||
|
* @return
|
||
|
*/
|
||
|
Result configPool(Long id, String category, List<Long> poolIds, RequestContext requestContext);
|
||
|
|
||
|
/**
|
||
|
* 根据租户查询资源池关联信息
|
||
|
*
|
||
|
* @param id
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<List<TenantPool>> listTenantPool(Long id);
|
||
|
|
||
|
/**
|
||
|
* 租户配置资源池
|
||
|
*
|
||
|
* @param id
|
||
|
* @param businessIds
|
||
|
* @return
|
||
|
*/
|
||
|
Result configBusiness(Long id, List<Long> businessIds);
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 租户登录
|
||
|
*
|
||
|
* @param account
|
||
|
* @param password
|
||
|
* @param sessionId
|
||
|
* @param requestIp
|
||
|
* @return
|
||
|
* @throws InternalServerException
|
||
|
*/
|
||
|
GeneralResult<Map<String, Object>> login(String account, String password, String sessionId, String requestIp)
|
||
|
throws InternalServerException;
|
||
|
|
||
|
/**
|
||
|
* 租户退出
|
||
|
*
|
||
|
* @param id
|
||
|
* @return
|
||
|
* @throws InternalServerException
|
||
|
*/
|
||
|
Result logout(Long id) throws InternalServerException;
|
||
|
|
||
|
/**
|
||
|
* 修改租户状态
|
||
|
*
|
||
|
* @param id
|
||
|
* @param action
|
||
|
* @param requestContext
|
||
|
* @return
|
||
|
*/
|
||
|
Result updateStatus(Long id, ActionModel.Action action, RequestContext requestContext);
|
||
|
|
||
|
/**
|
||
|
* 获取租户下的用户
|
||
|
*
|
||
|
* @param id
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<List<User>> getTenantUsers(Long id);
|
||
|
|
||
|
/**
|
||
|
* 修改密码
|
||
|
*
|
||
|
* @param id
|
||
|
* @param oldPassword
|
||
|
* @param password
|
||
|
* @param requestContext
|
||
|
* @return
|
||
|
*/
|
||
|
Result changePwd(Long id, String oldPassword, String password, RequestContext requestContext);
|
||
|
|
||
|
/**
|
||
|
* 重置密码
|
||
|
*
|
||
|
* @param id
|
||
|
* @param password
|
||
|
* @param requestContext
|
||
|
* @return
|
||
|
*/
|
||
|
Result resetPwd(Long id, String password, RequestContext requestContext);
|
||
|
|
||
|
/**
|
||
|
* 获取安全密钥(公共方法勿删)
|
||
|
*
|
||
|
* @param apiKey
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<AccountSecurity> apiKey(String apiKey);
|
||
|
|
||
|
/**
|
||
|
* 检查租户是否异地登录
|
||
|
*
|
||
|
* @param id
|
||
|
* @param token
|
||
|
* @return
|
||
|
*/
|
||
|
Result checkTenant(Long id, String token);
|
||
|
|
||
|
/**
|
||
|
* 查询租户的角色
|
||
|
*
|
||
|
* @param tenantId
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<List<Role>> listRoles(Long tenantId);
|
||
|
|
||
|
/**
|
||
|
* 获取apiKey
|
||
|
*
|
||
|
* @param apiKey
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<AccountSecurity> getByApiKey(String apiKey);
|
||
|
|
||
|
/**
|
||
|
* 根据租户账号冻结租户基本信息
|
||
|
*
|
||
|
* @param account
|
||
|
* @return
|
||
|
* @throws InternalServerException
|
||
|
*/
|
||
|
Result lockByAccount(String account) throws InternalServerException;
|
||
|
|
||
|
/**
|
||
|
* 批量冻结租户
|
||
|
*
|
||
|
* @param ids
|
||
|
* @param context
|
||
|
* @return
|
||
|
*/
|
||
|
Result batchLock(List<Long> ids, RequestContext context);
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 批量冻结租户
|
||
|
*
|
||
|
* @param ids
|
||
|
* @param context
|
||
|
* @return
|
||
|
*/
|
||
|
Result batchActive(List<Long> ids, RequestContext context);
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 批量删除租户
|
||
|
*
|
||
|
* @param ids
|
||
|
* @param context
|
||
|
* @return
|
||
|
*/
|
||
|
Result batchRemove(List<Long> ids, RequestContext context);
|
||
|
|
||
|
/**
|
||
|
* 保存租户登录数据
|
||
|
*
|
||
|
* @param log
|
||
|
* @return
|
||
|
* @throws InternalServerException
|
||
|
*/
|
||
|
Result save(LoginRecord log) throws InternalServerException;
|
||
|
|
||
|
/**
|
||
|
* 租户登录记录列表展示
|
||
|
*
|
||
|
* @param pager
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<GridBean<LoginRecord>> list(Pager pager);
|
||
|
|
||
|
/**
|
||
|
* checked租户权限
|
||
|
*
|
||
|
* @param context
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<Map<String, Object>> listPermissions(RequestContext context);
|
||
|
|
||
|
/**
|
||
|
* 校验密码
|
||
|
*
|
||
|
* @param id
|
||
|
* @param password
|
||
|
* @return
|
||
|
*/
|
||
|
Result check(Long id, String password);
|
||
|
|
||
|
/**
|
||
|
* 批量添加收藏
|
||
|
*
|
||
|
* @param favorites
|
||
|
* @return
|
||
|
*/
|
||
|
Result addFavorites(List<Favorite> favorites);
|
||
|
|
||
|
/**
|
||
|
* 添加收藏
|
||
|
*
|
||
|
* @param serviceMenuId
|
||
|
* @param tenantId
|
||
|
* @return
|
||
|
*/
|
||
|
Result addFavorite(Long serviceMenuId, Long tenantId);
|
||
|
|
||
|
/**
|
||
|
* 取消收藏
|
||
|
*
|
||
|
* @param serviceId
|
||
|
* @param tenantId
|
||
|
* @return
|
||
|
*/
|
||
|
Result cancelFavorite(Long serviceId, Long tenantId, RequestContext requestContext);
|
||
|
|
||
|
/**
|
||
|
* 获取服务目录
|
||
|
*
|
||
|
* @param requestContext
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<List<ServiceMenuBean>> listServiceMenu(RequestContext requestContext);
|
||
|
|
||
|
/**
|
||
|
* 获取收藏夹
|
||
|
*
|
||
|
* @param requestContext
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<List<CloudServiceBean>> listFavorite(RequestContext requestContext);
|
||
|
|
||
|
/**
|
||
|
* 修改收藏夹排序
|
||
|
*
|
||
|
* @param params
|
||
|
* @param requestContext
|
||
|
* @return
|
||
|
*/
|
||
|
Result changePriority(List<PriorityModel> params, RequestContext requestContext);
|
||
|
|
||
|
/**
|
||
|
* 返回账号相关登录所需信息
|
||
|
*
|
||
|
* @param account
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<Map<String, Object>> tokenLogin(String account);
|
||
|
|
||
|
/**
|
||
|
* 获取租户下的项目
|
||
|
*
|
||
|
* @param id
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<List<Project>> projects(Long id);
|
||
|
|
||
|
/**
|
||
|
* 根据账号获取租户信息
|
||
|
*
|
||
|
* @param account
|
||
|
* @return
|
||
|
*/
|
||
|
Result exist(String account);
|
||
|
|
||
|
/**
|
||
|
* 根据省市信息获取租户列表
|
||
|
*
|
||
|
* @param city
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult<List<Tenant>> listTenantByCity(String city);
|
||
|
|
||
|
/**
|
||
|
* 租户导入模板
|
||
|
*
|
||
|
* @param title
|
||
|
* @param requestContext
|
||
|
* @param response
|
||
|
* @return
|
||
|
*/
|
||
|
Result importTemp(String title, RequestContext requestContext, HttpServletResponse response);
|
||
|
|
||
|
/**
|
||
|
* 租户数据导入
|
||
|
*
|
||
|
* @param multipartFile
|
||
|
* @param requestContext
|
||
|
* @return
|
||
|
*/
|
||
|
Result importData(MultipartFile multipartFile, RequestContext requestContext);
|
||
|
|
||
|
/**
|
||
|
* 租户配置成员用户
|
||
|
*
|
||
|
* @param id
|
||
|
* @param userIds
|
||
|
* @return
|
||
|
*/
|
||
|
Result configUsers(Long id, List<Long> userIds);
|
||
|
|
||
|
/**
|
||
|
* 字典查询
|
||
|
*
|
||
|
* @param condition
|
||
|
* @return
|
||
|
*/
|
||
|
GeneralResult condition(String condition);
|
||
|
|
||
|
/**
|
||
|
* 导出租户列表
|
||
|
*
|
||
|
* @param paramList
|
||
|
* @param requestContext
|
||
|
* @param response
|
||
|
* @return
|
||
|
*/
|
||
|
Result export(List<Param> paramList, RequestContext requestContext, HttpServletResponse response);
|
||
|
|
||
|
GeneralResult checkPassword(RequestContext requestContext, String password);
|
||
|
}
|