|
@@ -1,12 +1,10 @@
|
|
|
package com.css.simulation.resource.system.ctrl;
|
|
|
|
|
|
import api.common.pojo.common.ResponseBodyVO;
|
|
|
-import api.common.pojo.constants.DictConstants;
|
|
|
import api.common.pojo.param.system.ClusterParam;
|
|
|
import api.common.pojo.po.system.ClusterPO;
|
|
|
import api.common.pojo.vo.system.ClusterVO;
|
|
|
import api.common.util.ObjectUtil;
|
|
|
-import com.css.simulation.resource.common.utils.AuthUtil;
|
|
|
import com.css.simulation.resource.system.service.ClusterService;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -32,30 +30,6 @@ public class ClusterCtrl {
|
|
|
@RequestMapping("/getClusterList")
|
|
|
@ResponseBody
|
|
|
public ResponseBodyVO<PageInfo<ClusterVO>> getClusterList(@RequestBody ClusterParam clusterParam){
|
|
|
-
|
|
|
- String roleCode = AuthUtil.getCurrentUserRoleCode();
|
|
|
- if(roleCode == null){
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE);
|
|
|
- }
|
|
|
- //当前账户为普通账户子账户,列表显示空
|
|
|
- if(DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)){
|
|
|
- clusterParam.setRoleCode("-1");//查不到
|
|
|
- }
|
|
|
- //当前账户为管理员账户,需要查询普通账户,设置roleCode为2
|
|
|
- if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){
|
|
|
- clusterParam.setRoleCode(DictConstants.ROLE_CODE_UESR);
|
|
|
- }
|
|
|
- // 当前账户为普通账户,需要查询该账户创建的普通账户子账户,设置roleCode为3及当前创建用户id
|
|
|
- if(DictConstants.ROLE_CODE_UESR.equals(roleCode)){
|
|
|
- String useType = AuthUtil.getCurrentUseType();
|
|
|
- if("1".equals(useType)){//独占
|
|
|
- clusterParam.setRoleCode(DictConstants.ROLE_CODE_SUBUESR);
|
|
|
- clusterParam.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
- }else {
|
|
|
- clusterParam.setRoleCode("-1"); //查不到
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
ResponseBodyVO<PageInfo<ClusterVO>> response = new ResponseBodyVO<PageInfo<ClusterVO>>(ResponseBodyVO.Response.SUCCESS);
|
|
|
response.setInfo(clusterService.getClusterList(clusterParam));
|
|
|
return response;
|
|
@@ -66,7 +40,7 @@ public class ClusterCtrl {
|
|
|
*/
|
|
|
@RequestMapping("/saveCluster")
|
|
|
@ResponseBody
|
|
|
- public ResponseBodyVO<ClusterPO> saveCluster(@RequestBody ClusterPO clusterPO) throws Exception {
|
|
|
+ public ResponseBodyVO<ClusterPO> saveCluster(@RequestBody ClusterPO clusterPO) {
|
|
|
if(ObjectUtil.isNull(clusterPO)){
|
|
|
return new ResponseBodyVO(false, 400, "参数必传!",null);
|
|
|
}
|
|
@@ -82,7 +56,6 @@ public class ClusterCtrl {
|
|
|
@RequestMapping("/getClusterHistory")
|
|
|
@ResponseBody
|
|
|
public ResponseBodyVO<PageInfo<ClusterVO>> getClusterHistory(@RequestBody ClusterParam clusterParam){
|
|
|
-
|
|
|
ResponseBodyVO<PageInfo<ClusterVO>> response = new ResponseBodyVO<PageInfo<ClusterVO>>(ResponseBodyVO.Response.SUCCESS);
|
|
|
response.setInfo(clusterService.getClusterHistory(clusterParam));
|
|
|
return response;
|
|
@@ -93,35 +66,23 @@ public class ClusterCtrl {
|
|
|
*/
|
|
|
@RequestMapping("/getClusterNum")
|
|
|
@ResponseBody
|
|
|
- public ResponseBodyVO<HashMap<String, Integer>> getClusterNum() throws Exception {
|
|
|
-
|
|
|
- ClusterParam clusterParam = new ClusterParam();
|
|
|
+ public ResponseBodyVO<HashMap<String, Integer>> getClusterNum() {
|
|
|
ResponseBodyVO<HashMap<String, Integer>> response = new ResponseBodyVO<HashMap<String, Integer>>(ResponseBodyVO.Response.SUCCESS);
|
|
|
- String roleCode = AuthUtil.getCurrentUserRoleCode();
|
|
|
- if(roleCode == null){
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE);
|
|
|
- }
|
|
|
- if(DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)){
|
|
|
- response.setInfo(null);
|
|
|
- }
|
|
|
- //当前账户为管理员账户,需要查询普通账户,设置roleCode为2
|
|
|
- if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){
|
|
|
- clusterParam.setRoleCode(DictConstants.ROLE_CODE_UESR);
|
|
|
- }
|
|
|
- // 当前账户为普通账户,需要查询该账户创建的普通账户子账户,设置roleCode为3及当前创建用户id
|
|
|
- if(DictConstants.ROLE_CODE_UESR.equals(roleCode)){
|
|
|
- String useType = AuthUtil.getCurrentUseType();
|
|
|
- if("1".equals(useType)){//独占
|
|
|
- clusterParam.setRoleCode(DictConstants.ROLE_CODE_SUBUESR);
|
|
|
- clusterParam.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
- }else {
|
|
|
- response.setInfo(null);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- HashMap<String, Integer> resMap = clusterService.getClusterNum(clusterParam);
|
|
|
+ HashMap<String, Integer> resMap = clusterService.getClusterNum();
|
|
|
response.setInfo(resMap);
|
|
|
return response;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询已分配未到期节点数量
|
|
|
+ */
|
|
|
+ @RequestMapping("/getLicenseNum")
|
|
|
+ @ResponseBody
|
|
|
+ public ResponseBodyVO<Integer> getLicenseNum() {
|
|
|
+ ResponseBodyVO<Integer> response = new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
+ Integer simulationLicenseNum = clusterService.getLicenseNum();
|
|
|
+ response.setInfo(simulationLicenseNum);
|
|
|
+ return response;
|
|
|
+ }
|
|
|
+
|
|
|
}
|