From 663878fdcd0d44c105888014f4cdf7fc926f609f Mon Sep 17 00:00:00 2001 From: yuxc <yuxc@vci-tech.com> Date: 星期三, 19 六月 2024 10:27:04 +0800 Subject: [PATCH] 1、去掉client包的相关更改。 2、修改登录鉴权修改。 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java | 359 ++++++++++++++++++++++++++++------------------------------- 1 files changed, 172 insertions(+), 187 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java index a2c2054..611d40d 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBoServiceImpl.java @@ -1,8 +1,7 @@ package com.vci.web.service.impl; -import com.vci.client.bof.ClientBusinessObject; -import com.vci.client.bof.ClientLinkObject; import com.vci.client.common.oq.OQTool; +import com.vci.client.common.providers.ClientServiceProvider; import com.vci.common.qt.object.*; import com.vci.common.utility.ObjectUtility; import com.vci.corba.common.PLException; @@ -15,6 +14,7 @@ import com.vci.corba.query.data.BtmRefQueryOption; import com.vci.corba.query.data.KV; import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; +import com.vci.omd.utils.ObjectTool; import com.vci.starter.web.annotation.Column; import com.vci.starter.web.constant.QueryOptionConstant; import com.vci.starter.web.enumpck.BooleanEnum; @@ -123,7 +123,7 @@ /** * 宸茬粡鍒涘缓杩囩殑涓氬姟瀵硅薄 */ - private static Map<String, ClientBusinessObject> hasCreatedCbos = new HashMap<String, ClientBusinessObject>(); + private static Map<String, BusinessObject> hasCreatedCbos = new HashMap<String, BusinessObject>(); /** * 涓氬姟瀵硅薄榛樿灞炴�� @@ -149,7 +149,7 @@ * @throws VciBaseException 鍒濆鍖栧嚭閿欑殑鏄細鎶涘嚭寮傚父 */ @Override - public ClientBusinessObject createCBOByBtmName(String btmName) + public BusinessObject createCBOByBtmName(String btmName) throws VciBaseException { if(btmName!=null){ btmName = btmName.trim().toLowerCase(); @@ -162,13 +162,14 @@ throw new VciBaseException(msgCodePrefix +"noHasUserid"); } try { +// ClientServiceProvider.getBOFService().initBusinessObject(btmName); 鍙互杩涜鏇挎崲 hasCreatedCbos.put(btmName, createBusinessObject(btmName)); } catch (Exception e) { logger.error("鍒涘缓涓氬姟绫诲瀷瀵硅薄",e); throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName}); } } - ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName)); + BusinessObject cbo = cloneBusinessObject(hasCreatedCbos.get(btmName)); return cbo; } @@ -177,44 +178,45 @@ * @param boName 涓氬姟绫诲瀷鍚嶇О * @return 涓氬姟鏁版嵁瀵硅薄 */ - public ClientBusinessObject createBusinessObject(String boName) { + public BusinessObject createBusinessObject(String boName) throws PLException { +// ClientServiceProvider.getBOFService().initBusinessObject(boName); OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName); String userName = WebUtil.getCurrentUserId(); - ClientBusinessObject bo = new ClientBusinessObject(); - bo.setOid((new ObjectUtility()).getNewObjectID36()); - bo.setRevisionid((new ObjectUtility()).getNewObjectID36()); - bo.setNameoid((new ObjectUtility()).getNewObjectID36()); - bo.setBtmName(boName); - bo.setIsLastR(true); - bo.setIsFirstR(true); - bo.setIsFirstV(true); - bo.setIsLastV(true); - bo.setCreator(userName); - bo.setCreateTime(System.currentTimeMillis()); - bo.setLastModifier(userName); - bo.setLastModifyTime(System.currentTimeMillis()); - bo.setRevisionRule(btmTypeVO.getRevisionRuleId()); - bo.setVersionRule(String.valueOf(btmTypeVO.getVersionRule())); + BusinessObject bo = new BusinessObject(); + bo.oid = (new ObjectUtility()).getNewObjectID36(); + bo.revisionid = (new ObjectUtility()).getNewObjectID36(); + bo.nameoid = (new ObjectUtility()).getNewObjectID36(); + bo.btName = boName; + bo.isLastR = true; + bo.isFirstR = true; + bo.isFirstV = true; + bo.isLastV = true; + bo.creator = userName; + bo.createTime = System.currentTimeMillis(); + bo.modifier = userName; + bo.modifyTime = System.currentTimeMillis(); + bo.revisionRule = btmTypeVO.getRevisionRuleId(); + bo.versionRule = String.valueOf(btmTypeVO.getVersionRule()); if(StringUtils.isNotBlank(btmTypeVO.getRevisionRuleId())){ OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionRuleId()); - bo.setRevisionValue(revisionRuleVO.getStartCode()); + bo.revisionValue = revisionRuleVO.getStartCode(); } - bo.setRevisionSeq((short) 1); - bo.setVersionSeq((short) 1); - bo.setVersionValue(getVersionValue(WebUtil.getInt(btmTypeVO.getVersionRule()))); - bo.setLctId(btmTypeVO.getLifeCycleId()); + bo.revisionSeq = (short) 1; + bo.versionSeq = (short) 1; + bo.versionValue = getVersionValue(WebUtil.getInt(btmTypeVO.getVersionRule())); + bo.lctId = btmTypeVO.getLifeCycleId(); if(StringUtils.isNotBlank(btmTypeVO.getLifeCycleId())){ OsLifeCycleVO lifeCycleVO = lifeService.getLifeCycleById(btmTypeVO.getLifeCycleId()); //todo 鏃犳硶鑾峰彇鏁版嵁 - // bo.setLcStatus(lifeCycleVO.getStartStatus()); + bo.lcStatus = lifeCycleVO == null ? "" : lifeCycleVO.getStartStatus(); } - bo.setId(""); - bo.setName(""); - bo.setDescription(""); - bo.setOwner(userName); + bo.id = ""; + bo.name = ""; + bo.description = ""; + bo.owner = userName; // bo.setCheckinBy(userName); - bo.setCopyFromVersion(""); + bo.fromVersion = ""; this.initTypeAttributeValue(bo,btmTypeVO); return bo; } @@ -224,15 +226,9 @@ * @param cbo 涓氬姟鏁版嵁瀵硅薄 * @param btmTypeVO 涓氬姟绫诲瀷鐨勬樉绀哄璞� */ - private void initTypeAttributeValue(ClientBusinessObject cbo,OsBtmTypeVO btmTypeVO) { + private void initTypeAttributeValue(BusinessObject cbo,OsBtmTypeVO btmTypeVO) { Optional.ofNullable(btmTypeVO.getAttributes()).orElseGet(()->new ArrayList<>()).stream().forEach(attribute->{ - try { - cbo.setAttributeValueWithNoCheck(attribute.getId(),attribute.getDefaultValue()); - } catch (PLException vciError) { - if(logger.isErrorEnabled()){ - logger.error("璁剧疆灞炴�х殑鍊肩殑鏃跺�欏嚭鐜颁簡閿欒",vciError); - } - } + ObjectTool.setBOAttributeValue(cbo,attribute.getId(),attribute.getDefaultValue()); }); } @@ -257,49 +253,42 @@ * @param cbo 浠ュ墠鐨勪笟鍔℃暟鎹璞� * @return 鎷疯礉鍚庣殑瀵硅薄 */ - private ClientBusinessObject cloneClientBusinessObject(ClientBusinessObject cbo){ + private BusinessObject cloneBusinessObject(BusinessObject cbo){ if(cbo !=null){ BusinessObject businessObject = new BusinessObject(); - BusinessObject bo = cbo.getBusinessObject(); businessObject.oid = new ObjectUtility().getNewObjectID36(); businessObject.revisionid = new ObjectUtility().getNewObjectID36(); businessObject.nameoid = new ObjectUtility().getNewObjectID36(); - businessObject.btName = bo.btName; - businessObject.isLastR = bo.isLastR; - businessObject.isFirstR = bo.isFirstR; - businessObject.isLastV = bo.isLastV; - businessObject.isFirstV = bo.isFirstV; + businessObject.btName = cbo.btName; + businessObject.isLastR = cbo.isLastR; + businessObject.isFirstR = cbo.isFirstR; + businessObject.isLastV = cbo.isLastV; + businessObject.isFirstV = cbo.isFirstV; businessObject.creator = WebUtil.getCurrentUserId(); businessObject.createTime = System.currentTimeMillis(); - businessObject.modifier = bo.modifier; - businessObject.modifyTime = bo.modifyTime; - businessObject.revisionRule = bo.revisionRule; - businessObject.versionRule = bo.versionRule; - businessObject.revisionSeq = bo.revisionSeq; - businessObject.revisionValue = bo.revisionValue; - businessObject.versionSeq = bo.versionSeq; - businessObject.versionValue = bo.versionValue; - businessObject.lctId = bo.lctId; - businessObject.lcStatus = bo.lcStatus; + businessObject.modifier = cbo.modifier; + businessObject.modifyTime = cbo.modifyTime; + businessObject.revisionRule = cbo.revisionRule; + businessObject.versionRule = cbo.versionRule; + businessObject.revisionSeq = cbo.revisionSeq; + businessObject.revisionValue = cbo.revisionValue; + businessObject.versionSeq = cbo.versionSeq; + businessObject.versionValue = cbo.versionValue; + businessObject.lctId = cbo.lctId; + businessObject.lcStatus = cbo.lcStatus; businessObject.ts = System.currentTimeMillis(); - businessObject.id = bo.id; - businessObject.name = bo.name; - businessObject.description = bo.description; + businessObject.id = cbo.id; + businessObject.name = cbo.name; + businessObject.description = cbo.description; businessObject.owner = businessObject.creator; -// businessObject.checkinBy = bo.checkinBy; -// businessObject.checkinTime = bo.checkinTime; -// businessObject.checkoutBy = bo.checkoutBy; -// businessObject.checkoutTime = bo.checkoutTime; - businessObject.fromVersion = bo.fromVersion; - if(bo.newAttrValList !=null){ - businessObject.newAttrValList = clone(bo.newAttrValList); + businessObject.fromVersion = cbo.fromVersion; + if(cbo.newAttrValList !=null){ + businessObject.newAttrValList = clone(cbo.newAttrValList); } - if(bo.hisAttrValList !=null){ - businessObject.hisAttrValList = clone(bo.hisAttrValList); + if(cbo.hisAttrValList !=null){ + businessObject.hisAttrValList = clone(cbo.hisAttrValList); } - ClientBusinessObject cbo2 = new ClientBusinessObject(); - cbo2.setBusinessObject(businessObject); - return cbo2; + return businessObject; }else { return null; } @@ -399,12 +388,12 @@ String fieldName = referInfo.split("\\.")[1].trim().toLowerCase(); Map<String,String> conditionMap = new HashMap<String, String>(); conditionMap.put(fieldName,QueryOptionConstant.IN + "(" + WebUtil.toInSql(value.toArray(new String[0])) + ")"); - List<com.vci.client.bof.ClientBusinessObject> cbos = queryCBO(btmName,conditionMap,null, Arrays.asList(new String[]{"oid",fieldName})); + List<BusinessObject> cbos = queryCBO(btmName,conditionMap,null, Arrays.asList(new String[]{"oid",fieldName})); Map<String,String> data = new HashMap<String, String>(); if(cbos!=null && cbos.size() > 0){ - for(ClientBusinessObject cbo : cbos){ - data.put(cbo.getAttributeValue(fieldName),cbo.getOid()); + for(BusinessObject cbo : cbos){ + data.put(ObjectTool.getBOAttributeValue(cbo,fieldName),cbo.oid); } } return data; @@ -433,10 +422,10 @@ throw new VciBaseException("灞炴��" + columnName + "鐨勫�间负绌�"); } conditionMap.put(columnName,QueryOptionConstant.IN + "(" + VciBaseUtil.toInSql(oidSet.toArray(new String[0])) + ")"); - List<ClientBusinessObject> cbos = queryCBO(btmName,conditionMap,null,Arrays.asList(new String[]{columnName})); + List<BusinessObject> cbos = queryCBO(btmName,conditionMap,null,Arrays.asList(new String[]{columnName})); if(cbos !=null && cbos.size() >0){ - for(ClientBusinessObject cbo : cbos){ - String oid = cbo.getAttributeValue(columnName); + for(BusinessObject cbo : cbos){ + String oid = ObjectTool.getBOAttributeValue(cbo,columnName); if(oidSet.contains(oid)){ oidSet.remove(oid); } @@ -473,7 +462,7 @@ * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬槸鎶涘嚭寮傚父 */ @Override - public List<ClientBusinessObject> queryCBO(String btmType, + public List<BusinessObject> queryCBO(String btmType, Map<String, String> conditionMap) throws VciBaseException { List<String> clauseList = new ArrayList<String>(); clauseList.add("*"); @@ -490,7 +479,7 @@ * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬槸鎶涘嚭寮傚父 */ @Override - public List<ClientBusinessObject> queryCBO(String btmType, + public List<BusinessObject> queryCBO(String btmType, Map<String, String> conditionMap, PageHelper ph) throws VciBaseException { List<String> clauseList = new ArrayList<String>(); @@ -508,7 +497,7 @@ * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬槸鎶涘嚭寮傚父 */ @Override - public List<ClientBusinessObject> queryCBO(String btmType, + public List<BusinessObject> queryCBO(String btmType, Map<String, String> conditionMap, PageHelper ph, List<String> clauseList) throws VciBaseException { QueryTemplate qt = new QueryTemplate(); @@ -559,8 +548,8 @@ * @return 鏌ヨ鍑烘潵鐨勫�� * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ - private List<ClientBusinessObject> baseQueryCBO(QueryTemplate qt,Map<String,String> conditionMap,PageHelper ph,List<String> clauseList) throws VciBaseException{ - List<ClientBusinessObject> allCbos = new ArrayList<ClientBusinessObject>(); + private List<BusinessObject> baseQueryCBO(QueryTemplate qt,Map<String,String> conditionMap,PageHelper ph,List<String> clauseList) throws VciBaseException{ + List<BusinessObject> allCbos = new ArrayList<BusinessObject>(); if(clauseList == null){ clauseList = new ArrayList<String>(); clauseList.add("*"); @@ -621,10 +610,10 @@ ObjectQueryService.FindBTMObjectsV3Result bos = qtService.findBTMObjectsV3(qt.getId(), OQTool.qtTOXMl(qt).asXML(), refOpts.toArray(new BtmRefQueryOption[refOpts.size()])); if (bos != null && bos.count > 0) { for (BusinessObject bo : bos.returnValue) { - ClientBusinessObject cbo = new ClientBusinessObject(); - cbo.setBusinessObject(bo); - queryEnumText(cbo,enumAttrName); - allCbos.add(cbo); +// BusinessObject cbo = new BusinessObject(); +// cbo = bo; + queryEnumText(bo,enumAttrName); +// allCbos.add(cbo); } //鍥犱负淇敼浜嗘煡璇㈢殑鏂瑰紡锛屾墍浠ュ氨涓嶉渶瑕佸崟鐙煡璇㈠弬鐓� } @@ -719,13 +708,13 @@ * 鏌ヨ鐢熷懡鍛ㄦ湡鐨勫�� * @param cbos 涓氬姟瀵硅薄 */ - private void queryLcStatus(List<ClientBusinessObject> cbos){ + private void queryLcStatus(List<BusinessObject> cbos){ if(!CollectionUtils.isEmpty(cbos)){ Map<String, OsStatusVO> statusVOMap = statusService.selectAllStatusMap(); cbos.stream().forEach(cbo->{ try{ - cbo.setAttributeValueWithNoCheck("lcStatus_text", statusVOMap.getOrDefault(cbo.getLcStatus(),new OsStatusVO()).getName()); + ObjectTool.setBOAttributeValue(cbo,"lcStatus_text", statusVOMap.getOrDefault(cbo.lcStatus,new OsStatusVO()).getName()); }catch(Exception e){ logger.error("鑾峰彇鐢熷懡鍛ㄦ湡涓姸鎬佺殑鏄剧ず鏂囨湰鍑洪敊",e); } @@ -739,7 +728,7 @@ * @param enumAttrName 鏋氫妇灞炴�х殑鍊� * @throws VciBaseException */ - private void queryEnumText(ClientBusinessObject cbo,List<String> enumAttrName) throws VciBaseException{ + private void queryEnumText(BusinessObject cbo,List<String> enumAttrName) throws VciBaseException{ queryEnumText(cbo,null,enumAttrName); } @@ -751,16 +740,16 @@ * @throws VciBaseException 鏌ヨ鏋氫妇鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public void queryEnumText(ClientBusinessObject cbo, ClientLinkObject clo, List<String> enumAttrName) throws VciBaseException{ + public void queryEnumText(BusinessObject cbo, LinkObject clo, List<String> enumAttrName) throws VciBaseException{ if(enumAttrName.size()>0){//鏌ヨ鏋氫妇 for(String enumAttr:enumAttrName){//鏍煎紡涓� code_field code鏄灇涓剧殑缂栫爜锛宖ield鏄綋鍓嶄笟鍔$被鍨嬪瓨鍌ㄦ灇涓惧�肩殑瀛楁 if(enumAttr.toLowerCase().equals("creator_name")){ //鍒涘缓浜虹殑鍚嶇О String creator = ""; if(cbo!=null){ - creator = cbo.getCreator(); + creator = cbo.creator; }else{ - creator = clo.getCreator(); + creator = clo.creator; } if(StringUtils.isNotBlank(creator)){ String userTrueName = userQueryService.getUserNameByUserId(creator); @@ -770,9 +759,9 @@ //鏈�鍚庝慨鏀逛汉鍚嶇О String modifier = ""; if(cbo!=null){ - modifier = cbo.getLastModifier(); + modifier = cbo.modifier; }else{ - modifier = clo.getLastModifier(); + modifier = clo.modifier; } if(StringUtils.isNotBlank(modifier)){ String userTrueName = userQueryService.getUserNameByUserId(modifier); @@ -784,7 +773,7 @@ if(fields.contains("_")){ String valueField = ""; valueField = fields.split("_")[0]; - String value = cbo.getAttributeValue(valueField); + String value = ObjectTool.getBOAttributeValue(cbo,valueField);; if(StringUtils.isNotBlank(value)){ String userTrueName = userQueryService.getUserNameByUserId(value); setValueToCboOrClo(cbo,clo,enumAttr,userTrueName); @@ -803,9 +792,9 @@ } String enumKey = ""; if (cbo != null) { - enumKey = cbo.getAttributeValue(valueFieldName); + enumKey = ObjectTool.getBOAttributeValue(cbo,valueFieldName); } else if (clo != null) { - enumKey = clo.getAttributeValue(valueFieldName); + enumKey = ObjectTool.getLOAttributeValue(clo,valueFieldName); } String enumText = ""; if (WebUtil.isNotNull(enumKey)) { @@ -829,10 +818,10 @@ * @param attr 灞炴�у悕 * @param value 鍊� */ - private void setValueToCboOrClo(ClientBusinessObject cbo,ClientLinkObject clo,String attr,String value){ + private void setValueToCboOrClo(BusinessObject cbo,LinkObject clo,String attr,String value){ try { if (cbo != null) { - cbo.setAttributeValueWithNoCheck(attr, value); + ObjectTool.setBOAttributeValue(cbo, attr, value); }else{ setAttributeValueForClo(clo,attr, value); } @@ -848,8 +837,8 @@ * @param attributeValue 灞炴�х殑鍊� */ @Override - public void setAttributeValueForClo(ClientLinkObject clo, String attributeName, String attributeValue) { - AttributeValue[] attrValues = clo.getLinkObject().newAttrValList; + public void setAttributeValueForClo(LinkObject clo, String attributeName, String attributeValue) { + AttributeValue[] attrValues = clo.newAttrValList; ArrayList<AttributeValue> attrValList = new ArrayList(); AttributeValue attrVal; int i; @@ -882,7 +871,7 @@ attrValList.add(attrVal); } - clo.getLinkObject().newAttrValList = (AttributeValue[]) attrValList.toArray(new AttributeValue[attrValList.size()]); + clo.newAttrValList = attrValList.toArray(new AttributeValue[attrValList.size()]); } @@ -892,7 +881,7 @@ * @param enumAttrName 鏋氫妇灞炴�� * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ - private void queryEnumTextClo(ClientLinkObject clo,List<String> enumAttrName) throws VciBaseException{ + private void queryEnumTextClo(LinkObject clo,List<String> enumAttrName) throws VciBaseException{ queryEnumText(null,clo,enumAttrName); } @@ -905,7 +894,7 @@ * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, + public List<BusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap) throws VciBaseException { PageHelper ph = new PageHelper(-1); @@ -923,7 +912,7 @@ * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父 */ @Override - public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, + public List<BusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap, PageHelper ph) throws VciBaseException { List<String> clauseList = new ArrayList<String>(); @@ -1002,7 +991,7 @@ * @throws VciBaseException 鏌ヨ鍑洪敊浼氭姏鍑哄紓甯� */ @Override - public List<ClientBusinessObject> queryCBOByScheme(String queryScheme, + public List<BusinessObject> queryCBOByScheme(String queryScheme, Map<String, String> conditionMap, Map<String, String> replaceMap, PageHelper ph, List<String> clauseList) throws VciBaseException { QueryTemplate qt = getQtByName(queryScheme,replaceMap); @@ -1134,11 +1123,11 @@ * @throws VciBaseException 鏌ヨ鍑洪敊浼氭姏鍑哄紓甯� */ @Override - public List<ClientBusinessObject> queryBySql(String sql, + public List<BusinessObject> queryBySql(String sql, Map<String, String> conditionMap) throws VciBaseException { List<Map> allData = queryBySqlForMap(sql,conditionMap); if(allData == null || allData.size() == 0){ - return new ArrayList<ClientBusinessObject>(); + return new ArrayList<BusinessObject>(); }else{ return map2Cbos(allData); } @@ -1151,10 +1140,10 @@ * @throws VciBaseException 鏌ヨ鍑洪敊娲绘姏鍑哄紓甯� */ @Override - public List<ClientBusinessObject> queryByOnlySql(String sql) throws VciBaseException{ + public List<BusinessObject> queryByOnlySql(String sql) throws VciBaseException{ List<Map> allData = queryByOnlySqlForMap(sql); if(allData == null || allData.size() == 0){ - return new ArrayList<ClientBusinessObject>(); + return new ArrayList<BusinessObject>(); }else{ return map2Cbos(allData); } @@ -1367,11 +1356,11 @@ allFieldAttrMap.put(columnName.toLowerCase(),fieldName); } List<T> allObject = new ArrayList<T>(); - List<ClientBusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c), conditionMap, ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));//鎵ц鏌ヨ + List<BusinessObject> allCbos = queryCBO(WebUtil.getBtmTypeByObject(c), conditionMap, ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList()));//鎵ц鏌ヨ List<String> oids = new ArrayList<String>(); if(allCbos!=null&&allCbos.size()>0){ - for(ClientBusinessObject cbo : allCbos){ + for(BusinessObject cbo : allCbos){ T obj = null; try { obj = c.newInstance(); @@ -1381,7 +1370,7 @@ } catch (IllegalAccessException e) { } if(obj !=null){ - oids.add(cbo.getOid()); + oids.add(cbo.oid); allObject.add(obj); } } @@ -1472,10 +1461,10 @@ allFieldAttrMap.put(columnName.toLowerCase(),fieldName); } List<T> allObject = new ArrayList<T>(); - List<ClientBusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList())); + List<BusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap, replaceMap,ph, allFieldAttrMap.keySet().stream().collect(Collectors.toList())); List<String> oids = new ArrayList<String>(); if(allCbos!=null&&allCbos.size()>0){ - for(ClientBusinessObject cbo : allCbos){ + for(BusinessObject cbo : allCbos){ T obj = null; try { obj = c.newInstance(); @@ -1485,7 +1474,7 @@ } catch (IllegalAccessException e) { } if(obj !=null){ - oids.add(cbo.getOid()); + oids.add(cbo.oid); allObject.add(obj); } } @@ -1539,7 +1528,7 @@ * @param isEdit 鏄惁涓虹紪杈� * @throws VciBaseException 璁剧疆鍑洪敊浼氭姏鍑哄紓甯� */ - private void setValueToCbo(Object obj,String btmType,ClientBusinessObject cbo ,boolean isEdit) throws VciBaseException{ + private void setValueToCbo(Object obj,String btmType,BusinessObject cbo ,boolean isEdit) throws VciBaseException{ Field pkField = WebUtil.getPkFieldForObj(obj.getClass()); if(pkField == null){ throw new VciBaseException("{0}绫讳腑娌℃湁瀹氫箟涓婚敭灞炴��",new Object[]{obj.getClass()}); @@ -1547,10 +1536,10 @@ //涓婚敭 Object pkValue = WebUtil.getValueFromField(pkField.getName(), obj); if(pkValue == null || (pkValue instanceof String && WebUtil.isNull(pkValue.toString()))){ - WebUtil.setValueToField(pkField.getName(), obj, cbo.getOid()); - pkValue = cbo.getOid(); + WebUtil.setValueToField(pkField.getName(), obj, cbo.oid); + pkValue = cbo.oid; }else{ - cbo.setOid(pkValue.toString()); + cbo.oid = pkValue.toString(); } //杩涜闈炵┖锛岄暱搴︼紝閲嶅鐨勬牎楠屻�傘�傛牎楠岄�氳繃鐨勮祴鍊� Map<String,String> fieldMap = WebUtil.getFieldNameMap(obj.getClass()); @@ -1592,7 +1581,7 @@ //璇存槑涓嶈兘閲嶅锛岄偅涔堝氨闇�瑕佹煡璇竴涓� Map<String,String> queryRepeatMap = getOneQuery(attrName, value); if(isEdit){ - queryRepeatMap.put("oid", QueryOptionConstant.NOTEQUAL + cbo.getOid()); + queryRepeatMap.put("oid", QueryOptionConstant.NOTEQUAL + cbo.oid); } if(queryCount(btmType, queryRepeatMap)>0){ throw new VciBaseException("{0}瀛楁鐨勫�納1}鍦ㄧ郴缁熶腑宸茬粡瀛樺湪", new Object[]{columnText,value}); @@ -1605,16 +1594,12 @@ if(isEdit && checkUnAttrUnEdit(attrName)){ //缂栬緫鐨勬椂鍊欙紝TS鍜孫ID涓嶈兘璁剧疆.鍥犱负骞冲彴閭f帴鍙h缃簡灏变細鎶ラ敊 }else { - try { - //闇�瑕佸垽鏂槸鍚﹂粯璁ょ殑灞炴�э紝濡傛灉鏄粯璁ゅ睘鎬э紝鍒欎娇鐢ㄥ璞$殑璧嬪�肩殑鏂瑰紡 - if (WebUtil.isDefaultField(fieldName) && WebUtil.inArray(new String[]{"id", "name", "description","lcstatus","revisionvalue","versionvalue"}, fieldName.toLowerCase())) { - WebUtil.setValueToField(fieldName, cbo, value); - cbo.setAttributeValueWithNoCheck(attrName.toLowerCase(), value); - } else { - cbo.setAttributeValueWithNoCheck(attrName.toLowerCase(), value); - } - } catch (PLException e) { - throw WebUtil.getVciBaseException(e); + //闇�瑕佸垽鏂槸鍚﹂粯璁ょ殑灞炴�э紝濡傛灉鏄粯璁ゅ睘鎬э紝鍒欎娇鐢ㄥ璞$殑璧嬪�肩殑鏂瑰紡 + if (WebUtil.isDefaultField(fieldName) && WebUtil.inArray(new String[]{"id", "name", "description","lcstatus","revisionvalue","versionvalue"}, fieldName.toLowerCase())) { + WebUtil.setValueToField(fieldName, cbo, value); + ObjectTool.setBOAttributeValue(cbo, attrName.toLowerCase(), value); + } else { + ObjectTool.setBOAttributeValue(cbo, attrName.toLowerCase(), value); } } } @@ -1633,7 +1618,7 @@ if(list==null){ throw new VciBaseException(VciBaseException.paramNull); } - Set<ClientBusinessObject> allCbos = new HashSet<ClientBusinessObject>(); + Set<BusinessObject> allCbos = new HashSet<BusinessObject>(); for(T obj : list){ //闇�瑕佸鐞嗛粯璁ゅ�� Field pkField = WebUtil.getPkFieldForObj(obj.getClass()); @@ -1641,7 +1626,7 @@ throw new VciBaseException("{0}瀵硅薄涓病鏈夎缃富閿殑灞炴��",new Object[]{obj.getClass()}); } String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); - ClientBusinessObject cbo = createCBOByBtmName(btmType); + BusinessObject cbo = createCBOByBtmName(btmType); setValueToCbo(obj,btmType,cbo,false); allCbos.add(cbo); } @@ -1684,9 +1669,9 @@ if(list==null){ throw new VciBaseException(VciBaseException.paramNull); } - Set<ClientBusinessObject> allUpdateCbos = new HashSet<ClientBusinessObject>(); - Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); - Set<ClientBusinessObject> allAddCbos = new HashSet<ClientBusinessObject>(); + Set<BusinessObject> allUpdateCbos = new HashSet<BusinessObject>(); + Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); + Set<BusinessObject> allAddCbos = new HashSet<BusinessObject>(); Map<String,String> btmOidsMap = new HashMap<String, String>(); for(T obj : list){ String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); @@ -1707,7 +1692,7 @@ } btmOidsMap.put(btmType, tempOids); } - List<ClientBusinessObject> needUpdateCbos = new ArrayList<ClientBusinessObject>(); + List<BusinessObject> needUpdateCbos = new ArrayList<BusinessObject>(); Iterator<String> it = btmOidsMap.keySet().iterator(); while(it.hasNext()){ String btmType = it.next(); @@ -1725,12 +1710,12 @@ } //涓婚敭 Object pkValue = WebUtil.getValueFromField(pkField.getName(), obj); - ClientBusinessObject cbo = null; + BusinessObject cbo = null; if(pkValue == null || (pkValue instanceof String && WebUtil.isNull(pkValue.toString()))){ continue; }else{ - for(ClientBusinessObject tempCbo : needUpdateCbos){ - if(tempCbo.getOid().equalsIgnoreCase(pkValue.toString().trim())){ + for(BusinessObject tempCbo : needUpdateCbos){ + if(tempCbo.oid.equalsIgnoreCase(pkValue.toString().trim())){ cbo = tempCbo; break; } @@ -1738,7 +1723,7 @@ } String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); //鎷疯礉涔嬪墠鍏堟竻闄ゅ凡缁忔湁鐨勫�� - cbo.getBusinessObject().newAttrValList = new AttributeValue[0]; + cbo.newAttrValList = new AttributeValue[0]; setValueToCbo(obj,btmType,cbo,true); allUpdateCbos.add(cbo); } @@ -1797,8 +1782,8 @@ if(list==null){ throw new VciBaseException(VciBaseException.paramNull); } - Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); - Map<String,List<ClientBusinessObject>> btmBos = new HashMap<String, List<ClientBusinessObject>>(); + Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); + Map<String,List<BusinessObject>> btmBos = new HashMap<String, List<BusinessObject>>(); for(Object obj : list){ //鏈夊彲鑳戒笉灞炰簬鍚屼竴涓笟鍔$被鍨嬩笅 Field pkField = WebUtil.getPkFieldForObj(obj.getClass()); @@ -1808,7 +1793,7 @@ String btmType = WebUtil.getBtmTypeByObject(obj.getClass()); String pkValue = WebUtil.getValueFromFieldForCbo(pkField, obj); //鎵�浠ヨ繖閲屼篃鏄洿鎺ユ煡璇㈢殑鍗曚釜' - List<ClientBusinessObject> deleteCbos = queryCBO(btmType, getOneQuery( + List<BusinessObject> deleteCbos = queryCBO(btmType, getOneQuery( WebUtil.getCboAttrNameFromField(pkField, obj.getClass()), pkValue)); if(deleteCbos!=null){ allDeleteCbos.addAll(deleteCbos); @@ -1838,7 +1823,7 @@ * @param btmBos 涓氬姟鏁版嵁 * @throws VciBaseException 琚紩鐢ㄧ殑鏃跺�欎細鎶涘嚭寮傚父 */ - private void checkCanDelete(Map<String,List<ClientBusinessObject>> btmBos) throws VciBaseException{ + private void checkCanDelete(Map<String,List<BusinessObject>> btmBos) throws VciBaseException{ //鏌ユ壘琛ㄦ槸鍚﹁鍏朵粬鐨勫睘鎬у紩鐢� if(!btmBos.isEmpty()){ Iterator<String> it = btmBos.keySet().iterator(); @@ -1848,13 +1833,13 @@ List<OsUsedAttributeVO> usedAttrVOs = btmService.listBtmUsedInfo(btmType); Map<String, List<OsUsedAttributeVO>> allReferAttr = Optional.ofNullable(usedAttrVOs).orElseGet(()->new ArrayList<>()).stream().collect(Collectors.groupingBy(s -> s.getPkBtmType())); - List<ClientBusinessObject> thisBtmTypeBo = btmBos.get(btmType); + List<BusinessObject> thisBtmTypeBo = btmBos.get(btmType); if(thisBtmTypeBo.size()== 0){ return; } String oids = ""; - for(ClientBusinessObject cbo : thisBtmTypeBo){ - oids += "'" + cbo.getOid() + "',"; + for(BusinessObject cbo : thisBtmTypeBo){ + oids += "'" + cbo.oid + "',"; } oids = WebUtil.removeComma(oids); if(!allReferAttr.isEmpty()){ @@ -1904,13 +1889,13 @@ conditionMap = new HashMap<String, String>(); } conditionMap.put(QUERY_FILTER_SECRET,BooleanEnum.FASLE.getValue());//鏌ヨ鐨勬椂鍊欎笉鑳芥煡璇㈠瘑绾� - List<ClientBusinessObject> allCbos = queryCBO(btmType, conditionMap); + List<BusinessObject> allCbos = queryCBO(btmType, conditionMap); BatchCBO batchCbo = new BatchCBO(); if(allCbos.size()>0){ - Map<String,List<ClientBusinessObject>> btmBos = new HashMap<String, List<ClientBusinessObject>>(); + Map<String,List<BusinessObject>> btmBos = new HashMap<String, List<BusinessObject>>(); btmBos.put(btmType, allCbos); checkCanDelete(btmBos); - Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); + Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); allDeleteCbos.addAll(allCbos); batchCbo.setDeleteCbos(allDeleteCbos); } @@ -1943,24 +1928,24 @@ selectSql += ",btmname "; } sql = selectSql + fromSql; - List<ClientBusinessObject> allDelete =queryBySql(sql, conditionMap); + List<BusinessObject> allDelete =queryBySql(sql, conditionMap); if(allDelete.size() == 0){ return batchCbo;//娌℃湁鍒犻櫎浠讳綍鏁版嵁 } //鎵綽tmType; - String btmType = allDelete.get(0).getAttributeValue("btmName"); - Map<String,List<ClientBusinessObject>> btmBos = new HashMap<String, List<ClientBusinessObject>>(); + String btmType = ObjectTool.getBOAttributeValue(allDelete.get(0),"btmName"); + Map<String,List<BusinessObject>> btmBos = new HashMap<String, List<BusinessObject>>(); btmBos.put(btmType, allDelete); checkCanDelete(btmBos); - Set<ClientBusinessObject> allDeleteCbos = new HashSet<ClientBusinessObject>(); + Set<BusinessObject> allDeleteCbos = new HashSet<BusinessObject>(); //鎴戜滑闇�瑕佷粠鍚庡彴鏌ヨ鏁翠釜鐨勫唴瀹规墠鍙互鎵ц鍒犻櫎锛� String oids = ""; - for(ClientBusinessObject cbo : allDelete){ - oids += "'" + cbo.getOid() + "',"; + for(BusinessObject cbo : allDelete){ + oids += "'" + cbo.oid + "',"; } conditionMap.clear(); conditionMap.put("oid", QueryOptionConstant.IN + "(" + WebUtil.removeComma(oids) + ")"); - List<ClientBusinessObject> inDbCbos = queryCBO(btmType, conditionMap); + List<BusinessObject> inDbCbos = queryCBO(btmType, conditionMap); allDeleteCbos.addAll(inDbCbos); batchCbo.setDeleteCbos(allDeleteCbos); @@ -1991,14 +1976,14 @@ Map<String,String> conditionMap = getOneQuery("oid", pkValue); List<String> causeList = new ArrayList<>(); causeList.add("ts"); - List<ClientBusinessObject> cbos = queryCBO(WebUtil.getBtmTypeByObject(obj.getClass()), conditionMap,new PageHelper(-1),causeList); + List<BusinessObject> cbos = queryCBO(WebUtil.getBtmTypeByObject(obj.getClass()), conditionMap,new PageHelper(-1),causeList); if(CollectionUtils.isEmpty(cbos)){ return false; } if(ts.contains(".")){ ts = ts.substring(0,ts.lastIndexOf(".")); } - return cbos.get(0).getTs() == Long.valueOf(ts); + return cbos.get(0).ts == Long.valueOf(ts); } /** @@ -2047,7 +2032,7 @@ ph = new PageHelper(-1); ph.setQueryTotal(true); } - List<ClientBusinessObject> allCbos = queryCBO(btmType, conditionMap, ph, clauseList); + List<BusinessObject> allCbos = queryCBO(btmType, conditionMap, ph, clauseList); DataGrid dg = new DataGrid(); if(allCbos.size()>0){ List<Map> mapList = cbos2Map(allCbos); @@ -2123,7 +2108,7 @@ if(ph == null){ ph = new PageHelper(-1,true); } - List<ClientBusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap,replaceMap, ph, clauseList); + List<BusinessObject> allCbos = queryCBOByScheme(queryScheme, conditionMap,replaceMap, ph, clauseList); DataGrid dg = new DataGrid(); if(allCbos.size()>0){ List<Map> mapList = cbos2Map(allCbos); @@ -2224,29 +2209,29 @@ } /** - * ClientBusinessObject 杞负HashMap + * BusinessObject 杞负HashMap * @param cbos CBOS * @return map * @throws VciBaseException 杞崲鍑洪敊浼氭姏鍑哄紓甯� */ @Override - public List<Map> cbos2Map(List<ClientBusinessObject> cbos) + public List<Map> cbos2Map(List<BusinessObject> cbos) throws VciBaseException { List<Map> mapList = new ArrayList<Map>(); - for(ClientBusinessObject cbo : cbos){ + for(BusinessObject cbo : cbos){ mapList.add(cbo2Map(cbo)); } return mapList; } /** - * ClientBusinessObject 杞负HashMap + * BusinessObject 杞负HashMap * @param cbo 涓氬姟鏁版嵁瀵硅薄 * @return map * @throws VciBaseException 杞崲鍑洪敊浼氭姏鍑哄紓甯� */ @Override - public Map cbo2Map(ClientBusinessObject cbo) throws VciBaseException { + public Map cbo2Map(BusinessObject cbo) throws VciBaseException { Map<String,String> map = new HashMap<String, String>(); WebUtil.copyValueToMapFromCbos(cbo, map); return map; @@ -2254,15 +2239,15 @@ /** - * map杞负clientBusinessObject + * map杞负BusinessObject * @param mapList map鍒楄〃 * @return 涓氬姟鏁版嵁鍒楄〃 * @throws VciBaseException 杞崲鍑洪敊浼氭姏鍑哄紓甯� */ @Override - public List<ClientBusinessObject> map2Cbos(List<Map> mapList) + public List<BusinessObject> map2Cbos(List<Map> mapList) throws VciBaseException { - List<ClientBusinessObject> cboList = new ArrayList<ClientBusinessObject>(); + List<BusinessObject> cboList = new ArrayList<BusinessObject>(); for(Map map : mapList){ cboList.add(map2Cbo(map)); } @@ -2271,14 +2256,14 @@ /** - * map杞负clientBusinessObject + * map杞负BusinessObject * @param map map * @return 涓氬姟鏁版嵁 * @throws VciBaseException 杞崲鍑洪敊浼氭姏鍑哄紓甯� */ @Override - public ClientBusinessObject map2Cbo(Map map) throws VciBaseException { - ClientBusinessObject cbo = new ClientBusinessObject(); + public BusinessObject map2Cbo(Map map) throws VciBaseException { + BusinessObject cbo = new BusinessObject(); WebUtil.copyValueToCboFromMap(cbo, map); return cbo; } @@ -2326,13 +2311,13 @@ * @param cbos 瀹㈡埛绔璞� * @return 涓氬姟瀵硅薄 */ - private BusinessObject[] cboArray2Bo(ClientBusinessObject[] cbos){ + private BusinessObject[] cboArray2Bo(BusinessObject[] cbos){ if(cbos == null ||cbos.length == 0){ return new BusinessObject[0]; } BusinessObject[] bos = new BusinessObject[cbos.length]; for(int i = 0; i < cbos.length; i++){ - bos[i] = cbos[i].getBusinessObject(); + bos[i] = cbos[i]; } return bos; } @@ -2342,13 +2327,13 @@ * @param clos 瀹㈡埛绔璞� * @return 涓氬姟瀵硅薄 */ - private LinkObject[] cloArray2Lo(ClientLinkObject[] clos){ + private LinkObject[] cloArray2Lo(LinkObject[] clos){ if(clos == null ||clos.length == 0){ return new LinkObject[0]; } LinkObject[] bos = new LinkObject[clos.length]; for(int i = 0; i < clos.length; i++){ - bos[i] = clos[i].getLinkObject(); + bos[i] = clos[i]; } return bos; } @@ -2357,10 +2342,10 @@ * 鍒犻櫎鏋氫妇鍜屽弬鐓х殑灞炴�� * @param cbos 涓氬姟鏁版嵁 */ - private void deleteReferAttrInCbo(Set<ClientBusinessObject> cbos){ + private void deleteReferAttrInCbo(Set<BusinessObject> cbos){ if(cbos !=null){ - for(ClientBusinessObject cbo : cbos){ - BusinessObject bo = cbo.getBusinessObject(); + for(BusinessObject cbo : cbos){ + BusinessObject bo = cbo; List<AttributeValue> newAttr = new ArrayList<AttributeValue>(); if (bo.newAttrValList != null) { for (int i = 0; i < bo.newAttrValList.length; ++i) { @@ -2374,7 +2359,7 @@ } } bo.newAttrValList = newAttr.toArray(new AttributeValue[0]); - cbo.setBusinessObject(bo); + cbo = bo; } } } @@ -2410,11 +2395,11 @@ * @throws VciBaseException 鍙傛暟涓虹┖锛屾暟鎹笉瀛樺湪浼氭姏鍑哄紓甯� */ @Override - public ClientBusinessObject selectCBOByOid(String oid, String btmName) throws VciBaseException { + public BusinessObject selectCBOByOid(String oid, String btmName) throws VciBaseException { VciBaseUtil.alertNotNull(oid,"涓婚敭",btmName,"涓氬姟绫诲瀷"); Map<String,String> conditionMap = new HashMap<String, String>(); conditionMap.put("oid", oid.trim()); - List<ClientBusinessObject> cbos = queryCBO(btmName, conditionMap); + List<BusinessObject> cbos = queryCBO(btmName, conditionMap); if(CollectionUtils.isEmpty(cbos)){ throw new VciBaseException("鏁版嵁鍦ㄧ郴缁熶腑涓嶅瓨鍦▄0}",new String[]{oid}); } @@ -2456,15 +2441,15 @@ * @throws VciBaseException 鍙傛暟涓虹┖锛屾煡璇㈠嚭閿欎細鎶涘嚭寮傚父 */ @Override - public List<ClientBusinessObject> selectCBOByOidCollection(Collection<String> oidCollection, String btmName) throws VciBaseException { + public List<BusinessObject> selectCBOByOidCollection(Collection<String> oidCollection, String btmName) throws VciBaseException { VciBaseUtil.alertNotNull(oidCollection,"涓婚敭闆嗗悎",btmName,"涓氬姟绫诲瀷"); Collection<Collection<String>> oidCollections = WebUtil.switchCollectionForOracleIn(oidCollection); - List<ClientBusinessObject> doList = new ArrayList<ClientBusinessObject>(); + List<BusinessObject> doList = new ArrayList<BusinessObject>(); for(Collection<String> oids: oidCollections){ Map<String,String> conditionMap = new HashMap<String, String>(); conditionMap.put("oid",QueryOptionConstant.IN + "(" + WebUtil.toInSql(oids.toArray(new String[0])) + ")"); - List<ClientBusinessObject> list = queryCBO(btmName, conditionMap); + List<BusinessObject> list = queryCBO(btmName, conditionMap); if(CollectionUtils.isEmpty(list)){ throw new VciBaseException("{0}鏉℃暟鎹湪绯荤粺涓笉瀛樺湪",new String[]{String.valueOf(oids.size())}); } -- Gitblit v1.9.3