From d6e9b6f11fd8f36895eb70f092bdd8c412750111 Mon Sep 17 00:00:00 2001
From: dangsn <dangsn@vci-tech.com>
Date: 星期四, 16 一月 2025 12:00:42 +0800
Subject: [PATCH] 补充AOF服务
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java | 321 +++++++++++++++++++++++++++++++++--------------------
1 files changed, 199 insertions(+), 122 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
index 73a4fac..fcba915 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
@@ -6,10 +6,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.vci.client.common.oq.OQTool;
import com.vci.client.common.providers.ClientServiceProvider;
-import com.vci.client.mw.ClientSessionUtility;
import com.vci.common.qt.object.Condition;
import com.vci.common.qt.object.QueryTemplate;
-import com.vci.common.utility.ObjectUtility;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.atm.AttributeDef;
@@ -21,9 +19,9 @@
import com.vci.corba.omd.lcm.LifeCycle;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.corba.omd.stm.StatePool;
+import com.vci.corba.omd.tim.TypeIndexDef;
import com.vci.corba.omd.vrm.VersionRule;
import com.vci.dto.OsBtmTypeDTO;
-import com.vci.dto.OsBtmTypeLinkAttributesDTO;
import com.vci.model.IndexObject;
import com.vci.omd.constants.AttributeConstants;
import com.vci.omd.constants.FileObjectType;
@@ -31,14 +29,12 @@
import com.vci.omd.utils.ObjectTool;
import com.vci.pagemodel.*;
import com.vci.po.OsBtmTypePO;
-import com.vci.po.OsLinkTypePO;
import com.vci.starter.poi.bo.ReadExcelOption;
import com.vci.starter.poi.bo.WriteExcelData;
import com.vci.starter.poi.bo.WriteExcelOption;
import com.vci.starter.poi.constant.ExcelLangCodeConstant;
import com.vci.starter.poi.util.ExcelUtil;
import com.vci.starter.web.annotation.log.VciUnLog;
-import com.vci.starter.web.constant.QueryOptionConstant;
import com.vci.starter.web.enumpck.BooleanEnum;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseResult;
@@ -46,9 +42,13 @@
import com.vci.starter.web.pagemodel.PageHelper;
import com.vci.starter.web.pagemodel.Tree;
import com.vci.starter.web.util.*;
-import com.vci.starter.web.util.BeanUtil;
+import com.vci.starter.web.util.Lcm.ConcurrentDateFormat;
+import com.vci.starter.web.util.Lcm.DateUtil;
+import com.vci.starter.web.util.Lcm.Func;
+import com.vci.web.other.AllOsEnumVOMapThreadLocal;
import com.vci.web.service.*;
-import com.vci.web.util.*;
+import com.vci.web.util.PlatformClientUtil;
+import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,7 +59,6 @@
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
-import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
@@ -203,10 +202,14 @@
@Override
public List<OsBtmTypeVO> btmDO2VOs(Collection<BizType> btmItems,Map<String, OsAttributeVO> attributeVOMap) {
List<OsBtmTypeVO> VOS = new ArrayList<>();
- Optional.ofNullable(btmItems).orElseGet(() -> new ArrayList<>()).stream().forEach(btmItem -> {
+// Optional.ofNullable(btmItems).orElseGet(() -> new ArrayList<>()).parallelStream().forEach(btmItem -> {
+// OsBtmTypeVO vo = btmDO2VO(btmItem,attributeVOMap);
+// VOS.add(vo);
+// });
+ for (BizType btmItem : btmItems) {
OsBtmTypeVO vo = btmDO2VO(btmItem,attributeVOMap);
VOS.add(vo);
- });
+ }
return VOS;
}
@@ -244,18 +247,20 @@
vo.setTableName(VciBaseUtil.getTableName(vo.getId()));
vo.setInputRevisionFlag(btmItem.revInput);
vo.setDelimiter(btmItem.delimiter);
+ vo.setImageName(btmItem.imageName);
vo.setfName(btmItem.fName);
vo.setVersionRule(String.valueOf(btmItem.verRuleName));
- if (StringUtils.isNotBlank(vo.getRevisionRuleName()) || vo.isInputRevisionFlag()) {
+ if (StringUtils.isNotBlank(vo.getRevisionRuleId()) || vo.isInputRevisionFlag()) {
vo.setRevisionFlag(true);
}
vo.setLifeCycleIds(Arrays.stream(btmItem.lifeCycles).collect(Collectors.joining(",")));
vo.setApNameArray(btmItem.apNameArray);
List<OsAttributeVO> attributeVOS = attributeService.listAttrByIds(Arrays.stream(btmItem.apNameArray).collect(Collectors.toList()),attributeVOMap);
List<OsBtmTypeAttributeVO> btmTypeAttributeVOS = new ArrayList<>();
- Optional.ofNullable(attributeVOS).orElseGet(() -> new ArrayList<>()).stream().forEach(attributeVO -> {
+// Optional.ofNullable(attributeVOS).orElseGet(() -> new ArrayList<>()).stream().forEach(attributeVO -> {
+ for (OsAttributeVO attributeVO : attributeVOS) {
OsBtmTypeAttributeVO btmTypeAttributeVO = new OsBtmTypeAttributeVO();
- BeanUtil.convert(attributeVO, btmTypeAttributeVO);
+ BeanUtilForVCI.convert(attributeVO, btmTypeAttributeVO);
btmTypeAttributeVO.setPkBtmType(vo.getOid());
btmTypeAttributeVO.setBtmTypeId(vo.getId());
btmTypeAttributeVO.setAttributeDataType(attributeVO.getAttributeDataType());
@@ -273,7 +278,8 @@
btmTypeAttributeVO.setEnumItemMap(enumService.getEnumValueMap(btmTypeAttributeVO.getEnumId()));
}
btmTypeAttributeVOS.add(btmTypeAttributeVO);
- });
+// });
+ }
vo.setAttributes(btmTypeAttributeVOS);
}
return vo;
@@ -290,12 +296,12 @@
if (CollectionUtils.isEmpty(btmIds)) {
return null;
}
- Map<String, OsBtmTypeVO> btmTypeVOMap = self.selectAllBtmMap();
+ //Map<String, OsBtmTypeVO> btmTypeVOMap = self.selectAllBtmMap();
+ BtmDataFetcher btmDataFetcher = new BtmDataFetcher();
List<OsBtmTypeVO> btmTypeVOS = new ArrayList<>();
btmIds.stream().forEach(id -> {
- if (btmTypeVOMap.containsKey(id.toLowerCase())) {
- btmTypeVOS.add(btmTypeVOMap.get(id.toLowerCase()));
- }
+ OsBtmTypeVO btmType = btmDataFetcher.getBtmType(id);
+ btmTypeVOS.add(btmType);
});
return btmTypeVOS;
}
@@ -307,12 +313,32 @@
* @return 涓氬姟绫诲瀷
*/
@Override
- public OsBtmTypeVO getBtmById(String id) {
+ public OsBtmTypeVO getBtmById(String id) throws PLException {
if (StringUtils.isBlank(id)) {
return null;
}
- return self.selectAllBtmMap().getOrDefault(id.toLowerCase(), null);
+ BizType bizType = platformClientUtil.getBtmService().getBizTypeByName(id);
+ return btmDO2VO(bizType,null);
}
+
+ /**
+ * 浣跨敤绫诲瀷鍚嶈幏鍙栦笟鍔$被鍨�,鏌ヤ笉鍒扮洿鎺ユ姤閿�
+ * @param btmName 绫诲瀷鍚�
+ * @return 涓氬姟绫诲瀷
+ * @throws
+ */
+ @Override
+ public OsBtmTypeVO getBtmByName(String btmName) throws PLException{
+ if(Func.isBlank(btmName)){
+ throw new PLException("500",new String[]{"鏌ヨ鏉′欢绫诲瀷鍚嶄笉鑳戒负绌猴紒"});
+ }
+ BizType bizType = platformClientUtil.getBtmService().getBizTypeByName(btmName);
+ if(Func.isEmpty(bizType) || Func.isBlank(bizType.oid)){
+ throw new PLException("500",new String[]{"鏍规嵁銆�"+btmName+"銆戞湭鏌ヨ鍒板搴斾笟鍔$被鍨嬶紒"});
+ }
+ return btmDO2VO(bizType,null);
+ }
+
/**
* 浣跨敤缂栧彿鑾峰彇涓氬姟绫诲瀷
*
@@ -424,11 +450,12 @@
if (attrVOs == null) {
attrVOs = new ArrayList<>();
}
- if (!CollectionUtils.isEmpty(attributeService.getDefaultAttributeVOs())) {
+ List<OsAttributeVO> defaultAttributeVOs = attributeService.getDefaultAttributeVOs();
+ if (!CollectionUtils.isEmpty(defaultAttributeVOs)) {
List<OsBtmTypeAttributeVO> finalAttrVOs = attrVOs;
- attributeService.getDefaultAttributeVOs().stream().forEach(attr -> {
+ defaultAttributeVOs.stream().forEach(attr -> {
OsBtmTypeAttributeVO attributeVO = new OsBtmTypeAttributeVO();
- BeanUtil.convert(attr, attributeVO);
+ BeanUtilForVCI.convert(attr, attributeVO);
attributeVO.setAttributeDataType(attr.getAttributeDataType());
attributeVO.setAttributeLength(attr.getAttrLength());
attributeVO.setReferBtmTypeId(attr.getBtmTypeId());
@@ -437,7 +464,8 @@
});
attrVOs = finalAttrVOs;
}
- return attrVOs;
+ // TODO: 2024/12/2 Ludc 杩斿洖鍊兼帓搴�
+ return attrVOs.stream().sorted(Comparator.comparing(o->o.getId(),String.CASE_INSENSITIVE_ORDER)).collect(Collectors.toList());
}
/**
@@ -495,7 +523,6 @@
/**
* 鍒ゆ柇璇ュ睘鎬ф槸鍚﹀凡缁忓湪涓氬姟绫诲瀷涓骇鐢熶簡鏁版嵁
- *
* @param abName
* @return
* @throws PLException
@@ -560,9 +587,10 @@
tree.setOid(bizType.oid);
tree.setLeaf(true);
tree.setParentName(bizType.fName);
+ tree.setIcon(bizType.imageName);
Map<String, String> atrrMap = new HashMap<>();
atrrMap.put("name", bizType.name);
- atrrMap.put("lable", bizType.label);
+ atrrMap.put("label", bizType.label);
tree.setAttributes(atrrMap);
trees.add(tree);
});
@@ -604,7 +632,7 @@
* @return 鏋氫妇鐨勫悕绉�
*/
@Override
- public String getNameById(String id) {
+ public String getNameById(String id) throws PLException {
OsBtmTypeVO btmTypeVO = getBtmById(id);
if (btmTypeVO == null) {
throw new VciBaseException("涓氬姟绫诲瀷[{0}]鍦ㄧ郴缁熼噷涓嶅瓨鍦�", new String[]{id});
@@ -618,7 +646,7 @@
* @param btmId 涓氬姟绫诲瀷涓婚敭
*/
@Override
- public OsERVO createERDiagram(String btmId) {
+ public OsERVO createERDiagram(String btmId) throws PLException {
VciBaseUtil.alertNotNull(btmId, "涓氬姟绫诲瀷缂栧彿");
OsBtmTypeVO btmTypeVO = getBtmById(btmId);
List<OsERNodeVO> nodeVOList = new ArrayList<>();
@@ -639,7 +667,7 @@
* @return 鎵ц缁撴灉
*/
@Override
- public OsERVO createERUsed(String btmId) {
+ public OsERVO createERUsed(String btmId) throws PLException {
VciBaseUtil.alertNotNull(btmId, "涓氬姟绫诲瀷缂栧彿");
OsBtmTypeVO btmTypeVO = getBtmById(btmId);
//鑾峰彇浣跨敤褰撳墠绫诲瀷鐨勫睘鎬�
@@ -684,7 +712,13 @@
List<Tree> rootTreeList = new ArrayList<>();
BizType[] bizTypes = getBizTypes("");
OsBtmTypeVO osBtmTypeVO = null;
- List<OsBtmTypeVO> osBtmTypeVOS = btmDO2VOs(Arrays.asList(bizTypes),null);
+ Map<String, OsAttributeVO> attributeVOMap = null;
+ if(bizTypes.length > 0){
+ //鍏堝皢鎵�闇�瑕佺殑灞炴�с�佹灇涓炬暟鎹叏閮ㄥ姞杞藉嚭鏉ワ紝閬垮厤鍚庣画杩涜閲嶅鍔犺浇
+ attributeVOMap = attributeService.selectAllAttributeMap();
+ AllOsEnumVOMapThreadLocal.set(enumService.selectAllEnumMap());
+ }
+ List<OsBtmTypeVO> osBtmTypeVOS = btmDO2VOs(Arrays.asList(bizTypes),attributeVOMap);
for (int i = 0; i < osBtmTypeVOS.size(); i++) {
osBtmTypeVO = osBtmTypeVOS.get(i);
@@ -694,6 +728,7 @@
tree.setParentName(null);
tree.setParentId(null);
tree.setLeaf(true);
+ tree.setIcon(osBtmTypeVO.getImageName());
tree.setId(osBtmTypeVO.getId());
tree.setText(osBtmTypeVO.getDescription());
tree.setAttributes(WebUtil.objectToMapString(osBtmTypeVO));
@@ -701,7 +736,8 @@
rootTreeList.add(tree);
}
}
-
+ AllOsEnumVOMapThreadLocal.remove();
+ rootTreeList = rootTreeList.stream().sorted((o1, o2) -> o1.getId().compareTo(o2.getId())).collect(Collectors.toList());
return rootTreeList;
}
@@ -790,6 +826,7 @@
bizType.label = dto.getName();
bizType.fName = dto.getfName();
bizType.implClass = dto.getImplClass();
+ bizType.imageName = dto.getImageName();
bizType.shape = "";
bizType.lifeCycle = dto.getLifeCycleId();
List<String> lcList = Arrays.asList(dto.getSubLifeCycleId().split(","));
@@ -802,14 +839,9 @@
bizType.revLevel = dto.getRevLevel();
bizType.revRuleName = dto.getRevisionRuleId();
bizType.revInput = dto.isInputRevisionFlag();
-
bizType.delimiter = (dto.getDelimiter() == null ? "" : dto.getDelimiter());
-
bizType.verRuleName = Func.isBlank(dto.getVersionRule()) ? 0 : Short.parseShort(dto.getVersionRule());
-
- //bizType.imageName = dto.get;
//List<String> attrIdList = dto.getAttributesDTOList().stream().map(OsBtmTypeLinkAttributesDTO::getId).collect(Collectors.toList());
-
bizType.apNameArray = dto.getApNameArray().split(",");//attrIdList.toArray(new String[attrIdList.size()]);
String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
long timeMillis = System.currentTimeMillis();
@@ -956,14 +988,14 @@
String[] unRemovableFields = null;
List<String> unRemovableFields_ = null;
//闇�瑕佺Щ闄ょ殑灞炴��
- List<String> removableFields = null;
+ List<String> removableFields = new ArrayList<>();
//淇敼鍓嶄笟鍔$被鍨嬪湪鏁版嵁搴撲腑宸插瓨鍦ㄧ殑鎵�鏈夊睘鎬�
- String[] apNameArray = btmTypeDTO.getApNameArray().split(",");
+ List<String> apNameArray = Func.toStrList(btmTypeDTO.getApNameArray());
Set<String> dbApNameArray = Arrays.stream(dbBizType.apNameArray)
.collect(Collectors.toSet());
//杩囨护鍑洪渶瑕佺Щ闄ょ殑灞炴��
- removableFields = Arrays.stream(apNameArray)
- .filter(ap -> !dbApNameArray.contains(ap)) // 杩囨护涓嶅湪 dbApSet 涓殑鍏冪礌
+ removableFields = dbApNameArray.stream()
+ .filter(ap -> !apNameArray.contains(ap)) // 杩囨护涓嶅湪 dbApSet 涓殑鍏冪礌
.collect(Collectors.toList());
// 褰撲笟鍔$被鍨嬭〃涓煇灞炴�у凡缁忔湁鍊�, 涓嶅垹闄よ灞炴��, 灏嗗凡缁忕Щ闄ょ殑灞炴�ф坊鍔犲洖鏉�
unRemovableFields = platformClientUtil.getBtmService().getUnRemovableFields(id, removableFields.toArray(new String[0]));
@@ -972,7 +1004,9 @@
if (this.hasInstanceByBtmName(id)) {
//涓氬姟绫诲瀷宸叉湁瀹炰緥, 鍙兘鍒犻櫎娌℃湁鏁版嵁鐨勫垪
if (unRemovableFields != null && unRemovableFields.length > 0) {
- unRemovableFields_ = Arrays.asList(unRemovableFields);
+ //绉婚櫎浜嗕笉鍙慨鏀圭殑灞炴�х洿鎺ユ姤閿欙紝灏变笉寰�涓嬫墽琛屼簡
+ throw new VciBaseException("涓氬姟绫诲瀷宸叉湁瀹炰緥, 鍙兘鍒犻櫎娌℃湁鏁版嵁鐨勫垪锛屾湁鏁版嵁鐨勫垪鍚嶄负锛�" + removableFields);
+ /*unRemovableFields_ = Arrays.asList(unRemovableFields);
for (int i = 0; i < removableFields.size(); i++) {
String abName = removableFields.get(i);
if (unRemovableFields_.contains(abName)) {
@@ -980,7 +1014,7 @@
lastAttrList.add(abName);
}
}
- }
+ }*/
}
}
}
@@ -1252,29 +1286,18 @@
if (Func.isEmpty(conditionMap)) {
return new ArrayList<>();
}
- List<String> indexNameList = new ArrayList<String>();
- QueryTemplate qtl = new QueryTemplate();
- List<String> list = new ArrayList<String>();
- list.add("*");
- qtl.setBtmType("indexobject");
- qtl.setClauseList(list);
- qtl.setId("p");
- qtl.setType("btm");
- qtl.setRightFlag(false);
- Condition condition = OQTool.getCondition(conditionMap);
- qtl.setCondition(condition);
- //HashMap<String, String> indexmap = new HashMap<String, String>();
- BusinessObject findBTMObjects[] = platformClientUtil.getQueryService().findBTMObjects(qtl.getId(), OQTool.qtTOXMl(qtl).asXML());
List<IndexObject> indexObjects = new ArrayList<>();
- for (int i = 0; i < findBTMObjects.length; i++) {
- BusinessObject findBTMObject = findBTMObjects[i];
+ TypeIndexDef[] typenames = ClientServiceProvider.getOMDService().getTypeIndexService().getBTIndexDefs(conditionMap.get("typename"));
+
+ for (int i = 0; i < typenames.length; i++) {
+ TypeIndexDef typename = typenames[i];
IndexObject indexObject = new IndexObject();
- indexObject.setOid(findBTMObject.oid);
- indexObject.setDescription(findBTMObject.description);
- indexObject.setCreateTime(Func.format(new Date(findBTMObject.createTime), DateUtil.PATTERN_DATE));
- indexObject.setIndexName(ObjectTool.getBOAttributeValue(findBTMObject, "indexname"));
- indexObject.setTypeName(ObjectTool.getBOAttributeValue(findBTMObject, "typename"));
- indexObject.setAttrNames(ObjectTool.getBOAttributeValue(findBTMObject, "attrname"));
+ indexObject.setOid(typename.oid);
+ indexObject.setDescription(typename.description);
+ indexObject.setCreateTime(Func.format(new Date(typename.createTime), DateUtil.PATTERN_DATE));
+ indexObject.setIndexName(typename.name);
+ indexObject.setTypeName(typename.typeName);
+ indexObject.setAttrNames(typename.attributes);
indexObjects.add(indexObject);
}
return indexObjects;
@@ -1290,11 +1313,8 @@
@Override
public boolean delIndex(String btmName, String indexName) throws PLException {
VciBaseUtil.alertNotNull(btmName, "涓氬姟绫诲瀷鍚�", indexName, "绱㈠紩鍚�");
- Map<String, String> conditionMap = new HashMap<>();
- conditionMap.put("typename", btmName);
- conditionMap.put("indexname", indexName);
- List<IndexObject> bo2 = getIndexByCondition(conditionMap);
- if (bo2 != null && bo2.size() > 0) {
+ TypeIndexDef[] typeIndexDef= ClientServiceProvider.getOMDService().getTypeIndexService().getBTIndexDefs(btmName);
+ if( typeIndexDef != null && typeIndexDef.length > 0 ){
String[] indexAttr = {indexName};
boolean alterFlag = platformClientUtil.getBtmService().dropIndex(btmName, indexAttr);
@@ -1302,10 +1322,12 @@
if (!alterFlag) {
return false;
}
- for (int i = 0; i < bo2.size(); i++) {
- String oid = bo2.get(i).getOid();
- BusinessObject bo = platformClientUtil.getBOFactoryService().readBusinessObject(oid, "indexobject");
- platformClientUtil.getBOFactoryService().deleteBusinessObject(bo, 1);
+ for (int i = 0; i < typeIndexDef.length; i++) {
+ if(!typeIndexDef[i].name.equals(indexName)) {
+ continue;
+ }
+ String oid = typeIndexDef[i].oid;
+ ClientServiceProvider.getOMDService().getTypeIndexService().delIndexDef(oid);
}
}
return true;
@@ -1323,49 +1345,50 @@
String btmName = indexObjectList.get(0).getTypeName();
String indexNames = indexObjectList.stream().map(IndexObject::getIndexName).collect(Collectors.joining(","));
String[] oldindexAttr = {indexNames};
- BusinessObject bo;
- List<BusinessObject> boList = new ArrayList<>();
- //鍏堟煡璇㈠綋鍓嶆坊鍔犵储寮曟槸鍚﹀凡缁忓瓨鍦紝濡傛灉瀛樺湪灏卞厛鍒犻櫎鍐嶆柊澧炲疄鐜版浛鎹㈡搷浣�
- Map<String, String> conditionMap = new HashMap<>();
- conditionMap.put("typename", btmName);
- //鍏堣繖鏍峰鐞嗭紝鍓嶇鐜板湪鍙仛浜嗗崟娆′繚瀛橈紝鎵�浠ヤ笉鐢╥n
- conditionMap.put("indexname", indexNames);
- List<IndexObject> indexObjects = getIndexByCondition(conditionMap);
- if (indexObjects != null && indexObjects.size() > 0) {
- //绱㈠紩涓嶅瓨鍦ㄦ椂鍒犻櫎灏变細鎶ラ敊绱㈠紩涓嶅瓨鍦紝鎵�浠ヨ繖閲屾湁绱㈠紩鎵嶅幓鍒犻櫎
- boolean b = platformClientUtil.getBtmService().dropIndex(btmName, oldindexAttr);
- if (b) {
- for (int i = 0; i < indexObjects.size(); i++) {
- String oid = (String) indexObjects.get(i).getOid();
- bo = platformClientUtil.getBOFactoryService().readBusinessObject(oid, "indexobject");
- platformClientUtil.getBOFactoryService().deleteBusinessObject(bo, 1);
- }
- }
- }
+// BusinessObject bo;
+// List<BusinessObject> boList = new ArrayList<>();
+// //鍏堟煡璇㈠綋鍓嶆坊鍔犵储寮曟槸鍚﹀凡缁忓瓨鍦紝濡傛灉瀛樺湪灏卞厛鍒犻櫎鍐嶆柊澧炲疄鐜版浛鎹㈡搷浣�
+// Map<String, String> conditionMap = new HashMap<>();
+// conditionMap.put("typename", btmName);
+// //鍏堣繖鏍峰鐞嗭紝鍓嶇鐜板湪鍙仛浜嗗崟娆′繚瀛橈紝鎵�浠ヤ笉鐢╥n
+// conditionMap.put("indexname", indexNames);
+ TypeIndexDef[] typeIndexDefs = platformClientUtil.getTypeIndexService().getBTIndexDefs(btmName);
- for (int i = 0; i < indexObjectList.size(); i++) {
- IndexObject indexObject = indexObjectList.get(i);
- //bo = platformClientUtil.getBOFService().initBusinessObject("indexobject");
- bo = boService.createCBOByBtmName("indexobject");
- List<AttributeValue> attributeValues = new ArrayList<>();
- attributeValues.add(new AttributeValue("typename", btmName));
- attributeValues.add(new AttributeValue("indexname", indexObject.getIndexName()));
- attributeValues.add(new AttributeValue("attrname", indexObject.getAttrNames()));
- bo.newAttrValList = attributeValues.toArray(new AttributeValue[attributeValues.size()]);
- bo.description = indexObject.getDescription();
- String[] indexAttr = {indexObject.getIndexName(), indexObject.getAttrNames()};
- //缁欐寚瀹氫笟鍔$被鍨嬬殑鎸囧畾灞炴�у垱寤虹储寮�
- boolean alterFlag = platformClientUtil.getBtmService().addIndex(btmName, indexAttr);
- //绱㈠紩鍒涘缓鎴愬姛涔嬪悗锛岄渶瑕佸瓨鍌ㄦ垚鍔熺储寮曞埌绱㈠紩琛ㄤ腑
- if (!alterFlag) {
- return false;
+ if(typeIndexDefs!=null && typeIndexDefs.length>0){
+ boolean hasIndex = false;
+ for(int i = 0; i < typeIndexDefs.length; i ++){
+ if(!typeIndexDefs[i].name.equals(indexNames)) {
+ continue;
+ }
+ String oid = typeIndexDefs[i].oid;
+ platformClientUtil.getTypeIndexService().delIndexDef(oid);
+ hasIndex = true;
}
- boList.add(bo);
- //娣诲姞绱㈠紩淇℃伅鍒扮储寮曠殑涓氬姟琛ㄤ腑
- //platformClientUtil.getBOFactoryService().createBusinessObject(bo,false,false);
+ //绱㈠紩涓嶅瓨鍦ㄦ椂鍒犻櫎灏变細鎶ラ敊绱㈠紩涓嶅瓨鍦紝鎵�浠ヨ繖閲屾湁绱㈠紩鎵嶅幓鍒犻櫎
+ if(hasIndex) {
+ platformClientUtil.getBtmService().dropIndex(btmName, oldindexAttr);
+ }
}
- //娣诲姞绱㈠紩淇℃伅鍒扮储寮曠殑涓氬姟琛ㄤ腑
- platformClientUtil.getBOFactoryService().batchCreateBusinessObject(boList.toArray(new BusinessObject[boList.size()]), false, false);
+ StringBuilder sb = new StringBuilder();
+ List<TypeIndexDef> saveDefs = new ArrayList<>();
+ for(int i = 0; i < indexObjectList.size(); i ++){
+ TypeIndexDef saveDef = new TypeIndexDef();
+ saveDef.typeName = indexObjectList.get(i).getTypeName();
+ saveDef.name = indexObjectList.get(i).getIndexName();
+ saveDef.description = indexObjectList.get(i).getDescription();
+ saveDef.attributes = indexObjectList.get(i).getAttrNames();
+ sb.append(indexObjectList.get(i).getAttrNames());
+ if(i<indexObjectList.size()-1){
+ sb.append(",");
+ }
+ saveDefs.add(saveDef);
+ }
+ String[] indexAttr = {indexObjectList.get(0).getIndexName(),sb.toString()};
+ boolean alterFlag = platformClientUtil.getBtmService().addIndex(btmName, indexAttr);
+ if(!alterFlag) {
+ return false;
+ }
+ ClientServiceProvider.getOMDService().getTypeIndexService().saveIndexDefs(saveDefs.toArray(new TypeIndexDef[saveDefs.size()]));
return true;
}
@@ -1383,7 +1406,7 @@
//璁剧疆鍒楀悕
List<String> columns = new ArrayList<>(
Arrays.asList("绫诲瀷鍚嶇О", "鏍囩", "缁ф壙鑷�", "瀹炵幇绫�", "鎻忚堪", "鐗堟湰瑙勫垯", "鐗堟湰鍙疯鍒�",
- "鏄惁鎵嬪伐杈撳叆", "鍒嗛殧绗�", "鐗堟鍙疯鍒�", "鐢熷懡鍛ㄦ湡", "澶囬�夌敓鍛藉懆鏈熷垪琛�", "灞炴�у垪琛�")
+ "鏄惁鎵嬪伐杈撳叆", "鍒嗛殧绗�", "鐗堟鍙疯鍒�","鍥炬爣", "鐢熷懡鍛ㄦ湡", "澶囬�夌敓鍛藉懆鏈熷垪琛�", "灞炴�у垪琛�")
);
try {
new File(excelPath).createNewFile();
@@ -1407,9 +1430,10 @@
excelDataList.add(new WriteExcelData(i + 1, 7, bizType.revInput));
excelDataList.add(new WriteExcelData(i + 1, 8, bizType.delimiter));
excelDataList.add(new WriteExcelData(i + 1, 9, bizType.verRuleName));
- excelDataList.add(new WriteExcelData(i + 1, 10, bizType.lifeCycle));
- excelDataList.add(new WriteExcelData(i + 1, 11, String.join(",", bizType.lifeCycles)));
- excelDataList.add(new WriteExcelData(i + 1, 12, String.join(",", bizType.apNameArray)));
+ excelDataList.add(new WriteExcelData(i + 1, 10, bizType.imageName));
+ excelDataList.add(new WriteExcelData(i + 1, 11, bizType.lifeCycle));
+ excelDataList.add(new WriteExcelData(i + 1, 12, String.join(",", bizType.lifeCycles)));
+ excelDataList.add(new WriteExcelData(i + 1, 13, String.join(",", bizType.apNameArray)));
attributes.addAll(Arrays.asList(bizType.apNameArray));
i++;
}
@@ -1517,7 +1541,7 @@
excelReapeat.put(osBtmTypePO.getName(), osBtmTypePO.getRowIndex());
BizType bizType = new BizType();
bizType.name = osBtmTypePO.getName();
- bizType.label = osBtmTypePO.getLable();
+ bizType.label = osBtmTypePO.getLabel();
bizType.description = osBtmTypePO.getDescription();
bizType.fName = osBtmTypePO.getFName();
bizType.implClass = osBtmTypePO.getImplClass();
@@ -1526,6 +1550,7 @@
bizType.revInput = Boolean.parseBoolean(osBtmTypePO.getRevInput().toLowerCase(Locale.ROOT));
bizType.delimiter = osBtmTypePO.getDelimiter();
bizType.verRuleName = osBtmTypePO.getVerRuleName();
+ bizType.imageName = osBtmTypePO.getImageName();
bizType.lifeCycle = osBtmTypePO.getLifeCycle();
bizType.lifeCycles = osBtmTypePO.getLifeCycles().split(",");
bizType.apNameArray = osBtmTypePO.getApNameArray().split(",");
@@ -1576,7 +1601,7 @@
//boolean flag = DDLToolClient.getService().hasInstanceOralce(tableName);
boolean flag = false;
try {
- flag = ClientServiceProvider.getOMDService().getBTMService().hasData(btmName);
+ flag = platformClientUtil.getBtmService().hasData(btmName);
} catch (PLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -1599,6 +1624,7 @@
tree.setParentName(parentBIzType.getfName());
tree.setParentId(parentBIzType.getOid());
tree.setLeaf(true);
+ tree.setIcon(bizType.getImageName());
tree.setText(bizType.getDescription());
tree.setAttributes(WebUtil.objectToMapString(bizType));
tree.setChildren(getChildren(osBtmTypeVOS, bizType));
@@ -1633,7 +1659,14 @@
itemList.add(nodePropertyVO);
//鍒ゆ柇鍙傜収
if (hasRefer) {
- selectReferenceBtmType(attribute, btmTypeVO, nodeVOList, relationVOList);
+ try {
+ selectReferenceBtmType(attribute, btmTypeVO, nodeVOList, relationVOList);
+ } catch (PLException e) {
+ e.printStackTrace();
+ String exceptionMessage = "鍒ゆ柇涓氬姟绫诲瀷鐨勫睘鎬ф槸涓嶆槸鍙傜収绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ throw new VciBaseException(exceptionMessage);
+ }
}
});
nodeVO.setItems(itemList);
@@ -1649,7 +1682,7 @@
* @param relationVOList 鍏崇郴淇℃伅
*/
private void selectReferenceBtmType(OsBtmTypeAttributeVO attribute, OsBtmTypeVO btmTypeVO,
- List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList) {
+ List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList) throws PLException {
if (StringUtils.isNotBlank(attribute.getReferBtmTypeId())) {
//鏄弬鐓х被鍨嬬殑
OsBtmTypeVO referenceBtmType = getBtmById(attribute.getReferBtmTypeId());
@@ -1738,7 +1771,14 @@
items.add(nodePropertyVO);
//鍒ゆ柇鍙傜収
if (!used) {
- selectReferenceLinkType(attr, link, nodeVOList, relationVOList);
+ try {
+ selectReferenceLinkType(attr, link, nodeVOList, relationVOList);
+ } catch (PLException e) {
+ e.printStackTrace();
+ String exceptionMessage = "鏂摼鎺ョ被鍨嬬殑灞炴�ф槸涓嶆槸鍙傜収绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ throw new VciBaseException(exceptionMessage);
+ }
}
});
nodeVO.setItems(items);
@@ -1813,7 +1853,7 @@
* @param nodeVOList 鑺傜偣瀵硅薄
* @param relationVOList 鍏崇郴瀵硅薄
*/
- private void selectReferenceLinkType(OsLinkTypeAttributeVO attr, OsLinkTypeVO linkTypeVO, List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList) {
+ private void selectReferenceLinkType(OsLinkTypeAttributeVO attr, OsLinkTypeVO linkTypeVO, List<OsERNodeVO> nodeVOList, List<OsERRelationVO> relationVOList) throws PLException {
if (StringUtils.isNotBlank(attr.getReferBtmTypeId())) {
//鏄弬鐓х被鍨嬬殑
OsBtmTypeVO referenceBtmType = getBtmById(attr.getReferBtmTypeId());
@@ -2064,4 +2104,41 @@
}
+ private class BtmDataFetcher {
+
+ //涓氬姟绫诲瀷
+ private Map<String, BizType> btmTypeVOMap = new HashMap<String, BizType>();
+
+ public BtmDataFetcher() {
+ initBtmDataFetcher();
+ }
+
+ private void initBtmDataFetcher(){
+ try {
+ BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes("");
+ //List<OsBtmTypeVO> osBtmTypeVOS = btmDO2VOs(Arrays.asList(bizTypes), null);
+ if(Func.isNotEmpty(bizTypes)){
+ btmTypeVOMap = Arrays.stream(bizTypes).collect(Collectors.toMap(btm -> btm.name, btm -> btm));
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 鑾峰彇涓氬姟绫诲瀷
+ * @param id
+ * @return
+ */
+ public OsBtmTypeVO getBtmType(String id) {
+ BizType bizType = btmTypeVOMap.get(id);
+ if(Func.isEmpty(bizType)){
+ return null;
+ }
+ //鑾峰彇鐨勬椂鍊欐墠璧歏O瀵硅薄锛岃繖鏍烽伩鍏嶄竴娆℃�у叏閮˙tm杞琕O澶參鐨勯棶棰�
+ return btmDO2VO(bizType,null);
+ }
+
+ }
+
}
--
Gitblit v1.9.3