From b47493e37a857208c47d1421edcad81260c734ce Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期五, 02 六月 2023 17:29:05 +0800
Subject: [PATCH] 修改树参照的懒加载
---
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeBasicSecServiceImpl.java | 77 ++++++++++++++++++++++++++++----------
1 files changed, 56 insertions(+), 21 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 fef2e76..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,16 +16,15 @@
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;
import com.vci.ubcs.code.wrapper.CodeBasicSecWrapper;
import com.vci.ubcs.starter.exception.VciBaseException;
import com.vci.ubcs.starter.revision.service.RevisionModelUtil;
+import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil;
import com.vci.ubcs.starter.web.enumpck.OsCodeFillTypeEnum;
import com.vci.ubcs.starter.web.pagemodel.KeyValue;
import com.vci.ubcs.starter.web.pagemodel.UIFormReferVO;
@@ -82,6 +81,9 @@
@Resource
private ICodeClassifyValueService codeClassifyValueService;
+
+ @Resource
+ private ICodeReferConfigService codeReferConfigService;
@Resource
private IDictBizClient iDictBizClient;
@@ -210,7 +212,6 @@
if (! "success".equals(attrKv.getKey())){
throw new VciBaseException(attrKv.getValue() + "涓嶈兘涓虹┖");
}
-
//灏咲TO杞崲涓篋O
CodeBasicSec codeBasicSecDO = new CodeBasicSec();
BeanUtilForVCI.copyPropertiesIgnoreCase(codeBasicSecDTO, codeBasicSecDO);
@@ -221,15 +222,7 @@
codeBasicSecDO.setValueCutTypeText(CodeCutTypeEnum.getValueByText(codeBasicSecDTO.getValueCutType()));
codeBasicSecDO.setCodeGetValueTypeText(CodeGetValueTypeEnum.getValueByText(codeBasicSecDTO.getCodeGetValueType()));
//濉厖涓�浜涢粯璁ゅ��
- codeBasicSecDO.setOid(VciBaseUtil.getPk());
- codeBasicSecDO.setRevisionOid(VciBaseUtil.getPk());
- codeBasicSecDO.setNameOid(VciBaseUtil.getPk());
- codeBasicSecDO.setBtmname(MdmBtmTypeConstant.CODE_BASIC_SEC);
- codeBasicSecDO.setTs(new Date());
- codeBasicSecDO.setCreateTime(new Date());
- codeBasicSecDO.setCreator(AuthUtil.getUserId().toString());
- codeBasicSecDO.setLastModifier(AuthUtil.getUserId().toString());
- codeBasicSecDO.setLastModifyTime(new Date());
+ DefaultAttrAssimtUtil.addDefaultAttrAssimt(codeBasicSecDO,MdmBtmTypeConstant.CODE_BASIC_SEC);
//鎺掑簭鍙凤紝榛樿绛変簬褰撳墠宸叉湁鐨勬暟閲忓姞1
Long total = codeBasicSecMapper.selectCount(Wrappers.<CodeBasicSec>query()
.lambda()
@@ -245,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;
@@ -287,6 +287,7 @@
}
//灏咲TO杞崲涓篋O
CodeBasicSec codeBasicSecDO = selectByOid(codeBasicSecDTO.getOid());
+ DefaultAttrAssimtUtil.updateDefaultAttrAssimt(codeBasicSecDO);
boolean status = codeRuleService.checkEditDelStatus(codeRuleService.getObjectByOid(codeBasicSecDO.getPkCodeRule()).getLcStatus());
boolean resBoolean;
if (!status){
@@ -694,13 +695,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);
}
@@ -737,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 鏁版嵁瀵硅薄
@@ -745,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