|
@@ -56,9 +56,6 @@ public class OrgQuotaAuthService implements IOrgQuotaAuthService {
|
|
@Autowired
|
|
@Autowired
|
|
private OrgQuotaRepository orgQuotaRepository;
|
|
private OrgQuotaRepository orgQuotaRepository;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private IStaffAssignAuthInfoService staffAssignAuthInfoService;
|
|
|
|
-
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private IOrgQuotaAuthLogService iOrgQuotaAuthLogService;
|
|
private IOrgQuotaAuthLogService iOrgQuotaAuthLogService;
|
|
|
|
|
|
@@ -185,23 +182,13 @@ public class OrgQuotaAuthService implements IOrgQuotaAuthService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
|
-// public void updateParentQuotaWhileAuth(String appId, String orgId, String roleId, String appOrgId, SecurityUser user,
|
|
|
|
-// int diffNum, int dxfNum, OrgQuotaAuthInfo orgQuotaAuthInfo) {
|
|
|
|
-// if (orgQuotaAuthInfo == null) {
|
|
|
|
-// orgQuotaAuthInfo = this.setOrgQuotaAuthInfo(appId, roleId, orgId, 0, diffNum, 0, "10", user.getId(), user.getDeptId());
|
|
|
|
-// orgQuotaRepository.save(orgQuotaAuthInfo);
|
|
|
|
-// } else {
|
|
|
|
-// orgQuotaAuthInfo.setYxfNum(orgQuotaAuthInfo.getYxfNum() + diffNum);
|
|
|
|
-// orgQuotaRepository.update(orgQuotaAuthInfo);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResponseStatus authCancelChild(String appId, String roleId, String orgId) {
|
|
public ResponseStatus authCancelChild(String appId, String roleId, String orgId) {
|
|
long time = System.currentTimeMillis();
|
|
long time = System.currentTimeMillis();
|
|
|
|
|
|
ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
|
|
ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
|
|
|
|
+ AuthOrgInfo appOrgInfo = authOrgInfoService.getByOrgCode(applyInfo.getOrgCode());
|
|
long time1 = System.currentTimeMillis();
|
|
long time1 = System.currentTimeMillis();
|
|
logger.info("authCancelChild:applyInfoFacade.applyDetail耗时:{} ms", (time1 - time));
|
|
logger.info("authCancelChild:applyInfoFacade.applyDetail耗时:{} ms", (time1 - time));
|
|
|
|
|
|
@@ -247,14 +234,14 @@ public class OrgQuotaAuthService implements IOrgQuotaAuthService {
|
|
|
|
|
|
OrgQuotaAuthInfo orgQuotaAuthInfo = orgQuotaAuthInfoMap.get(orgId);
|
|
OrgQuotaAuthInfo orgQuotaAuthInfo = orgQuotaAuthInfoMap.get(orgId);
|
|
orgQuotaAuthInfo.setYxfNum(orgQuotaAuthInfo.getYxfNum() - cancelNum);
|
|
orgQuotaAuthInfo.setYxfNum(orgQuotaAuthInfo.getYxfNum() - cancelNum);
|
|
- if (!orgId.equals(applyInfo.getOrgId())) {
|
|
|
|
|
|
+ if (!orgInfo.getCode().equals(applyInfo.getOrgCode())) {
|
|
orgQuotaAuthInfo.setDfpNum(orgQuotaAuthInfo.getDfpNum() + cancelNum);
|
|
orgQuotaAuthInfo.setDfpNum(orgQuotaAuthInfo.getDfpNum() + cancelNum);
|
|
}
|
|
}
|
|
updateList.add(orgQuotaAuthInfo);
|
|
updateList.add(orgQuotaAuthInfo);
|
|
//添加日志
|
|
//添加日志
|
|
List<OrgQuotaAuthLog> orgQuotaAuthLogs = new ArrayList<OrgQuotaAuthLog>();
|
|
List<OrgQuotaAuthLog> orgQuotaAuthLogs = new ArrayList<OrgQuotaAuthLog>();
|
|
for (OrgQuotaAuthInfo quotaAuthInfo : updateList) {
|
|
for (OrgQuotaAuthInfo quotaAuthInfo : updateList) {
|
|
- OrgQuotaAuthLog orgQuotaAuthLog = setOrgQuotaAuthLog(appId, roleId, applyInfo.getOrgId(), quotaAuthInfo.getTargetOrgId(),
|
|
|
|
|
|
+ OrgQuotaAuthLog orgQuotaAuthLog = setOrgQuotaAuthLog(appId, roleId, appOrgInfo.getId(), quotaAuthInfo.getTargetOrgId(),
|
|
quotaAuthInfo.getDfpNum() + quotaAuthInfo.getYxfNum() + quotaAuthInfo.getBjNum(), ContextUtils.getUserInfo().getId());
|
|
quotaAuthInfo.getDfpNum() + quotaAuthInfo.getYxfNum() + quotaAuthInfo.getBjNum(), ContextUtils.getUserInfo().getId());
|
|
orgQuotaAuthLogs.add(orgQuotaAuthLog);
|
|
orgQuotaAuthLogs.add(orgQuotaAuthLog);
|
|
}
|
|
}
|
|
@@ -356,7 +343,7 @@ public class OrgQuotaAuthService implements IOrgQuotaAuthService {
|
|
public ResponseStatus authCancelSelf(String applicationId, String roleId, String orgId, String appMtAuthOrgIds) {
|
|
public ResponseStatus authCancelSelf(String applicationId, String roleId, String orgId, String appMtAuthOrgIds) {
|
|
|
|
|
|
ApplyInfo applyInfo = applyInfoFacade.applyDetail(applicationId);
|
|
ApplyInfo applyInfo = applyInfoFacade.applyDetail(applicationId);
|
|
-
|
|
|
|
|
|
+ AuthOrgInfo appOrgInfo = authOrgInfoService.getByOrgCode(applyInfo.getOrgCode());
|
|
//查询用户拥有的应用机构管理权限范围机构
|
|
//查询用户拥有的应用机构管理权限范围机构
|
|
|
|
|
|
AuthOrgInfo orgInfo = authOrgInfoService.findById(orgId);
|
|
AuthOrgInfo orgInfo = authOrgInfoService.findById(orgId);
|
|
@@ -370,7 +357,7 @@ public class OrgQuotaAuthService implements IOrgQuotaAuthService {
|
|
boolean isRootUser = authUserInfoService.isRootUser(userId);
|
|
boolean isRootUser = authUserInfoService.isRootUser(userId);
|
|
|
|
|
|
|
|
|
|
- if ((haveParentAuth || isRootUser) && !orgId.equals(applyInfo.getOrgId())) {
|
|
|
|
|
|
+ if ((haveParentAuth || isRootUser) && !orgId.equals(appOrgInfo.getId())) {
|
|
List<OrgQuotaAuthLog> orgQuotaAuthLogs = getChangeLogs(roleId, orgId, pOrgId, applyInfo);
|
|
List<OrgQuotaAuthLog> orgQuotaAuthLogs = getChangeLogs(roleId, orgId, pOrgId, applyInfo);
|
|
iOrgQuotaAuthLogService.saveAll(orgQuotaAuthLogs);
|
|
iOrgQuotaAuthLogService.saveAll(orgQuotaAuthLogs);
|
|
return ResponseStatus.success("回收成功");
|
|
return ResponseStatus.success("回收成功");
|
|
@@ -391,7 +378,8 @@ public class OrgQuotaAuthService implements IOrgQuotaAuthService {
|
|
parent.setDfpNum(parent.getDfpNum() + changeNum);
|
|
parent.setDfpNum(parent.getDfpNum() + changeNum);
|
|
parent.setYxfNum(parent.getYxfNum() - changeNum);
|
|
parent.setYxfNum(parent.getYxfNum() - changeNum);
|
|
|
|
|
|
- String orgId = applyInfo.getOrgId();
|
|
|
|
|
|
+ AuthOrgInfo appOrgInfo = authOrgInfoService.getByOrgCode(applyInfo.getOrgCode());
|
|
|
|
+ String orgId = appOrgInfo.getId();
|
|
|
|
|
|
OrgQuotaAuthLog curOrgQuotaAuthLog = setOrgQuotaAuthLog(appId, roleId, orgId,
|
|
OrgQuotaAuthLog curOrgQuotaAuthLog = setOrgQuotaAuthLog(appId, roleId, orgId,
|
|
curOrgId, cur.getDfpNum() + cur.getYxfNum() + cur.getBjNum(), ContextUtils.getUserInfo().getId());
|
|
curOrgId, cur.getDfpNum() + cur.getYxfNum() + cur.getBjNum(), ContextUtils.getUserInfo().getId());
|
|
@@ -425,12 +413,14 @@ public class OrgQuotaAuthService implements IOrgQuotaAuthService {
|
|
OrgQuotaNumDTO orgQuotaNumDTO = authOrgBusiness.searchOrg(userId, rootId, unitClass, roleLevel);
|
|
OrgQuotaNumDTO orgQuotaNumDTO = authOrgBusiness.searchOrg(userId, rootId, unitClass, roleLevel);
|
|
|
|
|
|
ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
|
|
ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
|
|
|
|
+ AuthOrgInfo appOrgInfo = authOrgInfoService.getByOrgCode(applyInfo.getOrgCode());
|
|
|
|
+ String appOrgId = appOrgInfo.getId();
|
|
|
|
|
|
AuthOrgInfo rootOrg = authOrgInfoService.findById(rootId);
|
|
AuthOrgInfo rootOrg = authOrgInfoService.findById(rootId);
|
|
int count = orgQuotaNumDTO.getCount();
|
|
int count = orgQuotaNumDTO.getCount();
|
|
OrgQuotaAuthInfo rootOrgQuota = getOrgQuotaAuthInfo(appId, roleId, rootId);//获取当前本级机构配额信息
|
|
OrgQuotaAuthInfo rootOrgQuota = getOrgQuotaAuthInfo(appId, roleId, rootId);//获取当前本级机构配额信息
|
|
//判断空闲名额是否足够
|
|
//判断空闲名额是否足够
|
|
- if (!rootId.equals(applyInfo.getOrgId()) && (rootOrgQuota == null || rootOrgQuota.getDfpNum() < count * addNum)) {
|
|
|
|
|
|
+ if (!rootId.equals(appOrgId) && (rootOrgQuota == null || rootOrgQuota.getDfpNum() < count * addNum)) {
|
|
int kxme = rootOrgQuota == null ? 0 : rootOrgQuota.getDfpNum();
|
|
int kxme = rootOrgQuota == null ? 0 : rootOrgQuota.getDfpNum();
|
|
return ResponseStatus.fail("机构【" + rootOrg.getFullName() + "】空闲名额不足,当前空闲名额为:" + kxme + ",所需下发名额为:" + addNum * count);
|
|
return ResponseStatus.fail("机构【" + rootOrg.getFullName() + "】空闲名额不足,当前空闲名额为:" + kxme + ",所需下发名额为:" + addNum * count);
|
|
}
|
|
}
|
|
@@ -456,7 +446,7 @@ public class OrgQuotaAuthService implements IOrgQuotaAuthService {
|
|
//修改根节点
|
|
//修改根节点
|
|
boolean flag = StringUtils.isNotBlank(targetOrgLevel) && StringUtils.isNotBlank(orgLevel)
|
|
boolean flag = StringUtils.isNotBlank(targetOrgLevel) && StringUtils.isNotBlank(orgLevel)
|
|
&& Integer.parseInt(orgLevel) == Integer.parseInt(targetOrgLevel); //根节点机构层级与分配范围的层级相等
|
|
&& Integer.parseInt(orgLevel) == Integer.parseInt(targetOrgLevel); //根节点机构层级与分配范围的层级相等
|
|
- if (rootId.equals(applyInfo.getOrgId())) { //根节点为应用所属机构
|
|
|
|
|
|
+ if (rootId.equals(appOrgId)) { //根节点为应用所属机构
|
|
OrgTreeNodeDTO rootOrgTreeNode = new OrgTreeNodeDTO();
|
|
OrgTreeNodeDTO rootOrgTreeNode = new OrgTreeNodeDTO();
|
|
rootOrgTreeNode.setIsParent(false);
|
|
rootOrgTreeNode.setIsParent(false);
|
|
rootOrgTreeNode.setId(rootId);
|
|
rootOrgTreeNode.setId(rootId);
|