From edd0231f6f9d69df75c52439c104e5126820ac4a Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 30 一月 2024 16:40:34 +0800
Subject: [PATCH] 分类授权数据授权,界面修改;业务类型修改表字段信息接口提示信息修改

---
 Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/impl/DdlServiceImpl.java |   51 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/impl/DdlServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/impl/DdlServiceImpl.java
index a8ffb74..651433a 100644
--- a/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/impl/DdlServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-ddl/src/main/java/com/vci/ubcs/ddl/service/impl/DdlServiceImpl.java
@@ -7,10 +7,8 @@
 import com.vci.ubcs.ddl.bo.DdlTableInDataBaseBO;
 import com.vci.ubcs.ddl.enums.BusinessTypeEnum;
 import com.vci.ubcs.ddl.enums.ModifyTableTaskEnum;
-import com.vci.ubcs.ddl.processor.ddl.DdlMapperProcessStrategy;
 import com.vci.ubcs.ddl.processor.ddl.DdlMapperProcessor;
 import com.vci.ubcs.ddl.processor.dll.DllMapperProcessor;
-import com.vci.ubcs.ddl.processor.dll.DllMapperProcessorStrategy;
 import com.vci.ubcs.ddl.properties.DdlPropertise;
 import com.vci.ubcs.ddl.service.IDdlService;
 import com.vci.ubcs.omd.cache.BtmTypeCache;
@@ -35,6 +33,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
+import javax.annotation.Resource;
 import javax.validation.constraints.NotNull;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
@@ -64,13 +63,15 @@
 	/**
 	 * ddl鏁版嵁鎿嶄綔鏈嶅姟
 	 */
-	private final DdlMapperProcessor ddlMapper = DdlMapperProcessStrategy.getProcessor();
+	@Autowired
+	private DdlMapperProcessor ddlMapper;
 
 
 	/**
 	 * dll鏁版嵁鎿嶄綔鏈嶅姟
 	 */
-	private final DllMapperProcessor dllMapper = DllMapperProcessorStrategy.getProcessor();
+	@Autowired
+	private DllMapperProcessor dllMapper;
 
 	private static final String YES = "Y";
 
@@ -80,25 +81,25 @@
 
 	private final Map<String, LinkTypeVO> idLinkMap = new ConcurrentHashMap<>();
 
-	private void putBtm(@NotNull BtmTypeVO... voList) throws ServiceException {
+	private void putBtm(@NotNull BtmTypeVO... voList) throws Throwable {
 		String collect = Arrays.stream(voList).map(BtmTypeVO::getId).filter(idBtmMap::containsKey).collect(Collectors.joining(","));
 		if (StringUtils.isBlank(collect)) {
 			Arrays.stream(voList).forEach(vo -> {
 				idBtmMap.put(vo.getId(), vo);
 			});
 		} else {
-			throw new ServiceException("涓氬姟绫诲瀷:[" + collect + "]姝e湪琚叾浠栫敤鎴锋搷浣�");
+			throw new Throwable("涓氬姟绫诲瀷:[" + collect + "]姝e湪琚叾浠栫敤鎴锋搷浣�");
 		}
 	}
 
-	private void putLink(@NotNull LinkTypeVO... voList) throws ServiceException {
+	private void putLink(@NotNull LinkTypeVO... voList) throws Throwable {
 		String collect = Arrays.stream(voList).map(LinkTypeVO::getId).filter(idLinkMap::containsKey).collect(Collectors.joining(","));
 		if (StringUtils.isBlank(collect)) {
 			Arrays.stream(voList).forEach(vo -> {
 				idLinkMap.put(vo.getId(), vo);
 			});
 		} else {
-			throw new ServiceException("閾炬帴绫诲瀷:[" + collect + "]姝e湪琚叾浠栫敤鎴锋搷浣�");
+			throw new Throwable("閾炬帴绫诲瀷:[" + collect + "]姝e湪琚叾浠栫敤鎴锋搷浣�");
 		}
 	}
 
@@ -975,27 +976,39 @@
 	 * @return 鎵ц缁撴灉
 	 */
 	@Override
-	public R<List<ModifyAttributeInfo>> submit(BtmAndLinkTypeDdlDTO ddlDTO) {
-		//try {
+	public R<List<ModifyAttributeInfo>> submit(BtmAndLinkTypeDdlDTO ddlDTO) throws Throwable {
+		try {
 			List<ModifyAttributeInfo> changedList = new ArrayList<>();
 			if (!CollectionUtils.isEmpty(ddlDTO.getBtmTypeList())) {
 				List<BtmTypeVO> btmTypeList = ddlDTO.getBtmTypeList();
-				//putBtm(btmTypeList.toArray(new BtmTypeVO[0]));
+				putBtm(btmTypeList.toArray(new BtmTypeVO[0]));
 				changedList.addAll(checkDifferent(btmTypeList, null));
-				//removeBtm(btmTypeList.toArray(new BtmTypeVO[0]));
+				removeBtm(btmTypeList.toArray(new BtmTypeVO[0]));
 			}
 			if (!CollectionUtils.isEmpty(ddlDTO.getLinkTypeList())) {
 				List<LinkTypeVO> linkTypeList = ddlDTO.getLinkTypeList();
-				//putLink(linkTypeList.toArray(new LinkTypeVO[0]));
+				putLink(linkTypeList.toArray(new LinkTypeVO[0]));
 				changedList.addAll(checkDifferent(null,linkTypeList));
-				//removeLink(linkTypeList.toArray(new LinkTypeVO[0]));
+				removeLink(linkTypeList.toArray(new LinkTypeVO[0]));
 			}
-			R<List<ModifyAttributeInfo>> result = R.success("鏁版嵁搴撴搷浣滄垚鍔�");
+			String msg = changedList.isEmpty() ? "鏁版嵁搴撴搷浣滄垚鍔�" : changedList.get(0).getHandleResult();
+			R<List<ModifyAttributeInfo>> result = R.success(msg);
 			result.setData(changedList);
 			return result;
-		//} catch (ServiceException e) {
-			//throw new RuntimeException(e.getMessage());
-//		}
+		} catch (Exception e) {
+			try {
+				// 寤鸿〃澶辫触鏈夊紓甯革紝鎹曡幏鍚庤繑鍥烇紝骞堕噴鏀剧嚎绋嬩腑鐨勫唴瀹�
+				if (!CollectionUtils.isEmpty(ddlDTO.getBtmTypeList())) {
+					removeBtm(ddlDTO.getBtmTypeList().toArray(new BtmTypeVO[0]));
+				}
+				if (!CollectionUtils.isEmpty(ddlDTO.getLinkTypeList())) {
+					removeLink(ddlDTO.getLinkTypeList().toArray(new LinkTypeVO[0]));
+				}
+				return R.fail(e.getMessage());
+			}catch (ServiceException e2){
+				return R.fail(e.getMessage());
+			}
+		}
 	}
 
 	/**
@@ -1056,7 +1069,7 @@
 					BtmTypeAttributeVO attributeVO = new BtmTypeAttributeVO();
 					attributeVO.setId(col.getId().toLowerCase());
 					attributeVO.setName(col.getName());
-					attributeVO.setNullableFlag(col.getNullableFlag());
+					attributeVO.setNullableFlag(StringUtils.equals(col.getNullableFlag(), BooleanEnum.TRUE.getValue()));
 					attributeVO.setAttributeLength(col.getAttributeLength());
 					attributeVO.setPrecisionLength(col.getPrecisionLength());
 					attributeVO.setScaleLength(col.getScaleLength());

--
Gitblit v1.9.3