From 99dda6d4254e062f386976e0d66c8379020d3944 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期五, 06 九月 2024 16:34:18 +0800
Subject: [PATCH] 查询模板导出导入
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java | 79 +++++++++++++++++++++++++++++++--------
1 files changed, 62 insertions(+), 17 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 3c5921f..f573031 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
@@ -38,6 +38,7 @@
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;
@@ -232,7 +233,7 @@
BeanUtil.convert(attributeVO,btmTypeAttributeVO);
btmTypeAttributeVO.setPkBtmType(vo.getOid());
btmTypeAttributeVO.setBtmTypeId(vo.getId());
- btmTypeAttributeVO.setAttrDataType(attributeVO.getAttributeDataType());
+ btmTypeAttributeVO.setAttributeDataType(attributeVO.getAttributeDataType());
btmTypeAttributeVO.setAttributeLength(attributeVO.getAttrLength());
btmTypeAttributeVO.setDefaultValue(attributeVO.getDefaultValue());
if("secretgrade".equalsIgnoreCase(attributeVO.getId())){
@@ -358,9 +359,14 @@
* @return 灞炴�х殑鍐呭
*/
@Override
- public List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId) {
+ public List<OsBtmTypeAttributeVO> listAttributeByBtmId(String btmId) throws PLException {
VciBaseUtil.alertNotNull(btmId,"涓氬姟绫诲瀷鐨勭紪鍙�");
- OsBtmTypeVO btmTypeVO = getBtmById(btmId);
+ BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(btmId);
+ if(Func.isEmpty(bizTypes)){
+ return new ArrayList<>();
+ }
+ BizType bizType = bizTypes[0];
+ OsBtmTypeVO btmTypeVO = btmDO2VO(bizType);
List<OsBtmTypeAttributeVO> attributes = btmTypeVO.getAttributes();
if(attributes == null){
attributes = new ArrayList<>();
@@ -375,7 +381,7 @@
* @return 灞炴�х殑鍐呭
*/
@Override
- public List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId) {
+ public List<OsBtmTypeAttributeVO> listAttributeByBtmIdHasDefault(String btmId) throws PLException {
List<OsBtmTypeAttributeVO> attrVOs = listAttributeByBtmId(btmId);
if(attrVOs == null){
attrVOs = new ArrayList<>();
@@ -385,7 +391,7 @@
attributeService.getDefaultAttributeVOs().stream().forEach(attr->{
OsBtmTypeAttributeVO attributeVO = new OsBtmTypeAttributeVO();
BeanUtil.convert(attr, attributeVO);
- attributeVO.setAttrDataType(attr.getAttributeDataType());
+ attributeVO.setAttributeDataType(attr.getAttributeDataType());
attributeVO.setAttributeLength(attr.getAttrLength());
attributeVO.setReferBtmTypeId(attr.getBtmTypeId());
attributeVO.setReferBtmTypeName(attr.getBtmTypeName());
@@ -487,6 +493,42 @@
}
/**
+ * 涓氬姟绫诲瀷鍒楄〃鏌ヨ锛岄潪鏍戠粨鏋勶細鐢ㄤ簬UI瀹氫箟宸︿晶涓氬姟绫诲瀷鏌ヨ锛屽彧杩斿洖name鍜宭able
+ * @param btmName
+ * @return
+ * @throws PLException
+ */
+ @Override
+ public Tree getBizTree(String btmName) throws PLException {
+ if(null == btmName){
+ btmName = "";
+ }
+ Tree returnTree = new Tree();
+ BizType[] bizTypes = platformClientUtil.getBtmService().getBizTypes(btmName);
+ if(Func.isEmpty(bizTypes)){
+ return returnTree;
+ }
+ returnTree.setOid("");
+ returnTree.setText("涓氬姟绫诲瀷");
+ returnTree.setLeaf(false);
+ List<Tree> trees = new ArrayList<>();
+ Arrays.stream(bizTypes).forEach(bizType -> {
+ Tree tree = new Tree();
+ tree.setText(bizType.name + " " +bizType.label);
+ tree.setOid(bizType.oid);
+ tree.setLeaf(true);
+ tree.setParentName(bizType.fName);
+ Map<String, String> atrrMap = new HashMap<>();
+ atrrMap.put("name",bizType.name);
+ atrrMap.put("lable",bizType.label);
+ tree.setAttributes(atrrMap);
+ trees.add(tree);
+ });
+ returnTree.setChildren(trees);
+ return returnTree;
+ }
+
+ /**
* 鍙傜収涓氬姟绫诲瀷
*
* @param conditionMap 鏌ヨ鏉′欢
@@ -648,7 +690,7 @@
AttributeDef sysAttributeDef = collect.get(attrName.toLowerCase());
OsBtmTypeAttributeVO vo = new OsBtmTypeAttributeVO();
vo.setOid(sysAttributeDef.oid);
- vo.setAttrDataType(sysAttributeDef.vtDataType);
+ vo.setAttributeDataType(sysAttributeDef.vtDataType);
vo.setPkBtmType(btmName);
vo.setCreateTime(new Date(sysAttributeDef.createTime));
vo.setCreator(sysAttributeDef.creator);
@@ -667,7 +709,7 @@
for (AttributeDef attribute : attributeDefs) {
OsBtmTypeAttributeVO vo = new OsBtmTypeAttributeVO();
vo.setOid(attribute.oid);
- vo.setAttrDataType(attribute.vtDataType);
+ vo.setAttributeDataType(attribute.vtDataType);
vo.setPkBtmType(btmName);
vo.setCreateTime(new Date(attribute.createTime));
vo.setCreator(attribute.creator);
@@ -695,6 +737,7 @@
*/
private BizType dto2BizType(OsBtmTypeDTO dto){
BizType bizType = new BizType();
+ bizType.oid = dto.getOid();
bizType.name =dto.getId();
bizType.isAbstract = dto.isAbstractFlag();
bizType.label = dto.getName();
@@ -710,24 +753,24 @@
}
bizType.description = dto.getDescription();
bizType.revLevel = dto.getRevLevel();
-
bizType.revRuleName = dto.getRevisionRuleId();
bizType.revInput = dto.isInputRevisionFlag();
bizType.delimiter = (dto.getDelimiter() == null ? "" : dto.getDelimiter());
- bizType.verRuleName = Short.parseShort(dto.getVersionRule());
+ 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();//attrIdList.toArray(new String[attrIdList.size()]);
+ bizType.apNameArray = dto.getApNameArray().split(",");//attrIdList.toArray(new String[attrIdList.size()]);
String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
long timeMillis = System.currentTimeMillis();
bizType.creator = Func.isBlank(dto.getCreator()) ? userId:dto.getCreator();
bizType.createTime = Func.isEmpty(dto.getCreateTime()) ? timeMillis:dto.getCreateTime().getTime();
bizType.modifier = userId;
bizType.modifyTime = timeMillis;
+ bizType.ts = Func.isEmpty(dto.getTs())? timeMillis:dto.getTs().getTime();
return bizType;
}
@@ -856,14 +899,14 @@
checkRevLevel(dbBizType,btmTypeDTO);
checkVersionInfo(btmTypeDTO);
//澶勭悊涓氬姟绫诲瀷涓嬬殑灞炴��
- List<String> lastAttrList = new ArrayList<>(Arrays.asList(btmTypeDTO.getApNameArray()));
+ List<String> lastAttrList = new ArrayList<>(Arrays.asList(btmTypeDTO.getApNameArray().split(",")));
//涓嶈兘绉婚櫎鐨勫睘鎬�
String[] unRemovableFields = null;
List<String> unRemovableFields_ = null;
//闇�瑕佺Щ闄ょ殑灞炴��
List<String> removableFields = null;
//淇敼鍓嶄笟鍔$被鍨嬪湪鏁版嵁搴撲腑宸插瓨鍦ㄧ殑鎵�鏈夊睘鎬�
- String[] apNameArray = btmTypeDTO.getApNameArray();
+ String[] apNameArray = btmTypeDTO.getApNameArray().split(",");
Set<String> dbApNameArray = Arrays.stream(dbBizType.apNameArray)
.collect(Collectors.toSet());
//杩囨护鍑洪渶瑕佺Щ闄ょ殑灞炴��
@@ -1215,13 +1258,15 @@
public boolean addIndex(List<IndexObject> indexObjectList) throws PLException {
VciBaseUtil.alertNotNull(indexObjectList,"鏂板鐨勭储寮曚俊鎭�");
String btmName = indexObjectList.get(0).getTypeName();
- String indexNames = indexObjectList.stream().map(IndexObject::getIndexName).collect(Collectors.joining());
+ 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){
//绱㈠紩涓嶅瓨鍦ㄦ椂鍒犻櫎灏变細鎶ラ敊绱㈠紩涓嶅瓨鍦紝鎵�浠ヨ繖閲屾湁绱㈠紩鎵嶅幓鍒犻櫎
@@ -1263,7 +1308,7 @@
/**
* 瀵煎嚭涓氬姟绫诲瀷
- * name 涓氬姟绫诲瀷鍚嶇О
+ * oid 涓氬姟绫诲瀷鍚嶇О
* @return 鍒涘缓缁撴灉
*/
@Override
@@ -1310,8 +1355,8 @@
String attrPath = attributeService.exportAttributes("btmattr",
attributes.stream().collect(Collectors.joining(",")),true);
//绉诲姩灞炴�у埌閾炬帴绫诲瀷鏂囦欢澶归噷闈㈠幓
- cn.hutool.core.io.FileUtil.move(new File(attrPath), new File(defaultTempFolder),true);
- cn.hutool.core.io.FileUtil.del(attrPath.substring(0,attrPath.lastIndexOf("\\")));
+ FileUtil.move(new File(attrPath), new File(defaultTempFolder),true);
+ FileUtil.del(attrPath.substring(0,attrPath.lastIndexOf("\\")));
}catch (IOException e) {
throw new RuntimeException(e);
}
@@ -1481,7 +1526,7 @@
if(StringUtils.isBlank(bizType.getfName())){
continue;
}
- if(bizType.getfName().equals(parentBIzType.getName())){
+ if(bizType.getfName().equals(parentBIzType.getId())){
Tree tree = new Tree();
tree.setOid(bizType.getOid());
tree.setParentName(parentBIzType.getfName());
--
Gitblit v1.10.0