被检设备根据设备类型调整
This commit is contained in:
@@ -22,6 +22,8 @@ import com.njcn.gather.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.script.util.ScriptDtlsDesc;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import com.njcn.gather.type.entity.DevType;
|
||||
import com.njcn.gather.type.service.IDevTypeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -69,6 +71,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
private final IPqDevService pqDevService;
|
||||
private final PqScriptMapper pqScriptMapper;
|
||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||
private final IDevTypeService devTypeService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@@ -117,10 +120,14 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
.in(PqDev::getId, param.getDevIds())
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode())
|
||||
);
|
||||
Set<String> devTypeSet = list.stream().map(PqDev::getDevType).collect(Collectors.toSet());
|
||||
List<DevType> devTypes = devTypeService.listByIds(devTypeSet);
|
||||
|
||||
//额定电压信息
|
||||
Set<Double> voltSet = list.stream().map(PqDev::getDevVolt).collect(Collectors.toSet());
|
||||
Set<Double> voltSet = devTypes.stream().map(DevType::getDevVolt).collect(Collectors.toSet());
|
||||
//额定电流信息
|
||||
Set<Double> currSet = list.stream().map(PqDev::getDevCurr).collect(Collectors.toSet());
|
||||
Set<Double> currSet = devTypes.stream().map(DevType::getDevCurr).collect(Collectors.toSet());
|
||||
|
||||
if (voltSet.size() == 1 && currSet.size() == 1) {
|
||||
Double volt = voltSet.stream().collect(Collectors.toList()).stream().findFirst().get();
|
||||
Double curr = currSet.stream().collect(Collectors.toList()).stream().findFirst().get();
|
||||
|
||||
Reference in New Issue
Block a user