From ac8e8998235f247365280d1a1632115c43b10037 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 17 十一月 2023 02:24:30 +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 |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 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 6db0334..1a85609 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
@@ -701,14 +701,16 @@
 
         //娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙�
         if (!CollectionUtils.isEmpty(conditionMap)) {
-			conditionMap.put("CODETEMPLATEOID","'" + orderDTO.getTemplateOid() + "'");
+			// TODO: 鍚屼竴涓簱鍒ら噸涓嶉渶瑕佸尯鍒嗗垎绫籵id
+			// conditionMap.put("CODETEMPLATEOID","'" + orderDTO.getTemplateOid() + "'");
 //			final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
             R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(classifyFullInfo.getTopClassifyVO().getBtmTypeId()));
 //				String referTable = VciBaseUtil.getTableName(referVO.getReferType());
             if (!listR.isSuccess() || listR.getData().size() == 0) {
                 throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒");
             }
-            final String[] sql = {"select count(*) from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "};
+            //final String[] sql = {"select count(*) from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "};
+			final String[] sql = {"select id from " + listR.getData().get(0).getTableName() + " t where 1 = 1 "};
             conditionMap.forEach((key, value) -> {
 				if(StringUtils.isBlank(value)||value.equals(QueryOptionConstant.ISNULL)) {
 					sql[0] += " and " + key + " is null";
@@ -723,11 +725,16 @@
                 sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'";
             }
             sql[0] += " and lastR = '1' and lastV = '1' ";
+			String isParticipateCheckOids = classifyService.selectLeafByParentClassifyOid(classifyFullInfo.getTopClassifyVO().getOid(), classifyFullInfo.getCurrentClassifyVO().getOid());
+			if(Func.isNotEmpty(isParticipateCheckOids)){
+				sql[0] += " and codeclsfid not in(" + isParticipateCheckOids + ")";
+			}
 //			if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) {
-            if (Integer.parseInt(commonsMapper.selectById(sql[0]).get(0)) > 0) {
+			List<String> repeatData = commonsMapper.selectList(sql[0]);
+			if (!repeatData.isEmpty()) {
                 String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}";
                 String[] objs = new String[]{trim ? "鏄�" : "鍚�", ignoreCase ? "鏄�" : "鍚�", ignoreWidth ? "鏄�" : "鍚�", trimAll ? "鏄�" : "鍚�"};
-                throw new VciBaseException("鏍规嵁鎮ㄥ~鍐欑殑鍏抽敭灞炴�х殑鍐呭锛岀粨鍚堝叧閿睘鎬ф煡璇㈣鍒欙紝鍙戠幇杩欎釜鏁版嵁宸茬粡鍦ㄧ郴缁熶腑瀛樺湪浜嗐�傝淇!銆�" + ruleInfoMsg, objs);
+                throw new VciBaseException("鏍规嵁鎮ㄥ~鍐欑殑鍏抽敭灞炴�х殑鍐呭锛岀粨鍚堝叧閿睘鎬ф煡璇㈣鍒欙紝鍙戠幇璇ユ暟鎹凡缁忎笌绯荤粺涓紪鍙蜂负"+repeatData.stream().collect(Collectors.joining(","))+"鐨勬暟鎹噸澶嶃�傝淇!銆�" + ruleInfoMsg, objs);
             }
         }
     }
@@ -994,7 +1001,6 @@
             logger.error("璁剧疆榛樿鐨勫睘鎬х殑鍊奸敊璇�", e);
         }
     }
-
 
     /**
      * 鍒濆鍖栦笟鍔$被鍨�
@@ -1794,7 +1800,6 @@
         }
     }
 
-
     /**
      * 鏍规嵁妯℃澘灞炴�х敓鎴愮浉搴旂殑sql淇℃伅
      *
@@ -1960,6 +1965,8 @@
         String sqlHasPage = pageHelper.getLimit() > 0 ? ("select * from (select A.*,rownum RN from (" + sql + whereSubfixForPage) : sql;
         String sqlCount = "select count(1) from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE))
                 + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql;
+		String sqlId = "select ID from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE))
+			+ (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql;
         CodeTemplateAttrSqlBO sqlBO = new CodeTemplateAttrSqlBO();
         sqlBO.setTableName(tableName);
         sqlBO.setJoinTable(joinTableList);
@@ -1968,9 +1975,9 @@
         sqlBO.setSqlHasPage(sqlHasPage);
         sqlBO.setSqlCount(sqlCount);
         sqlBO.setSqlUnPage(sql);
+		sqlBO.setSqlId(sqlId);
         return sqlBO;
     }
-
 
     /**
      * 缁勫悎鏌ヨ鏉′欢鐨剆ql
@@ -2774,6 +2781,7 @@
         cbo.setName(orderDTO.getName());
         //鏁版嵁鐨勬椂鍊欙紝缂栫爜鏄笉鍙樼殑
         cbo.setCreateTime(cbo.getCreateTime());
+		cbo.setCreator(cbo.getCreator());
         cbo.setLastModifyTime(cbo.getLastModifyTime());
 		cbo.setTenantId(AuthUtil.getTenantId());
 		oldCbo.setLastV("0");
@@ -4191,7 +4199,7 @@
         toBo.setLastV(String.valueOf(1));
 		// 鏁版嵁鍗囩増涓嶉渶瑕侀噸鏂拌缃垱寤轰汉锛屽彧瀵规渶鍚庝慨鏀逛汉鍋氭洿鏂板氨鍙互浜�
         //toBo.setCreator(String.valueOf(AuthUtil.getUser().getUserId()));
-        toBo.setCreateTime(new Date());
+        toBo.setCreateTime(fromBo.getCreateTime());
         // toBo.setLastModifier(String.valueOf(AuthUtil.getUser().getUserId()));
 		toBo.setLastModifier(String.valueOf(AuthUtil.getUser().getAccount()));
         toBo.setLastModifyTime(new Date());

--
Gitblit v1.9.3