From 8d95a237e35d8b04ec4cfad7ca2e12fd360b5e8d Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 12 十月 2023 16:40:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java |   46 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
index 184ea18..a10b340 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -2363,8 +2363,14 @@
 //		cbo.getData().putAll(orderDTO.getData());
         cbo.setLastModifyTime(new Date());
         cbo.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId()));
-        updateBatchByBaseModel(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), Collections.singletonList(cbo));
-        batchSaveSelectChar(templateVO, Collections.singletonList(cbo));
+		if(selectIdAndOidCounts(classifyFullInfo.getTopClassifyVO().getBtmTypeId(),cbo.getId(),cbo.getOid())>0){
+			throw new ServiceException("淇敼鐨勭紪鐮佹暟鎹甀D宸叉湁鍘嗗彶璁板綍璇风‘璁わ紒锛�");
+		}
+		R r = updateBatchByBaseModel(classifyFullInfo.getTopClassifyVO().getBtmTypeId(), Collections.singletonList(cbo));
+		if(!r.isSuccess()){
+			throw new ServiceException(r.getMsg());
+		}
+		batchSaveSelectChar(templateVO, Collections.singletonList(cbo));
     }
 
     /**
@@ -3522,6 +3528,42 @@
         });
         return commonsMapper.insertByBaseModel(listR.getData().get(0).getTableName(), maps.get(0), maps);
     }
+	/**
+	 * 浼犲叆涓氬姟绫诲瀷浠ュ強ID鏌ヨ涓氬姟琛ㄦ暟鎹槸鍚﹂噸澶�
+	 *
+	 * @param btmType 涓氬姟绫诲瀷
+	 * @param ids      澶勭悊鏁版嵁
+	 * @return 鏌ヨ鍒版暟鎹殑鎬绘暟
+	 */
+    @Override
+    public Integer selectIdsCounts(String btmType, List<String> ids) {
+        //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
+        R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
+        if (!listR.isSuccess() || listR.getData().size() == 0) {
+            throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+        }
+		return commonsMapper.queryCountBySql("select count(*) from " +
+			listR.getData().get(0).getTableName() + " where id in ("+ ids.stream().map(s -> "'" + s + "'").collect(Collectors.joining(",")) +")");
+    }
+
+	/**
+	 * 浼犲叆涓氬姟绫诲瀷浠ュ強ID銆丱ID鏌ヨ涓氬姟琛ㄦ暟鎹槸鍚﹂噸澶�
+	 *
+	 * @param btmType 涓氬姟绫诲瀷
+	 * @param id      澶勭悊鏁版嵁id
+	 * @param oid      澶勭悊鏁版嵁oid
+	 * @return 鏌ヨ鍒版暟鎹殑鎬绘暟
+	 */
+	@Override
+	public Integer selectIdAndOidCounts(String btmType, String id, String oid) {
+		//浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃
+		R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType));
+		if (!listR.isSuccess() || listR.getData().size() == 0) {
+			throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
+		}
+		return commonsMapper.queryCountBySql("select count(*) from " +
+			listR.getData().get(0).getTableName() + " where id ='" + id + "' and oid <> '" + oid + "'");
+	}
 
     /**
      * 浼犲叆涓氬姟绫诲瀷浠ュ強鐩竜id闆嗗悎鏌ヨ鏁版嵁杩涜杩斿洖

--
Gitblit v1.9.3