diff --git a/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java index d92d6ae4..9908bf05 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/common/service/impl/LawsCommonServiceImpl.java @@ -163,18 +163,22 @@ public class LawsCommonServiceImpl implements ILawsCommonService { public void setEnable(boolean enable) { ENCRYPT_ENABLE = enable; } + @Value("${download.decrypt.url}") public void setDecryptUrl(String decryptUrl) { DECRYPT_URL = decryptUrl; } + @Value("${download.decrypt.app_code}") public void setDecryptAppCode(String decryptAppCode) { DECRYPT_APP_CODE = decryptAppCode; } + @Value("${download.decrypt.secret_key}") public void setDecryptSecretKey(String decryptSecretKey) { DECRYPT_SECRET_KEY = decryptSecretKey; } + @Value("#{'${adminRoleCode}'.split(',')}") private List adminRoleCodeList; @Value("#{'${enterpriseDetailRoleCode}'.split(',')}") @@ -346,7 +350,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { Map flagMap = new HashMap<>(); sarFileSplitInfoEOList.forEach(e -> { - if (!flagMap.containsKey(e.getFileType())){ + if (!flagMap.containsKey(e.getFileType())) { flagMap.put(e.getFileType(), e.getId() + "," + e.getPublishBeforeId()); } }); @@ -1415,15 +1419,15 @@ public class LawsCommonServiceImpl implements ILawsCommonService { **/ @Override public IPage getManyStandardSelectionBox(ManyStandardSelectionBoxVO selectionBoxVO, Integer pageNo, Integer pageSize) { - if (StringUtils.isNotBlank(selectionBoxVO.getStandardSystem())){ + if (StringUtils.isNotBlank(selectionBoxVO.getStandardSystem())) { List list = Arrays.asList(selectionBoxVO.getStandardSystem().split(",")); List lawsNodeRelationList = lawsNodeRelationService.list( new LambdaQueryWrapper().in(LawsNodeRelation::getNodeId, list)); - if (CollectionUtils.isNotEmpty(lawsNodeRelationList)){ + if (CollectionUtils.isNotEmpty(lawsNodeRelationList)) { String ids = lawsNodeRelationList.stream() .map(LawsNodeRelation::getUniqueRelationFlag).collect(Collectors.joining(",")); selectionBoxVO.setIds(ids); - }else { + } else { return new Page<>(); } } @@ -1588,7 +1592,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { ZipEntry fileEntry = new ZipEntry(file.getFileRelativePath()); zipOut.putNextEntry(fileEntry); // 将文件取出存入流中 - if(TableNameEnum.ENTERPRISE_STANDARDS.getValue().equals(parameterMap.get(FieldCommon.MODULE))) { + if (TableNameEnum.ENTERPRISE_STANDARDS.getValue().equals(parameterMap.get(FieldCommon.MODULE))) { bytes = this.getMinioFileContentES(file); } else { bytes = this.getMinioFileContent(file); @@ -1805,8 +1809,8 @@ public class LawsCommonServiceImpl implements ILawsCommonService { } // 获取错误信息 errMsgList = importUtil.validExcelData(sheet, headerList, fileMap, insertDataList, - treeNodeMap, treeNodePathMap, - sysDeaprtMap,sysDepartPathMap); + treeNodeMap, treeNodePathMap, + sysDeaprtMap, sysDepartPathMap); } return errMsgList; } @@ -2133,9 +2137,9 @@ public class LawsCommonServiceImpl implements ILawsCommonService { lambdaQueryWrapper.eq(LawsReplacedStandard::getType, "1"); List replacedStandardList = lawsReplacedStandardService.list(lambdaQueryWrapper); Set setSub = replacedStandardList.stream().map(LawsReplacedStandard::getReplacedBy).collect(Collectors.toSet()); - if(CollectionUtils.isEmpty(listIntersection)){ + if (CollectionUtils.isEmpty(listIntersection)) { listIntersection.addAll(setSub); - }else{ + } else { listIntersection = listIntersection.stream() .filter(setSub::contains) .collect(Collectors.toSet()); @@ -2159,9 +2163,9 @@ public class LawsCommonServiceImpl implements ILawsCommonService { return s.getReplaced(); } }).collect(Collectors.toSet()); - if(CollectionUtils.isEmpty(listIntersection)){ + if (CollectionUtils.isEmpty(listIntersection)) { listIntersection.addAll(setSub); - }else{ + } else { listIntersection = listIntersection.stream() .filter(setSub::contains) .collect(Collectors.toSet()); @@ -2186,9 +2190,9 @@ public class LawsCommonServiceImpl implements ILawsCommonService { lambdaQueryWrapper.eq(LawsReplacedStandard::getType, "2"); List replacedStandardList = lawsReplacedStandardService.list(lambdaQueryWrapper); Set setSub = replacedStandardList.stream().map(LawsReplacedStandard::getReplacedBy).collect(Collectors.toSet()); - if(CollectionUtils.isEmpty(listIntersection)){ + if (CollectionUtils.isEmpty(listIntersection)) { listIntersection.addAll(setSub); - }else{ + } else { listIntersection = listIntersection.stream() .filter(setSub::contains) .collect(Collectors.toSet()); @@ -2212,9 +2216,9 @@ public class LawsCommonServiceImpl implements ILawsCommonService { return s.getReplaced(); } }).collect(Collectors.toSet()); - if(CollectionUtils.isEmpty(listIntersection)){ + if (CollectionUtils.isEmpty(listIntersection)) { listIntersection.addAll(setSub); - }else{ + } else { listIntersection = listIntersection.stream() .filter(setSub::contains) .collect(Collectors.toSet()); @@ -2229,7 +2233,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { // }).collect(Collectors.toSet())); parameterMap.remove(FieldCommon.REFERENCED_STANDARD); } - if(!CollectionUtils.isEmpty(listIntersection)){ + if (!CollectionUtils.isEmpty(listIntersection)) { snSet.addAll(listIntersection); } // 零部件名称 @@ -2391,30 +2395,29 @@ public class LawsCommonServiceImpl implements ILawsCommonService { } @NotNull - private List getLawsPartNameStandard(String partName) { - PartName targetNode = partNameService.getById(partName); - List resultNodeList = new ArrayList<>(); - // 获取整颗零部件树 - List allNodeList = partNameService.list(); - // 获取当前 - Set pathToRoot = PartNameServiceImpl.findPathToRoot(allNodeList, targetNode); - Set allChildren = PartNameServiceImpl.findAllChildren(allNodeList, targetNode); - resultNodeList.addAll(pathToRoot); - resultNodeList.addAll(allChildren); + private List getLawsPartNameStandard(String partNames) { + String[] partNameIdList = partNames.split(","); + Set partNameStandardSet = new HashSet<>(); + for (String partName : partNameIdList) { + PartName targetNode = partNameService.getById(partName); + List resultNodeList = new ArrayList<>(); + // 获取整颗零部件树 + List allNodeList = partNameService.list(); + // 获取当前 + Set pathToRoot = PartNameServiceImpl.findPathToRoot(allNodeList, targetNode); + Set allChildren = PartNameServiceImpl.findAllChildren(allNodeList, targetNode); + resultNodeList.addAll(pathToRoot); + resultNodeList.addAll(allChildren); - if (resultNodeList.isEmpty()) { - return new ArrayList<>(); + if (resultNodeList.isEmpty()) { + return new ArrayList<>(); + } + + LambdaQueryWrapper pnsWrapper = new LambdaQueryWrapper<>(); + pnsWrapper.in(LawsPartNameStandard::getPartNameId, resultNodeList.stream().map(PartName::getCode).collect(Collectors.toList())); + partNameStandardSet.addAll(partNameStandardService.list(pnsWrapper)); } - - LambdaQueryWrapper pnsWrapper = new LambdaQueryWrapper<>(); - pnsWrapper.in(LawsPartNameStandard::getPartNameId, resultNodeList.stream().map(PartName::getCode).collect(Collectors.toList())); - List partNameStandardList = partNameStandardService.list(pnsWrapper); - - if (partNameStandardList.isEmpty()) { - return new ArrayList<>(); - } - - return partNameStandardList.stream().map(LawsPartNameStandard::getStandardId).collect(Collectors.toList()); + return partNameStandardSet.stream().map(LawsPartNameStandard::getStandardId).collect(Collectors.toList()); } @@ -2526,7 +2529,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { } else if (LawsFieldTypeEnum.DATE_MANY.getValue().equals(fieldShowType)) { // 多日期查询 processDateManyTypeCondition(selectCondition, key, value); - }else if (FieldShowTypeEnum.TREE_FATHER_CHILD.getValue().equals(fieldShowType)) { + } else if (FieldShowTypeEnum.TREE_FATHER_CHILD.getValue().equals(fieldShowType)) { String sql = getTreeFatherChild(tableName, key, value, lawsTag.getDictId()); selectCondition.append(sql); } else if (FieldShowTypeEnum.TREE_CHILD.getValue().equals(fieldShowType)) { @@ -2625,7 +2628,6 @@ public class LawsCommonServiceImpl implements ILawsCommonService { } - @Override public byte[] getMinioFileContent(OSSFile file) throws Exception { return this.getMinioFileContentNormal(file, false); @@ -2996,7 +2998,7 @@ public class LawsCommonServiceImpl implements ILawsCommonService { public StringBuilder validateFieldByDict(Object record) { StringBuilder msg = new StringBuilder(); List listDict = sysBaseAPI.getDictItemAll(); - if(CollectionUtils.isEmpty(listDict)){ + if (CollectionUtils.isEmpty(listDict)) { return msg; } ObjectMapper mapper = new ObjectMapper(); @@ -3020,24 +3022,24 @@ public class LawsCommonServiceImpl implements ILawsCommonService { field.setAccessible(true); if (field.getAnnotation(Excel.class) != null) { String code = field.getAnnotation(Excel.class).dicCode(); - if(StringUtils.isBlank(code)){ + if (StringUtils.isBlank(code)) { continue; } String name = field.getAnnotation(Excel.class).name(); String text = field.getAnnotation(Excel.class).dicText(); String table = field.getAnnotation(Excel.class).dictTable(); String key = String.valueOf(item.get(field.getName())); - if(StringUtils.isBlank(key) || Objects.equals("null", key)){ + if (StringUtils.isBlank(key) || Objects.equals("null", key)) { item.put(field.getName(), null); continue; } String textValue = translateDictValue(code, text, table, key, listDict); - if(StringUtils.isBlank(textValue)){ + if (StringUtils.isBlank(textValue)) { String[] str1 = name.split("\\("); String en = str1.length > 1 ? str1[1].split("\\)")[0] : str1[0]; String zh = str1[0]; - name = Objects.equals(locale,Locale.ENGLISH) ? en : zh; - msg.append(MessageUtils.getMessage(ResultCommon.DATA_DOES_NOT_EXIST,name)).append(","); + name = Objects.equals(locale, Locale.ENGLISH) ? en : zh; + msg.append(MessageUtils.getMessage(ResultCommon.DATA_DOES_NOT_EXIST, name)).append(","); } } }