From f6e7d70e650536e7cafa0da24922b2dda1902f06 Mon Sep 17 00:00:00 2001
From: lihang <lihang@vci-tech.com>
Date: 星期五, 26 五月 2023 18:18:47 +0800
Subject: [PATCH] 元数据页面调整完善

---
 Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/AttributeWrapper.java |   38 ++++++++++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/AttributeWrapper.java b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/AttributeWrapper.java
index d279695..837353b 100644
--- a/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/AttributeWrapper.java
+++ b/Source/UBCS/ubcs-service/ubcs-omd/src/main/java/com/vci/ubcs/omd/wrapper/AttributeWrapper.java
@@ -1,12 +1,18 @@
 package com.vci.ubcs.omd.wrapper;
 
+import com.vci.ubcs.omd.cache.EnumCache;
+import com.vci.ubcs.omd.constant.BtmTypeConstant;
+import com.vci.ubcs.omd.dto.AttributeDTO;
 import com.vci.ubcs.omd.entity.Attribute;
 import com.vci.ubcs.omd.vo.*;
+import com.vci.ubcs.starter.web.util.VciBaseUtil;
 import com.vci.ubcs.system.cache.DictBizCache;
 import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.StringUtil;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -32,12 +38,13 @@
 	@Override
 	public AttributeVO entityVO(Attribute entity) {
 		AttributeVO vo = Objects.requireNonNull(BeanUtil.copy(entity, AttributeVO.class));
-		vo.setTypeValue(DictBizCache.getValue(vo.getTypeCode(),vo.getTypeKey()));
+		vo.setTypeValue(EnumCache.getValue(vo.getTypeCode(),vo.getTypeKey()));
 		if (StringUtil.isNotBlank(vo.getReferTypeCode())){
-			vo.setReferTypeValue(DictBizCache.getValue(vo.getReferTypeCode(),vo.getReferTypeKey()));
+			vo.setReferTypeValue(EnumCache.getValue(vo.getReferTypeCode(),vo.getReferTypeKey()));
 		}
-		vo.setDictValue(vo.getDictKey());
-		vo.setTypeValue(vo.getTypeKey());
+		if (StringUtil.isNotBlank(vo.getDictCode())) {
+			vo.setDictValue(EnumCache.getValue(vo.getDictCode(),vo.getDictKey()));
+		}
 		return vo;
 	}
 
@@ -49,4 +56,27 @@
 	public List<AttributeVO> listEntityVO(List<Attribute> list) {
 		return list.stream().map(this::entityVO).collect(Collectors.toList());
 	}
+
+	/**
+	 * 鍦ㄤ繚瀛樹箣鍓嶈璁剧疆榛樿灞炴��
+	 * @param dto
+	 * @return
+	 */
+    public Attribute copyBeforeSave(AttributeDTO dto) {
+		Attribute attribute = BeanUtil.copy(dto, Attribute.class);
+		Objects.requireNonNull(attribute);
+		String currentUser = AuthUtil.getUserAccount();
+		Date now = new Date();
+		if (StringUtil.isBlank(dto.getOid())) {
+			attribute.setBtmName(BtmTypeConstant.ATTRIBUTE);
+			attribute.setCreator(currentUser);
+			attribute.setCreateTime(now);
+			attribute.setOwner(currentUser);
+			attribute.setOid(VciBaseUtil.getPk());
+		}
+		attribute.setLastModifier(currentUser);
+		attribute.setLastModifyTime(now);
+		attribute.setTs(now);
+		return attribute;
+	}
 }

--
Gitblit v1.9.3