Source/platformProject/vci-platform-web/src/main/java/com/vci/web/util/WebUtil.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.vci.base.ui.exception.VCIException;
import com.vci.corba.common.PLException;
import com.vci.corba.common.VCIError;
import com.vci.corba.framework.data.UserEntityInfo;
import com.vci.rmip.framework.client.systemConfig.object.UserEntityObject;
@@ -20,6 +21,9 @@
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;
@@ -1077,7 +1081,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 +1093,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 +1145,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 +1155,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;
         //要先把BO对象上的值拷贝过去
         List<Field> boFields = getAllFieldForObj(bo.getClass());
   
@@ -1175,7 +1179,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 +1197,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 +1221,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 +1232,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 +1259,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 +1270,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);
            }
@@ -1350,7 +1354,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 +1368,7 @@
                   setValueToField(key, cbo, value);
                }
                cbo.setAttributeValueWithNoCheck(key.toLowerCase(), value);
             } catch (VCIError e) {
             } catch (PLException e) {
                throw WebUtil.getVciBaseException(e);
             }
          }
@@ -1516,6 +1520,16 @@
    * @param e 异常对象
    * @return base异常对象
    */
   public static VciBaseException getVciBaseException(PLException e){
      return new VciBaseException(e.code, new java.lang.String[]{e.getMessage()});
//      return null;
   }
   /**
    * 转换异常
    * @param e 异常对象
    * @return base异常对象
    */
   public static VciBaseException getVciBaseException(VCIException e){
      String[] errorMsgs = new String[0];
      if(e != null && e.getException_objArray() !=null ){
@@ -1654,14 +1668,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 +1737,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("数据解析错误",e);
         return null;
      }
      return clientBusinessObject;
   }
}