From f29ad099c6dc5c55d6cb94fb190d06743777ec6d Mon Sep 17 00:00:00 2001
From: dangsn <dangsn@chicecm.com>
Date: 星期三, 05 六月 2024 10:56:48 +0800
Subject: [PATCH] 项目引用调整

---
 Source/platformProject/vci-platform-web/src/main/java/com/vci/web/util/WebUtil.java |  135 +++++++++++++++++++++++++++-----------------
 1 files changed, 83 insertions(+), 52 deletions(-)

diff --git a/Source/platformProject/vci-platform-web/src/main/java/com/vci/web/util/WebUtil.java b/Source/platformProject/vci-platform-web/src/main/java/com/vci/web/util/WebUtil.java
index 2dc6fe5..15dd76a 100644
--- a/Source/platformProject/vci-platform-web/src/main/java/com/vci/web/util/WebUtil.java
+++ b/Source/platformProject/vci-platform-web/src/main/java/com/vci/web/util/WebUtil.java
@@ -2,10 +2,15 @@
 
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.vci.base.ui.exception.VCIException;
-import com.vci.corba.common.VCIError;
-import com.vci.corba.framework.data.UserEntityInfo;
-import com.vci.rmip.framework.client.systemConfig.object.UserEntityObject;
+import com.vci.client.bof.ClientBusinessObject;
+import com.vci.client.bof.ClientLinkObject;
+import com.vci.client.common.objects.UserEntityObject;
+import com.vci.common.exception.VciException;
+import com.vci.corba.common.PLException;
+import com.vci.corba.common.data.UserEntityInfo;
+import com.vci.corba.omd.data.AttributeValue;
+import com.vci.corba.omd.data.BusinessObject;
+import com.vci.corba.omd.data.LinkObject;
 import com.vci.starter.revision.bo.TreeWrapperOptions;
 import com.vci.starter.web.annotation.*;
 import com.vci.starter.web.constant.QueryOptionConstant;
@@ -18,19 +23,15 @@
 import com.vci.starter.web.util.*;
 import com.vci.starter.web.wrapper.VciQueryWrapperForDO;
 import com.vci.web.pageModel.*;
-import com.vci.web.properties.WebProperties;
 import com.vci.web.service.impl.WebLoServiceImpl;
+import net.sf.jsqlparser.parser.CCJSqlParserUtil;
+import net.sf.jsqlparser.statement.select.PlainSelect;
+import net.sf.jsqlparser.statement.select.SelectItem;
 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.Component;
 import org.springframework.util.CollectionUtils;
-import plm.bs.bom.clientobject.ClientBusinessObject;
-import plm.bs.bom.clientobject.ClientLinkObject;
-import plm.bs.bom.common.AttributeValue;
-import plm.bs.bom.common.BusinessObject;
-import plm.bs.bom.common.LinkObject;
 
 import javax.servlet.http.HttpServletRequest;
 import java.beans.IntrospectionException;
@@ -77,16 +78,16 @@
 			if (e == null) {
 				return errContent;
 			}
-			if (e instanceof VCIError ) {
+			if (e instanceof PLException ) {
 //				String error_code = ((VCIError) e).error_code;
 //				String[] error_message = ((VCIError) e).error_message;
 //				return MessageUtils.get(error_code, error_message);
 				return null;
 			} else if(e instanceof VciBaseException || e.getClass().getSuperclass().equals(VciBaseException.class)){
 				return LangBaseUtil.getErrorMsg(e);
-			}else if (e instanceof VCIException){
-				String error_code = ((VCIException) e).getException_code();
-				Object[] error_message = ((VCIException) e).getException_objArray();
+			}else if (e instanceof VciException){
+				String error_code = ((VciException) e).getCode();
+				Object[] error_message = ((VciException) e).getObjArray();
 				return MessageUtils.get(error_code, error_message);
 			}else if (e.getCause() != null
 					&& !e.getCause().toString().equals("")) {
@@ -238,7 +239,7 @@
 	public static UserEntityInfo getUserEntityInfo(String model){
 		SessionInfo si = WebUtil.getCurrentUserSessionInfo();
 		UserEntityInfo ueo = new UserEntityInfo();
-		ueo.ip = si.getIp();
+//		ueo.ip = si.getIp();
 		ueo.modules = model;
 		ueo.userName = si.getUserId();
 		return ueo;
@@ -252,7 +253,7 @@
 	public static UserEntityObject getUserEntityObject(String model) {
 		UserEntityObject entityObject = new UserEntityObject();
 		SessionInfo si = WebUtil.getCurrentUserSessionInfo();
-		entityObject.setIp(si.getIp());
+//		entityObject.setIp(si.getIp());
 		entityObject.setModules(model);
 		entityObject.setUserName(si.getUserId());
 		return entityObject;
@@ -1077,7 +1078,7 @@
 	 * @param cbo 涓氬姟鏁版嵁
 	 * @param obj 瀵硅薄
 	 */
-	public static void copyValueToObjectFromCbos(ClientBusinessObject cbo,Object obj){
+	public static void copyValueToObjectFromCbos(com.vci.client.bof.ClientBusinessObject cbo,Object obj){
 		if(cbo!=null){
 			copyValueToObjectFromBos(cbo.getBusinessObject(),obj);
 		}
@@ -1089,7 +1090,7 @@
 	 * @param obj 瀵硅薄
 	 * @param fieldAttrMap 灞炴�ф槧灏�
 	 */
-	public static void copyValueToObjectFromCbos(ClientBusinessObject cbo,Object obj,Map<String,String> fieldAttrMap){
+	public static void copyValueToObjectFromCbos(com.vci.client.bof.ClientBusinessObject cbo,Object obj,Map<String,String> fieldAttrMap){
 		if(cbo!=null){
 			copyValueToObjectFromBos(cbo.getBusinessObject(),obj,fieldAttrMap);
 		}
@@ -1141,7 +1142,7 @@
 	 * @param bo 涓氬姟鏁版嵁
 	 * @param obj 瀵硅薄
 	 */
-	public static void copyValueToObjectFromBos(BusinessObject bo ,Object obj){
+	public static void copyValueToObjectFromBos(com.vci.corba.omd.data.BusinessObject bo ,Object obj){
 		copyValueToObjectFromBos(bo,obj,null);
 	}
 
@@ -1151,14 +1152,14 @@
 	 * @param obj 瀵硅薄
 	 * @param fieldAttrMap 灞炴�ф槧灏�
 	 */
-    public static void copyValueToObjectFromBos(BusinessObject bo ,Object obj,Map<String,String> fieldAttrMap){
+    public static void copyValueToObjectFromBos(com.vci.corba.omd.data.BusinessObject bo , Object obj, Map<String,String> fieldAttrMap){
     	if(bo!=null && obj != null){
     		//鍏堟妸鎵�鏈夌殑瀛楁鏄犲皠鎵惧埌
     		if(fieldAttrMap == null){
     			fieldAttrMap = getFieldNameMap(obj.getClass());
     		}
-			AttributeValue[] newAList = bo.newAttrValList;
-			AttributeValue[] hisAList = bo.hisAttrValList;
+			com.vci.corba.omd.data.AttributeValue[] newAList = bo.newAttrValList;
+			com.vci.corba.omd.data.AttributeValue[] hisAList = bo.hisAttrValList;
 			//瑕佸厛鎶夿O瀵硅薄涓婄殑鍊兼嫹璐濊繃鍘�
 			List<Field> boFields = getAllFieldForObj(bo.getClass());
 	
@@ -1175,7 +1176,7 @@
 			}
 			if(newAList!=null&&newAList.length>0){
 				for(int i = 0 ; i < newAList.length;i++){
-					AttributeValue av = newAList[i];
+					com.vci.corba.omd.data.AttributeValue av = newAList[i];
 					String attrName = av.attrName.toLowerCase();
 					if(fieldAttrMap.containsKey(attrName)) {
 						String fieldName = fieldAttrMap.get(attrName);
@@ -1193,7 +1194,7 @@
 			}
 			if(hisAList!=null&&hisAList.length>0){
 				for(int i = 0 ; i < hisAList.length;i++){
-					AttributeValue av = hisAList[i];
+					com.vci.corba.omd.data.AttributeValue av = hisAList[i];
 					String attrName = av.attrName.toLowerCase();
 					String fieldName = fieldAttrMap.get(attrName);
 					if(fieldName!=null){
@@ -1217,7 +1218,7 @@
 	 * @param cbo 涓氬姟鏁版嵁
 	 * @param map map
 	 */
-	public static void copyValueToMapFromCbos(ClientBusinessObject cbo,Map<String,String> map){
+	public static void copyValueToMapFromCbos(com.vci.client.bof.ClientBusinessObject cbo,Map<String,String> map){
     	if(cbo!=null){
     		copyValueToMapFromBos(cbo.getBusinessObject(),map);
 		}
@@ -1228,21 +1229,21 @@
 	 * @param bo 涓氬姟鏁版嵁
 	 * @param map map
 	 */
-    public static void copyValueToMapFromBos(BusinessObject bo,Map<String,String> map){
+    public static void copyValueToMapFromBos(com.vci.corba.omd.data.BusinessObject bo, Map<String,String> map){
     	if(bo!=null ){
     		//鍏堟妸鎵�鏈夌殑瀛楁鏄犲皠鎵惧埌
-			AttributeValue[] newAList = bo.newAttrValList;
-			AttributeValue[] hisAList = bo.hisAttrValList;
+			com.vci.corba.omd.data.AttributeValue[] newAList = bo.newAttrValList;
+			com.vci.corba.omd.data.AttributeValue[] hisAList = bo.hisAttrValList;
 			if(hisAList!=null&&hisAList.length>0){//
 				for(int i = 0 ; i < hisAList.length;i++){
-					AttributeValue av = hisAList[i];
+					com.vci.corba.omd.data.AttributeValue av = hisAList[i];
 					String attrName = av.attrName.toLowerCase();
 					map.put(attrName, av.attrVal);
 				}
 			}
 			if(newAList!=null&&newAList.length>0){//NEW鐨勪紭鍏堢骇楂樹簺
 				for(int i = 0 ; i < newAList.length;i++){
-					AttributeValue av = newAList[i];
+					com.vci.corba.omd.data.AttributeValue av = newAList[i];
 					String attrName = av.attrName.toLowerCase();
 					map.put(attrName, av.attrVal);
 				}
@@ -1255,7 +1256,7 @@
 	 * @param clo 閾炬帴绫诲瀷
 	 * @param map map
 	 */
-	public static void copyValueToMapFromClos(ClientLinkObject clo,Map<String,String> map){
+	public static void copyValueToMapFromClos(com.vci.client.bof.ClientLinkObject clo,Map<String,String> map){
     	if(clo!=null){
     		copyValueToMapFromLos(clo.getLinkObject(),map);
     	}
@@ -1266,24 +1267,24 @@
 	 * @param lo 閾炬帴绫诲瀷
 	 * @param map map
 	 */
-	public static void copyValueToMapFromLos(LinkObject lo,Map<String,String> map){
+	public static void copyValueToMapFromLos(com.vci.corba.omd.data.LinkObject lo,Map<String,String> map){
     	if(lo!=null){
 			WebLoServiceImpl.LO_BASE_FIELD_MAP.forEach((field,attr)->{
 				map.put(attr.toLowerCase(),getValueFromFieldForCbo(getFieldForObject(field,lo),lo));
 			});
     		//鍏堟妸鎵�鏈夌殑瀛楁鏄犲皠鎵惧埌
-			AttributeValue[] newAList = lo.newAttrValList;
-			AttributeValue[] hisAList = lo.hisAttrValList;
+			com.vci.corba.omd.data.AttributeValue[] newAList = lo.newAttrValList;
+			com.vci.corba.omd.data.AttributeValue[] hisAList = lo.hisAttrValList;
 			if(hisAList!=null&&hisAList.length>0){
 				for(int i = 0 ; i < hisAList.length;i++){
-					AttributeValue av = hisAList[i];
+					com.vci.corba.omd.data.AttributeValue av = hisAList[i];
 					String attrName = av.attrName.toLowerCase();
 					map.put(attrName, av.attrVal);
 				}
 			}
 			if(newAList!=null&&newAList.length>0){
 				for(int i = 0 ; i < newAList.length;i++){
-					AttributeValue av = newAList[i];
+					com.vci.corba.omd.data.AttributeValue av = newAList[i];
 					String attrName = av.attrName.toLowerCase();
 					map.put(attrName, av.attrVal);
 				}
@@ -1317,7 +1318,7 @@
 	 * @param obj 瀵硅薄
 	 * @param fieldAttrMap 灞炴�ap
 	 */
-    public static void copyValueToObjectFromLos(LinkObject lo ,Object obj,Map<String,String> fieldAttrMap){
+    public static void copyValueToObjectFromLos(LinkObject lo , Object obj, Map<String,String> fieldAttrMap){
     	if(lo!=null && obj != null){
     		//鍏堟妸鎵�鏈夌殑瀛楁鏄犲皠鎵惧埌
     		if(fieldAttrMap == null){
@@ -1350,7 +1351,7 @@
 	 * @param cbo 閾炬帴绫诲瀷
 	 * @param map 瀵硅薄
 	 */
-    public static void copyValueToCboFromMap(ClientBusinessObject cbo,Map<String,String> map) throws VciBaseException{
+    public static void copyValueToCboFromMap(com.vci.client.bof.ClientBusinessObject cbo,Map<String,String> map) throws VciBaseException{
     	if(map!=null){
     		Iterator<String> it = map.keySet().iterator();
     		while(it.hasNext()){
@@ -1364,7 +1365,7 @@
     					setValueToField(key, cbo, value);
     				}
     				cbo.setAttributeValueWithNoCheck(key.toLowerCase(), value);
-    			} catch (VCIError e) {
+    			} catch (PLException e) {
     				throw WebUtil.getVciBaseException(e);
     			}
     		}
@@ -1391,7 +1392,7 @@
     				}else {
 						clo.setAttributeValue(key.toLowerCase(), value);
 					}
-    			} catch (VCIError e) {
+    			} catch (PLException e) {
     				throw WebUtil.getVciBaseException(e);
     			}
     		}
@@ -1434,7 +1435,7 @@
     					setValueToField(fieldName, cbo, value);
     				}
     				cbo.setAttributeValue(attrName.toLowerCase(), value);
-    			} catch (VCIError e) {
+    			} catch (PLException e) {
     				throw WebUtil.getVciBaseException(e);
     			}
     		}
@@ -1506,9 +1507,19 @@
 	 * @param e 寮傚父瀵硅薄
 	 * @return base寮傚父瀵硅薄
 	 */
-	public static VciBaseException getVciBaseException(VCIError e){
-//		return new VciBaseException(e.error_code, e.error_message);
-		return null;
+//	public static VciBaseException getVciBaseException(PLException e){
+////		return new VciBaseException(e.error_code, e.error_message);
+//		return null;
+//	}
+
+	/**
+	 * 杞崲寮傚父
+	 * @param e 寮傚父瀵硅薄
+	 * @return base寮傚父瀵硅薄
+	 */
+	public static VciBaseException getVciBaseException(PLException e){
+		return new VciBaseException(e.code, new java.lang.String[]{e.getMessage()});
+//		return null;
 	}
 
 	/**
@@ -1516,15 +1527,15 @@
 	 * @param e 寮傚父瀵硅薄
 	 * @return base寮傚父瀵硅薄
 	 */
-	public static VciBaseException getVciBaseException(VCIException e){
+	public static VciBaseException getVciBaseException(VciException e){
 		String[] errorMsgs = new String[0];
-		if(e != null && e.getException_objArray() !=null ){
-			errorMsgs = new String[e.getException_objArray().length];
+		if(e != null && e.getObjArray() !=null ){
+			errorMsgs = new String[e.getObjArray().length];
 			for(int i = 0 ; i < errorMsgs.length ; i ++){
-				errorMsgs[i] = e.getException_objArray()[i].toString();
+				errorMsgs[i] = e.getObjArray()[i].toString();
 			}
 		}
-		return new VciBaseException(e == null ?"com.vci.web.base.unknowerror":e.getException_code(), errorMsgs);
+		return new VciBaseException(e == null ?"com.vci.web.base.unknowerror":e.getCode(), errorMsgs);
 	}
 
 	/**
@@ -1654,14 +1665,14 @@
 	 * @param wrapperOptions 灏佽鐨勪俊鎭�
 	 * @return 鏍戝垪琛�
 	 */
-	public static <T,R> List<Tree> cboList2Trees(List<? extends ClientBusinessObject> doList, TreeWrapperOptions wrapperOptions, Function<T,R> f){
+	public static <T,R> List<Tree> cboList2Trees(List<? extends com.vci.client.bof.ClientBusinessObject> doList, TreeWrapperOptions wrapperOptions, Function<T,R> f){
 		if(CollectionUtils.isEmpty(doList)){
 			return new ArrayList<>();
 		}
 		List<Tree> allTree = new ArrayList<Tree>();
 		List<Tree> children = new ArrayList<Tree>();
 		for (int i = 0 ; i < doList.size();i++) {
-			ClientBusinessObject cbo =  doList.get(i);
+			com.vci.client.bof.ClientBusinessObject cbo =  doList.get(i);
 			Tree tree =new Tree();
 			List<String> oidFieldNames = VciBaseUtil.str2List(wrapperOptions.getOidFieldName());
 			List<String> oidValues = new LinkedList<>();
@@ -1723,4 +1734,24 @@
 		new Tree().findChild(allTree,children);
 		return allTree;
 	}
+
+	public static com.vci.client.bof.ClientBusinessObject arryAndSqlToClientBusinessObject(String sqlStr,String[] valueArry) {
+		com.vci.client.bof.ClientBusinessObject clientBusinessObject = new com.vci.client.bof.ClientBusinessObject();
+		try {
+			PlainSelect select = (PlainSelect) CCJSqlParserUtil.parse(sqlStr);
+			com.vci.corba.omd.data.AttributeValue[] attributeValues = new com.vci.corba.omd.data.AttributeValue[valueArry.length];
+			for (int i = 0; i < select.getSelectItems().size(); i++) {
+				SelectItem selectItem = select.getSelectItem(i);
+				com.vci.corba.omd.data.AttributeValue attributeValue = new com.vci.corba.omd.data.AttributeValue();
+				attributeValue.attrName = selectItem.getAlias().getName();
+				attributeValue.attrVal	= valueArry[i];
+				attributeValues[i] = attributeValue;
+			}
+			clientBusinessObject.getBusinessObject().newAttrValList= attributeValues;
+		}catch (Exception e){
+			logger.error("鏁版嵁瑙f瀽閿欒",e);
+			return null;
+		}
+		return clientBusinessObject;
+	}
 }

--
Gitblit v1.9.3