From 4ab5b59853ced6334450d359a3dee629afc2212c Mon Sep 17 00:00:00 2001 From: ludc Date: 星期二, 16 四月 2024 20:14:56 +0800 Subject: [PATCH] 集团属性池映射界面代码完善 --- Source/UBCS/ubcs-service-api/ubcs-applyjtcodeservice-api/src/main/java/com/vci/ubcs/code/applyjtcodeservice/entity/DockingPreMetaAttr.java | 2 Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/impl/DockingPreAttrMappingServiceImpl.java | 46 ++++++++++++--- Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/IDockingPreAttrMappingService.java | 5 + Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java | 5 + Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/IGroupAttrPoolMappingService.java | 16 +++-- Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/wrapper/GroupAttrPoolMappingWrapper.java | 6 - Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/impl/GroupAttrPoolMappingServiceImpl.java | 54 +++++++++++++----- Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/controller/GroupAttrPoolMappingController.java | 31 +++++----- Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/MdmBtmTypeConstant.java | 6 ++ 9 files changed, 115 insertions(+), 56 deletions(-) diff --git a/Source/UBCS/ubcs-service-api/ubcs-applyjtcodeservice-api/src/main/java/com/vci/ubcs/code/applyjtcodeservice/entity/DockingPreMetaAttr.java b/Source/UBCS/ubcs-service-api/ubcs-applyjtcodeservice-api/src/main/java/com/vci/ubcs/code/applyjtcodeservice/entity/DockingPreMetaAttr.java index cde2485..1c79612 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-applyjtcodeservice-api/src/main/java/com/vci/ubcs/code/applyjtcodeservice/entity/DockingPreMetaAttr.java +++ b/Source/UBCS/ubcs-service-api/ubcs-applyjtcodeservice-api/src/main/java/com/vci/ubcs/code/applyjtcodeservice/entity/DockingPreMetaAttr.java @@ -39,7 +39,7 @@ * 鍙栧�艰寖鍥� */ @ApiModelProperty(value = "鍙栧�艰寖鍥�") - private String range; + private String range; /*** * 鐖跺睘鎬� diff --git a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/MdmBtmTypeConstant.java b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/MdmBtmTypeConstant.java index 2fa0b36..d174c61 100644 --- a/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/MdmBtmTypeConstant.java +++ b/Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/util/MdmBtmTypeConstant.java @@ -106,6 +106,12 @@ * 鍚屼箟璇嶉厤缃� */ public static final String CODE_SYNONYM = "codesynonym"; + + /** + * 闆嗗洟灞炴�ф睜閰嶇疆 + */ + public static final String GROUP_ATTR_POOL = "groupAttrPool"; + /** * 鍏ㄩ儴鐨勭爜鍊� */ diff --git a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/controller/GroupAttrPoolMappingController.java b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/controller/GroupAttrPoolMappingController.java index 6203583..63b4f77 100644 --- a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/controller/GroupAttrPoolMappingController.java +++ b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/controller/GroupAttrPoolMappingController.java @@ -1,19 +1,20 @@ package com.vci.ubcs.code.applyjtcodeservice.controller; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.vci.ubcs.code.applyjtcodeservice.entity.DockingPreMetaAttr; +import com.vci.ubcs.code.applyjtcodeservice.entity.GroupAttrPoolMapping; import com.vci.ubcs.code.applyjtcodeservice.service.IGroupAttrPoolMappingService; import com.vci.ubcs.code.applyjtcodeservice.vo.GroupAttrPoolMappingVO; +import com.vci.ubcs.starter.web.pagemodel.BladeQueryObject; import io.swagger.annotations.Api; import lombok.AllArgsConstructor; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.sql.rowset.serial.SerialException; import java.util.List; -import java.util.Map; /** * 闆嗗洟灞炴�ф睜鏄犲皠Controller @@ -30,12 +31,12 @@ /** * 鏌ヨ闆嗗洟灞炴�ф睜鏄犲皠鐨勫睘鎬� - * @param groupAttrPoolMappingVO + * @param bladeQueryObject * @return */ - @PostMapping("/getGroupAttrPoolALlList") - public R<List<GroupAttrPoolMappingVO>> getGroupAttrPoolALlList(@RequestBody GroupAttrPoolMappingVO groupAttrPoolMappingVO) throws SerialException { - return R.data(groupAttrPoolMappingService.getGroupAttrPoolALlList(groupAttrPoolMappingVO)); + @GetMapping("/getGroupAttrPoolALlList") + public R<IPage<GroupAttrPoolMappingVO>> getGroupAttrPoolALlList(BladeQueryObject bladeQueryObject) throws ServiceException { + return R.data(groupAttrPoolMappingService.getGroupAttrPoolALlList(bladeQueryObject)); } /** @@ -44,7 +45,7 @@ * @return */ @PostMapping("/getByGroupAttrKeyList") - public R<List<GroupAttrPoolMappingVO>> getByGroupAttrKeyList(@RequestBody GroupAttrPoolMappingVO groupAttrPoolMappingVO) throws SerialException { + public R<List<GroupAttrPoolMappingVO>> getByGroupAttrKeyList(@RequestBody GroupAttrPoolMappingVO groupAttrPoolMappingVO) throws ServiceException { return R.data(groupAttrPoolMappingService.getByGroupAttrKeyList(groupAttrPoolMappingVO)); } @@ -54,18 +55,18 @@ * @return */ @PostMapping("/editGroupAttr") - public R editGroupAttr(@RequestBody List<GroupAttrPoolMappingVO>groupAttrPoolMappingVO) throws SerialException { + public R editGroupAttr(@RequestBody List<GroupAttrPoolMappingVO> groupAttrPoolMappingVO) throws ServiceException { return R.status(groupAttrPoolMappingService.editGroupAttr(groupAttrPoolMappingVO)); } /** - * 鏍规嵁闆嗗洟灞炴�х紪鍙锋煡璇㈤泦鍥㈠睘鎬ф睜鏄犲皠锛屾厧鐢ㄥ洜涓轰細鏇存柊鎵�鏈夌敤鍒拌繖涓泦鍥㈠睘鎬х殑璁板綍 + * 鏍规嵁闆嗗洟灞炴�х紪鍙锋煡璇㈤泦鍥㈠睘鎬ф睜鏄犲皠骞跺悓姝ワ紝鎱庣敤鍥犱负浼氭洿鏂版墍鏈夌敤鍒拌繖涓泦鍥㈠睘鎬х殑璁板綍 * @param groupAttrPoolMappingVOS * @return */ @PostMapping("/syncGroupAttrMapping") - public R syncGroupAttrMapping(@RequestBody List<GroupAttrPoolMappingVO> groupAttrPoolMappingVOS) throws SerialException { - return R.status(groupAttrPoolMappingService.syncGroupAttrMapping(groupAttrPoolMappingVOS)); + public R syncGroupAttrMapping(@RequestBody List<GroupAttrPoolMappingVO> groupAttrPoolMappingVOS) throws ServiceException { + return groupAttrPoolMappingService.syncGroupAttrMapping(groupAttrPoolMappingVOS); } /** @@ -75,7 +76,7 @@ * @throws SerialException */ @PostMapping("/saveDistinctGroupAttr") - public R saveDistinctGroupAttr(@RequestBody List<DockingPreMetaAttr> dockingPreMetaAttrList) throws SerialException { + public R saveDistinctGroupAttr(@RequestBody List<DockingPreMetaAttr> dockingPreMetaAttrList) throws ServiceException { return R.status(groupAttrPoolMappingService.saveDistinctGroupAttr(dockingPreMetaAttrList)); } diff --git a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/IDockingPreAttrMappingService.java b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/IDockingPreAttrMappingService.java index 279c12e..63bbfd7 100644 --- a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/IDockingPreAttrMappingService.java +++ b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/IDockingPreAttrMappingService.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.extension.service.IService; import com.vci.ubcs.code.applyjtcodeservice.entity.DockingPreAttrMapping; +import com.vci.ubcs.code.applyjtcodeservice.entity.GroupAttrPoolMapping; import com.vci.ubcs.code.applyjtcodeservice.vo.DockingPreAttrMappingVO; import com.vci.ubcs.code.applyjtcodeservice.vo.DokingAttributeSerchVO; import com.vci.ubcs.code.applyjtcodeservice.vo.GroupAttrPoolMappingVO; @@ -64,9 +65,9 @@ /** * 闆嗗洟灞炴�ф睜鏄犲皠鏁版嵁鍚屾瀵奸泦鍥㈠睘鎬ф槧灏勭晫闈� - * @param groupAttrPoolMappingVOS + * @param groupAttrPoolMappings * @return */ - boolean syncGroupAttrMapping(List<GroupAttrPoolMappingVO> groupAttrPoolMappingVOS); + R syncGroupAttrMapping(List<GroupAttrPoolMapping> groupAttrPoolMappings); } diff --git a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/IGroupAttrPoolMappingService.java b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/IGroupAttrPoolMappingService.java index d0dd9e6..36d3a5d 100644 --- a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/IGroupAttrPoolMappingService.java +++ b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/IGroupAttrPoolMappingService.java @@ -1,14 +1,16 @@ package com.vci.ubcs.code.applyjtcodeservice.service; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.vci.ubcs.code.applyjtcodeservice.entity.DockingPreMetaAttr; import com.vci.ubcs.code.applyjtcodeservice.entity.GroupAttrPoolMapping; import com.vci.ubcs.code.applyjtcodeservice.vo.GroupAttrPoolMappingVO; +import com.vci.ubcs.starter.web.pagemodel.BladeQueryObject; +import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; import javax.sql.rowset.serial.SerialException; import java.util.List; -import java.util.Map; /** * 闆嗗洟灞炴�ф睜鏄犲皠鏈嶅姟灞� @@ -19,11 +21,11 @@ /** * 鏌ヨ鍏ㄩ儴闆嗗洟灞炴�ф睜鏄犲皠鐨勫睘鎬� - * @param GroupAttrPoolMappingVO + * @param bladeQueryObject * @return * @throws SerialException */ - List<GroupAttrPoolMappingVO> getGroupAttrPoolALlList(GroupAttrPoolMappingVO GroupAttrPoolMappingVO) throws SerialException; + IPage<GroupAttrPoolMappingVO> getGroupAttrPoolALlList(BladeQueryObject bladeQueryObject) throws ServiceException; /** * 鏍规嵁闆嗗洟灞炴�х紪鍙锋煡璇㈤泦鍥㈠睘鎬ф睜鏄犲皠 @@ -31,7 +33,7 @@ * @return * @throws SerialException */ - List<GroupAttrPoolMappingVO> getByGroupAttrKeyList(GroupAttrPoolMappingVO groupAttrPoolMappingVO) throws SerialException; + List<GroupAttrPoolMappingVO> getByGroupAttrKeyList(GroupAttrPoolMappingVO groupAttrPoolMappingVO) throws ServiceException; /** * 鐐瑰嚮鍚屾璇︾粏妯″瀷鏃惰皟鐢ㄨ鏂规硶锛� @@ -39,7 +41,7 @@ * @return * @throws SerialException */ - boolean saveDistinctGroupAttr(List<DockingPreMetaAttr> dockingPreMetaAttrList) throws SerialException; + boolean saveDistinctGroupAttr(List<DockingPreMetaAttr> dockingPreMetaAttrList) throws ServiceException; /** * 闆嗗洟灞炴�ф槧灏勭晫闈慨鏀圭殑鏄犲皠閰嶇疆淇濆瓨 @@ -47,7 +49,7 @@ * @return * @throws SerialException */ - boolean editGroupAttr(List<GroupAttrPoolMappingVO> groupAttrPoolMappingVO) throws SerialException; + boolean editGroupAttr(List<GroupAttrPoolMappingVO> groupAttrPoolMappingVO) throws ServiceException; /** * 鍚屾闆嗗洟灞炴�ф睜涓殑鏄犲皠閰嶇疆鍒帮紝鎵�鏈夊簲鐢ㄤ簡璇ラ泦鍥㈠睘鎬х殑鍏蜂綋鏌愪釜鍒嗙被涓婂幓 @@ -55,6 +57,6 @@ * @return * @throws SerialException */ - boolean syncGroupAttrMapping(List<GroupAttrPoolMappingVO> groupAttrPoolMappingVOS) throws SerialException; + R syncGroupAttrMapping(List<GroupAttrPoolMappingVO> groupAttrPoolMappingVOS) throws ServiceException; } diff --git a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/impl/DockingPreAttrMappingServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/impl/DockingPreAttrMappingServiceImpl.java index 0e402b6..807de69 100644 --- a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/impl/DockingPreAttrMappingServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/impl/DockingPreAttrMappingServiceImpl.java @@ -1,5 +1,6 @@ package com.vci.ubcs.code.applyjtcodeservice.service.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -21,15 +22,14 @@ import com.vci.ubcs.code.applyjtcodeservice.vo.DockingPreAttrRangeVO; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.BeanUtil; +import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /*** @@ -259,15 +259,43 @@ return dockingPreAttrMappingVOList; } + /** + * 闆嗗洟灞炴�ф睜鏄犲皠鏁版嵁鍚屾瀵奸泦鍥㈠睘鎬ф槧灏勭晫闈� + * @param groupAttrPoolMappings + * @return + */ @Override - public boolean syncGroupAttrMapping(List<GroupAttrPoolMappingVO> groupAttrPoolMappingVOS) { + public R syncGroupAttrMapping(List<GroupAttrPoolMapping> groupAttrPoolMappings) { log.info("寮�濮嬮泦鍥㈠睘鎬ф睜鍚屾鍒伴泦鍥㈠睘鎬ф槧灏勯厤缃〃"); - //groupAttrPoolMappingVOS.stream().map(GroupAttrPoolMapping::getGroupAttrKey); - dockingPreAttrMappingMapper.selectList( - Wrappers.<DockingPreAttrMapping>query().lambda().in(DockingPreAttrMapping::getSourceClassifyId) + List<String> groupAttrKeys = groupAttrPoolMappings.stream().map(GroupAttrPoolMapping::getGroupAttrKey).collect(Collectors.toList()); + List<DockingPreAttrMapping> dockingPreAttrMappings = dockingPreAttrMappingMapper.selectList( + Wrappers.<DockingPreAttrMapping>query() + .lambda().in(DockingPreAttrMapping::getSourceAttrKey,groupAttrKeys) ); + // 灞炴�ф槧灏勯厤缃〃涓笉瀛樺湪瑕佸悓姝ョ殑闆嗗洟灞炴�� + if(Func.isEmpty(dockingPreAttrMappings)){ + return R.fail(String.format("瑕佸悓姝ョ殑%s灞炴�э紝鍦ㄩ泦鍥㈠睘鎬ф槧灏勮〃涓笉瀛樺湪锛�", JSON.toJSONString(groupAttrKeys))); + } + log.info(String.format("杩欎簺%s闆嗗洟灞炴�ф鍦ㄥ線闆嗗洟灞炴�ф槧灏勮〃涓悓姝ャ��",JSON.toJSONString(groupAttrPoolMappings))); + Map<String, GroupAttrPoolMapping> syncTargetMap = new HashMap<>(); + // 鍑嗗瑕佷慨鏀圭殑姣斿鍙傛暟 + groupAttrPoolMappings.stream().forEach(item->{ + syncTargetMap.put((item.getGroupAttrKey()+item.getGroupAttrName()).toLowerCase(Locale.ROOT),item); + }); + List<DockingPreAttrMapping> newGroupAttrPoolMappings = new ArrayList<>(); + //鏌ユ壘鍒版洿鏀瑰氨鏀瑰彉鏌ヨ鍑烘潵鐨勬暟鎹繘琛屼慨鏀广�� + dockingPreAttrMappings.stream().forEach(item->{ + GroupAttrPoolMapping groupAttrPoolMapping = syncTargetMap.get((item.getSourceAttrKey()+item.getSourceAttrName()).toLowerCase(Locale.ROOT)); + if(Func.isNotEmpty(groupAttrPoolMapping)){ + DockingPreAttrMapping dockingPreAttrMapping = BeanUtil.copy(item, DockingPreAttrMapping.class); + dockingPreAttrMapping.setTargetAttrKey(groupAttrPoolMapping.getCodeMetaAttrKey()); + dockingPreAttrMapping.setTargetAttrName(groupAttrPoolMapping.getCodeMetaAttrName()); + newGroupAttrPoolMappings.add(dockingPreAttrMapping); + } + }); + boolean resBoolean = this.saveOrUpdateBatch(newGroupAttrPoolMappings); log.info("闆嗗洟灞炴�ф睜鍚屾鍒伴泦鍥㈠睘鎬ф槧灏勯厤缃〃瀹屾垚锛�"); - return false; + return resBoolean ? R.success("闆嗗洟灞炴�ф睜鍚屾鍒伴泦鍥㈠睘鎬ф槧灏勯厤缃〃鎴愬姛锛�"):R.fail("鍚屾杩囩▼涓紝淇敼闆嗗洟灞炴�ф槧灏勮〃鏃跺け璐ワ紒"); } } diff --git a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/impl/GroupAttrPoolMappingServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/impl/GroupAttrPoolMappingServiceImpl.java index 6593e75..db69aa6 100644 --- a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/impl/GroupAttrPoolMappingServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/service/impl/GroupAttrPoolMappingServiceImpl.java @@ -1,21 +1,27 @@ package com.vci.ubcs.code.applyjtcodeservice.service.impl; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.vci.ubcs.code.applyjtcodeservice.entity.DockingPreAttrRange; import com.vci.ubcs.code.applyjtcodeservice.entity.DockingPreMetaAttr; import com.vci.ubcs.code.applyjtcodeservice.entity.GroupAttrPoolMapping; import com.vci.ubcs.code.applyjtcodeservice.mapper.GroupAttrPoolMappingMapper; import com.vci.ubcs.code.applyjtcodeservice.service.IDockingPreAttrMappingService; import com.vci.ubcs.code.applyjtcodeservice.service.IGroupAttrPoolMappingService; -import com.vci.ubcs.code.applyjtcodeservice.service.IGroupMdmInterService; import com.vci.ubcs.code.applyjtcodeservice.vo.GroupAttrPoolMappingVO; import com.vci.ubcs.code.applyjtcodeservice.wrapper.GroupAttrPoolMappingWrapper; import com.vci.ubcs.code.feign.ICodeClassifyClient; import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; +import com.vci.ubcs.starter.util.DefaultAttrAssimtUtil; +import com.vci.ubcs.starter.util.MdmBtmTypeConstant; +import com.vci.ubcs.starter.util.UBCSCondition; +import com.vci.ubcs.starter.web.pagemodel.BladeQueryObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.support.Condition; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.stereotype.Service; @@ -23,7 +29,6 @@ import javax.sql.rowset.serial.SerialException; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.stream.Collectors; /** @@ -45,14 +50,15 @@ /** * 鏌ヨ鍏ㄩ儴闆嗗洟灞炴�ф睜鏄犲皠鐨勫睘鎬� - * - * @param GroupAttrPoolMappingVO + * @param bladeQueryObject * @return + * @throws SerialException */ @Override - public List<GroupAttrPoolMappingVO> getGroupAttrPoolALlList(GroupAttrPoolMappingVO GroupAttrPoolMappingVO) throws SerialException { - List<GroupAttrPoolMapping> groupAttrPoolMappings = groupAttrPoolMappingMapper.selectList(null); - return GroupAttrPoolMappingWrapper.build().entityVOs(groupAttrPoolMappings); + public IPage<GroupAttrPoolMappingVO> getGroupAttrPoolALlList(BladeQueryObject bladeQueryObject) throws ServiceException { + QueryWrapper<GroupAttrPoolMapping> queryWrapper = UBCSCondition.getQueryWrapper(bladeQueryObject.getConditionMap(), GroupAttrPoolMapping.class); + IPage<GroupAttrPoolMapping> groupAttrPoolMappingIPage = this.groupAttrPoolMappingMapper.selectPage(Condition.getPage(bladeQueryObject.getQuery()), queryWrapper); + return GroupAttrPoolMappingWrapper.build().pageVO(groupAttrPoolMappingIPage); } /** @@ -98,7 +104,7 @@ * @throws SerialException */ @Override - public boolean saveDistinctGroupAttr(List<DockingPreMetaAttr> dockingPreMetaAttrList) throws SerialException { + public boolean saveDistinctGroupAttr(List<DockingPreMetaAttr> dockingPreMetaAttrList) throws ServiceException { // 涓虹┖鐩存帴杩斿洖 if(Func.isEmpty(dockingPreMetaAttrList)){ return true; @@ -124,16 +130,23 @@ .lambda().in(GroupAttrPoolMapping::getGroupAttrKey, distinctListEnglishName) .in(GroupAttrPoolMapping::getGroupAttrName, distinctListChineseName) ); - List<GroupAttrPoolMapping> finalGroupAttrPoolMappings = null; + List<GroupAttrPoolMapping> newGroupAttrPoolMappings = null; // 灏嗗凡瀛樺湪鐨勯泦鍥㈠睘鎬т粠groupAttrPoolMappings涓Щ闄� if(Func.isNotEmpty(dbGroupAttrPoolMappings)){ - finalGroupAttrPoolMappings = groupAttrPoolMappings.stream() + newGroupAttrPoolMappings = groupAttrPoolMappings.stream() .filter(mapping -> !dbGroupAttrPoolMappings.stream() .map(GroupAttrPoolMapping::getGroupAttrKey) .collect(Collectors.toList()) .contains(mapping.getGroupAttrKey())) .collect(Collectors.toList()); + }else{ + newGroupAttrPoolMappings = groupAttrPoolMappings; } + List<GroupAttrPoolMapping> finalGroupAttrPoolMappings = newGroupAttrPoolMappings.stream().map(item -> { + DefaultAttrAssimtUtil.addDefaultAttrAssimt(item, MdmBtmTypeConstant.GROUP_ATTR_POOL); + return item; + }).collect(Collectors.toList()); + log.info("鏈鍚屾鐨勬暟鎹负锛�"+ JSON.toJSONString(finalGroupAttrPoolMappings)); boolean resBoolean = this.saveBatch(finalGroupAttrPoolMappings); log.info("闆嗗洟灞炴�у悓姝ュ埌闆嗗洟灞炴�ф睜,鍚屾瀹屾瘯"); return resBoolean; @@ -146,12 +159,16 @@ * @throws SerialException */ @Override - public boolean editGroupAttr(List<GroupAttrPoolMappingVO> groupAttrPoolMappingVO) throws SerialException { + public boolean editGroupAttr(List<GroupAttrPoolMappingVO> groupAttrPoolMappingVO) throws ServiceException { if(Func.isEmpty(groupAttrPoolMappingVO)){ return true; } List<GroupAttrPoolMapping> groupAttrPoolMappings = GroupAttrPoolMappingWrapper.build().VOsEntity(groupAttrPoolMappingVO); - return this.updateBatchById(groupAttrPoolMappings); + List<GroupAttrPoolMapping> finalGroupAttrPoolMappings = groupAttrPoolMappings.stream().map(item -> { + DefaultAttrAssimtUtil.updateDefaultAttrAssimt(item); + return item; + }).collect(Collectors.toList()); + return this.updateBatchById(finalGroupAttrPoolMappings); } /** @@ -161,8 +178,15 @@ * @throws SerialException */ @Override - public boolean syncGroupAttrMapping(List<GroupAttrPoolMappingVO> groupAttrPoolMappingVOS) throws SerialException { - return dockingPreAttrMappingService.syncGroupAttrMapping(groupAttrPoolMappingVOS); + public R syncGroupAttrMapping(List<GroupAttrPoolMappingVO> groupAttrPoolMappingVOS) throws ServiceException { + List<String> groupKeyList = groupAttrPoolMappingVOS.stream().map(GroupAttrPoolMappingVO::getGroupAttrKey).collect(Collectors.toList()); + List<GroupAttrPoolMapping> groupAttrPoolMappings = this.groupAttrPoolMappingMapper.selectList( + Wrappers.<GroupAttrPoolMapping>query().lambda().in(GroupAttrPoolMapping::getGroupAttrKey, groupKeyList) + ); + if(Func.isEmpty(groupAttrPoolMappings) && groupKeyList.size() == groupAttrPoolMappings.size()){ + return R.fail("鍕鹃�夌殑瑕佸悓姝ョ殑闆嗗洟灞炴�т腑鏈夊湪搴撲腑涓嶅瓨鍦ㄧ殑鏁版嵁锛岃鍒锋柊鍚庨噸璇曪紒"); + } + return dockingPreAttrMappingService.syncGroupAttrMapping(groupAttrPoolMappings); } } diff --git a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/wrapper/GroupAttrPoolMappingWrapper.java b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/wrapper/GroupAttrPoolMappingWrapper.java index 16e4a45..d261552 100644 --- a/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/wrapper/GroupAttrPoolMappingWrapper.java +++ b/Source/UBCS/ubcs-service/ubcs-applyjtcodeservice/src/main/java/com/vci/ubcs/code/applyjtcodeservice/wrapper/GroupAttrPoolMappingWrapper.java @@ -1,11 +1,7 @@ package com.vci.ubcs.code.applyjtcodeservice.wrapper; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; -import com.vci.ubcs.code.applyjtcodeservice.entity.DockingPreMetaAttr; -import com.vci.ubcs.code.applyjtcodeservice.entity.DockingPreViewModel; import com.vci.ubcs.code.applyjtcodeservice.entity.GroupAttrPoolMapping; -import com.vci.ubcs.code.applyjtcodeservice.vo.DockingPreMetaAttrVO; -import com.vci.ubcs.code.applyjtcodeservice.vo.DockingPreViewModelVO; import com.vci.ubcs.code.applyjtcodeservice.vo.GroupAttrPoolMappingVO; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; @@ -47,7 +43,7 @@ return vos; } - private GroupAttrPoolMapping VOEntity(GroupAttrPoolMappingVO groupAttrPoolMappingVO){ + public GroupAttrPoolMapping VOEntity(GroupAttrPoolMappingVO groupAttrPoolMappingVO){ GroupAttrPoolMapping groupAttrPoolMapping = Objects.requireNonNull(BeanUtil.copy(groupAttrPoolMappingVO, GroupAttrPoolMapping.class)); return groupAttrPoolMapping; } diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java index 4345114..b371101 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java @@ -5204,7 +5204,7 @@ Map<String, CodeClassifyTemplateAttrVO> attrVOMap = templateVO.getAttributes().stream().filter(s-> finalFieldList.contains(s.getId().toLowerCase(Locale.ROOT))).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); List<WriteExcelData> excelDataList = new ArrayList<>(); Workbook workbook = new HSSFWorkbook(); - List<CodeAndGroupCodeAttrMappingDTO> codeAndGroupCodeAttrMappingDTOList= execGroupCodePortDataDTO.getCodeAttrMapGroupAttrDTOS(); + List<CodeAndGroupCodeAttrMappingDTO> codeAndGroupCodeAttrMappingDTOList = execGroupCodePortDataDTO.getCodeAttrMapGroupAttrDTOS(); Map<String, CodeAndGroupCodeAttrMappingDTO> jAttrVOMap = codeAndGroupCodeAttrMappingDTOList.stream().filter(s-> finalFieldList.contains(s.getTargetAttrKey().toLowerCase(Locale.ROOT))).collect(Collectors.toMap(s -> s.getTargetAttrKey().toLowerCase(Locale.ROOT), t -> t)); WriteExcelData codeExcelData = new WriteExcelData(0, 0, "浼佷笟缂栫爜"); WriteExcelData groupExcelData = new WriteExcelData(0, 1, "闆嗗洟鐮�"); @@ -5576,7 +5576,8 @@ LinkedList<String> colNameList=new LinkedList<>(); dockingPreAttrMappingVOList.stream().forEach(dockingPreAttrMappingVO -> { CodeAndGroupCodeAttrMappingDTO codeAndGroupCodeAttrMappingDTO=new CodeAndGroupCodeAttrMappingDTO(); - if(StringUtils.isNotBlank(dockingPreAttrMappingVO.getTargetAttrId())){ + // TODO:2024/4/16鏀规垚鐢╧ey鍊煎垽鏂� + if(StringUtils.isNotBlank(dockingPreAttrMappingVO.getTargetAttrKey())){ codeAndGroupCodeAttrMappingDTO.setDefaultValue(dockingPreAttrMappingVO.getDefaultValue()); codeAndGroupCodeAttrMappingDTO.setMetaListId(dockingPreAttrMappingVO.getMetaListId()); codeAndGroupCodeAttrMappingDTO.setSourceAttrKey(dockingPreAttrMappingVO.getSourceAttrKey()); -- Gitblit v1.9.3