Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
@@ -171,7 +171,7 @@ //添加 “查看全部禁用条件” if (item.code === "classify_view") { this.$set(this.classifyAuthData[index].authButton, "allDisabled", true); console.log(this.classifyAuthData[index].authButton.allDisabled) // console.log(this.classifyAuthData[index].authButton.allDisabled) } } else { @@ -288,8 +288,10 @@ classifyAuthList: [], isCLear: false, //默认是清空 classifyId: this.TreeNode.oid, authType: 'classify_auth', }; let isRepeat = false; // console.log(this.classifyAuthData); if(this.classifyAuthData.length > 0){ // 遍历数组,比较后面的对象的roleData是否与前面的对象相等 for (let i = 0; i < this.classifyAuthData.length - 1; i++) { Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue
@@ -131,7 +131,7 @@ classifyAuthData(newval){ this.addIndex = newval.length <= 0 ? 0 :newval.length-1; console.log(this.addIndex) // console.log(this.addIndex) } }, computed: {}, @@ -289,6 +289,7 @@ classifyAuthList: [], isCLear: false, //默认是清空 classifyId: this.TreeNode.oid, authType: 'data_auth', }; let isRepeat = false; if (this.classifyAuthData.length > 0) { Source/UBCS/ubcs-service-api/ubcs-system-api/src/main/java/com/vci/ubcs/system/dto/ClassifyAuthDTO.java
@@ -11,20 +11,20 @@ * @date 2024/1/24 17:57 */ @Data public class ClassifyAuthDTO { public class ClassifyAuthDTO extends ClassifyAuth{ private List<ClassifyAuth> classifyAuthList; /** * 是否清空 true是清空,false不是清空 */ // @NotBlank(message = "必传参数isCLear不能为空") // @NotBlank(message = "必传参数isCLear不能为空") private Boolean isCLear; /** * 分类id */ // @NotBlank(message = "必传参数classifyId不能为空") // @NotBlank(message = "必传参数classifyId不能为空") private String classifyId; } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/ICodeSynonymService.java
@@ -77,4 +77,10 @@ */ String selectNameByWrapper(LambdaQueryWrapper<CodeSynonym> wrappers); /** * 获取近义词查询规则 * @return */ Map<String,List<CodeSynonym>> getCodeSynonymByOids(Map<String, CodeClassifyTemplateAttrVO> sysonymAttrMap); } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeSynonymServiceImpl.java
@@ -42,8 +42,10 @@ import org.springblade.core.tool.utils.Func; import org.springframework.stereotype.Service; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; /** * 近义词维护 服务实现类 @@ -156,4 +158,22 @@ return res.toString().replaceAll(",$", ""); } /** * 获取近义词查询规则 * @return */ @Override public Map<String, List<CodeSynonym>> getCodeSynonymByOids(Map<String, CodeClassifyTemplateAttrVO> sysonymAttrMap) { if(sysonymAttrMap.isEmpty()){ return new HashMap<>(); } Map<String, List<CodeSynonym>> resMap = new HashMap<>(); for (String key : sysonymAttrMap.keySet()) { List<String> oids = Func.toStrList(sysonymAttrMap.get(key).getSysonymRuleOids()); List<CodeSynonym> codeSynonyms = codeSynonymMapper.selectBatchIds(oids); resMap.put(key,codeSynonyms); } return resMap; } } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmEngineServiceImpl.java
@@ -3915,7 +3915,11 @@ uiInfoVO.setLeaf(classifyService.countChildrenByClassifyOid(codeClassifyOid) == 0); if (StringUtils.isNotBlank(functionId) && !"~".equalsIgnoreCase(functionId)) { // TODO:2024-1-25 18:42模板上的btmtypeid有时候会存在大小写的问题,按理来说这儿直接用functionId就能满足查询菜单按钮了uiInfoVO.getTemplateVO().getBtmTypeId() List<Menu> buttonVOS = iSysClient.getMenuButtonByType(codeClassifyOid, functionId, "data_auth").getData(); R<List<Menu>> buttonListR = iSysClient.getMenuButtonByType(codeClassifyOid, functionId, "data_auth"); if(!buttonListR.isSuccess()){ throw new ServiceException("获取按钮授权列表失败,原因:"+buttonListR.getMsg()); } List<Menu> buttonVOS = buttonListR.getData(); List<SmOperationVO> operationVOS = new ArrayList<>(); if (!CollectionUtils.isEmpty(buttonVOS)) { Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmIOServiceImpl.java
@@ -12,6 +12,7 @@ import com.vci.ubcs.code.bo.CodeTemplateAttrSqlBO; import com.vci.ubcs.code.dto.*; import com.vci.ubcs.code.entity.CodeAllCode; import com.vci.ubcs.code.entity.CodeSynonym; import com.vci.ubcs.code.enumpack.*; import com.vci.ubcs.code.lifecycle.CodeAllCodeLC; import com.vci.ubcs.code.mapper.CommonsMapper; @@ -97,7 +98,6 @@ @Slf4j public class MdmIOServiceImpl implements MdmIOService { /** * 字段 */ @@ -164,36 +164,45 @@ @Autowired private ICodeKeyAttrRepeatService keyRuleService; @Autowired ICodeSynonymService codeSynonymService; /** * 公式的服务 */ @Autowired private FormulaServiceImpl formulaService; /** * 规则的服务 */ @Autowired private ICodeRuleService ruleService; /** * 业务类型的服务 */ @Autowired private IBtmTypeClient btmTypeClient; /*** * 申请集团编码服务 */ @Resource private IMdmInterJtClient mdmInterJtClient; /*** * 密级服务 */ @Resource private IWebSecretClient secretService; /** * 日志保存工具类 */ @Autowired private SaveLogUtil saveLogUtil; /** * 客户现场excel为老版本,导出的总数限制为65535 @@ -959,9 +968,7 @@ //最后弄组合规则 batchSwitchComponentAttrOnOrder(attrVOS,allCboList); Map<String, ClientBusinessObject> rowIndexCboMap = allCboList.stream().filter(cbo -> cbo != null).collect(Collectors.toList()).stream().collect(Collectors.toMap(s -> s.getAttributeValue((IMPORT_ROW_INDEX)), t -> t)); List<ClientBusinessObject> needSaveCboList = allCboList.stream().filter(cbo -> { String rowIndex = cbo.getAttributeValue(IMPORT_ROW_INDEX); @@ -4386,7 +4393,16 @@ CodeKeyAttrRepeatVO keyRuleVO = keyRuleService.getRuleByClassifyFullInfo(classifyFullInfo); //注意的是keyRuleVO可能为空,表示不使用规则控制 //获取所有的关键属性 Map<String/**属性的编号**/, CodeClassifyTemplateAttrVO> ketAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyAttrFlag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); Map<String/**属性的编号**/, CodeClassifyTemplateAttrVO> keyAttrMap = templateVO.getAttributes().stream().filter(s -> VciBaseUtil.getBoolean(s.getKeyAttrFlag())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); // TODO:2024-02-01 先获取配置了近义词查询规则的属性,不同于关键属性,设置了近义词查询规则的属性可能是多条不同的近义词查询规则 Map<String, CodeClassifyTemplateAttrVO> sysonymAttrMaps = templateVO.getAttributes().stream().filter(item -> Func.isNotBlank(item.getSysonymRuleOids())).collect(Collectors.toMap(s -> s.getId().toLowerCase(Locale.ROOT), t -> t)); //有配置近义词查询规则属性 Map<String, List<CodeSynonym>> codeSynonymMaps = new HashMap<>(); if(!sysonymAttrMaps.isEmpty()){ // 查询近义词规则 codeSynonymMaps = codeSynonymService.getCodeSynonymByOids(sysonymAttrMaps); } boolean trimAll =keyRuleVO ==null?false: VciBaseUtil.getBoolean(keyRuleVO.getIgnoreallspaceflag()); //全部去空的优先级大于去空 @@ -4398,15 +4414,13 @@ CodeImportResultVO resultVO = new CodeImportResultVO(); resultVO.setKeyAttrRuleInfo(String.format(keyRuleVO ==null?"":"查询规则:去除空格--{0},忽略大小写--{1},忽略全半角--{2},忽略全部空格--{3}", new String[]{trim?"是":"否",ignoreCase?"是":"否",ignoreWidth?"是":"否",trimAll?"是":"否"})); //resultVO.setSelfRepeatRowIndexList(getSelfRepeatRowIndex(ketAttrMap,cboList,keyRuleVO)); getSelfRepeatRowIndex(ketAttrMap,cboList,keyRuleVO,resultVO); //resultVO.setSelfRepeatRowIndexList(getSelfRepeatRowIndex(keyAttrMap,cboList,keyRuleVO)); getSelfRepeatRowIndex(keyAttrMap,cboList,keyRuleVO,resultVO); if(!CollectionUtils.isEmpty(resultVO.getSelfRepeatRowIndexList())){ //我们移除本身重复的数据 cboList = cboList.stream().filter(s->!resultVO.getSelfRepeatRowIndexList().contains(s.getAttributeValue(IMPORT_ROW_INDEX))).collect(Collectors.toList()); } //2.判断关键属性在系统里是否重复 //因为数据量很大,所以得想办法并行 //SessionInfo sessionInfo = VciBaseUtil.getCurrentUserSessionInfo(); Map<String,List<BaseModel>> indexTODataMap=new ConcurrentHashMap<>(); // 查询不需要参与关键属性校验的除自己以外的所有分类oid final String isParticipateCheckOids = classifyService.selectLeafByParentClassifyOid(classifyFullInfo.getTopClassifyVO().getOid(), classifyFullInfo.getCurrentClassifyVO().getOid()); @@ -4420,7 +4434,7 @@ //每行都得查询.如果其中出现了错误,我们就直接抛出异常,其余的显示 //VciBaseUtil.setCurrentUserSessionInfo(sessionInfo); Map<String, String> conditionMap = new HashMap<>(); ketAttrMap.forEach((attrId, attrVO) -> { keyAttrMap.forEach((attrId, attrVO) -> { String value =cbo.getAttributeValue(attrId.toLowerCase(Locale.ROOT)); if (value == null) { value = ""; @@ -4428,12 +4442,13 @@ value= value.replace(REQUIRED_CHAR,SPECIAL_CHAR); engineService.wrapperKeyAttrConditionMap(value, keyRuleVO, attrId, trim, ignoreCase, ignoreWidth, trimAll, conditionMap); }); if (!CollectionUtils.isEmpty(ketAttrMap)) { if (!CollectionUtils.isEmpty(keyAttrMap)) { // 添加不参与关键属性校验的分类oid判断 if(Func.isNotBlank(isParticipateCheckOids)){ conditionMap.put("t.codeclsfid",QueryOptionConstant.NOTIN+isParticipateCheckOids); } if(isEdit){//如果是更改则需排除系统本身 //如果是更改则需排除系统本身 if(isEdit){ conditionMap.put("t.id",QueryOptionConstant.NOTEQUAL+cbo.getId()); } conditionMap.put("t.lastr", "1"); Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/MdmProductCodeServiceImpl.java
@@ -438,16 +438,22 @@ for (CodeAllCode codeAllCode : takeBack) { codeAllCode.setTs(new Date()); codeAllCode.setLastModifyTime(new Date()); codeAllCode.setLastModifier(AuthUtil.getUserId().toString()); Iterator<CodeAllCode> iterator = allCodeDOList.iterator(); while (iterator.hasNext()){ codeAllCode.setLastModifier(Func.isNotEmpty(user) ? user.getAccount():AuthUtil.getUserAccount()); for (int i = 0; i < allCodeDOList.size(); i++) { if(codeAllCode.getId().equals(allCodeDOList.get(i).getId())){ codeAllCode.setCreateCodeOid(allCodeDOList.get(i).getCreateCodeOid()); codeAllCode.setLcStatus(allCodeDOList.get(i).getLcStatus()); allCodeDOList.remove(i); } } /*while (iterator.hasNext()){ CodeAllCode next = iterator.next(); if(codeAllCode.getId().equals(next.getId())){ codeAllCode.setCreateCodeOid(next.getCreateCodeOid()); codeAllCode.setLcStatus(next.getLcStatus()); //iterator.remove(); } } }*/ } if(takeBack.size()>0){ codeAllCodeService.updateBatchById(takeBack); @@ -614,7 +620,7 @@ } } } /** * 转换流水码段的值 * @param serialSecVOList 流水码段 @@ -1259,14 +1265,21 @@ codeAllCode.setLastModifyTime(new Date()); codeAllCode.setLastModifier(AuthUtil.getUserId().toString()); Iterator<CodeAllCode> iterator = allCodeDOList.iterator(); while (iterator.hasNext()){ for (int i = 0; i < allCodeDOList.size(); i++) { if(codeAllCode.getId().equals(allCodeDOList.get(i).getId())){ codeAllCode.setCreateCodeOid(allCodeDOList.get(i).getCreateCodeOid()); codeAllCode.setLcStatus(allCodeDOList.get(i).getLcStatus()); allCodeDOList.remove(i); } } /*while (iterator.hasNext()){ CodeAllCode next = iterator.next(); if(codeAllCode.getId().equals(next.getId())){ codeAllCode.setCreateCodeOid(next.getCreateCodeOid()); codeAllCode.setLcStatus(next.getLcStatus()); //iterator.remove(); } } }*/ } if(takeBack.size()>0){ codeAllCodeService.updateBatchById(takeBack); Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/ClassifyAuthServiceImpl.java
@@ -2,7 +2,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.vci.ubcs.code.feign.ICodeClassifyClient; @@ -14,15 +13,12 @@ import com.vci.ubcs.system.service.IClassifyAuthService; import com.vci.ubcs.system.service.IMenuService; import com.vci.ubcs.system.vo.ClassifyAuthVO; import com.vci.ubcs.system.vo.MenuVO; import com.vci.ubcs.system.wrapper.ClassifyAuthWrapper; import lombok.AllArgsConstructor; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -55,10 +51,12 @@ // 是清空授权列表 if(classifyAuthListDTO.getIsCLear()){ if(Func.isEmpty(classifyAuthListDTO.getClassifyId())){ return R.fail("清空授权列表时,未获取的分类id"); return R.fail("清空授权列表时,未获取到分类id"); } this.classifyAuthMapper.delete(Wrappers.<ClassifyAuth>update() this.classifyAuthMapper.delete( Wrappers.<ClassifyAuth>update() .lambda().eq(ClassifyAuth::getClassifyId, classifyAuthListDTO.getClassifyId()) .eq(ClassifyAuth::getAuthType,classifyAuthListDTO.getAuthType()) ); return R.success("授权列表清空成功"); } @@ -82,6 +80,7 @@ // 删除 LambdaUpdateWrapper<ClassifyAuth> updateWrapper = Wrappers.<ClassifyAuth>update() .lambda().eq(ClassifyAuth::getClassifyId, classifyAuthListDTO.getClassifyAuthList().get(0).getClassifyId()) .eq(ClassifyAuth::getAuthType,classifyAuthListDTO.getAuthType()) .notIn(ClassifyAuth::getRoleId, roleIds); try { this.classifyAuthMapper.delete(updateWrapper); @@ -168,15 +167,23 @@ .eq(ClassifyAuth::getAuthType,authType) .in(ClassifyAuth::getRoleId, roleIds) ); //只要当前节点的上层节点中找到了分类授权信息就不再继续网上找了 //只要当前节点的上层节点中找到了分类授权信息就不再继续往上找了 if(!classifyAuths.isEmpty()){ break; } } } //出现了错误数据,同一个角色和同一个分类id存在多条授权记录 //出现了多条数据 if(classifyAuths.size()>1){ throw new ServiceException("角色和分类配置存在多条记录,请联系管理人员清理错误配置!"); // 校验是否存在错误数据,同一个角色和同一个分类id存在多条授权记录 List<ClassifyAuth> finalClassifyAuths = classifyAuths; boolean hasDuplicate = classifyAuths.stream() .anyMatch(auth1 -> finalClassifyAuths.stream() .filter(auth2 -> auth1 != auth2) .anyMatch(auth2 -> auth1.getRoleId().equals(auth2.getRoleId()) && auth1.getClassifyId().equals(auth2.getClassifyId()))); if (hasDuplicate) { throw new ServiceException("角色和分类配置存在多条记录,请联系管理人员清理错误配置!"); } } // 是否为超管 Boolean isAdmin = VciBaseUtil.checkAdminTenant(); @@ -187,7 +194,10 @@ List<String> ids = new ArrayList<>(); // 如果不是超管用户 if(!isAdmin){ ids.addAll(Arrays.asList(classifyAuths.get(0).getButtonIds().split(","))); String concatenatedButtonIds = classifyAuths.stream() .map(ClassifyAuth::getButtonIds) // 获取每个classifyAuths对象的buttonIds .collect(Collectors.joining(",")); // 用逗号分隔拼接成一个字符串 ids.addAll(Arrays.asList(concatenatedButtonIds.split(","))); } return menuService.getMenuListByCode(ids,menuCode,roleIds); } Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/service/impl/MenuServiceImpl.java
@@ -359,6 +359,7 @@ classifyAuths = classifyAuthMapper.selectList( Wrappers.<ClassifyAuth>query() .lambda().eq(ClassifyAuth::getClassifyId, classifyOidList.get(i)) .eq(ClassifyAuth::getAuthType,authType) .in(ClassifyAuth::getRoleId, roleIds) ); if(!classifyAuths.isEmpty()){ @@ -366,9 +367,17 @@ } } } //出现了错误数据,同一个角色和同一个分类id存在多条授权记录 //出现了多条数据 if(classifyAuths.size()>1){ throw new ServiceException("角色和分类配置存在多条记录,请联系管理人员清理错误配置!"); // 校验是否存在错误数据,同一个角色和同一个分类id存在多条授权记录 List<ClassifyAuth> finalClassifyAuths = classifyAuths; boolean hasDuplicate = classifyAuths.stream() .anyMatch(auth1 -> finalClassifyAuths.stream() .filter(auth2 -> auth1 != auth2) .anyMatch(auth2 -> auth1.getRoleId().equals(auth2.getRoleId()) && auth1.getClassifyId().equals(auth2.getClassifyId()))); if (hasDuplicate) { throw new ServiceException("角色和分类配置存在多条记录,请联系管理人员清理错误配置!"); } } // 是否为超管 Boolean isAdmin = VciBaseUtil.checkAdminTenant(); @@ -379,7 +388,10 @@ List<String> ids = new ArrayList<>(); // 如果不是超管用户 if(!isAdmin){ ids.addAll(Arrays.asList(classifyAuths.get(0).getButtonIds().split(","))); String concatenatedButtonIds = classifyAuths.stream() .map(ClassifyAuth::getButtonIds) // 获取每个classifyAuths对象的buttonIds .collect(Collectors.joining(",")); // 用逗号分隔拼接成一个字符串 ids.addAll(Arrays.asList(concatenatedButtonIds.split(","))); } return this.getMenuListByCode(ids,btmType,roleIds); }