From 8381325223bee254168855b1b697db31fc591b9e Mon Sep 17 00:00:00 2001 From: ludc Date: 星期二, 19 九月 2023 09:28:42 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java | 83 +++++++++++++++++++++++++++++++++++++---- 1 files changed, 74 insertions(+), 9 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 6a3d868..0a3fb50 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 @@ -16,6 +16,7 @@ import com.vci.ubcs.code.enumpack.*; import com.vci.ubcs.code.mapper.CommonsMapper; import com.vci.ubcs.code.service.*; +import com.vci.ubcs.code.util.ClientBusinessObject; import com.vci.ubcs.code.vo.CodeKeyAttrRepeatVO; import com.vci.ubcs.code.vo.CodeReferConfigVO; import com.vci.ubcs.code.vo.pagemodel.UITableFieldVO; @@ -56,6 +57,7 @@ import com.vci.ubcs.system.user.feign.IUserClient; import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils; import oracle.sql.TIMESTAMP; +import org.aspectj.apache.bcel.classfile.Code; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springblade.core.cache.utils.CacheUtil; @@ -466,7 +468,7 @@ if (!CodeLevelTypeEnum.MIN.getValue().equalsIgnoreCase(attrVO.getClassifyInvokeLevel()) && !"min".equalsIgnoreCase(attrVO.getClassifyInvokeLevel())) { //鎸囧畾浜嗗眰绾х殑 //娉ㄦ剰锛屽洜涓烘煡璇笂绾у垎绫诲嚭鏉ョ殑灞傜骇鏄�掑簭鐨勶紝鍗抽《灞傝妭鐐规槸鏈�澶х殑鍊� - List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList()); + List<CodeClassifyVO> classifyVOS = classifyFullInfoBO.getParentClassifyVOs().stream().sorted(((o1, o2) -> -o2.getDataLevel().compareTo(o1.getDataLevel()))).collect(Collectors.toList()); int level = VciBaseUtil.getInt(attrVO.getClassifyInvokeLevel()); if (classifyVOS.size() >= level && level > 0) { classifyVO = classifyVOS.get(level - 1); @@ -753,7 +755,7 @@ */ @Override public R checkGroupCode(Map<String, String> parameter) { - List<CodeClassify> codeClassifyList = classifyService.selectAllLevelParents(parameter.get("oid")); + List<CodeClassify> codeClassifyList = classifyService.selectAllLevelParentByOid(parameter.get("oid")); Set<String> configGroupCode = Arrays.stream(parameter.get("classifyGroupCode").split("#")).collect(Collectors.toSet()); // Boolean checkGroupFlag = false;//鏄惁鏌ヨ鍒伴厤缃殑椤跺眰鍒嗙被涓� for (int i = codeClassifyList.size()-1; i >= 0; i--) { @@ -1387,6 +1389,9 @@ uiTableConfigVO.setQueryColumns(queryColumns); //set缁欒〃鏍奸厤缃睘鎬� uiFormReferVO.setTableConfig(uiTableConfigVO); + //瀛楁鍚嶄笉涓�鑷达紝闇�瑕佹墜鍔╯et + uiFormReferVO.setMuti(Func.toBoolean(codeReferConfig.getIsMuti())); + uiFormReferVO.setInitSort(new UIFieldSortVO(codeReferConfig.getSortField(),codeReferConfig.getSortType())); // 绛涢�夋潯浠� HashMap<String, String> whereMap = new HashMap<>(); if(!CollectionUtils.isEmpty(codeReferConfig.getCodeSrchCondConfigVOS())){ @@ -2800,7 +2805,7 @@ // 鏃ユ湡鐮佹璁剧疆榛樿鍊� if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) { try { - secVO.setCodeDateFormatStr(Func.format(new Date(),secVO.getCodeDateFormatStr())); + secVO.setCodeDateValue(Func.format(new Date(),secVO.getCodeDateFormatStr())); }catch (Exception e){ throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細"+e.getMessage()); } @@ -2818,7 +2823,7 @@ // 鏃ユ湡鐮佹璁剧疆榛樿鍊� if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) { try { - secVO.setCodeDateFormatStr(Func.format(new Date(),secVO.getCodeDateFormatStr())); + secVO.setCodeDateValue(Func.format(new Date(),secVO.getCodeDateFormatStr())); }catch (Exception e){ throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細"+e.getMessage()); } @@ -2840,7 +2845,7 @@ // 鏃ユ湡鐮佹璁剧疆榛樿鍊� if (secVO.getSecType().equals(CodeSecTypeEnum.CODE_DATE_SEC.getValue())) { try { - secVO.setCodeDateFormatStr(Func.format(new Date(),secVO.getCodeDateFormatStr())); + secVO.setCodeDateValue(Func.format(new Date(),secVO.getCodeDateFormatStr())); }catch (Exception e){ throw new ServiceException("鏃ユ湡鐮佹鏃ユ湡鏍煎紡閰嶇疆鏈夎锛屽鑷磋浆鎹㈠嚭閿欙細"+e.getMessage()); } @@ -2867,7 +2872,7 @@ } else { if (CollectionUtils.isEmpty(fullInfoBO.getParentClassifyVOs())) { //璇存槑宸茬粡鏄渶楂樺眰绾�, - throw new VciBaseException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�"); + throw new ServiceException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�"); } List<CodeClassifyVO> parentClassifyVOList = fullInfoBO.getParentClassifyVOs().stream().sorted((o1, o2) -> o1.getDataLevel().compareTo(o2.getDataLevel())).collect(Collectors.toList()); //浠庢渶楂樼殑level寮�濮嬭幏鍙� @@ -2879,7 +2884,7 @@ } } if (StringUtils.isBlank(codeRuleOid)) { - throw new VciBaseException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�"); + throw new ServiceException("褰撳墠涓婚搴撳垎绫伙紝浠ュ強瀹冪殑鎵�鏈夌殑涓婄骇鍒嗙被閮芥病鏈夎缃紪鐮佽鍒�"); } } return ruleService.getObjectHasSecByOid(codeRuleOid); @@ -3684,8 +3689,67 @@ return R.success("鏇存柊鎴愬姛锛�"); } + /** + * 鏇存柊涓氬姟鏁版嵁鍚屾椂瀵圭爜鍊艰〃鏁版嵁鎿嶄綔鎺ュ彛 + * + * @param btmType 涓氬姟绫诲瀷 + * @param baseModels 澶勭悊鏁版嵁 + * @return 澶勭悊鐘舵�� + */ + @Transactional(rollbackFor = VciBaseException.class) + @Override + public R<Integer> updateBatchBtypeDatas(String btmType, List<BaseModel> baseModels) { - /** + //浣跨敤浼犲叆鐨勪笟鍔$被鍨嬫煡璇㈣〃 + R<List<BtmTypeVO>> listR = btmTypeClient.selectByIdCollection(Collections.singletonList(btmType)); + if (!listR.isSuccess() || listR.getData().size() == 0) { + throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒"); + } + //鑾峰彇褰撳墠涓氬姟绫诲瀷鎵�鏈夊瓧娈电敤鏉ュ仛瀵规瘮 + R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(btmType); + if (!allAttributeByBtmId.isSuccess() || allAttributeByBtmId.getData().getAttributes().size() == 0) { + throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲瀛楁淇℃伅锛岃妫�鏌ワ紒"); + } + Set<String> existFild = allAttributeByBtmId.getData().getAttributes().stream().map(btmTypeAttributeVO -> { + return btmTypeAttributeVO.getId(); + }).collect(Collectors.toSet()); + if(!CollectionUtils.isEmpty(baseModels)){ + List<String> oidList=baseModels.stream().filter(data-> com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(data.getOid())).map(BaseModel::getOid).distinct().collect(Collectors.toList()); + LambdaQueryWrapper<CodeAllCode> lqw = new LambdaQueryWrapper<>(); + lqw.in(CodeAllCode::getCreateCodeOid,oidList); + List<CodeAllCode> codeAllCodeList= codeAllCodeService.selectByWrapper(lqw); + Map<String, CodeAllCode> cboMap = codeAllCodeList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getCreateCodeOid(), t -> t)); + List<CodeAllCode> newCodeAllCodeList=new ArrayList<>(); + //灏哹ean杞负map,mybatis缁熶竴澶勭悊 + List<Map<String, String>> maps = new ArrayList<>(); + try { + baseModels.stream().forEach(baseModel->{ + String oid=baseModel.getOid(); + try { + maps.add(VciBaseUtil.convertBean2Map(baseModel,existFild)); + } catch (Exception e) { + throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage()); + } + if(cboMap.containsKey(oid)){ + CodeAllCode codeAllCode= cboMap.get(oid); + codeAllCode.setId(baseModel.getId()); + codeAllCode.setLastModifier(AuthUtil.getUser().getUserName()); + codeAllCode.setLastModifyTime(new Date()); + codeAllCode.setLcStatus(baseModel.getLcStatus()); + newCodeAllCodeList.add(codeAllCode); + } + }); + commonsMapper.updateBatchByBaseModel(listR.getData().get(0).getTableName(), maps); + codeAllCodeService.saveOrUpdateBatch(newCodeAllCodeList); + } catch (Exception e) { + throw new VciBaseException("绫诲瀷杞崲閿欒锛�" + e.getMessage()); + } + + } + return R.success("鏇存柊鎴愬姛锛�"); + } + + /** * 鑾峰彇鍙傜収鐨勪俊鎭� * * @param referConfigVO 鍙傜収鐨勯厤缃� @@ -3697,7 +3761,7 @@ //浣跨敤涓氬姟绫诲瀷鏌ヨ R<BtmTypeVO> allAttributeByBtmId = btmTypeClient.getAllAttributeByBtmId(referConfigVO.getReferType()); if (!allAttributeByBtmId.isSuccess()) { - throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒锛�"); + throw new ServiceException("涓氬姟绫诲瀷feign鎺ュ彛璋冪敤閿欒;"+allAttributeByBtmId.getMsg()); } if (Func.isEmpty(allAttributeByBtmId.getData())) { throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒"); @@ -3724,6 +3788,7 @@ if (listR.getData().isEmpty()) { throw new VciBaseException("浼犲叆涓氬姟绫诲瀷鏈煡璇㈠埌鐩稿簲琛ㄥ崟锛岃妫�鏌ワ紒"); } + // TODO:鍙傜収閰嶇疆鐨勬ā绯婃煡璇㈣繃婊ゆ潯浠舵殏鏈鐞� String namesql = ""; if (StringUtils.isNotBlank(baseQueryObject.getConditionMap().get("name"))) { String s = baseQueryObject.getConditionMap().get("name"); -- Gitblit v1.9.3