dangsn
2024-06-05 72c7bbd66b8456db7dabf0dbc15f7aa9c2af2b9d
Source/platformProject/vci-platform-web/src/main/java/com/vci/web/service/impl/UIEngineServiceImpl.java
@@ -5,9 +5,8 @@
import com.thoughtworks.xstream.io.xml.XmlFriendlyNameCoder;
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.corba.common.PLException;
import com.vci.corba.portal.data.*;
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.util.BeanUtil;
@@ -25,7 +24,6 @@
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;
@@ -41,12 +39,6 @@
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.*;
import java.util.stream.Collectors;
@@ -146,7 +138,7 @@
      try {
         portalVIS = ServiceProvider.getUIService().getAllPortalVI();
         // portalVIS = platformClientUtil.getPortalService().getAllPortalVI();
      } catch (VCIError vciError) {
      } catch (PLException vciError) {
         throw WebUtil.getVciBaseException(vciError);
      }
      for(int i = 0 ; i < portalVIS.length ; i++){
@@ -170,7 +162,7 @@
      PortalVI[] portalVIS = null;
      try {
         portalVIS = ServiceProvider.getUIService().getAllPortalVI();
      } catch (VCIError vciError) {
      } catch (PLException vciError) {
         throw WebUtil.getVciBaseException(vciError);
      }
      List<PortalVI> portalVIList = Arrays.stream(portalVIS).filter(portal -> 1 == portal.viType).collect(Collectors.toList());
@@ -372,18 +364,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.")
@@ -421,7 +413,7 @@
         PortalVI portalVI = null;
         try {
            portalVI = ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmId, id);
         } catch (VCIError vciError) {
         } catch (PLException vciError) {
            throw WebUtil.getVciBaseException(vciError);
         }
         return formDO2VO(portalVI);
@@ -464,7 +456,7 @@
      PortalVI[] portalVIS = null;
      try {
         portalVIS = ServiceProvider.getUIService().getAllPortalVI();
      } catch (VCIError vciError) {
      } catch (PLException vciError) {
         throw WebUtil.getVciBaseException(vciError);
      }
      List<PortalVI> portalVIList = Arrays.stream(portalVIS).filter(portal -> 0 == portal.viType).collect(Collectors.toList());
@@ -540,7 +532,7 @@
      }else{
         try {
            formDefineVO = formDO2VO(ServiceProvider.getUIService().getPortalVIById(formOid));
         } catch (VCIError vciError) {
         } catch (PLException vciError) {
            throw WebUtil.getVciBaseException(vciError);
         }
      }
@@ -741,7 +733,7 @@
         PortalVI portalVI = null;
         try {
            portalVI = ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmId, id);
         } catch (VCIError vciError) {
         } catch (PLException vciError) {
            throw WebUtil.getVciBaseException(vciError);
         }
         return tableDO2VO(portalVI,true);
@@ -783,7 +775,7 @@
      try {
//         return actionDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLAction()).collect(Collectors.toList()));
         return actionDO2VOs(Arrays.stream(ServiceProvider.getUIService().getAllPLAction()).collect(Collectors.toList()));
      } catch (VCIError vciError) {
      } catch (PLException vciError) {
         throw WebUtil.getVciBaseException(vciError);
      }
   }
@@ -872,8 +864,8 @@
   @Cacheable(value = VCI_OBJECT_SERVICE,key = CacheKeyConstant.ALL_UI,unless = "#result == null")
   public List<UIContentVO> selectAllUIContent() {
      try {
         return UIContentDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLPageLayoutDefinations()).collect(Collectors.toList()));
      } catch (VCIError vciError) {
         return UIContentDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLUILayouts()).collect(Collectors.toList()));
      } catch (PLException vciError) {
         throw WebUtil.getVciBaseException(vciError);
      }
   }
@@ -883,10 +875,10 @@
    * @param pageLayoutDefinations 上下文UI对象
    * @return 显示对象
    */
   private List<UIContentVO> UIContentDO2VOs(Collection<PLPageLayoutDefination> pageLayoutDefinations){
   private List<UIContentVO> UIContentDO2VOs(Collection<PLUILayout> pageLayoutDefinations){
      List<UIContentVO> contentVOS = new ArrayList<>();
      Optional.ofNullable(pageLayoutDefinations).orElseGet(()->new ArrayList<PLPageLayoutDefination>()).stream().forEach(pageLayout->{
//         contentVOS.add(UIContentDO2VO(pageLayout,false));
      Optional.ofNullable(pageLayoutDefinations).orElseGet(()->new ArrayList<PLUILayout>()).stream().forEach(pageLayout->{
         contentVOS.add(UIContentDO2VO(pageLayout,false));
      });
      if(!CollectionUtils.isEmpty(contentVOS)) {
         Map<String, List<UILayoutVO>> layoutMap = batchListLayoutByContent(contentVOS.stream().map(UIContentVO::getOid).collect(Collectors.toSet()));
@@ -1033,7 +1025,7 @@
   private List<UILayoutVO> listLayoutByContent(String pkContent){
      try {
         return UILayoutDO2VOs(Arrays.stream(ServiceProvider.getUIService().getPLTabPagesByPageDefinationOId(pkContent)).collect(Collectors.toList()),true);
      } catch (VCIError vciError) {
      } catch (PLException vciError) {
         throw WebUtil.getVciBaseException(vciError);
      }
   }
@@ -1079,7 +1071,7 @@
   public List<UILayoutVO> selectAllUILayout() {
//      try {
//         return UILayoutDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLTabPages()).collect(Collectors.toList()),true);
//      } catch (VCIError vciError) {
//      } catch (PLException vciError) {
//         throw WebUtil.getVciBaseException(vciError);
//      }
      return null;
@@ -1158,7 +1150,7 @@
            try {
               layoutVO.setComponentVOs(uiComponentDO2VOs(Arrays.stream(ServiceProvider.getUIService().getPLPageDefinationsByPageContextOId(layoutVO.getOid())).collect(Collectors.toList()),true));
//               layoutVO.setComponentVOs(uiComponentDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getPLPageDefinationsByPageContextOId(layoutVO.getOid())).collect(Collectors.toList()),true));
            } catch (VCIError vciError) {
            } catch (PLException vciError) {
               throw WebUtil.getVciBaseException(vciError);
            }
         }
@@ -1185,7 +1177,7 @@
   public List<UIComponentVO> selectAllUIComponent() {
//      try {
//         return uiComponentDO2VOs(Arrays.stream(platformClientUtil.getPortalService().getAllPLPageDefinations()).collect(Collectors.toList()),false);
//      } catch (VCIError vciError) {
//      } catch (PLException vciError) {
//         throw WebUtil.getVciBaseException(vciError);
//      }
      return null;
@@ -1205,7 +1197,7 @@
      if(!QUERY_BY_CACHE){
         try {
            return uiComponentDO2VO(ServiceProvider.getUIService().getPLPageDefinationById(componentOid),true);
         } catch (VCIError vciError) {
         } catch (PLException vciError) {
            throw WebUtil.getVciBaseException(vciError);
         }
      }else{
@@ -1278,7 +1270,7 @@
               try {
                  componentVO.setTableDefineVO(tableDO2VO(ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true));
                  //componentVO.setTableDefineVO(tableDO2VO(platformClientUtil.getPortalService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true));
               } catch (VCIError vciError) {
               } catch (PLException vciError) {
                  throw WebUtil.getVciBaseException(vciError);
               }
            }
@@ -1314,7 +1306,7 @@
            }else{
               try {
                  tableDefineVO = tableDO2VO(ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId()),true);
               } catch (VCIError vciError) {
               } catch (PLException vciError) {
                  throw WebUtil.getVciBaseException(vciError);
               }
            }
@@ -1365,7 +1357,7 @@
            }else{
               try {
                  componentVO.setFormDefineVO(formDO2VO(ServiceProvider.getUIService().getPortalVIByTypeNameAndVIName(btmType,componentDefineXO.getTemplateId())));
               } catch (VCIError vciError) {
               } catch (PLException vciError) {
                  throw WebUtil.getVciBaseException(vciError);
               }
            }
@@ -1429,7 +1421,7 @@
         }else{
            return buttonDefineVOS;
         }
      } catch (VCIError vciError) {
      } catch (PLException vciError) {
         throw WebUtil.getVciBaseException(vciError);
      }
   }
@@ -1495,7 +1487,7 @@
                     params.put(parameter.plKey,parameter.plValue);
                  }
               }
            } catch (VCIError vciError) {
            } catch (PLException vciError) {
               throw WebUtil.getVciBaseException(vciError);
            }
            buttonVO.setParamVOS(params);
@@ -1559,7 +1551,7 @@
//         obj = platformClientUtil.getPortalService().getPLPageLayoutDefinationsByRelatedType(btmType);
//         obj = ServiceProvider.geT(btmType);
      } catch (VCIError vciError) {
      } catch (PLException vciError) {
         throw WebUtil.getVciBaseException(vciError);
      }
      PLUILayout context = null;