From 26e5c1cdad65881f7fdccb79fe15db713e0b3cc5 Mon Sep 17 00:00:00 2001
From: yuxc <yuxc@vci-tech.com>
Date: 星期二, 30 四月 2024 10:51:29 +0800
Subject: [PATCH] 字段枚举解析修改

---
 Source/platformProject/vci-platform-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java |  131 +++++++++++++++++++++++--------------------
 1 files changed, 70 insertions(+), 61 deletions(-)

diff --git a/Source/platformProject/vci-platform-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java b/Source/platformProject/vci-platform-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java
index ea1e16f..36da87e 100644
--- a/Source/platformProject/vci-platform-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java
+++ b/Source/platformProject/vci-platform-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java
@@ -6,6 +6,7 @@
 import com.thoughtworks.xstream.io.xml.XppDriver;
 import com.vci.client.common.providers.ServiceProvider;
 import com.vci.corba.common.VCIError;
+import com.vci.corba.portal.data.PLTabButton;
 import com.vci.corba.portal.data.PLUILayout;
 import com.vci.starter.web.annotation.log.VciUnLog;
 import com.vci.starter.web.exception.VciBaseException;
@@ -24,6 +25,7 @@
 import com.vci.web.service.OsBtmServiceI;
 import com.vci.web.service.UIEngineServiceI;
 import com.vci.web.service.WebBoServiceI;
+import com.vci.web.util.Func;
 import com.vci.web.util.PlatformClientUtil;
 import com.vci.web.util.WebUtil;
 import com.vci.web.xmlmodel.UIComponentDefineXO;
@@ -39,6 +41,11 @@
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+import com.vci.corba.portal.data.PortalVI;
+import com.vci.corba.portal.data.PLTabPage;
+import com.vci.corba.portal.data.PLAction;
+import com.vci.corba.portal.data.PLPageDefination;
+import com.vci.corba.portal.data.PLCommandParameter;
 import plm.corba.portal.*;
 
 import java.util.*;
@@ -53,7 +60,7 @@
  *
  */
 @Service
-public class UIEngineServiceImpl  implements UIEngineServiceI {
+public class UIEngineServiceImpl implements UIEngineServiceI {
 
 	/**
 	 * 鏄惁浠庣紦瀛樹腑鏌ヨ
@@ -137,7 +144,8 @@
 	public void checkInvalidXmlVI() {
 		PortalVI[] portalVIS = null;
 		try {
-			portalVIS = platformClientUtil.getPortalService().getAllPortalVI();
+			portalVIS = ServiceProvider.getUIService().getAllPortalVI();
+			// portalVIS = platformClientUtil.getPortalService().getAllPortalVI();
 		} catch (VCIError vciError) {
 			throw WebUtil.getVciBaseException(vciError);
 		}
@@ -159,13 +167,13 @@
 	@Override
 	@VciUnLog
 	public List<UIFormDefineVO> selectAllForm() {
-		com.vci.corba.portal.data.PortalVI[] portalVIS = null;
+		PortalVI[] portalVIS = null;
 		try {
 			portalVIS = ServiceProvider.getUIService().getAllPortalVI();
 		} catch (VCIError vciError) {
 			throw WebUtil.getVciBaseException(vciError);
 		}
-		List<com.vci.corba.portal.data.PortalVI> portalVIList = Arrays.stream(portalVIS).filter(portal -> 1 == portal.viType).collect(Collectors.toList());
+		List<PortalVI> portalVIList = Arrays.stream(portalVIS).filter(portal -> 1 == portal.viType).collect(Collectors.toList());
 		return formDO2VOs(portalVIList);
 	}
 
@@ -187,9 +195,9 @@
 	 * @return 鏄剧ず瀵硅薄
 	 */
 	@Override
-	public List<UIFormDefineVO> formDO2VOs(Collection<com.vci.corba.portal.data.PortalVI> portalVIS) {
+	public List<UIFormDefineVO> formDO2VOs(Collection<PortalVI> portalVIS) {
 		List<UIFormDefineVO> formDefineVOList = new ArrayList<>();
-		Optional.ofNullable(portalVIS).orElseGet(()->new ArrayList<com.vci.corba.portal.data.PortalVI>()).stream().forEach(portal->{
+		Optional.ofNullable(portalVIS).orElseGet(()->new ArrayList<PortalVI>()).stream().forEach(portal->{
 			try {
 				UIFormDefineVO defineVO = formDO2VO(portal);
 				formDefineVOList.add(defineVO);
@@ -210,7 +218,7 @@
 	 */
 	@Override
 	@VciUnLog
-	public UIFormDefineVO formDO2VO(com.vci.corba.portal.data.PortalVI portal) {
+	public UIFormDefineVO formDO2VO(PortalVI portal) {
 		if(portal == null ||StringUtils.isBlank(portal.prm)){
 			throw new VciBaseException("琛ㄥ崟鍙兘涓嶅瓨鍦紝鍥犱负鏈兘鑾峰彇鍒板畠鐨勪俊鎭�");
 		}
@@ -364,18 +372,18 @@
 			if("radio".equalsIgnoreCase(itemVO.getType()) || "checkbox".equalsIgnoreCase(itemVO.getType())
 					|| "combox".equalsIgnoreCase(itemVO.getType())){
 				//鐪嬬湅鏈夋病鏈夊崟鐙缃�
-				if(StringUtils.isNotBlank(itemXO.getComboxKey())){
-					itemVO.setComboxKey(itemXO.getComboxKey());
-					if(StringUtils.isNotBlank(itemXO.getComboxItems())){
-						List<KeyValue> keyValues = new ArrayList<>();
-						VciBaseUtil.str2List(itemXO.getComboxItems()).stream().forEach(temmpKeyValue->{
-							KeyValue kv = new KeyValue();
-							kv.setKey(temmpKeyValue.split("=")[0]);
-							kv.setValue(temmpKeyValue.split("=")[1]);
-							keyValues.add(kv);
-						});
-						itemVO.setData(keyValues);
+//				if(StringUtils.isNotBlank(itemXO.getComboxKey())){
+//					itemVO.setComboxKey(itemXO.getComboxKey());
+				if(StringUtils.isNotBlank(itemXO.getComboxItems())){
+					List<KeyValue> keyValues = new ArrayList<>();
+					for (String keyValue : itemXO.getComboxItems().split(";")) {
+						KeyValue kv = new KeyValue();
+						String[] split = keyValue.split("\\{");
+						kv.setKey(split[0]);
+						kv.setValue(split[1].substring(0,split[1].length()-1));
+						keyValues.add(kv);
 					}
+					itemVO.setData(keyValues);
 				}else{
 					String attr = itemVO.getField();
 					if(itemVO.getField().toLowerCase().startsWith("t_oid.")
@@ -410,7 +418,7 @@
 			return null;
 		}
 		if(!QUERY_BY_CACHE){
-			com.vci.corba.portal.data.PortalVI portalVI = null;
+			PortalVI portalVI = null;
 			try {
 				portalVI = ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmId, id);
 			} catch (VCIError vciError) {
@@ -453,13 +461,13 @@
 	@Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_TABLE,unless = "#result == null")
 	@VciUnLog
 	public List<UITableDefineVO> selectAllTable() {
-		com.vci.corba.portal.data.PortalVI[] portalVIS = null;
+		PortalVI[] portalVIS = null;
 		try {
 			portalVIS = ServiceProvider.getUIService().getAllPortalVI();
 		} catch (VCIError vciError) {
 			throw WebUtil.getVciBaseException(vciError);
 		}
-		List<com.vci.corba.portal.data.PortalVI> portalVIList = Arrays.stream(portalVIS).filter(portal -> 0 == portal.viType).collect(Collectors.toList());
+		List<PortalVI> portalVIList = Arrays.stream(portalVIS).filter(portal -> 0 == portal.viType).collect(Collectors.toList());
 		return tableDO2VOs(portalVIList,false);
 	}
 
@@ -482,9 +490,9 @@
 	 */
 	@Override
 	@VciUnLog
-	public List<UITableDefineVO> tableDO2VOs(Collection<com.vci.corba.portal.data.PortalVI> prms, boolean queryDetail) {
+	public List<UITableDefineVO> tableDO2VOs(Collection<PortalVI> prms, boolean queryDetail) {
 		List<UITableDefineVO> tableDefineVOList = new ArrayList<>();
-		Optional.ofNullable(prms).orElseGet(()->new ArrayList<com.vci.corba.portal.data.PortalVI>()).stream().forEach(portal->{
+		Optional.ofNullable(prms).orElseGet(()->new ArrayList<PortalVI>()).stream().forEach(portal->{
 			UITableDefineVO defineVO = tableDO2VO(portal,queryDetail);
 			tableDefineVOList.add(defineVO);
 		});
@@ -500,7 +508,7 @@
 	 */
 	@Override
 	@VciUnLog
-	public UITableDefineVO tableDO2VO(com.vci.corba.portal.data.PortalVI portal, boolean queryDetail) {
+	public UITableDefineVO tableDO2VO(PortalVI portal, boolean queryDetail) {
 		UITableDefineVO tableDefineVO = new UITableDefineVO();
 		tableDefineVO.setOid(portal.id);
 		tableDefineVO.setId(portal.viName);
@@ -730,7 +738,7 @@
 			return null;
 		}
 		if(!QUERY_BY_CACHE){
-			com.vci.corba.portal.data.PortalVI portalVI = null;
+			PortalVI portalVI = null;
 			try {
 				portalVI = ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmId, id);
 			} catch (VCIError vciError) {
@@ -799,7 +807,7 @@
 	 */
 	@Override
 	@VciUnLog
-	public List<UIActionVO> actionDO2VOs(Collection<com.vci.corba.portal.data.PLAction> actions) {
+	public List<UIActionVO> actionDO2VOs(Collection<PLAction> actions) {
 		List<UIActionVO> actionVOS = new ArrayList<>();
 		Optional.ofNullable(actions).orElseGet(()->new ArrayList<>()).stream().forEach(action->{
 			UIActionVO actionVO = actionDO2VO(action);
@@ -816,7 +824,7 @@
 	 */
 	@Override
 	@VciUnLog
-	public UIActionVO actionDO2VO(com.vci.corba.portal.data.PLAction action) {
+	public UIActionVO actionDO2VO(PLAction action) {
 		UIActionVO actionVO = new UIActionVO();
 		if(action!=null){
 			actionVO.setOid(action.plOId);
@@ -998,24 +1006,24 @@
 		return contentVO;
 	}
 
-//	private List<UILayoutVO> swapLayArea(List<UILayoutVO> layoutVOS){
-//		List<UILayoutVO> layoutVOList = new ArrayList<>();
-//		//1 瀵艰埅鍖�
-//		//2 涓诲唴瀹瑰尯
-//		//3 椤电鍖�
-//		if(!CollectionUtils.isEmpty(layoutVOS)){
-//			//鍙湁涓�涓尯鍩熺殑鏃跺�欙紝閮芥斁鍦╟enter閲岋紝鍝�曟湰韬槸瀵艰埅鍖�
-//			if(layoutVOS.size() == 1){
-//				layoutVOS.get(0).setLayoutAreaType(UILayoutAreaTypeEnum.CENTER.getValue());
-//				layoutVOList.add(layoutVOS.get(0));
-//			}else{
-//				Map<String,List<UILayoutVO>> layoutAreaMap = layoutVOS.stream().collect(Collectors.groupingBy(UILayoutVO::getLayoutAreaType));
-//				if(layoutAreaMap.containsKey("1")){
-//					//
-//				}
-//			}
-//		}
-//	}
+	//	private List<UILayoutVO> swapLayArea(List<UILayoutVO> layoutVOS){
+	//		List<UILayoutVO> layoutVOList = new ArrayList<>();
+	//		//1 瀵艰埅鍖�
+	//		//2 涓诲唴瀹瑰尯
+	//		//3 椤电鍖�
+	//		if(!CollectionUtils.isEmpty(layoutVOS)){
+	//			//鍙湁涓�涓尯鍩熺殑鏃跺�欙紝閮芥斁鍦╟enter閲岋紝鍝�曟湰韬槸瀵艰埅鍖�
+	//			if(layoutVOS.size() == 1){
+	//				layoutVOS.get(0).setLayoutAreaType(UILayoutAreaTypeEnum.CENTER.getValue());
+	//				layoutVOList.add(layoutVOS.get(0));
+	//			}else{
+	//				Map<String,List<UILayoutVO>> layoutAreaMap = layoutVOS.stream().collect(Collectors.groupingBy(UILayoutVO::getLayoutAreaType));
+	//				if(layoutAreaMap.containsKey("1")){
+	//					//
+	//				}
+	//			}
+	//		}
+	//	}
 
 	/**
 	 * 鑾峰彇鏌愪釜UI涓婁笅鏂囩殑鍖哄煙
@@ -1082,9 +1090,9 @@
 	 * @param pages 鍖哄煙鐨勬暟鎹璞�
 	 * @return 鏄剧ず瀵硅薄
 	 */
-	private List<UILayoutVO> UILayoutDO2VOs(Collection<com.vci.corba.portal.data.PLTabPage> pages, boolean queryDetail){
+	private List<UILayoutVO> UILayoutDO2VOs(Collection<PLTabPage> pages, boolean queryDetail){
 		List<UILayoutVO> contentVOS = new ArrayList<>();
-		Optional.ofNullable(pages).orElseGet(()->new ArrayList<com.vci.corba.portal.data.PLTabPage>()).stream().forEach(page->{
+		Optional.ofNullable(pages).orElseGet(()->new ArrayList<PLTabPage>()).stream().forEach(page->{
 			UILayoutVO layoutVO = UILayoutDO2VO(page, queryDetail);
 			if(layoutVO.isEnableStatus()) {
 				contentVOS.add(layoutVO);
@@ -1108,7 +1116,7 @@
 	 * @return 鍖哄煙鐨勬樉绀哄璞�
 	 */
 	@VciUnLog
-	private UILayoutVO UILayoutDO2VO(com.vci.corba.portal.data.PLTabPage page, boolean queryDetail){
+	private UILayoutVO UILayoutDO2VO(PLTabPage page, boolean queryDetail){
 		UILayoutVO layoutVO = new UILayoutVO();
 		if(page !=null ){
 			layoutVO.setOid(page.plOId);
@@ -1196,8 +1204,7 @@
 		}
 		if(!QUERY_BY_CACHE){
 			try {
-				platformClientUtil.getPortalService().getPLPageDefinationById(componentOid);
-				return uiComponentDO2VO(null,true);
+				return uiComponentDO2VO(ServiceProvider.getUIService().getPLPageDefinationById(componentOid),true);
 			} catch (VCIError vciError) {
 				throw WebUtil.getVciBaseException(vciError);
 			}
@@ -1230,7 +1237,7 @@
 	 * @return 鏄剧ず瀵硅薄
 	 */
 	@VciUnLog
-	private UIComponentVO uiComponentDO2VO(com.vci.corba.portal.data.PLPageDefination page, boolean queryDetail){
+	private UIComponentVO uiComponentDO2VO(PLPageDefination page, boolean queryDetail){
 		UIComponentVO componentVO = new UIComponentVO();
 		if(page !=null){
 			componentVO.setOid(page.plOId);
@@ -1270,6 +1277,7 @@
 				}else{
 					try {
 						componentVO.setTableDefineVO(tableDO2VO(ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true));
+						//componentVO.setTableDefineVO(tableDO2VO(platformClientUtil.getPortalService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true));
 					} catch (VCIError vciError) {
 						throw WebUtil.getVciBaseException(vciError);
 					}
@@ -1426,8 +1434,6 @@
 		}
 	}
 
-
-
 	/**
 	 * 鎸夐挳鐨勬暟鎹璞¤浆鎹负鏄剧ず瀵硅薄
 	 * @param buttons 鎸夐挳鐨勬暟鎹璞�
@@ -1482,10 +1488,10 @@
 				//鏌ユ壘鍙傛暟
 				Map<String,String> params = new HashMap<>();
 				try {
-//					PLCommandParameter[] parameters = platformClientUtil.getPortalService().getPLCommandParametersByCommandOId(buttonVO.getOid());
-					com.vci.corba.portal.data.PLCommandParameter[] parameters = ServiceProvider.getUIService().getPLCommandParametersByCommandOId(buttonVO.getOid());
+					//PLCommandParameter[] parameters = platformClientUtil.getPortalService().getPLCommandParametersByCommandOId(buttonVO.getOid());
+					PLCommandParameter[] parameters = ServiceProvider.getUIService().getPLCommandParametersByCommandOId(buttonVO.getOid());
 					if(parameters!=null && parameters.length > 0){
-						for(com.vci.corba.portal.data.PLCommandParameter parameter: parameters){
+						for(PLCommandParameter parameter: parameters){
 							params.put(parameter.plKey,parameter.plValue);
 						}
 					}
@@ -1547,21 +1553,24 @@
 	@Cacheable(value = VCI_OBJECT_SERVICE,key = "#p0.concat('${uicache}').concat(#p1)",unless = "#result == null || #p0 == null || #p1 ==null")
 	public UIContentVO getUIContentByBtmTypeAndId(String btmType, String id) {
 		WebUtil.alertNotNull(btmType,"涓氬姟绫诲瀷鎴栬�呴摼鎺ョ被鍨�",id,"UI涓婁笅鏂囩殑缂栧彿");
-		PLPageLayoutDefination[] obj = null;
+		PLUILayout[] obj = null;
 		try {
-			obj = platformClientUtil.getPortalService().getPLPageLayoutDefinationsByRelatedType(btmType);
+			obj = ServiceProvider.getUIService().getPLUILayoutsByRelatedType(btmType);
+//			obj = platformClientUtil.getPortalService().getPLPageLayoutDefinationsByRelatedType(btmType);
+//			obj = ServiceProvider.geT(btmType);
+
 		} catch (VCIError vciError) {
 			throw WebUtil.getVciBaseException(vciError);
 		}
-		PLPageLayoutDefination context = null;
+		PLUILayout context = null;
 		for (int i = 0; i < obj.length; i++) {
 			if (obj[i].plCode.equals(id)) {
 				context = obj[i];
 				break;
 			}
 		}
-//		return UIContentDO2VO(context,true);
-		return UIContentDO2VO(null,true);
+		return UIContentDO2VO(context,true);
+//		return UIContentDO2VO(null,true);
 	}
 }
 

--
Gitblit v1.9.3