| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.vci.client.bof.BOFactoryClient; |
| | | import com.vci.client.bof.ClientBusinessObject; |
| | | import com.vci.client.bof.ClientLinkObject; |
| | | import com.vci.client.bof.ClientLinkObjectOperation; |
| | | import com.vci.client.common.oq.OQTool; |
| | | import com.vci.client.common.providers.ServiceProvider; |
| | | import com.vci.common.qt.object.*; |
| | | import com.vci.common.utility.ObjectUtility; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.data.AttributeValue; |
| | | import com.vci.corba.omd.data.LinkObject; |
| | | import com.vci.corba.query.ObjectQueryService; |
| | | import com.vci.corba.query.data.BOAndLO; |
| | | import com.vci.starter.web.constant.QueryOptionConstant; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | |
| | | * 多语言前缀 |
| | | */ |
| | | private final String msgCodePrefix = "com.vci.web.loService."; |
| | | |
| | | |
| | | /** |
| | | * 日志对象 |
| | | */ |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | |
| | | /** |
| | | * LO操作类 |
| | | */ |
| | | private ClientLinkObjectOperation loOperation = new ClientLinkObjectOperation(); |
| | | |
| | | |
| | | @Autowired |
| | | private WebBoServiceI boService; |
| | | |
| | |
| | | LO_BASE_FIELD_MAP.put("ts","ts"); |
| | | LO_BASE_FIELD_MAP.put("linkTypeName","linkTypeName"); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public ClientLinkObjectOperation getLoOption() throws VciBaseException { |
| | | return loOperation; |
| | |
| | | int level, Map<String, String> conditionMap) throws VciBaseException { |
| | | return queryCLO(linkType, toBtmName, level, false, conditionMap); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<ClientLinkObject> queryCLO(String linkType, String toBtmName, |
| | | int level, boolean isDirection,Map<String, String> conditionMap) throws VciBaseException { |
| | | return queryCLO(linkType,toBtmName,level,isDirection,conditionMap,new PageHelper(-1)); |
| | | } |
| | | |
| | | |
| | | /*** |
| | | * 链接查询,支持限定某端的业务类型,限定层级,排序,反向,查询条件,但是不支持枚举和参照字段的显示 |
| | | * @param linkType 链接类型名称 |
| | |
| | | Condition condition = boService.getConditionByMap(conditionMap); |
| | | qt.setCondition(condition); |
| | | try { |
| | | LinkObject[] bos = platformClientUtil.getQueryService().findLTObjects(qt.getId(), Tool.qtTOXMl(qt).asXML()); |
| | | LinkObject[] bos = platformClientUtil.getQueryService().findLTObjects(qt.getId(), OQTool.qtTOXMl(qt).asXML()); |
| | | if (bos != null && bos.length > 0) { |
| | | for (LinkObject bo : bos) { |
| | | ClientLinkObject clo = new ClientLinkObject(); |
| | | clo.setLinkObject(bo); |
| | | |
| | | |
| | | rtnOBJs.add(clo); |
| | | } |
| | | return rtnOBJs; |
| | | } |
| | | } catch (VCIError e) { |
| | | // logger.error(e.error_code,e); |
| | | // throw WebUtil.getVciBaseException(e); |
| | | } catch (PLException e) { |
| | | logger.error(e.code,e); |
| | | throw WebUtil.getVciBaseException(e); |
| | | } |
| | | return rtnOBJs; |
| | | } |
| | |
| | | throws VciBaseException { |
| | | return queryLinkCbo(linkType, toBtmname, level, false, conditionMap); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<ClientBusinessObject> queryLinkCbo(String linkType, |
| | | String toBtmName, int level,boolean isDirection, Map<String, String> conditionMap) |
| | |
| | | }else if(!isDirection && conditionMap.containsKey("f_oid")){ |
| | | btmOid = conditionMap.get("f_oid"); |
| | | } |
| | | BOAndLO[] bos = platformClientUtil.getQueryService().getBOAndLOS(qt.getId(), Tool.qtTOXMl(qt).asXML(),btmOid); |
| | | BOAndLO[] bos = platformClientUtil.getQueryService().getBOAndLOS(qt.getId(), OQTool.qtTOXMl(qt).asXML(),btmOid); |
| | | if (bos != null && bos.length > 0) { |
| | | for (BOAndLO blo : bos) { |
| | | ClientBusinessObject cbo = new ClientBusinessObject(); |
| | |
| | | } |
| | | return rtnOBJs; |
| | | } |
| | | } catch (VCIError e) { |
| | | } catch (PLException e) { |
| | | // logger.error(e.error_code,e); |
| | | // throw WebUtil.getVciBaseException(e); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, com.vci.client.bof.ClientBusinessObject> queryLinkedCbo(LinkObject[] lo, |
| | | public Map<String, ClientBusinessObject> queryLinkedCbo(LinkObject[] lo, |
| | | boolean isDirection) throws VciBaseException { |
| | | ClientLinkObject[] clos = new ClientLinkObject[lo.length]; |
| | | for(int i =0 ; i < lo.length; i ++){ |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, com.vci.client.bof.ClientBusinessObject> queryLinkedCbo(List los, |
| | | public Map<String, ClientBusinessObject> queryLinkedCbo(List los, |
| | | boolean isDirection) throws VciBaseException { |
| | | return queryLinkedCbo(los,isDirection,new ArrayList<String>()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Map<String, com.vci.client.bof.ClientBusinessObject> queryLinkedCbo(List los, |
| | | public Map<String, ClientBusinessObject> queryLinkedCbo(List los, |
| | | boolean isDirection,List<String> queryColumn) throws VciBaseException { |
| | | ClientLinkObject[] clos = new ClientLinkObject[los.size()]; |
| | | for(int i = 0 ; i < los.size(); i ++){ |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, com.vci.client.bof.ClientBusinessObject> queryLinkedCbo( |
| | | public Map<String, ClientBusinessObject> queryLinkedCbo( |
| | | ClientLinkObject[] clol, boolean isDirection) throws VciBaseException { |
| | | return queryLinkedCbo(clol,isDirection,new ArrayList<String>()); |
| | | } |
| | | /***** |
| | | * |
| | | * |
| | | */ |
| | | @Override |
| | | public Map<String, com.vci.client.bof.ClientBusinessObject> queryLinkedCbo( |
| | | public Map<String, ClientBusinessObject> queryLinkedCbo( |
| | | ClientLinkObject[] clol, boolean isDirection,List<String> queryColumn) throws VciBaseException{ |
| | | Map<String/*t_oid或者f_oid*/,String/*oid*/> linkBoOidMap = new HashMap<String, String>(); |
| | | Map<String,String> btmTypeOidMap = new HashMap<String, String>(); |
| | |
| | | btmTypeOidMap.put(btmType, oids); |
| | | } |
| | | } |
| | | Map<String,com.vci.client.bof.ClientBusinessObject> linkedCboMap = new HashMap<>(); |
| | | Map<String,ClientBusinessObject> linkedCboMap = new HashMap<>(); |
| | | Iterator<String> it = btmTypeOidMap.keySet().iterator(); |
| | | while(it.hasNext()){ |
| | | String btmType = it.next(); |
| | |
| | | } |
| | | Map<String,String> conditionMap = new HashMap<>(); |
| | | conditionMap.put("oid",oids); |
| | | List<com.vci.client.bof.ClientBusinessObject> allCbo = boService.queryCBO(btmType, conditionMap,new PageHelper(-1),clauseList); |
| | | List<ClientBusinessObject> allCbo = boService.queryCBO(btmType, conditionMap,new PageHelper(-1),clauseList); |
| | | if(allCbo.size()>0){ |
| | | for(com.vci.client.bof.ClientBusinessObject cbo : allCbo){ |
| | | for(ClientBusinessObject cbo : allCbo){ |
| | | String linkOid = linkBoOidMap.get(cbo.getOid()); |
| | | linkedCboMap.put(linkOid, cbo); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map> clos2Map(List<com.vci.client.bof.ClientLinkObject> clos) throws VciBaseException { |
| | | public List<Map> clos2Map(List<ClientLinkObject> clos) throws VciBaseException { |
| | | List<Map> allMap = new ArrayList<Map>(); |
| | | for(com.vci.client.bof.ClientLinkObject clo : clos){ |
| | | for(ClientLinkObject clo : clos){ |
| | | allMap.add(clo2Map(clo)); |
| | | } |
| | | return allMap; |
| | | } |
| | | |
| | | @Override |
| | | public Map clo2Map(com.vci.client.bof.ClientLinkObject clo) throws VciBaseException { |
| | | public Map clo2Map(ClientLinkObject clo) throws VciBaseException { |
| | | Map<String,String> map = new HashMap<String, String>(); |
| | | WebUtil.copyValueToMapFromClos(clo, map); |
| | | return map; |
| | |
| | | if(StringUtils.isBlank(clo.getCreator())){ |
| | | clo.setCreator(WebUtil.getCurrentUserId()); |
| | | } |
| | | if(StringUtils.isBlank(clo.getCreateTime())){ |
| | | clo.setCreateTime(VciDateUtil.getNowString(VciDateUtil.DateTimeMillFormat)); |
| | | if(clo.getCreateTime() == 0){ |
| | | clo.setCreateTime(VciDateUtil.getTime(VciDateUtil.getNow())); |
| | | } |
| | | if(StringUtils.isBlank(clo.getLastModifier())){ |
| | | clo.setLastModifier(clo.getCreator()); |
| | | } |
| | | if(StringUtils.isBlank(clo.getLastModifyTime())){ |
| | | if(clo.getLastModifyTime() == 0){ |
| | | clo.setLastModifyTime(clo.getCreateTime()); |
| | | } |
| | | if(StringUtils.isBlank(clo.getTs())){ |
| | | if(clo.getTs() == 0){ |
| | | clo.setTs(clo.getCreateTime()); |
| | | } |
| | | linkObjects.add(clo.getLinkObject()); |
| | |
| | | } |
| | | } |
| | | return savedClientLinkObject; |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | WebUtil.alertNotNull(loName,"链接"); |
| | | try { |
| | | return loOperation.createLinkObject(loName,WebUtil.getCurrentUserId()); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | newClo.setLinkObject(lo); |
| | | newClo.setOid((new ObjectUtility()).getNewObjectID36()); |
| | | newClo.setCreator(WebUtil.getCurrentUserId()); |
| | | newClo.setCreateTime(VciDateUtil.getNowString(VciDateUtil.DateTimeMillFormat)); |
| | | newClo.setCreateTime(VciDateUtil.getTime(VciDateUtil.getNow())); |
| | | newClo.setLastModifier(newClo.getCreator()); |
| | | newClo.setLastModifyTime(newClo.getCreateTime()); |
| | | newClo.setTs(newClo.getCreateTime()); |
| | |
| | | if(clos!=null){ |
| | | try { |
| | | loOperation.batchdDeleteLinkObject(clos.toArray(new ClientLinkObject[0])); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | if(clos!=null){ |
| | | try { |
| | | loOperation.batchUpdateLinkObject(clos.toArray(new ClientLinkObject[0])); |
| | | } catch (VCIError vciError) { |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |
| | |
| | | } |
| | | Condition condition = boService.getConditionByMap(conditionMap); |
| | | if(qt.getCondition() !=null) { |
| | | qt.setCondition(Tool.mergeCondition(qt.getCondition(), condition, Connector.AND)); |
| | | qt.setCondition(OQTool.mergeCondition(qt.getCondition(), condition, Connector.AND)); |
| | | }else { |
| | | qt.setCondition(condition); |
| | | } |
| | | boService.setPageAndOrderToQT(qt,linkTypeDataQuery.getPageHelper()); |
| | | try { |
| | | // com.vci.corba.query.data.BOAndLO[] bos = platformClientUtil.getQueryService().getBOAndLOS(qt.getId(), Tool.qtTOXMl(qt).asXML(),linkTypeDataQuery.getParentOid()==null?"":linkTypeDataQuery.getParentOid()); |
| | | com.vci.corba.query.data.BOAndLO[] bos = ServiceProvider.getOQService().getBOAndLOS(qt.getId(), Tool.qtTOXMl(qt).asXML(),linkTypeDataQuery.getParentOid()==null?"":linkTypeDataQuery.getParentOid()); |
| | | // com.vci.corba.query.data.BOAndLO[] bos = platformClientUtil.getQueryService().getBOAndLOS(qt.getId(), OQTool.qtTOXMl(qt).asXML(),linkTypeDataQuery.getParentOid()==null?"":linkTypeDataQuery.getParentOid()); |
| | | com.vci.corba.query.data.BOAndLO[] bos = ServiceProvider.getOQService().getBOAndLOS(qt.getId(), OQTool.qtTOXMl(qt).asXML(),linkTypeDataQuery.getParentOid()==null?"":linkTypeDataQuery.getParentOid()); |
| | | return Arrays.stream(bos).collect(Collectors.toList()); |
| | | } catch (PLException e) { |
| | | // logger.error(e.error_code,e); |
| | |
| | | } |
| | | Condition condition = boService.getConditionByMap(conditionMap); |
| | | if(qt.getCondition() !=null) { |
| | | qt.setCondition(Tool.mergeCondition(qt.getCondition(), condition, Connector.AND)); |
| | | qt.setCondition(OQTool.mergeCondition(qt.getCondition(), condition, Connector.AND)); |
| | | }else { |
| | | qt.setCondition(condition); |
| | | } |
| | |
| | | Map<String,List<String>> toBtmOidsMap = new HashMap<>(); |
| | | try { |
| | | IntHolder totalHolder = new IntHolder(); |
| | | // com.vci.corba.omd.data.LinkObject[] linkObjects = platformClientUtil.getQueryService().findLTObjectsV2(qt.getId(), Tool.qtTOXMl(qt).asXML(),totalHolder); |
| | | ObjectQueryService.FindLTObjectsV2Result linkObjects = ServiceProvider.getOQService().findLTObjectsV2(qt.getId(), Tool.qtTOXMl(qt).asXML()); |
| | | // com.vci.corba.omd.data.LinkObject[] linkObjects = platformClientUtil.getQueryService().findLTObjectsV2(qt.getId(), OQTool.qtTOXMl(qt).asXML(),totalHolder); |
| | | ObjectQueryService.FindLTObjectsV2Result linkObjects = ServiceProvider.getOQService().findLTObjectsV2(qt.getId(), OQTool.qtTOXMl(qt).asXML()); |
| | | |
| | | |
| | | List<Map<String,String>> data = new ArrayList<>(); |
| | | List<String> finalEnumFields = enumFields; |
| | | final Integer[] total = {totalHolder.value}; |
| | | Arrays.stream(linkObjects.returnValue).forEach(lo->{ |
| | | com.vci.client.bof.ClientLinkObject clo = new com.vci.client.bof.ClientLinkObject(); |
| | | ClientLinkObject clo = new ClientLinkObject(); |
| | | clo.setLinkObject(lo); |
| | | Map<String, String> map = new HashMap<>(); |
| | | boService.queryEnumText(null,clo, finalEnumFields); |
| | |
| | | //分页不要超过1000 |
| | | Map<String,String> boConditionMap =new HashMap<>(); |
| | | boConditionMap.put("oid",QueryOptionConstant.IN + "(" + WebUtil.toInSql(oids.toArray(new String[0])) + ")"); |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryCBO(btm, boConditionMap, null, fromFieldsFix); |
| | | List<ClientBusinessObject> cbos = boService.queryCBO(btm, boConditionMap, null, fromFieldsFix); |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | cbos.stream().forEach(cbo->{ |
| | | dataGrid.getData().forEach(data->{ |
| | |
| | | //分页不要超过1000 |
| | | Map<String,String> boConditionMap =new HashMap<>(); |
| | | boConditionMap.put("oid",QueryOptionConstant.IN + "(" + WebUtil.toInSql(oids.toArray(new String[0])) + ")"); |
| | | List<com.vci.client.bof.ClientBusinessObject> cbos = boService.queryCBO(btm, boConditionMap, null, toFieldsFix); |
| | | List<ClientBusinessObject> cbos = boService.queryCBO(btm, boConditionMap, null, toFieldsFix); |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | cbos.stream().forEach(cbo->{ |
| | | dataGrid.getData().forEach(data->{ |
| | |
| | | Condition condition = boService.getConditionByMap(conditionMap); |
| | | qt.setCondition(condition); |
| | | try { |
| | | return platformClientUtil.getQueryService().findTotalCount(qt.getId(), Tool.qtTOXMl(qt).asXML()); |
| | | } catch (VCIError vciError) { |
| | | return Math.toIntExact(platformClientUtil.getQueryService().findTotalCount(qt.getId(), OQTool.qtTOXMl(qt).asXML())); |
| | | } catch (PLException vciError) { |
| | | throw WebUtil.getVciBaseException(vciError); |
| | | } |
| | | } |