|
@@ -89,18 +89,27 @@ public class ClusterService {
|
|
String roleCode = AuthUtil.getCurrentUserRoleCode();
|
|
String roleCode = AuthUtil.getCurrentUserRoleCode();
|
|
String useType = AuthUtil.getCurrentUseType();
|
|
String useType = AuthUtil.getCurrentUseType();
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
|
|
+ Integer totalSimulationAll;
|
|
|
|
+ Integer totalDynamicAll;
|
|
//当前账户为管理员账户,需要查询普通账户,设置roleCode为2
|
|
//当前账户为管理员账户,需要查询普通账户,设置roleCode为2
|
|
if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){
|
|
if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){
|
|
clusterParam.setRoleCode(DictConstants.ROLE_CODE_UESR);
|
|
clusterParam.setRoleCode(DictConstants.ROLE_CODE_UESR);
|
|
|
|
+ totalSimulationAll = -1;
|
|
|
|
+ totalDynamicAll = -1;
|
|
}else if(DictConstants.ROLE_CODE_UESR.equals(roleCode) && DictConstants.USE_TYPE_EXCLUSIVE.equals(useType)){
|
|
}else if(DictConstants.ROLE_CODE_UESR.equals(roleCode) && DictConstants.USE_TYPE_EXCLUSIVE.equals(useType)){
|
|
// 当前账户为独占使用的普通账户,需要查询该账户创建的普通账户子账户,设置roleCode为3及当前创建用户id
|
|
// 当前账户为独占使用的普通账户,需要查询该账户创建的普通账户子账户,设置roleCode为3及当前创建用户id
|
|
clusterParam.setRoleCode(DictConstants.ROLE_CODE_SUBUESR);
|
|
clusterParam.setRoleCode(DictConstants.ROLE_CODE_SUBUESR);
|
|
clusterParam.setCreateUserId(userId);
|
|
clusterParam.setCreateUserId(userId);
|
|
|
|
+ // 查询该普通账户所有的集群数量
|
|
|
|
+ totalSimulationAll = clusterMapper.getSimulationLicenseNum(userId);
|
|
|
|
+ totalDynamicAll = clusterMapper.getDynamicLicenseNum(userId);
|
|
}else{
|
|
}else{
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
HashMap<String, Integer> resMap = clusterMapper.getClusterNum(clusterParam);
|
|
HashMap<String, Integer> resMap = clusterMapper.getClusterNum(clusterParam);
|
|
|
|
+ resMap.put("totalSimulationAll", totalSimulationAll);
|
|
|
|
+ resMap.put("totalDynamicAll", totalDynamicAll);
|
|
return resMap;
|
|
return resMap;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -115,10 +124,17 @@ public class ClusterService {
|
|
//查询父账户
|
|
//查询父账户
|
|
userId = AuthUtil.getCreateUserId();
|
|
userId = AuthUtil.getCreateUserId();
|
|
}
|
|
}
|
|
- Integer simulationLicenseNum = clusterMapper.getLicenseNum(userId);
|
|
|
|
|
|
+ Integer simulationLicenseNum = clusterMapper.getSimulationLicenseNum(userId);
|
|
if(simulationLicenseNum == null){
|
|
if(simulationLicenseNum == null){
|
|
simulationLicenseNum = 0;
|
|
simulationLicenseNum = 0;
|
|
}
|
|
}
|
|
|
|
+ if(DictConstants.ROLE_CODE_UESR.equals(roleCode) && simulationLicenseNum != 0){//普通账户需要减去它分配给子账户的
|
|
|
|
+ ClusterParam clusterParam = new ClusterParam();
|
|
|
|
+ clusterParam.setCreateUserId(userId);
|
|
|
|
+ Integer assignedSimulationLicenseNum = clusterMapper.getAssignedSimLicenseNum(clusterParam);
|
|
|
|
+ simulationLicenseNum = simulationLicenseNum - assignedSimulationLicenseNum;
|
|
|
|
+ }
|
|
|
|
+
|
|
return simulationLicenseNum;
|
|
return simulationLicenseNum;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -128,11 +144,41 @@ public class ClusterService {
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){ //管理员账户
|
|
if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){ //管理员账户
|
|
return null;
|
|
return null;
|
|
- }else if(DictConstants.ROLE_CODE_SUBUESR.equals(roleCode) && DictConstants.USE_TYPE_PUBLIC.equals(useType)){
|
|
|
|
|
|
+ }else if(DictConstants.ROLE_CODE_SUBUESR.equals(roleCode) && DictConstants.USE_TYPE_PUBLIC.equals(useType)){ //公共使用的普通子账户
|
|
//查询父账户
|
|
//查询父账户
|
|
userId = AuthUtil.getCreateUserId();
|
|
userId = AuthUtil.getCreateUserId();
|
|
}
|
|
}
|
|
ClusterVO clusterVO = clusterMapper.getClusterByUserId(userId);
|
|
ClusterVO clusterVO = clusterMapper.getClusterByUserId(userId);
|
|
return clusterVO;
|
|
return clusterVO;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public ClusterVO getValidClusterInfo(ClusterParam clusterParam) {
|
|
|
|
+ String roleCode = AuthUtil.getCurrentUserRoleCode();
|
|
|
|
+ String useType = AuthUtil.getCurrentUseType();
|
|
|
|
+ String currentUserId = AuthUtil.getCurrentUserId();
|
|
|
|
+ if(DictConstants.ROLE_CODE_UESR.equals(roleCode) && DictConstants.USE_TYPE_EXCLUSIVE.equals(useType)){
|
|
|
|
+ //当前账户为独占使用的普通账户,其集群配置信息
|
|
|
|
+ ClusterVO clusterVO = clusterMapper.getClusterByUserId(currentUserId);
|
|
|
|
+
|
|
|
|
+ //查询当前普通账户分配给其子账户的集群总数量
|
|
|
|
+ clusterParam.setCreateUserId(currentUserId);
|
|
|
|
+ Integer assignedSimLicenseNum = clusterMapper.getAssignedSimLicenseNum(clusterParam);
|
|
|
|
+ Integer assignedDynLicenseNum = clusterMapper.getAssignedDynLicenseNum(clusterParam);
|
|
|
|
+
|
|
|
|
+ //当前普通账户的集群总数量减去已分配的数量
|
|
|
|
+ if(ObjectUtil.isNotNull(clusterVO) && clusterVO.getNumSimulationLicense() > assignedSimLicenseNum && clusterVO.getNumDynamicLicense() > assignedDynLicenseNum){
|
|
|
|
+ int validSimLicenseNum = clusterVO.getNumSimulationLicense() - assignedSimLicenseNum;
|
|
|
|
+ int validDynLicenseNum = clusterVO.getNumDynamicLicense() - assignedDynLicenseNum;
|
|
|
|
+
|
|
|
|
+ clusterVO.setValidNumSimLicense(validSimLicenseNum);
|
|
|
|
+ clusterVO.setValidNumDynLicense(validDynLicenseNum);
|
|
|
|
+
|
|
|
|
+ return clusterVO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|