Browse Source

环境切换

wangchangsheng 1 year ago
parent
commit
7425c8b42c

+ 35 - 6
ims-service/ims-eval/src/main/java/com/ims/eval/config/ImaConfig.java

@@ -1,23 +1,52 @@
 package com.ims.eval.config;
 
 import lombok.Data;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.stereotype.Component;
 
 @Data
 @Component
-@ConfigurationProperties(prefix = "iam")
+//@ConfigurationProperties(prefix = "iam")
 public class ImaConfig {
 
+
+
+	@Value("${iam.active}")
+	private String active;
+
 	/**网关网址 **/
-	private String gatewayUrl;
+	@Value("${iam.gateway-url.dev}")
+	private String gatewayUrlDev;
 
 
-	public String getGatewayUrl() {
-		return gatewayUrl;
+	@Value("${iam.gateway-url.pro}")
+	private String gatewayUrlPro;
+
+
+	@Value("${iam.menu.dev}")
+	private String menuDev;
+
+	@Value("${iam.menu.pro}")
+	private String menuPro;
+
+
+	public String getMenu() {
+
+		if("dev".equals(active)) {
+			return menuDev;
+		}
+		return menuPro;
 	}
 
-	public void setGatewayUrl(String gatewayUrl) {
-		this.gatewayUrl = gatewayUrl;
+
+
+	public String getGatewayUrl() {
+		if("dev".equals(active)){
+			return gatewayUrlDev;
+		}
+		return gatewayUrlPro;
 	}
+
+
 }

+ 6 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/feign/IGatewayUrlService.java

@@ -1,5 +1,6 @@
 package com.ims.eval.feign;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import feign.Headers;
 import feign.Param;
@@ -59,4 +60,9 @@ public interface IGatewayUrlService {
 	JSONObject removeByToken(@Param(value = "token") String token);
 
 
+	@Headers({"Content-Type: application/json", "Accept: application/json"})
+	@RequestLine("POST /ims-iam-ext/sys/sysOrg/allDataNoControl")
+	JSONArray allDataNoControl();
+
+
 }

+ 2 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/custom/MenuOperationService.java

@@ -87,7 +87,8 @@ public class MenuOperationService {
 	 * @return
 	 */
 	public List<Menu> getMenuTree(String parentId, HttpServletRequest request) {
-		JSONArray arr = menuList(parentId, request);
+
+		JSONArray arr = menuList(imaConfig.getMenu(), request);
 		if (null == arr) {
 			return null;
 		}

+ 21 - 3
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/OrganizationStructureServiceImpl.java

@@ -1,13 +1,15 @@
 package com.ims.eval.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.ims.common.utils.StringUtils;
-import com.ims.eval.entity.OrganizationEvaluationRule;
 import com.ims.eval.entity.OrganizationStructure;
 import com.ims.eval.dao.OrganizationStructureMapper;
+import com.ims.eval.entity.custom.Menu;
+import com.ims.eval.feign.RemoteServiceBuilder;
 import com.ims.eval.service.IOrganizationStructureService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
@@ -29,6 +31,11 @@ public class OrganizationStructureServiceImpl extends ServiceImpl<OrganizationSt
 
 	private static String type = null;
 
+	@Autowired
+	private RemoteServiceBuilder remoteServiceBuilder;
+
+	private List<OrganizationStructure> list = new ArrayList<>();
+
 	@Override
 	public List<OrganizationStructure> getTree(String id, Integer num, String type1) {
 
@@ -36,9 +43,20 @@ public class OrganizationStructureServiceImpl extends ServiceImpl<OrganizationSt
 			type = type1;
 		}
 
+		if(null != list && list.size()>0){
+			return list;
+		}
 		QueryWrapper<OrganizationStructure> qw = new QueryWrapper<>();
 
-		List<OrganizationStructure> list = baseMapper.selectList(qw);
+//		List<OrganizationStructure> list = baseMapper.selectList(qw);
+
+//		http://10.65.79.83:86/ims-iam-ext/sys/sysOrg/allDataNoControl
+		JSONArray arr = remoteServiceBuilder.getGatewayUrl().allDataNoControl();
+		if (null == arr) {
+			return null;
+		}
+
+		List<OrganizationStructure> list = arr.toJavaList(OrganizationStructure.class);
 		List<OrganizationStructure> tr = convert(list, id, num);
 		return tr;
 	}

+ 9 - 1
ims-service/ims-eval/src/main/resources/application.yml

@@ -17,7 +17,15 @@ spring:
 
 
 iam:
-  gateway-url: http://10.65.78.23:18600/
+  active: dev
+  gateway-url:
+    dev: http://10.65.78.23:18600/
+    pro: http://10.65.79.83:86/
+
+  menu:
+    dev: 10105
+    pro: 6802
+