yuxc
2024-06-04 93f7335e1a52591662d5d37f41ac352860b2ca2a
Source/platformProject/vci-platform-web/src/main/java/com/vci/web/util/WebUtil.java
@@ -2,11 +2,15 @@
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.vci.base.ui.exception.VCIException;
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.VCIError;
import com.vci.corba.framework.data.UserEntityInfo;
import com.vci.rmip.framework.client.systemConfig.object.UserEntityObject;
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;
@@ -19,7 +23,6 @@
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;
@@ -27,14 +30,8 @@
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;
@@ -81,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("")) {
@@ -242,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;
@@ -256,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;
@@ -1321,7 +1318,7 @@
    * @param obj 对象
    * @param fieldAttrMap 属性map
    */
    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){
@@ -1395,7 +1392,7 @@
                }else {
                  clo.setAttributeValue(key.toLowerCase(), value);
               }
             } catch (VCIError e) {
             } catch (PLException e) {
                throw WebUtil.getVciBaseException(e);
             }
          }
@@ -1438,7 +1435,7 @@
                   setValueToField(fieldName, cbo, value);
                }
                cbo.setAttributeValue(attrName.toLowerCase(), value);
             } catch (VCIError e) {
             } catch (PLException e) {
                throw WebUtil.getVciBaseException(e);
             }
          }
@@ -1510,10 +1507,10 @@
    * @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;
//   }
   /**
    * 转换异常
@@ -1530,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);
   }
   /**