From 085df90e488067783759dcd63cdb5fb43a51ff1f Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 26 九月 2024 12:44:04 +0800
Subject: [PATCH] 添加记录当前在线用户人数查询接口
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java | 1
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmHMSysModConfigServiceI.java | 6
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java | 10 +
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/pagemodel/Tree.java | 19 ++
Source/plt-web/plt-web-ui/src/views/systemModel/systemMonitor/index.vue | 23 ++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java | 78 +++++++++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmHMSysModConfigServiceImpl.java | 28 +++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIManagerServiceI.java | 35 ++++
Source/plt-web/plt-web-ui/src/api/systemModel/systemConfig/api.js | 8 +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java | 217 +++++++++++++++++++++++++++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java | 16 ++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/RedisService.java | 35 ++++
12 files changed, 471 insertions(+), 5 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/pagemodel/Tree.java b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/pagemodel/Tree.java
index 809dc3b..19d6de9 100644
--- a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/pagemodel/Tree.java
+++ b/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 琛ㄧず鍙跺瓙鑺傜偣
*/
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmHMSysModConfigServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmHMSysModConfigServiceI.java
index e4e47af..0ace3d0 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmHMSysModConfigServiceI.java
+++ b/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();
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmHMSysModConfigServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmHMSysModConfigServiceImpl.java
index bd566c1..54c8d31 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmHMSysModConfigServiceImpl.java
+++ b/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;
+ /**
+ * 鍒濆鍖杅oDelegate
+ */
{
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 @@
}
}
-
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java
index 98b5e18..0651684 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java
+++ b/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);
+ }
+ }
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java
index 0e37319..547d42d 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java
+++ b/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瀹氫箟涓嬫媺鏌ヨ锛坱emplateType涓篣I瀹氫箟鏃剁殑閫夋嫨瀵硅薄涓嬫媺鏌ヨ锛�
+ * @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);
+ }
+ }
+
+
//椤甸潰璁捐涓嬮厤缃寜閽浉鍏虫帴鍙�
/**
* 鑾峰彇椤电鍖哄煙鎸夐挳閰嶇疆淇℃伅
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/RedisService.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/RedisService.java
index ed55283..7172e62 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/RedisService.java
+++ b/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鑴氭湰瀹炵幇鍘熷瓙鏌ヨ骞跺垹闄�
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIManagerServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIManagerServiceI.java
index 3f393ba..247e847 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/UIManagerServiceI.java
+++ b/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;
+ /**
+ * 涓氬姟绫诲瀷銆佹簮瀵硅薄绫诲瀷銆侀《灞傝妭鐐规樉绀虹被鍨嬬瓑閮借皟鐢ㄨ繖涓帴鍙f煡璇�
+ * @param baseQueryObject
+ * @return
+ * @throws PLException
+ */
+ DataGrid<BizType> getBtmDatasByPage(BaseQueryObject baseQueryObject) throws Throwable;
+
+ /**
+ * UI瀹氫箟涓嬫媺鏌ヨ锛坱emplateType涓篣I瀹氫箟鏃剁殑閫夋嫨瀵硅薄涓嬫媺鏌ヨ锛�
+ * @param baseQueryObject selectBtmType 閫夋嫨鐨勬簮瀵硅薄,甯﹀垎椤典俊鎭�
+ * @return
+ * @throws PLException
+ */
+ DataGrid<PLUILayout> getUILayoutDatasByPage(BaseQueryObject baseQueryObject)throws Throwable;
+
+ /**
+ * 閫夋嫨妯℃澘涓嬫媺鏌ヨ锛坱emplateType涓鸿〃鏍笺�佽〃鍗曘�佹爲琛ㄦ椂鐨勯�夋嫨瀵硅薄涓嬫媺鏌ヨ锛�
+ * @param baseQueryObject
+ * @return
+ * @throws PLException
+ */
+ DataGrid<PortalVI> getPortalVIDatasByPage(BaseQueryObject baseQueryObject) throws Throwable;
+
+ /**
+ * 鏌ヨ妯℃澘涓嬫媺鏌ヨ
+ * @param baseQueryObject
+ * @return
+ * @throws PLException
+ */
+ DataGrid<QTInfo> getQTInfoDatasByPage(BaseQueryObject baseQueryObject)throws Throwable;
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java
index fbe28cb..eb454b7 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LoginServiceImpl.java
+++ b/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());
//鎷疯礉鐢ㄦ埛鍒版柊鐨剆ession浼氳瘽涓�
copyUser2SessionInfo(user, sessionInfo, userDTO.getLangCode());
//鎷疯礉璇锋眰淇℃伅鍒皊ession浼氳瘽涓�
@@ -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) -> {
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
index c73204c..319777c 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
+++ b/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));
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
index 5da58ec..40346aa 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
+++ b/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;
}
+ /**
+ * 涓氬姟绫诲瀷銆佹簮瀵硅薄绫诲瀷銆侀《灞傝妭鐐规樉绀虹被鍨嬬瓑閮借皟鐢ㄨ繖涓帴鍙f煡璇�
+ * @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瀹氫箟涓嬫媺鏌ヨ锛坱emplateType涓篣I瀹氫箟鏃剁殑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;
+ }
+
+ /**
+ * 閫夋嫨妯℃澘涓嬫媺鏌ヨ锛坱emplateType涓鸿〃鏍笺�佽〃鍗曘�佹爲琛ㄦ椂鐨勯�夋嫨瀵硅薄涓嬫媺鏌ヨ锛�
+ * @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 {
diff --git a/Source/plt-web/plt-web-ui/src/api/systemModel/systemConfig/api.js b/Source/plt-web/plt-web-ui/src/api/systemModel/systemConfig/api.js
index 9f2141c..e96a110 100644
--- a/Source/plt-web/plt-web-ui/src/api/systemModel/systemConfig/api.js
+++ b/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({
diff --git a/Source/plt-web/plt-web-ui/src/views/systemModel/systemMonitor/index.vue b/Source/plt-web/plt-web-ui/src/views/systemModel/systemMonitor/index.vue
index 24f5dce..9fb216f 100644
--- a/Source/plt-web/plt-web-ui/src/views/systemModel/systemMonitor/index.vue
+++ b/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>
--
Gitblit v1.9.3