ludc
2024-09-26 085df90e488067783759dcd63cdb5fb43a51ff1f
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java
@@ -1,15 +1,17 @@
package com.vci.web.controller;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.corba.framework.data.AppConfigDetailInfo;
import com.vci.corba.common.PLException;
import com.vci.corba.framework.data.FuncOperationInfo;
import com.vci.corba.framework.data.OperateInfo;
import com.vci.dto.RoleInfoDTO;
import com.vci.dto.RoleRightDTO;
import com.vci.dto.RoleRightParamDTO;
import com.vci.frameworkcore.compatibility.ISmFunctionQueryService;
import com.vci.frameworkcore.compatibility.SmHMSysModConfigServiceI;
import com.vci.pagemodel.AppConfigDetailInfoVO;
import com.vci.pagemodel.ExpExcelConditionVO;
import com.vci.pagemodel.MenuVO;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.util.ControllerUtil;
@@ -19,7 +21,6 @@
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -70,6 +71,76 @@
        }catch (Exception e){
            e.printStackTrace();
            String errorMsg = "查询子模块时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e);
            logger.error(errorMsg);
            throw new VciBaseException(errorMsg);
        }
    }
    /**
     * 获取当前模块下的子模块
     * @return
     */
    @GetMapping("/getSysModelAuthTreeMenuByPID")
    public BaseResult<List<MenuVO>> getSysModelAuthTreeMenuByPID() {
        try {
            return BaseResult.dataList(functionQueryService.getSysModelAuthTreeMenuByPID(false));
        }catch (Exception e){
            e.printStackTrace();
            String errorMsg = "查询子模块时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e);
            logger.error(errorMsg);
            throw new VciBaseException(errorMsg);
        }
    }
    /**
     * 获取所授权的模块权限
     * @param roleId 角色
     * @return
     */
    @GetMapping("/getSysModelAuth")
    public BaseResult<List<String>> getSysModelAuth(String roleId) {
        try {
            return BaseResult.dataList(functionQueryService.getSysModelAuth(roleId));
        }catch (Exception e){
            e.printStackTrace();
            String errorMsg = "查询子模块时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e);
            logger.error(errorMsg);
            throw new VciBaseException(errorMsg);
        }
    }
    /**
     * 角色列表
     * @param roleName 搜索的角色
     * @return 角色列表
     */
    @GetMapping("/getRoleList")
    public BaseResult<List<RoleInfoDTO>> getRoleList(String roleName) {
        try {
            return BaseResult.dataList(functionQueryService.getRoleList(roleName));
        }catch (Exception e){
            e.printStackTrace();
            String errorMsg = "查询时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e);
            logger.error(errorMsg);
            throw new VciBaseException(errorMsg);
        }
    }
    /**
     * 保存授权的模块
     * @param roleRightDTOS 用户选择授权模块信息
     * @param roleId 角色主键
     * @return 授权结果
     * @throws PLException
     */
    @PostMapping("/saveRoleRight")
    public BaseResult<List<String>> saveRoleRight(@RequestBody List<RoleRightParamDTO> roleRightDTOS, String roleId) {
        try {
            return functionQueryService.saveRoleRight(roleRightDTOS, roleId);
        }catch (Exception e){
            e.printStackTrace();
            String errorMsg = "保存模块时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e);
            logger.error(errorMsg);
            throw new VciBaseException(errorMsg);
        }
@@ -188,7 +259,7 @@
            return BaseResult.success(hmSysModConfigService.addOperationType(operateInfo),"添加操作类型成功");
        }catch (Exception e){
            e.printStackTrace();
            String errorMsg = "删除模块时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e);
            String errorMsg = "添加操作类型时出现错误,原因:"+ VciBaseUtil.getExceptionMessage(e);
            logger.error(errorMsg);
            throw new VciBaseException(errorMsg);
        }
@@ -435,4 +506,20 @@
        }
    }
    /**
     * 获取当前用户在线人数
     * @return
     */
    @GetMapping("/getOnlineUsersNum")
    public BaseResult getOnlineUsersNum() {
        try {
            long onlineUsersNum = hmSysModConfigService.getOnlineUsersNum();
            return BaseResult.success(onlineUsersNum);
        } catch (Exception e) {
            String errorMsg = "获取当前用户在线人数时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(errorMsg);
            throw new VciBaseException(errorMsg);
        }
    }
}