|
@@ -8,7 +8,6 @@ import com.dragoninfo.dcuc.app.entity.ApplyInfo;
|
|
|
import com.dragoninfo.dcuc.app.facade.IApplyInfoFacade;
|
|
|
import com.dragoninfo.dcuc.auth.audit.enums.AuthResultEnum;
|
|
|
import com.dragoninfo.dcuc.auth.audit.service.log.LogInfoFillService;
|
|
|
-import com.dragoninfo.dcuc.auth.auth.async.StaffAssignAuthEventCenterBus;
|
|
|
import com.dragoninfo.dcuc.auth.auth.bpo.StaffAssignAuthInfoBPO;
|
|
|
import com.dragoninfo.dcuc.auth.auth.bpo.po.StaffRoleAuthApiPO;
|
|
|
import com.dragoninfo.dcuc.auth.auth.dto.AppDataSensitiveLevelDTO;
|
|
@@ -17,6 +16,7 @@ import com.dragoninfo.dcuc.auth.auth.dto.StaffRoleOperateDTO;
|
|
|
import com.dragoninfo.dcuc.auth.auth.dto.UserRoleAuthInfoDTO;
|
|
|
import com.dragoninfo.dcuc.auth.auth.entity.*;
|
|
|
import com.dragoninfo.dcuc.auth.auth.entity.zerotrust.AuthRoleOrgRel;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.entity.zerotrust.RoleAuthApply;
|
|
|
import com.dragoninfo.dcuc.auth.auth.service.*;
|
|
|
import com.dragoninfo.dcuc.auth.auth.service.zerotrust.IAuthRoleOrgRelService;
|
|
|
import com.dragoninfo.dcuc.auth.auth.vo.*;
|
|
@@ -39,6 +39,7 @@ import com.dragonsoft.duceap.core.search.Searchable;
|
|
|
import com.dragonsoft.duceap.core.search.enums.SearchOperator;
|
|
|
import com.dragonsoft.duceap.core.search.filter.Condition;
|
|
|
import com.dragonsoft.duceap.web.utils.RequestUtils;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.hibernate.criterion.DetachedCriteria;
|
|
|
import org.hibernate.criterion.Projections;
|
|
|
import org.hibernate.criterion.Restrictions;
|
|
@@ -56,6 +57,7 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
@Transactional
|
|
|
public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
|
|
@@ -69,10 +71,6 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
|
|
|
@Autowired
|
|
|
private IRoleInfoService roleInfoService;
|
|
|
@Autowired
|
|
|
- private IStaffAssignAuthLogService staffAssignAuthLogService;
|
|
|
- @Autowired
|
|
|
- private StaffAssignAuthEventCenterBus staffAssignAuthEventCenterBus;
|
|
|
- @Autowired
|
|
|
private IApplyInfoFacade applyInfoFacade;
|
|
|
@Autowired
|
|
|
private IAuthUserInfoService authUserInfoService;
|
|
@@ -207,31 +205,12 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
|
|
|
updateNum = dfpNum - needNum;
|
|
|
bjNum = quotoInfo.getBjNum() + needNum;
|
|
|
}
|
|
|
- SecurityUser securityUser = UserContextUtils.getCurrentUser();
|
|
|
//保存授权、日志
|
|
|
- addList.forEach(e -> {
|
|
|
- staffAssignAuthInfoBPO.save(e);
|
|
|
- String activeTime = e.getActiveTime();
|
|
|
- String prefix = "有效期至:";
|
|
|
- if ("长期".equals(activeTime)) {
|
|
|
- prefix = "有效期为:";
|
|
|
- }
|
|
|
- saveLog(e, applyInfo.getOrgCode(), "10", securityUser, prefix + activeTime);
|
|
|
- });
|
|
|
- Map<String, StaffAssignAuthInfo> finalExistMap1 = existMap;
|
|
|
+ addList.forEach(e -> staffAssignAuthInfoBPO.save(e));
|
|
|
//更新有效期、保存日志
|
|
|
- updateList.forEach(e -> {
|
|
|
- staffAssignAuthInfoBPO.update(e);
|
|
|
- String staffId = e.getStaffId();
|
|
|
- String oldActiveTime = finalExistMap1.get(staffId).getActiveTime();
|
|
|
- String content = "有效期时间由" + oldActiveTime + "变更为" + e.getActiveTime();
|
|
|
- saveLog(e, applyInfo.getOrgCode(), "20", securityUser, content);
|
|
|
- });
|
|
|
+ updateList.forEach(e -> staffAssignAuthInfoBPO.update(e));
|
|
|
//删除权限、保存日志
|
|
|
- delList.forEach(e -> {
|
|
|
- staffAssignAuthInfoBPO.delete(e.getId());
|
|
|
- saveLog(e, applyInfo.getOrgCode(), "30", securityUser, "");
|
|
|
- });
|
|
|
+ delList.forEach(e -> staffAssignAuthInfoBPO.delete(e.getId()));
|
|
|
//更新配额
|
|
|
if (updateNum != null) {
|
|
|
quotoInfo.setDfpNum(updateNum);
|
|
@@ -243,20 +222,6 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
|
|
|
return ResponseStatus.success("保存成功!");
|
|
|
}
|
|
|
|
|
|
- private void saveLog(StaffAssignAuthInfo assignAuthInfo, String appOrgCode, String status, SecurityUser securityUser, String content) {
|
|
|
- StaffAssignAuthLog staffAssignAuthLog = new StaffAssignAuthLog();
|
|
|
- staffAssignAuthLog.setAppId(assignAuthInfo.getAppId());
|
|
|
- staffAssignAuthLog.setRoleId(assignAuthInfo.getRoleId());
|
|
|
- staffAssignAuthLog.setStaffId(assignAuthInfo.getStaffId());
|
|
|
- staffAssignAuthLog.setCreateTime(new Date());
|
|
|
- staffAssignAuthLog.setStaffOrgId(assignAuthInfo.getStaffOrgId());
|
|
|
- staffAssignAuthLog.setManagerId(securityUser.getId());
|
|
|
- staffAssignAuthLog.setStatus(status);
|
|
|
- staffAssignAuthLog.setAppOrgId(appOrgCode); // 之后取appOrgId
|
|
|
- staffAssignAuthLog.setChangeContent(content);
|
|
|
- staffAssignAuthLogService.save(staffAssignAuthLog);
|
|
|
- }
|
|
|
-
|
|
|
private List<StaffAssignAuthInfo> getRoleAuthByOrgId(String orgId, String roleId) {
|
|
|
Searchable searchable = Searchable.newSearchable();
|
|
|
searchable.addSearchFilter("role_id", SearchOperator.eq, roleId);
|
|
@@ -278,20 +243,6 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
|
|
|
return authInfo;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 人员角色变更消息发送
|
|
|
- *
|
|
|
- * @param staffObjList
|
|
|
- * @param appId
|
|
|
- */
|
|
|
- private void sendMessage(JSONArray staffObjList, String appId) {
|
|
|
- Map<String, Object> paramsObject = new HashMap<String, Object>();
|
|
|
- paramsObject.put("staffObjList", staffObjList);
|
|
|
- paramsObject.put("appId", appId);
|
|
|
- paramsObject.put("securityUser", ContextUtils.getUserInfo());
|
|
|
- staffAssignAuthEventCenterBus.post(paramsObject);
|
|
|
- }
|
|
|
-
|
|
|
private boolean isEnoughQuota(String appId, String roleId, String orgId, int needNum, boolean isAdd) {
|
|
|
RoleInfo roleInfo = roleInfoService.get(roleId);
|
|
|
if (BooleanEnum.FALSE.getValue().equals(roleInfo.getIsNotLimitCount())) {
|
|
@@ -321,10 +272,6 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
|
|
|
}
|
|
|
staffAssignAuthInfo.setActiveTime(activeTime);
|
|
|
this.update(staffAssignAuthInfo);
|
|
|
- //记录修改日志
|
|
|
-
|
|
|
- //保存T_STAFF_ASSIGN_AUTH_INFO表
|
|
|
- saveLog(roleId, orgId, appId, user, staffId, "20", "有效时间由" + oldActiveTime + "变更为" + activeTime);
|
|
|
}
|
|
|
return "update";
|
|
|
} else {
|
|
@@ -340,127 +287,30 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
|
|
|
}
|
|
|
staffAssignAuthInfo.setActiveTime(activeTime);
|
|
|
this.save(staffAssignAuthInfo);
|
|
|
- //记录授权日志
|
|
|
-
|
|
|
- //保存T_STAFF_ASSIGN_AUTH_INFO表
|
|
|
- String prefix = "有效期至:";
|
|
|
- if ("长期".equals(activeTime)) {
|
|
|
- prefix = "有效期为:";
|
|
|
- }
|
|
|
- saveLog(roleId, orgId, appId, user, staffId, "10", prefix + activeTime);
|
|
|
return "save";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void saveLog(String roleId, String orgId, String appId, SecurityUser user, String staffId, String status, String changeContent) {
|
|
|
- ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
|
|
|
- StaffAssignAuthLog staffAssignAuthLog = new StaffAssignAuthLog();
|
|
|
- staffAssignAuthLog.setAppId(appId);
|
|
|
- staffAssignAuthLog.setRoleId(roleId);
|
|
|
- staffAssignAuthLog.setStaffId(staffId);
|
|
|
- staffAssignAuthLog.setCreateTime(new Date());
|
|
|
- staffAssignAuthLog.setStaffOrgId(orgId);
|
|
|
- if (null != user) {
|
|
|
- staffAssignAuthLog.setManagerId(user.getId());
|
|
|
- }
|
|
|
- staffAssignAuthLog.setStatus(status);
|
|
|
- staffAssignAuthLog.setAppOrgId(applyInfo.getOrgCode()); // 之后取appOrgId
|
|
|
- staffAssignAuthLog.setChangeContent(changeContent);
|
|
|
- staffAssignAuthLogService.save(staffAssignAuthLog);
|
|
|
- }
|
|
|
-
|
|
|
public void deletedAuth(List<StaffAssignAuthInfo> staffAssignAuthInfos) {
|
|
|
if (staffAssignAuthInfos == null) {
|
|
|
return;
|
|
|
}
|
|
|
for (StaffAssignAuthInfo staffAssignAuthInfo : staffAssignAuthInfos) {
|
|
|
this.delete(staffAssignAuthInfo.getId());
|
|
|
- //记录取消授权日志
|
|
|
- saveLog(staffAssignAuthInfo.getRoleId(), staffAssignAuthInfo.getStaffOrgId(), staffAssignAuthInfo.getAppId(), (SecurityUser) ContextUtils.getUserInfo(), staffAssignAuthInfo.getStaffId(), "30", "");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public void deletedAuthAndUpdateQuota(StaffAssignAuthInfo staffAssignAuthInfo, String appOrgId) {
|
|
|
- SecurityUser user = UserContextUtils.getCurrentUser();
|
|
|
- if (staffAssignAuthInfo == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- this.delete(staffAssignAuthInfo.getId());
|
|
|
- //记录取消授权日志
|
|
|
-
|
|
|
- //修改配额
|
|
|
- String appId = staffAssignAuthInfo.getAppId();
|
|
|
- String roleId = staffAssignAuthInfo.getRoleId();
|
|
|
- String orgId = staffAssignAuthInfo.getStaffOrgId();
|
|
|
- OrgQuotaAuthInfo orgQuotaAuthInfo = orgQuotaAuthService.getOrgQuotaAuthInfo(appId, roleId, orgId);
|
|
|
- int bjNum = 0;
|
|
|
- int dfpNum = 0;
|
|
|
- if (orgQuotaAuthInfo != null) {
|
|
|
- bjNum = orgQuotaAuthInfo.getBjNum() - 1;
|
|
|
- dfpNum = orgQuotaAuthInfo.getDfpNum() + 1;
|
|
|
}
|
|
|
- orgQuotaAuthService.updateQuotaWhileAuth(appId, orgId, roleId, appOrgId, user, bjNum, dfpNum, orgQuotaAuthInfo);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResponseStatus deleteAllStaffRole(String staffId) {
|
|
|
- Map<String, Object> params = new HashMap<String, Object>();
|
|
|
- params.put("staffId", staffId);
|
|
|
- List<StaffAssignAuthInfo> staffAssignAuthInfos = this.findByPropertyValue("staffId", staffId);
|
|
|
- if (staffAssignAuthInfos == null) {
|
|
|
- return ResponseStatus.success("删除角色授权成功!");
|
|
|
- }
|
|
|
- for (StaffAssignAuthInfo staffAssignAuthInfo : staffAssignAuthInfos) {
|
|
|
- String appId = staffAssignAuthInfo.getAppId();
|
|
|
-
|
|
|
- ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
|
|
|
- if (applyInfo == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- String orgCode = applyInfo.getOrgCode();
|
|
|
- AuthOrgInfo appOrgInfo = authOrgInfoService.getByOrgCode(orgCode);
|
|
|
- deletedAuthAndUpdateQuota(staffAssignAuthInfo, appOrgInfo.getId());
|
|
|
+ public void deleteExpireAuth() {
|
|
|
+ log.info("取消过期的服务授权开始");
|
|
|
+ setAuthSysSecurityUser();
|
|
|
+ List<StaffAssignAuthInfo> authExpired = staffAssignAuthInfoBPO.findAuthExpired();
|
|
|
+ if (CollectionUtils.isNotEmpty(authExpired)) {
|
|
|
+ authExpired.forEach(e-> staffAssignAuthInfoBPO.delete(e));
|
|
|
+ Map<String, List<StaffAssignAuthInfo>> collect = authExpired.stream().collect(Collectors.groupingBy(StaffAssignAuthInfo::getRoleId));
|
|
|
+ collect.forEach((roleId, list)-> logInfoFillService.sendRoleViewAuthLog(AuthResultEnum.SUC, null, list, ""));
|
|
|
}
|
|
|
-
|
|
|
- //删除用户时取消用户的所有角色授权,发送消息
|
|
|
- JSONArray staffList = new JSONArray();
|
|
|
- JSONObject staffObject = new JSONObject();
|
|
|
- staffObject.put("id", staffId);
|
|
|
- staffList.add(staffObject);
|
|
|
- sendMessage(staffList, null);
|
|
|
- return ResponseStatus.success("删除角色授权成功!");
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void authMonitor(SecurityUser user) {
|
|
|
- List<StaffAssignAuthInfo> staffAssignAuthInfos = staffAssignAuthInfoBPO.findAuthExpired();
|
|
|
- for (StaffAssignAuthInfo staffAssignAuthInfo : staffAssignAuthInfos) {
|
|
|
- String appId = staffAssignAuthInfo.getAppId();
|
|
|
- ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
|
|
|
- if (applyInfo == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- String orgCode = applyInfo.getOrgCode();
|
|
|
- AuthOrgInfo appOrgInfo = authOrgInfoService.getByOrgCode(orgCode);
|
|
|
- deletedAuthAndUpdateQuota(staffAssignAuthInfo, appOrgInfo.getId());
|
|
|
-
|
|
|
- //发送消息
|
|
|
- JSONArray staffList = new JSONArray();
|
|
|
- JSONObject staffObject = new JSONObject();
|
|
|
- staffObject.put("id", staffAssignAuthInfo.getStaffId());
|
|
|
- staffList.add(staffObject);
|
|
|
- sendMessage(staffList, staffAssignAuthInfo.getAppId());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public ResponseStatus changeStaffOrg(String oldOrgId, String newOrgId) {
|
|
|
- List<StaffAssignAuthInfo> staffAssignAuthInfos = this.findByPropertyValue("staffOrgId", oldOrgId);
|
|
|
- for (StaffAssignAuthInfo staffAssignAuthInfo : staffAssignAuthInfos) {
|
|
|
- staffAssignAuthInfo.setStaffOrgId(newOrgId);
|
|
|
- }
|
|
|
- PersistentFactory.getHibernateDao().saveOrUpdateAll(staffAssignAuthInfos);
|
|
|
- return ResponseStatus.success();
|
|
|
+ log.info("取消过期的服务授权开始");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -584,14 +434,6 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
|
|
|
//5、删除原勾选-->未勾选的角色授权
|
|
|
deletedAuth(deleteUserRoles);
|
|
|
//6、发送授权变更消息
|
|
|
- JSONArray staffList = new JSONArray();
|
|
|
- JSONObject staffObject = new JSONObject();
|
|
|
- staffObject.put("id", dto.getUserId());
|
|
|
- staffList.add(staffObject);
|
|
|
- for (String appId : appIds) {
|
|
|
- sendMessage(staffList, appId);
|
|
|
- }
|
|
|
-
|
|
|
logInfoFillService.sendUserViewAuthLog(AuthResultEnum.SUC, dto, logUserRoles, IpUtils.getRealIpAdrress(RequestUtils.getRequest()));
|
|
|
|
|
|
} catch (Exception e) {
|
|
@@ -602,53 +444,12 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
|
|
|
return ResponseStatus.success("保存成功!");
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 保存
|
|
|
- *
|
|
|
- * @param roleId 角色id
|
|
|
- * @param orgId 被操作人机构id
|
|
|
- * @param appId 应用id
|
|
|
- * @param userId 审批人用户id
|
|
|
- * @param userOrg 审批人机构
|
|
|
- * @param activeTime 赋予被操作人时间
|
|
|
- * @param staffId 被操作人id
|
|
|
- */
|
|
|
- @Override
|
|
|
- public void saveStaffAssign(String roleId, String orgId, String appId,
|
|
|
- String userId, String userOrg, String activeTime, String staffId) {
|
|
|
- StaffAssignAuthInfo staffAssignAuthInfo;
|
|
|
- staffAssignAuthInfo = new StaffAssignAuthInfo();
|
|
|
- staffAssignAuthInfo.setAppId(appId);
|
|
|
- staffAssignAuthInfo.setRoleId(roleId);
|
|
|
- staffAssignAuthInfo.setStaffOrgId(orgId);
|
|
|
- staffAssignAuthInfo.setStaffId(staffId);
|
|
|
- staffAssignAuthInfo.setCreateTime(new Date());
|
|
|
- staffAssignAuthInfo.setManagerId(userId);
|
|
|
- staffAssignAuthInfo.setMgeOrgId(userOrg);
|
|
|
- staffAssignAuthInfo.setActiveTime(activeTime);
|
|
|
- this.save(staffAssignAuthInfo);
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
public List<StaffAssignAuthInfo> getByStaffId(String staffId) {
|
|
|
return staffAssignAuthInfoBPO.findByPropertyValue("staffId", staffId);
|
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
-// public Integer getAppIdeNumber(String appId) {
|
|
|
-// return staffAssignAuthInfoBPO.getAppIdNumber(appId);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public Integer getOrgIdRoleIdNumber(String orgId, String roleId) {
|
|
|
-// return staffAssignAuthInfoBPO.getOrgIdRoleIdNumber(orgId, roleId);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public Integer getFuncNumber(String appId, String funcId) {
|
|
|
-// return staffAssignAuthInfoBPO.getFuncNumber(appId, funcId);
|
|
|
-// }
|
|
|
-
|
|
|
@Override
|
|
|
public List<String> getPermissionUpdateUserByAppId(String appId) {
|
|
|
return staffAssignAuthInfoBPO.getStaffIdsByAppId(appId);
|
|
@@ -1094,11 +895,73 @@ public class StaffAssignAuthInfoService implements IStaffAssignAuthInfoService {
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public void batchSave(List<StaffAssignAuthInfo> roleAuths) {
|
|
|
- if (CollectionUtils.isEmpty(roleAuths)) {
|
|
|
+ public void startRoleAuthApply(List<RoleAuthApply> authApplies) {
|
|
|
+ if (CollectionUtils.isEmpty(authApplies)) {
|
|
|
return;
|
|
|
}
|
|
|
- roleAuths.forEach(e-> staffAssignAuthInfoBPO.save(e));
|
|
|
+
|
|
|
+ setAuthSysSecurityUser();
|
|
|
+
|
|
|
+ // 查询申请人员
|
|
|
+ List<String> userIds = authApplies.stream().map(RoleAuthApply::getUserId).distinct().collect(Collectors.toList());
|
|
|
+ List<AuthUserInfo> userInfos = authUserInfoService.findByIds(userIds);
|
|
|
+ Map<String, AuthUserInfo> userMap = userInfos.stream().collect(Collectors.toMap(AuthUserInfo::getId, e -> e));
|
|
|
+
|
|
|
+ // 查询应用中的角色
|
|
|
+ List<String> appIds = authApplies.stream().map(RoleAuthApply::getAppId).distinct().collect(Collectors.toList());
|
|
|
+ List<RoleInfo> roles = roleInfoService.getRolesByAppIds(appIds);
|
|
|
+ Map<String, Map<String, String>> appRoleMap = roles.stream().collect(Collectors.groupingBy(RoleInfo::getAppId,
|
|
|
+ Collectors.collectingAndThen(Collectors.toList(),
|
|
|
+ e -> e.stream().collect(Collectors.toMap(RoleInfo::getCode, RoleInfo::getId)))));
|
|
|
+
|
|
|
+ List<StaffAssignAuthInfo> roleAuths = getStaffAssignAuthInfos(authApplies, appRoleMap, userMap);
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(roleAuths)) {
|
|
|
+ roleAuths.forEach(e-> staffAssignAuthInfoBPO.save(e));
|
|
|
+ Map<String, List<StaffAssignAuthInfo>> collect = roleAuths.stream().collect(Collectors.groupingBy(StaffAssignAuthInfo::getRoleId));
|
|
|
+ collect.forEach((roleId, list)-> logInfoFillService.sendRoleViewAuthLog(AuthResultEnum.SUC, list, null, ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void setAuthSysSecurityUser() {
|
|
|
+ // 设置当前登录人为系统自动
|
|
|
+ SecurityUser securityUser = new SecurityUser();
|
|
|
+ securityUser.setName("权限服务审批回调处理");
|
|
|
+ UserContextUtils.setCurrentUser(securityUser);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private List<StaffAssignAuthInfo> getStaffAssignAuthInfos(List<RoleAuthApply> authApplies, Map<String, Map<String, String>> appRoleMap,
|
|
|
+ Map<String, AuthUserInfo> userMap) {
|
|
|
+ Date createTime = new Date();
|
|
|
+ String activeTime = getActiveTime(authApplies);
|
|
|
+
|
|
|
+ return authApplies.stream().map(e -> {
|
|
|
+ StaffAssignAuthInfo authInfo = new StaffAssignAuthInfo();
|
|
|
+ String roleId = appRoleMap.get(e.getAppId()).get(e.getRoleCode());
|
|
|
+ authInfo.setRoleId(roleId);
|
|
|
+ authInfo.setAppId(e.getAppId());
|
|
|
+
|
|
|
+ AuthUserInfo authUserInfo = userMap.get(e.getUserId());
|
|
|
+ authInfo.setStaffId(e.getUserId());
|
|
|
+ authInfo.setStaffOrgId(authUserInfo.getOrgId());
|
|
|
+
|
|
|
+ authInfo.setCreateTime(createTime);
|
|
|
+ authInfo.setActiveTime(activeTime);
|
|
|
+ return authInfo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getActiveTime(List<RoleAuthApply> authApplies) {
|
|
|
+ RoleAuthApply roleAuthApply = authApplies.get(0);
|
|
|
+ Date endTime = roleAuthApply.getEndTime();
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ if (Objects.isNull(endTime)) {
|
|
|
+ return "长期";
|
|
|
+ } else {
|
|
|
+ return format.format(endTime);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void setUserContext(AuthUserInfo manageUser) {
|