feat: 零部件支持多选查询

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