From 27f7b8f0459ed7c91cd532ae04c9aa3d15d11d84 Mon Sep 17 00:00:00 2001
From: yuxc <653031404@qq.com>
Date: 星期四, 25 五月 2023 17:22:29 +0800
Subject: [PATCH] 接口联调以及接口测试等上传

---
 Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeWupin.java                      |    2 
 Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/pagemodel/Tree.java                 |    9 +
 Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/revision/service/RevisionModelUtil.java |    1 
 Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeKeyAttrRepeat.java              |    4 
 Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeSerialValue.java                |    2 
 Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml                                   |    7 
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java          |   22 ++-
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java          |    7 
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java             |   98 +++++++++------
 Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/BeanUtilForVCI.java            |  142 +++++++++++++++++++++++
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java        |    4 
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java       |    5 
 Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodePhaseAttrMapper.xml                                  |   12 -
 13 files changed, 245 insertions(+), 70 deletions(-)

diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeKeyAttrRepeat.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeKeyAttrRepeat.java
index 254edc7..9b70ab5 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeKeyAttrRepeat.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeKeyAttrRepeat.java
@@ -126,7 +126,7 @@
 	 *
 	 */
 	@ApiModelProperty(value = "")
-	private Short revisionseq;
+	private Integer revisionseq;
 	/**
 	 *
 	 */
@@ -136,7 +136,7 @@
 	 *
 	 */
 	@ApiModelProperty(value = "")
-	private Short versionseq;
+	private Integer versionseq;
 	/**
 	 *
 	 */
diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeSerialValue.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeSerialValue.java
index 4fbaffc..0084f53 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeSerialValue.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeSerialValue.java
@@ -13,7 +13,7 @@
  * @date 2022-3-1
  */
 @Data
-@TableName("PL_CODE_CODESERIALVALUE")
+@TableName("PL_CODE_SERIALVALUE")
 @ApiModel(value = "CodeSerialValue瀵硅薄", description = "缂栫爜瑙勫垯鐨勬祦姘村��")
 @EqualsAndHashCode(callSuper = true)
 public class CodeSerialValue extends BaseModel {
diff --git a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeWupin.java b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeWupin.java
index 2d98fbf..3d8c88c 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeWupin.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeWupin.java
@@ -116,7 +116,7 @@
 	 *
 	 */
 	@ApiModelProperty(value = "")
-	private Short materialtype;
+	private Integer materialtype;
 	/**
 	 *
 	 */
diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/revision/service/RevisionModelUtil.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/revision/service/RevisionModelUtil.java
index 40100cc..9579b51 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/revision/service/RevisionModelUtil.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/revision/service/RevisionModelUtil.java
@@ -55,6 +55,7 @@
 						oidValues.add(VciBaseUtil.getStringValueFromObject(VciBaseUtil.getValueFromField(s, doObject)));
 					});
 					tree.setOid((String)oidValues.stream().collect(Collectors.joining(wrapperOptions.getOidValueSep())));
+					tree.setName((String) VciBaseUtil.getValueFromField("name", doObject));
 					if (f != null) {
 						tree.setText((String)f.apply(doObject));
 					} else {
diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/pagemodel/Tree.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/pagemodel/Tree.java
index bb09378..0baa065 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/pagemodel/Tree.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/pagemodel/Tree.java
@@ -14,6 +14,7 @@
 	private static final long serialVersionUID = 6886695271635257882L;
 	private String oid;
 	private String text;
+	private String name;
 	private boolean leaf = false;
 	private boolean showCheckbox = false;
 	private boolean checked = false;
@@ -44,6 +45,14 @@
 		this.oid = oid;
 	}
 
+	public String getName() {
+		return this.name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
 	public String getText() {
 		return this.text;
 	}
diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/BeanUtilForVCI.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/BeanUtilForVCI.java
index 880ca54..abaaa10 100644
--- a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/BeanUtilForVCI.java
+++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/util/BeanUtilForVCI.java
@@ -7,9 +7,19 @@
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.BeanWrapper;
+import org.springframework.beans.BeanWrapperImpl;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.ObjectUtils;
 
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
 import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.math.BigDecimal;
 import java.util.*;
 
 public class BeanUtilForVCI {
@@ -159,4 +169,136 @@
 			return result;
 		}
 	}
+
+	/**
+	 * 灏嗕竴涓� Map 瀵硅薄杞寲涓轰竴涓� JavaBean
+	 * @param clazz 瑕佽浆鍖栫殑绫诲瀷
+	 * @param map 鍖呭惈灞炴�у�肩殑 map
+	 * @return 杞寲鍑烘潵鐨� JavaBean 瀵硅薄
+	 * @throws IntrospectionException
+	 *             濡傛灉鍒嗘瀽绫诲睘鎬уけ璐�
+	 * @throws IllegalAccessException
+	 *             濡傛灉瀹炰緥鍖� JavaBean 澶辫触
+	 * @throws InstantiationException
+	 *             濡傛灉瀹炰緥鍖� JavaBean 澶辫触
+	 * @throws InvocationTargetException
+	 *             濡傛灉璋冪敤灞炴�х殑 setter 鏂规硶澶辫触
+	 */
+	public static <T>T convertMap(Class<T> clazz, Map map) throws IntrospectionException, IllegalAccessException, InstantiationException, InvocationTargetException {
+		BeanInfo beanInfo = Introspector.getBeanInfo(clazz); // 鑾峰彇绫诲睘鎬�
+		T obj = clazz.newInstance();
+		// 缁� JavaBean 瀵硅薄鐨勫睘鎬ц祴鍊�
+		PropertyDescriptor[] propertyDescriptors =  beanInfo.getPropertyDescriptors();
+		for (int i = 0; i< propertyDescriptors.length; i++) {
+			PropertyDescriptor descriptor = propertyDescriptors[i];
+			String propertyName = descriptor.getName();
+
+			if (map.containsKey(propertyName)) {
+				// 涓嬮潰涓�鍙ュ彲浠� try 璧锋潵锛岃繖鏍峰綋涓�涓睘鎬ц祴鍊煎け璐ョ殑鏃跺�欏氨涓嶄細褰卞搷鍏朵粬灞炴�ц祴鍊笺��
+				Object value = map.get(propertyName);
+
+				Object[] args = new Object[1];
+				args[0] = value;
+				Field privateField = getPrivateField(propertyName, clazz);
+				if (privateField == null) {
+				}
+				privateField.setAccessible(true);
+				String type = privateField.getGenericType().toString();
+				if (type.equals("class java.lang.String")) {
+					privateField.set(obj, value);
+				} else if (type.equals("class java.lang.Boolean")) {
+					privateField.set(obj, Boolean.parseBoolean(String.valueOf(value)));
+				} else if (type.equals("class java.lang.Long")) {
+					privateField.set(obj, Long.parseLong(String.valueOf(value)));
+				} else if (type.equals("class java.lang.Integer")) {
+					privateField.set(obj, Integer.parseInt(String.valueOf(value)));
+				} else if (type.equals("class java.lang.Double")) {
+					privateField.set(obj,Double.parseDouble(String.valueOf(value)));
+				} else if (type.equals("class java.lang.Float")) {
+					privateField.set(obj,Float.parseFloat(String.valueOf(value)));
+				} else if (type.equals("class java.math.BigDecimal")){
+					privateField.set(obj,new BigDecimal(String.valueOf(value)));
+				}//鍙户缁拷鍔犵被鍨�
+			}
+		}
+		return obj;
+	}
+	/*鎷垮埌鍙嶅皠鐖剁被绉佹湁灞炴��*/
+	private static Field getPrivateField(String name, Class cls) {
+		Field declaredField = null;
+		try {
+			declaredField = cls.getDeclaredField(name);
+		} catch (NoSuchFieldException ex) {
+
+			if (cls.getSuperclass() == null) {
+				return declaredField;
+			} else {
+				declaredField = getPrivateField(name, cls.getSuperclass());
+			}
+		}
+		return declaredField;
+	}
+
+	/**
+	 * 鑾峰彇鍒板璞′腑灞炴�т负null鐨勫睘鎬у悕
+	 *
+	 * @param source
+	 * @return
+	 */
+	private static String[] getNullPropertyNames(Object source) {
+		final BeanWrapper src = new BeanWrapperImpl(source);
+		PropertyDescriptor[] pds = src.getPropertyDescriptors();
+
+		Set<String> emptyNames = new HashSet<>();
+		for (PropertyDescriptor pd : pds) {
+			Object srcValue = src.getPropertyValue(pd.getName());
+			if (ObjectUtils.isEmpty(srcValue)) {
+				emptyNames.add(pd.getName());
+			}
+		}
+		String[] result = new String[emptyNames.size()];
+		return emptyNames.toArray(result);
+	}
+
+	/**
+	 * 鎷疯礉闈炵┖瀵硅薄灞炴�у��
+	 *
+	 * @param source
+	 * @param target
+	 */
+	public static void copyPropertiesIgnoreNull(Object source, Object target) {
+		BeanUtils.copyProperties(source, target, getNullPropertyNames(source));
+	}
+
+	/**
+	 * 闆嗗悎鎷疯礉闈炵┖鏁版嵁
+	 *
+	 * @param source       鏁版嵁婧�
+	 * @param target       鐩爣
+	 * @param propertyName 瑕佸尮閰嶇殑灞炴�у悕,渚嬪涓や釜闆嗗悎浣跨敤id杩涜鍖归厤鎷疯礉 propertyName: "id"
+	 */
+	public static void copyListPropertiesIgnoreNull(List<?> source, List<?> target, String propertyName) {
+		if (CollectionUtils.isEmpty(source)) {
+			throw new NullPointerException("copyListPropertiesIgnoreNull source婧愭暟鎹负绌�!");
+		}
+		Map<Object, Object> map = new HashMap<>(source.size());
+		source.forEach(s -> {
+			final BeanWrapper sourceBean = new BeanWrapperImpl(s);
+			Object value = sourceBean.getPropertyValue(propertyName);
+			if (value == null) {
+				throw new NullPointerException("copyListPropertiesIgnoreNull鑾峰彇鍙傛暟寮傚父");
+			}
+			map.put(value, s);
+		});
+		target.forEach(s -> {
+			final BeanWrapper targetBean = new BeanWrapperImpl(s);
+			Object value = targetBean.getPropertyValue(propertyName);
+			if (value == null) {
+				throw new NullPointerException("copyListPropertiesIgnoreNull鑾峰彇鍙傛暟寮傚父");
+			}
+			Object o = map.get(value);
+			copyPropertiesIgnoreNull(o, s);
+		});
+	}
+
 }
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java
index ed02a92..9bfc72b 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java
@@ -687,13 +687,14 @@
 		if(StringUtils.isBlank(ruleOid)){
 			return new ArrayList<>();
 		}
-		Map<String,String> conditionMap = new HashMap<>();
-		conditionMap.put("pkCodeRule",ruleOid);
+//		Map<String,String> conditionMap = new HashMap<>();
+//		conditionMap.put("pkCodeRule",ruleOid);
 //		PageHelper pageHelper = new PageHelper(-1);
 //		pageHelper.addDefaultAsc("ordernum");
 		QueryWrapper<CodeBasicSec> wrapper = new QueryWrapper<>();
+		wrapper.eq("pkCodeRule",ruleOid);
 		wrapper.orderByAsc("ordernum");
-		List<CodeBasicSec> secDOList = codeBasicSecMapper.selectList(wrapper);//.selectByCondition(conditionMap, pageHelper);
+		List<CodeBasicSec> secDOList = baseMapper.selectList(wrapper);//.selectByCondition(conditionMap, pageHelper);
 		return codeBasicSecDO2VOs(secDOList,true);
 	}
 
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
index 98d8b8e..03ef145 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -25,6 +25,7 @@
 import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeKeyAttrRepeatRuleVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
+import com.vci.ubcs.core.log.exception.ServiceException;
 import com.vci.ubcs.starter.bo.WriteExcelData;
 import com.vci.ubcs.starter.exception.VciBaseException;
 import com.vci.ubcs.starter.poi.bo.ReadExcelOption;
@@ -45,7 +46,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springblade.core.cache.utils.CacheUtil;
-import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
@@ -255,7 +255,7 @@
 		if(StringUtils.isBlank(oid)){
 			throw new ServiceException("oid涓嶈兘涓虹┖锛�");
 		}
-		return !codeClassifyMapper.checkHasChild(oid.trim());
+		return codeClassifyMapper.checkHasChild(oid.trim());
 	}
 
 
@@ -1089,14 +1089,16 @@
 		CodeClassify classifyDO = selectByOid(codeClassifyOid);
 		//鏌ヨ涓婄骇
 		fullInfo.setCurrentClassifyVO(codeClassifyDO2VO(classifyDO));
-		List<Map<String, Object>> maps = codeClassifyMapper.selectAllLevelParentByOid(codeClassifyOid);
-		List<CodeClassify> codeClassifyList = new ArrayList<>();
-		for (Map<String, Object> map : maps) {
-			CodeClassify codeClassify = new CodeClassify();
-			codeClassify.setOid(String.valueOf(map.get("OID")));
-			codeClassify.setOid(String.valueOf(map.get("LEVEL")));
-			codeClassifyList.add(codeClassify);
-		}
+//		List<Map<String, Object>> maps = codeClassifyMapper.selectAllLevelParentByOid(codeClassifyOid);
+//		List<Map<String, Object>> maps = selectAllLevelParentByOid(codeClassifyOid);
+		List<CodeClassify> codeClassifyList = selectAllLevelParentByOid(codeClassifyOid);
+//		for (Map<String, Object> map : maps) {
+//			CodeClassify codeClassify = new CodeClassify();
+//			codeClassify.setOid(String.valueOf(map.get("OID")));
+//			codeClassify.setDataLevel((Integer) map.get("LEVEL"));
+//			codeClassifyList.add(codeClassify);
+//		}
+
 		fullInfo.setParentClassifyVOs(codeClassifyDO2VOs(codeClassifyList));
 		if(!CollectionUtils.isEmpty(fullInfo.getParentClassifyVOs())){
 			fullInfo.setTopClassifyVO(fullInfo.getParentClassifyVOs().stream().filter(s->StringUtils.isBlank(s.getParentcodeclassifyoid())).findFirst().orElseGet(()->null));
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java
index d8af1a4..bfb5344 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClstemplateServiceImpl.java
@@ -648,7 +648,10 @@
 		codeClassifyTemplateDO_old.setDescription(codeClassifyDTO.getDescription());//鎻忚堪
 		codeClassifyTemplateDO_old.setCodeClassifyOid(codeClassifyOid);//鍒嗙被oid
 		codeClassifyTemplateDO_old.setOid(newOid);
-		List<CodeClassifyTemplate> codeClassifyTemplateDOList = new ArrayList<CodeClassifyTemplate>();
+		codeClassifyTemplateDO_old.setTs(new Date());
+		codeClassifyTemplateDO_old.setCreateTime(new Date());
+		codeClassifyTemplateDO_old.setLastModifyTime(new Date());
+		List<CodeClassifyTemplate> codeClassifyTemplateDOList = new ArrayList<>();
 		codeClassifyTemplateDOList.add(codeClassifyTemplateDO_old);
 
 		//澶嶅埗妯℃澘灞炴��
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 08960e7..f96f6f5 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
@@ -21,6 +21,9 @@
 import com.vci.ubcs.code.vo.pagemodel.*;
 import com.vci.ubcs.code.vo.pagemodel.UITableFieldVO;
 import com.vci.ubcs.code.vo.pagemodel.UITablePageVO;
+import com.vci.ubcs.omd.feign.IEnumClient;
+import com.vci.ubcs.omd.feign.IEnumItemClient;
+import com.vci.ubcs.omd.vo.EnumVO;
 import com.vci.ubcs.starter.exception.VciBaseException;
 import com.vci.ubcs.starter.revision.model.TreeWrapperOptions;
 import com.vci.ubcs.starter.revision.service.RevisionModelUtil;
@@ -31,12 +34,10 @@
 import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum;
 import com.vci.ubcs.starter.web.pagemodel.*;
 import com.vci.ubcs.starter.web.toolmodel.DateConverter;
-import com.vci.ubcs.starter.web.util.VciBaseUtil;
-import com.vci.ubcs.starter.web.util.VciDateUtil;
-import com.vci.ubcs.starter.web.util.VciQueryWrapperForDO;
-import com.vci.ubcs.starter.web.util.WebUtil;
+import com.vci.ubcs.starter.web.util.*;
 import com.vci.ubcs.system.entity.DictBiz;
 import com.vci.ubcs.system.feign.IDictBizClient;
+import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
 import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,10 +45,13 @@
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cglib.beans.BeanMap;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
+import java.beans.IntrospectionException;
+import java.lang.reflect.InvocationTargetException;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
@@ -84,10 +88,15 @@
 	@Resource
 	private MdmProductCodeService productCodeService;
 	/**
-	 * 瀛楀吀鐨勬湇鍔�
+	 * 鍙緭鍙�夌殑鏈嶅姟
 	 */
 	@Resource
 	IDictBizClient iDictBizClient;
+	/**
+	 * 瀛楀吀鐨勬湇鍔�
+	 */
+	@Resource
+	IEnumClient enumClient;
 	/**
 	 * 鍏紡鐨勬湇鍔�
 	 */
@@ -244,19 +253,19 @@
 	 */
 	@Override
 	public List<KeyValue> listComboboxItems(CodeClassifyTemplateAttrVO attrVO) {
-		List<KeyValue> comboboxKVs = null;
+		List<KeyValue> comboboxKVs = new ArrayList<>();
 		if (StringUtils.isNotBlank(attrVO.getEnumString())) {
 			comboboxKVs = JSONObject.parseArray(attrVO.getEnumString(), KeyValue.class);
 		} else {
 //			comboboxKVs = enumService.getEnum(attrVO.getEnumid());
 //		 	Dict dict = new Dict();
 //			dict.setParentId(Long.valueOf(attrVO.getEnumid()));
-			R<List<DictBiz>> list = iDictBizClient.getList(attrVO.getEnumId());
+			R<List<EnumVO>> list = enumClient.getList(attrVO.getEnumId());
 			if(list.isSuccess()){
-				for (DictBiz datum : list.getData()) {
+				for (EnumVO datum : list.getData()) {
 					KeyValue keyValue = new KeyValue();
-					keyValue.setKey(datum.getDictKey());
-					keyValue.setValue(datum.getDictValue());
+					keyValue.setKey(datum.getItemValue());
+					keyValue.setValue(datum.getItemName());
 					comboboxKVs.add(keyValue);
 				}
 			}
@@ -563,7 +572,9 @@
 		//娌℃湁闄愬埗鍒嗙被锛屼絾鏄竴涓ā鏉垮彧鍙兘鍦ㄤ竴涓笟鍔$被鍨嬮噷闈紝鎵�浠ョ洿鎺ユ煡璇㈣繖涓笟鍔$被鍨嬪嵆鍙�
 
 		if (!CollectionUtils.isEmpty(conditionMap)) {
-			final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
+			//琛ㄩ渶瑕佹敼
+//			final String[] sql = {"select count(*) from " + VciBaseUtil.getTableName(classifyFullInfo.getTopClassifyVO().getBtmtypeid()) + " t where 1 = 1 "};
+			final String[] sql = {"select count(*) from pl_code_wupin t where 1 = 1 "};
 			conditionMap.forEach((key, value) -> {
 				sql[0] += " and " + key + " = " + value;
 			});
@@ -700,7 +711,7 @@
 	 */
 	private void copyValueToCBO(CodeClassifyFullInfoBO classifyFullInfo, CodeWupin cbo,
 								CodeOrderDTO orderDTO, CodeClassifyTemplateVO templateVO,
-								boolean edit) {
+								boolean edit)  {
 		String fullPath = "";
 		if (!CollectionUtils.isEmpty(classifyFullInfo.getParentClassifyVOs())) {
 			fullPath = classifyFullInfo.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel())))
@@ -710,8 +721,8 @@
 		}
 
 //		BeanUtils.
-		BeanUtils.copyProperties(orderDTO.getData(),cbo);
-		cbo.setMaterialtype(Short.valueOf("1001"));
+//		BeanUtils.copyProperties(orderDTO.getData(),cbo);
+//		cbo.setMaterialtype(Short.valueOf("1001"));
 //		orderDTO.getData().forEach((key, value) -> {
 //			if (!edit || (!checkUnAttrUnEdit(key) &&
 //				!VciQueryWrapperForDO.LC_STATUS_FIELD.equalsIgnoreCase(key))) {
@@ -722,18 +733,19 @@
 //				}
 //			}
 //		});
+//		BeanMap beanMap = BeanMap.create(cbo);
+//		beanMap.putAll(orderDTO.getData());
+
 		try {
+
+			BeanUtilForVCI.copyPropertiesIgnoreNull(BeanUtilForVCI.convertMap(CodeWupin.class,orderDTO.getData()),cbo);
 
 			cbo.setCodeclsfid(classifyFullInfo.getCurrentClassifyVO().getOid());
 			cbo.setCodetemplateoid(templateVO.getOid());
 			cbo.setCodeclsfpath(fullPath);
-//			cbo.setMaterialclassify("model_type");
-//			cbo.setMaterialname(orderDTO.getData().get("materialname"));
-//			cbo.setShifoupihaoguanli("true");
-//			cbo.setKucunwl("true");
-//			cbo.setXiaoshouwl("false");
+			cbo.setTs(new Date());
 			if (!edit && StringUtils.isBlank(orderDTO.getLcStatus())) {
-				//鎵剧敓鍛藉懆鏈熺殑璧峰鐘舵�侊紝鎻掍釜鐐癸紝鐪嬬敓鍛藉懆鏈熸槸鍚﹂渶瑕佸垱寤�
+				//鎵剧敓鍛藉懆鏈熺殑璧峰鐘舵�侊紝鎻掍釜鐐癸紝鐢熷懡鍛ㄦ湡鏄惁闇�瑕佸垱寤�
 				if (StringUtils.isNotBlank(cbo.getLctid())) {
 //					OsLifeCycleVO lifeCycleVO = lifeCycleService.getLifeCycleById(cbo.getLctid());
 //					if (lifeCycleVO != null) {
@@ -748,7 +760,7 @@
 
 			}
 
-			int secret = VciBaseUtil.getInt(cbo.getSecretGrade().toString());
+			int secret = VciBaseUtil.getInt(String.valueOf(cbo.getSecretGrade()));
 			//鎻掍釜鐐癸紝鍚庣画鐪嬪瘑绾ф湇鍔℃槸鍚﹀彲鐢�
 //			if (secret == 0 || !secretService.checkDataSecret(secret)) {
 			if (secret == 0 ) {
@@ -789,13 +801,13 @@
 //		}
 //		ClientBusinessObject cbo = cloneClientBusinessObject(hasCreatedCbos.get(btmName));
 
-		QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>();
-		btmWrapper.eq("ID",btmName);
-		CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper);
+//		QueryWrapper<CodeOsbtmtypeEntity> btmWrapper = new QueryWrapper<>();
+//		btmWrapper.eq("ID",btmName);
+//		CodeOsbtmtypeEntity btmTypeVO = codeOsbtmtypeMapper.selectOne(btmWrapper);
 //		OsBtmTypeVO btmTypeVO = btmService.getBtmById(boName);
 		String userName = AuthUtil.getUser().getUserName();
 		CodeWupin wupinEntity = new CodeWupin();
-		wupinEntity.setOid(null);
+		wupinEntity.setOid(VciBaseUtil.getPk());
 //		bo.setRevisionid((new ObjectUtility()).getNewObjectID36());
 //		bo.setNameoid((new ObjectUtility()).getNewObjectID36());
 		wupinEntity.setBtmname(btmName);
@@ -807,13 +819,13 @@
 		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
+		wupinEntity.setRevisionRule("numberversionrule");
+		wupinEntity.setVersionRule("0");
+//		if(StringUtils.isNotBlank(btmTypeVO.getRevisionruleid())){
+			//
 //			OsRevisionRuleVO revisionRuleVO = revisionRuleService.getRevisionRuleById(btmTypeVO.getRevisionruleid());
-			wupinEntity.setRevisionValue("1");
-		}
+		wupinEntity.setRevisionValue("1");
+//		}
 
 		wupinEntity.setRevisionSeq(1);
 		wupinEntity.setVersionSeq(1);
@@ -827,7 +839,7 @@
 		wupinEntity.setOwner(userName);
 		wupinEntity.setCheckinby(userName);
 		wupinEntity.setCopyFromVersion("");
-		wupinEntity.setMaterialtype((short) 1001);
+		wupinEntity.setMaterialtype(1001);
 		wupinEntity.setCaigouwl("true");
 		wupinEntity.setShifoupihaoguanli("true");
 		wupinEntity.setKucunwl("true");
@@ -1341,7 +1353,7 @@
 			maps.stream().forEach(map -> {
 				Map<String, String> data = new HashMap<>();
 				map.forEach((key, value) -> {
-					data.put(((String) key).toLowerCase(Locale.ROOT), (String) value);
+					data.put(((String) key).toLowerCase(Locale.ROOT), String.valueOf(value));
 				});
 				dataList.add(data);
 			});
@@ -1514,8 +1526,9 @@
 					referVO.setValueField(VciQueryWrapperForDO.OID_FIELD);
 					referVO.setTextField("name");
 				}
-
-				String referTable = VciBaseUtil.getTableName(referVO.getReferType());
+				//琛ㄩ渶瑕佹敼
+//				String referTable = VciBaseUtil.getTableName(referVO.getReferType());
+				String referTable = "pl_code_wupin";
 				String referTableNick = attrVO.getId() + "0";
 				String left = " left join " + referTable + " " + referTableNick + " on " + referTableNick + "." + referVO.getValueField() + " =  t." + attrVO.getId();
 				joinTableList.put(attrVO.getId(), left);
@@ -1603,7 +1616,9 @@
 			}
 			whereSql += " and ( t.secretGrade <= " + userSecret + ") ";
 		}
-		String tableName = VciBaseUtil.getTableName(btmType);
+		//瑕佹敼锛岃〃鏄庤幏鍙栨湁闂
+//		String tableName = VciBaseUtil.getTableName(btmType);
+		String tableName = "pl_code_wupin";
 		String sql = "select " + selectFieldList.stream().map(s -> (s.contains(".") ? s : ("t." + s))).collect(Collectors.joining(","))
 			+ " from " + tableName + SPACE + "t" + SPACE
 			+ joinTableList.values().stream().collect(Collectors.joining(SPACE))
@@ -2049,12 +2064,13 @@
 		if (!classifyService.checkHasChild(codeClassifyOid)) {
 			conditionMap.put(CODE_CLASSIFY_OID_FIELD, codeClassifyOid);
 		} else {
-			conditionMap.put(CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY)
-				+ " where lcstatus='" + FrameWorkDefaultValueConstant.FRAMEWORK_DATA_ENABLED +
+			//琛ㄩ渶瑕佹敼
+//			conditionMap.put(CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY)
+			conditionMap.put(CODE_CLASSIFY_OID_FIELD, QueryOptionConstant.IN + "(select oid from pl_code_wupin where lcstatus='" + FrameWorkDefaultValueConstant.FRAMEWORK_DATA_ENABLED +
 				"' start with parentCodeClassifyOid = '" + codeClassifyOid + "' CONNECT BY PRIOR OID = parentCodeClassifyOid )");
 		}
-		conditionMap.put("islastr", "1");
-		conditionMap.put("islastv", "1");
+		conditionMap.put("lastr", "1");
+		conditionMap.put("lastv", "1");
 		return queryGrid(btmTypeId, templateVO, conditionMap, pageHelper);
 //        List<String> selectFieldList = templateVO.getAttributes().stream().map(CodeClassifyTemplateAttrVO::getId).collect(Collectors.toList());
 //        //鍙傜収璁╁钩鍙扮洿鎺ユ煡璇㈠氨琛�
@@ -2437,7 +2453,7 @@
 			executionId = executionId.substring(0, executionId.lastIndexOf("."));
 		}
 		String sql = "select wm_concat(distinct (t.codetempattrOidArr)) codetempattroidarr\n" +
-			"from " + VciBaseUtil.getTableName(MdmBtmTypeConstant.CODE_CLASSIFY_PROCESS_TEMPLATE) + " t\n" +
+			"from pl_code_wupin t\n" +
 			"join PLFLOWINSTANCE plfi on t.ID = plfi.PLTEMPLATEPUID\n" +
 			"where plfi.PLEXECUTIONID = '" + executionId + "' and t.CLASSIFYTEMPLATEOID = '" + templateOid + "' and t.CODEPROCESSUSE = '" + processUse + "'";
 //		List<ClientBusinessObject> tempAttrOidArr = boService.queryByOnlySql(sql);
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java
index 396b6f0..6a785bc 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java
@@ -20,6 +20,7 @@
 import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
 import com.vci.ubcs.starter.exception.VciBaseException;
+import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil;
 import com.vci.ubcs.starter.web.constant.QueryOptionConstant;
 import com.vci.ubcs.starter.web.constant.RegExpConstant;
 import com.vci.ubcs.starter.web.enumpck.OsCodeFillTypeEnum;
@@ -304,6 +305,9 @@
 				s.setLcStatus(statusMap.get(s.getOid()));
 
 			});
+			allCodeDOList.stream().forEach(
+				allCode -> {DefaultAttrAssimtUtil.addDefaultAttrAssimt(allCode,"codeallcode");allCode.setLctid("codeAllCodeLC");}
+			);
 			codeAllCodeService.saveBatch(allCodeDOList);
 			iCodeWupinService.saveBatch(dataCBOList);
 //			batchCBO.getCreateCbos().stream().filter(s -> StringUtils.equalsIgnoreCase("codeallcode",s.getBtmName())).forEach(s -> {
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml
index 44b7b0c..b054ef5 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml
@@ -52,9 +52,9 @@
     </select>
 
     <select id="checkHasChild" resultType="java.lang.Boolean">
-        select count(oid)
+        <![CDATA[select count(oid)
         from PL_CODE_CLASSIFY
-        where parentCodeClassifyOid = #{oid}
+        where parentCodeClassifyOid = #{oid}]]>
     </select>
 
     <select id="selectCodeClassifyVOByTree" resultMap="plCodeClassifyResultMap">
@@ -141,7 +141,8 @@
     </select>
 
     <select id="selectAllLevelParentByOid" resultType="java.util.HashMap">
-        select oid,level from pl_code_classify start with oid= #{oid} connect by prior PARENTCODECLASSIFYOID = oid
+        select oid,
+               level from pl_code_classify start with oid= #{oid} connect by prior PARENTCODECLASSIFYOID = oid
     </select>
 
     <select id="selectByFieldNamePath"  resultMap="plCodeClassifyResultMap">
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodePhaseAttrMapper.xml b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodePhaseAttrMapper.xml
index b23f6e2..09e3ded 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodePhaseAttrMapper.xml
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodePhaseAttrMapper.xml
@@ -80,31 +80,27 @@
                description,
                oid,
                versionseq,
-               checkinby,
                revisionrule,
                lctid,
                id,
                owner,
-               checkoutby,
                creator,
                createtime,
-               isfirstv,
+               firstv,
                attributegroup,
                revisionoid,
                btmname,
-               checkouttime,
                revisionvalue,
                versionrule,
                name,
-               islastr,
+               lastr,
                lastmodifytime,
                copyfromversion,
                nameoid,
                lcstatus,
-               islastv,
-               checkintime,
+               lastv,
                codephaseoid,
-               isfirstr
+               firstr
         from PL_CODE_PHASEATTR
         where codephaseoid in
               (#{oids})

--
Gitblit v1.9.3