Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/util/WebUtil.java
@@ -2,8 +2,6 @@
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
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;
@@ -11,6 +9,8 @@
import com.vci.corba.omd.data.AttributeValue;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.data.LinkObject;
import com.vci.omd.utils.ObjectTool;
import com.vci.pagemodel.LinkTypeInfoVO;
import com.vci.starter.revision.bo.TreeWrapperOptions;
import com.vci.starter.web.annotation.*;
import com.vci.starter.web.constant.QueryOptionConstant;
@@ -22,7 +22,6 @@
import com.vci.starter.web.toolmodel.DateConverter;
import com.vci.starter.web.util.*;
import com.vci.starter.web.wrapper.VciQueryWrapperForDO;
import com.vci.web.pageModel.*;
import com.vci.web.service.impl.WebLoServiceImpl;
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.statement.select.PlainSelect;
@@ -187,7 +186,7 @@
    * @return 用户对象,但是不抛出异常
    */
   public static SessionInfo getCurrentUserSessionInfoNotException() {
      return WebThreadLocalUtil.getCurrentUserSessionInfoInThread().get();
      return WebThreadLocalUtil.getCurrentUserSessionInfoInThread();
   }
   /**
@@ -195,7 +194,7 @@
    * @param sessionInfo 会话信息
    */
   public static synchronized void setSessionInfo(SessionInfo sessionInfo){
       WebThreadLocalUtil.getCurrentUserSessionInfoInThread().set(sessionInfo);
       WebThreadLocalUtil.setCurrentUserSessionInfoInThread(sessionInfo);
   }
   /**
@@ -1078,9 +1077,9 @@
    * @param cbo 业务数据
    * @param obj 对象
    */
   public static void copyValueToObjectFromCbos(com.vci.client.bof.ClientBusinessObject cbo,Object obj){
   public static void copyValueToObjectFromCbos(BusinessObject cbo,Object obj){
      if(cbo!=null){
         copyValueToObjectFromBos(cbo.getBusinessObject(),obj);
         copyValueToObjectFromBos(cbo,obj);
      }
   }
@@ -1090,9 +1089,9 @@
    * @param obj 对象
    * @param fieldAttrMap 属性映射
    */
   public static void copyValueToObjectFromCbos(com.vci.client.bof.ClientBusinessObject cbo,Object obj,Map<String,String> fieldAttrMap){
   public static void copyValueToObjectFromCbos(BusinessObject cbo,Object obj,Map<String,String> fieldAttrMap){
      if(cbo!=null){
         copyValueToObjectFromBos(cbo.getBusinessObject(),obj,fieldAttrMap);
         copyValueToObjectFromBos(cbo,obj,fieldAttrMap);
      }
   }
@@ -1218,9 +1217,9 @@
    * @param cbo 业务数据
    * @param map map
    */
   public static void copyValueToMapFromCbos(com.vci.client.bof.ClientBusinessObject cbo,Map<String,String> map){
   public static void copyValueToMapFromCbos(BusinessObject cbo,Map<String,String> map){
       if(cbo!=null){
          copyValueToMapFromBos(cbo.getBusinessObject(),map);
          copyValueToMapFromBos(cbo,map);
      }
    }
@@ -1256,9 +1255,9 @@
    * @param clo 链接类型
    * @param map map
    */
   public static void copyValueToMapFromClos(com.vci.client.bof.ClientLinkObject clo,Map<String,String> map){
   public static void copyValueToMapFromClos(LinkObject clo,Map<String,String> map){
       if(clo!=null){
          copyValueToMapFromLos(clo.getLinkObject(),map);
          copyValueToMapFromLos(clo,map);
       }
    }
@@ -1297,9 +1296,9 @@
    * @param obj 对象
    * @param fieldAttrMap 属性map
    */
    public static void copyValueToObjectFromClos(ClientLinkObject clo,Object obj,Map<String,String> fieldAttrMap){
    public static void copyValueToObjectFromClos(LinkObject clo,Object obj,Map<String,String> fieldAttrMap){
      if(clo!=null){
         copyValueToObjectFromLos(clo.getLinkObject(),obj,fieldAttrMap);
         copyValueToObjectFromLos(clo,obj,fieldAttrMap);
      }
   }
@@ -1351,7 +1350,7 @@
    * @param cbo 链接类型
    * @param map 对象
    */
    public static void copyValueToCboFromMap(com.vci.client.bof.ClientBusinessObject cbo,Map<String,String> map) throws VciBaseException{
    public static void copyValueToCboFromMap(BusinessObject cbo,Map<String,String> map) throws VciBaseException{
       if(map!=null){
          Iterator<String> it = map.keySet().iterator();
          while(it.hasNext()){
@@ -1360,15 +1359,11 @@
             if(value == null){
                value = "";
             }
             try {
                if(isDefaultField(key)){
                   setValueToField(key, cbo, value);
                }
                cbo.setAttributeValueWithNoCheck(key.toLowerCase(), value);
             } catch (PLException e) {
                throw WebUtil.getVciBaseException(e);
             }
          }
            if(isDefaultField(key)){
               setValueToField(key, cbo, value);
            }
            ObjectTool.setBOAttributeValue(cbo,key.toLowerCase(), value);
         }
       }
    }
@@ -1377,7 +1372,7 @@
    * @param clo 链接类型
    * @param map 对象
    */
    public static void copyValueToCloFromMap(ClientLinkObject clo,Map<String,String> map) throws VciBaseException{
    public static void copyValueToCloFromMap(LinkObject clo,Map<String,String> map) throws VciBaseException{
       if(map!=null){
          Iterator<String> it = map.keySet().iterator();
          while(it.hasNext()){
@@ -1386,16 +1381,12 @@
             if(value == null){
                value = "";
             }
             try {
                if(isDefaultField(key)){
                   setValueToField(key, clo, value);
                }else {
                  clo.setAttributeValue(key.toLowerCase(), value);
               }
             } catch (PLException e) {
                throw WebUtil.getVciBaseException(e);
             }
          }
            if(isDefaultField(key)){
               setValueToField(key, clo, value);
            }else {
               ObjectTool.setLOAttributeValue(clo,key.toLowerCase(), value);
            }
         }
       }
    }
@@ -1406,10 +1397,10 @@
    * @throws VciBaseException 拷贝出错的时候会抛出异常
    */
   public static void copyValueToBoFromObj(BusinessObject bo,Object obj) throws VciBaseException{
       ClientBusinessObject cbo = new ClientBusinessObject();
       cbo.setBusinessObject(bo);
       BusinessObject cbo = new BusinessObject();
       cbo = bo;
       copyValueToCboFromObj(cbo,obj);
       bo = cbo.getBusinessObject();
       bo = cbo;
    }
   /**
@@ -1418,7 +1409,7 @@
    * @param obj 数据对象
    * @throws VciBaseException 拷贝出错的时候会抛出异常
    */
   public static void copyValueToCboFromObj(ClientBusinessObject cbo ,Object obj) throws VciBaseException{
   public static void copyValueToCboFromObj(BusinessObject cbo ,Object obj) throws VciBaseException{
       Map<String,String> fieldMap = getFieldNameMap(obj.getClass());//先查找所有需要持久化到平台的属性,不需要持久化的就不用赋值了
       Iterator<String> it = fieldMap.keySet().iterator();
       while(it.hasNext()){
@@ -1430,15 +1421,11 @@
             if(value==null){
                value = "";
             }
             try {
                if(isDefaultField(fieldName)){
                   setValueToField(fieldName, cbo, value);
                }
                cbo.setAttributeValue(attrName.toLowerCase(), value);
             } catch (PLException e) {
                throw WebUtil.getVciBaseException(e);
             }
          }
            if(isDefaultField(fieldName)){
               setValueToField(fieldName, cbo, value);
            }
            ObjectTool.setBOAttributeValue(cbo,attrName.toLowerCase(), value);
         }
       }
    }
@@ -1665,19 +1652,19 @@
    * @param wrapperOptions 封装的信息
    * @return 树列表
    */
   public static <T,R> List<Tree> cboList2Trees(List<? extends com.vci.client.bof.ClientBusinessObject> doList, TreeWrapperOptions wrapperOptions, Function<T,R> f){
   public static <T,R> List<Tree> cboList2Trees(List<? extends BusinessObject> 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++) {
         com.vci.client.bof.ClientBusinessObject cbo =  doList.get(i);
         BusinessObject cbo =  doList.get(i);
         Tree tree =new Tree();
         List<String> oidFieldNames = VciBaseUtil.str2List(wrapperOptions.getOidFieldName());
         List<String> oidValues = new LinkedList<>();
         oidFieldNames.stream().forEach( s->{
            oidValues.add(cbo.getAttributeValue(s));
            oidValues.add(ObjectTool.getBOAttributeValue(cbo, s));
         });
         tree.setOid(oidValues.stream().collect(Collectors.joining(wrapperOptions.getOidValueSep())));
         if(f !=null){
@@ -1686,12 +1673,12 @@
            List<String> textFieldNames = VciBaseUtil.str2List(wrapperOptions.getTextFieldName());
            List<String> textValues = new LinkedList<>();
            textFieldNames.stream().forEach( s->{
               textValues.add(cbo.getAttributeValue(s));
               textValues.add(ObjectTool.getBOAttributeValue(cbo, s));
            });
            tree.setText(textValues.stream().collect(Collectors.joining(wrapperOptions.getTextValueSep())));
         }
         if(StringUtils.isNotBlank(wrapperOptions.getParentFieldName())){
            tree.setParentId(cbo.getAttributeValue(wrapperOptions.getParentFieldName()));
            tree.setParentId(ObjectTool.getBOAttributeValue(cbo, wrapperOptions.getParentFieldName()));
         }
         if(wrapperOptions.isAllAttributes()) {
            try {
@@ -1735,23 +1722,23 @@
      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();
   public static BusinessObject arryAndSqlToBusinessObject(String sqlStr,String[] valueArry) {
      BusinessObject BusinessObject = new BusinessObject();
      try {
         PlainSelect select = (PlainSelect) CCJSqlParserUtil.parse(sqlStr);
         com.vci.corba.omd.data.AttributeValue[] attributeValues = new com.vci.corba.omd.data.AttributeValue[valueArry.length];
         AttributeValue[] attributeValues = new 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 attributeValue = new AttributeValue();
            attributeValue.attrName = selectItem.getAlias().getName();
            attributeValue.attrVal   = valueArry[i];
            attributeValues[i] = attributeValue;
         }
         clientBusinessObject.getBusinessObject().newAttrValList= attributeValues;
         BusinessObject.newAttrValList= attributeValues;
      }catch (Exception e){
         logger.error("数据解析错误",e);
         return null;
      }
      return clientBusinessObject;
      return BusinessObject;
   }
}