pdi部件绑定修改
This commit is contained in:
parent
7e5de36bd0
commit
b736a816ca
|
|
@ -79,6 +79,7 @@ public class QmsPdiComponentBindingControllerService {
|
||||||
getComponentMapByName(request.getPdiDetectionRulesId(), componentNames);
|
getComponentMapByName(request.getPdiDetectionRulesId(), componentNames);
|
||||||
|
|
||||||
List<QmsPdiComponentBinding> bindings = new ArrayList<>();
|
List<QmsPdiComponentBinding> bindings = new ArrayList<>();
|
||||||
|
Set<String> bindingKeys = new HashSet<>();
|
||||||
for (QmsPdiComponentBindingSaveQO.ImageBindingQO item : request.getItems()) {
|
for (QmsPdiComponentBindingSaveQO.ImageBindingQO item : request.getItems()) {
|
||||||
if (CollectionUtil.isEmpty(item.getComponents())) {
|
if (CollectionUtil.isEmpty(item.getComponents())) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -93,6 +94,10 @@ public class QmsPdiComponentBindingControllerService {
|
||||||
throw new NflgException(STATE.BusinessError, "部件名称不存在:" + component.getComponentName());
|
throw new NflgException(STATE.BusinessError, "部件名称不存在:" + component.getComponentName());
|
||||||
}
|
}
|
||||||
for (QmsPdiComponentAnagement matchedComponent : matchedComponents) {
|
for (QmsPdiComponentAnagement matchedComponent : matchedComponents) {
|
||||||
|
String bindingKey = bindingKey(item.getUploadImageId(), matchedComponent.getId(), matchedComponent.getStatus());
|
||||||
|
if (!bindingKeys.add(bindingKey)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
bindings.add(new QmsPdiComponentBinding()
|
bindings.add(new QmsPdiComponentBinding()
|
||||||
.setPdiDetectionRulesId(request.getPdiDetectionRulesId())
|
.setPdiDetectionRulesId(request.getPdiDetectionRulesId())
|
||||||
.setUploadImageId(item.getUploadImageId())
|
.setUploadImageId(item.getUploadImageId())
|
||||||
|
|
@ -409,7 +414,17 @@ public class QmsPdiComponentBindingControllerService {
|
||||||
if (StrUtil.isBlank(componentName)) {
|
if (StrUtil.isBlank(componentName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
componentMap.computeIfAbsent(componentName, ignored -> new ArrayList<>()).add(component);
|
List<QmsPdiComponentAnagement> components = componentMap.computeIfAbsent(componentName, ignored -> new ArrayList<>());
|
||||||
|
boolean exists = components.stream()
|
||||||
|
.anyMatch(item -> Objects.equals(item.getId(), component.getId())
|
||||||
|
&& Objects.equals(item.getStatus(), component.getStatus()));
|
||||||
|
if (!exists) {
|
||||||
|
components.add(component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String bindingKey(Long uploadImageId, Long componentId, Short status) {
|
||||||
|
return uploadImageId + "|" + componentId + "|" + status;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String appendNewlineIfMixedChineseEnglishEndsWithEnglish(String text) {
|
private String appendNewlineIfMixedChineseEnglishEndsWithEnglish(String text) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue