|
@@ -89,18 +89,27 @@ public class ClusterService {
|
|
|
String roleCode = AuthUtil.getCurrentUserRoleCode();
|
|
|
String useType = AuthUtil.getCurrentUseType();
|
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
|
+ Integer totalSimulationAll;
|
|
|
+ Integer totalDynamicAll;
|
|
|
|
|
|
if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){
|
|
|
clusterParam.setRoleCode(DictConstants.ROLE_CODE_UESR);
|
|
|
+ totalSimulationAll = -1;
|
|
|
+ totalDynamicAll = -1;
|
|
|
}else if(DictConstants.ROLE_CODE_UESR.equals(roleCode) && DictConstants.USE_TYPE_EXCLUSIVE.equals(useType)){
|
|
|
|
|
|
clusterParam.setRoleCode(DictConstants.ROLE_CODE_SUBUESR);
|
|
|
clusterParam.setCreateUserId(userId);
|
|
|
+
|
|
|
+ totalSimulationAll = clusterMapper.getSimulationLicenseNum(userId);
|
|
|
+ totalDynamicAll = clusterMapper.getDynamicLicenseNum(userId);
|
|
|
}else{
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
HashMap<String, Integer> resMap = clusterMapper.getClusterNum(clusterParam);
|
|
|
+ resMap.put("totalSimulationAll", totalSimulationAll);
|
|
|
+ resMap.put("totalDynamicAll", totalDynamicAll);
|
|
|
return resMap;
|
|
|
}
|
|
|
|
|
@@ -115,10 +124,17 @@ public class ClusterService {
|
|
|
|
|
|
userId = AuthUtil.getCreateUserId();
|
|
|
}
|
|
|
- Integer simulationLicenseNum = clusterMapper.getLicenseNum(userId);
|
|
|
+ Integer simulationLicenseNum = clusterMapper.getSimulationLicenseNum(userId);
|
|
|
if(simulationLicenseNum == null){
|
|
|
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;
|
|
|
}
|
|
|
|
|
@@ -128,11 +144,41 @@ public class ClusterService {
|
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
|
if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){
|
|
|
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();
|
|
|
}
|
|
|
ClusterVO clusterVO = clusterMapper.getClusterByUserId(userId);
|
|
|
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;
|
|
|
+ }
|
|
|
+
|
|
|
}
|