From c6a845528d45bfb44591a69dadb44539432d06d0 Mon Sep 17 00:00:00 2001
From: yuxc <653031404@qq.com>
Date: 星期五, 12 五月 2023 11:55:06 +0800
Subject: [PATCH] 枚举相关改动

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java |  389 +++++++++++++++++++++++++++++--------------------------
 1 files changed, 207 insertions(+), 182 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 d99f7e4..d5dbbc5 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
@@ -3,32 +3,28 @@
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.nacos.common.utils.StringUtils;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.sun.corba.se.impl.orbutil.ObjectUtility;
 import com.vci.ubcs.code.bo.CodeClassifyFullInfoBO;
 import com.vci.ubcs.code.dto.CodeOrderDTO;
 import com.vci.ubcs.code.dto.datapush.BaseModelDTO;
 import com.vci.ubcs.code.entity.CodeAllCode;
 import com.vci.ubcs.code.entity.CodeOsbtmtypeEntity;
-import com.vci.ubcs.code.entity.CodeRule;
 import com.vci.ubcs.code.entity.CodeWupinEntity;
 import com.vci.ubcs.code.enumpack.CodeDefaultLC;
 import com.vci.ubcs.code.enumpack.CodeLevelTypeEnum;
 import com.vci.ubcs.code.enumpack.CodeSecTypeEnum;
 import com.vci.ubcs.code.mapper.CodeAllCodeMapper;
 import com.vci.ubcs.code.mapper.CodeOsbtmtypeMapper;
-import com.vci.ubcs.code.mapper.CodeRuleMapper;
+import com.vci.ubcs.code.mapper.CommonsMapper;
 import com.vci.ubcs.code.service.*;
+import com.vci.ubcs.code.vo.CodeClstempattrVO;
 import com.vci.ubcs.code.vo.CodeClstemplateVO;
 import com.vci.ubcs.code.vo.CodeKeyattrrepeatVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
-import com.vci.ubcs.omd.entity.Dict;
 import com.vci.ubcs.starter.exception.VciBaseException;
-import com.vci.ubcs.starter.revision.model.BaseModel;
 import com.vci.ubcs.starter.web.enumpck.UserSecretEnum;
 import com.vci.ubcs.starter.web.pagemodel.KeyValue;
 import com.vci.ubcs.starter.web.toolmodel.DateConverter;
@@ -40,7 +36,6 @@
 import com.vci.ubcs.system.feign.IDictBizClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.BeanUtils;
@@ -50,7 +45,6 @@
 
 import javax.annotation.Resource;
 import java.util.*;
-import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.stream.Collectors;
 
 /**
@@ -61,6 +55,7 @@
  */
 @Service
 public class MdmEngineServiceImpl extends ServiceImpl<CodeAllCodeMapper, CodeAllCode> implements MdmEngineService {
+
 
 	/**
 	 * 妯℃澘鐨勬湇鍔�
@@ -96,6 +91,17 @@
 	private ICodeClassifyService classifyService;
 
 	/**
+	 * 鍏紡鐨勬湇鍔�
+	 */
+	@Autowired
+	private FormulaServiceImpl formulaService;
+
+	/**
+	 * 閫氱敤鏌ヨ
+	 */
+	@Resource
+	CommonsMapper commonsMapper;
+	/**
 	 * 鍏抽敭灞炴�х殑閰嶇疆
 	 */
 	@Autowired
@@ -105,8 +111,10 @@
 	 */
 	private Logger logger = LoggerFactory.getLogger(getClass());
 
-	//	@Autowired
-	//	private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
+//	@Autowired
+//	private CodeOsbtmtypeMapper codeOsbtmtypeMapper;
+
+
 
 	/**
 	 * 浣跨敤鍒嗙被鐨勪富閿幏鍙栧彲浠ヤ娇鐢ㄧ殑妯℃澘瀵硅薄
@@ -184,14 +192,14 @@
 		List<CodeAllCode> codeCbos = baseMapper.selectList(allCodeWrapper);
 //		List<ClientBusinessObject> codeCbos = boService.queryCBO(MdmBtmTypeConstant.CODE_ALL_CODE, conditionMap);
 		// 鍥炴敹闇�瑕佷笟鍔℃暟鎹垹闄�
-//		if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) {
-////			BatchCBO batchCBO = new BatchCBO();
-////			batchCBO.getDeleteCbos().addAll(cboList);
-//			codeOsbtmtypeMapper.deleteBatchIds(cboList);
-////			boService.persistenceBatch(batchCBO);
-//		} else {
+		if (CodeDefaultLC.TASK_BACK.getValue().equals(baseModelDTO.getLcStatus())) {
+//			BatchCBO batchCBO = new BatchCBO();
+//			batchCBO.getDeleteCbos().addAll(cboList);
+			codeOsbtmtypeMapper.deleteBatchIds(cboList);
+//			boService.persistenceBatch(batchCBO);
+		} else {
 //			lifeCycleService.transCboStatus(cboList, baseModelDTO.getLcStatus());
-//		}
+		}
 //		lifeCycleService.transCboStatus(codeCbos, baseModelDTO.getLcStatus());
 	}
 
@@ -227,23 +235,30 @@
 		switchDateAttrOnOrder(templateVO, orderDTO);
 		//9.鐢熸垚缂栫爜鐨勪俊鎭�
 //		ClientBusinessObject cbo = boService.createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
-//		CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
+		CodeWupinEntity cbo = createCBOByBtmName(classifyFullInfo.getTopClassifyVO().getBtmtypeid());
 //		//榛樿鐨勫睘鎬ч兘涓嶇敤浠庡墠绔嫹璐�
 //		//璁剧疆缂栫爜闇�瑕佺殑榛樿灞炴�х殑鍐呭
-//		copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false);
+		copyValueToCBO(classifyFullInfo, cbo, orderDTO, templateVO, false);
 //		//TODO:鍥犱负榛樿鐨勫睘鎬ч兘涓嶆嫹璐濓紝鐩墠闆嗗洟鐮佸彨name锛屽苟娌℃湁浠嶥TO鎷疯礉鍒癱bo閲屻�傚鍔犱竴涓崟鐙鐞嗭紝浠ュ悗鍐嶇湅瑕佷笉瑕佽皟鏁�
-//		cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName());
+		cbo.setName(orderDTO.getName() == null ? "" : orderDTO.getName());
 //		//end -- modify by lihang @20220407
-//		List<CodeWupinEntity> cboList = new ArrayList<>();
-//
-//		//澶囨敞
-//		cbo.setDescription(orderDTO.getDescription());
+		List<CodeWupinEntity> cboList = new ArrayList<>();
+
+		//澶囨敞
+		cbo.setDescription(orderDTO.getDescription());
+		cboList.add(cbo);
 //
 //		cboList.add(cbo);
-//		List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList);
-////		batchSaveSelectChar(templateVO, cboList);
-//		return codeList.size() > 0 ? codeList.get(0) : "";
-		return null;
+		List<String> codeList = productCodeService.productCodeAndSaveData(classifyFullInfo, templateVO, ruleVO, orderDTO.getSecDTOList(),cboList);
+
+
+		List<String> charList = new ArrayList<>();
+		for (CodeWupinEntity wupinEntity : cboList) {
+			charList.add(wupinEntity.getId());
+		}
+		batchSaveSelectChar(templateVO, charList);
+		return codeList.size() > 0 ? codeList.get(0) : "";
+//		return null;
 	}
 
 	/**
@@ -378,7 +393,7 @@
 			}
 			dataLowMap.putAll(orderDTO.getData());
 			compAttrVOMap.forEach((attrId, attrVO) -> {
-//				dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentrule()));
+				dataLowMap.put(attrId, formulaService.getValueByFormula(dataLowMap, attrVO.getComponentRule()));
 			});
 			dataLowMap.forEach((key, value) -> {
 				setValueToOrderDTO(orderDTO, key, value);
@@ -446,29 +461,30 @@
 			if (value == null) {
 				value = "";
 			}
-//			wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
+			wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap);
 		});
 
 		//娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙�
 
-//		if (!CollectionUtils.isEmpty(conditionMap)) {
-//			final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
-//			conditionMap.forEach((key, value) -> {
-//				sql[0] += " and " + key + " = " + value;
-//			});
-//			if (StringUtils.isNotBlank(orderDTO.getOid())) {
-//				//淇敼鐨勬椂鍊欙紝闇�瑕佹帓闄よ嚜宸�
-//				sql[0] += " and oid != '" + orderDTO.getOid() + "'";
-//			} else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) {
-//				sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'";
-//			}
-//			sql[0] += " and islastR = '1' and islastV = '1' ";
+		if (!CollectionUtils.isEmpty(conditionMap)) {
+			final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
+			conditionMap.forEach((key, value) -> {
+				sql[0] += " and " + key + " = " + value;
+			});
+			if (StringUtils.isNotBlank(orderDTO.getOid())) {
+				//淇敼鐨勬椂鍊欙紝闇�瑕佹帓闄よ嚜宸�
+				sql[0] += " and oid != '" + orderDTO.getOid() + "'";
+			} else if (StringUtils.isNotBlank(orderDTO.getCopyFromVersion())) {
+				sql[0] += " and oid != '" + orderDTO.getCopyFromVersion() + "'";
+			}
+			sql[0] += " and islastR = '1' and islastV = '1' ";
 //			if (boService.queryCountBySql(sql[0], new HashMap<>()) > 0) {
-//				String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}";
-//				String[] objs = new String[]{trim ? "鏄�" : "鍚�", ignoreCase ? "鏄�" : "鍚�", ignoreWidth ? "鏄�" : "鍚�", trimAll ? "鏄�" : "鍚�"};
-//				throw new VciBaseException("鏍规嵁鎮ㄥ~鍐欑殑鍏抽敭灞炴�х殑鍐呭锛岀粨鍚堝叧閿睘鎬ф煡璇㈣鍒欙紝鍙戠幇杩欎釜鏁版嵁宸茬粡鍦ㄧ郴缁熶腑瀛樺湪浜嗐�傝淇!銆�" + ruleInfoMsg, objs);
-//			}
-//		}
+			if (Integer.parseInt(commonsMapper.selectById(sql[0]).get(0)) > 0) {
+				String ruleInfoMsg = keyRuleVO == null ? "" : "鏌ヨ瑙勫垯锛氬幓闄ょ┖鏍�--{0},蹇界暐澶у皬鍐�--{1},蹇界暐鍏ㄥ崐瑙�--{2},蹇界暐鍏ㄩ儴绌烘牸--{3}";
+				String[] objs = new String[]{trim ? "鏄�" : "鍚�", ignoreCase ? "鏄�" : "鍚�", ignoreWidth ? "鏄�" : "鍚�", trimAll ? "鏄�" : "鍚�"};
+				throw new VciBaseException("鏍规嵁鎮ㄥ~鍐欑殑鍏抽敭灞炴�х殑鍐呭锛岀粨鍚堝叧閿睘鎬ф煡璇㈣鍒欙紝鍙戠幇杩欎釜鏁版嵁宸茬粡鍦ㄧ郴缁熶腑瀛樺湪浜嗐�傝淇!銆�" + ruleInfoMsg, objs);
+			}
+		}
 	}
 
 	/**
@@ -483,54 +499,54 @@
 	 * @param trimAll      鏄惁蹇界暐鍏ㄩ儴绌烘牸
 	 * @param conditionMap 鏌ヨ鏉′欢
 	 */
-//	@Override
-//	public void wrapperKeyAttrConditionMap(String value, CodeKeyattrrepeatVO keyRuleVO, String attrId,
-//										   boolean trim, boolean ignoreCase, boolean ignoreWidth,
-//										   boolean trimAll, Map<String, String> conditionMap) {
-//		boolean ignoreSpace = trim || trimAll;
-//		if (StringUtils.isBlank(value)) {
-//			//涓虹┖鐨勬椂鍊欙紝涓嶈兘鐢≦ueryOperation.ISNULL锛屽钩鍙颁笉鐭ラ亾鍟ユ椂鍊欎笉澶勭悊杩欑浜�
-//			conditionMap.put("t."+attrId, "null");
-//		} else {
-//			if (keyRuleVO != null) {
-//				String queryKey = "";
-//				String queryValue = "";
-//
-//				String temp = "";
-//				if (ignoreCase && ignoreSpace && ignoreWidth) {
-//					//蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙�
-//					temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte(%s)) " + (trimAll ? ",' ','')" : ")");
-//				} else if (ignoreCase && ignoreSpace && !ignoreWidth) {
-//					//蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
-//					temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")");
-//				} else if (ignoreCase && !ignoreSpace && ignoreWidth) {
-//					//蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
-//					temp = "UPPER(to_single_byte(%s))";
-//				} else if (!ignoreCase && ignoreSpace && ignoreWidth) {
-//					//涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅
-//					temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte(%s) " + (trimAll ? ",' ','')" : ")");
-//				} else if (ignoreCase && !ignoreSpace && !ignoreWidth) {
-//					//蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
-//					temp = "UPPER(%s)";
-//				} else if (!ignoreCase && !ignoreCase && ignoreWidth) {
-//					//涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
-//					temp = "to_single_byte(%s)";
-//				} else if (!ignoreCase && ignoreSpace && !ignoreWidth) {
-//					//涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
-//					temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")");
-//				} else if (!ignoreCase && !ignoreSpace && !ignoreWidth) {
-//					//涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
-//					temp = "%s";
-//				}
-//				queryKey = String.format(temp, "t."+attrId);
-//				queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'");
-//				conditionMap.put(queryKey, queryValue);
-//			} else {
-//				//涓虹┖鐨勬椂鍊欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅
-//				conditionMap.put("t."+attrId, value);
-//			}
-//		}
-//	}
+	@Override
+	public void wrapperKeyAttrConditionMap(String value, CodeKeyattrrepeatVO keyRuleVO, String attrId,
+										   boolean trim, boolean ignoreCase, boolean ignoreWidth,
+										   boolean trimAll, Map<String, String> conditionMap) {
+		boolean ignoreSpace = trim || trimAll;
+		if (StringUtils.isBlank(value)) {
+			//涓虹┖鐨勬椂鍊欙紝涓嶈兘鐢≦ueryOperation.ISNULL锛屽钩鍙颁笉鐭ラ亾鍟ユ椂鍊欎笉澶勭悊杩欑浜�
+			conditionMap.put("t."+attrId, "null");
+		} else {
+			if (keyRuleVO != null) {
+				String queryKey = "";
+				String queryValue = "";
+
+				String temp = "";
+				if (ignoreCase && ignoreSpace && ignoreWidth) {
+					//蹇界暐澶у皬鍐欙紝涓斿幓绌猴紝蹇界暐鍏ㄥ崐瑙�
+					temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(to_single_byte(%s)) " + (trimAll ? ",' ','')" : ")");
+				} else if (ignoreCase && ignoreSpace && !ignoreWidth) {
+					//蹇界暐澶у皬鍐欍�佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
+					temp = (trimAll ? "REPLACE" : "TRIM") + "(UPPER(%s) " + (trimAll ? ",' ','')" : ")");
+				} else if (ignoreCase && !ignoreSpace && ignoreWidth) {
+					//蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
+					temp = "UPPER(to_single_byte(%s))";
+				} else if (!ignoreCase && ignoreSpace && ignoreWidth) {
+					//涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佸拷鐣ュ叏鍗婅
+					temp = (trimAll ? "REPLACE" : "TRIM") + "(to_single_byte(%s) " + (trimAll ? ",' ','')" : ")");
+				} else if (ignoreCase && !ignoreSpace && !ignoreWidth) {
+					//蹇界暐澶у皬鍐欍�佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
+					temp = "UPPER(%s)";
+				} else if (!ignoreCase && !ignoreCase && ignoreWidth) {
+					//涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佸拷鐣ュ叏鍗婅
+					temp = "to_single_byte(%s)";
+				} else if (!ignoreCase && ignoreSpace && !ignoreWidth) {
+					//涓嶅拷鐣ュぇ灏忓啓銆佸幓绌恒�佷笉蹇界暐鍏ㄥ崐瑙�
+					temp = (trimAll ? "REPLACE" : "TRIM") + "(%s " + (trimAll ? ",' ','')" : ")");
+				} else if (!ignoreCase && !ignoreSpace && !ignoreWidth) {
+					//涓嶅拷鐣ュぇ灏忓啓銆佷笉鍘荤┖銆佷笉蹇界暐鍏ㄥ崐瑙�
+					temp = "%s";
+				}
+				queryKey = String.format(temp, "t."+attrId);
+				queryValue = String.format(temp, "'" + (trim ? value.trim() : value) + "'");
+				conditionMap.put(queryKey, queryValue);
+			} else {
+				//涓虹┖鐨勬椂鍊欎笉浠h〃涓嶆牎楠岋紝鍙槸涓嶅幓闄ょ浉鍏崇殑淇℃伅
+				conditionMap.put("t."+attrId, value);
+			}
+		}
+	}
 
 	/**
 	 * 鏍¢獙鏋氫妇鐨勫唴瀹�
@@ -657,77 +673,77 @@
 	 * @return CodeWupinEntity
 	 * @throws VciBaseException 鍒濆鍖栧嚭閿欑殑鏄細鎶涘嚭寮傚父
 	 */
-//	@Override
-//	public CodeWupinEntity createCBOByBtmName(String btmName)
-//		throws VciBaseException {
-//		if(btmName!=null){
-//			btmName = btmName.trim().toLowerCase();
+	@Override
+	public CodeWupinEntity createCBOByBtmName(String btmName)
+		throws VciBaseException {
+		if(btmName!=null){
+			btmName = btmName.trim().toLowerCase();
+		}
+		String userid = AuthUtil.getUser().getUserName();
+//		if(!hasCreatedCbos.containsKey(btmName)){
+//			if(StringUtils.isEmpty(userid)){
+//				throw new VciBaseException(msgCodePrefix +"noHasUserid");
+//			}
+//			try {
+//				hasCreatedCbos.put(btmName, createBusinessObject(btmName));
+//			} catch (Exception e) {
+//				logger.error("鍒涘缓涓氬姟绫诲瀷瀵硅薄",e);
+//				throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName});
+//			}
 //		}
-//		String userid = AuthUtil.getUser().getUserName();
-////		if(!hasCreatedCbos.containsKey(btmName)){
-////			if(StringUtils.isEmpty(userid)){
-////				throw new VciBaseException(msgCodePrefix +"noHasUserid");
-////			}
-////			try {
-////				hasCreatedCbos.put(btmName, createBusinessObject(btmName));
-////			} catch (Exception e) {
-////				logger.error("鍒涘缓涓氬姟绫诲瀷瀵硅薄",e);
-////				throw new VciBaseException(msgCodePrefix + "initBoError",new String[]{btmName});
-////			}
-////		}
-////		ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName));
-//
-//		QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>();
-//		btmWrapper.eq("ID",btmName);
-//		CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper);
-////		OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName);
-//		String userName = AuthUtil.getUser().getUserName();
-//		CodeWupinEntity wupinEntity = new CodeWupinEntity();
-//		wupinEntity.setOid(null);
-////		bo.setRevisionid((new ObjectUtility()).getNewObjectID36());
-////		bo.setNameoid((new ObjectUtility()).getNewObjectID36());
-//		wupinEntity.setBtmname(btmName);
-//		wupinEntity.setLastR(String.valueOf(1));
-//		wupinEntity.setFirstR(String.valueOf(1));
-//		wupinEntity.setFirstV(String.valueOf(1));
-//		wupinEntity.setLastV(String.valueOf(1));
-//		wupinEntity.setCreator(userName);
-//		wupinEntity.setCreateTime(new Date());
-//		wupinEntity.setLastModifier(userName);
-//		wupinEntity.setLastModifyTime(new Date());
-//		wupinEntity.setRevisionRule(btmTypeVO.getRevisionruleid());
-//		wupinEntity.setVersionRule(String.valueOf(btmTypeVO.getVersionRule()));
-//		if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){
-//			//鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1
-////			OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid());
-//			wupinEntity.setRevisionValue("1");
-//		}
-//
-//		wupinEntity.setRevisionSeq(1);
-//		wupinEntity.setVersionSeq(1);
-//		//鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1
-//		wupinEntity.setVersionValue("1");
-//		wupinEntity.setLctid("wupinLC");
-//		wupinEntity.setLcStatus("Editing");
-//		wupinEntity.setId("");
-//		wupinEntity.setName("");
-//		wupinEntity.setDescription("");
-//		wupinEntity.setOwner(userName);
-//		wupinEntity.setCheckinby(userName);
-//		wupinEntity.setCopyFromVersion("");
-//		wupinEntity.setMaterialtype((short) 1001);
-//		wupinEntity.setCaigouwl("true");
-//		wupinEntity.setShifoupihaoguanli("true");
-//		wupinEntity.setKucunwl("true");
-//		wupinEntity.setXiaoshouwl("false");
-//		wupinEntity.setPassing("true");
-//
-////		this.initTypeAttributeValue(wupinEntity,btmTypeVO);
-//		return wupinEntity;
-//
-//
-////		return cbo;
-//	}
+//		ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName));
+
+		QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>();
+		btmWrapper.eq("ID",btmName);
+		CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper);
+//		OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName);
+		String userName = AuthUtil.getUser().getUserName();
+		CodeWupinEntity wupinEntity = new CodeWupinEntity();
+		wupinEntity.setOid(null);
+//		bo.setRevisionid((new ObjectUtility()).getNewObjectID36());
+//		bo.setNameoid((new ObjectUtility()).getNewObjectID36());
+		wupinEntity.setBtmname(btmName);
+		wupinEntity.setLastR(String.valueOf(1));
+		wupinEntity.setFirstR(String.valueOf(1));
+		wupinEntity.setFirstV(String.valueOf(1));
+		wupinEntity.setLastV(String.valueOf(1));
+		wupinEntity.setCreator(userName);
+		wupinEntity.setCreateTime(new Date());
+		wupinEntity.setLastModifier(userName);
+		wupinEntity.setLastModifyTime(new Date());
+		wupinEntity.setRevisionRule(btmTypeVO.getRevisionruleid());
+		wupinEntity.setVersionRule(String.valueOf(btmTypeVO.getVersionRule()));
+		if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){
+			//鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1
+//			OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid());
+			wupinEntity.setRevisionValue("1");
+		}
+
+		wupinEntity.setRevisionSeq(1);
+		wupinEntity.setVersionSeq(1);
+		//鎻掍釜鐐癸紝闇�瑕侀棶鍕囧摜鐗堟湰闂锛屽睍绀洪粯璁や负1
+		wupinEntity.setVersionValue("1");
+		wupinEntity.setLctid("wupinLC");
+		wupinEntity.setLcStatus("Editing");
+		wupinEntity.setId("");
+		wupinEntity.setName("");
+		wupinEntity.setDescription("");
+		wupinEntity.setOwner(userName);
+		wupinEntity.setCheckinby(userName);
+		wupinEntity.setCopyFromVersion("");
+		wupinEntity.setMaterialtype((short) 1001);
+		wupinEntity.setCaigouwl("true");
+		wupinEntity.setShifoupihaoguanli("true");
+		wupinEntity.setKucunwl("true");
+		wupinEntity.setXiaoshouwl("false");
+		wupinEntity.setPassing("true");
+
+//		this.initTypeAttributeValue(wupinEntity,btmTypeVO);
+		return wupinEntity;
+
+
+//		return cbo;
+	}
 
 	/**
 	 * 鏄惁涓轰慨鏀瑰拷鐣ョ殑灞炴��
@@ -750,27 +766,36 @@
 	 * @param templateVO 妯℃澘鐨勫璞�
 	 * @param cboList    鏁版嵁鐨勫唴瀹�
 	 */
-//	@Override
-//	public void batchSaveSelectChar(CodeClstemplateVO templateVO, List<ClientBusinessObject> cboList) {
-//		if (templateVO != null && !CollectionUtils.isEmpty(cboList)) {
-//			//鏄紓姝ョ殑锛屾墍浠ョ洿鎺ュ惊鐜�
-//			List<CodeClassifyTemplateAttrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryidentification())).collect(Collectors.toList());
-//
-//			if (!CollectionUtils.isEmpty(selectAttrVOs)) {
-////				SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
-//				selectAttrVOs.parallelStream().forEach(attrVO -> {
-//					List<String> valuesList = new CopyOnWriteArrayList<>();
+	@Override
+	public void batchSaveSelectChar(CodeClstemplateVO templateVO, /*List<ClientBusinessObject> cboList*/
+									List<String> cboList) {
+		if (templateVO != null && !CollectionUtils.isEmpty(cboList)) {
+			//鏄紓姝ョ殑锛屾墍浠ョ洿鎺ュ惊鐜�
+			List<CodeClassifyTemplateAttrVO> selectAttrVOs = templateVO.getAttributes().stream().filter(s -> StringUtils.isNotBlank(s.getLibraryIdentification())).collect(Collectors.toList());
+
+			if (!CollectionUtils.isEmpty(selectAttrVOs)) {
+//				SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo();
+				selectAttrVOs.parallelStream().forEach(attrVO -> {
+					List<String> valuesList = cboList;
 //					cboList.parallelStream().forEach(cbo -> {
-//						String value = cbo.getAttributeValue(attrVO.getId());
+//						String value = cbo.get.getAttributeValue(attrVO.getId());
 //						if (StringUtils.isNotBlank(value)) {
 //							valuesList.add(value);
 //						}
 //					});
-//					if (!CollectionUtils.isEmpty(valuesList)) {
+					if (!CollectionUtils.isEmpty(valuesList)) {
+						for (String s : valuesList) {
+							DictBiz dictBiz = new DictBiz();
+							dictBiz.setCode(templateVO.getBtmTypeId());
+							dictBiz.setDictKey(s);
+							dictBiz.setDictValue(s);
+							//浠庡師鏉ョ殑charService锛堝彲杈撳彲閫夛級鏇存敼涓鸿皟鐢╫md涓殑鎺ュ彛鏉ュ疄鐜�
+							iDictBizClient.getCheck(dictBiz);
+						}
 //						charService.saveBySameNamespaceAndFlag(templateVO.getBtmTypeId(), attrVO.getLibraryIdentification(), valuesList, sessionInfo);
-//					}
-//				});
-//			}
-//		}
-//	}
+					}
+				});
+			}
+		}
+	}
 }

--
Gitblit v1.9.3