From e9b405657b6117a8dcfcf8505cfd5d6eccd39cc8 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 30 五月 2023 18:32:57 +0800
Subject: [PATCH] code服务中部分do转vo时显示值转换改为缓存中拿值

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java |   57 +++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 49 insertions(+), 8 deletions(-)

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 9bfc72b..fd0dfdc 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
@@ -16,10 +16,8 @@
 import com.vci.ubcs.code.mapper.CodeBasicSecMapper;
 import com.vci.ubcs.code.mapper.CodeClassifyValueMapper;
 import com.vci.ubcs.code.mapper.CodeFixedValueMapper;
-import com.vci.ubcs.code.service.ICodeBasicSecService;
-import com.vci.ubcs.code.service.ICodeClassifyValueService;
-import com.vci.ubcs.code.service.ICodeFixedValueService;
-import com.vci.ubcs.code.service.ICodeRuleService;
+import com.vci.ubcs.code.service.*;
+import com.vci.ubcs.code.vo.CodeReferConfigVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeFixedValueVO;
 import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO;
@@ -83,6 +81,9 @@
 
 	@Resource
 	private ICodeClassifyValueService codeClassifyValueService;
+
+	@Resource
+	private ICodeReferConfigService codeReferConfigService;
 
 	@Resource
 	private IDictBizClient iDictBizClient;
@@ -237,15 +238,22 @@
 			&& StringUtils.isBlank(codeBasicSecDO.getCodeFillSeparator())){
 			throw new VciBaseException("褰撹ˉ浣嶆柟寮忎负宸﹁ˉ浣嶆垨鑰呭彸琛ヤ綅鐨勬椂鍊欙紝琛ヤ綅瀛楃涓嶈兘涓虹┖");
 		}
+		CodeReferConfigVO codeReferConfigVO = null;
 		//寮曠敤鐮佹鐨勬椂鍊欙紝闇�瑕佸垽鏂弬鐓х殑淇℃伅鏄惁姝g‘
 		if(CodeSecTypeEnum.CODE_REFER_SEC.getValue().equalsIgnoreCase(codeBasicSecDO.getSecType())){
 			if(StringUtils.isBlank(codeBasicSecDO.getReferConfig())){
 				throw new VciBaseException("寮曠敤鐮佹鐨勬椂鍊欙紝闇�瑕佸~鍐� 鍙傜収閰嶇疆 鐨勫唴瀹�");
 			}
 			try{
-				JSONObject.parseObject(codeBasicSecDO.getReferConfig(), UIFormReferVO.class);
+				//JSONObject.parseObject(codeBasicSecDO.getReferConfig(), UIFormReferVO.class);
+				codeReferConfigVO = JSONObject.parseObject(codeBasicSecDO.getReferConfig(), CodeReferConfigVO.class);
+				// 灏嗗弬鐓ч厤缃繘琛屾寔涔呭寲锛岀粰鐢ㄦ埛鎻愪緵鍙彲閫夋嫨鍙傜収閰嶇疆鐨勬柟寮�
+
 			}catch (Throwable e){
 				throw new VciBaseException("寮曠敤鐮佹鐨勬椂鍊欙紝鍙傜収閰嶇疆鐨勫唴瀹圭殑鏍煎紡涓嶆纭�,",new String[0],e);
+			}
+			if(codeReferConfigVO.getIsPersistence()=="true"){
+				codeReferConfigService.insert(codeReferConfigVO);
 			}
 		}
 		boolean resBoolean = codeBasicSecMapper.insert(codeBasicSecDO) > 0;
@@ -731,6 +739,27 @@
 	}
 
 	/**
+	 * 鎵归噺鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
+	 *
+	 * @param codeBasicSecDOs 鏁版嵁瀵硅薄鍒楄〃
+	 * @return 鏄剧ず瀵硅薄
+	 * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呬笉瀛樺湪鐨勬椂鍊欎細鎶涘嚭寮傚父
+	 */
+	@Override
+	public List<CodeBasicSecVO> codeBasicSecDO2VOs(Collection<CodeBasicSec> codeBasicSecDOs) throws VciBaseException {
+		List<CodeBasicSecVO> voList = new ArrayList<CodeBasicSecVO>();
+		if (!CollectionUtils.isEmpty(codeBasicSecDOs)) {
+			for (CodeBasicSec s : codeBasicSecDOs) {
+				CodeBasicSecVO vo = codeBasicSecDO2VO(s);
+				if (vo != null) {
+					voList.add(vo);
+				}
+			}
+		}
+		return voList;
+	}
+
+	/**
 	 * 鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
 	 *
 	 * @param codeBasicSecDO 鏁版嵁瀵硅薄
@@ -739,14 +768,26 @@
 	 */
 	@Override
 	public CodeBasicSecVO codeBasicSecDO2VO(CodeBasicSec codeBasicSecDO) throws VciBaseException {
-		CodeBasicSecVO vo = new CodeBasicSecVO();
+		CodeBasicSecVO codeBasicSecVO = new CodeBasicSecVO();
 		if (codeBasicSecDO != null) {
-			BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDO, vo);
+			BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecVO, codeBasicSecVO);
+			codeBasicSecVO.setSecTypeText(CodeSecTypeEnum.getTextByValue(codeBasicSecVO.getSecType()));
+			codeBasicSecVO.setCodeLevelTypeText(CodeLevelTypeEnum.getTextByValue(codeBasicSecVO.getCodeLevelType()));
+			codeBasicSecVO.setCodeSecLengthTypeText(CodeSecLengthTypeEnum.getTextByValue(codeBasicSecVO.getCodeSecLengthType()));
+			codeBasicSecVO.setValueCutTypeText(CodeCutTypeEnum.getValueByText(codeBasicSecVO.getValueCutType()));
+			codeBasicSecVO.setCodeGetValueTypeText(CodeGetValueTypeEnum.getValueByText(codeBasicSecVO.getCodeGetValueType()));
+			// 濡傛灉鏄垎绫荤爜娈甸渶瑕佹煡璇㈡墍灞炲垎绫荤殑涓枃鍚嶇О
+			if(codeBasicSecDO.getSecType().equals("codeclassifysec") && Func.isNotEmpty(codeBasicSecDO.getParentClassifySecOid())){
+				CodeBasicSec codeBasicSec = codeBasicSecMapper.selectOne(Wrappers.<CodeBasicSec>query().lambda()
+					.eq(CodeBasicSec::getOid, codeBasicSecDO.getParentClassifySecOid())
+					.eq(CodeBasicSec::getSecType, codeBasicSecDO.getSecType()));
+				codeBasicSecVO.setParentClassifySecText(codeBasicSec.getName());
+			}
 			//濡傛灉鏈塴cstatus鐨勭被鐨勮瘽
 			if (true) {
 				//vo.setLcStatusText({lcStatusFullClassName}.getTextByValue(vo.getLcStatus()));
 			}
 		}
-		return vo;
+		return codeBasicSecVO;
 	}
 }

--
Gitblit v1.9.3