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 |   59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 54 insertions(+), 5 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 0a3fb50..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
@@ -425,7 +425,9 @@
 		cbo.setNameOid(VciBaseUtil.getPk());
 		cbo.setCreateTime(new Date());
 		cbo.setLastModifyTime(new Date());
-		cbo.setCreator(String.valueOf(AuthUtil.getUser().getUserId()));
+		//cbo.setCreator(String.valueOf(AuthUtil.getUser().getUserId()));銆�
+		// 瑕佹眰鏄剧ず璐﹀彿锛屾墍浠ュ仛浜嗘洿鏀�
+		cbo.setCreator(String.valueOf(AuthUtil.getUser().getAccount()));
 		cbo.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId()));
 		cbo.setTenantId(AuthUtil.getTenantId());
 		if(StringUtils.isNotBlank(orderDTO.getLcStatus())||StringUtils.isNotBlank(orderDTO.getData().get("lcStatus"))){
@@ -727,7 +729,11 @@
 			}
 			final String[] sql = {"select * from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "};
 			conditionMap.forEach((key, value) -> {
-				sql[0] += " and " + key + " = " + value;
+				if(StringUtils.isBlank(value)||value.equals(QueryOptionConstant.ISNULL)) {
+					sql[0] += " and " + key + " is null";
+				}else{
+					sql[0] += " and " + key + " = " + value;
+				}
 			});
 			if (StringUtils.isNotBlank(orderDTO.getOid())) {
 				//淇敼鐨勬椂鍊欙紝闇�瑕佹帓闄よ嚜宸�
@@ -1390,7 +1396,8 @@
 		//set缁欒〃鏍奸厤缃睘鎬�
 		uiFormReferVO.setTableConfig(uiTableConfigVO);
 		//瀛楁鍚嶄笉涓�鑷达紝闇�瑕佹墜鍔╯et
-		uiFormReferVO.setMuti(Func.toBoolean(codeReferConfig.getIsMuti()));
+
+		uiFormReferVO.setMuti(StringUtils.isBlank(codeReferConfig.getIsMuti())?false:true);
 		uiFormReferVO.setInitSort(new UIFieldSortVO(codeReferConfig.getSortField(),codeReferConfig.getSortType()));
 		// 绛涢�夋潯浠�
 		HashMap<String, String> whereMap = new HashMap<>();
@@ -2356,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));
     }
 
     /**
@@ -3515,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