Commit 595289ee by 阳浪

登录优化

parent 48a40242
...@@ -31,6 +31,7 @@ import com.yizhi.site.application.vo.site.MyItemConfigVO; ...@@ -31,6 +31,7 @@ import com.yizhi.site.application.vo.site.MyItemConfigVO;
import com.yizhi.system.application.constant.SecurityError; import com.yizhi.system.application.constant.SecurityError;
import com.yizhi.system.application.controller.manage.AccountController; import com.yizhi.system.application.controller.manage.AccountController;
import com.yizhi.system.application.domain.Account; import com.yizhi.system.application.domain.Account;
import com.yizhi.system.application.domain.Site;
import com.yizhi.system.application.enums.SecurityReturnCode; import com.yizhi.system.application.enums.SecurityReturnCode;
import com.yizhi.system.application.exception.AuthNoManagementException; import com.yizhi.system.application.exception.AuthNoManagementException;
import com.yizhi.system.application.exception.AuthNotManageException; import com.yizhi.system.application.exception.AuthNotManageException;
...@@ -223,6 +224,7 @@ public class AuthController { ...@@ -223,6 +224,7 @@ public class AuthController {
user.setPassword(""); user.setPassword("");
retMap.put("userInfo", user); retMap.put("userInfo", user);
retMap.put("siteId", context.getSiteId().toString()); retMap.put("siteId", context.getSiteId().toString());
retMap.put("siteCode", context.getSiteCode());
} }
/** /**
...@@ -293,6 +295,14 @@ public class AuthController { ...@@ -293,6 +295,14 @@ public class AuthController {
} }
context.setAccountId(user.getId()); context.setAccountId(user.getId());
context.setOrgId(user.getOrgId()); context.setOrgId(user.getOrgId());
Long siteId = accountService.findSiteId(user.getId());
if(siteId!=null) {
context.setSiteId(siteId);
Site site = siteService.findById(siteId);
if(site!=null){
context.setSiteCode(site.getCode());
}
}
String token = createToken(user, context); String token = createToken(user, context);
// 生成token(不是首次登陆) // 生成token(不是首次登陆)
if (!firstLoginFlg) { if (!firstLoginFlg) {
......
package com.yizhi.system.application.mapper; import com.baomidou.mybatisplus.mapper.BaseMapper;import com.baomidou.mybatisplus.plugins.Page;import com.yizhi.system.application.util.RightLeftIndex;import com.yizhi.system.application.vo.*;import com.yizhi.system.application.domain.Account;import org.apache.ibatis.annotations.Param;import org.apache.ibatis.annotations.Select;import org.apache.ibatis.session.RowBounds; import java.io.Serializable;import java.util.Collection;import java.util.List;import java.util.Set; public interface AccountMapper extends BaseMapper<Account> { List<Account> selectBatchIds(@Param("idList") Collection<? extends Serializable> idList); @Select("<script>" + "SELECT id,name,full_name fullName,remark_first status, org_id orgId,email, mobile, work_num workNum, sex, position, id_number idNumber, remark_second siteId " + "FROM account WHERE company_id = #{companyId} AND remark_second = #{siteId} AND remark_first='0' AND deleted = 0" + "<if test=\"userName != null and userName != '' \"> " + " AND name = #{userName} " + "</if> order by tb.sort" + "</script>") List<OutsideUserVO> getRcUsers(@Param(value = "userName") String userName, @Param(value = "companyId") Long companyId, @Param(value = "siteId") String siteId); /** * 获取企业下的接入有效用户 * @param companyId * @param enable * @return */ @Select("<script>" + "SELECT id,name,full_name fullName,remark_first status, org_id orgId,email, mobile, work_num workNum, sex, position, id_number idNumber, remark_second siteId " + "FROM account WHERE company_id = #{companyId} AND deleted = 0" + "<if test='enable != null'> " + " AND enabled = #{enable} " + "</if>" + "</script>") List<OutsideUserVO> getCompanyOutsideUsers(@Param(value = "companyId") Long companyId, @Param(value = "enable") Integer enable); /** * 查询重名的不同账号数量 * * @param id * @param resourceName * @return */ @Select("select count(*) from account where " + "id <> #{accountId} and company_id=#{companyId} and name = #{accountName} AND deleted = 0") int countExistAccount(@Param(value = "accountId") Long accountId, @Param(value = "companyId") Long companyId, @Param(value = "accountName") String accountName); /** * 获取公司内账号关闭的人数 * * @param companyId * @return */ @Select("select count(*) from account where company_id= #{companyId} and enabled=0 AND deleted = 0 ") int getCloseCountByCompanyId(@Param(value = "companyId") Long companyId); /** * 获取公司内总账号数 * * @param companyId * @return */ @Select("select count(*) from account where company_id= #{companyId} AND deleted = 0 ") int getCountByCompanyId(@Param(value = "companyId") Long companyId); /** * RowBounds rowBounds 支持分页,selectVoteList要和xml配置id一致 * * @param cid 企业 * @param orgId 组织id * @return */ List<OrgAccountVO> selectOrgAndAccount(@Param("cid") Long cid, @Param("orgId") Long orgId, @Param("queryStr") String queryStr); List<OrgAccountVO> selectOrgAndAccountByName(@Param("cid") Long cid, @Param("orgId") Long orgId, @Param("queryStr") String queryStr); /** * 查询用户 * * @param cid * @param orgId * @param queryStr * @return */ List<OrgAccountVO> selectAccount(@Param("cid") Long cid, @Param("orgId") Long orgId, @Param("queryStr") String queryStr); /** * 查询用户组信息 * * @param cid * @param queryStr * @return */ List<OrgAccountVO> selectUserGrouop(@Param("cid") Long cid, @Param("sid") Long sid, @Param("queryStr") String queryStr); /** * 根据用户名,姓名,或部门名称查询账号列表 * * @param name * @param fullName * @param orgName * @return */ List<UserInfoVO> selectUserInfo(@Param("name") String name, @Param("fullName") String fullName, @Param("orgName") String orgName, @Param("companyId") Long companyId, @Param("orgIds") List<Long> orgIds); /** * 返回用户ids 排序 * * @param accountIdList * @return */ List<Long> selectAccountIdList(@Param("accountIdList") List<Long> accountIdList); /** * 检查和给定worknum重复的员工总人数 * * @param accountId * @param companyId * @param worknum * @return */ @Select("select count(*) from account where " + "id <> #{accountId} and company_id=#{companyId} and work_num = #{worknum} AND deleted = 0") int countExistWorknum(@Param(value = "accountId") Long accountId, @Param(value = "companyId") Long companyId, @Param(value = "worknum") String worknum); // /** // * 根基id查询 // * // * @param ids // * @return // */ // List<Account> selectByIds(@Param("ids") List<Long> ids); /** * 组织下人员接口-其他 -- 权限改造 * * @param groupId * @param name * @param mobile * @param workNum * @return */ List<Account> orgAccountListPageOther(@Param("groupId") Long groupId, @Param("name") String name, @Param("mobile") String mobile, @Param("workNum") String workNum, @Param("email") String email, @Param("enabled") Integer enabled, RowBounds rowBounds); Integer orgAccountListPageOtherCount(@Param("groupId") Long groupId, @Param("name") String name, @Param("mobile") String mobile, @Param("workNum") String workNum, @Param("email") String email, @Param("enabled") Integer enabled); /** * 组织下人员接口-部门 -- 权限改造 * * @param rightLeftIndices * @param name * @param mobile * @param workNum * @param fullName * @param enabled * @return */ List<Account> orgAccountListPage(@Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("name") String name, @Param("mobile") String mobile, @Param("orgId") Long orgId, @Param("workNum") String workNum, @Param("fullName") String fullName, @Param("email") String email, @Param("enabled") Integer enabled, @Param("companyId") Long companyId, RowBounds rowBounds); Integer orgAccountListPageCount(@Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("name") String name, @Param("mobile") String mobile, @Param("orgId") Long orgId, @Param("workNum") String workNum, @Param("fullName") String fullName, @Param("email") String email, @Param("enabled") Integer enabled, @Param("companyId") Long companyId); List<Account> orgAccountList(@Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("enabled") Integer enabled, @Param("companyId") Long companyId); int orgAccountListCount(@Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("enabled") Integer enabled, @Param("companyId") Long companyId); /** * 根据管辖区id获取用户id * * @param groupIds * @return */ List<Long> getIdsByUserGroupIds(@Param("groupIds") List<Long> groupIds); /** * 分页查询当前站点下的用户 * * @param orgIds * @param ids * @return */ List<Account> searchSitePage(@Param("name") String name, @Param("mobile") String mobile, @Param("workNum") String workNum, @Param("fullName") String fullName, @Param("email") String email, @Param("enabled") Integer enabled, @Param("orgIds") List<Long> orgIds, @Param("ids") List<Long> ids, RowBounds rowBounds); /** * 分页查询当前站点下的用户 * * @param orgIds * @param ids * @return */ Integer searchSitePageCount(@Param("name") String name, @Param("mobile") String mobile, @Param("workNum") String workNum, @Param("fullName") String fullName, @Param("email") String email, @Param("enabled") Integer enabled, @Param("orgIds") List<Long> orgIds, @Param("ids") List<Long> ids); /** * 根据账号id来获取组织部门id * https://blog.csdn.net/aiyawalie/article/details/52954138 * * @param accountId * @return */ @Select("select org_id from account where id = #{accoungId}") Long getOrgIdByAccountId(@Param("accoungId") Long accoungId); /** * 根据用户id集合查询用户信息 * * @param ids * @return */ @Select("<script>" + "SELECT t.id,t.`name`,t.sex,t.full_name AS fullName,t.head_portrait AS headPortrait,o.id AS orgId,o.`name` AS orgName,t.enabled,t.company_id as companyId " + "FROM (SELECT id,`name`,head_portrait,full_name,org_id,enabled,sex,company_id FROM account WHERE 1=1 AND deleted = 0" + "<if test='ids != null'> " + " AND id IN " + "<foreach collection='ids' open='(' close=')' separator=',' item='userId' index='index'> " + "#{userId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> "</if>" + " ORDER BY create_time DESC) t LEFT JOIN organization o " + " ON t.org_id=o.id " + "</script>") List<AccountVO> idsGet(@Param("ids") List<Long> ids); /** * 通过给定accountIds 结合条件查询 * * @param keyWord 用户名 姓名 工号 * @param position 职位 * @param orgId 部门id * @param page * @return */ List<ReportAccountRespVO> getVoByIds(@Param("accountIds") List<Long> accountIds, @Param("keyWord") String keyWord, @Param("position") String position, @Param("orgId") Long orgId, @Param("orgName") String orgName, Page page); /** * 查询站点下的人数 * * @param siteId * @param companyId * @return */ @Select("select count(a.id) from account a " + "left join organization o on o.id = a.org_id " + "left join authz_group_member gm on ((gm.member_id = o.id and gm.type = 1) or (gm.member_id = a.id and type = 2)) " + "where a.company_id = #{companyId} and gm.group_id = (select user_group_id from site where id = #{siteId}) AND a.deleted = 0") Integer getSiteAccountNum(@Param("siteId") Long siteId, @Param("companyId") Long companyId); /** * 查找公司下所有的账号名 * * @param companyId * @return */ @Select("select name from account where company_id = #{companyId} AND deleted = 0") List<String> selectNamesByCompanyId(@Param("companyId") Long companyId); /** * 查找公司下用户的手机号码 * * @param companyId * @return */ @Select("select mobile from account where company_id = #{companyId} and enabled=1 and mobile!='' AND deleted = 0") List<String> selectMobilesByCompanyId(@Param("companyId") Long companyId); /** * 查找公司下所有的工号 * * @param companyId * @return */ @Select("select work_num from account where company_id = #{companyId} AND deleted = 0") List<String> selectWorkNumsByCompanyId(@Param("companyId") Long companyId); /** * 管辖范围内,查询用户列表,指定部门 * * @param names * @param rightLeftIndices * @param companyId * @return */ List<Account> listByNamesInManageRangeOrg(@Param("names") List<String> names, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("companyId") Long companyId); /** * 管辖范围内,查询用户列表,指定用户组 * * @param userGroupIds * @param companyId * @return */ List<Account> listByNamesInManageRangeUserGroup(@Param("names") List<String> names, @Param("userGroupIds") List<Long> userGroupIds, @Param("companyId") Long companyId); @Select("<script>" + "SELECT a.id AS userId,a.`name` AS userName,a.full_name AS userFullName, " + "a.org_id AS orgId,o.`name` AS orgName,a.enabled AS status,,a.create_time AS createTime " + "FROM " + "account a LEFT JOIN organization o ON a.org_id = o.id " + "WHERE enabled=1 and 1=1 AND a.deleted = 0" + "<if test='orgs != null'> " + " AND a.org_id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='orgId' index='index'> " + "#{orgId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> "</if>" + "<if test='orgName != null'> " + "AND o.`name` LIKE #{orgName} " + "</if>" + "<if test='userName != null'> " + "AND a.`name` LIKE #{userName} " + "</if>" + "ORDER BY a.enabled DESC,a.id ASC " + "</script>") List<ReportAccountRespVO> getOrgsCountUser(@Param("orgs") List<Long> orgs, @Param("orgName") String orgName, @Param("userName") String userName); @Select("<script>" + "SELECT a.id AS userId,a.`name` AS userName,a.full_name AS userFullName, " + "a.org_id AS orgId,o.`name` AS orgName,a.enabled AS status,,a.create_time AS createTime " + "FROM " + "account a LEFT JOIN organization o ON a.org_id = o.id " + "WHERE 1=1 AND a.deleted = 0" + "<if test='orgs != null'> " + " AND a.org_id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='orgId' index='index'> " + "#{orgId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> "</if>" + "<if test='orgName != null'> " + "AND o.`name` LIKE #{orgName} " + "</if>" + "<if test='userName != null'> " + "AND a.`name` LIKE #{userName} " + "</if>" + "ORDER BY a.enabled DESC,a.id ASC " + "</script>") List<ReportAccountRespVO> getOrgsCountUser(@Param("page") Page<ReportAccountRespVO> page, @Param("orgs") List<Long> orgs, @Param("orgName") String orgName, @Param("userName") String userName); @Select("<script>" + "SELECT t.userId,t.workNum,t.userName,t.userFullName,t.orgId,t.orgName,t.orgCode,t.status,t.createTime,t.email,t.companyId FROM (" + " SELECT a.email,a.id AS userId,a.work_num AS workNum,a.`name` AS userName,a.full_name AS userFullName, " + " a.org_id AS orgId,o.`name` AS orgName,o.`code` AS orgCode,a.enabled AS status,a.create_time AS createTime," + " a.company_id AS companyId" + " FROM " + " account a LEFT JOIN organization o ON a.org_id = o.id " + " WHERE 1=1 AND a.deleted = 0" + "<if test='isAllAccout==false'>" + " AND a.enabled = 1 " + "</if>" + "<if test='nameOrFullName != null'>" + "AND (a.`name` LIKE CONCAT('%', #{nameOrFullName}, '%') OR a.full_name LIKE CONCAT('%', #{nameOrFullName}, '%') ) " + "</if>" + "<if test='orgs != null'> " + " AND (a.org_id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='orgId' index='index'> " + "#{orgId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> " OR a.id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='accountId' index='index'> " + "#{accountId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> "<if test='groupId != null and groupId != 0'>" + " OR a.id IN (select member_id from authz_group_member where group_id = #{groupId} and type = 2)" + "</if>" + " ) " + "</if>" + "<if test='orgs == null and groupId != null and groupId != 0'>" + " AND a.id IN (select member_id from authz_group_member where group_id = #{groupId} and type = 2)" + "</if>" + ") t ORDER BY t.status DESC,t.userId ASC " + "</script>") List<ReportAccountRespVO> getOrgsRangeUser(@Param("orgs") List<Long> orgs, @Param("isAllAccout") boolean isAllAccout, @Param("nameOrFullName") String nameOrFullName, @Param("groupId") Long groupId); @Select("<script>" + "SELECT id AS userId,name AS userName FROM account" + " WHERE 1=1 AND deleted = 0 " + "<if test='orgs != null'> " + " AND org_id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='orgId' index='index'> " + "#{orgId,jdbcType=BIGINT} " + "</foreach>" + "</if>" + " GROUP BY userName" + "</script>") List<ReportAccountRespVO> getRangeUserNames(@Param("orgs") Set<Long> orgs); @Select("<script>" + "SELECT count(0) " + "FROM " + "account a LEFT JOIN organization o ON a.org_id = o.id " + "WHERE 1=1 AND deleted = 0" + "<if test='isAllAccout==false'>" + "AND a.enabled = 1 " + "</if>" + "<if test='nameOrFullName != null'>" + "AND (a.`name` LIKE CONCAT('%', #{nameOrFullName}, '%') OR a.full_name LIKE CONCAT('%', #{nameOrFullName}, '%') ) " + "</if>" + "<if test='orgs != null'> " + " AND (a.org_id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='orgId' index='index'> " + "#{orgId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> " OR a.id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='accountId' index='index'> " + "#{accountId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> "<if test='groupId != null and groupId != 0'>" + " OR a.id IN (select member_id from authz_group_member where group_id = #{groupId} and type = 2)" + "</if>" + " ) " + "</if>" + "<if test='orgs == null and groupId != null and groupId != 0'>" + " AND a.id IN (select member_id from authz_group_member where group_id = #{groupId} and type = 2)" + "</if>" + "ORDER BY a.enabled DESC,a.id ASC " + "</script>") Long getOrgsRangeUserCountNum(@Param("orgs") List<Long> orgs, @Param("isAllAccout") boolean isAllAccout, @Param("nameOrFullName") String nameOrFullName, @Param("groupId") Long groupId); /** * 根据组织id查询组织下的用户id * * @param OrgId * @return */ @Select("SELECT a.id FROM account a WHERE a.org_id = #{OrgId} AND a.deleted = 0") List<Long> getAccountsByOrgId(@Param("OrgId") Long OrgId); /** * 获取id * * @param account * @return */ Set<Long> getIds(@Param("account") Account account); /** * 获取id * * @param account * @param rightLeftIndices * @return */ Set<Long> getIdsInManage(@Param("account") Account account, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices); /** * 获取用户 * * @param companyId * @param rightLeftIndices * @return */ Set<Account> getInManage(@Param("companyId") Long companyId, @Param("rightLeftIndices") Collection<RightLeftIndex> rightLeftIndices, @Param("accountIds") Collection<Long> accountIds); /** * @param names * @param companyId * @return */ List<Account> getIdsByNames(@Param("names") List<String> names, @Param("companyId") Long companyId); /** * 根据companId,id查询账号姓名 * * @param companyId * @param ids * @return */ List<Account> getAccountsByCompanIdIds(@Param("companyId") Long companyId, @Param("ids") List<Long> ids); /** * 根据条件查询一个部门下的用户id * * @param companyId * @param orgId * @param enabled * @return */ @Select("select id from account " + "where company_id = #{companyId} " + "and org_id = #{orgId} " + "and enabled = #{enabled} AND deleted = 0") List<Long> listAccountIdByOrgIdAndEnable(@Param("companyId") Long companyId, @Param("orgId") Long orgId, @Param("enabled") Integer enabled); /** * 查询手机号码是否已经存在系统中 * * @param mobile * @param companyId * @return */ @Select("select count(*) from account where " + "id <> #{accountId} and company_id=#{companyId} and mobile = #{mobile} AND deleted = 0") int countExistMobile(@Param("accountId") Long accountId, @Param("companyId") Long companyId, @Param("mobile") String mobile); List<ReportAccountRespVO> getReportAccountRespVO(@Param("companyId") Long companyId, @Param("enabled") Boolean enabled, @Param("accountName") String accountName, @Param("orgName") String orgName, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("accountIds") List<Long> accountIds, @Param("orgIds") List<Long> orgIds); List<ReportAccountRespVO> getReportAccountRespVO(@Param("companyId") Long companyId, @Param("enabled") Boolean enabled, @Param("accountName") String accountName, @Param("orgName") String orgName, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("accountIds") List<Long> accountIds, @Param("orgIds") List<Long> orgIds, Page page); List<Account> getByParam(@Param("companyId") Long companyId, @Param("enabled") Boolean enabled, @Param("accountName") String accountName, @Param("mobile") String mobile, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("accountIds") List<Long> accountIds, Page<Account> page); Long getReportAccountRespVOCount(@Param("companyId") Long companyId, @Param("enabled") Boolean enabled, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("accountIds") List<Long> accountIds); List<Long> getAccountId(@Param("companyId") Long companyId, @Param("enabled") Boolean enabled, @Param("accountName") String accountName, @Param("orgName") String orgName, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("accountIds") List<Long> accountIds); @Select("select id from account where company_id = #{companyId} AND deleted = 0") Set<Long> getIdByCompanyId(@Param("companyId") Long companyId); List<AccountCountVO> getAccountCount(@Param("companyId") Long companyId); /** * 查找公司下除了指定用户的手机号 * * @param companyId * @return */ @Select("select mobile from account where company_id = #{companyId} and id != #{accountId} and mobile!='' AND deleted = 0") List<String> selectMobilesExceptAccountId(@Param("companyId") Long companyId, @Param("accountId") Long accountId); /** * 查询站点下的管理员 * * @param siteId * @return */ List<Account> selectManagerList(@Param("siteId") Long siteId, @Param("name") String name, RowBounds rowBounds); Integer selectManagerCount(@Param("siteId") Long siteId, @Param("name") String name); /** * 根据用户名,姓名,或部门名称查询账号列表 * * @param name * @param fullName * @param orgName * @return */ List<UserInfoVO> getUser(@Param("name") String name, @Param("fullName") String fullName, @Param("orgName") String orgName, @Param("companyId") Long companyId, @Param("orgIds") List<Long> orgIds); } package com.yizhi.system.application.mapper; import com.baomidou.mybatisplus.mapper.BaseMapper;import com.baomidou.mybatisplus.plugins.Page;import com.yizhi.system.application.util.RightLeftIndex;import com.yizhi.system.application.vo.*;import com.yizhi.system.application.domain.Account;import org.apache.ibatis.annotations.Param;import org.apache.ibatis.annotations.Select;import org.apache.ibatis.session.RowBounds; import java.io.Serializable;import java.util.Collection;import java.util.List;import java.util.Set; public interface AccountMapper extends BaseMapper<Account> { List<Account> selectBatchIds(@Param("idList") Collection<? extends Serializable> idList); @Select("<script>" + "SELECT id,name,full_name fullName,remark_first status, org_id orgId,email, mobile, work_num workNum, sex, position, id_number idNumber, remark_second siteId " + "FROM account WHERE company_id = #{companyId} AND remark_second = #{siteId} AND remark_first='0' AND deleted = 0" + "<if test=\"userName != null and userName != '' \"> " + " AND name = #{userName} " + "</if> order by tb.sort" + "</script>") List<OutsideUserVO> getRcUsers(@Param(value = "userName") String userName, @Param(value = "companyId") Long companyId, @Param(value = "siteId") String siteId); /** * 获取企业下的接入有效用户 * @param companyId * @param enable * @return */ @Select("<script>" + "SELECT id,name,full_name fullName,remark_first status, org_id orgId,email, mobile, work_num workNum, sex, position, id_number idNumber, remark_second siteId " + "FROM account WHERE company_id = #{companyId} AND deleted = 0" + "<if test='enable != null'> " + " AND enabled = #{enable} " + "</if>" + "</script>") List<OutsideUserVO> getCompanyOutsideUsers(@Param(value = "companyId") Long companyId, @Param(value = "enable") Integer enable); /** * 查询重名的不同账号数量 * * @param id * @param resourceName * @return */ @Select("select count(*) from account where " + "id <> #{accountId} and company_id=#{companyId} and name = #{accountName} AND deleted = 0") int countExistAccount(@Param(value = "accountId") Long accountId, @Param(value = "companyId") Long companyId, @Param(value = "accountName") String accountName); /** * 获取公司内账号关闭的人数 * * @param companyId * @return */ @Select("select count(*) from account where company_id= #{companyId} and enabled=0 AND deleted = 0 ") int getCloseCountByCompanyId(@Param(value = "companyId") Long companyId); /** * 获取公司内总账号数 * * @param companyId * @return */ @Select("select count(*) from account where company_id= #{companyId} AND deleted = 0 ") int getCountByCompanyId(@Param(value = "companyId") Long companyId); /** * RowBounds rowBounds 支持分页,selectVoteList要和xml配置id一致 * * @param cid 企业 * @param orgId 组织id * @return */ List<OrgAccountVO> selectOrgAndAccount(@Param("cid") Long cid, @Param("orgId") Long orgId, @Param("queryStr") String queryStr); List<OrgAccountVO> selectOrgAndAccountByName(@Param("cid") Long cid, @Param("orgId") Long orgId, @Param("queryStr") String queryStr); /** * 查询用户 * * @param cid * @param orgId * @param queryStr * @return */ List<OrgAccountVO> selectAccount(@Param("cid") Long cid, @Param("orgId") Long orgId, @Param("queryStr") String queryStr); /** * 查询用户组信息 * * @param cid * @param queryStr * @return */ List<OrgAccountVO> selectUserGrouop(@Param("cid") Long cid, @Param("sid") Long sid, @Param("queryStr") String queryStr); /** * 根据用户名,姓名,或部门名称查询账号列表 * * @param name * @param fullName * @param orgName * @return */ List<UserInfoVO> selectUserInfo(@Param("name") String name, @Param("fullName") String fullName, @Param("orgName") String orgName, @Param("companyId") Long companyId, @Param("orgIds") List<Long> orgIds); /** * 返回用户ids 排序 * * @param accountIdList * @return */ List<Long> selectAccountIdList(@Param("accountIdList") List<Long> accountIdList); /** * 检查和给定worknum重复的员工总人数 * * @param accountId * @param companyId * @param worknum * @return */ @Select("select count(*) from account where " + "id <> #{accountId} and company_id=#{companyId} and work_num = #{worknum} AND deleted = 0") int countExistWorknum(@Param(value = "accountId") Long accountId, @Param(value = "companyId") Long companyId, @Param(value = "worknum") String worknum); // /** // * 根基id查询 // * // * @param ids // * @return // */ // List<Account> selectByIds(@Param("ids") List<Long> ids); /** * 组织下人员接口-其他 -- 权限改造 * * @param groupId * @param name * @param mobile * @param workNum * @return */ List<Account> orgAccountListPageOther(@Param("groupId") Long groupId, @Param("name") String name, @Param("mobile") String mobile, @Param("workNum") String workNum, @Param("email") String email, @Param("enabled") Integer enabled, RowBounds rowBounds); Integer orgAccountListPageOtherCount(@Param("groupId") Long groupId, @Param("name") String name, @Param("mobile") String mobile, @Param("workNum") String workNum, @Param("email") String email, @Param("enabled") Integer enabled); /** * 组织下人员接口-部门 -- 权限改造 * * @param rightLeftIndices * @param name * @param mobile * @param workNum * @param fullName * @param enabled * @return */ List<Account> orgAccountListPage(@Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("name") String name, @Param("mobile") String mobile, @Param("orgId") Long orgId, @Param("workNum") String workNum, @Param("fullName") String fullName, @Param("email") String email, @Param("enabled") Integer enabled, @Param("companyId") Long companyId, RowBounds rowBounds); Integer orgAccountListPageCount(@Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("name") String name, @Param("mobile") String mobile, @Param("orgId") Long orgId, @Param("workNum") String workNum, @Param("fullName") String fullName, @Param("email") String email, @Param("enabled") Integer enabled, @Param("companyId") Long companyId); List<Account> orgAccountList(@Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("enabled") Integer enabled, @Param("companyId") Long companyId); int orgAccountListCount(@Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("enabled") Integer enabled, @Param("companyId") Long companyId); /** * 根据管辖区id获取用户id * * @param groupIds * @return */ List<Long> getIdsByUserGroupIds(@Param("groupIds") List<Long> groupIds); /** * 分页查询当前站点下的用户 * * @param orgIds * @param ids * @return */ List<Account> searchSitePage(@Param("name") String name, @Param("mobile") String mobile, @Param("workNum") String workNum, @Param("fullName") String fullName, @Param("email") String email, @Param("enabled") Integer enabled, @Param("orgIds") List<Long> orgIds, @Param("ids") List<Long> ids, RowBounds rowBounds); /** * 分页查询当前站点下的用户 * * @param orgIds * @param ids * @return */ Integer searchSitePageCount(@Param("name") String name, @Param("mobile") String mobile, @Param("workNum") String workNum, @Param("fullName") String fullName, @Param("email") String email, @Param("enabled") Integer enabled, @Param("orgIds") List<Long> orgIds, @Param("ids") List<Long> ids); /** * 根据账号id来获取组织部门id * https://blog.csdn.net/aiyawalie/article/details/52954138 * * @param accountId * @return */ @Select("select org_id from account where id = #{accoungId}") Long getOrgIdByAccountId(@Param("accoungId") Long accoungId); /** * 根据用户id集合查询用户信息 * * @param ids * @return */ @Select("<script>" + "SELECT t.id,t.`name`,t.sex,t.full_name AS fullName,t.head_portrait AS headPortrait,o.id AS orgId,o.`name` AS orgName,t.enabled,t.company_id as companyId " + "FROM (SELECT id,`name`,head_portrait,full_name,org_id,enabled,sex,company_id FROM account WHERE 1=1 AND deleted = 0" + "<if test='ids != null'> " + " AND id IN " + "<foreach collection='ids' open='(' close=')' separator=',' item='userId' index='index'> " + "#{userId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> "</if>" + " ORDER BY create_time DESC) t LEFT JOIN organization o " + " ON t.org_id=o.id " + "</script>") List<AccountVO> idsGet(@Param("ids") List<Long> ids); /** * 通过给定accountIds 结合条件查询 * * @param keyWord 用户名 姓名 工号 * @param position 职位 * @param orgId 部门id * @param page * @return */ List<ReportAccountRespVO> getVoByIds(@Param("accountIds") List<Long> accountIds, @Param("keyWord") String keyWord, @Param("position") String position, @Param("orgId") Long orgId, @Param("orgName") String orgName, Page page); /** * 查询站点下的人数 * * @param siteId * @param companyId * @return */ @Select("select count(a.id) from account a " + "left join organization o on o.id = a.org_id " + "left join authz_group_member gm on ((gm.member_id = o.id and gm.type = 1) or (gm.member_id = a.id and type = 2)) " + "where a.company_id = #{companyId} and gm.group_id = (select user_group_id from site where id = #{siteId}) AND a.deleted = 0") Integer getSiteAccountNum(@Param("siteId") Long siteId, @Param("companyId") Long companyId); /** * 查找公司下所有的账号名 * * @param companyId * @return */ @Select("select name from account where company_id = #{companyId} AND deleted = 0") List<String> selectNamesByCompanyId(@Param("companyId") Long companyId); /** * 查找公司下用户的手机号码 * * @param companyId * @return */ @Select("select mobile from account where company_id = #{companyId} and enabled=1 and mobile!='' AND deleted = 0") List<String> selectMobilesByCompanyId(@Param("companyId") Long companyId); /** * 查找公司下所有的工号 * * @param companyId * @return */ @Select("select work_num from account where company_id = #{companyId} AND deleted = 0") List<String> selectWorkNumsByCompanyId(@Param("companyId") Long companyId); /** * 管辖范围内,查询用户列表,指定部门 * * @param names * @param rightLeftIndices * @param companyId * @return */ List<Account> listByNamesInManageRangeOrg(@Param("names") List<String> names, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("companyId") Long companyId); /** * 管辖范围内,查询用户列表,指定用户组 * * @param userGroupIds * @param companyId * @return */ List<Account> listByNamesInManageRangeUserGroup(@Param("names") List<String> names, @Param("userGroupIds") List<Long> userGroupIds, @Param("companyId") Long companyId); @Select("<script>" + "SELECT a.id AS userId,a.`name` AS userName,a.full_name AS userFullName, " + "a.org_id AS orgId,o.`name` AS orgName,a.enabled AS status,,a.create_time AS createTime " + "FROM " + "account a LEFT JOIN organization o ON a.org_id = o.id " + "WHERE enabled=1 and 1=1 AND a.deleted = 0" + "<if test='orgs != null'> " + " AND a.org_id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='orgId' index='index'> " + "#{orgId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> "</if>" + "<if test='orgName != null'> " + "AND o.`name` LIKE #{orgName} " + "</if>" + "<if test='userName != null'> " + "AND a.`name` LIKE #{userName} " + "</if>" + "ORDER BY a.enabled DESC,a.id ASC " + "</script>") List<ReportAccountRespVO> getOrgsCountUser(@Param("orgs") List<Long> orgs, @Param("orgName") String orgName, @Param("userName") String userName); @Select("<script>" + "SELECT a.id AS userId,a.`name` AS userName,a.full_name AS userFullName, " + "a.org_id AS orgId,o.`name` AS orgName,a.enabled AS status,,a.create_time AS createTime " + "FROM " + "account a LEFT JOIN organization o ON a.org_id = o.id " + "WHERE 1=1 AND a.deleted = 0" + "<if test='orgs != null'> " + " AND a.org_id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='orgId' index='index'> " + "#{orgId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> "</if>" + "<if test='orgName != null'> " + "AND o.`name` LIKE #{orgName} " + "</if>" + "<if test='userName != null'> " + "AND a.`name` LIKE #{userName} " + "</if>" + "ORDER BY a.enabled DESC,a.id ASC " + "</script>") List<ReportAccountRespVO> getOrgsCountUser(@Param("page") Page<ReportAccountRespVO> page, @Param("orgs") List<Long> orgs, @Param("orgName") String orgName, @Param("userName") String userName); @Select("<script>" + "SELECT t.userId,t.workNum,t.userName,t.userFullName,t.orgId,t.orgName,t.orgCode,t.status,t.createTime,t.email,t.companyId FROM (" + " SELECT a.email,a.id AS userId,a.work_num AS workNum,a.`name` AS userName,a.full_name AS userFullName, " + " a.org_id AS orgId,o.`name` AS orgName,o.`code` AS orgCode,a.enabled AS status,a.create_time AS createTime," + " a.company_id AS companyId" + " FROM " + " account a LEFT JOIN organization o ON a.org_id = o.id " + " WHERE 1=1 AND a.deleted = 0" + "<if test='isAllAccout==false'>" + " AND a.enabled = 1 " + "</if>" + "<if test='nameOrFullName != null'>" + "AND (a.`name` LIKE CONCAT('%', #{nameOrFullName}, '%') OR a.full_name LIKE CONCAT('%', #{nameOrFullName}, '%') ) " + "</if>" + "<if test='orgs != null'> " + " AND (a.org_id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='orgId' index='index'> " + "#{orgId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> " OR a.id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='accountId' index='index'> " + "#{accountId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> "<if test='groupId != null and groupId != 0'>" + " OR a.id IN (select member_id from authz_group_member where group_id = #{groupId} and type = 2)" + "</if>" + " ) " + "</if>" + "<if test='orgs == null and groupId != null and groupId != 0'>" + " AND a.id IN (select member_id from authz_group_member where group_id = #{groupId} and type = 2)" + "</if>" + ") t ORDER BY t.status DESC,t.userId ASC " + "</script>") List<ReportAccountRespVO> getOrgsRangeUser(@Param("orgs") List<Long> orgs, @Param("isAllAccout") boolean isAllAccout, @Param("nameOrFullName") String nameOrFullName, @Param("groupId") Long groupId); @Select("<script>" + "SELECT id AS userId,name AS userName FROM account" + " WHERE 1=1 AND deleted = 0 " + "<if test='orgs != null'> " + " AND org_id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='orgId' index='index'> " + "#{orgId,jdbcType=BIGINT} " + "</foreach>" + "</if>" + " GROUP BY userName" + "</script>") List<ReportAccountRespVO> getRangeUserNames(@Param("orgs") Set<Long> orgs); @Select("<script>" + "SELECT count(0) " + "FROM " + "account a LEFT JOIN organization o ON a.org_id = o.id " + "WHERE 1=1 AND deleted = 0" + "<if test='isAllAccout==false'>" + "AND a.enabled = 1 " + "</if>" + "<if test='nameOrFullName != null'>" + "AND (a.`name` LIKE CONCAT('%', #{nameOrFullName}, '%') OR a.full_name LIKE CONCAT('%', #{nameOrFullName}, '%') ) " + "</if>" + "<if test='orgs != null'> " + " AND (a.org_id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='orgId' index='index'> " + "#{orgId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> " OR a.id IN " + "<foreach collection='orgs' open='(' close=')' separator=',' item='accountId' index='index'> " + "#{accountId,jdbcType=BIGINT} " + "</foreach>" + //<if test="idNumber != null and idNumber != ''"> "<if test='groupId != null and groupId != 0'>" + " OR a.id IN (select member_id from authz_group_member where group_id = #{groupId} and type = 2)" + "</if>" + " ) " + "</if>" + "<if test='orgs == null and groupId != null and groupId != 0'>" + " AND a.id IN (select member_id from authz_group_member where group_id = #{groupId} and type = 2)" + "</if>" + "ORDER BY a.enabled DESC,a.id ASC " + "</script>") Long getOrgsRangeUserCountNum(@Param("orgs") List<Long> orgs, @Param("isAllAccout") boolean isAllAccout, @Param("nameOrFullName") String nameOrFullName, @Param("groupId") Long groupId); /** * 根据组织id查询组织下的用户id * * @param OrgId * @return */ @Select("SELECT a.id FROM account a WHERE a.org_id = #{OrgId} AND a.deleted = 0") List<Long> getAccountsByOrgId(@Param("OrgId") Long OrgId); /** * 获取id * * @param account * @return */ Set<Long> getIds(@Param("account") Account account); /** * 获取id * * @param account * @param rightLeftIndices * @return */ Set<Long> getIdsInManage(@Param("account") Account account, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices); /** * 获取用户 * * @param companyId * @param rightLeftIndices * @return */ Set<Account> getInManage(@Param("companyId") Long companyId, @Param("rightLeftIndices") Collection<RightLeftIndex> rightLeftIndices, @Param("accountIds") Collection<Long> accountIds); /** * @param names * @param companyId * @return */ List<Account> getIdsByNames(@Param("names") List<String> names, @Param("companyId") Long companyId); /** * 根据companId,id查询账号姓名 * * @param companyId * @param ids * @return */ List<Account> getAccountsByCompanIdIds(@Param("companyId") Long companyId, @Param("ids") List<Long> ids); /** * 根据条件查询一个部门下的用户id * * @param companyId * @param orgId * @param enabled * @return */ @Select("select id from account " + "where company_id = #{companyId} " + "and org_id = #{orgId} " + "and enabled = #{enabled} AND deleted = 0") List<Long> listAccountIdByOrgIdAndEnable(@Param("companyId") Long companyId, @Param("orgId") Long orgId, @Param("enabled") Integer enabled); /** * 查询手机号码是否已经存在系统中 * * @param mobile * @param companyId * @return */ @Select("select count(*) from account where " + "id <> #{accountId} and company_id=#{companyId} and mobile = #{mobile} AND deleted = 0") int countExistMobile(@Param("accountId") Long accountId, @Param("companyId") Long companyId, @Param("mobile") String mobile); List<ReportAccountRespVO> getReportAccountRespVO(@Param("companyId") Long companyId, @Param("enabled") Boolean enabled, @Param("accountName") String accountName, @Param("orgName") String orgName, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("accountIds") List<Long> accountIds, @Param("orgIds") List<Long> orgIds); List<ReportAccountRespVO> getReportAccountRespVO(@Param("companyId") Long companyId, @Param("enabled") Boolean enabled, @Param("accountName") String accountName, @Param("orgName") String orgName, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("accountIds") List<Long> accountIds, @Param("orgIds") List<Long> orgIds, Page page); List<Account> getByParam(@Param("companyId") Long companyId, @Param("enabled") Boolean enabled, @Param("accountName") String accountName, @Param("mobile") String mobile, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("accountIds") List<Long> accountIds, Page<Account> page); Long getReportAccountRespVOCount(@Param("companyId") Long companyId, @Param("enabled") Boolean enabled, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("accountIds") List<Long> accountIds); List<Long> getAccountId(@Param("companyId") Long companyId, @Param("enabled") Boolean enabled, @Param("accountName") String accountName, @Param("orgName") String orgName, @Param("rightLeftIndices") List<RightLeftIndex> rightLeftIndices, @Param("accountIds") List<Long> accountIds); @Select("select id from account where company_id = #{companyId} AND deleted = 0") Set<Long> getIdByCompanyId(@Param("companyId") Long companyId); List<AccountCountVO> getAccountCount(@Param("companyId") Long companyId); /** * 查找公司下除了指定用户的手机号 * * @param companyId * @return */ @Select("select mobile from account where company_id = #{companyId} and id != #{accountId} and mobile!='' AND deleted = 0") List<String> selectMobilesExceptAccountId(@Param("companyId") Long companyId, @Param("accountId") Long accountId); /** * 查询站点下的管理员 * * @param siteId * @return */ List<Account> selectManagerList(@Param("siteId") Long siteId, @Param("name") String name, RowBounds rowBounds); Integer selectManagerCount(@Param("siteId") Long siteId, @Param("name") String name); /** * 根据用户名,姓名,或部门名称查询账号列表 * * @param name * @param fullName * @param orgName * @return */ List<UserInfoVO> getUser(@Param("name") String name, @Param("fullName") String fullName, @Param("orgName") String orgName, @Param("companyId") Long companyId, @Param("orgIds") List<Long> orgIds); Long findSiteId(@Param("accountId")Long accountId); }
\ No newline at end of file \ No newline at end of file
......
package com.yizhi.system.application.service; import com.baomidou.mybatisplus.plugins.Page;import com.baomidou.mybatisplus.service.IService;import com.yizhi.core.application.context.RequestContext;import com.yizhi.core.application.enums.SmsSendBizType;import com.yizhi.core.application.exception.BizException;import com.yizhi.core.application.vo.DroolsVo;import com.yizhi.system.application.model.AccountImpModel;import com.yizhi.system.application.model.ImportModel;import com.yizhi.system.application.model.RangeModel;import com.yizhi.system.application.vo.*;import com.yizhi.system.application.domain.Account;import com.yizhi.system.application.domain.AccountEnableLog;import com.yizhi.system.application.domain.AuthzRole;import com.yizhi.system.application.util.RightLeftIndex;import com.yizhi.util.application.page.PageInfo;import com.yizhi.system.application.utils.recursion.TreeObjectVO; import java.util.Collection;import java.util.List;import java.util.Map;import java.util.Set; public interface IAccountService extends IService<Account> { /** * 获取待入职的员工 * @param userName * @param companyId * @param siteId * @return */ List<OutsideUserVO> getRcUsers(String userName, Long companyId, String siteId); /** * 获取企业下对接的全部启用用户信息 * @param companyId * @param enable * @return */ List<OutsideUserVO> getCompanyOutsideUsers(Long companyId, Integer enable); /** * 检查手机验证码是否正确 * * @param smsSendBizType 发送短信业务类型 * @param mobile 手机号 * @param verifyCode 验证码 * @param extend 是否需要扩展字段处理特殊业务 */ void checkVerifyCode(SmsSendBizType smsSendBizType, Long mobile, String verifyCode, String extend); /** * 检查手机号是否存在 * * @param mobile * @return * @throws BizException */ Account mobileBindCheck(long mobile) throws BizException; /** * 检查修改的密码的数据是否符合业务规范 * * @param vo 要修改的数据 * @return */ Account checkUpPwdData(FirstLoginUpdateVO vo, SmsSendBizType smsSendBizType, String smsSendRequestNo) throws BizException; /** * 新增账号 * * @param account * @return */ Long add(Account account); /** * 更新账号 * * @param account * @return */ Boolean update(Account account); /** * 禁止账号 * * @param log * @return */ Boolean close(AccountEnableLog log); /** * 开通账号 * * @param log * @return */ Boolean open(AccountEnableLog log); /** * 更新密码 * * @param id * @param password * @return */ Boolean updatePassword(Long id, String password); /** * 查询账号列表 * * @param account * @return */ Page<Account> list(Account account, Page<Account> page); /** * 站点下的管理员 * @param account * @param page * @return */ Page<Account> managerList(AccountPageVO accountPageVO); /** * 查找账号角色列表 * * @param accountId * @return */ List<AuthzRole> findRoles(Long accountId); /** * 根据账号名和公司查找账号 * * @param companyId * @param accountName * @return */ Account find(Long companyId, String accountName); /** * 根据名称(用户名和全名) * * @param name * @return */ List<Account> fuzzySearchByName(String name, Long companyId); /** * 判断名称唯一 * * @param companyId * @param name * @return */ Boolean nameExists(Long id, Long companyId, String name); /** * 根据ids列表查询账号列表 * * @param ids * @return */ List<Account> getAccountByIds(List<Long> ids); /** * 根据orgName模糊查询符合条件下的部门account列表 * * @param name * @return */ List<Account> getAccountByOrgName(String name, Long companyId); /** * 获取账号信息 * * @param id * @return */ Account get(Long id); /** * 获取账号信息 * * @param id * @return */ Account getCard(Long id); /** * 批量修改部门 * * @param accountIds * @param orgId */ void batchUpdateOrg(List<Long> accountIds, Long orgId); /** * 批量解绑微信 * * @param accountIds */ void batchDeleteWechat(List<Long> accountIds); /** * 批量禁用账号 * * @param accountIds */ void batchDisable(List<Long> accountIds); /** * 根据企业id和组织id查询组织的下级组织和当前组织下的用户 * * @param cid * @param orgId * @param siteId * @param queryStr 查询字段 * @param type 1:组织;2:用户;3:用户组 * @return */ List<OrgAccountVO> selectOrgAndAccount(Long cid, Long orgId, Long siteId, String queryStr, int type); /** * 查询部门下所有的员工 * * @param orgId * @return */ List<Account> selectByOrgId(Long orgId, Long companyId); /** * 查询用户组下所有的员工 * * @param groupId * @return */ List<Account> selectByGroupId(Long groupId, Long companyId); /** * 获取全平台下所有的用户 * * @param siteId * @return */ List<Account> selectBySiteId(Long siteId); /** * 判断用户对站点是否有访问权限 * * @param accountId * @param siteId * @return */ Boolean isAccessToSite(Long accountId, Long siteId); /** * 根据用户名,姓名,或部门名称查询账号列表 * * @param userInfoVO * @return */ Map<Long, UserInfoVO> selectUserInfo(UserInfoVO userInfoVO); /** * 查询用户列表 * @param userInfoVO * @return */ List<Account> getUserInfoVOList(UserInfoVO userInfoVO); /** * 获取排序后逇idlist * @param accountIdList * @return */ List<Long> selectAccountIdList(List<Long> accountIdList); /** * 根据企业id查询组织列表 * * @param companyId * @return */ List<TreeObjectVO> selectOrgList(long companyId); /** * 根据相关类型和id查询用户信息 * key为count时,value为人数 * key为account时,value为用户列表 * * @param models * @return */ Map<String, Object> findMemberInfo(List<RangeModel> models); /** * 新增用户app id * * @param account */ void updateRegistrationId(Account account); /** * 组织下人员接口-其他 -- 权限改造 * * @param userGroupId * @param name * @param mobile * @param workNum * @param fullName * @param email * @param enabled * @param pageNo * @param pageSize * @return */ Page<Account> orgAccountListPageOther(Long userGroupId, String name, String mobile, String workNum, String email, Integer enabled, Integer pageNo, Integer pageSize); /** * 组织下人员接口-部门 -- 权限改造 * * @param rightLeftIndices * @param name * @param mobile * @param workNum * @param fullName * @param email * @param enabled * @param pageNo * @param pageSize * @return */ Page<Account> orgAccountListPage(Long companyId, List<RightLeftIndex> rightLeftIndices, String name, String mobile,Long orgId, String workNum, String fullName, String email, Integer enabled, Integer pageNo, Integer pageSize); Page<Account> orgAccountListById(Long companyId, List<RightLeftIndex> rightLeftIndices, String name, String mobile,Long orgId, String workNum, String fullName, String email, Integer enabled, Integer pageNo, Integer pageSize); /** * 管辖范围内,查询用户列表 * * @param noRange 是否不管orgIds和userGroupIds,查询所有(查全企业) * @param rightLeftIndices * @param userGroupIds * @param companyId * @return */ List<Account> listByNamesInManageRange(List<String> names, Boolean noRange, List<RightLeftIndex> rightLeftIndices, List<Long> userGroupIds, Long companyId,Integer type); /** * 根据用户id集合查询用户信息 * * @param ids * @return */ List<AccountVO> idsGet(List<Long> ids); /** * 查询一个站点下的用户数 * * @param siteId * @param companyId * @return */ Integer getSiteAccountNum(Long siteId, Long companyId); /** * 查询一个站点下的用户 * * @param siteId * @param companyId * @return */ List<Account> getSiteAccount(Long siteId, Long companyId); /** * 用户的导入 * * @param importModel * @return */ List<AccountImpModel> importAccount(ImportModel importModel, RequestContext context); /** * 查询用户信息 * * @param orgs * @param pageNo * @param pageSize * @param orgName * @param userName * @return */ PageInfo<ReportAccountRespVO> getOrgsUsers(List<Long> orgs, Integer pageNo, Integer pageSize, String orgName, String userName); /** * 查询指定范围内的用户名列表 * * @param ids * @return */ Map<String, Long> getRangeUserNames(Set<Long> ids); Long getRangeAccountCountNum(List<Long> ids, boolean isAllAccout, String nameOrFullName, Long groupId); /** * 获取用户的详情 * * @param name 用户名 * @param companyId 公司id * @return */ AccountVO findUser(String name, Long companyId); /** * 查询id * * @param account * @return */ Set<Long> getIds(Account account); /** * 查询id * * @param account * @param rightLeftIndices * @return */ Set<Long> getIds(Account account, List<RightLeftIndex> rightLeftIndices); /** * 获取指定部门下的用户,包含子部门(包含指定的用户) * * @param companyId * @param orgIds * @param accountIds * @return */ Set<Account> getList(Long companyId, Collection<Long> orgIds, Collection<Long> accountIds); /** * 根据用户名来查询账号 id,包括数据权限的校验 * * @param names * @param companyId * @param SiteId * @param managerContext * @param moduleType * @return */ Map<String, Long> getAccountIdByNames(List<String> names, Long companyId, Long SiteId, RequestContext managerContext, String moduleType); /** * 判断图形验证码是否正确 * * @param captchaKey 验证码请求前端生成的UUID * @param captchaVal 前端输入的验证码值 * @return 相等验证通过返回true */ boolean validateCaptcha(String captchaKey, String captchaVal); /** * 验证手机号 */ Integer VerifyPhoneNum(String phone); /** * PC端修改个人信息 账号-姓名-头像-公司名称-职级-手机号-个人介绍 * * @param account * @return */ Boolean updateInfo(Account account); /** * 对图形、短信验证码进行校验 * * @param smsSendBizType * @param mobile * @param verifyCode * @return */ Boolean VerifyCode(SmsSendBizType smsSendBizType, String mobile, String verifyCode); /** * 根据companId,id查询账号姓名 * * @param companyId * @param ids * @return */ List<Account> getAccountsByCompanIdIds(Long companyId, List<Long> ids); /** * 查询用户id集合 * * @param orgId * @param isEnable * @return */ List<Long> listAccountIdByOrgIdAndEnable(Long orgId, Boolean isEnable); /** * * @param companyId * @param enabled * @param accountName 模糊查询accountName,fullName * @param orgName 模糊查询orgname,orgCode * @param indices * @param accountIds * @return */ List<ReportAccountRespVO> getReportAccountRespVO(Long companyId, Boolean enabled, String accountName, String orgName, List<RightLeftIndex> indices, List<Long> accountIds,List<Long> orgIds, boolean allComppany, Page page); /** * * @param companyId * @param enabled * @param accountName * @param orgName * @param indices * @param accountIds * @return */ List<Long> getAccountId(Long companyId, Boolean enabled, String accountName, String orgName, List<RightLeftIndex> indices, List<Long> accountIds); Long getReportAccountRespVOCount(Long companyId, Boolean enabled, List<RightLeftIndex> indices, List<Long> accountIds, boolean allComppany); List<Account> getByParam(Long companyId, Boolean enabled, String accountName, String mobile, List<RightLeftIndex> rightLeftIndices, List<Long> accountIds, Page<Account> page); /** * 丁小伟添加,外部经验导入需要用户的部门id和部门名称 * * @param names * @param companyId * @param siteId * @param managerContext * @param moduleType * @return */ Map<String, Map<String, Object>> getAccountByNames(List<String> names, Long companyId, Long siteId, RequestContext managerContext, String moduleType); List<AccountCountVO> getAccountCount(Long companyId); Page<DroolsVo> getPageByDrools(String field, String value, Page<DroolsVo> page); Page getPageByRuleItems(RuleVisibleRangeVo vo,Page page); /** * 保存第用户 * @param account * @return */ Account saveThirdAccount(Account account); Map<Long, UserInfoVO> getUser(UserInfoVO userInfoVO); Integer getUserCount(List<Long> orgIds,Long companyId);} package com.yizhi.system.application.service; import com.baomidou.mybatisplus.plugins.Page;import com.baomidou.mybatisplus.service.IService;import com.yizhi.core.application.context.RequestContext;import com.yizhi.core.application.enums.SmsSendBizType;import com.yizhi.core.application.exception.BizException;import com.yizhi.core.application.vo.DroolsVo;import com.yizhi.system.application.model.AccountImpModel;import com.yizhi.system.application.model.ImportModel;import com.yizhi.system.application.model.RangeModel;import com.yizhi.system.application.vo.*;import com.yizhi.system.application.domain.Account;import com.yizhi.system.application.domain.AccountEnableLog;import com.yizhi.system.application.domain.AuthzRole;import com.yizhi.system.application.util.RightLeftIndex;import com.yizhi.util.application.page.PageInfo;import com.yizhi.system.application.utils.recursion.TreeObjectVO; import java.util.Collection;import java.util.List;import java.util.Map;import java.util.Set; public interface IAccountService extends IService<Account> { /** * 获取待入职的员工 * @param userName * @param companyId * @param siteId * @return */ List<OutsideUserVO> getRcUsers(String userName, Long companyId, String siteId); /** * 获取企业下对接的全部启用用户信息 * @param companyId * @param enable * @return */ List<OutsideUserVO> getCompanyOutsideUsers(Long companyId, Integer enable); /** * 检查手机验证码是否正确 * * @param smsSendBizType 发送短信业务类型 * @param mobile 手机号 * @param verifyCode 验证码 * @param extend 是否需要扩展字段处理特殊业务 */ void checkVerifyCode(SmsSendBizType smsSendBizType, Long mobile, String verifyCode, String extend); /** * 检查手机号是否存在 * * @param mobile * @return * @throws BizException */ Account mobileBindCheck(long mobile) throws BizException; /** * 检查修改的密码的数据是否符合业务规范 * * @param vo 要修改的数据 * @return */ Account checkUpPwdData(FirstLoginUpdateVO vo, SmsSendBizType smsSendBizType, String smsSendRequestNo) throws BizException; /** * 新增账号 * * @param account * @return */ Long add(Account account); /** * 更新账号 * * @param account * @return */ Boolean update(Account account); /** * 禁止账号 * * @param log * @return */ Boolean close(AccountEnableLog log); /** * 开通账号 * * @param log * @return */ Boolean open(AccountEnableLog log); /** * 更新密码 * * @param id * @param password * @return */ Boolean updatePassword(Long id, String password); /** * 查询账号列表 * * @param account * @return */ Page<Account> list(Account account, Page<Account> page); /** * 站点下的管理员 * @param account * @param page * @return */ Page<Account> managerList(AccountPageVO accountPageVO); /** * 查找账号角色列表 * * @param accountId * @return */ List<AuthzRole> findRoles(Long accountId); /** * 根据账号名和公司查找账号 * * @param companyId * @param accountName * @return */ Account find(Long companyId, String accountName); /** * 根据名称(用户名和全名) * * @param name * @return */ List<Account> fuzzySearchByName(String name, Long companyId); /** * 判断名称唯一 * * @param companyId * @param name * @return */ Boolean nameExists(Long id, Long companyId, String name); /** * 根据ids列表查询账号列表 * * @param ids * @return */ List<Account> getAccountByIds(List<Long> ids); /** * 根据orgName模糊查询符合条件下的部门account列表 * * @param name * @return */ List<Account> getAccountByOrgName(String name, Long companyId); /** * 获取账号信息 * * @param id * @return */ Account get(Long id); /** * 获取账号信息 * * @param id * @return */ Account getCard(Long id); /** * 批量修改部门 * * @param accountIds * @param orgId */ void batchUpdateOrg(List<Long> accountIds, Long orgId); /** * 批量解绑微信 * * @param accountIds */ void batchDeleteWechat(List<Long> accountIds); /** * 批量禁用账号 * * @param accountIds */ void batchDisable(List<Long> accountIds); /** * 根据企业id和组织id查询组织的下级组织和当前组织下的用户 * * @param cid * @param orgId * @param siteId * @param queryStr 查询字段 * @param type 1:组织;2:用户;3:用户组 * @return */ List<OrgAccountVO> selectOrgAndAccount(Long cid, Long orgId, Long siteId, String queryStr, int type); /** * 查询部门下所有的员工 * * @param orgId * @return */ List<Account> selectByOrgId(Long orgId, Long companyId); /** * 查询用户组下所有的员工 * * @param groupId * @return */ List<Account> selectByGroupId(Long groupId, Long companyId); /** * 获取全平台下所有的用户 * * @param siteId * @return */ List<Account> selectBySiteId(Long siteId); /** * 判断用户对站点是否有访问权限 * * @param accountId * @param siteId * @return */ Boolean isAccessToSite(Long accountId, Long siteId); /** * 根据用户名,姓名,或部门名称查询账号列表 * * @param userInfoVO * @return */ Map<Long, UserInfoVO> selectUserInfo(UserInfoVO userInfoVO); /** * 查询用户列表 * @param userInfoVO * @return */ List<Account> getUserInfoVOList(UserInfoVO userInfoVO); /** * 获取排序后逇idlist * @param accountIdList * @return */ List<Long> selectAccountIdList(List<Long> accountIdList); /** * 根据企业id查询组织列表 * * @param companyId * @return */ List<TreeObjectVO> selectOrgList(long companyId); /** * 根据相关类型和id查询用户信息 * key为count时,value为人数 * key为account时,value为用户列表 * * @param models * @return */ Map<String, Object> findMemberInfo(List<RangeModel> models); /** * 新增用户app id * * @param account */ void updateRegistrationId(Account account); /** * 组织下人员接口-其他 -- 权限改造 * * @param userGroupId * @param name * @param mobile * @param workNum * @param fullName * @param email * @param enabled * @param pageNo * @param pageSize * @return */ Page<Account> orgAccountListPageOther(Long userGroupId, String name, String mobile, String workNum, String email, Integer enabled, Integer pageNo, Integer pageSize); /** * 组织下人员接口-部门 -- 权限改造 * * @param rightLeftIndices * @param name * @param mobile * @param workNum * @param fullName * @param email * @param enabled * @param pageNo * @param pageSize * @return */ Page<Account> orgAccountListPage(Long companyId, List<RightLeftIndex> rightLeftIndices, String name, String mobile,Long orgId, String workNum, String fullName, String email, Integer enabled, Integer pageNo, Integer pageSize); Page<Account> orgAccountListById(Long companyId, List<RightLeftIndex> rightLeftIndices, String name, String mobile,Long orgId, String workNum, String fullName, String email, Integer enabled, Integer pageNo, Integer pageSize); /** * 管辖范围内,查询用户列表 * * @param noRange 是否不管orgIds和userGroupIds,查询所有(查全企业) * @param rightLeftIndices * @param userGroupIds * @param companyId * @return */ List<Account> listByNamesInManageRange(List<String> names, Boolean noRange, List<RightLeftIndex> rightLeftIndices, List<Long> userGroupIds, Long companyId,Integer type); /** * 根据用户id集合查询用户信息 * * @param ids * @return */ List<AccountVO> idsGet(List<Long> ids); /** * 查询一个站点下的用户数 * * @param siteId * @param companyId * @return */ Integer getSiteAccountNum(Long siteId, Long companyId); /** * 查询一个站点下的用户 * * @param siteId * @param companyId * @return */ List<Account> getSiteAccount(Long siteId, Long companyId); /** * 用户的导入 * * @param importModel * @return */ List<AccountImpModel> importAccount(ImportModel importModel, RequestContext context); /** * 查询用户信息 * * @param orgs * @param pageNo * @param pageSize * @param orgName * @param userName * @return */ PageInfo<ReportAccountRespVO> getOrgsUsers(List<Long> orgs, Integer pageNo, Integer pageSize, String orgName, String userName); /** * 查询指定范围内的用户名列表 * * @param ids * @return */ Map<String, Long> getRangeUserNames(Set<Long> ids); Long getRangeAccountCountNum(List<Long> ids, boolean isAllAccout, String nameOrFullName, Long groupId); /** * 获取用户的详情 * * @param name 用户名 * @param companyId 公司id * @return */ AccountVO findUser(String name, Long companyId); /** * 查询id * * @param account * @return */ Set<Long> getIds(Account account); /** * 查询id * * @param account * @param rightLeftIndices * @return */ Set<Long> getIds(Account account, List<RightLeftIndex> rightLeftIndices); /** * 获取指定部门下的用户,包含子部门(包含指定的用户) * * @param companyId * @param orgIds * @param accountIds * @return */ Set<Account> getList(Long companyId, Collection<Long> orgIds, Collection<Long> accountIds); /** * 根据用户名来查询账号 id,包括数据权限的校验 * * @param names * @param companyId * @param SiteId * @param managerContext * @param moduleType * @return */ Map<String, Long> getAccountIdByNames(List<String> names, Long companyId, Long SiteId, RequestContext managerContext, String moduleType); /** * 判断图形验证码是否正确 * * @param captchaKey 验证码请求前端生成的UUID * @param captchaVal 前端输入的验证码值 * @return 相等验证通过返回true */ boolean validateCaptcha(String captchaKey, String captchaVal); /** * 验证手机号 */ Integer VerifyPhoneNum(String phone); /** * PC端修改个人信息 账号-姓名-头像-公司名称-职级-手机号-个人介绍 * * @param account * @return */ Boolean updateInfo(Account account); /** * 对图形、短信验证码进行校验 * * @param smsSendBizType * @param mobile * @param verifyCode * @return */ Boolean VerifyCode(SmsSendBizType smsSendBizType, String mobile, String verifyCode); /** * 根据companId,id查询账号姓名 * * @param companyId * @param ids * @return */ List<Account> getAccountsByCompanIdIds(Long companyId, List<Long> ids); /** * 查询用户id集合 * * @param orgId * @param isEnable * @return */ List<Long> listAccountIdByOrgIdAndEnable(Long orgId, Boolean isEnable); /** * * @param companyId * @param enabled * @param accountName 模糊查询accountName,fullName * @param orgName 模糊查询orgname,orgCode * @param indices * @param accountIds * @return */ List<ReportAccountRespVO> getReportAccountRespVO(Long companyId, Boolean enabled, String accountName, String orgName, List<RightLeftIndex> indices, List<Long> accountIds,List<Long> orgIds, boolean allComppany, Page page); /** * * @param companyId * @param enabled * @param accountName * @param orgName * @param indices * @param accountIds * @return */ List<Long> getAccountId(Long companyId, Boolean enabled, String accountName, String orgName, List<RightLeftIndex> indices, List<Long> accountIds); Long getReportAccountRespVOCount(Long companyId, Boolean enabled, List<RightLeftIndex> indices, List<Long> accountIds, boolean allComppany); List<Account> getByParam(Long companyId, Boolean enabled, String accountName, String mobile, List<RightLeftIndex> rightLeftIndices, List<Long> accountIds, Page<Account> page); /** * 丁小伟添加,外部经验导入需要用户的部门id和部门名称 * * @param names * @param companyId * @param siteId * @param managerContext * @param moduleType * @return */ Map<String, Map<String, Object>> getAccountByNames(List<String> names, Long companyId, Long siteId, RequestContext managerContext, String moduleType); List<AccountCountVO> getAccountCount(Long companyId); Page<DroolsVo> getPageByDrools(String field, String value, Page<DroolsVo> page); Page getPageByRuleItems(RuleVisibleRangeVo vo,Page page); /** * 保存第用户 * @param account * @return */ Account saveThirdAccount(Account account); Map<Long, UserInfoVO> getUser(UserInfoVO userInfoVO); Integer getUserCount(List<Long> orgIds,Long companyId); Long findSiteId(Long accountId);}
\ No newline at end of file \ No newline at end of file
......
...@@ -2636,4 +2636,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl ...@@ -2636,4 +2636,8 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
return wrapper; return wrapper;
} }
@Override
public Long findSiteId(Long accountId){
return this.accountMapper.findSiteId(accountId);
}
} }
...@@ -997,5 +997,16 @@ ...@@ -997,5 +997,16 @@
where 1=1 and id in(<foreach collection="idList" index="index" item="item" separator=",">#{item}</foreach>) and where 1=1 and id in(<foreach collection="idList" index="index" item="item" separator=",">#{item}</foreach>) and
deleted=0 deleted=0
</select> </select>
<select id="findSiteId" resultType="java.lang.Long">
select
distinct ar.site_id
from
authz_account_role aar
left join authz_role ar on
aar.role_id = ar.id
where
account_id = #{accountId}
limit 1
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment