From 8bb85606a294d2c6d2d4840d42a62744d7ef909b Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期五, 27 九月 2024 09:51:54 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/redis/RedisConfig.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmSessionForLoginImpl.java | 2 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/views/modelingMenu/ui/uiDefine/index.vue | 68 + Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/index.vue | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/HMSysModConfigController.java | 16 Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/queryDefine/index.vue | 2 Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciSecurityInterceptor.java | 16 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/src/main/resources/properties/ice.properties | 3 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/LogBasicController.java | 127 +++ Source/plt-web/plt-web-parent/plt-web-base/pom.xml | 17 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogPeriodInfoDTO.java | 26 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogQueryCriteriaDTO.java | 36 + Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/redis/FastJson2JsonRedisSerializer.java | 2 Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PLTabButtonVO.java | 4 Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/redis/RedisService.java | 57 + 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-parent/plt-web-base/src/main/java/com/vci/starter/web/constant/VConstant.java | 5 Source/plt-web/plt-web-parent/plt-web/pom.xml | 17 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java | 1 Source/plt-web/plt-web-ui/src/api/systemModel/systemConfig/api.js | 8 Source/plt-web/plt-web-ui/src/views/wel/index.vue | 6 Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java | 615 ++++++++++--------- 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/util/PlatformClientUtil.java | 2 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 | 22 Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciLogAfterInterceptor.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/LogBasicServiceI.java | 42 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java | 220 ++++++ Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogInfoDTO.java | 34 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LogBasicServiceImpl.java | 390 ++++++++++++ 35 files changed, 1,559 insertions(+), 358 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogInfoDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogInfoDTO.java new file mode 100644 index 0000000..7b432ad --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogInfoDTO.java @@ -0,0 +1,34 @@ +package com.vci.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 鏃ュ織浼犺緭瀵硅薄 + * @author yuxc + * @date 2024-09-18 + */ +@Data +public class LogInfoDTO implements Serializable { + + + /** + * 绂佹淇敼杩欎釜鍊� + */ + private static final long serialVersionUID = 2492852474710986720L; + private String puid; + private String username; + private String truename; + private String userIp; + private String result; + private String content; + private String date; + private String type; + private String moduleName; + private String entityDesc; + private String property; + private String previousVal; + private String newVal; + private String logType; +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogPeriodInfoDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogPeriodInfoDTO.java new file mode 100644 index 0000000..606e6a5 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogPeriodInfoDTO.java @@ -0,0 +1,26 @@ +package com.vci.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 淇濆瓨鏈熼檺浼犺緭瀵硅薄 + * @author yuxc + * @date 2024-09-11 + */ +@Data +public class LogPeriodInfoDTO implements Serializable { + + + /** + * 绂佹淇敼杩欎釜鍊� + */ + private static final long serialVersionUID = 2492852474710986720L; + //缂栫爜 + public String code; + //鍊� + public String value; + //鏄惁閫変腑 + public boolean choose; +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogQueryCriteriaDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogQueryCriteriaDTO.java new file mode 100644 index 0000000..1e26832 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/LogQueryCriteriaDTO.java @@ -0,0 +1,36 @@ +package com.vci.dto; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 鏃ュ織鏌ヨ浼犺緭瀵硅薄 + * @author yuxc + * @date 2024-09-18 + */ +@Data +public class LogQueryCriteriaDTO implements Serializable { + + + /** + * 绂佹淇敼杩欎釜鍊� + */ + private static final long serialVersionUID = 2492852474710986720L; + //寮�濮嬫椂闂� + private String startDate; + //缁撴潫鏃ユ湡 + private String endDate; + //鏃ュ織绫诲瀷锛�1锛氱櫥褰曪紱2锛氱櫥鍑猴紱3锛氭巿鏉冿紱4锛氫竴鑸搷浣滐紱5锛氶泦鎴愬簲鐢� + int logType; + //鐢ㄦ埛IP + String ipText; + //鎿嶄綔鐢ㄦ埛 + String userName; + //鎿嶄綔绫诲瀷 + String typeText; + //椤电爜 + int pageNo; + //椤甸潰鏉℃暟 + int pageSize; +} diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PLTabButtonVO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PLTabButtonVO.java index 8480dbe..9e69eaa 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PLTabButtonVO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/PLTabButtonVO.java @@ -76,7 +76,7 @@ private List<PLTabButtonVO> children; /** - * 鏄惁鏄剧ず + * 鏄剧ず鏂瑰紡 */ private String displayMode; @@ -91,7 +91,7 @@ private String authorization; /** - * 鏄剧ず鏂瑰紡 + * 鏄惁鏄剧ず */ private String show; diff --git a/Source/plt-web/plt-web-parent/plt-web-base/pom.xml b/Source/plt-web/plt-web-parent/plt-web-base/pom.xml index f07c7fa..880a7ba 100644 --- a/Source/plt-web/plt-web-parent/plt-web-base/pom.xml +++ b/Source/plt-web/plt-web-parent/plt-web-base/pom.xml @@ -73,6 +73,23 @@ <artifactId>icegridgui</artifactId> <version>1.0.RELEASE</version> </dependency> + <!--redis start--> + <dependency> + <groupId>org.springframework.data</groupId> + <artifactId>spring-data-redis</artifactId> + <version>2.1.5.RELEASE</version> + </dependency> + <dependency> + <groupId>redis.clients</groupId> + <artifactId>jedis</artifactId> + <version>2.9.0</version> + </dependency> + <!--redis end--> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>2.13.3</version> + </dependency> </dependencies> </project> \ No newline at end of file diff --git a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/constant/VConstant.java b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/constant/VConstant.java index e9c2ddd..5dff82d 100644 --- a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/constant/VConstant.java +++ b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/constant/VConstant.java @@ -82,6 +82,11 @@ public static final String SYS_ENUM_KEY = "sys_enum:"; /** + * 褰撳墠鐧诲綍鐨勭敤鎴锋�绘暟cache key + */ + public static final String CURRENT_LOGGED_USERS_KEY = "current_logged_users"; + + /** * 璧勬簮鏄犲皠璺緞 鍓嶇紑 */ public static final String RESOURCE_PREFIX = "/profile"; diff --git a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciLogAfterInterceptor.java b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciLogAfterInterceptor.java index 334d0a2..cbde7da 100644 --- a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciLogAfterInterceptor.java +++ b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciLogAfterInterceptor.java @@ -1,8 +1,6 @@ package com.vci.starter.web.interceptor; import com.vci.starter.web.constant.TokenKeyConstant; -import com.vci.starter.web.util.VciBaseUtil; -import com.vci.starter.web.util.WebThreadLocalUtil; import org.apache.commons.lang3.StringUtils; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; diff --git a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciSecurityInterceptor.java b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciSecurityInterceptor.java index 9679f27..68ef18a 100644 --- a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciSecurityInterceptor.java +++ b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/interceptor/VciSecurityInterceptor.java @@ -4,9 +4,11 @@ import com.vci.starter.web.annotation.controller.VciUnCheckRight; import com.vci.starter.web.autoconfigure.SpringMVCConfig; import com.vci.starter.web.constant.TokenKeyConstant; +import com.vci.starter.web.constant.VConstant; import com.vci.starter.web.enumpck.ResultCodeEnum; import com.vci.starter.web.pagemodel.BaseResult; import com.vci.starter.web.pagemodel.SessionInfo; +import com.vci.starter.web.redis.RedisService; import com.vci.starter.web.util.ApplicationContextProvider; import com.vci.starter.web.util.LangBaseUtil; import com.vci.starter.web.util.VciBaseUtil; @@ -15,15 +17,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Configuration; -import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.HandlerInterceptor; -import javax.annotation.Resource; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -56,6 +54,9 @@ @Autowired private VciSessionForLoginI vciSessionForLoginI; + @Autowired + private RedisService redisService; + /** * 鎵ц鎷︽埅 * @param request 璇锋眰瀵硅薄 @@ -76,7 +77,7 @@ if(StringUtils.isBlank(userToken)){ userToken = request.getParameter(TokenKeyConstant.USER_TOKEN_KEY); } - if(!(handler instanceof HandlerMethod)){ + if(!(handler instanceof HandlerMethod)){ return true; } @@ -127,6 +128,11 @@ if(logger.isErrorEnabled()) { logger.error("token鍊奸潪娉曪紝鎴栬繃鏈燂紝鎴栬�呯敤鎴峰凡缁忚韪笅绾�," + userToken); } + //鍒犻櫎缂撳瓨涓粺璁$殑鐢ㄦ埛淇℃伅 + if(redisService == null){ + redisService = ApplicationContextProvider.getBean(RedisService.class); + } + redisService.decreOnlineUser(VConstant.CURRENT_LOGGED_USERS_KEY); sendErrorMsg(response,"token鍊奸潪娉曪紝鎴栬繃鏈燂紝鎴栬�呯敤鎴峰凡缁忚韪笅绾�," + userToken,1); return false; }else{ 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/web/redis/FastJson2JsonRedisSerializer.java b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/redis/FastJson2JsonRedisSerializer.java similarity index 97% rename from Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/FastJson2JsonRedisSerializer.java rename to Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/redis/FastJson2JsonRedisSerializer.java index 2112c43..e48ac8a 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/FastJson2JsonRedisSerializer.java +++ b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/redis/FastJson2JsonRedisSerializer.java @@ -1,4 +1,4 @@ -package com.vci.web.redis; +package com.vci.starter.web.redis; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.serializer.SerializerFeature; diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/RedisConfig.java b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/redis/RedisConfig.java similarity index 98% rename from Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/RedisConfig.java rename to Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/redis/RedisConfig.java index 7e64afc..d2375b7 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/RedisConfig.java +++ b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/redis/RedisConfig.java @@ -1,4 +1,4 @@ -package com.vci.web.redis; +package com.vci.starter.web.redis; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.cache.annotation.CachingConfigurerSupport; 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-base/src/main/java/com/vci/starter/web/redis/RedisService.java similarity index 88% rename from Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/redis/RedisService.java rename to Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/redis/RedisService.java index ed55283..b795342 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-base/src/main/java/com/vci/starter/web/redis/RedisService.java @@ -1,4 +1,4 @@ -package com.vci.web.redis; +package com.vci.starter.web.redis; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -11,6 +11,7 @@ import org.springframework.data.redis.serializer.RedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; import java.io.IOException; import java.util.*; @@ -21,10 +22,9 @@ * @author dangsn **/ @SuppressWarnings(value = { "unchecked", "rawtypes" }) -@Component +@Service @Slf4j -public class RedisService -{ +public class RedisService { @Autowired(required = false) public RedisTemplate redisTemplate; @@ -390,6 +390,55 @@ return new ArrayList<>(); } + /** + * 鐢ㄦ埛鐧诲綍 + * @param currentLoggedUserKey + */ + public void increOnlineUser(String currentLoggedUserKey) { + // 妫�鏌ラ敭鏄惁瀛樺湪 + if (!redisTemplate.hasKey(currentLoggedUserKey)) { + // 濡傛灉閿笉瀛樺湪锛屽垵濮嬪寲涓�0 + redisTemplate.opsForValue().set(currentLoggedUserKey, 0); + } + // 鑷鍦ㄧ嚎鐢ㄦ埛鏁� + redisTemplate.opsForValue().increment(currentLoggedUserKey); + } + + /** + * 鐢ㄦ埛鐧诲嚭 + * @param currentLoggedUserKey + */ + public void decreOnlineUser(String currentLoggedUserKey) { + // 妫�鏌ュ綋鍓嶅湪绾跨敤鎴锋暟 + String currentLoggedUser = (String)redisTemplate.opsForValue().get(currentLoggedUserKey); + + if (currentLoggedUser != null) { + Long currentCount = Long.parseLong((String)redisTemplate.opsForValue().get(currentLoggedUserKey)); + if(currentCount > 0){ + + } + // 鑷噺鍦ㄧ嚎鐢ㄦ埛鏁� + redisTemplate.opsForValue().decrement(currentLoggedUserKey); + } + } + + /** + * 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛鎬讳汉鏁� + * @param currentLoggedUserKey + * @return + */ + public long getCurrentOnlineUserCount(String currentLoggedUserKey) { + return Long.parseLong(redisTemplate.opsForValue().get(currentLoggedUserKey).toString()); + } + + /** + * 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛鐨勭敤鎴峰悕鍒楄〃 + * @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/pom.xml b/Source/plt-web/plt-web-parent/plt-web/pom.xml index 039b4d9..a35b80a 100644 --- a/Source/plt-web/plt-web-parent/plt-web/pom.xml +++ b/Source/plt-web/plt-web-parent/plt-web/pom.xml @@ -106,23 +106,6 @@ <version>0.9.11</version> </dependency> - <!--redis start--> - <dependency> - <groupId>org.springframework.data</groupId> - <artifactId>spring-data-redis</artifactId> - <version>2.1.5.RELEASE</version> - </dependency> - <dependency> - <groupId>redis.clients</groupId> - <artifactId>jedis</artifactId> - <version>2.9.0</version> - </dependency> - <!--redis end--> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - <version>2.13.3</version> - </dependency> </dependencies> <build> 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..897ed4a 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 @@ -12,12 +12,14 @@ import com.vci.starter.poi.bo.WriteExcelData; import com.vci.starter.poi.bo.WriteExcelOption; import com.vci.starter.poi.util.ExcelUtil; +import com.vci.starter.web.constant.VConstant; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.BaseResult; import com.vci.starter.web.pagemodel.SessionInfo; import com.vci.starter.web.util.LocalFileUtil; import com.vci.starter.web.util.VciBaseUtil; import com.vci.starter.web.util.WebThreadLocalUtil; +import com.vci.starter.web.redis.RedisService; import com.vci.web.util.Func; import com.vci.web.util.PlatformClientUtil; import org.slf4j.Logger; @@ -45,13 +47,22 @@ private int count = 0; + /** + * 鍖呭惈淇濆瓨妯″潡鏂规硶绛夋搷浣滅被 + */ private static FunctionOperateDelegate foDelegate; + /** + * 鍒濆鍖杅oDelegate + */ { if(Func.isEmpty(foDelegate)){ foDelegate = new FunctionOperateDelegate(); } } + + @Autowired + private RedisService redisService; /** * 鏃ュ織 @@ -770,6 +781,16 @@ WriteExcelOption excelOption = new WriteExcelOption(excelDataList); ExcelUtil.writeDataToFile(excelPath, excelOption); return excelPath; + } + + /** + * 鑾峰彇褰撳墠鍦ㄧ嚎浜烘暟 + * @return + */ + @Override + public long getOnlineUsersNum() { + long currentLoggedUserCount = redisService.getCurrentOnlineUserCount(VConstant.CURRENT_LOGGED_USERS_KEY); + return currentLoggedUserCount; } /** @@ -1585,6 +1606,5 @@ } } - } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmSessionForLoginImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmSessionForLoginImpl.java index 8896f69..34f1d9a 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmSessionForLoginImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmSessionForLoginImpl.java @@ -13,7 +13,7 @@ import com.vci.starter.web.util.*; import com.vci.constant.CacheNameConstant; import com.vci.web.properties.WebProperties; -import com.vci.web.redis.RedisService; +import com.vci.starter.web.redis.RedisService; import com.vci.web.service.WebBoServiceI; import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; 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/LogBasicController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/LogBasicController.java new file mode 100644 index 0000000..f16e2fc --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/LogBasicController.java @@ -0,0 +1,127 @@ +package com.vci.web.controller; +import com.vci.corba.common.PLException; +import com.vci.dto.LogQueryCriteriaDTO; +import com.vci.starter.web.annotation.log.VciBusinessLog; +import com.vci.starter.web.exception.VciBaseException; +import com.vci.starter.web.pagemodel.BaseResult; +import com.vci.starter.web.util.VciBaseUtil; +import com.vci.web.service.LogBasicServiceI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +/** + * 骞冲彴鏃ュ織鎺у埗鍣� + * @author yuxc + * @date 2024-9-11 + */ +@Controller +@RequestMapping("/loginBasicController") +@VciBusinessLog(modelName="鏃ュ織鏈嶅姟") +public class LogBasicController { + + /** + * 鐧诲綍鏈嶅姟 + */ + @Autowired + private LogBasicServiceI logBasicServiceI; + + /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * 鑾峰彇鏃ユ湡淇濆瓨鏈熼檺涓嬫媺鍒楄〃妗� + * @return 鏌ヨ缁撴灉 + */ + @VciBusinessLog(operateName="鏃ユ湡淇濆瓨鏈熼檺") + @GetMapping(value = "/getPeroid") + @ResponseBody + public BaseResult getPeroid(){ + try { + return logBasicServiceI.getPeroid(); + }catch (Exception e){ + e.printStackTrace(); + String errorMsg = "鏌ヨ鍑虹幇閿欒锛屽師鍥狅細"+ VciBaseUtil.getExceptionMessage(e); + logger.error(errorMsg); + throw new VciBaseException(errorMsg); + } + } + + /** + * 淇濆瓨鏈熼檺璁剧疆 + * period 鏈熼檺缂栫爜 + * @return 淇濆瓨缁撴灉 + */ + @VciBusinessLog(operateName="淇濆瓨鏈熼檺璁剧疆") + @PostMapping(value = "/savePeriod") + @ResponseBody + public BaseResult savePeriod(String period){ + try { + return logBasicServiceI.savePeriod(period); + }catch (Exception e){ + e.printStackTrace(); + String errorMsg = "淇濆瓨鍑虹幇閿欒锛屽師鍥狅細"+ VciBaseUtil.getExceptionMessage(e); + logger.error(errorMsg); + throw new VciBaseException(errorMsg); + } + } + + /** + * 鍒犻櫎鏃ュ織 + * period 鏈熼檺缂栫爜 + * @return 淇濆瓨缁撴灉 + */ + @VciBusinessLog(operateName="鍒犻櫎鏃ュ織") + @DeleteMapping(value = "/deleteLog") + @ResponseBody + public BaseResult deleteLog(String deleteDate){ + try { + return logBasicServiceI.deleteLog(deleteDate); + }catch (Exception e){ + e.printStackTrace(); + String errorMsg = "鍒犻櫎鍑虹幇閿欒锛屽師鍥狅細"+ VciBaseUtil.getExceptionMessage(e); + logger.error(errorMsg); + throw new VciBaseException(errorMsg); + } + } + /** + * 鏌ヨ鏃ュ織 + * @param dto 鏌ヨ鏉′欢浼犺緭瀵硅薄 + * @return 鏌ヨ鏁版嵁 + * @throws PLException + */ + @VciBusinessLog(operateName="鏃ュ織鏌ヨ") + @GetMapping(value = "/getLogListByContion") + @ResponseBody + public BaseResult getLogListByContion(@RequestBody LogQueryCriteriaDTO dto){ + try { + return logBasicServiceI.getLogListByContion(dto); + }catch (Exception e){ + e.printStackTrace(); + String errorMsg = "鏌ヨ鏃ュ織鍑虹幇閿欒锛屽師鍥狅細"+ VciBaseUtil.getExceptionMessage(e); + logger.error(errorMsg); + throw new VciBaseException(errorMsg); + } + } + + /** + * 鎿嶄綔鐢ㄦ埛鑾峰彇 + */ + @VciBusinessLog(operateName="鑾峰彇鎿嶄綔鐢ㄦ埛") + @GetMapping(value = "/getOperatingUsers") + @ResponseBody + public BaseResult getOperatingUsers(){ + try { + return logBasicServiceI.getOperatingUsers(); + }catch (Exception e){ + e.printStackTrace(); + 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/service/LogBasicServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/LogBasicServiceI.java new file mode 100644 index 0000000..995a7ce --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/LogBasicServiceI.java @@ -0,0 +1,42 @@ +package com.vci.web.service; + +import com.vci.corba.common.PLException; +import com.vci.dto.LogQueryCriteriaDTO; +import com.vci.starter.web.pagemodel.BaseResult; + +/** + * 骞冲彴鏃ュ織鏈嶅姟 + * @author yuxc + * @date 2024-9-11 + */ +public interface LogBasicServiceI { + + /** + * 鑾峰彇鏃ユ湡淇濆瓨鏈熼檺涓嬫媺鍒楄〃妗� + * @return 鏌ヨ缁撴灉 + */ + BaseResult getPeroid() throws PLException; + /** + * 淇濆瓨鏈熼檺璁剧疆 + * period 鏈熼檺缂栫爜 + * @return 淇濆瓨缁撴灉 + */ + BaseResult savePeriod(String period) throws PLException; + /** + * 鍒犻櫎鏃ュ織 + * period 鏈熼檺缂栫爜 + * @return 淇濆瓨缁撴灉 + */ + BaseResult deleteLog(String deleteDate) throws PLException; + /** + * 鏌ヨ鏃ュ織 + * @param dto 鏌ヨ鏉′欢浼犺緭瀵硅薄 + * @return 鏌ヨ鏁版嵁 + * @throws PLException + */ + BaseResult getLogListByContion(LogQueryCriteriaDTO dto) throws PLException; + /** + * 鎿嶄綔鐢ㄦ埛鑾峰彇 + */ + BaseResult getOperatingUsers() throws PLException; +} 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/LogBasicServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LogBasicServiceImpl.java new file mode 100644 index 0000000..2392826 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/LogBasicServiceImpl.java @@ -0,0 +1,390 @@ +package com.vci.web.service.impl; +import com.vci.client.common.objects.UserObject; +import com.vci.corba.common.PLException; +import com.vci.corba.common.data.UserEntityInfo; +import com.vci.corba.framework.data.UserInfo; +import com.vci.corba.pllog.data.LogInfo; +import com.vci.corba.pllog.data.LogPeriodInfo; +import com.vci.corba.pllog.data.LogType; +import com.vci.dto.LogInfoDTO; +import com.vci.dto.LogPeriodInfoDTO; +import com.vci.dto.LogQueryCriteriaDTO; +import com.vci.starter.web.pagemodel.BaseResult; +import com.vci.web.service.*; +import com.vci.web.util.*; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 涓氬姟绫诲瀷鏈嶅姟 + * @author yuxc + * @date 2024-9-11 + */ +@Service +public class LogBasicServiceImpl implements LogBasicServiceI { + + /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** + * 骞冲彴鐨勮皟鐢ㄥ伐鍏风被 + */ + @Autowired + private PlatformClientUtil platformClientUtil; + public static final String UTF8_BOM="\uFEFF"; + private final String LOG_SAVE_PERIOD = "logSavePeriod";//鏃ュ織淇濆瓨鏈熼檺 + + /** + * 鑾峰彇鏃ユ湡淇濆瓨鏈熼檺涓嬫媺鍒楄〃妗� + * @return 鏌ヨ缁撴灉 + */ + @Override + public BaseResult getPeroid() throws PLException { + //鑾峰彇褰撳墠鏈熼檺璁剧疆 + int curPeriod = platformClientUtil.getLogService().getCurPeriod(); + LogPeriodInfo[] periods = platformClientUtil.getLogService().getPeriods(); + List<LogPeriodInfoDTO> logDTOs = new ArrayList<>(); + for (LogPeriodInfo period : periods) { + LogPeriodInfoDTO dto = new LogPeriodInfoDTO(); + dto.setValue(period.value); + if(period.code.startsWith(UTF8_BOM)) { + period.code=period.code.substring(1); + } + if (Integer.valueOf(period.code) == curPeriod){ + dto.setChoose(true); + } + dto.setCode(period.code); + logDTOs.add(dto); + } + return BaseResult.dataList(logDTOs); + } + + /** + * 淇濆瓨鏈熼檺璁剧疆 + * period 鏈熼檺缂栫爜 + * @return 淇濆瓨缁撴灉 + */ + @Override + public BaseResult savePeriod(String period) throws PLException { + UserEntityInfo userEntityInfo = new UserEntityInfo(); + userEntityInfo.setModules("com.vci.client.log.ui.LogBasicConfPanel"); + userEntityInfo.setUserName(WebUtil.getCurrentUserId()); + boolean b = platformClientUtil.getLogService().savePeriod(period, userEntityInfo); + if(!b){ + return BaseResult.fail("淇濆瓨澶辫触锛�"); + } + return BaseResult.success("淇濆瓨鎴愬姛锛�"); + } + + /** + * 鍒犻櫎鏃ュ織 + * @param deleteDate 鍒犻櫎鐨勬棩鏈� + * @return 鍒犻櫎缁撴灉 + * @throws PLException + */ + @Override + public BaseResult deleteLog(String deleteDate) throws PLException { + if(StringUtils.isBlank(deleteDate)){ + throw new PLException("500", new String[]{"鏃ユ湡涓嶈兘涓虹┖锛�"}); + } + //鑾峰彇褰撳墠鏈熼檺璁剧疆 + int curSavePeriod = platformClientUtil.getLogService().getCurPeriod(); + int monthSpan = 1; + String monthLabel = ""; + LogPeriodInfo[] periods = platformClientUtil.getLogService().getPeriods(); + Map<String, String> periodMap = Arrays.stream(periods).collect(Collectors.toMap(e -> e.code, e -> e.value)); + + + if(curSavePeriod <= 0){ + // 鏈厤缃椂锛屽彧鑳藉垹闄� + monthLabel = periods[0].value; + monthSpan = Integer.valueOf(periods[0].code); + } else { + monthSpan = curSavePeriod;//鏈熼檺code + monthLabel = periodMap.get(String.valueOf(curSavePeriod));//鏈熼檺鏄剧ず鍊� + } + //妫�鏌ュ垹闄ら�昏緫 + checkCanDelete(deleteDate, monthSpan, monthLabel); + boolean res = false; + res = platformClientUtil.getLogService().deleteLog(getDeleteDateString(deleteDate));//鍒犻櫎鏃ュ織 + if(!res){ + return BaseResult.fail("鍒犻櫎澶辫触锛�"); + } + return BaseResult.success("鍒犻櫎鎴愬姛锛�"); + } + + /** + * 鏌ヨ鏃ュ織 + * @param queryDto 鏌ヨ鏉′欢浼犺緭瀵硅薄 + * @return 鏌ヨ鏁版嵁 + * @throws PLException + */ + @Override + public BaseResult getLogListByContion(LogQueryCriteriaDTO queryDto) throws PLException { + String querySql = getSQL(queryDto); + LogInfo[] logInfos = platformClientUtil.getLogService().getLogListByContion(queryDto.getPageNo(),queryDto.getPageSize(),querySql); + List<LogInfoDTO> dtos = new ArrayList<>(); + for (LogInfo logInfo : logInfos) { + LogInfoDTO dto = new LogInfoDTO(); + dto.setLogType(logInfo.logType); + dto.setDate(logInfo.date); + dto.setContent(logInfo.content); + dto.setPuid(logInfo.puid); + dto.setModuleName(logInfo.moduleName); + dto.setEntityDesc(logInfo.entityDesc); + dto.setResult(logInfo.result); + dto.setType(logInfo.type); + dto.setProperty(logInfo.property); + dto.setTruename(logInfo.truename); + dto.setNewVal(logInfo.newVal); + dto.setUserIp(logInfo.userIp); + dto.setUsername(logInfo.username); + dto.setPreviousVal(logInfo.previousVal); + dtos.add(dto); + } + long sumLogRows = platformClientUtil.getLogService().getSumLogRows(querySql); + BaseResult result = new BaseResult(); + result.setSuccess(true); + result.setCode(200); + result.setData(dtos); + result.setTotal(sumLogRows); + return result; + } + /** + * 鎿嶄綔鐢ㄦ埛鑾峰彇 + */ + @Override + public BaseResult getOperatingUsers() throws PLException { + List<UserObject> users = new ArrayList<UserObject>(); + if("secAdmin".equals(WebUtil.getCurrentUserId())){ + users.addAll(getUsersByUserNames(Arrays.asList("auditAdmin"))); + users.addAll(getUsersByUserNames(getUserNameByUserType(2))); + } + else if("auditAdmin".equals(WebUtil.getCurrentUserId())){ + users.addAll(getUsersByUserNames(Arrays.asList("secAdmin", "sysAdmin"))); + } else if("sysAdmin".equals(WebUtil.getCurrentUserId())){ + + } + return BaseResult.dataList(users); + } + + /** + * 鑾峰彇鐢ㄦ埛淇℃伅 + * @param userNames 鐢ㄦ埛鍚嶇О + * @return 鐢ㄦ埛淇℃伅 + * @throws PLException + */ + private List<UserObject> getUsersByUserNames(List<String> userNames) throws PLException { + List<UserObject> userList = new ArrayList<UserObject>(); + for(String userName : userNames){ + UserInfo userInfo = platformClientUtil.getFrameworkService().fetchUserInfoByName(userName); + UserObject user = new UserObject(); + user.setId(userInfo.id); + user.setUserName(userInfo.userName); + user.setPwd(userInfo.pwd); + user.setEmail(userInfo.email); + user.setTrueName(userInfo.trueName); + user.setSpecialties(userInfo.specialties); + user.setDesc(userInfo.desc); + user.setUserType(userInfo.userType); + user.setStatus(userInfo.status); + user.setCreateTime(userInfo.createTime); + user.setCreateUser(userInfo.createUser); + user.setUpdateTime(userInfo.updateTime); + user.setUpdateUser(userInfo.updateUser); + user.setPwdUpdateTime(userInfo.pwdUpdateTime); + user.setGrantor(userInfo.grantor); + user.setSecretGrade(userInfo.secretGrade); + user.setIsDeptLeader(userInfo.isDeptLeader); + userList.add(user); + } + + Collections.sort(userList, new Comparator<UserObject>(){ + @Override + public int compare(UserObject o1, UserObject o2) { + return o1.getUserName().compareTo(o2.getUserName()); + } + }); + return userList; + } + + /** + * 鏍规嵁鐢ㄦ埛绫诲瀷鑾峰彇鐢ㄦ埛鏁版嵁 + * @param userType 鐢ㄦ埛绫诲瀷 + * @return 鐢ㄦ埛鏁版嵁 + * @throws PLException + */ + private List<String> getUserNameByUserType(int userType) throws PLException{ + List<String> userNames = new ArrayList<String>(); + String sql = "select plusername,pltruename from pluser u where u.plusertype = " + String.valueOf(userType); + String[][] valss = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql); + for(String[] vals : valss){ + userNames.add(vals[0]); + } + return userNames; + } + /** + * 鑾峰彇鏌ヨ鏉′欢骞舵嫾鎴怱QL锛屽彧鎷紈here瀛愬彞鍚庨潰鐨凷QL + * @return + */ + public String getSQL(LogQueryCriteriaDTO dto) throws PLException { + StringBuffer sql = new StringBuffer(""); +// int period = getPeriod(LOG_SAVE_PERIOD);//鑾峰彇淇濆瓨鏈熼檺锛屼互鏈堜负鍗曚綅 + int period = platformClientUtil.getLogService().getCurPeriod();;//鑾峰彇淇濆瓨鏈熼檺锛屼互鏈堜负鍗曚綅 + //涓嬮潰鏄嫾鍑篠QL + if(period != 0){ + sql.append(" to_date(PLDATE) >= add_months(to_date(sysdate),"+(-period)+")"); + } + if(dto.getStartDate()!=null&&!dto.getStartDate().trim().equals("")&&!dto.getStartDate().equals("null")){//璧峰鏃ユ湡 + if(!sql.toString().equals("")){ + sql.append(" and "); + } + sql.append(" to_date(PLDATE) >= to_date('"+dto.getStartDate().trim()+"','yyyy-MM-dd') "); + } + if(dto.getEndDate()!=null&&!dto.getEndDate().trim().equals("")&&!dto.getEndDate().equals("null")){//缁撴潫鏃ユ湡 + if(!sql.toString().equals("")){ + sql.append(" and "); + } + sql.append(" trunc(PLDATE) <= to_date('"+dto.getEndDate().trim()+"','yyyy-MM-dd')"); + } + + if(dto.getLogType() == LogType.Login.value()) {//鐧诲叆鐧诲嚭鏃ュ織 + if(!sql.toString().equals("")){ + sql.append(" and "); + } + sql.append("PLLOGTYPE in ('" + getLogTypeString(LogType.Login) +"','" + getLogTypeString(LogType.Logout)+ "')"); + } else if(dto.getLogType() == LogType.Grant.value()) {//鎺堟潈鏃ュ織 + if(!sql.toString().equals("")){ + sql.append(" and "); + } + sql.append("PLLOGTYPE in('" + getLogTypeString(LogType.Grant) + "')"); + } else if(dto.getLogType() == LogType.General.value()) {//涓�鑸搷浣滄棩蹇� + if(!sql.toString().equals("")){ + sql.append(" and "); + } + sql.append("PLLOGTYPE in('" + getLogTypeString(LogType.General) + "')"); + } + if(StringUtils.isNotBlank(dto.getUserName())){//鎿嶄綔鐢ㄦ埛 + if(!dto.getUserName().trim().equals("")){//濡傛灉鐢ㄦ埛鍚嶄负绌烘牸鍒欎笉鍔犵敤鎴锋潯浠� + if(!sql.toString().equals("")){ + sql.append(" and "); + } + if(dto.getUserName().contains("*")){ + dto.setUserName(dto.getUserName().trim().replaceAll("\\*", "%")); + sql.append(" PLUSER like '").append(dto.getUserName().trim()).append("'"); + }else{ + sql.append(" PLUSER = '").append(dto.getUserName().trim()).append("'"); + } + } + } + //鎸塈P鏌ヨ + if(StringUtils.isNotBlank(dto.getIpText())){ + String ip = dto.getIpText().trim(); + if(!sql.toString().equals("")){ + sql.append(" and "); + } + if(ip.trim().contains("*")){//妯$硦鏌ヨ + ip = ip.trim().replaceAll("\\*", "%"); + sql.append(" PLIP like '").append(ip.trim()).append("'"); + }else{ + sql.append(" PLIP = '").append(ip.trim()).append("'"); + } + } + if(StringUtils.isNotBlank(dto.getTypeText())){ + String typeValue = dto.getTypeText(); + sql.append(" and pltype like '%").append(typeValue).append("%'"); + } + //杩囨护鎺塧dmin鍜宒eveloper鐢ㄦ埛鐨勬棩蹇楄褰� + sql.append(" and PLUSER !='admin' and PLUSER !='developer' "); + + sql.append(" and pluser != '" + WebUtil.getCurrentUserId() + "' "); + + + // 瀹夊叏淇濆瘑鍛樹笉鐪嬬郴缁熺鐞嗗憳鐨勬棩蹇� + if("secAdmin".equals(WebUtil.getCurrentUserId())){ + sql.append(" and pluser != 'sysAdmin' "); + } + // 瀹¤绠$悊鍛樺彧鐪嬬郴缁熺鐞嗗憳鍜屽畨鍏ㄤ繚瀵嗗憳鐨勬棩蹇� + else if("auditAdmin".equals(WebUtil.getCurrentUserId())){ + sql.append(" and pluser in ('secAdmin', 'sysAdmin')"); + } + return sql.toString(); + } + protected String getLogTypeString(LogType logType){ + String res = ""; + if(logType == LogType.Login) { + res = "鐧诲綍"; + } else if(logType == LogType.Logout) { + res = "鐧诲嚭"; + } else if(logType == LogType.Grant) { + res = "鎺堟潈"; + } else if(logType == LogType.General) { + res = "涓�鑸搷浣�"; + } else if(logType == LogType.Integration) { + res = "闆嗘垚搴旂敤"; + } + return res; + } + + /** + * 鏃ユ湡瀛楃涓插鐞� + * @param deleteDate 鏃ユ湡瀛楃涓� + * @return 澶勭悊瀹屾垚鐨勬棩鏈熷瓧绗︿覆 + */ + protected String getDeleteDateString(String deleteDate){ + int s = Integer.parseInt(deleteDate.substring(8))+1; + StringBuffer buff = new StringBuffer(); + buff.append(deleteDate.substring(0, 8)); + if(("0"+s).length()>2){ + buff.append(s+""); + }else{ + buff.append("0"+s); + } + return buff.toString(); + } + + /** + * 鍒犻櫎閫昏緫妫�鏌� + * @param deleteDate 鏃ユ湡瀛楃涓� + * @param monthSpan 鏈熼檺code + * @param monthLabel 鏈熼檺鏄剧ず鍊� + * @return + * @throws PLException + */ + private boolean checkCanDelete(String deleteDate, int monthSpan, String monthLabel) throws PLException { + boolean res = false; + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + sdf.parse(deleteDate); + } catch (ParseException e1) { + throw new PLException("500", new String[]{"灏�" + deleteDate + "杞崲鏃ユ湡鏃跺彂鐢熼敊璇紒"}); + } + String sql = "SELECT FLOOR(MONTHS_BETWEEN(SYSDATE, to_date('" + deleteDate + "','yyyy-mm-dd'))) from dual"; + String[][] vals; + try { + vals = platformClientUtil.getQueryService().queryBySqlWithoutKey(sql); + if(vals != null && vals.length > 0 && vals[0].length > 0){ + int spval = Integer.valueOf(vals[0][0]); + if(spval <= monthSpan){ + throw new PLException("500", new String[]{"鍙兘鍒犻櫎 " + monthLabel + " 涔嬪墠鐨勬暟鎹紒"}); + } + } + } catch (PLException e) { + e.printStackTrace(); + e.messages[0] += "璁$畻鏄惁鍙互鍒犻櫎鎸囧畾鏃ユ湡涔嬪墠鐨勬暟鎹椂鍙戠敓閿欒锛�"; + throw new PLException("500", e.messages); + } + res = true; + return res; + } +} 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..bb4ab4f 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 @@ -19,6 +19,7 @@ import com.vci.starter.web.annotation.bus.VciLoginAfter; import com.vci.starter.web.annotation.bus.VciLogoutBefore; import com.vci.starter.web.annotation.bus.VciLogoutPlugin; +import com.vci.starter.web.constant.VConstant; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.interceptor.VciSessionForLoginI; import com.vci.starter.web.pagemodel.RequestClientInfo; @@ -30,7 +31,7 @@ import com.vci.constant.CacheNameConstant; import com.vci.dto.LoginUserDTO; import com.vci.web.properties.WebProperties; -import com.vci.web.redis.RedisService; +import com.vci.starter.web.redis.RedisService; import com.vci.web.service.LoginServiceI; import com.vci.web.util.Func; import com.vci.web.util.PlatformClientUtil; @@ -146,7 +147,7 @@ * @return 鎵ц缁撴灉 * @throws VciBaseException 鍙傛暟閿欒锛岀敤鎴蜂笉鑳界櫥褰曠瓑浼氭姏鍑哄紓甯� */ - private LoginResultBO login(LoginUserDTO userDTO, RequestClientInfo clientInfo, boolean checkPassword/*鍗曠偣鐧诲綍涓嶉渶瑕佹牎楠屽瘑鐮�*/) throws VciBaseException, PLException { + private LoginResultBO login(LoginUserDTO userDTO, RequestClientInfo clientInfo, boolean checkPassword/*鍗曠偣鐧诲綍涓嶉渶瑕佹牎楠屽瘑鐮�*/) throws VciBaseException { LoginResultBO loginResult = new LoginResultBO(); loginResult.setSuccess(false); @@ -167,6 +168,7 @@ String tokenKey = redisService.getCacheObject(userIdTokenKey); redisService.deleteObject(tokenKey); redisService.deleteObject(userIdTokenKey); + redisService.decreOnlineUser(VConstant.CURRENT_LOGGED_USERS_KEY); } //3.鑾峰彇鐢ㄦ埛鐨勫璞★紙瀵硅薄涓寘鍚鑹查儴闂ㄨ繕鏈夊瘑鐮佺瓥鐣ヤ俊鎭�(褰撳墠鐢ㄦ埛娌¤缃瘑鐮佺瓥鐣ュ氨鏄彇鐨勯粯璁ゅ瘑鐮佺瓥鐣�)锛� @@ -242,6 +244,8 @@ sessionInfo.setToken(token); //鍒濆鍖栧钩鍙扮殑token sessionForLogin.initInvocationInfo(sessionInfo); + //璁板綍褰撳墠鐧诲綍浜烘暟鐨勬�绘暟 + redisService.increOnlineUser(VConstant.CURRENT_LOGGED_USERS_KEY); //鎷疯礉鐢ㄦ埛鍒版柊鐨剆ession浼氳瘽涓� copyUser2SessionInfo(user, sessionInfo, userDTO.getLangCode()); //鎷疯礉璇锋眰淇℃伅鍒皊ession浼氳瘽涓� @@ -558,6 +562,8 @@ } }); } + //娓呴櫎瀛樺綋鍓嶇櫥褰曠殑鐢ㄦ埛锛堟�绘暟-1锛� + redisService.decreOnlineUser(VConstant.CURRENT_LOGGED_USERS_KEY); 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/OsActionServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java index 80c21c9..6a05746 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsActionServiceImpl.java @@ -98,6 +98,7 @@ PLActionCls pac = new PLActionCls(); pac.name = pLActionCls.getName(); pac.pid = pLActionCls.getPid(); + pac.id = pLActionCls.getId(); pac.description = pLActionCls.getDescription() == null ? "" : pLActionCls.getDescription(); pac.creator = WebUtil.getCurrentUserId(); pac.createTime = System.currentTimeMillis(); 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 f573031..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 @@ -153,7 +153,7 @@ public List<OsBtmTypeVO> selectAllBtm() { try { return btmDO2VOs(Arrays.stream(platformClientUtil.getBtmService().getBizTypes("")).collect(Collectors.toList())); - } catch (PLException e) { + } catch (PLException e) { throw new RuntimeException(e); } } @@ -166,7 +166,7 @@ @Override @VciUnLog public Map<String, OsBtmTypeVO> selectAllBtmMap() { - return Optional.ofNullable(self.selectAllBtm()).orElseGet(()->new ArrayList<OsBtmTypeVO>()).stream().collect(Collectors.toMap(s->s.getId().toLowerCase(), t->t,(o1,o2)->o1)); + return Optional.ofNullable(self.selectAllBtm()).orElseGet(() -> new ArrayList<OsBtmTypeVO>()).stream().collect(Collectors.toMap(s -> s.getId().toLowerCase(), t -> t, (o1, o2) -> o1)); } /** @@ -178,7 +178,7 @@ @Override public List<OsBtmTypeVO> btmDO2VOs(Collection<BizType> btmItems) { List<OsBtmTypeVO> VOS = new ArrayList<>(); - Optional.ofNullable(btmItems).orElseGet(()->new ArrayList<>()).stream().forEach(btmItem -> { + Optional.ofNullable(btmItems).orElseGet(() -> new ArrayList<>()).stream().forEach(btmItem -> { OsBtmTypeVO vo = btmDO2VO(btmItem); VOS.add(vo); }); @@ -194,7 +194,7 @@ @Override public OsBtmTypeVO btmDO2VO(BizType btmItem) { OsBtmTypeVO vo = new OsBtmTypeVO(); - if(btmItem !=null){ + if (btmItem != null) { vo.setOid(btmItem.oid); vo.setCreator(btmItem.creator); vo.setLastModifier(btmItem.modifier); @@ -202,7 +202,7 @@ // btmItem.createTime鎷垮埌鐨勬槸鏃堕棿鎴筹紝浣嗘槸杩欏効瑕佺殑鏄緥濡�2017-12-27 09:32:20.034杩欐牱鐨勬牸寮忥紝鎵�浠ヤ笉璋冪敤杩欎釜鏂规硶锛屾敼璋冪敤鍏朵粬鏂规硶 //vo.setCreateTime(VciDateUtil.str2Date(String.valueOf(btmItem.createTime),VciDateUtil.DateTimeFormat)); vo.setCreateTime(Func.parse(btmItem.createTime, ConcurrentDateFormat.of(VciDateUtil.DateTimeFormat))); - vo.setLastModifyTime( Func.parse(btmItem.modifyTime, ConcurrentDateFormat.of(VciDateUtil.DateTimeFormat))); + vo.setLastModifyTime(Func.parse(btmItem.modifyTime, ConcurrentDateFormat.of(VciDateUtil.DateTimeFormat))); vo.setTs(Func.parse(btmItem.ts, ConcurrentDateFormat.of(VciDateUtil.DateTimeMillFormat))); } catch (Exception e) { e.printStackTrace(); @@ -221,29 +221,29 @@ vo.setDelimiter(btmItem.delimiter); vo.setfName(btmItem.fName); vo.setVersionRule(String.valueOf(btmItem.verRuleName)); - if(StringUtils.isNotBlank(vo.getRevisionRuleName()) || vo.isInputRevisionFlag()){ + if (StringUtils.isNotBlank(vo.getRevisionRuleName()) || vo.isInputRevisionFlag()) { vo.setRevisionFlag(true); } vo.setLifeCycleIds(Arrays.stream(btmItem.lifeCycles).collect(Collectors.joining(","))); vo.setApNameArray(btmItem.apNameArray); List<OsAttributeVO> attributeVOS = attributeService.listAttrByIds(Arrays.stream(btmItem.apNameArray).collect(Collectors.toList())); List<OsBtmTypeAttributeVO> btmTypeAttributeVOS = new ArrayList<>(); - Optional.ofNullable(attributeVOS).orElseGet(()->new ArrayList<>()).stream().forEach(attributeVO->{ + Optional.ofNullable(attributeVOS).orElseGet(() -> new ArrayList<>()).stream().forEach(attributeVO -> { OsBtmTypeAttributeVO btmTypeAttributeVO = new OsBtmTypeAttributeVO(); - BeanUtil.convert(attributeVO,btmTypeAttributeVO); + BeanUtil.convert(attributeVO, btmTypeAttributeVO); btmTypeAttributeVO.setPkBtmType(vo.getOid()); btmTypeAttributeVO.setBtmTypeId(vo.getId()); btmTypeAttributeVO.setAttributeDataType(attributeVO.getAttributeDataType()); btmTypeAttributeVO.setAttributeLength(attributeVO.getAttrLength()); btmTypeAttributeVO.setDefaultValue(attributeVO.getDefaultValue()); - if("secretgrade".equalsIgnoreCase(attributeVO.getId())){ + if ("secretgrade".equalsIgnoreCase(attributeVO.getId())) { vo.setSecretFlag(true); } - if(StringUtils.isNotBlank(attributeVO.getBtmTypeId())){ + if (StringUtils.isNotBlank(attributeVO.getBtmTypeId())) { btmTypeAttributeVO.setReferFlag(true); btmTypeAttributeVO.setReferBtmTypeId(attributeVO.getBtmTypeId()); } - if(StringUtils.isNotBlank(attributeVO.getEnumId())){ + if (StringUtils.isNotBlank(attributeVO.getEnumId())) { btmTypeAttributeVO.setEnumFlag(true); btmTypeAttributeVO.setEnumItemMap(enumService.getEnumValueMap(btmTypeAttributeVO.getEnumId())); } @@ -262,13 +262,13 @@ */ @Override public List<OsBtmTypeVO> listBtmByIds(Collection<String> btmIds) { - if(CollectionUtils.isEmpty(btmIds)){ + if (CollectionUtils.isEmpty(btmIds)) { return null; } Map<String, OsBtmTypeVO> btmTypeVOMap = self.selectAllBtmMap(); List<OsBtmTypeVO> btmTypeVOS = new ArrayList<>(); - btmIds.stream().forEach(id->{ - if(btmTypeVOMap.containsKey(id.toLowerCase())){ + btmIds.stream().forEach(id -> { + if (btmTypeVOMap.containsKey(id.toLowerCase())) { btmTypeVOS.add(btmTypeVOMap.get(id.toLowerCase())); } }); @@ -283,10 +283,10 @@ */ @Override public OsBtmTypeVO getBtmById(String id) { - if(StringUtils.isBlank(id)){ + if (StringUtils.isBlank(id)) { return null; } - return self.selectAllBtmMap().getOrDefault(id.toLowerCase(),null); + return self.selectAllBtmMap().getOrDefault(id.toLowerCase(), null); } /** @@ -297,33 +297,33 @@ */ @Override public List<OsUsedAttributeVO> listBtmUsedInfo(String btmName) { - return listBtmUsedInfo(btmName,false); + return listBtmUsedInfo(btmName, false); } /** * 鑾峰彇涓氬姟绫诲瀷鐨勫湪鍝釜灞炴�т腑浣跨敤 * - * @param btmId 涓氬姟绫诲瀷 + * @param btmId 涓氬姟绫诲瀷 * @param hasLink 鏄惁鍖呭惈閾炬帴绫诲瀷涓� * @return 寮曠敤鐨勪俊鎭� */ @Override - public List<OsUsedAttributeVO> listBtmUsedInfo(String btmId, boolean hasLink){ - VciBaseUtil.alertNotNull(btmId,"涓氬姟绫诲瀷鐨勫悕绉�"); - List<OsAttributeVO> allReferThisBtmAttributes = Optional.ofNullable(attributeService.selectAllAttribute()).orElseGet(()->new ArrayList<>()).stream().filter(s->btmId.equalsIgnoreCase(s.getBtmTypeId())).collect(Collectors.toList()); - if(CollectionUtils.isEmpty(allReferThisBtmAttributes)){ + public List<OsUsedAttributeVO> listBtmUsedInfo(String btmId, boolean hasLink) { + VciBaseUtil.alertNotNull(btmId, "涓氬姟绫诲瀷鐨勫悕绉�"); + List<OsAttributeVO> allReferThisBtmAttributes = Optional.ofNullable(attributeService.selectAllAttribute()).orElseGet(() -> new ArrayList<>()).stream().filter(s -> btmId.equalsIgnoreCase(s.getBtmTypeId())).collect(Collectors.toList()); + if (CollectionUtils.isEmpty(allReferThisBtmAttributes)) { return null; } //鏍规嵁杩欎簺灞炴�э紝鎵惧畠浣跨敤鐨勪笟鍔$被鍨� - List<OsUsedAttributeVO> usedInfos= new ArrayList<>(); + List<OsUsedAttributeVO> usedInfos = new ArrayList<>(); List<OsBtmTypeVO> btmTypeVOMap = self.selectAllBtmMap().values().stream().collect(Collectors.toList()); List<OsLinkTypeVO> linkTypeVOS = linkTypeService.selectAllLinkMap().values().stream().collect(Collectors.toList()); - allReferThisBtmAttributes.stream().forEach(attribute->{ + allReferThisBtmAttributes.stream().forEach(attribute -> { //鍏朵粬鐨勪笟鍔$被鍨嬪寘鍚簡杩欎釜灞炴�х殑 List<OsBtmTypeVO> usedBtms = btmTypeVOMap.stream().filter(btmTypeVO -> !CollectionUtils.isEmpty(btmTypeVO.getAttributes()) && btmTypeVO.getAttributes().stream().anyMatch(s -> attribute.getId().equalsIgnoreCase(s.getId()))).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(usedBtms)){ - usedBtms.stream().forEach(btm->{ - btm.getAttributes().stream().filter(s->attribute.getId().equalsIgnoreCase(s.getId())).forEach(attrInBtm->{ + if (!CollectionUtils.isEmpty(usedBtms)) { + usedBtms.stream().forEach(btm -> { + btm.getAttributes().stream().filter(s -> attribute.getId().equalsIgnoreCase(s.getId())).forEach(attrInBtm -> { OsUsedAttributeVO usedAttributeVO = new OsUsedAttributeVO(); usedAttributeVO.setId(attrInBtm.getId()); usedAttributeVO.setName(attrInBtm.getName()); @@ -333,11 +333,11 @@ }); }); } - if(hasLink){ - List<OsLinkTypeVO> usedLinks = linkTypeVOS.stream().filter(linkTypeVO -> !CollectionUtils.isEmpty(linkTypeVO.getAttributes()) &&linkTypeVO.getAttributes().stream().anyMatch(s->attribute.getId().equalsIgnoreCase(s.getId())) ).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(usedLinks)){ - usedLinks.stream().forEach(link->{ - link.getAttributes().stream().filter(s->attribute.getId().equalsIgnoreCase(s.getId())).forEach(attrInBtm->{ + if (hasLink) { + List<OsLinkTypeVO> usedLinks = linkTypeVOS.stream().filter(linkTypeVO -> !CollectionUtils.isEmpty(linkTypeVO.getAttributes()) && linkTypeVO.getAttributes().stream().anyMatch(s -> attribute.getId().equalsIgnoreCase(s.getId()))).collect(Collectors.toList()); + if (!CollectionUtils.isEmpty(usedLinks)) { + usedLinks.stream().forEach(link -> { + link.getAttributes().stream().filter(s -> attribute.getId().equalsIgnoreCase(s.getId())).forEach(attrInBtm -> { OsUsedAttributeVO usedAttributeVO = new OsUsedAttributeVO(); usedAttributeVO.setId(attrInBtm.getId()); usedAttributeVO.setName(attrInBtm.getName()); @@ -360,15 +360,15 @@ */ @Override public List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId) throws PLException { - VciBaseUtil.alertNotNull(btmId,"涓氬姟绫诲瀷鐨勭紪鍙�"); + VciBaseUtil.alertNotNull(btmId, "涓氬姟绫诲瀷鐨勭紪鍙�"); BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(btmId); - if(Func.isEmpty(bizTypes)){ + if (Func.isEmpty(bizTypes)) { return new ArrayList<>(); } BizType bizType = bizTypes[0]; OsBtmTypeVO btmTypeVO = btmDO2VO(bizType); List<OsBtmTypeAttributeVO> attributes = btmTypeVO.getAttributes(); - if(attributes == null){ + if (attributes == null) { attributes = new ArrayList<>(); } return attributes.stream().sorted(((o1, o2) -> o1.getId().toLowerCase(Locale.ROOT).compareTo(o2.getId().toLowerCase(Locale.ROOT)))).collect(Collectors.toList()); @@ -383,12 +383,12 @@ @Override public List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId) throws PLException { List<OsBtmTypeAttributeVO> attrVOs = listAttributeByBtmId(btmId); - if(attrVOs == null){ + if (attrVOs == null) { attrVOs = new ArrayList<>(); } - if(!CollectionUtils.isEmpty(attributeService.getDefaultAttributeVOs())) { + if (!CollectionUtils.isEmpty(attributeService.getDefaultAttributeVOs())) { List<OsBtmTypeAttributeVO> finalAttrVOs = attrVOs; - attributeService.getDefaultAttributeVOs().stream().forEach(attr->{ + attributeService.getDefaultAttributeVOs().stream().forEach(attr -> { OsBtmTypeAttributeVO attributeVO = new OsBtmTypeAttributeVO(); BeanUtil.convert(attr, attributeVO); attributeVO.setAttributeDataType(attr.getAttributeDataType()); @@ -412,6 +412,7 @@ /** * 淇敼涓氬姟绫诲瀷涓搴斿睘鎬у悕鐨勫睘鎬� + * * @param apName * @return * @throws PLException @@ -426,7 +427,7 @@ } catch (PLException e1) { e1.printStackTrace(); } - if(abItem == null || abItem.equals("")){ + if (abItem == null || abItem.equals("")) { return true; } try { @@ -434,21 +435,21 @@ } catch (PLException e) { e.printStackTrace(); } - if(btmNames == null || btmNames.length <= 0){ + if (btmNames == null || btmNames.length <= 0) { return true; } btmNameList = Arrays.asList(btmNames); - for(Iterator<String> i = btmNameList.iterator(); i.hasNext();){ + for (Iterator<String> i = btmNameList.iterator(); i.hasNext(); ) { String btmName = i.next(); try { platformClientUtil.getBtmService().modifyBTAttribute(btmName, apName); } catch (PLException e) { // TODO Auto-generated catch block e.printStackTrace(); - String erreMsg = "璋冩暣涓氬姟绫诲瀷涓��"+apName+"銆戝睘鎬ф椂鍑虹幇閿欒锛屽師鍥狅細"+e.getMessage(); + String erreMsg = "璋冩暣涓氬姟绫诲瀷涓��" + apName + "銆戝睘鎬ф椂鍑虹幇閿欒锛屽師鍥狅細" + e.getMessage(); logger.error(erreMsg); - throw new PLException("500",new String[]{erreMsg}); + throw new PLException("500", new String[]{erreMsg}); } } return false; @@ -456,6 +457,7 @@ /** * 鍒ゆ柇璇ュ睘鎬ф槸鍚﹀凡缁忓湪涓氬姟绫诲瀷涓骇鐢熶簡鏁版嵁 + * * @param abName * @return * @throws PLException @@ -463,14 +465,14 @@ @Override public boolean hasInstance(String abName) throws PLException { String[] btmNames = platformClientUtil.getBtmService().getBTNamesByAPName(abName); - if(btmNames == null || btmNames.length == 0){ + if (btmNames == null || btmNames.length == 0) { return false; } - for(int i = 0; i < btmNames.length; i++){ + for (int i = 0; i < btmNames.length; i++) { String btmName = btmNames[i]; boolean flag; flag = platformClientUtil.getBtmService().hasData(btmName); - if(flag){ + if (flag) { return flag; } } @@ -480,13 +482,14 @@ /** * 鑾峰彇鍚嶅瓧浠ilter寮�濮嬬殑涓氬姟绫诲瀷(for 鏌ヨ)锛屼富瑕佺敤浜庡睘鎬ф睜鐨勪笟鍔$被鍨嬮�夋嫨瀵硅瘽妗� * 鑾峰彇鍏ㄩ儴涓氬姟绫诲瀷锛屼紶鍙俧ilter涓�"" + * * @param btmName * @return * @throws PLException */ @Override public BizType[] getBizTypes(String btmName) throws PLException { - if(null == btmName){ + if (null == btmName) { btmName = ""; } return platformClientUtil.getBtmService().getBizTypes(btmName); @@ -494,18 +497,19 @@ /** * 涓氬姟绫诲瀷鍒楄〃鏌ヨ锛岄潪鏍戠粨鏋勶細鐢ㄤ簬UI瀹氫箟宸︿晶涓氬姟绫诲瀷鏌ヨ锛屽彧杩斿洖name鍜宭able + * * @param btmName * @return * @throws PLException */ @Override public Tree getBizTree(String btmName) throws PLException { - if(null == btmName){ + if (null == btmName) { btmName = ""; } Tree returnTree = new Tree(); BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(btmName); - if(Func.isEmpty(bizTypes)){ + if (Func.isEmpty(bizTypes)) { return returnTree; } returnTree.setOid(""); @@ -514,13 +518,13 @@ List<Tree> trees = new ArrayList<>(); Arrays.stream(bizTypes).forEach(bizType -> { Tree tree = new Tree(); - tree.setText(bizType.name + " " +bizType.label); + tree.setText(bizType.name + " " + bizType.label); tree.setOid(bizType.oid); tree.setLeaf(true); tree.setParentName(bizType.fName); Map<String, String> atrrMap = new HashMap<>(); - atrrMap.put("name",bizType.name); - atrrMap.put("lable",bizType.label); + atrrMap.put("name", bizType.name); + atrrMap.put("lable", bizType.label); tree.setAttributes(atrrMap); trees.add(tree); }); @@ -537,7 +541,7 @@ */ @Override public DataGrid<OsBtmTypeVO> referDataGrid(Map<String, String> conditionMap, PageHelper pageHelper) { - DataGrid<OsBtmTypeVO> dataGrid = queryObjectServiceInfoBySql(conditionMap, pageHelper, "plbtmtype",OsBtmTypeVO.class,((data, obj) -> { + DataGrid<OsBtmTypeVO> dataGrid = queryObjectServiceInfoBySql(conditionMap, pageHelper, "plbtmtype", OsBtmTypeVO.class, ((data, obj) -> { obj.setTableName(VciBaseUtil.getTableName(obj.getId())); })); return dataGrid; @@ -552,7 +556,7 @@ @Override public OsBtmTypeVO selectByOid(String oid) { List<OsBtmTypeVO> btmTypeVOS = self.selectAllBtmMap().values().stream().collect(Collectors.toList()); - return Optional.ofNullable(btmTypeVOS).orElseGet(()->new ArrayList<>()).stream().filter(s->s.getOid().equalsIgnoreCase(oid)).findFirst().orElseGet(()->null); + return Optional.ofNullable(btmTypeVOS).orElseGet(() -> new ArrayList<>()).stream().filter(s -> s.getOid().equalsIgnoreCase(oid)).findFirst().orElseGet(() -> null); } /** @@ -564,8 +568,8 @@ @Override public String getNameById(String id) { OsBtmTypeVO btmTypeVO = getBtmById(id); - if(btmTypeVO == null){ - throw new VciBaseException("涓氬姟绫诲瀷[{0}]鍦ㄧ郴缁熼噷涓嶅瓨鍦�",new String[]{id}); + if (btmTypeVO == null) { + throw new VciBaseException("涓氬姟绫诲瀷[{0}]鍦ㄧ郴缁熼噷涓嶅瓨鍦�", new String[]{id}); } return btmTypeVO.getName(); } @@ -582,7 +586,7 @@ List<OsERNodeVO> nodeVOList = new ArrayList<>(); List<OsERRelationVO> relationVOList = new ArrayList<>(); //鐪嬪綋鍓嶈繖涓笟鍔$被鍨嬶紝鍙傜収浜嗗叾浠栫殑鍝簺涓氬姟绫诲瀷 .鎴戜滑涓嶆樉绀哄紩鐢ㄥ綋鍓嶄笟鍔$被鍨嬬殑涓氬姟绫诲瀷 - splicingBtmType2Json(nodeVOList, relationVOList, btmTypeVO,true); + splicingBtmType2Json(nodeVOList, relationVOList, btmTypeVO, true); loadAllLinkTypeByBtmType(nodeVOList, relationVOList, btmTypeVO); OsERVO osERVO = new OsERVO(); osERVO.setTabViewList(nodeVOList); @@ -604,25 +608,25 @@ List<OsUsedAttributeVO> usedAttributeVOS = listBtmUsedInfo(btmTypeVO.getId()); List<OsERNodeVO> nodeVOList = new ArrayList<>(); List<OsERRelationVO> relationVOList = new ArrayList<>(); - splicingBtmType2Json(nodeVOList, relationVOList, btmTypeVO,false); - if(!CollectionUtils.isEmpty(usedAttributeVOS)){ - usedAttributeVOS.stream().forEach(usedAttr->{ + splicingBtmType2Json(nodeVOList, relationVOList, btmTypeVO, false); + if (!CollectionUtils.isEmpty(usedAttributeVOS)) { + usedAttributeVOS.stream().forEach(usedAttr -> { //涓氬姟绫诲瀷鍜岄摼鎺ョ被鍨嬮兘鏈夊彲鑳� - if(BooleanEnum.TRUE.getValue().equalsIgnoreCase(usedAttr.getBusinessType())){ + if (BooleanEnum.TRUE.getValue().equalsIgnoreCase(usedAttr.getBusinessType())) { //涓氬姟绫诲瀷 OsBtmTypeVO linkBtmVO = self.selectAllBtmMap().get(usedAttr.getPkBtmType().toLowerCase(Locale.ROOT)); - splicingBtmType2Json(nodeVOList, relationVOList, linkBtmVO,false); + splicingBtmType2Json(nodeVOList, relationVOList, linkBtmVO, false); OsERRelationVO relationVO = new OsERRelationVO(); relationVO.setTo(btmTypeVO.getId() + " " + btmTypeVO.getName()); relationVO.setFrom(linkBtmVO.getId() + " " + linkBtmVO.getName()); relationVO.setToText("寮曠敤"); relationVOList.add(relationVO); - }else{ + } else { //鏄摼鎺ョ被鍨� OsLinkTypeVO linkTypeVO = linkTypeService.selectAllLinkMap().get(usedAttr.getPkBtmType().toLowerCase(Locale.ROOT)); List<OsLinkTypeVO> linkTypeVOList = new ArrayList<>(); linkTypeVOList.add(linkTypeVO); - splicingLinkType2Json(nodeVOList, relationVOList,linkTypeVOList,btmTypeVO,true); + splicingLinkType2Json(nodeVOList, relationVOList, linkTypeVOList, btmTypeVO, true); } }); } @@ -634,6 +638,7 @@ /** * 鑾峰彇鎵�鏈変笟鍔$被鍨嬶紙鏍戝舰缁撴瀯锛� + * * @return 鏌ヨ缁撴灉 */ @Override @@ -642,18 +647,19 @@ BizType[] bizTypes = getBizTypes(""); OsBtmTypeVO osBtmTypeVO = null; List<OsBtmTypeVO> osBtmTypeVOS = btmDO2VOs(Arrays.asList(bizTypes)); - for(int i = 0; i < osBtmTypeVOS.size(); i++){ + for (int i = 0; i < osBtmTypeVOS.size(); i++) { osBtmTypeVO = osBtmTypeVOS.get(i); - if(osBtmTypeVO.getfName().equals("")){ + if (osBtmTypeVO.getfName().equals("")) { Tree tree = new Tree(); tree.setOid(osBtmTypeVO.getOid()); 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)); + tree.setChildren(getChildren(osBtmTypeVOS, osBtmTypeVO)); rootTreeList.add(tree); } } @@ -663,12 +669,13 @@ /** * 鑾峰彇鎵�鏈変笟鍔$被鍨嬪悕绉伴泦鍚� + * * @return */ @Override public List<String> getAllBtmName() throws PLException { BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(""); - if(null != bizTypes && bizTypes.length > 0){ + if (null != bizTypes && bizTypes.length > 0) { return Arrays.stream(bizTypes).map(bizType -> bizType.name).collect(Collectors.toList()); } return null; @@ -676,6 +683,7 @@ /** * 鑾峰彇涓氬姟鍏ㄩ儴灞炴�х被鍨� + * * @param btmName 涓氬姟绫诲瀷鍚嶇О * @return 灞炴�х殑淇℃伅 */ @@ -723,7 +731,7 @@ vo.setOwner(attribute.creator); vo.setLastModifyTime(new Date(attribute.modifyTime)); String maxLength = AttributeConstants.getOtherValueByType(attribute.other, AttributeConstants.LENGTH); - if(StringUtils.isNotBlank(maxLength)){ + if (StringUtils.isNotBlank(maxLength)) { vo.setAttributeLength(Integer.valueOf(maxLength)); } osBtms.add(vo); @@ -733,12 +741,13 @@ /** * dto杞琩o瀵硅薄 + * * @return */ - private BizType dto2BizType(OsBtmTypeDTO dto){ + private BizType dto2BizType(OsBtmTypeDTO dto) { BizType bizType = new BizType(); bizType.oid = dto.getOid(); - bizType.name =dto.getId(); + bizType.name = dto.getId(); bizType.isAbstract = dto.isAbstractFlag(); bizType.label = dto.getName(); bizType.fName = dto.getfName(); @@ -758,7 +767,7 @@ bizType.delimiter = (dto.getDelimiter() == null ? "" : dto.getDelimiter()); - bizType.verRuleName = Func.isBlank(dto.getVersionRule()) ? 0:Short.parseShort(dto.getVersionRule()); + bizType.verRuleName = Func.isBlank(dto.getVersionRule()) ? 0 : Short.parseShort(dto.getVersionRule()); //bizType.imageName = dto.get; //List<String> attrIdList = dto.getAttributesDTOList().stream().map(OsBtmTypeLinkAttributesDTO::getId).collect(Collectors.toList()); @@ -766,22 +775,23 @@ bizType.apNameArray = dto.getApNameArray().split(",");//attrIdList.toArray(new String[attrIdList.size()]); String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); long timeMillis = System.currentTimeMillis(); - bizType.creator = Func.isBlank(dto.getCreator()) ? userId:dto.getCreator(); - bizType.createTime = Func.isEmpty(dto.getCreateTime()) ? timeMillis:dto.getCreateTime().getTime(); + bizType.creator = Func.isBlank(dto.getCreator()) ? userId : dto.getCreator(); + bizType.createTime = Func.isEmpty(dto.getCreateTime()) ? timeMillis : dto.getCreateTime().getTime(); bizType.modifier = userId; bizType.modifyTime = timeMillis; - bizType.ts = Func.isEmpty(dto.getTs())? timeMillis:dto.getTs().getTime(); + bizType.ts = Func.isEmpty(dto.getTs()) ? timeMillis : dto.getTs().getTime(); return bizType; } /** * 鍒涘缓鏂扮殑涓氬姟绫诲瀷 + * * @return * @throws PLException */ @Override public boolean addBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException { - VciBaseUtil.alertNotNull(btmTypeDTO,"鍒涘缓鐨勪笟鍔$被鍨嬪璞�"); + VciBaseUtil.alertNotNull(btmTypeDTO, "鍒涘缓鐨勪笟鍔$被鍨嬪璞�"); //涓氬姟绫诲瀷鍚嶇О妫�鏌� checkName(btmTypeDTO.getId()); //鐢熷懡鍛ㄦ湡妫�鏌� @@ -815,26 +825,27 @@ /** * 妫�鏌ヤ笟鍔$被鍨嬪悕绉版槸鍚﹀悎瑙� + * * @param btmName * @throws PLException */ private void checkName(String btmName) throws PLException { if (Func.isBlank(btmName)) { - throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶄笉鑳戒负绌�!"}); + throw new PLException("500", new String[]{"涓氬姟绫诲瀷鍚嶄笉鑳戒负绌�!"}); } if (!btmName.matches("[a-z A-Z]*")) { - throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶅彧鑳戒负鑻辨枃瀛楁瘝!"}); + throw new PLException("500", new String[]{"涓氬姟绫诲瀷鍚嶅彧鑳戒负鑻辨枃瀛楁瘝!"}); } int maxLength = platformClientUtil.getBtmService().getBTNameMaxLength(); if (btmName.length() > maxLength) { - throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶉暱搴︿笉鑳借秴杩�" + maxLength}); + throw new PLException("500", new String[]{"涓氬姟绫诲瀷鍚嶉暱搴︿笉鑳借秴杩�" + maxLength}); } if (platformClientUtil.getBtmService().checkRowIsExists(btmName)) { - throw new PLException("500",new String[]{"涓氬姟绫诲瀷鍚嶅凡缁忓瓨鍦�"}); + throw new PLException("500", new String[]{"涓氬姟绫诲瀷鍚嶅凡缁忓瓨鍦�"}); } } @@ -845,19 +856,20 @@ */ private void checkLifeCycle(OsBtmTypeDTO btmTypeDTO) throws PLException { if (Func.isBlank(btmTypeDTO.getLifeCycleId())) { - throw new PLException("500",new String[]{"鐢熷懡鍛ㄦ湡涓嶈兘涓虹┖"}); + throw new PLException("500", new String[]{"鐢熷懡鍛ㄦ湡涓嶈兘涓虹┖"}); } } /** * 閫夋嫨涓�绾х増鏈細蹇呴』閫夋嫨鎴栨墜宸ヨ緭鍏ョ増鏈彿瑙勫垯; 閫夋嫨浜岀骇鐗堟湰锛氬繀椤婚�夋嫨鎴栨墜宸ヨ緭鍏ョ増鏈彿瑙勫垯, (鐗堟鍙峰凡缁忛粯璁ら�夋嫨). + * * @return */ private void checkVersionInfo(OsBtmTypeDTO dto) throws PLException { //闇�瑕佹墜鍔ㄨ緭鍏ョ増鏈椂revisionRuleId涓嶈兘涓虹┖ if (dto.getRevLevel() == 1 || dto.getRevLevel() == 2) { if (Func.isBlank(dto.getRevisionRuleId()) && !dto.isInputRevisionFlag()) { - throw new PLException("500",new String[]{"鐗堟湰鍙疯鍒欎笉鑳戒负绌�"}); + throw new PLException("500", new String[]{"鐗堟湰鍙疯鍒欎笉鑳戒负绌�"}); } } } @@ -865,38 +877,40 @@ /** * 鐗堟湰鏈哄埗淇敼: 浠呭厑璁哥被鍨嬩粠"涓嶅彲淇"鍙樻洿鑷�"涓�绾х増鏈鐞嗘満鍒�","浜岀骇鐗堟湰绠$悊鏈哄埗杩涜璋冩暣"; "涓�绾х増鏈鐞嗘満鍒�"鍙樻洿鑷�"浜岀骇鐗堟湰绠$悊鏈哄埗"; * 涓ょ鏂瑰紡. + * * @param dbBizType 褰撳墠淇敼鍓嶇殑涓氬姟绫诲瀷锛堝簱涓瓨鍌ㄧ殑锛� - * @param dto 褰撳墠淇敼涓氬姟绫诲瀷 + * @param dto 褰撳墠淇敼涓氬姟绫诲瀷 * @throws PLException */ - private void checkRevLevel(BizType dbBizType,OsBtmTypeDTO dto) throws PLException { - if (dbBizType.revLevel == 1 && dto.getRevLevel()==0) { - throw new PLException("500",new String[]{"鐗堟湰鍙樻洿閿欒锛氫笉鑳戒粠涓�绾у彉涓轰笉鍙慨璁�"}); + private void checkRevLevel(BizType dbBizType, OsBtmTypeDTO dto) throws PLException { + if (dbBizType.revLevel == 1 && dto.getRevLevel() == 0) { + throw new PLException("500", new String[]{"鐗堟湰鍙樻洿閿欒锛氫笉鑳戒粠涓�绾у彉涓轰笉鍙慨璁�"}); } if (dbBizType.revLevel == 2 && (dto.getRevLevel() == 1 || dto.getRevLevel() == 0)) { - throw new PLException("500",new String[]{"鐗堟湰鍙樻洿閿欒锛氫笉鑳戒粠浜岀骇鍙樹负涓�绾ф垨涓嶅彲淇"}); + throw new PLException("500", new String[]{"鐗堟湰鍙樻洿閿欒锛氫笉鑳戒粠浜岀骇鍙樹负涓�绾ф垨涓嶅彲淇"}); } } /** * 淇敼涓氬姟绫诲瀷 + * * @param btmTypeDTO * @return * @throws PLException */ @Override public boolean updateBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException { - VciBaseUtil.alertNotNull(btmTypeDTO,"淇敼鐨勪笟鍔$被鍨嬪璞�"); + VciBaseUtil.alertNotNull(btmTypeDTO, "淇敼鐨勪笟鍔$被鍨嬪璞�"); //妫�鏌ョ敓鍛藉懆鏈熸槸鍚﹀悎瑙� checkLifeCycle(btmTypeDTO); //鏌ヨ鏁版嵁搴撲腑鐨勪笟鍔$被鍨� String id = btmTypeDTO.getId(); BizType dbBizType = platformClientUtil.getBtmService().getBizTypeByName(id); - if(Func.isEmpty(dbBizType) || Func.isBlank(dbBizType.oid)){ - throw new PLException("500",new String[]{"褰撳墠淇敼鐨勪笟鍔$被鍨嬩笉瀛樺湪锛�"}); + if (Func.isEmpty(dbBizType) || Func.isBlank(dbBizType.oid)) { + throw new PLException("500", new String[]{"褰撳墠淇敼鐨勪笟鍔$被鍨嬩笉瀛樺湪锛�"}); } //妫�鏌ョ増鏈鍒欎慨鏀规槸鍚﹀悎瑙� - checkRevLevel(dbBizType,btmTypeDTO); + checkRevLevel(dbBizType, btmTypeDTO); checkVersionInfo(btmTypeDTO); //澶勭悊涓氬姟绫诲瀷涓嬬殑灞炴�� List<String> lastAttrList = new ArrayList<>(Arrays.asList(btmTypeDTO.getApNameArray().split(","))); @@ -939,28 +953,29 @@ /** * 鍒犻櫎涓氬姟绫诲瀷 + * * @param btmTypeDTO * @return * @throws PLException */ @Override public boolean deleteBtmType(OsBtmTypeDTO btmTypeDTO) throws PLException { - VciBaseUtil.alertNotNull(btmTypeDTO,"鍒犻櫎鐨勪笟鍔$被鍨�"); + VciBaseUtil.alertNotNull(btmTypeDTO, "鍒犻櫎鐨勪笟鍔$被鍨�"); String btmName = btmTypeDTO.getId(); //鍙兘鍒犻櫎鍙跺瓙鑺傜偣 - if(Func.isNotBlank(btmTypeDTO.getfName())){ - throw new PLException("500",new String[]{"鍙兘鍒犻櫎鍙跺瓙鑺傜偣"}); + if (Func.isNotBlank(btmTypeDTO.getfName())) { + throw new PLException("500", new String[]{"鍙兘鍒犻櫎鍙跺瓙鑺傜偣"}); } // 涓氬姟绫诲瀷琚摼鎺ョ被鍨嬩娇鐢�, 涓嶈兘鍒犻櫎 List<String> usedNameList = linkTypeService.getUsedBtmLinkList(btmName); if (usedNameList != null && usedNameList.size() > 0) { - throw new PLException("500",new String[]{"璇ョ被鍨嬪凡琚摼鎺ョ被鍨嬩娇鐢紝绂佹鍒犻櫎"}); + throw new PLException("500", new String[]{"璇ョ被鍨嬪凡琚摼鎺ョ被鍨嬩娇鐢紝绂佹鍒犻櫎"}); } // 涓氬姟绫诲瀷宸茬粡鐢熸垚浜嗕笟鍔″璞�, 涓嶈兘鍒犻櫎 if (hasInstanceByBtmName(btmName)) { - throw new PLException("500",new String[]{"璇ョ被鍨嬪凡鏈夊疄渚嬶紝绂佹鍒犻櫎"}); + throw new PLException("500", new String[]{"璇ョ被鍨嬪凡鏈夊疄渚嬶紝绂佹鍒犻櫎"}); } - + BizType bizType = new BizType(); bizType.ts = btmTypeDTO.getTs().getTime(); bizType.oid = btmTypeDTO.getOid(); @@ -970,6 +985,7 @@ /** * 涓�鑷存�ф鏌� + * * @return * @throws PLException */ @@ -977,9 +993,9 @@ public BaseResult checkBtmConsistency() throws PLException { String[] result = platformClientUtil.getBtmService().btmConsistencyCheck(); Map<String, String> dbCheckMap = new HashMap<String, String>(); - for(int i = 0; i < result.length; i++){ + for (int i = 0; i < result.length; i++) { String info = result[i]; - if(info.equals("")){ + if (info.equals("")) { continue; } String[] infos = info.split("/DML"); @@ -987,9 +1003,9 @@ String dml = infos[1]; dbCheckMap.put(typeName, dml); } - if(dbCheckMap.size() < 1){ + if (dbCheckMap.size() < 1) { return BaseResult.successMsg("鏁版嵁搴撲腑鐨勮〃缁撴瀯涓庣被鍨嬩竴鑷�,鏃犻渶淇!!"); - }else{ + } else { //闇�瑕佷慨澶嶆椂灏遍渶瑕佺晫闈㈠敜璧峰璇濇杩涜澶勭悊 List<Map> list = new ArrayList<>(); list.add(dbCheckMap); @@ -1001,26 +1017,29 @@ /** * 涓�鑷存�ф鏌ヤ慨澶嶅姛鑳� + * * @param repairData * @return */ @Override public BaseResult executeRepair(String repairData) throws Exception { - Map<String, String> dbCheckMap = new ObjectMapper().readValue(repairData, new TypeReference<Map<String,String>>(){}); + Map<String, String> dbCheckMap = new ObjectMapper().readValue(repairData, new TypeReference<Map<String, String>>() { + }); List<String> list = this.getRepairDML(dbCheckMap); - if(list.size() < 1){ + if (list.size() < 1) { return BaseResult.success(); } try { String[] result = platformClientUtil.getBtmService().executeRepair(list.toArray(new String[0])); return BaseResult.success(result); - }catch (PLException e){ - return BaseResult.fail("涓氬姟绫诲瀷淇澶辫触锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e)); + } catch (PLException e) { + return BaseResult.fail("涓氬姟绫诲瀷淇澶辫触锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e)); } } /** * 鍒涘缓瑙嗗浘 + * * @return * @throws PLException */ @@ -1031,6 +1050,7 @@ /** * 鍒犻櫎鏁版嵁鐣岄潰鐨勬煡璇� + * * @return 涓氬姟绫诲瀷锛岄摼鎺ョ被鍨� */ @Override @@ -1039,11 +1059,11 @@ List<String> allBtmName = this.getAllBtmName(); //鑾峰彇閾炬帴绫诲瀷鍚嶇О闆嗗悎 List<String> allLinkType = linkTypeService.getAllLtName(); - Map<String,List> map = new HashMap<>(); - map.put("btmType",allBtmName); - map.put("linkType",allLinkType); - map.put("table",tableList); - map.put("workFlow",workFlowTableList); + Map<String, List> map = new HashMap<>(); + map.put("btmType", allBtmName); + map.put("linkType", allLinkType); + map.put("table", tableList); + map.put("workFlow", workFlowTableList); List<Map> list = new ArrayList<>(); list.add(map); return BaseResult.dataList(list); @@ -1051,24 +1071,25 @@ /** * 鍒犻櫎鏁版嵁 - * @param btmNames 涓氬姟绫诲瀷鍚� + * + * @param btmNames 涓氬姟绫诲瀷鍚� * @param linkNames 閾炬帴绫诲瀷鍚� * @return * @throws PLException */ @Override - public List<Map> truncateTable(String[] btmNames,String[] linkNames) throws PLException { + public List<Map> truncateTable(String[] btmNames, String[] linkNames) throws PLException { List<Map> returnMapList = new ArrayList<>(); Map<String, List<String>> map = new HashMap<>(); - map.put("btmSuccess",new ArrayList<>()); - map.put("btmFail",new ArrayList<>()); - map.put("linkSuccess",new ArrayList<>()); - map.put("linkFail",new ArrayList<>()); - if(Func.isNotEmpty(btmNames)){ - for(int i = 0; i < btmNames.length; i++){ + map.put("btmSuccess", new ArrayList<>()); + map.put("btmFail", new ArrayList<>()); + map.put("linkSuccess", new ArrayList<>()); + map.put("linkFail", new ArrayList<>()); + if (Func.isNotEmpty(btmNames)) { + for (int i = 0; i < btmNames.length; i++) { String btName = btmNames[i]; try { - if(platformClientUtil.getBtmService().truncateTable(btName)){ + if (platformClientUtil.getBtmService().truncateTable(btName)) { //淇敼鎴愬姛璁板綍涓嬫垚鍔熺殑涓氬姟绫诲瀷鍚� map.get("btmSuccess").add(btName); } @@ -1080,12 +1101,12 @@ } } } - if(Func.isNotEmpty(linkNames)){ + if (Func.isNotEmpty(linkNames)) { //truncate閾炬帴绫诲瀷鏁版嵁 - for(int i = 0; i < linkNames.length; i++){ + for (int i = 0; i < linkNames.length; i++) { String ltName = linkNames[i]; try { - if(platformClientUtil.getLinkTypeService().truncateTable(ltName)){ + if (platformClientUtil.getLinkTypeService().truncateTable(ltName)) { map.get("linkSuccess").add(ltName); } } catch (PLException e1) { @@ -1101,6 +1122,7 @@ /** * 鍒犻櫎鍏ㄩ儴绫诲瀷 + * * @return * @throws PLException */ @@ -1108,7 +1130,7 @@ public BaseResult deleteAllType() throws PLException { DeleteType deleteType = new DeleteType(); //鑾峰彇寰呭垹闄ょ殑涓氬姟绫诲瀷 - List<BizType> delBtList = deleteType.getDelBtList(); + List<BizType> delBtList = deleteType.getDelBtList(); //鑾峰彇寰呭垹闄ょ殑閾炬帴绫诲瀷 List<LinkType> ltNames = deleteType.getDelLtList(); //鑾峰彇寰呭垹闄ょ殑灞炴�� @@ -1125,7 +1147,7 @@ platformClientUtil.getBtmService().deleteBtsAndTables(delBtList.toArray(new BizType[0])); } catch (PLException e) { e.printStackTrace(); - String exceptionMessage = "娓呴櫎涓氬姟绫诲瀷鍜屽搴旇〃鏍兼椂鍑虹幇寮傚父锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e); + String exceptionMessage = "娓呴櫎涓氬姟绫诲瀷鍜屽搴旇〃鏍兼椂鍑虹幇寮傚父锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } @@ -1133,7 +1155,7 @@ ClientServiceProvider.getOMDService().getLinkTypeService().deleteLtsAndTables(ltNames.toArray(new LinkType[0])); } catch (PLException e) { e.printStackTrace(); - String exceptionMessage = "娓呴櫎閾炬帴绫诲瀷鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e); + String exceptionMessage = "娓呴櫎閾炬帴绫诲瀷鏃跺嚭鐜板紓甯革紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } @@ -1142,7 +1164,7 @@ platformClientUtil.getAttributeService().deleteAttributeDefs(abs); } catch (PLException e) { e.printStackTrace(); - String exceptionMessage = "娓呴櫎灞炴�ф睜灞炴�ф椂鍑虹幇寮傚父锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e); + String exceptionMessage = "娓呴櫎灞炴�ф睜灞炴�ф椂鍑虹幇寮傚父锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } @@ -1150,7 +1172,7 @@ platformClientUtil.getEnumService().deleteEnumTypes(delEnumList.toArray(new EnumType[0])); } catch (PLException e) { e.printStackTrace(); - String exceptionMessage = "娓呴櫎鏋氫妇绫诲瀷鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e); + String exceptionMessage = "娓呴櫎鏋氫妇绫诲瀷鏃跺嚭鐜板紓甯革紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } @@ -1158,7 +1180,7 @@ platformClientUtil.getLifeCycleService().deleteLifeCycles(delLCList.toArray(new LifeCycle[0])); } catch (PLException e) { e.printStackTrace(); - String exceptionMessage = "娓呴櫎鐢熷懡鍛ㄦ湡鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e); + String exceptionMessage = "娓呴櫎鐢熷懡鍛ㄦ湡鏃跺嚭鐜板紓甯革紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } @@ -1166,7 +1188,7 @@ platformClientUtil.getStatePoolService().deleteStatePools(delStateList.toArray(new StatePool[0])); } catch (PLException e) { e.printStackTrace(); - String exceptionMessage = "娓呴櫎鐘舵�佹睜鐘舵�佹椂鍑虹幇寮傚父锛屽師鍥狅細"+VciBaseUtil.getExceptionMessage(e); + String exceptionMessage = "娓呴櫎鐘舵�佹睜鐘舵�佹椂鍑虹幇寮傚父锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } @@ -1174,7 +1196,7 @@ platformClientUtil.getVersionService().deleteVersionRules(delVRList.toArray(new VersionRule[0])); } catch (PLException e) { e.printStackTrace(); - String exceptionMessage = "娓呴櫎鐗堟湰瑙勫垯鏃跺嚭鐜板紓甯革紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e); + String exceptionMessage = "娓呴櫎鐗堟湰瑙勫垯鏃跺嚭鐜板紓甯革紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } @@ -1183,12 +1205,13 @@ /** * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉拌幏鍙栧凡鏈夌殑绱㈠紩 + * * @param conditionMap 鏍规嵁鏌ヨ鏉′欢浼犲弬: typename:涓氬姟绫诲瀷鍚�; * @return */ @Override - public List<IndexObject> getIndexByCondition(Map<String,String> conditionMap) throws PLException { - if(Func.isEmpty(conditionMap)){ + public List<IndexObject> getIndexByCondition(Map<String, String> conditionMap) throws PLException { + if (Func.isEmpty(conditionMap)) { return new ArrayList<>(); } List<String> indexNameList = new ArrayList<String>(); @@ -1205,15 +1228,15 @@ //HashMap<String, String> indexmap = new HashMap<String, String>(); BusinessObject findBTMObjects[] = platformClientUtil.getQueryService().findBTMObjects(qtl.getId(), OQTool.qtTOXMl(qtl).asXML()); List<IndexObject> indexObjects = new ArrayList<>(); - for(int i = 0; i < findBTMObjects.length; i++) { + for (int i = 0; i < findBTMObjects.length; i++) { BusinessObject findBTMObject = findBTMObjects[i]; IndexObject indexObject = new IndexObject(); indexObject.setOid(findBTMObject.oid); indexObject.setDescription(findBTMObject.description); - indexObject.setCreateTime(Func.format(new Date(findBTMObject.createTime),DateUtil.PATTERN_DATE)); - indexObject.setIndexName(ObjectTool.getBOAttributeValue(findBTMObject,"indexname")); - indexObject.setTypeName(ObjectTool.getBOAttributeValue(findBTMObject,"typename")); - indexObject.setAttrNames(ObjectTool.getBOAttributeValue(findBTMObject,"attrname")); + indexObject.setCreateTime(Func.format(new Date(findBTMObject.createTime), DateUtil.PATTERN_DATE)); + indexObject.setIndexName(ObjectTool.getBOAttributeValue(findBTMObject, "indexname")); + indexObject.setTypeName(ObjectTool.getBOAttributeValue(findBTMObject, "typename")); + indexObject.setAttrNames(ObjectTool.getBOAttributeValue(findBTMObject, "attrname")); indexObjects.add(indexObject); } return indexObjects; @@ -1221,18 +1244,19 @@ /** * 鏍规嵁涓氬姟绫诲瀷鍚嶇О鍜屽叾涓嬬殑灞炴�у悕绉板垹闄ょ储寮� + * * @param btmName * @param indexName * @return */ @Override public boolean delIndex(String btmName, String indexName) throws PLException { - VciBaseUtil.alertNotNull(btmName,"涓氬姟绫诲瀷鍚�",indexName,"绱㈠紩鍚�"); + VciBaseUtil.alertNotNull(btmName, "涓氬姟绫诲瀷鍚�", indexName, "绱㈠紩鍚�"); Map<String, String> conditionMap = new HashMap<>(); - conditionMap.put("typename",btmName); - conditionMap.put("indexname",indexName); + conditionMap.put("typename", btmName); + conditionMap.put("indexname", indexName); List<IndexObject> bo2 = getIndexByCondition(conditionMap); - if(bo2!=null && bo2.size()>0) { + if (bo2 != null && bo2.size() > 0) { String[] indexAttr = {indexName}; boolean alterFlag = platformClientUtil.getBtmService().dropIndex(btmName, indexAttr); @@ -1243,7 +1267,7 @@ for (int i = 0; i < bo2.size(); i++) { String oid = bo2.get(i).getOid(); BusinessObject bo = platformClientUtil.getBOFactoryService().readBusinessObject(oid, "indexobject"); - platformClientUtil.getBOFactoryService().deleteBusinessObject(bo,1); + platformClientUtil.getBOFactoryService().deleteBusinessObject(bo, 1); } } return true; @@ -1251,12 +1275,13 @@ /** * 缁欎笟鍔$被鍨嬩笅鐨勬寚瀹氬睘鎬ф柊澧炵储寮� + * * @param indexObjectList * @return */ @Override public boolean addIndex(List<IndexObject> indexObjectList) throws PLException { - VciBaseUtil.alertNotNull(indexObjectList,"鏂板鐨勭储寮曚俊鎭�"); + VciBaseUtil.alertNotNull(indexObjectList, "鏂板鐨勭储寮曚俊鎭�"); String btmName = indexObjectList.get(0).getTypeName(); String indexNames = indexObjectList.stream().map(IndexObject::getIndexName).collect(Collectors.joining(",")); String[] oldindexAttr = {indexNames}; @@ -1264,23 +1289,23 @@ List<BusinessObject> boList = new ArrayList<>(); //鍏堟煡璇㈠綋鍓嶆坊鍔犵储寮曟槸鍚﹀凡缁忓瓨鍦紝濡傛灉瀛樺湪灏卞厛鍒犻櫎鍐嶆柊澧炲疄鐜版浛鎹㈡搷浣� Map<String, String> conditionMap = new HashMap<>(); - conditionMap.put("typename",btmName); + conditionMap.put("typename", btmName); //鍏堣繖鏍峰鐞嗭紝鍓嶇鐜板湪鍙仛浜嗗崟娆′繚瀛橈紝鎵�浠ヤ笉鐢╥n conditionMap.put("indexname", indexNames); List<IndexObject> indexObjects = getIndexByCondition(conditionMap); - if(indexObjects!=null && indexObjects.size()>0){ + if (indexObjects != null && indexObjects.size() > 0) { //绱㈠紩涓嶅瓨鍦ㄦ椂鍒犻櫎灏变細鎶ラ敊绱㈠紩涓嶅瓨鍦紝鎵�浠ヨ繖閲屾湁绱㈠紩鎵嶅幓鍒犻櫎 boolean b = platformClientUtil.getBtmService().dropIndex(btmName, oldindexAttr); - if(b){ - for(int i = 0; i < indexObjects.size(); i ++){ + if (b) { + for (int i = 0; i < indexObjects.size(); i++) { String oid = (String) indexObjects.get(i).getOid(); - bo = platformClientUtil.getBOFactoryService().readBusinessObject(oid,"indexobject"); - platformClientUtil.getBOFactoryService().deleteBusinessObject(bo,1); + bo = platformClientUtil.getBOFactoryService().readBusinessObject(oid, "indexobject"); + platformClientUtil.getBOFactoryService().deleteBusinessObject(bo, 1); } } } - for(int i = 0; i < indexObjectList.size(); i ++){ + for (int i = 0; i < indexObjectList.size(); i++) { IndexObject indexObject = indexObjectList.get(i); //bo = platformClientUtil.getBOFService().initBusinessObject("indexobject"); bo = boService.createCBOByBtmName("indexobject"); @@ -1290,11 +1315,11 @@ attributeValues.add(new AttributeValue("attrname", indexObject.getAttrNames())); bo.newAttrValList = attributeValues.toArray(new AttributeValue[attributeValues.size()]); bo.description = indexObject.getDescription(); - String[] indexAttr = {indexObject.getIndexName(),indexObject.getAttrNames()}; + String[] indexAttr = {indexObject.getIndexName(), indexObject.getAttrNames()}; //缁欐寚瀹氫笟鍔$被鍨嬬殑鎸囧畾灞炴�у垱寤虹储寮� boolean alterFlag = platformClientUtil.getBtmService().addIndex(btmName, indexAttr); //绱㈠紩鍒涘缓鎴愬姛涔嬪悗锛岄渶瑕佸瓨鍌ㄦ垚鍔熺储寮曞埌绱㈠紩琛ㄤ腑 - if(!alterFlag){ + if (!alterFlag) { return false; } boList.add(bo); @@ -1302,13 +1327,14 @@ //platformClientUtil.getBOFactoryService().createBusinessObject(bo,false,false); } //娣诲姞绱㈠紩淇℃伅鍒扮储寮曠殑涓氬姟琛ㄤ腑 - platformClientUtil.getBOFactoryService().batchCreateBusinessObject(boList.toArray(new BusinessObject[boList.size()]),false,false); + platformClientUtil.getBOFactoryService().batchCreateBusinessObject(boList.toArray(new BusinessObject[boList.size()]), false, false); return true; } /** * 瀵煎嚭涓氬姟绫诲瀷 * oid 涓氬姟绫诲瀷鍚嶇О + * * @return 鍒涘缓缁撴灉 */ @Override @@ -1319,7 +1345,7 @@ //璁剧疆鍒楀悕 List<String> columns = new ArrayList<>( Arrays.asList("绫诲瀷鍚嶇О", "鏍囩", "缁ф壙鑷�", "瀹炵幇绫�", "鎻忚堪", "鐗堟湰瑙勫垯", "鐗堟湰鍙疯鍒�", - "鏄惁鎵嬪伐杈撳叆","鍒嗛殧绗�", "鐗堟鍙疯鍒�","鐢熷懡鍛ㄦ湡", "澶囬�夌敓鍛藉懆鏈熷垪琛�","灞炴�у垪琛�") + "鏄惁鎵嬪伐杈撳叆", "鍒嗛殧绗�", "鐗堟鍙疯鍒�", "鐢熷懡鍛ㄦ湡", "澶囬�夌敓鍛藉懆鏈熷垪琛�", "灞炴�у垪琛�") ); try { new File(excelPath).createNewFile(); @@ -1327,25 +1353,25 @@ List<WriteExcelData> excelDataList = new ArrayList<>(); //璁剧疆鍒楀ご for (int index = 0; index < columns.size(); index++) { - excelDataList.add(new WriteExcelData(0,index, columns.get(index))); + excelDataList.add(new WriteExcelData(0, index, columns.get(index))); } HashSet<String> attributes = new HashSet<>(); int i = 0; for (String name : names.split(",")) { BizType bizType = platformClientUtil.getBtmService().getBizTypeByName(name); - excelDataList.add(new WriteExcelData(i+1,0, bizType.name)); - excelDataList.add(new WriteExcelData(i+1,1, bizType.label)); - excelDataList.add(new WriteExcelData(i+1,2, bizType.fName)); - excelDataList.add(new WriteExcelData(i+1,3, bizType.implClass)); - excelDataList.add(new WriteExcelData(i+1,4, bizType.description)); - excelDataList.add(new WriteExcelData(i+1,5, bizType.revLevel)); - excelDataList.add(new WriteExcelData(i+1,6, bizType.revRuleName)); - excelDataList.add(new WriteExcelData(i+1,7, bizType.revInput)); - excelDataList.add(new WriteExcelData(i+1,8, bizType.delimiter)); - excelDataList.add(new WriteExcelData(i+1,9, bizType.verRuleName)); - excelDataList.add(new WriteExcelData(i+1,10, bizType.lifeCycle)); - excelDataList.add(new WriteExcelData(i+1,11, String.join(",",bizType.lifeCycles))); - excelDataList.add(new WriteExcelData(i+1,12, String.join(",",bizType.apNameArray))); + excelDataList.add(new WriteExcelData(i + 1, 0, bizType.name)); + excelDataList.add(new WriteExcelData(i + 1, 1, bizType.label)); + excelDataList.add(new WriteExcelData(i + 1, 2, bizType.fName)); + excelDataList.add(new WriteExcelData(i + 1, 3, bizType.implClass)); + excelDataList.add(new WriteExcelData(i + 1, 4, bizType.description)); + excelDataList.add(new WriteExcelData(i + 1, 5, bizType.revLevel)); + excelDataList.add(new WriteExcelData(i + 1, 6, bizType.revRuleName)); + excelDataList.add(new WriteExcelData(i + 1, 7, bizType.revInput)); + excelDataList.add(new WriteExcelData(i + 1, 8, bizType.delimiter)); + excelDataList.add(new WriteExcelData(i + 1, 9, bizType.verRuleName)); + excelDataList.add(new WriteExcelData(i + 1, 10, bizType.lifeCycle)); + excelDataList.add(new WriteExcelData(i + 1, 11, String.join(",", bizType.lifeCycles))); + excelDataList.add(new WriteExcelData(i + 1, 12, String.join(",", bizType.apNameArray))); attributes.addAll(Arrays.asList(bizType.apNameArray)); i++; } @@ -1353,20 +1379,21 @@ ExcelUtil.writeDataToFile(excelPath, excelOption); //瀵煎嚭灞炴�� String attrPath = attributeService.exportAttributes("btmattr", - attributes.stream().collect(Collectors.joining(",")),true); + attributes.stream().collect(Collectors.joining(",")), true); //绉诲姩灞炴�у埌閾炬帴绫诲瀷鏂囦欢澶归噷闈㈠幓 - FileUtil.move(new File(attrPath), new File(defaultTempFolder),true); - FileUtil.del(attrPath.substring(0,attrPath.lastIndexOf("\\"))); - }catch (IOException e) { + FileUtil.move(new File(attrPath), new File(defaultTempFolder), true); + FileUtil.del(attrPath.substring(0, attrPath.lastIndexOf("\\"))); + } catch (IOException e) { throw new RuntimeException(e); } File zip = ZipUtil.zip(defaultTempFolder); FileUtil.del(defaultTempFolder + File.separator); - ControllerUtil.writeFileToResponse(response,zip.getAbsoluteFile()); + ControllerUtil.writeFileToResponse(response, zip.getAbsoluteFile()); } /** * 瀵煎叆涓氬姟绫诲瀷 + * * @param file 涓婁紶鐨勬枃浠� * @return */ @@ -1392,8 +1419,8 @@ } } //TODO锛氬鍏ュ睘鎬э紝浣嗘槸杩欎釜閫昏緫瀹為檯涓婂瓨鍦ㄤ竴浜涢棶棰橈紝瀵煎叆鐨勫睘鎬у彧鏄笟鍔$被鍨嬬殑灞炴�т笉搴旇鍘荤粰灞炴�ф睜瀵煎叆锛屽彲鑳芥槸鎯崇殑灞炴�т笉瀛樺湪鐨勫氨鏂板涓�娆� - BaseResult baseResult = attributeService.importAttributes(attrExcel,true); - if(!baseResult.isSuccess()){ + BaseResult baseResult = attributeService.importAttributes(attrExcel, true); + if (!baseResult.isSuccess()) { //鍒犻櫎涓婁紶鐨勬枃浠跺す FileUtil.del(defaultTempFolder + File.separator); return baseResult; @@ -1408,13 +1435,14 @@ return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"娌℃湁瀵煎叆鐨勯摼鎺ユ枃浠躲�傚鍏ョ粓姝紒"}); } } - try{ + try { //1銆佽鍙杄xcel涓殑鏁版嵁锛岀粍鎴愬璞� ReadExcelOption excelOption = new ReadExcelOption(); - List<OsBtmTypePO> poList = ExcelUtil.readDataObjectFromExcel(btmExcel, OsBtmTypePO.class,excelOption,(value, po, fieldName)->{}); + List<OsBtmTypePO> poList = ExcelUtil.readDataObjectFromExcel(btmExcel, OsBtmTypePO.class, excelOption, (value, po, fieldName) -> { + }); //鍘婚櫎閮芥槸绌虹殑鎯呭喌 - if(CollectionUtils.isEmpty(poList)){ - return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{}); + if (CollectionUtils.isEmpty(poList)) { + return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL, new String[]{}); } //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級 Map<String, String> excelReapeat = new HashMap<>(); @@ -1422,25 +1450,25 @@ //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫 poList.stream().forEach(osBtmTypePO -> { - if(Func.isBlank(osBtmTypePO.getName())){//灞炴�у悕鍒ょ┖ - throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛宯ame"); - }else if(osBtmTypePO.getName().length() > maxLength){ - throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛屼笟鍔$被鍨嬪悕闀垮害涓嶈兘瓒呰繃" + maxLength); - }else if(!osBtmTypePO.getName().matches("^[A-Za-z]+$")){ - throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛屼笟鍔$被鍨嬪悕绉板彧鑳戒负鑻辨枃瀛楁瘝"); - }else if (osBtmTypePO.getName().length() > maxLength) { - throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛屼笟鍔$被鍨嬪悕闀垮害涓嶈兘瓒呰繃" + maxLength); - }else if(excelReapeat.containsKey(osBtmTypePO.getName())){//涓氬姟绫诲瀷鍚嶅湪琛ㄦ牸涓垽閲� - throw new VciBaseException("绗��"+excelReapeat.get(osBtmTypePO.getName())+"銆戣鍜岀銆�"+osBtmTypePO.getRowIndex()+"銆戣鏁版嵁锛屼笟鍔$被鍨嬪悕閲嶅"); - }else if (Func.isBlank(osBtmTypePO.getLifeCycle())) { - throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛岀敓鍛藉懆鏈熶笉鑳戒负绌�"); - }else if ("true".equalsIgnoreCase(osBtmTypePO.getRevInput()) && Func.isBlank(osBtmTypePO.getRevRuleName())) { - throw new VciBaseException("绗��"+osBtmTypePO.getRowIndex()+"銆戣锛岀増鏈彿瑙勫垯涓嶈兘涓虹┖"); + if (Func.isBlank(osBtmTypePO.getName())) {//灞炴�у悕鍒ょ┖ + throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛宯ame"); + } else if (osBtmTypePO.getName().length() > maxLength) { + throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛屼笟鍔$被鍨嬪悕闀垮害涓嶈兘瓒呰繃" + maxLength); + } else if (!osBtmTypePO.getName().matches("^[A-Za-z]+$")) { + throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛屼笟鍔$被鍨嬪悕绉板彧鑳戒负鑻辨枃瀛楁瘝"); + } else if (osBtmTypePO.getName().length() > maxLength) { + throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛屼笟鍔$被鍨嬪悕闀垮害涓嶈兘瓒呰繃" + maxLength); + } else if (excelReapeat.containsKey(osBtmTypePO.getName())) {//涓氬姟绫诲瀷鍚嶅湪琛ㄦ牸涓垽閲� + throw new VciBaseException("绗��" + excelReapeat.get(osBtmTypePO.getName()) + "銆戣鍜岀銆�" + osBtmTypePO.getRowIndex() + "銆戣鏁版嵁锛屼笟鍔$被鍨嬪悕閲嶅"); + } else if (Func.isBlank(osBtmTypePO.getLifeCycle())) { + throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛岀敓鍛藉懆鏈熶笉鑳戒负绌�"); + } else if ("true".equalsIgnoreCase(osBtmTypePO.getRevInput()) && Func.isBlank(osBtmTypePO.getRevRuleName())) { + throw new VciBaseException("绗��" + osBtmTypePO.getRowIndex() + "銆戣锛岀増鏈彿瑙勫垯涓嶈兘涓虹┖"); } try { BizType historyBtm = platformClientUtil.getBtmService().getBizTypeByName(osBtmTypePO.getName()); //宸叉湁姝ゆ暟鎹繘琛屽垹闄よ鐩� - if(historyBtm != null && !historyBtm.name.equals("")){ + if (historyBtm != null && !historyBtm.name.equals("")) { platformClientUtil.getBtmService().deleteBizType(historyBtm); } } catch (PLException e) { @@ -1448,7 +1476,7 @@ } //灞炴�у悕excel涓垽閲嶅鐞� - excelReapeat.put(osBtmTypePO.getName(),osBtmTypePO.getRowIndex()); + excelReapeat.put(osBtmTypePO.getName(), osBtmTypePO.getRowIndex()); BizType bizType = new BizType(); bizType.name = osBtmTypePO.getName(); bizType.label = osBtmTypePO.getLable(); @@ -1472,12 +1500,12 @@ throw new RuntimeException(e); } }); - }catch (Exception e){ - if(logger.isErrorEnabled()){ - logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨涓氬姟绫诲瀷淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e)); + } catch (Exception e) { + if (logger.isErrorEnabled()) { + logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨涓氬姟绫诲瀷淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細", VciBaseUtil.getExceptionMessage(e)); } e.printStackTrace(); - return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); + return BaseResult.fail(VciBaseUtil.getExceptionMessage(e), new String[]{}, e); } //鍒犻櫎涓婁紶鐨勬枃浠跺す FileUtil.del(defaultTempFolder + File.separator); @@ -1486,12 +1514,13 @@ /** * 鑾峰彇闇�瑕佷慨澶嶇殑浼猻ql + * * @param dbCheckMap * @return */ private List<String> getRepairDML(Map<String, String> dbCheckMap) { List<String> list = new ArrayList<String>(); - for(Iterator<String> ite = dbCheckMap.keySet().iterator(); ite.hasNext();){ + for (Iterator<String> ite = dbCheckMap.keySet().iterator(); ite.hasNext(); ) { String type = ite.next(); String dml = dbCheckMap.get(type); list.add(type + "/DML" + dml); @@ -1515,18 +1544,18 @@ e.printStackTrace(); String exceptionMessage = VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); - throw new PLException("500",new String[]{exceptionMessage}); + throw new PLException("500", new String[]{exceptionMessage}); } return flag; } - private List<Tree> getChildren(List<OsBtmTypeVO> osBtmTypeVOS,OsBtmTypeVO parentBIzType){ - List<Tree> trees= new ArrayList<>(); + private List<Tree> getChildren(List<OsBtmTypeVO> osBtmTypeVOS, OsBtmTypeVO parentBIzType) { + List<Tree> trees = new ArrayList<>(); for (OsBtmTypeVO bizType : osBtmTypeVOS) { - if(StringUtils.isBlank(bizType.getfName())){ + if (StringUtils.isBlank(bizType.getfName())) { continue; } - if(bizType.getfName().equals(parentBIzType.getId())){ + if (bizType.getfName().equals(parentBIzType.getId())) { Tree tree = new Tree(); tree.setOid(bizType.getOid()); tree.setParentName(parentBIzType.getfName()); @@ -1534,7 +1563,7 @@ tree.setLeaf(true); tree.setText(bizType.getDescription()); tree.setAttributes(WebUtil.objectToMapString(bizType)); - tree.setChildren(getChildren(osBtmTypeVOS,bizType)); + tree.setChildren(getChildren(osBtmTypeVOS, bizType)); trees.add(tree); } } @@ -1544,12 +1573,12 @@ /** * 灏嗕笟鍔$被鍨嬫嫾鎺son * - * @param nodeVOList 瀵硅薄鑺傜偣鐨勪俊鎭� - * @param relationVOList 鍏崇郴鐨勪俊鎭� - * @param btmTypeVO 涓氬姟绫诲瀷鏄剧ず瀵硅薄 - * @param hasRefer 鍖呭惈鍙傜収 + * @param nodeVOList 瀵硅薄鑺傜偣鐨勪俊鎭� + * @param relationVOList 鍏崇郴鐨勪俊鎭� + * @param btmTypeVO 涓氬姟绫诲瀷鏄剧ず瀵硅薄 + * @param hasRefer 鍖呭惈鍙傜収 */ - private void splicingBtmType2Json(List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList, OsBtmTypeVO btmTypeVO,boolean hasRefer) { + private void splicingBtmType2Json(List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList, OsBtmTypeVO btmTypeVO, boolean hasRefer) { OsERNodeVO nodeVO = new OsERNodeVO(); nodeVO.setKey(btmTypeVO.getId() + " " + btmTypeVO.getName()); List<OsERNodePropertyVO> itemList = new ArrayList<>(); @@ -1557,15 +1586,15 @@ OsERNodePropertyVO nodePropertyVO = new OsERNodePropertyVO(); nodePropertyVO.setName(attribute.getId() + " " + attribute.getName()); nodePropertyVO.setKey("oid".equals(attribute.getId().toLowerCase())); - if(StringUtils.isNotBlank(attribute.getReferBtmTypeId())){ + if (StringUtils.isNotBlank(attribute.getReferBtmTypeId())) { //鍙傜収鐨勫睘鎬э紝璁剧疆涓洪粍鑹� nodePropertyVO.setColor("#FEDD32FF"); - }else{ + } else { nodePropertyVO.setColor("#000"); } itemList.add(nodePropertyVO); //鍒ゆ柇鍙傜収 - if(hasRefer) { + if (hasRefer) { selectReferenceBtmType(attribute, btmTypeVO, nodeVOList, relationVOList); } }); @@ -1576,9 +1605,9 @@ /** * 鍒ゆ柇涓氬姟绫诲瀷鐨勫睘鎬ф槸涓嶆槸鍙傜収绫诲瀷锛屽苟灏嗗弬鐓ф坊鍔犲埌ER鍥句腑 * - * @param attribute 涓氬姟绫诲瀷灞炴�� - * @param nodeVOList 鑺傜偣淇℃伅 - * @param btmTypeVO 涓氬姟绫诲瀷 + * @param attribute 涓氬姟绫诲瀷灞炴�� + * @param nodeVOList 鑺傜偣淇℃伅 + * @param btmTypeVO 涓氬姟绫诲瀷 * @param relationVOList 鍏崇郴淇℃伅 */ private void selectReferenceBtmType(OsBtmTypeAttributeVO attribute, OsBtmTypeVO btmTypeVO, @@ -1592,14 +1621,14 @@ nodeVO.setKey(referenceBtmType.getId() + " " + referenceBtmType.getName()); List<OsERNodePropertyVO> items = new ArrayList<>(); - if(referenceBtmType.getId().equalsIgnoreCase(btmTypeVO.getId())){ + if (referenceBtmType.getId().equalsIgnoreCase(btmTypeVO.getId())) { //鍙傜収鑷繁鐨勫唴瀹� OsERRelationVO relationVO = new OsERRelationVO(); relationVO.setTo(referenceBtmType.getId() + " " + referenceBtmType.getName()); relationVO.setFrom(btmTypeVO.getId() + " " + btmTypeVO.getName()); relationVO.setToText("鑷弬鐓�"); relationVOList.add(relationVO); - }else { + } else { referenceBtmAttributes.forEach(attr -> { OsERNodePropertyVO nodePropertyVO = new OsERNodePropertyVO(); nodePropertyVO.setName(attr.getId() + " " + attr.getName()); @@ -1622,23 +1651,23 @@ /** * 鍔犺浇涓氬姟绫诲瀷鎵�鍏宠仈鐨勯摼鎺ョ被鍨� * - * @param nodeVOList 鑺傜偣淇℃伅 + * @param nodeVOList 鑺傜偣淇℃伅 * @param relationVOList 鍏崇郴鐨勪俊鎭� - * @param btmTypeVO 涓氬姟绫诲瀷 + * @param btmTypeVO 涓氬姟绫诲瀷 */ private void loadAllLinkTypeByBtmType(List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList, OsBtmTypeVO btmTypeVO) { Map<String, OsLinkTypeVO> linkTypeVOMap = linkTypeService.selectAllLinkMap(); Collection<OsLinkTypeVO> linkTypeVOS = linkTypeVOMap.values(); Set<OsLinkTypeVO> fromLinkTypeVOList = linkTypeVOS.stream().filter(link -> - Arrays.stream(link.getFromBtmType().split(",")).anyMatch(s->s.equalsIgnoreCase(btmTypeVO.getId())) + Arrays.stream(link.getFromBtmType().split(",")).anyMatch(s -> s.equalsIgnoreCase(btmTypeVO.getId())) ).collect(Collectors.toSet()); Set<OsLinkTypeVO> toLinkTypeList = linkTypeVOS.stream().filter(link -> - Arrays.stream(link.getToBtmType().split(",")).anyMatch(s->s.equalsIgnoreCase(btmTypeVO.getId()))).collect(Collectors.toSet()); + Arrays.stream(link.getToBtmType().split(",")).anyMatch(s -> s.equalsIgnoreCase(btmTypeVO.getId()))).collect(Collectors.toSet()); List<OsLinkTypeVO> linkTypeVOList = new ArrayList<>(); linkTypeVOList.addAll(fromLinkTypeVOList); linkTypeVOList.addAll(toLinkTypeList); if (!CollectionUtils.isEmpty(linkTypeVOList)) { - splicingLinkType2Json(nodeVOList, relationVOList,linkTypeVOList,btmTypeVO,false); + splicingLinkType2Json(nodeVOList, relationVOList, linkTypeVOList, btmTypeVO, false); } } @@ -1646,31 +1675,31 @@ /** * 灏嗛摼鎺ョ被鍨嬫嫾鎺ユ垚json * - * @param nodeVOList 鑺傜偣淇℃伅 - * @param relationVOList 鍏崇郴淇℃伅 - * @param linkTypeVOs 閾炬帴绫诲瀷 - * @param btmTypeVO 涓氬姟绫诲瀷鐨勬樉绀哄璞� - * @param used 鏄惁涓鸿浣跨敤 + * @param nodeVOList 鑺傜偣淇℃伅 + * @param relationVOList 鍏崇郴淇℃伅 + * @param linkTypeVOs 閾炬帴绫诲瀷 + * @param btmTypeVO 涓氬姟绫诲瀷鐨勬樉绀哄璞� + * @param used 鏄惁涓鸿浣跨敤 */ private void splicingLinkType2Json(List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList, - List<OsLinkTypeVO> linkTypeVOs,OsBtmTypeVO btmTypeVO,boolean used) { + List<OsLinkTypeVO> linkTypeVOs, OsBtmTypeVO btmTypeVO, boolean used) { linkTypeVOs.forEach(link -> { List<OsLinkTypeAttributeVO> attributeList = link.getAttributes(); - OsERNodeVO nodeVO= new OsERNodeVO(); + OsERNodeVO nodeVO = new OsERNodeVO(); nodeVO.setKey(link.getId() + " " + link.getName()); List<OsERNodePropertyVO> items = new ArrayList<>(); attributeList.forEach(attr -> { OsERNodePropertyVO nodePropertyVO = new OsERNodePropertyVO(); nodePropertyVO.setName(attr.getId() + " " + attr.getName()); nodePropertyVO.setKey("oid".equals(attr.getId().toLowerCase())); - if(StringUtils.isNotBlank(attr.getReferBtmTypeId())) { + if (StringUtils.isNotBlank(attr.getReferBtmTypeId())) { nodePropertyVO.setColor("#FEDD32FF"); - }else { + } else { nodePropertyVO.setColor("#1c446f"); } items.add(nodePropertyVO); //鍒ゆ柇鍙傜収 - if(!used) { + if (!used) { selectReferenceLinkType(attr, link, nodeVOList, relationVOList); } }); @@ -1682,26 +1711,26 @@ nodeVOList.add(nodeVO); - if(used){ + if (used) { relationVO.setText("琚紩鐢�"); } //濡傛灉褰撳墠鐨刦rom绔紝閭d箞灏辨樉绀簍o绔殑 //濡傛灉褰撳墠鐨勬槸to绔殑锛岄偅涔堝氨鏄剧ずfrom绔殑鍐呭 - if(Arrays.stream(link.getFromBtmType().split(",")).anyMatch(s->s.equalsIgnoreCase(btmTypeVO.getId()))){ + if (Arrays.stream(link.getFromBtmType().split(",")).anyMatch(s -> s.equalsIgnoreCase(btmTypeVO.getId()))) { //杩欎釜鏄痜rom绔� - if(!used) { - relationVO.setToText("from绔�"); - } + if (!used) { + relationVO.setToText("from绔�"); + } //鎵捐繖涓摼鎺ョ被鍨嬬殑to绔殑涓氬姟绫诲瀷 - link.getToBtmTypeVOS().stream().forEach(toBtm->{ - splicingBtmType2JsonForLink(nodeVOList,relationVOList,link,toBtm,true); - }); - }else{ - if(!used) { + link.getToBtmTypeVOS().stream().forEach(toBtm -> { + splicingBtmType2JsonForLink(nodeVOList, relationVOList, link, toBtm, true); + }); + } else { + if (!used) { relationVO.setToText("to绔�"); } - link.getFromBtmTypeVOS().stream().forEach(fromBtm->{ - splicingBtmType2JsonForLink(nodeVOList,relationVOList,link,fromBtm,false); + link.getFromBtmTypeVOS().stream().forEach(fromBtm -> { + splicingBtmType2JsonForLink(nodeVOList, relationVOList, link, fromBtm, false); }); } relationVOList.add(relationVO); @@ -1710,11 +1739,12 @@ /** * 閾炬帴绫诲瀷鍏抽敭鐨勪笟鍔$被鍨� - * @param nodeVOList 瀵硅薄鍒楄〃 + * + * @param nodeVOList 瀵硅薄鍒楄〃 * @param relationVOList 鍏宠仈鍏崇郴鍒楄〃 - * @param link 閾炬帴绫诲瀷 - * @param btmTypeVO 涓氬姟绫诲瀷 - * @param to 鏄惁涓簍o绔� + * @param link 閾炬帴绫诲瀷 + * @param btmTypeVO 涓氬姟绫诲瀷 + * @param to 鏄惁涓簍o绔� */ private void splicingBtmType2JsonForLink(List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList, OsLinkTypeVO link, OsBtmTypeVO btmTypeVO, boolean to) { OsERNodeVO nodeVO = new OsERNodeVO(); @@ -1732,7 +1762,7 @@ OsERRelationVO relationVO = new OsERRelationVO(); relationVO.setFrom(link.getId() + " " + link.getName()); relationVO.setTo(btmTypeVO.getId() + " " + btmTypeVO.getName()); - relationVO.setToText(to?"to绔�":"from绔�"); + relationVO.setToText(to ? "to绔�" : "from绔�"); relationVOList.add(relationVO); nodeVOList.add(nodeVO); } @@ -1740,12 +1770,12 @@ /** * 鍒ゆ柇閾炬帴绫诲瀷鐨勫睘鎬ф槸涓嶆槸鍙傜収绫诲瀷锛屽苟灏嗗弬鐓ф坊鍔犲埌ER鍥句腑 * - * @param attr 閾炬帴绫诲瀷鐨勫睘鎬� - * @param linkTypeVO 閾炬帴绫诲瀷鐨勫唴瀹� - * @param nodeVOList 鑺傜偣瀵硅薄 + * @param attr 閾炬帴绫诲瀷鐨勫睘鎬� + * @param linkTypeVO 閾炬帴绫诲瀷鐨勫唴瀹� + * @param nodeVOList 鑺傜偣瀵硅薄 * @param relationVOList 鍏崇郴瀵硅薄 */ - private void selectReferenceLinkType(OsLinkTypeAttributeVO attr, OsLinkTypeVO linkTypeVO,List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList) { + private void selectReferenceLinkType(OsLinkTypeAttributeVO attr, OsLinkTypeVO linkTypeVO, List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList) { if (StringUtils.isNotBlank(attr.getReferBtmTypeId())) { //鏄弬鐓х被鍨嬬殑 OsBtmTypeVO referenceBtmType = getBtmById(attr.getReferBtmTypeId()); @@ -1775,7 +1805,7 @@ /** * 灏佽鍒犻櫎鍏ㄩ儴绫诲瀷鐩稿叧鐨勬煡璇㈡柟娉曠殑鍐呴儴绫� */ - private class DeleteType{ + private class DeleteType { private List<String> exceptBts, exceptAbs, exceptEnums, exceptRev, exceptLCs, exceptStates; @@ -1786,20 +1816,21 @@ /** * 鑾峰彇闇�瑕佸垹闄ょ殑涓氬姟绫诲瀷 + * * @return */ public List<BizType> getDelBtList() throws PLException { List<BizType> list = new ArrayList<>(); BizType[] bts = platformClientUtil.getBtmService().getBizTypes(""); - for(BizType bt : bts){ + for (BizType bt : bts) { boolean exceptFlag = false; - for(String except : exceptBts){ - if(except.equalsIgnoreCase(bt.name)){ + for (String except : exceptBts) { + if (except.equalsIgnoreCase(bt.name)) { exceptFlag = true; break; } } - if(!exceptFlag){ + if (!exceptFlag) { list.add(bt); } } @@ -1808,6 +1839,7 @@ /** * 鑾峰彇闇�瑕佸垹闄ょ殑閾炬帴绫诲瀷 + * * @return */ public List<LinkType> getDelLtList() throws PLException { @@ -1817,6 +1849,7 @@ /** * 鑾峰彇寰呭垹闄ょ殑灞炴�� + * * @return */ public List<String> getDelAbList() { @@ -1829,26 +1862,26 @@ } //渚濇嵁淇濈暀鐨勭被鍨嬫瀯閫犱繚鐣欑殑灞炴�� exceptAbs = new ArrayList<String>(); - for(String except : exceptBts){ + for (String except : exceptBts) { String[] btmApNameArray = null; try { btmApNameArray = platformClientUtil.getBtmService().getAttributeNames(except); } catch (PLException e) { e.printStackTrace(); } - if(btmApNameArray != null){ - for(String abName : btmApNameArray){ - if(!exceptAbs.contains(abName)){ + if (btmApNameArray != null) { + for (String abName : btmApNameArray) { + if (!exceptAbs.contains(abName)) { exceptAbs.add(abName); } } } } //鏋勯�犲彲鍒犻櫎鐨勫睘鎬� - if(attribItems != null){ - for(AttributeDef ab : attribItems){ + if (attribItems != null) { + for (AttributeDef ab : attribItems) { String abName = ab.name; - if(!exceptAbs.contains(abName)){ + if (!exceptAbs.contains(abName)) { list.add(abName); } } @@ -1858,6 +1891,7 @@ /** * 鑾峰彇寰呭垹闄ょ殑鏋氫妇绫诲瀷 + * * @return */ public List<EnumType> getDelEnumList() { @@ -1867,15 +1901,15 @@ exceptEnums = new ArrayList<String>(); EnumType[] emItems = ClientServiceProvider.getOMDService().getEnumService().getEnumTypes("", 0, 0); AttributeDef[] abs = platformClientUtil.getAttributeService().getAttributeDefsByNames(exceptAbs.toArray(new String[0])); - for(AttributeDef ab : abs){ + for (AttributeDef ab : abs) { OtherInfo otherInfo = OtherInfo.getOtherInfoByText(ab.other); String enumName = otherInfo.getEnumName(); - if(enumName != null && !enumName.equals("") && !exceptEnums.contains(enumName)){ + if (enumName != null && !enumName.equals("") && !exceptEnums.contains(enumName)) { exceptEnums.add(enumName); } } - for(EnumType em : emItems){ - if(!exceptEnums.contains(em.name)){ + for (EnumType em : emItems) { + if (!exceptEnums.contains(em.name)) { list.add(em); } } @@ -1887,17 +1921,18 @@ /** * 鑾峰彇寰呭垹闄ょ殑鐢熷懡鍛ㄦ湡 + * * @return */ - public List<LifeCycle> getDelLCList(){ + public List<LifeCycle> getDelLCList() { List<LifeCycle> list = new ArrayList<LifeCycle>(); exceptLCs = new ArrayList<String>(); exceptStates = new ArrayList<String>(); - for(String btName : exceptBts){ + for (String btName : exceptBts) { try { BizType bt = platformClientUtil.getBtmService().getBizTypeByName(btName); String lcName = bt.lifeCycle; - if(lcName != null && !lcName.equals("") && !exceptLCs.contains(lcName)){ + if (lcName != null && !lcName.equals("") && !exceptLCs.contains(lcName)) { exceptLCs.add(lcName); } } catch (PLException e) { @@ -1911,15 +1946,15 @@ } catch (PLException e) { e.printStackTrace(); } - if(lcs != null){ - for(LifeCycle lc : lcs){ + if (lcs != null) { + for (LifeCycle lc : lcs) { String name = lc.name; - if(name != null && !name.equals("") && !exceptLCs.contains(name)){ + if (name != null && !name.equals("") && !exceptLCs.contains(name)) { list.add(lc); - }else{ + } else { //淇濈暀鐨勭姸鎬佹睜 Bound[] bounds = lc.bounds; - for(Bound bound : bounds){ + for (Bound bound : bounds) { String sName = bound.name; exceptStates.add(sName); } @@ -1931,9 +1966,10 @@ /** * 鑾峰彇寰呭垹闄ょ殑鐘舵�� + * * @return */ - public List<StatePool> getDelSPList(){ + public List<StatePool> getDelSPList() { List<StatePool> list = new ArrayList<StatePool>(); StatePool[] states = null; try { @@ -1941,10 +1977,10 @@ } catch (PLException e) { e.printStackTrace(); } - if(states != null){ - for(StatePool state : states){ + if (states != null) { + for (StatePool state : states) { String name = state.name; - if(name != null && !name.equals("") && !exceptStates.contains(name)){ + if (name != null && !name.equals("") && !exceptStates.contains(name)) { list.add(state); } } @@ -1954,16 +1990,17 @@ /** * 鑾峰彇寰呭垹闄ょ殑鐗堟湰瑙勫垯 + * * @return */ - public List<VersionRule> getDelVRList(){ + public List<VersionRule> getDelVRList() { List<VersionRule> list = new ArrayList<VersionRule>(); exceptRev = new ArrayList<String>(); - for(String btName : exceptBts){ + for (String btName : exceptBts) { try { BizType bt = platformClientUtil.getBtmService().getBizTypeByName(btName); String revName = bt.revRuleName; - if(revName != null && !revName.equals("") && !exceptRev.contains(revName)){ + if (revName != null && !revName.equals("") && !exceptRev.contains(revName)) { exceptRev.add(revName); } } catch (PLException e) { @@ -1976,10 +2013,10 @@ } catch (PLException e) { e.printStackTrace(); } - if(revs != null){ - for(VersionRule rev : revs){ + if (revs != null) { + for (VersionRule rev : revs) { String name = rev.name; - if(name != null && !name.equals("") && !exceptRev.contains(name)){ + if (name != null && !name.equals("") && !exceptRev.contains(name)) { list.add(rev); } } 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 3ef9a19..da050fc 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; @@ -20,7 +21,7 @@ import com.vci.starter.web.pagemodel.DataGrid; import com.vci.starter.web.pagemodel.SessionInfo; import com.vci.starter.web.util.*; -import com.vci.web.redis.RedisService; +import com.vci.starter.web.redis.RedisService; import com.vci.web.service.OsBtmServiceI; import com.vci.web.service.UIManagerServiceI; import com.vci.web.util.*; @@ -2118,7 +2119,6 @@ return roleRightVOS; } - /** * UI瑙掕壊瀵硅薄杞崲 * @param infos @@ -2267,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; @@ -2333,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-parent/plt-web/src/main/java/com/vci/web/util/PlatformClientUtil.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/PlatformClientUtil.java index 5798c87..a2e9a69 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/PlatformClientUtil.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/PlatformClientUtil.java @@ -4,7 +4,6 @@ import com.vci.corba.bofactory.BOFactoryServicePrx; import com.vci.corba.common.PLException; import com.vci.corba.framework.FrameworkServicePrx; -import com.vci.corba.log.LogServicePrx; import com.vci.corba.omd.atm.AttPoolServicePrx; import com.vci.corba.omd.btm.BTMServicePrx; import com.vci.corba.omd.data.AttributeValue; @@ -14,6 +13,7 @@ import com.vci.corba.omd.qtm.QTDServicePrx; import com.vci.corba.omd.stm.StatePoolServicePrx; import com.vci.corba.omd.vrm.VersionRuleServicePrx; +import com.vci.corba.pllog.LogServicePrx; import com.vci.corba.portal.PortalServicePrx; import com.vci.corba.query.ObjectQueryServicePrx; import com.vci.corba.volume.VolumeServicePrx; diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/ice.properties b/Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/ice.properties index 2fae8b8..3259ca1 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/ice.properties +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/ice.properties @@ -1,4 +1,5 @@ #NameService=PLT Adapter=PLT -Endpoints=default -h localhost -p 4601 +Endpoints=default -h localhost -p 4061 +Ice.MessageSizeMax=1048576 #Endpoints=VCI-PLT/Locator:default -h localhost -p 4601 \ No newline at end of file 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/modelingMenu/queryTemplate/businessTypeQuery/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/index.vue index 4bdc47c..3b809cc 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/businessTypeQuery/index.vue @@ -151,6 +151,8 @@ }); this.treeData[0].children = data; loading.close(); + }).catch(error=>{ + loading.close(); }) }, // 澶勭悊鏍戝舰缁撴瀯 diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue index b8cc2f9..36166ce 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/linkTypeQuery/index.vue @@ -185,6 +185,8 @@ }); this.treeData[0].children = data; loading.close(); + }).catch(error=>{ + loading.close(); }) }, diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/queryDefine/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/queryDefine/index.vue index 4a4395b..5b8d5cf 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/queryDefine/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/queryTemplate/queryDefine/index.vue @@ -202,6 +202,8 @@ }); this.treeData = data; loading.close(); + }).catch(error=>{ + loading.close(); }) }, // 澶勭悊涓氬姟绫诲瀷鏍戝舰缁撴瀯 diff --git a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/index.vue b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/index.vue index 308c333..e83166d 100644 --- a/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/index.vue @@ -1,26 +1,10 @@ <template> <el-container> - <el-aside> <basic-container> - <div ref="TreeBox" style="height: calc(100vh - 144px);!important;"> - <div class="headerCon"> - <el-button icon="el-icon-plus" plain size="small" type="primary" @click="addClickHandler">鍒涘缓 - </el-button> - <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editClickHandler">淇敼 - </el-button> - <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delClickHandler">鍒犻櫎 - </el-button> - <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">瀵煎嚭 - </el-button> - <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadClickHandler">瀵煎叆 - </el-button> - <el-button class="smallBtn" plain size="small" type="primary" - @click="checkViewClickHandler">鏌ョ湅浣跨敤鑼冨洿 - </el-button> - </div> + <div ref="TreeBox" style="height: calc(100vh - 154px);!important;"> <!-- 宸︿晶鏍� --> - <div style="height: calc(100vh - 280px);"> + <div style="height: calc(100vh - 190px);"> <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick"> <span slot-scope="{ node, data }" class="el-tree-node__label"> <span style="font-size: 15px"> @@ -36,6 +20,7 @@ <el-main> <basic-container> + </basic-container> </el-main> @@ -43,8 +28,53 @@ </template> <script> +import {getBizTypes} from "@/api/modeling/businessType/api"; export default { - name: "index" + name: "index", + data() { + return { + treeOption: { + height: 'auto', + defaultExpandedKeys: ['topNode'], + menu: false, + addBtn: false, + props: { + label: 'label', + value: 'oid', + children: 'children' + } + }, + nodeRow: {}, + treeData: [{ + label: '涓氬姟绫诲瀷鏍�', + oid: 'topNode', + children: [] + }], + } + }, + created() { + this.getTreeList(); + }, + methods: { + //鏍戣〃鏌ヨ + getTreeList() { + const loading = this.$loading({}); + getBizTypes().then(res => { + const data = res.data.data.map(item => { + item.attributes.label = item.attributes.id; + return item.attributes; + }); + this.treeData[0].children = data; + loading.close(); + }).catch(error => { + loading.close(); + }) + }, + // 鏍戠偣鍑� + nodeClick(row) { + this.nodeRow = row; + }, + } } </script> 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> diff --git a/Source/plt-web/plt-web-ui/src/views/wel/index.vue b/Source/plt-web/plt-web-ui/src/views/wel/index.vue index 5afdcc8..052b5e6 100644 --- a/Source/plt-web/plt-web-ui/src/views/wel/index.vue +++ b/Source/plt-web/plt-web-ui/src/views/wel/index.vue @@ -13,12 +13,6 @@ <img src="https://img.shields.io/badge/JDK-1.8+-green.svg" alt="Build Status"/> <img src="https://img.shields.io/badge/Spring%20Cloud-2021-blue.svg" alt="Coverage Status"/> <img src="https://img.shields.io/badge/Spring%20Boot-2.7-blue.svg" alt="Downloads"/> - <a target="_blank" href="https://bladex.vip"> - <img src="https://img.shields.io/badge/Saber%20Author-Small%20Chill-ff69b4.svg" alt="Downloads"/> - </a> - <a target="_blank" href="https://bladex.vip"> - <img src="https://img.shields.io/badge/Copyright%20-@BladeX-%23ff3f59.svg" alt="Downloads"/> - </a> </p> </basic-container> </el-col> -- Gitblit v1.9.3