|
@@ -0,0 +1,869 @@
|
|
|
+package com.dragoninfo.dcuc.auth.admin.service.impl;
|
|
|
+
|
|
|
+import com.dragoninfo.dcuc.auth.admin.entity.AppMtAuth;
|
|
|
+import com.dragoninfo.dcuc.auth.admin.entity.ManageInfo;
|
|
|
+import com.dragoninfo.dcuc.auth.admin.entity.MgeLog;
|
|
|
+import com.dragoninfo.dcuc.auth.admin.entity.TempMtAuth;
|
|
|
+import com.dragoninfo.dcuc.auth.admin.enumresource.AdminObjectTypeEnum;
|
|
|
+import com.dragoninfo.dcuc.auth.admin.enumresource.AdminOperateTypeEnum;
|
|
|
+import com.dragoninfo.dcuc.auth.admin.repo.ManageInfoRepository;
|
|
|
+import com.dragoninfo.dcuc.auth.admin.service.IAppMtAuthService;
|
|
|
+import com.dragoninfo.dcuc.auth.admin.service.IManageInfoService;
|
|
|
+import com.dragoninfo.dcuc.auth.admin.service.IMgeLogService;
|
|
|
+import com.dragoninfo.dcuc.auth.admin.service.ITempMtAuthService;
|
|
|
+import com.dragoninfo.dcuc.auth.admin.vo.AdminAuditVO;
|
|
|
+import com.dragoninfo.dcuc.auth.sub.dto.AuthUserDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.sub.entity.AuthUserInfo;
|
|
|
+import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
|
|
|
+import com.dragoninfo.dcuc.duceap.facade.ICodeListResourceFacade;
|
|
|
+import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
|
|
|
+import com.dragoninfo.dcuc.org.vo.OrgTreeNode;
|
|
|
+import com.dragoninfo.duceap.commons.util.server.OrgInfoUtil;
|
|
|
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
|
+import com.dragonsoft.duceap.base.entity.metadata.CodeRecord;
|
|
|
+import com.dragonsoft.duceap.base.entity.search.SearchDTO;
|
|
|
+import com.dragonsoft.duceap.base.entity.security.BaseSecurityUser;
|
|
|
+import com.dragonsoft.duceap.base.entity.security.SecurityUser;
|
|
|
+import com.dragonsoft.duceap.base.enums.BooleanEnum;
|
|
|
+import com.dragonsoft.duceap.base.utils.UserContextUtils;
|
|
|
+import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
|
|
|
+import com.dragonsoft.duceap.commons.util.string.StringUtils;
|
|
|
+import com.dragonsoft.duceap.core.entity.page.PageImpl;
|
|
|
+import com.dragonsoft.duceap.core.search.Searchable;
|
|
|
+import com.dragonsoft.duceap.core.search.enums.SearchOperator;
|
|
|
+import com.dragonsoft.duceap.core.search.filter.Condition;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Example;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+
|
|
|
+@Service
|
|
|
+@Transactional
|
|
|
+public class ManageInfoService implements IManageInfoService {
|
|
|
+
|
|
|
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ManageInfoRepository manageInfoRepository;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAuthUserInfoService authUserInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAppMtAuthService appMtAuthService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITempMtAuthService tempMtAuthService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IMgeLogService iMgeLogService;
|
|
|
+ @Autowired
|
|
|
+ private IOrgInfoFacade orgInfoFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICodeListResourceFacade codeListResourceFacade;
|
|
|
+
|
|
|
+ private volatile boolean isEmpty = true;
|
|
|
+
|
|
|
+ private final Map<String, String> POLICE_CATEGORY_MAP = new HashMap<>();
|
|
|
+
|
|
|
+ private void checkPoliceTypeMap(){
|
|
|
+ if (!this.isEmpty){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ synchronized (this.POLICE_CATEGORY_MAP){
|
|
|
+ if (this.isEmpty){
|
|
|
+ this.POLICE_CATEGORY_MAP.putAll(codeListResourceFacade.listCode("code", "T_MD_POLICE_TYPE").stream()
|
|
|
+ .collect(Collectors.toMap(CodeRecord::getValue,CodeRecord::getLabel)));
|
|
|
+ this.isEmpty = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据机构获取非管理员用户
|
|
|
+ *
|
|
|
+ * @param searchDTO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<AuthUserDTO> getUserNotInManage(SearchDTO searchDTO) {
|
|
|
+ checkPoliceTypeMap();
|
|
|
+ Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
+ Condition orgIdEq = searchable.getSearchFilter("orgId", SearchOperator.eq);
|
|
|
+ //机构id不为空,从带有管理范围的机构树选择某一个机构查询
|
|
|
+ //无需再过滤管理范围的机构
|
|
|
+ //机构id为空,从搜索框查询,带有人员的查询条件
|
|
|
+ //需要过滤当前登录人的管理范围
|
|
|
+ if(null == orgIdEq) {
|
|
|
+ BaseSecurityUser currentUser = UserContextUtils.getCurrentUser();
|
|
|
+ boolean rootUser = authUserInfoService.isRootUser(currentUser.getId());
|
|
|
+ if(!rootUser) {
|
|
|
+ List<AppMtAuth> mtAuths = appMtAuthService.getByUserId(currentUser.getId());
|
|
|
+ if(CollectionUtils.isEmpty(mtAuths)) {
|
|
|
+ return new PageImpl<>(new ArrayList(), searchable.getPage(), 0L);
|
|
|
+ }
|
|
|
+ Set<String> allMtOrgIds = orgInfoFacade.getAllMtOrgIds(mtAuths.get(0).getOrgId());
|
|
|
+ searchable.addSearchFilter("orgId", SearchOperator.in, allMtOrgIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Page<AuthUserInfo> userInfoPage = manageInfoRepository.getNotManagePolice(searchable);
|
|
|
+ List<AuthUserInfo> userInfos = userInfoPage.getContent();
|
|
|
+ List<AuthUserDTO> collect = userInfos.stream().map(e -> {
|
|
|
+ AuthUserDTO dto = new AuthUserDTO();
|
|
|
+ BeanUtils.copyProperties(e, dto);
|
|
|
+ final String code;
|
|
|
+ if (null == (code = e.getPoliceCategory())) {
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
+ final String value = POLICE_CATEGORY_MAP.get(code);
|
|
|
+ dto.setPoliceCategory(value);
|
|
|
+ return dto;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return new PageImpl<>(collect, searchable.getPage(), userInfoPage.getTotalElements());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseStatus saveAdmin(String userIds) {
|
|
|
+ String[] idArray = userIds.split(",");
|
|
|
+ List<ManageInfo> manageInfos = new ArrayList<ManageInfo>();
|
|
|
+ Set<String> uids = new HashSet<String>();
|
|
|
+ for (String id : idArray) {
|
|
|
+ AuthUserInfo userInfo = authUserInfoService.findById(id);
|
|
|
+ if (userInfo == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ uids.add(id);
|
|
|
+ ManageInfo manageInfo = new ManageInfo();
|
|
|
+ manageInfo.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
+ manageInfo.setOrgId(userInfo.getOrgId());
|
|
|
+ manageInfo.setUserId(userInfo.getId());
|
|
|
+ manageInfo.setUserName(userInfo.getName());
|
|
|
+ manageInfo.setOrgName(userInfo.getOrgName());
|
|
|
+ manageInfo.setCreateUser(UserContextUtils.getCurrentUser().getId());
|
|
|
+ manageInfo.setCreateTime(new Date());
|
|
|
+ manageInfos.add(manageInfo);
|
|
|
+ }
|
|
|
+ manageInfoRepository.saveAll(manageInfos);
|
|
|
+ //未启用auth管理本系统菜单
|
|
|
+ List<TempMtAuth> list = tempMtAuthService.findByUserIds(uids);
|
|
|
+ tempMtAuthService.deleteAll(list);
|
|
|
+ Map<String, String> authMap = list.stream()
|
|
|
+ .collect(Collectors.toMap(TempMtAuth::getUserId, TempMtAuth::getOrgId));
|
|
|
+ this.setMgeAuth(manageInfos, authMap);
|
|
|
+ return ResponseStatus.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseStatus deleteByUserId(String userId) {
|
|
|
+ //删除授权管理员
|
|
|
+ appMtAuthService.delByUserId(userId);
|
|
|
+ //查询下用户管理是否有该用户如果没有删除
|
|
|
+ manageInfoRepository.delByUserId(userId);
|
|
|
+ saveMgeLog(AdminOperateTypeEnum.QXGLY.getValue(),AdminObjectTypeEnum.SQGL.getValue(), userId, userId);
|
|
|
+ return ResponseStatus.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<AdminAuditVO> adminAuditPage(SearchDTO dto) {
|
|
|
+ Searchable searchable = Searchable.toSearchable(dto);
|
|
|
+ Page<AdminAuditVO> userInfoPage = manageInfoRepository.adminAuditPage(searchable);
|
|
|
+ List<AdminAuditVO> content = userInfoPage.getContent();
|
|
|
+ List<String> createUserIds = content.stream().map(AdminAuditVO::getCreateUser).collect(Collectors.toList());
|
|
|
+ List<AuthUserInfo> createUsers = authUserInfoService.findByIds(createUserIds);
|
|
|
+ Map<String, AuthUserInfo> userDTOMap = createUsers.stream().collect(Collectors.toMap(AuthUserInfo::getId, e -> e));
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
|
|
+ content.forEach(e->{
|
|
|
+ String createUser = e.getCreateUser();
|
|
|
+ AuthUserInfo authUserInfo = userDTOMap.get(createUser);
|
|
|
+ if(null != authUserInfo) {
|
|
|
+ e.setCreateUserName(authUserInfo.getName());
|
|
|
+ }
|
|
|
+ Date createTime = e.getCreateTime();
|
|
|
+ if(null != createTime) {
|
|
|
+ e.setCreateTimeString(format.format(createTime));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return userInfoPage;
|
|
|
+ }
|
|
|
+
|
|
|
+ //历史数据会产生同一个人会有多条管理员数据
|
|
|
+ //如果因为多条数据报错,要处理历史数据
|
|
|
+ @Override
|
|
|
+ public ManageInfo manageInfoByUserId(String userId) {
|
|
|
+ ManageInfo manageInfo = new ManageInfo();
|
|
|
+ manageInfo.setUserId(userId);
|
|
|
+ Example<ManageInfo> example = Example.of(manageInfo);
|
|
|
+ return manageInfoRepository.findOne(example).orElse(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 广东地区管理员导入——新增管理员,新增理范围
|
|
|
+ *
|
|
|
+ * @param list 新增的管理员
|
|
|
+ * @param orgIdAuthMap 新的管理范围userId:orgIdAuth
|
|
|
+ */
|
|
|
+ private void setMgeAuth(Collection<ManageInfo> list, Map<String, String> orgIdAuthMap) {
|
|
|
+ List<AppMtAuth> appMtAuthList = new ArrayList<>();
|
|
|
+ List<MgeLog> mgeLogList = new ArrayList<>();
|
|
|
+ for (ManageInfo manageInfo : list) {
|
|
|
+ String userId = manageInfo.getUserId();
|
|
|
+ String orgIdAuth = orgIdAuthMap.get(userId);
|
|
|
+ mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.XZGLY.getValue(), userId, userId, AdminObjectTypeEnum.GLY.getValue()));//管理员新增日志
|
|
|
+ if (StringUtils.isNotEmpty(orgIdAuth)) {
|
|
|
+ //新增管理范围
|
|
|
+ AppMtAuth appMtAuth = new AppMtAuth(manageInfo.getId(), userId, orgIdAuth);
|
|
|
+ appMtAuthList.add(appMtAuth);
|
|
|
+ //新增管理范围日志
|
|
|
+ mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.XZJGGL.getValue(), userId, orgIdAuth, AdminObjectTypeEnum.JGGL.getValue()));
|
|
|
+ mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.XZSQGL.getValue(), userId, orgIdAuth, AdminObjectTypeEnum.SQGL.getValue()));
|
|
|
+ mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.XZRYGL.getValue(), userId, orgIdAuth, AdminObjectTypeEnum.RYGL.getValue()));
|
|
|
+ mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.XZGLYGL.getValue(), userId, orgIdAuth, AdminObjectTypeEnum.GLYGL.getValue()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //保存新增管理范围及日志
|
|
|
+ if (CollectionUtils.isNotEmpty(appMtAuthList)) {
|
|
|
+ appMtAuthService.saveAll(appMtAuthList);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(mgeLogList)) {
|
|
|
+ iMgeLogService.saveAll(mgeLogList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存管理员操作日志
|
|
|
+ *
|
|
|
+ * @param type 操作类型
|
|
|
+ * @param userId 用户id
|
|
|
+ * @param ids 操作对象id
|
|
|
+ */
|
|
|
+ private void saveMgeLog(String type,String objectType, String userId, String ids) {
|
|
|
+ String objIds = ids.replace("[", "").replace("]", "");
|
|
|
+ if (StringUtils.isEmpty(objIds)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ MgeLog mgeLog = new MgeLog();
|
|
|
+ mgeLog.setMgeId(userId);
|
|
|
+ mgeLog.setOperateType(type);
|
|
|
+ mgeLog.setObjectType(objectType);
|
|
|
+ mgeLog.setObjectId(objIds);
|
|
|
+ SecurityUser userInfo = UserContextUtils.getCurrentUser();
|
|
|
+ if (userInfo == null) {
|
|
|
+ mgeLog.setOperateUserId("000000");
|
|
|
+ mgeLog.setOperateUserName("监控程序");
|
|
|
+ } else {
|
|
|
+ mgeLog.setOperateUserId(userInfo.getId());
|
|
|
+ mgeLog.setOperateUserName(userInfo.getName());
|
|
|
+ mgeLog.setOperateOrgId(userInfo.getDeptId());
|
|
|
+ mgeLog.setOperateOrgName(userInfo.getSecurityOrgName());
|
|
|
+ }
|
|
|
+ mgeLog.setOperateTime(new Date());
|
|
|
+ iMgeLogService.save(mgeLog);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+//
|
|
|
+ @Override
|
|
|
+ public boolean haveAuthWithManage(String userId) {
|
|
|
+ SecurityUser curUser = UserContextUtils.getCurrentUser();
|
|
|
+ if (authUserInfoService.isRootUser(curUser.getId())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ String mgeMt = appMtAuthService.mgeAppRightRangeStr(curUser.getId());
|
|
|
+ AuthUserInfo userInfo = authUserInfoService.findById(userId);
|
|
|
+ String orgId = userInfo.getOrgId();
|
|
|
+ OrgTreeNode orgTreeNode = orgInfoFacade.getOrgTreeNode(orgId);
|
|
|
+
|
|
|
+ return OrgInfoUtil.isHaveAuth(userInfo.getOrgId(), orgTreeNode.getPath(), mgeMt);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<AuthUserDTO> rightRangeManagerList(SearchDTO searchDTO) {
|
|
|
+ checkPoliceTypeMap();
|
|
|
+ Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
+ Condition orgIdEq = searchable.getSearchFilter("orgId", SearchOperator.eq);
|
|
|
+ //机构id不为空,从带有管理范围的机构树选择某一个机构查询
|
|
|
+ //无需再过滤管理范围的机构
|
|
|
+ //机构id为空,从搜索框查询,带有人员的查询条件
|
|
|
+ //需要过滤当前登录人的管理范围
|
|
|
+ if(null == orgIdEq) {
|
|
|
+ BaseSecurityUser currentUser = UserContextUtils.getCurrentUser();
|
|
|
+ boolean rootUser = authUserInfoService.isRootUser(currentUser.getId());
|
|
|
+ if(!rootUser) {
|
|
|
+ List<AppMtAuth> mtAuths = appMtAuthService.getByUserId(currentUser.getId());
|
|
|
+ if(CollectionUtils.isEmpty(mtAuths)) {
|
|
|
+ return new PageImpl<>(new ArrayList(), searchable.getPage(), 0L);
|
|
|
+ }
|
|
|
+ Set<String> allMtOrgIds = orgInfoFacade.getAllMtOrgIds(mtAuths.get(0).getOrgId());
|
|
|
+ searchable.addSearchFilter("orgId", SearchOperator.in, allMtOrgIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Page<AuthUserInfo> userInfoPage = manageInfoRepository.getManageUserInfo(searchable);
|
|
|
+ List<AuthUserInfo> userInfos = userInfoPage.getContent();
|
|
|
+ List<AuthUserDTO> collect = userInfos.stream().map(e -> {
|
|
|
+ // TODO-Lvzr:过滤ADMIN数据,暂时写死,是否需要支持动态过滤
|
|
|
+ String name = e.getName();
|
|
|
+ if (org.springframework.util.StringUtils.hasText(name) && "ADMIN".equalsIgnoreCase(name)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ AuthUserDTO dto = new AuthUserDTO();
|
|
|
+ BeanUtils.copyProperties(e, dto);
|
|
|
+ final String code;
|
|
|
+ if (null == (code = e.getPoliceCategory())) {
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
+ dto.setPoliceCategory(POLICE_CATEGORY_MAP.get(code));
|
|
|
+ return dto;
|
|
|
+ }).filter(el-> el != null).collect(Collectors.toList());
|
|
|
+ return new PageImpl<>(collect, searchable.getPage(), userInfoPage.getTotalElements());
|
|
|
+ }
|
|
|
+
|
|
|
+ // @Override
|
|
|
+// public ResponseStatus impManger(List<Map<String, String>> list, Boolean authAccessable) throws NumberFormatException {
|
|
|
+// List<ManageInfo> manageInfoList = new ArrayList<ManageInfo>();
|
|
|
+// List<Map<String, String>> newManageInfoList = new ArrayList<Map<String, String>>();
|
|
|
+// int count = 1;
|
|
|
+// StringBuffer errorMsg = new StringBuffer();
|
|
|
+// Set<String> userIdCardSet = new HashSet<String>();
|
|
|
+// for (Map<String, String> map : list) {
|
|
|
+// StringBuffer errorColum = new StringBuffer();
|
|
|
+// ++count;
|
|
|
+// String idCard = map.get("idCard");
|
|
|
+// if (userIdCardSet.contains(idCard)) {
|
|
|
+// errorColum.append("\"身份证\"存在重复信息!");
|
|
|
+// }
|
|
|
+// userIdCardSet.add(idCard);
|
|
|
+// AuthUserInfo userInfo = authUserInfoService.findByIdcard(idCard);
|
|
|
+// if (userInfo == null || UserTypeEnum.EXTERNAL.getValue().equals(userInfo.getUserType())) {
|
|
|
+// errorColum.append("不是警员、辅警!");
|
|
|
+// }
|
|
|
+// if (errorColum.length() == 0) {
|
|
|
+// needAddManagerFilter(manageInfoList, newManageInfoList, errorColum, map, userInfo);
|
|
|
+// }
|
|
|
+// if (errorColum.length() > 0) {
|
|
|
+// errorMsg.append("第" + count + "行用户" + errorColum + "<br/>");
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (manageInfoList.size() > 0) {
|
|
|
+// Map<String, String> userMgeIdmMap = new HashMap<>();
|
|
|
+// manageInfoBPO.saveAll(manageInfoList);
|
|
|
+// for (ManageInfo manageInfo : manageInfoList) {
|
|
|
+// userMgeIdmMap.put(manageInfo.getUserId(), manageInfo.getId());
|
|
|
+// }
|
|
|
+// orgMtAuthService.impManger(newManageInfoList, userMgeIdmMap);
|
|
|
+// appMtAuthService.impManger(newManageInfoList, userMgeIdmMap);
|
|
|
+// userMtAuthService.impManger(newManageInfoList, userMgeIdmMap);
|
|
|
+// iMgeMtAuthService.impManger(newManageInfoList, userMgeIdmMap);
|
|
|
+// //重新计算管理员数量
|
|
|
+//
|
|
|
+// ArrayList<String> keys = new ArrayList<>();
|
|
|
+// Map<String, OrgTreeNode> allOrgTreeNode = orgInfoFacade.getAllOrgTreeNode();
|
|
|
+// for (String key : allOrgTreeNode.keySet()) {
|
|
|
+// keys.add(key + "_manage");
|
|
|
+// }
|
|
|
+// redisTemplate.delete(keys); //清除redis缓存
|
|
|
+// RedisConnectionUtils.unbindConnection(this.redisTemplate.getConnectionFactory());//释放redis连接
|
|
|
+// }
|
|
|
+// return ResponseStatus.success(errorMsg.length() > 0 ? errorMsg.toString() + "以上用户管理员未导入!" : "");
|
|
|
+// }
|
|
|
+
|
|
|
+// private void needAddManagerFilter(List<ManageInfo> manageInfoList, List<Map<String, String>> newManageInfoList, StringBuffer errorMsg, Map<String, String> map, AuthUserInfo userInfo) {
|
|
|
+// ManageInfo manageInfo = this.setManageInfo(userInfo);
|
|
|
+// Map<String, Object> managerParams = new HashMap<String, Object>();
|
|
|
+// managerParams.put("userId", manageInfo.getUserId());
|
|
|
+// managerParams.put("deleted", BooleanEnum.FALSE.getValue());
|
|
|
+// List<ManageInfo> manageInfoListOld = manageInfoBPO.andsearch(ManageInfo.class, managerParams);//找出该用户旧管理员数据
|
|
|
+// if (CollectionUtils.isNotEmpty(manageInfoListOld)) {
|
|
|
+// errorMsg.append("已是管理员,跳过该用户导入!");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// String orgCode = map.get("code");
|
|
|
+// if (StringUtils.isEmpty(orgCode)) {//机构代码未填,默认所在机构
|
|
|
+// map.put("authOrgId", userInfo.getOrgId());
|
|
|
+// } else {
|
|
|
+// OrgInfo orgInfo = orgInfoFacade.getOrgInfoByCode(orgCode);
|
|
|
+// if (orgInfo != null) {//机构不存在
|
|
|
+// map.put("authOrgId", orgInfo.getId());
|
|
|
+// } else {
|
|
|
+// errorMsg.append("机构代码填写有误!");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (errorMsg.length() > 0) {
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// manageInfoList.add(manageInfo);
|
|
|
+// newManageInfoList.add(map);
|
|
|
+// saveMgeLog(AdminOperateTypeEnum.XZGLY.getValue(),AdminObjectTypeEnum.GLY.getValue(), manageInfo.getUserId(), manageInfo.getUserId());
|
|
|
+// }
|
|
|
+
|
|
|
+// private ResponseStatus impMangerForGD(List<Map<String, String>> list, Boolean authAccessable) throws NumberFormatException {
|
|
|
+// StringBuffer errorMsg = new StringBuffer();
|
|
|
+// Map<String, String> orgIdAuthMap = new HashMap<String, String>();//存放用户管理范围
|
|
|
+// Map<String, ManageInfo> oldMgeMap = new HashMap<String, ManageInfo>();//存放已存在的管理员
|
|
|
+// Map<String, ManageInfo> newMgeMap = new HashMap<String, ManageInfo>();//存放新增的管理员
|
|
|
+// int count = 1;
|
|
|
+// for (Map<String, String> map : list) {
|
|
|
+// ++count;
|
|
|
+// StringBuffer errorColum = new StringBuffer();
|
|
|
+// String idCard = map.get("idCard");
|
|
|
+// AuthUserInfo userInfo = authUserInfoService.findByIdcard(idCard);
|
|
|
+// if (userInfo == null || UserTypeEnum.EXTERNAL.getValue().equals(userInfo.getUserType())) {
|
|
|
+// errorColum.append("不是警员、辅警!");
|
|
|
+// errorMsg.append("第" + count + "行用户" + errorColum + "<br/>");
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// String userId = userInfo.getId();
|
|
|
+// String orgCode = map.get("code");
|
|
|
+// String orgIdAuth = "";
|
|
|
+// if (StringUtils.isEmpty(orgCode)) {//机构代码未填,范围默认所在机构
|
|
|
+// orgIdAuth = userInfo.getOrgId() + ":" + map.get("auth");
|
|
|
+// } else {
|
|
|
+// OrgInfo orgInfo = orgInfoFacade.getOrgInfoByCode(orgCode);
|
|
|
+// if (orgInfo == null) {
|
|
|
+// errorColum.append("机构代码填写有误!");
|
|
|
+// errorMsg.append("第").append(count).append("行用户").append(errorColum).append("<br/>");
|
|
|
+// continue;
|
|
|
+// } else {
|
|
|
+// orgIdAuth = orgInfo.getId() + ":" + map.get("auth");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (orgIdAuthMap.containsKey(userId)){
|
|
|
+// //存放用户管理范围
|
|
|
+// orgIdAuth = orgIdAuthMap.get(userId) + "," + orgIdAuth;
|
|
|
+// }
|
|
|
+// orgIdAuthMap.put(userId, orgIdAuth);
|
|
|
+// if (!oldMgeMap.containsKey(userId) && !newMgeMap.containsKey(userId)) {//管理员未重复
|
|
|
+// ManageInfo manageInfo = manageInfoBPO.manageInfoByUserId(userId);
|
|
|
+// if (manageInfo == null) {
|
|
|
+// newMgeMap.put(userId, this.setManageInfo(userInfo));//新增管理员
|
|
|
+// } else {
|
|
|
+// oldMgeMap.put(userId, manageInfo);//已存在管理员
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (oldMgeMap.size() != 0) {
|
|
|
+// manageInfoBPO.saveAll(oldMgeMap.values());//更新旧管理员信息
|
|
|
+// }
|
|
|
+// manageInfoBPO.saveAll(newMgeMap.values());//保存新增管理员
|
|
|
+// this.updateMgeAuth(oldMgeMap.values(), orgIdAuthMap);//更新旧管理员的管理范围
|
|
|
+// this.setMgeAuth(newMgeMap.values(), orgIdAuthMap, authAccessable);//新增管理员范围
|
|
|
+// ArrayList<String> keys = new ArrayList<String>();
|
|
|
+// Map<String, OrgTreeNode> allTreeNode = orgInfoFacade.getAllOrgTreeNode();
|
|
|
+// for (String key : allTreeNode.keySet()) {
|
|
|
+// keys.add(key + "_manage");
|
|
|
+// }
|
|
|
+// redisTemplate.delete(keys); //清除redis缓存
|
|
|
+// RedisConnectionUtils.unbindConnection(this.redisTemplate.getConnectionFactory());//释放redis连接
|
|
|
+// return ResponseStatus.success(errorMsg.length() > 0 ? errorMsg.toString() + "以上用户管理员未导入!" : "");
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 广东地区管理员导入——已是管理员,更新管理范围
|
|
|
+// *
|
|
|
+// * @param list 管理员
|
|
|
+// * @param orgIdAuthMap 新的管理范围userId:orgIdAuth
|
|
|
+// */
|
|
|
+// private void updateMgeAuth(Collection<ManageInfo> list, Map<String, String> orgIdAuthMap) {
|
|
|
+// List<OrgMtAuth> orgMtAuthList = new ArrayList<OrgMtAuth>();
|
|
|
+// List<AppMtAuth> appMtAuthList = new ArrayList<AppMtAuth>();
|
|
|
+// List<UserMtAuth> userMtAuthList = new ArrayList<UserMtAuth>();
|
|
|
+// List<MgeMtAuth> mgeMtAuthList = new ArrayList<MgeMtAuth>();
|
|
|
+// List<MgeLog> mgeLogList = new ArrayList<MgeLog>();
|
|
|
+// for (ManageInfo manageInfo : list) {
|
|
|
+// OrgMtAuth orgMtAuth = orgMtAuthBPO.getByUserId(manageInfo.getId(), manageInfo.getUserId());
|
|
|
+// AppMtAuth appMtAuth = appMtAuthService1.getByUserId(manageInfo.getId(), manageInfo.getUserId());
|
|
|
+// UserMtAuth userMtAuth = userMtAuthBPO.getByUserId(manageInfo.getId(), manageInfo.getUserId());
|
|
|
+// MgeMtAuth mgeMtAuth = mgeMtAuthBPO.getByUserId(manageInfo.getId(), manageInfo.getUserId());
|
|
|
+// String orgIdAuth = orgIdAuthMap.get(manageInfo.getUserId());
|
|
|
+// if (orgMtAuth != null) {//存在旧管理范围
|
|
|
+// orgMtAuth.setOrgId(orgIdAuth);
|
|
|
+// mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.BGJGGL.getValue(), orgMtAuth.getUserId(), orgMtAuth.getOrgId(), AdminObjectTypeEnum.JGGL.getValue()));
|
|
|
+// } else {//未授权管理范围
|
|
|
+// orgMtAuth = new OrgMtAuth(manageInfo.getId(), manageInfo.getUserId(), orgIdAuth);
|
|
|
+// mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.XZJGGL.getValue(), orgMtAuth.getUserId(), orgMtAuth.getOrgId(), AdminObjectTypeEnum.JGGL.getValue()));
|
|
|
+// }
|
|
|
+// if (appMtAuth != null) {//存在旧管理范围
|
|
|
+// appMtAuth.setOrgId(orgIdAuth);
|
|
|
+// mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.BGSQGL.getValue(), appMtAuth.getUserId(), appMtAuth.getOrgId(), AdminObjectTypeEnum.SQGL.getValue()));
|
|
|
+// } else {//未授权管理范围
|
|
|
+// appMtAuth = new AppMtAuth(manageInfo.getId(), manageInfo.getUserId(), orgIdAuth);
|
|
|
+// mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.XZSQGL.getValue(), appMtAuth.getUserId(), appMtAuth.getOrgId(), AdminObjectTypeEnum.SQGL.getValue()));
|
|
|
+// }
|
|
|
+// if (userMtAuth != null) {//存在旧管理范围
|
|
|
+// userMtAuth.setOrgId(orgIdAuth);
|
|
|
+// mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.BGRYGL.getValue(), userMtAuth.getUserId(), userMtAuth.getOrgId(), AdminObjectTypeEnum.RYGL.getValue()));
|
|
|
+// } else {//未授权管理范围
|
|
|
+// userMtAuth = new UserMtAuth(manageInfo.getId(), manageInfo.getUserId(), orgIdAuth);
|
|
|
+// mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.XZRYGL.getValue(), userMtAuth.getUserId(), userMtAuth.getOrgId(), AdminObjectTypeEnum.RYGL.getValue()));
|
|
|
+// }
|
|
|
+// if (mgeMtAuth != null) {//存在旧管理范围
|
|
|
+// mgeMtAuth.setOrgId(orgIdAuth);
|
|
|
+// mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.BGGLYGL.getValue(), mgeMtAuth.getUserId(), mgeMtAuth.getOrgId(), AdminObjectTypeEnum.GLYGL.getValue()));
|
|
|
+// } else {//未授权管理范围
|
|
|
+// mgeMtAuth = new MgeMtAuth(manageInfo.getId(), manageInfo.getUserId(), orgIdAuth);
|
|
|
+// mgeLogList.add(iMgeLogService.getMgeLog(AdminOperateTypeEnum.XZGLYGL.getValue(), mgeMtAuth.getUserId(), mgeMtAuth.getOrgId(), AdminObjectTypeEnum.GLYGL.getValue()));
|
|
|
+// }
|
|
|
+// orgMtAuthList.add(orgMtAuth);
|
|
|
+// appMtAuthList.add(appMtAuth);
|
|
|
+// userMtAuthList.add(userMtAuth);
|
|
|
+// mgeMtAuthList.add(mgeMtAuth);
|
|
|
+// }
|
|
|
+// if (orgMtAuthList.size() != 0){
|
|
|
+// orgMtAuthBPO.saveAll(orgMtAuthList);//保存新的管理范围及日志
|
|
|
+// }
|
|
|
+// if (appMtAuthList.size() != 0){
|
|
|
+// appMtAuthService1.saveAll(appMtAuthList);
|
|
|
+// }
|
|
|
+// if (userMtAuthList.size() != 0){
|
|
|
+// userMtAuthBPO.saveAll(userMtAuthList);
|
|
|
+// }
|
|
|
+// if (mgeMtAuthList.size() != 0){
|
|
|
+// mgeMtAuthBPO.saveAll(mgeMtAuthList);
|
|
|
+// }
|
|
|
+// if (mgeLogList.size() != 0){
|
|
|
+// iMgeLogService.saveAll(mgeLogList);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ //
|
|
|
+// private ManageInfo setManageInfo(AuthUserInfo userInfo) {
|
|
|
+// ManageInfo manageInfo = new ManageInfo();
|
|
|
+// manageInfo.setOrgId(userInfo.getOrgId());
|
|
|
+// manageInfo.setUserId(userInfo.getId());
|
|
|
+// manageInfo.setUserName(userInfo.getName());
|
|
|
+// manageInfo.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
+// manageInfo.setCreateTime(new Date());
|
|
|
+// manageInfo.setCreateUser(ContextUtils.getUserInfo().getId());
|
|
|
+// return manageInfo;
|
|
|
+// }
|
|
|
+
|
|
|
+// @Override
|
|
|
+// public List<AuthUserDTO> exportAdminList(Set<String> orgInfoSets, List<AuthUserDTO> adminLists) {
|
|
|
+// Set<String> removeOrgs = new HashSet<String>();
|
|
|
+// StringBuffer stringBuffer = new StringBuffer();
|
|
|
+// int i = 0;
|
|
|
+// for (String id : orgInfoSets) {
|
|
|
+// i++;
|
|
|
+// if (i % 1000 == 0) {
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// removeOrgs.add(id);
|
|
|
+// stringBuffer.append("'").append(id).append("',");
|
|
|
+// }
|
|
|
+// orgInfoSets.removeAll(removeOrgs);
|
|
|
+// adminLists.addAll(manageInfoBPO.exprotAdminList(stringBuffer.substring(0, stringBuffer.length() - 1)));
|
|
|
+// if (orgInfoSets.size() > 0) {
|
|
|
+// exportAdminList(orgInfoSets, adminLists);
|
|
|
+// }
|
|
|
+// return adminLists;
|
|
|
+// }
|
|
|
+
|
|
|
+// @Override
|
|
|
+// public List<Map<String, String>> mgeSpreadDtlList(String orgId) {
|
|
|
+// logger.info("开始统计===========================");
|
|
|
+// long time = System.currentTimeMillis();
|
|
|
+// List<Map<String, String>> list = new ArrayList<>();
|
|
|
+// List<OrgInfo> orgInfoList = new ArrayList<>();
|
|
|
+// boolean checkNull = false;
|
|
|
+// if (StringUtils.isBlank(orgId)) {
|
|
|
+// orgId = orgInfoFacade.getRootOrgId();
|
|
|
+//
|
|
|
+// OrgInfo orgInfo = orgInfoFacade.detail(orgId);
|
|
|
+// orgInfoList.add(orgInfo);
|
|
|
+// checkNull = true;
|
|
|
+// } else {
|
|
|
+//
|
|
|
+// orgInfoList = orgInfoFacade.getOrgListByUpId(orgId);
|
|
|
+// }
|
|
|
+// if (!orgInfoList.isEmpty()) {
|
|
|
+// logger.info("开始循环统计===========================");
|
|
|
+// StringBuilder ids = new StringBuilder();
|
|
|
+// for (OrgInfo orgInfo : orgInfoList) {
|
|
|
+// ids.append(",'").append(orgInfo.getId()).append("'");
|
|
|
+// }
|
|
|
+// String idsStr = ids.toString().replaceFirst(",", "");
|
|
|
+// //管理员数,优先从缓存获取
|
|
|
+// String amListRedisKey = orgId + "_am_manage";
|
|
|
+// List<Map<String, Object>> amList = null;
|
|
|
+// String amListStr = redisTemplate.opsForValue().get(amListRedisKey) != null ? redisTemplate.opsForValue().get(amListRedisKey).toString() : null;
|
|
|
+// if (checkNull) {
|
|
|
+// amList = manageInfoBPO.mgeCountDtlList("T_ADMIN_MGE_MT_AUTH", idsStr);
|
|
|
+// } else if (amListStr == null) {
|
|
|
+// amList = manageInfoBPO.mgeCountDtlList("T_ADMIN_MGE_MT_AUTH", idsStr);
|
|
|
+// amListStr = JSON.toJSONString(amList);
|
|
|
+// redisTemplate.opsForValue().set(amListRedisKey, amListStr);
|
|
|
+// //设置超时时间1小时
|
|
|
+// redisTemplate.expire(amListRedisKey, 1, TimeUnit.HOURS);
|
|
|
+// } else {
|
|
|
+// amList = (List<Map<String, Object>>) JSONArray.parse(amListStr);
|
|
|
+// }
|
|
|
+// long time3 = System.currentTimeMillis();
|
|
|
+// logger.info("---管理员管理人数:----------" + (time3 - time));
|
|
|
+//
|
|
|
+// //机构管理员数,优先从缓存获取
|
|
|
+// String omListRedisKey = orgId + "_om_manage";
|
|
|
+// List<Map<String, Object>> omList = null;
|
|
|
+// long time4 = System.currentTimeMillis();
|
|
|
+// logger.info("---机构管理员人数:----------" + (time4 - time3));
|
|
|
+//
|
|
|
+// //用户管理员数,优先从缓存获取
|
|
|
+// String umListRedisKey = orgId + "_um_manage";
|
|
|
+// List<Map<String, Object>> umList = null;
|
|
|
+// long time5 = System.currentTimeMillis();
|
|
|
+// logger.info("---人员管理员人数:----------" + (time5 - time4));
|
|
|
+// for (OrgInfo orgInfo : orgInfoList) {
|
|
|
+// String id = orgInfo.getId();
|
|
|
+// String upGovId = orgInfo.getUpGovId();
|
|
|
+// Integer sortNo = orgInfo.getSortNo();
|
|
|
+// String fullName = orgInfo.getFullName();
|
|
|
+// String code = orgInfo.getCode();
|
|
|
+//
|
|
|
+// Map map = new HashMap();
|
|
|
+// String mgeNums = "0";
|
|
|
+// String orgNums = "0";
|
|
|
+// String userNums = "0";
|
|
|
+//
|
|
|
+// map.put("id", id);
|
|
|
+// map.put("pid", upGovId);
|
|
|
+// map.put("sortNo", sortNo);
|
|
|
+// map.put("name", fullName);
|
|
|
+// map.put("code", code);
|
|
|
+// for (Map<String, Object> am : amList) {
|
|
|
+// if (id.equals(am.get("ORGID"))) {
|
|
|
+// mgeNums = am.get("TOTAL").toString();
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// map.put("mgeNums", mgeNums + "");
|
|
|
+// map.put("orgNums", orgNums + "");
|
|
|
+// map.put("userNums", userNums + "");
|
|
|
+// map.put("isParent", true);
|
|
|
+// list.add(map);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// long time6 = System.currentTimeMillis();
|
|
|
+// logger.info("---总耗时:----------" + (time6 - time) + "ms");
|
|
|
+// //排序
|
|
|
+// Collections.sort(list, new Comparator<Map<String, String>>() {
|
|
|
+// @Override
|
|
|
+// public int compare(Map<String, String> o1, Map<String, String> o2) {
|
|
|
+// String sortOne = o1.get("sortNo") == null ? "0" : String.valueOf(o1.get("sortNo"));
|
|
|
+// String sortTwo = o2.get("sortNo") == null ? "0" : String.valueOf(o2.get("sortNo"));
|
|
|
+// return Integer.parseInt(sortOne) - Integer.parseInt(sortTwo);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// return list;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public List<Map<String, String>> mgeSpreadDtlListForGD(String orgId) {
|
|
|
+// logger.info("开始统计===========================");
|
|
|
+// long time = System.currentTimeMillis();
|
|
|
+// List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
|
|
+// List<OrgInfo> orgInfoList = new ArrayList<>();
|
|
|
+// MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
|
|
|
+// boolean checkNull = false;
|
|
|
+// if (StringUtils.isBlank(orgId)) {
|
|
|
+// orgId = orgInfoFacade.getRootOrgId();
|
|
|
+//
|
|
|
+// OrgInfo orgInfo = orgInfoFacade.detail(orgId);
|
|
|
+// orgInfoList.add(orgInfo);
|
|
|
+// checkNull = true;
|
|
|
+// } else {
|
|
|
+// orgInfoList = orgInfoFacade.getOrgListByUpId(orgId);
|
|
|
+//
|
|
|
+// }
|
|
|
+// if (!orgInfoList.isEmpty()) {
|
|
|
+// logger.info("开始循环统计===========================");
|
|
|
+// StringBuilder ids = new StringBuilder();
|
|
|
+// for (OrgInfo orgInfo : orgInfoList) {
|
|
|
+// ids.append("or t4.ORG_ID like '%").append(orgInfo.getId()).append("%' ");
|
|
|
+// }
|
|
|
+// String rootUser = authConfig.getRootUserId();
|
|
|
+// String idsStr = ids.toString().replaceFirst("or", "");
|
|
|
+//
|
|
|
+// //管理员数,优先从缓存获取
|
|
|
+// String amListRedisKey = orgId + "_am_manage";
|
|
|
+// List<Map<String, Object>> amList = null;
|
|
|
+// String amListStr = redisTemplate.opsForValue().get(amListRedisKey) != null ? redisTemplate.opsForValue().get(amListRedisKey).toString() : null;
|
|
|
+// if (checkNull) {
|
|
|
+// amList = manageInfoBPO.mgeCountDtlListForGD(rootUser, idsStr);
|
|
|
+// } else if (amListStr == null) {
|
|
|
+// amList = manageInfoBPO.mgeCountDtlListForGD(rootUser, idsStr);
|
|
|
+// } else {
|
|
|
+// amList = (List<Map<String, Object>>) JSONArray.parse(amListStr);
|
|
|
+// }
|
|
|
+// long time3 = System.currentTimeMillis();
|
|
|
+// logger.info("---管理员管理人数:----------" + (time3 - time) + "ms");
|
|
|
+// for (OrgInfo orgInfo : orgInfoList) {
|
|
|
+// String id = orgInfo.getId();
|
|
|
+// String upGovId = orgInfo.getUpGovId();
|
|
|
+// Integer sortNo = orgInfo.getSortNo();
|
|
|
+// String fullName = orgInfo.getFullName();
|
|
|
+// String code = orgInfo.getCode();
|
|
|
+// Map map = new HashMap();
|
|
|
+// int mgeNums = 0;
|
|
|
+//
|
|
|
+// map.put("id", id);
|
|
|
+// map.put("pid", upGovId);
|
|
|
+// map.put("sortNo", sortNo.toString());
|
|
|
+// map.put("name", fullName);
|
|
|
+// map.put("code", code);
|
|
|
+// for (Map<String, Object> am : amList) {
|
|
|
+// if ((am.get("orgId").toString()).contains(id)) {
|
|
|
+// mgeNums++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// map.put("mgeNums", mgeNums + "");
|
|
|
+// map.put("isParent", "true");
|
|
|
+// list.add(map);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return list;
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * 根据权限范围找到机构
|
|
|
+// *
|
|
|
+// * @param mtOrgIds 权限范围ID
|
|
|
+// * @param orgInfoList List<OrgInfo>
|
|
|
+// */
|
|
|
+// public List getUpgovIdMap(String mtOrgIds, List orgInfoList) {
|
|
|
+// String ids = "";
|
|
|
+// if (StringUtils.isNotEmpty(mtOrgIds)) {
|
|
|
+// String[] mtIds = mtOrgIds.split(",");
|
|
|
+// for (String mtId : mtIds) {
|
|
|
+// ids += StringUtils.isEmpty(ids) ? mtId.split(":")[0] : "," + mtId.split(":")[0];
|
|
|
+// }
|
|
|
+//
|
|
|
+// orgInfoList = orgInfoFacade.getOrgsByIds(ids);
|
|
|
+// }
|
|
|
+// return orgInfoList;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public Page<AuthUserDTO> rightRangeManagerListWithQuery(String type, SearchDTO searchDTO) {
|
|
|
+// Searchable searchable = Searchable.toSearchable(searchDTO);
|
|
|
+// searchable.addSort(Sort.Direction.ASC, "userType");
|
|
|
+// searchable.addSort(Sort.Direction.DESC, "orgCode");
|
|
|
+// return manageInfoBPO.rightRangeManagerList(type, "", searchable);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public Map<String, Long> getMgeNumByOrgIds(Set<String> orgIds, String type) {
|
|
|
+// String tableName = getTableName(type);
|
|
|
+// Map<String, Long> countMap = new HashMap<>();
|
|
|
+// for (String orgId : orgIds) {
|
|
|
+// if (StringUtils.isBlank(orgId)){
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// int count = manageInfoBPO.getMgeNumByOrgIds(orgId, authConfig.getRootUserId(), tableName);
|
|
|
+// countMap.put(orgId, Long.valueOf(count));
|
|
|
+// }
|
|
|
+// return countMap;
|
|
|
+// }
|
|
|
+//
|
|
|
+// public String getTableName(String type) {
|
|
|
+// String tableName = "";
|
|
|
+// switch (type) {
|
|
|
+// case SysConstants.MT_ORG:
|
|
|
+// tableName = "t_admin_org_mt_auth";
|
|
|
+// break;
|
|
|
+// case SysConstants.MT_USER:
|
|
|
+// tableName = "t_admin_user_mt_auth";
|
|
|
+// break;
|
|
|
+// default:
|
|
|
+// tableName = "";
|
|
|
+// }
|
|
|
+// return tableName;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public Page<AuthUserDTO> getManageInfoByOrgId(Searchable searchable) {
|
|
|
+// Page<AuthUserDTO> userInfos = manageInfoBPO.adminList(searchable);
|
|
|
+// return userInfos;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public ResponseStatus saveAdminBJ(String rootOrgId, String orgId, String ids) {
|
|
|
+// String[] idArray = ids.split(",");
|
|
|
+// List<ManageInfo> manageInfos = new ArrayList<ManageInfo>();
|
|
|
+// for (String id : idArray) {
|
|
|
+// AuthUserInfo userInfo = authUserInfoService.findById(id);
|
|
|
+// if (userInfo == null) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// ManageInfo manageInfo = new ManageInfo();
|
|
|
+// manageInfo.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
+// manageInfo.setOrgId(userInfo.getOrgId());
|
|
|
+// manageInfo.setUserId(userInfo.getId());
|
|
|
+// manageInfo.setUserName(userInfo.getName());
|
|
|
+// manageInfo.setCreateUser(ContextUtils.getUserInfo().getId());
|
|
|
+// manageInfo.setCreateTime(new Date());
|
|
|
+// saveOrUpdate(manageInfo);
|
|
|
+// saveMgeLog(AdminOperateTypeEnum.XZGLY.getValue(), AdminObjectTypeEnum.GLY.getValue(), id, id);
|
|
|
+// manageInfos.add(manageInfo);
|
|
|
+// }
|
|
|
+//
|
|
|
+// //删除redis缓存管理员统计数据
|
|
|
+// redisTemplate.delete(orgId + "_manage");
|
|
|
+// //释放redis连接
|
|
|
+// RedisConnectionUtils.unbindConnection(this.redisTemplate.getConnectionFactory());
|
|
|
+// //异步添加管理员默认角色
|
|
|
+//// ManageInfoMsg manageInfoMsg = new ManageInfoMsg();
|
|
|
+//// manageInfoMsg.setSecurityUser((SecurityUser) ContextUtils.getUserInfo());
|
|
|
+//// manageInfoMsg.setManageInfoList(manageInfos);
|
|
|
+//// manageInfoMsg.setOperateType(AdminOperateTypeEnum.XZGLY.getValue());
|
|
|
+//// manageInfoBusCenter.post(manageInfoMsg);
|
|
|
+// return ResponseStatus.success();
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public Boolean checkIsManagerByUserId(String userId) {
|
|
|
+// if (authUserInfoService.isRootUser(userId)) {
|
|
|
+// return true;
|
|
|
+// }
|
|
|
+// ManageInfo manageInfo = manageInfoBPO.manageInfoByUserId(userId);
|
|
|
+// return manageInfo != null;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public List<MgeMonitorVO> getAbnormalInfo(int limitDay) {
|
|
|
+// return manageInfoBPO.getAbnormalInfo(limitDay);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public List<NoticeUserVO> getManagerByOrgId(String orgId) {
|
|
|
+// return manageInfoBPO.getManagerByOrgId(orgId);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public List<NoticeUserVO> getOrgMgeManager(String orgId) {
|
|
|
+// return manageInfoBPO.getOrgMgeManager(orgId);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public Page<AuthUserDTO> getManageInfoList(Searchable searchable) {
|
|
|
+// Pageable page = searchable.getPage();
|
|
|
+// Pageable pageAble = searchable.getPage();
|
|
|
+// List<Map<String, String>> list = manageInfoBPO.adminMapList(searchable);
|
|
|
+// List<String> rightList = filterUsers(list, "MgeMtAuth");
|
|
|
+// int total = rightList.size();
|
|
|
+// int end = (int) (page.getOffset() + page.getPageSize());
|
|
|
+// List<String> inList = rightList.subList((int) page.getOffset(), end > total ? total : end);
|
|
|
+// List<AuthUserDTO> resultList = authUserInfoService.findByIds(inList);
|
|
|
+// return new PageImpl<AuthUserDTO>(resultList, pageAble, total);
|
|
|
+// }
|
|
|
+
|
|
|
+}
|