From 3dd88eb315a90c2b793e10b0b987a6c3b09a8650 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 14 八月 2024 16:44:35 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
index c95d0bf..302d878 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -479,6 +479,10 @@
 		);
 		//灞炴�ц嫳鏂囧悕绉版牎楠岋紙鍒ょ┖銆佺郴缁熶腑鍒ら噸銆佹槸鍚﹀叧閿瓧銆佹槸鍚﹀悎瑙勭瓑锛�
 		checkName(osAttributeDTO.getId());
+		//妫�鏌ュ睘鎬у悕鏄惁宸插瓨鍦ㄤ笌绯荤粺涓�
+		if(platformClientUtil.getAttributeService().checkRowIsExists(osAttributeDTO.getId())){
+			throw new PLException("500",new String[]{"灞炴�у悕绉般��" + osAttributeDTO.getId() + "銆戝湪绯荤粺涓凡瀛樺湪!"});
+		}
 		//妫�鏌ラ粯璁ゅ�间笌灞炴�х被鍨嬫槸鍚﹀尮閰�
 		checkDefValue(osAttributeDTO);
 		//osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
@@ -693,9 +697,9 @@
 			throw new PLException("500",new String[]{"灞炴�у悕鏃犳晥,鍘熷洜锛氬睘鎬у悕鏄暟鎹簱鍏抽敭瀛�!"});
 		}
 		//妫�鏌ュ睘鎬у悕鏄惁宸插瓨鍦ㄤ笌绯荤粺涓�
-		if(platformClientUtil.getAttributeService().checkRowIsExists(abName)){
+		/*if(platformClientUtil.getAttributeService().checkRowIsExists(abName)){
 			throw new PLException("500",new String[]{"灞炴�у悕绉般��" + abName + "銆戝湪绯荤粺涓凡瀛樺湪!"});
-		}
+		}*/
 	}
 
 	/**
@@ -997,10 +1001,12 @@
 	/**
 	 * 瀵煎叆灞炴��
 	 * @param file
+	 * @param isContinue 绯荤粺涓嚭鐜伴噸澶嶆槸鍚﹁烦杩囨姤閿欑户缁墽琛�
 	 * @return
+	 * @throws Exception
 	 */
 	@Override
-	public BaseResult importAttributes(File file) throws Exception{
+	public BaseResult importAttributes(File file, boolean isContinue) throws Exception{
 		VciBaseUtil.alertNotNull(file,"excel鏂囦欢");
 		if(!file.exists()){
 			throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()});
@@ -1017,13 +1023,29 @@
 			List<OsAttributeDTO> dtoList = new ArrayList<>();
 			//褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級
 			Map<String, String> excelReapeat = new HashMap<>();
-			poList.stream().forEach(osAttributePO -> {
+			for (int i = 0; i < poList.size(); i++) {
+				OsAttributePO osAttributePO = poList.get(i);
 				if(Func.isBlank(osAttributePO.getId())){//灞炴�у悕鍒ょ┖
 					throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宎ttrnameerror");
 				}else if(Func.isBlank(osAttributePO.getAttributeDataType())){
 					throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宼ypeerror");
 				}else if(excelReapeat.containsKey(osAttributePO.getId())){//灞炴�у悕琛ㄦ牸涓垽閲�
 					throw new VciBaseException("绗��"+excelReapeat.get(osAttributePO.getId())+"銆戣鍜岀銆�"+osAttributePO.getRowIndex()+"銆戣鏁版嵁锛屽睘鎬у悕閲嶅");
+				}else {
+					try {
+						if(platformClientUtil.getAttributeService().checkRowIsExists(osAttributePO.getId())){
+							throw new PLException("500",new String[]{"灞炴�у悕绉般��" + osAttributePO.getId() + "銆戝湪绯荤粺涓凡瀛樺湪!"});
+						}
+					} catch (PLException e) {
+						e.printStackTrace();
+						String errorMsg = "涓庣郴缁熶腑灞炴�у悕鏌ラ噸鏃跺嚭鐜伴敊璇�,鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+						logger.error(errorMsg);
+						//鏄惁璺宠繃褰撴湡閲嶅鏁版嵁
+						if(isContinue){
+							continue;
+						}
+						throw new VciBaseException(errorMsg);
+					}
 				}
 				//灞炴�у悕鏍¢獙
 				try {
@@ -1076,7 +1098,7 @@
 					throw new VciBaseException(VciBaseUtil.getExceptionMessage(e));
 				}
 				dtoList.add(osAttributeDTO);
-			});
+			}
 			//鎵ц淇濆瓨鎿嶄綔
 			dtoList.stream().forEach(dto->{
 				try {

--
Gitblit v1.9.3