Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/pagemodel/Tree.java
@@ -58,6 +58,10 @@ */ private String text; /** * 编号 */ private String id; /** * 是否叶子 */ private boolean leaf = false; @@ -158,6 +162,21 @@ } /** * 设置编号 * @param id */ public void setId(String id) { this.id = id; } /** * 获取编号 */ public String getId() { return id; } /** * 是否叶子节点 * @return true 表示叶子节点 */ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmHMSysModConfigServiceI.java
@@ -158,4 +158,10 @@ */ String exportSysConf(ExpExcelConditionVO expExcelConditionVO, HttpServletResponse response) throws IOException; /** * 获取当前在线人数 * @return */ long getOnlineUsersNum(); } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmHMSysModConfigServiceImpl.java
@@ -18,6 +18,7 @@ import com.vci.starter.web.util.LocalFileUtil; import com.vci.starter.web.util.VciBaseUtil; import com.vci.starter.web.util.WebThreadLocalUtil; import com.vci.web.redis.RedisService; import com.vci.web.util.Func; import com.vci.web.util.PlatformClientUtil; import org.slf4j.Logger; @@ -45,13 +46,27 @@ private int count = 0; /** * 包含保存模块方法等操作类 */ private static FunctionOperateDelegate foDelegate; /** * 初始化foDelegate */ { if(Func.isEmpty(foDelegate)){ foDelegate = new FunctionOperateDelegate(); } } @Autowired private RedisService redisService; /** * 当前登录的用户总数key */ private static final String CURRENT_LOGGED_USERS_KEY = "current_logged_users"; /** * 日志 @@ -594,6 +609,8 @@ return res; } /** * 检查是否存在引用关系 * @param ids @@ -770,6 +787,16 @@ WriteExcelOption excelOption = new WriteExcelOption(excelDataList); ExcelUtil.writeDataToFile(excelPath, excelOption); return excelPath; } /** * 获取当前在线人数 * @return */ @Override public long getOnlineUsersNum() { long currentLoggedUserCount = redisService.getCurrentLoggedUserCount(CURRENT_LOGGED_USERS_KEY); return currentLoggedUserCount; } /** @@ -1585,6 +1612,5 @@ } } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java
@@ -506,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); } } } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java
@@ -397,6 +397,84 @@ } } /** * 业务类型下拉查询 * @param baseQueryObject selectBtmType 选择的源对象,带分页信息 * @return * @throws PLException */ @GetMapping( "/getBtmDatasByPage") @VciBusinessLog(operateName = "业务类型下拉查询") public BaseResult getBtmDatasByPage(BaseQueryObject baseQueryObject){ try { return BaseResult.dataGrid(uiManagerService.getBtmDatasByPage(baseQueryObject)); }catch (Throwable e) { e.printStackTrace(); String exceptionMessage = "业务类型下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } } /** * UI定义下拉查询(templateType为UI定义时的选择对象下拉查询) * @param baseQueryObject selectBtmType 选择的源对象,带分页信息 * @return * @throws PLException */ @GetMapping( "/getUILayoutDatasByPage") @VciBusinessLog(operateName = "UI定义下拉查询") public BaseResult getUILayoutDatasByPage(BaseQueryObject baseQueryObject){ try { return BaseResult.dataGrid(uiManagerService.getUILayoutDatasByPage(baseQueryObject)); }catch (Throwable e) { e.printStackTrace(); String exceptionMessage = "UI定义下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } } /** * 选择模板下拉查询 * @param baseQueryObject * @return * @throws PLException */ @GetMapping( "/getPortalVIDatasByPage") @VciBusinessLog(operateName = "选择模板下拉查询") public BaseResult getPortalVIDatasByPage(BaseQueryObject baseQueryObject){ try { return BaseResult.dataGrid(uiManagerService.getPortalVIDatasByPage(baseQueryObject)); }catch (Throwable e) { e.printStackTrace(); String exceptionMessage = "选择模板下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } } /** * 查询模板下拉查询 * @param baseQueryObject * @return * @throws PLException */ @GetMapping( "/getQTInfoDatasByPage") @VciBusinessLog(operateName = "查询模板下拉查询") public BaseResult getQTInfoDatasByPage(BaseQueryObject baseQueryObject){ try { return BaseResult.dataGrid(uiManagerService.getQTInfoDatasByPage(baseQueryObject)); }catch (Throwable e) { e.printStackTrace(); String exceptionMessage = "查询模板下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } } //页面设计下配置按钮相关接口 /** * 获取页签区域按钮配置信息 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/RedisService.java
@@ -390,6 +390,41 @@ return new ArrayList<>(); } /** * 用户登录 * @param currentLoggedUserKey * @param username */ public void userLogin(String currentLoggedUserKey,String username) { redisTemplate.opsForSet().add(currentLoggedUserKey, username); } /** * 用户登出 * @param currentLoggedUserKey * @param username */ public void userLogout(String currentLoggedUserKey,String username) { redisTemplate.opsForSet().remove(currentLoggedUserKey, username); } /** * 获取当前登录用户总人数 * @param currentLoggedUserKey * @return */ public long getCurrentLoggedUserCount(String currentLoggedUserKey) { return redisTemplate.opsForSet().size(currentLoggedUserKey); } /** * 获取当前登录用户的用户名列表 * @param currentLoggedUserKey * @return */ public Set<String> getCurrentLoggedUsers(String currentLoggedUserKey) { return redisTemplate.opsForSet().members(currentLoggedUserKey); } /** * 基于Lua脚本实现原子查询并删除 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIManagerServiceI.java
@@ -1,8 +1,11 @@ package com.vci.web.service; import com.vci.corba.common.PLException; import com.vci.corba.omd.btm.BizType; import com.vci.corba.omd.qtm.QTInfo; import com.vci.corba.portal.data.PLUILayout; import com.vci.corba.portal.data.PLTabPage; import com.vci.corba.portal.data.PortalVI; import com.vci.pagemodel.PLTabButtonVO; import com.vci.pagemodel.PLUILayoutCloneVO; import com.vci.starter.web.exception.VciBaseException; @@ -212,4 +215,36 @@ */ boolean authorizedUI(UIAuthorDTO uiAuthorDTO)throws Exception; /** * 业务类型、源对象类型、顶层节点显示类型等都调用这个接口查询 * @param baseQueryObject * @return * @throws PLException */ DataGrid<BizType> getBtmDatasByPage(BaseQueryObject baseQueryObject) throws Throwable; /** * UI定义下拉查询(templateType为UI定义时的选择对象下拉查询) * @param baseQueryObject selectBtmType 选择的源对象,带分页信息 * @return * @throws PLException */ DataGrid<PLUILayout> getUILayoutDatasByPage(BaseQueryObject baseQueryObject)throws Throwable; /** * 选择模板下拉查询(templateType为表格、表单、树表时的选择对象下拉查询) * @param baseQueryObject * @return * @throws PLException */ DataGrid<PortalVI> getPortalVIDatasByPage(BaseQueryObject baseQueryObject) throws Throwable; /** * 查询模板下拉查询 * @param baseQueryObject * @return * @throws PLException */ DataGrid<QTInfo> getQTInfoDatasByPage(BaseQueryObject baseQueryObject)throws Throwable; } Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java
@@ -128,6 +128,11 @@ private PlatformClientUtil platformClientUtil; /** * 当前登录的用户总数key */ private static final String CURRENT_LOGGED_USERS_KEY = "current_logged_users"; /** * 执行登录 * @param userDTO 登录信息 * @param clientInfo 请求的客户端的信息 @@ -167,6 +172,7 @@ String tokenKey = redisService.getCacheObject(userIdTokenKey); redisService.deleteObject(tokenKey); redisService.deleteObject(userIdTokenKey); redisService.userLogout(CURRENT_LOGGED_USERS_KEY,userDTO.getUserId()); } //3.获取用户的对象(对象中包含角色部门还有密码策略信息(当前用户没设置密码策略就是取的默认密码策略)) @@ -242,6 +248,8 @@ sessionInfo.setToken(token); //初始化平台的token sessionForLogin.initInvocationInfo(sessionInfo); //记录当前登录人数的总数 redisService.userLogin(CURRENT_LOGGED_USERS_KEY,userDTO.getUserId()); //拷贝用户到新的session会话中 copyUser2SessionInfo(user, sessionInfo, userDTO.getLangCode()); //拷贝请求信息到session会话中 @@ -558,6 +566,8 @@ } }); } //清除存当前登录的用户(总数-1) redisService.userLogout(CURRENT_LOGGED_USERS_KEY,WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId()); sessionForLogin.logout(userToken); if(!CollectionUtils.isEmpty(logoutpluginBeanMap)){ logoutpluginBeanMap.forEach((k,v) -> { Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
@@ -656,6 +656,7 @@ tree.setParentName(null); tree.setParentId(null); tree.setLeaf(true); tree.setId(osBtmTypeVO.getId()); tree.setText(osBtmTypeVO.getDescription()); tree.setAttributes(WebUtil.objectToMapString(osBtmTypeVO)); tree.setChildren(getChildren(osBtmTypeVOS, osBtmTypeVO)); Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
@@ -5,6 +5,7 @@ import com.vci.corba.common.data.UserEntityInfo; import com.vci.corba.framework.data.RoleRightInfo; import com.vci.corba.omd.btm.BizType; import com.vci.corba.omd.qtm.QTInfo; import com.vci.corba.portal.PortalService; import com.vci.corba.portal.data.*; import com.vci.dto.RoleRightDTO; @@ -2266,7 +2267,7 @@ * @param obj * @throws PLException */ public void checkCodeName(PLUILayout obj) throws PLException { private void checkCodeName(PLUILayout obj) throws PLException { PLUILayout[] plUILayouts = platformClientUtil.getUIService().getPLUILayoutsByRelatedType(obj.plRelatedType); int length = plUILayouts.length; String code = obj.plCode; @@ -2332,6 +2333,220 @@ return res; } /** * 业务类型、源对象类型、顶层节点显示类型等都调用这个接口查询 * @param baseQueryObject * @return * @throws PLException */ public DataGrid<BizType> getBtmDatasByPage(BaseQueryObject baseQueryObject) throws PLException{ BizType[] btmNames = null; int start = baseQueryObject.getPage() <= 1 ? 1 : (baseQueryObject.getPage() - 1) * baseQueryObject.getLimit() + 1; int end = baseQueryObject.getPage() <= 1 ? baseQueryObject.getLimit() : (baseQueryObject.getPage() * baseQueryObject.getLimit()); String where = " 1=1 "; String text = ""; Map<String, String> conditionMap = baseQueryObject.getConditionMap(); if(Func.isNotEmpty(conditionMap)){ //过滤条件 String filterInputValue = conditionMap.get("filterInputValue"); if(Func.isNotBlank(filterInputValue)){ where += String.format(" and (bt.name like '%%%s%%' or bt.label like '%%%s%%')", text, text); } } String fromWhere = String.format(" from plbtmtype bt where %s ", where); String fromWhereOrderBy = String.format(" %s order by bt.name", fromWhere); String sql = String.format("select * from(" + " select row_.*,rownum rownum_ from( " + " select bt.name, bt.label %s" + " ) row_ " + ") where rownum_ >= %d and rownum_ <= %d ", fromWhereOrderBy, start, end); List<BizType> list = new LinkedList<BizType>(); String[][] kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql); for(String[] kvs : kvss){ BizType bi = new BizType(); bi.name = kvs[0]; bi.label = kvs[1]; list.add(bi); } btmNames = list.toArray(new BizType[]{}); sql = String.format("select count(1) count_ %s", fromWhere); kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql); int total = Integer.valueOf(kvss[0][0]); DataGrid<BizType> res = new DataGrid<>(); res.setData(Arrays.asList(btmNames)); res.setTotal(total); return res; } /** * UI定义下拉查询(templateType为UI定义时的UI定义下拉查询) * @param baseQueryObject selectBtmType 选择的源对象,带分页信息 * @return * @throws PLException */ public DataGrid<PLUILayout> getUILayoutDatasByPage(BaseQueryObject baseQueryObject) throws PLException{ PLUILayout[] datas = null; int start = baseQueryObject.getPage() <= 1 ? 1 : (baseQueryObject.getPage() - 1) * baseQueryObject.getLimit() + 1; int end = baseQueryObject.getPage() <= 1 ? baseQueryObject.getLimit() : (baseQueryObject.getPage() * baseQueryObject.getLimit()); String where = " 1=1 "; Map<String, String> conditionMap = baseQueryObject.getConditionMap(); if(Func.isNotEmpty(conditionMap)){ //选择的对象类型 String selectBtmType = conditionMap.get("selectBtmType"); if(selectBtmType != null){ where += String.format(" and ui.PLRELATEDTYPE = '%s' ", selectBtmType); } //过滤条件 String filterInputValue = conditionMap.get("filterInputValue"); if(Func.isNotBlank(filterInputValue)){ where += String.format(" and (ui.plname like '%%%s%%') ", filterInputValue, filterInputValue); } } String fromWhere = String.format(" from PLUILAYOUT ui where %s ", where); String fromWhereOrderBy = String.format(" %s order by ui.plname", fromWhere); String sql = String.format("select * from(" + " select row_.*,rownum rownum_ from( " + " select ui.plname, ui.plcode %s" + " ) row_ " + ") where rownum_ >= %d and rownum_ <= %d ", fromWhereOrderBy, start, end); List<PLUILayout> list = new LinkedList<PLUILayout>(); String[][] kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql); for(String[] kvs : kvss){ PLUILayout bi = new PLUILayout(); bi.plName = kvs[0]; bi.plCode = kvs[1]; list.add(bi); } datas = list.toArray(new PLUILayout[0]); sql = String.format("select count(1) count_ %s", fromWhere); kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql); int total = Integer.valueOf(kvss[0][0]); DataGrid<PLUILayout> res = new DataGrid<PLUILayout>(); res.setData(Arrays.asList(datas)); res.setTotal(total); return res; } /** * 选择模板下拉查询(templateType为表格、表单、树表时的选择对象下拉查询) * @param baseQueryObject * @return * @throws PLException */ public DataGrid<PortalVI> getPortalVIDatasByPage(BaseQueryObject baseQueryObject) throws PLException{ PortalVI[] datas = null; int start = baseQueryObject.getPage() <= 1 ? 1 : (baseQueryObject.getPage() - 1) * baseQueryObject.getLimit() + 1; int end = baseQueryObject.getPage() <= 1 ? baseQueryObject.getLimit() : (baseQueryObject.getPage() * baseQueryObject.getLimit()); String where = " 1=1 "; Map<String, String> conditionMap = baseQueryObject.getConditionMap(); if(Func.isNotEmpty(conditionMap)){ //选择的源对象或者是选择的父节点显示类型 String selectBtmType = conditionMap.get("selectBtmType"); if(selectBtmType != null){ where += String.format(" and vi.typename = '%s' ", selectBtmType); } /*if(getPopupDialog().getPortalVIType() != null){ where += String.format(" and vi.vitype = %d ", getPopupDialog().getPortalVIType().getIntVal()); }*/ //过滤条件 String filterInputValue = conditionMap.get("filterInputValue"); if(Func.isNotBlank(filterInputValue)){ where += String.format(" and (vi.viname like '%%%s%%') ", filterInputValue, filterInputValue); } } String fromWhere = String.format(" from plportalvi vi where %s ", where); String fromWhereOrderBy = String.format(" %s order by vi.viname", fromWhere); String sql = String.format("select * from(" + " select row_.*,rownum rownum_ from( " + " select vi.viname,vi.vitype %s" + " ) row_ " + ") where rownum_ >= %d and rownum_ <= %d ", fromWhereOrderBy, start, end); List<PortalVI> list = new LinkedList<>(); String[][] kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql); for(String[] kvs : kvss){ PortalVI bi = new PortalVI(); bi.viName = kvs[0]; bi.viType = Short.valueOf(kvs[1]); list.add(bi); } datas = list.toArray(new PortalVI[]{}); sql = String.format("select count(1) count_ %s", fromWhere); kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql); int total = Integer.valueOf(kvss[0][0]); DataGrid<PortalVI> res = new DataGrid<>(); res.setData(Arrays.asList(datas)); res.setTotal(total); return res; } /** * 查询模板下拉查询 * @param baseQueryObject * @return * @throws PLException */ public DataGrid<QTInfo> getQTInfoDatasByPage(BaseQueryObject baseQueryObject) throws PLException{ QTInfo[] datas = null; int start = baseQueryObject.getPage() <= 1 ? 1 : (baseQueryObject.getPage() - 1) * baseQueryObject.getLimit() + 1; int end = baseQueryObject.getPage() <= 1 ? baseQueryObject.getLimit() : (baseQueryObject.getPage() * baseQueryObject.getLimit()); String where = " 1=1 "; Map<String, String> conditionMap = baseQueryObject.getConditionMap(); if(Func.isNotEmpty(conditionMap)){ //选择的源对象或者是选择的父节点显示类型 String selectBtmType = conditionMap.get("selectBtmType"); if(selectBtmType != null){ where += String.format(" and qt.btmname = '%s' ", selectBtmType); } //过滤条件 String filterInputValue = conditionMap.get("filterInputValue"); if(Func.isNotBlank(filterInputValue)){ where += String.format(" and (qt.qtname like '%%%s%%') ", filterInputValue, filterInputValue); } } String fromWhere = String.format(" from PL_QTEMPLATE qt where %s ", where); String fromWhereOrderBy = String.format(" %s order by qt.qtname ", fromWhere); String sql = String.format("select * from(" + " select row_.*,rownum rownum_ from( " + " select qt.qtname,qt.btmname %s" + " ) row_ " + ") where rownum_ >= %d and rownum_ <= %d ", fromWhereOrderBy, start, end); List<QTInfo> list = new LinkedList<QTInfo>(); String[][] kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql); for(String[] kvs : kvss){ QTInfo bi = new QTInfo(); bi.qtName = kvs[0]; bi.btmName = kvs[1]; list.add(bi); } datas = list.toArray(new QTInfo[]{}); sql = String.format("select count(1) count_ %s", fromWhere); kvss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql); int total = Integer.valueOf(kvss[0][0]); DataGrid<QTInfo> res = new DataGrid<QTInfo>(); res.setData(Arrays.asList(datas)); res.setTotal(total); return res; } //基础公共检查接口 private abstract class BaseComptInter { Source/plt-web/plt-web-ui/src/api/systemModel/systemConfig/api.js
@@ -9,6 +9,14 @@ }); } // 获取当前用户在线人数 export function getOnlineUsersNum() { return request({ url: "/api/hmSysModConfigController/getOnlineUsersNum", method: "get", }); } // 配置项查询 export function getAppConfigDetailsByID(params) { return request({ Source/plt-web/plt-web-ui/src/views/systemModel/systemMonitor/index.vue
@@ -4,8 +4,8 @@ <el-form ref="form" :model="form" label-width="150px"> <el-form-item label="当前在线用户人数"> <div style="display: flex;"> <el-input v-model="form.name" :readOnly="true"></el-input> <el-button plain style="margin-left: 10px"> 刷新</el-button> <el-input v-model="form.currentOnlineUser" :readOnly="true"></el-input> <el-button plain type="primary" style="margin-left: 10px" @click="getOnlineUsersNum"> 刷新</el-button> </div> </el-form-item> </el-form> @@ -14,14 +14,31 @@ </template> <script> import { getOnlineUsersNum } from "@/api/systemModel/systemConfig/api" export default { name: "index", data() { return { form: { name: '0' currentOnlineUser: '0' } } }, created() { this.getOnlineUsersNum(); }, methods: { // 左侧树查询 getOnlineUsersNum() { getOnlineUsersNum().then(res => { if (res.data.code === 200) { const data = res.data.obj; this.form.currentOnlineUser = data; } }) } } } </script>