|
@@ -14,10 +14,10 @@ import com.dragoninfo.dcuc.auth.auth.enumresources.YesNotEnum;
|
|
|
import com.dragoninfo.dcuc.auth.auth.service.IOrgQuotaAuthLogService;
|
|
|
import com.dragoninfo.dcuc.auth.auth.service.IOrgQuotaAuthService;
|
|
|
import com.dragoninfo.dcuc.auth.auth.service.IStaffAssignAuthInfoService;
|
|
|
+import com.dragoninfo.dcuc.auth.sub.dto.OrgTreeNodeDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.sub.entity.AuthOrgInfo;
|
|
|
+import com.dragoninfo.dcuc.auth.sub.service.IAuthOrgInfoService;
|
|
|
import com.dragoninfo.dcuc.auth.sub.service.IAuthUserInfoService;
|
|
|
-import com.dragoninfo.dcuc.org.entity.OrgInfo;
|
|
|
-import com.dragoninfo.dcuc.org.facade.IOrgInfoFacade;
|
|
|
-import com.dragoninfo.dcuc.org.vo.OrgTreeNode;
|
|
|
import com.dragoninfo.duceap.commons.util.server.OrgInfoUtil;
|
|
|
import com.dragoninfo.duceap.core.service.impl.BaseService;
|
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseDTO;
|
|
@@ -37,6 +37,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
* Created by liws on 2018/6/28.
|
|
@@ -57,7 +58,7 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
|
|
|
@Autowired
|
|
|
private IApplyInfoFacade applyInfoFacade;
|
|
|
@Autowired
|
|
|
- private IOrgInfoFacade orgInfoFacade;
|
|
|
+ private IAuthOrgInfoService authOrgInfoService;
|
|
|
|
|
|
@Autowired
|
|
|
private IAppMtAuthFacade appMtAuthFacade;
|
|
@@ -109,17 +110,17 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
|
|
|
}
|
|
|
if (roleInfo.getIsNotLimitCount().equalsIgnoreCase(BooleanEnum.FALSE.getValue())) {
|
|
|
|
|
|
- List<OrgInfo> orgsByIds = orgInfoFacade.getOrgsByIds(userOrgId);
|
|
|
+
|
|
|
+ AuthOrgInfo authOrgInfo = authOrgInfoService.findById(userOrgId);
|
|
|
String path = "";
|
|
|
String[] paths = new String[]{};
|
|
|
- if (CollectionUtils.isNotEmpty(orgsByIds)) {
|
|
|
- path = orgsByIds.get(0).getPath();
|
|
|
- if (StringUtils.isNotEmpty(path)) {
|
|
|
- paths = path.split("-");
|
|
|
- }
|
|
|
- } else {
|
|
|
+ if (null == authOrgInfo) {
|
|
|
return;
|
|
|
}
|
|
|
+ path = authOrgInfo.getPath();
|
|
|
+ if (StringUtils.isNotEmpty(path)) {
|
|
|
+ paths = path.split("-");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
for (String currentOrg : paths) {
|
|
@@ -156,14 +157,15 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
|
|
|
long time1 = System.currentTimeMillis();
|
|
|
logger.info("authCancelChild:applyInfoFacade.applyDetail耗时:{} ms", (time1 - time));
|
|
|
|
|
|
- OrgInfo orgInfo = orgInfoFacade.detail(orgId);
|
|
|
+ AuthOrgInfo orgInfo = authOrgInfoService.findById(orgId);
|
|
|
if (orgInfo == null) {
|
|
|
return ResponseStatus.fail("回收异常!");
|
|
|
}
|
|
|
long time2 = System.currentTimeMillis();
|
|
|
logger.info("authCancelChild:orgInfoFacade.detail耗时:{} ms", (time2 - time1));
|
|
|
-
|
|
|
- List<String> childIds = orgInfoFacade.getChildrenIds(orgId);
|
|
|
+
|
|
|
+ List<String> childIds = authOrgInfoService.getChildById(orgId)
|
|
|
+ .stream().map(OrgTreeNodeDTO::getId).collect(Collectors.toList());
|
|
|
long time3 = System.currentTimeMillis();
|
|
|
logger.info("authCancelChild:orgInfoFacade.getChildrenIds耗时:{} ms", (time3 - time2));
|
|
|
|
|
@@ -215,8 +217,9 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
|
|
|
|
|
|
private int cancelQuota(String orgId, String appMtAuths, List<OrgQuotaAuthInfo> updateList, Map<String, OrgQuotaAuthInfo> orgQuotaAuthInfoMap) {
|
|
|
int count = 0;
|
|
|
-
|
|
|
- List<String> childrenIds = orgInfoFacade.getChildrenIds(orgId);
|
|
|
+
|
|
|
+ List<String> childrenIds = authOrgInfoService.getChildById(orgId)
|
|
|
+ .stream().map(OrgTreeNodeDTO::getId).collect(Collectors.toList());
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(childrenIds)) {
|
|
|
for (String cId : childrenIds) {
|
|
@@ -232,8 +235,12 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
|
|
|
if (orgQuotaAuthInfo == null || (count == 0 && orgQuotaAuthInfo.getDfpNum() == 0)) {
|
|
|
return count;
|
|
|
}
|
|
|
-
|
|
|
- OrgTreeNode orgTreeNode = orgInfoFacade.getOrgTreeNode(orgId);
|
|
|
+
|
|
|
+ List<OrgTreeNodeDTO> list = authOrgInfoService.getChildById(orgId);
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+ OrgTreeNodeDTO orgTreeNode = list.get(0);
|
|
|
|
|
|
orgQuotaAuthInfo.setYxfNum(orgQuotaAuthInfo.getYxfNum() - count);
|
|
|
if (orgTreeNode != null && OrgInfoUtil.isHaveAuth(orgId, orgTreeNode.getPath(), appMtAuths)) {
|
|
@@ -306,10 +313,10 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
|
|
|
|
|
|
|
|
|
|
|
|
- OrgInfo orgInfo = orgInfoFacade.detail(orgId);
|
|
|
+ AuthOrgInfo orgInfo = authOrgInfoService.findById(orgId);
|
|
|
String pOrgId = orgInfo.getUpGovId();
|
|
|
|
|
|
- OrgInfo upOrgInfo = orgInfoFacade.detail(pOrgId);
|
|
|
+ AuthOrgInfo upOrgInfo = authOrgInfoService.findById(pOrgId);
|
|
|
|
|
|
boolean haveParentAuth = OrgInfoUtil.isHaveAuth(pOrgId, upOrgInfo.getPath(), appMtAuthOrgIds);
|
|
|
String userId = ContextUtils.getUserInfo().getId();
|
|
@@ -376,11 +383,12 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
|
|
|
|
|
|
String userId = userInfo.getId();
|
|
|
|
|
|
- Map<String, Object> resultMap = orgInfoFacade.searchOrg(userId, rootId, unitClass, roleLevel);
|
|
|
+
|
|
|
+ Map<String, Object> resultMap = null;
|
|
|
|
|
|
ApplyInfo applyInfo = applyInfoFacade.applyDetail(appId);
|
|
|
|
|
|
- OrgInfo rootOrg = orgInfoFacade.detail(rootId);
|
|
|
+ AuthOrgInfo rootOrg = authOrgInfoService.findById(rootId);
|
|
|
int count = (Integer) resultMap.get("count");
|
|
|
OrgQuotaAuthInfo rootOrgQuota = orgQuotaAuthInfoBpo.getOrgQuotoAuthInfo(appId, roleId, rootId);
|
|
|
|
|
@@ -569,10 +577,9 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
|
|
|
|
|
|
@Override
|
|
|
public ResponseStatus changeQuotaWhenOrgMove(String orgId, String oldUpId, String newUpId) {
|
|
|
-
|
|
|
- OrgTreeNode oldUpNode = orgInfoFacade.getOrgTreeNode(oldUpId);
|
|
|
-
|
|
|
- OrgTreeNode newUpNode = orgInfoFacade.getOrgTreeNode(newUpId);
|
|
|
+
|
|
|
+ OrgTreeNodeDTO oldUpNode = authOrgInfoService.getOrgTreeNode(oldUpId);
|
|
|
+ OrgTreeNodeDTO newUpNode = authOrgInfoService.getOrgTreeNode(newUpId);
|
|
|
return changeUpOrgYxfQuota(orgId, newUpId, oldUpNode, newUpNode);
|
|
|
}
|
|
|
|
|
@@ -626,12 +633,12 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
|
|
|
|
|
|
@Override
|
|
|
public ResponseStatus changeQuotaWhenOrgMerfe(String orgId, String oldUpId, String newId) {
|
|
|
+
|
|
|
+ OrgTreeNodeDTO oldUpNode = authOrgInfoService.getOrgTreeNode(oldUpId);
|
|
|
|
|
|
- OrgTreeNode oldUpNode = orgInfoFacade.getOrgTreeNode(oldUpId);
|
|
|
-
|
|
|
- OrgTreeNode newNode = orgInfoFacade.getOrgTreeNode(newId);
|
|
|
+ OrgTreeNodeDTO newNode = authOrgInfoService.getOrgTreeNode(newId);
|
|
|
|
|
|
- OrgTreeNode newUpNode = orgInfoFacade.getOrgTreeNode(newNode.getPid());
|
|
|
+ OrgTreeNodeDTO newUpNode = authOrgInfoService.getOrgTreeNode(newNode.getPid());
|
|
|
|
|
|
if (newUpNode != null) {
|
|
|
changeUpOrgYxfQuota(orgId, newId, oldUpNode, newUpNode);
|
|
@@ -654,7 +661,7 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
|
|
|
return ResponseStatus.success();
|
|
|
}
|
|
|
|
|
|
- private ResponseStatus changeUpOrgYxfQuota(String orgId, String newId, OrgTreeNode oldUpNode, OrgTreeNode newUpNode) {
|
|
|
+ private ResponseStatus changeUpOrgYxfQuota(String orgId, String newId, OrgTreeNodeDTO oldUpNode, OrgTreeNodeDTO newUpNode) {
|
|
|
String oldUpPath = oldUpNode.getPath() + "-" + oldUpNode.getId();
|
|
|
String newUpPath = newUpNode.getPath() + "-" + newUpNode.getId();
|
|
|
|
|
@@ -699,8 +706,8 @@ public class OrgQuotaAuthService extends BaseService<OrgQuotaAuthInfo, String> i
|
|
|
public List<String> getAppIds(String orgId) {
|
|
|
List<String> appIds = applyInfoFacade.getAppIdsByOrgId(orgId);
|
|
|
List<String> resultList = new ArrayList<>(appIds);
|
|
|
-
|
|
|
- OrgTreeNode orgTreeNode = orgInfoFacade.getOrgTreeNode(orgId);
|
|
|
+
|
|
|
+ OrgTreeNodeDTO orgTreeNode = authOrgInfoService.getOrgTreeNode(orgId);
|
|
|
String path = orgTreeNode.getPath();
|
|
|
if (StringUtils.isBlank(path)) {
|
|
|
return resultList;
|