Commit 6359c104 authored by hkl's avatar hkl

修改代码

parent b690f3e5
...@@ -163,7 +163,7 @@ public class AnalysisAlgorithm { ...@@ -163,7 +163,7 @@ public class AnalysisAlgorithm {
BigDecimal labourCheckScore = (BigDecimal) unitDevice.get("labourCheckScore"); BigDecimal labourCheckScore = (BigDecimal) unitDevice.get("labourCheckScore");
if (labourCheckScore == null) { if (labourCheckScore == null) {
analysisBatchUnitDevice.setLabourCheck(0); analysisBatchUnitDevice.setLabourCheck(0);
analysisBatchUnitDevice.setLabourCheckScore(new BigDecimal("-1")); analysisBatchUnitDevice.setLabourCheckScore(null); // 设置空值
} else { } else {
analysisBatchUnitDevice.setLabourCheck(1); analysisBatchUnitDevice.setLabourCheck(1);
analysisBatchUnitDevice.setLabourCheckScore(labourCheckScore); analysisBatchUnitDevice.setLabourCheckScore(labourCheckScore);
...@@ -174,7 +174,7 @@ public class AnalysisAlgorithm { ...@@ -174,7 +174,7 @@ public class AnalysisAlgorithm {
BigDecimal railDeviceCheckScore = (BigDecimal) unitDevice.get("railDeviceCheckScore"); BigDecimal railDeviceCheckScore = (BigDecimal) unitDevice.get("railDeviceCheckScore");
if (null == railDeviceCheckScore) { if (null == railDeviceCheckScore) {
analysisBatchUnitDevice.setRailDeviceCheck(0); analysisBatchUnitDevice.setRailDeviceCheck(0);
analysisBatchUnitDevice.setRailDeviceCheckScore(new BigDecimal("-1")); analysisBatchUnitDevice.setRailDeviceCheckScore(null);
} else { } else {
analysisBatchUnitDevice.setRailDeviceCheck(1); analysisBatchUnitDevice.setRailDeviceCheck(1);
analysisBatchUnitDevice.setRailDeviceCheckScore(railDeviceCheckScore); analysisBatchUnitDevice.setRailDeviceCheckScore(railDeviceCheckScore);
...@@ -190,7 +190,7 @@ public class AnalysisAlgorithm { ...@@ -190,7 +190,7 @@ public class AnalysisAlgorithm {
BigDecimal railVehicleCheckScore = (BigDecimal) unitDevice.get("railVehicleCheckScore"); BigDecimal railVehicleCheckScore = (BigDecimal) unitDevice.get("railVehicleCheckScore");
if (null == railVehicleCheckScore) { if (null == railVehicleCheckScore) {
analysisBatchUnitDevice.setRailVehicleCheck(0); analysisBatchUnitDevice.setRailVehicleCheck(0);
analysisBatchUnitDevice.setRailVehicleCheckScore(new BigDecimal("-1")); analysisBatchUnitDevice.setRailVehicleCheckScore(null);
} else { } else {
analysisBatchUnitDevice.setRailVehicleCheck(1); analysisBatchUnitDevice.setRailVehicleCheck(1);
analysisBatchUnitDevice.setRailVehicleCheckScore(railVehicleCheckScore); analysisBatchUnitDevice.setRailVehicleCheckScore(railVehicleCheckScore);
...@@ -205,7 +205,7 @@ public class AnalysisAlgorithm { ...@@ -205,7 +205,7 @@ public class AnalysisAlgorithm {
BigDecimal addInstrumentCheckScore = (BigDecimal) unitDevice.get("addInstrumentCheckScore"); BigDecimal addInstrumentCheckScore = (BigDecimal) unitDevice.get("addInstrumentCheckScore");
if (null == addInstrumentCheckScore) { if (null == addInstrumentCheckScore) {
analysisBatchUnitDevice.setAddDeviceCheck(0); analysisBatchUnitDevice.setAddDeviceCheck(0);
analysisBatchUnitDevice.setAddDeviceCheckScore(new BigDecimal("-1")); analysisBatchUnitDevice.setAddDeviceCheckScore(null);
} else { } else {
analysisBatchUnitDevice.setAddDeviceCheck(1); analysisBatchUnitDevice.setAddDeviceCheck(1);
analysisBatchUnitDevice.setAddDeviceCheckScore(railVehicleCheckScore); analysisBatchUnitDevice.setAddDeviceCheckScore(railVehicleCheckScore);
...@@ -234,7 +234,7 @@ public class AnalysisAlgorithm { ...@@ -234,7 +234,7 @@ public class AnalysisAlgorithm {
} }
} }
} else { } else {
unitScore = new BigDecimal("-1"); unitScore = null;
unitScoreLevelStr = "无"; unitScoreLevelStr = "无";
unitScoreLevel = 4; unitScoreLevel = 4;
} }
...@@ -1289,11 +1289,23 @@ public class AnalysisAlgorithm { ...@@ -1289,11 +1289,23 @@ public class AnalysisAlgorithm {
List<MovementCheckDataUnitDeviceMap> movementCheckDataUnitDeviceMaps = new ArrayList<>(); List<MovementCheckDataUnitDeviceMap> movementCheckDataUnitDeviceMaps = new ArrayList<>();
// 1 获取轨检仪静态检查 // 1.1 获取轨检仪静态检查
List<RailInspectionEquipmentItem> checkItemList = railInspectionEquipmentItemService.lambdaQuery().eq(RailInspectionEquipmentItem::getRailInspectionEquipmentId, checkDataMap.getEkId()).list(); List<RailInspectionEquipmentItem> checkItemList = railInspectionEquipmentItemService.lambdaQuery()
.eq(RailInspectionEquipmentItem::getRailInspectionEquipmentId, checkDataMap.getEkId())
.orderByAsc(RailInspectionEquipmentItem::getCourseStartingMileage)
.list();
List<RailInspectionEquipmentItemDetail> checkItemItemDetailList = railInspectionEquipmentItemDetailService.lambdaQuery().eq(RailInspectionEquipmentItemDetail::getRailInspectionEquipmentId, checkDataMap.getEkId()).list(); List<RailInspectionEquipmentItemDetail> checkItemItemDetailList = railInspectionEquipmentItemDetailService.lambdaQuery().eq(RailInspectionEquipmentItemDetail::getRailInspectionEquipmentId, checkDataMap.getEkId()).list();
Map<String, List<RailInspectionEquipmentItemDetail>> checkItemItemDetailMap = checkItemItemDetailList.stream().collect(Collectors.groupingBy(RailInspectionEquipmentItemDetail::getRailInspectionEquipmentItemId)); Map<String, List<RailInspectionEquipmentItemDetail>> checkItemItemDetailMap = checkItemItemDetailList.stream().collect(Collectors.groupingBy(RailInspectionEquipmentItemDetail::getRailInspectionEquipmentItemId));
// 1.2 处理检查项目的开始-结束里程
for (RailInspectionEquipmentItem checkItem : checkItemList) {
// 1.2 处理检查项目是公里的情况
BigDecimal checkItemStartingMileage = checkItem.getCourseStartingMileage().multiply(new BigDecimal("1000"));
BigDecimal checkItemEndMileage = checkItem.getCourseEndMileage().multiply(new BigDecimal("1000"));
checkItem.setCourseStartingMileage(checkItemStartingMileage);
checkItem.setCourseEndMileage(checkItemEndMileage);
}
// 2.循环单元设备根据单元设备的中心里程落在检查项目【开始-结束】这个区间视为这个区间的单元设备第第一个就行了 // 2.循环单元设备根据单元设备的中心里程落在检查项目【开始-结束】这个区间视为这个区间的单元设备第第一个就行了
for (Map<String, Object> unitDevice : unitDeviceList) { for (Map<String, Object> unitDevice : unitDeviceList) {
...@@ -1301,16 +1313,13 @@ public class AnalysisAlgorithm { ...@@ -1301,16 +1313,13 @@ public class AnalysisAlgorithm {
BigDecimal centerMileage = Convert.toBigDecimal(unitDevice.get("centerMileage")); BigDecimal centerMileage = Convert.toBigDecimal(unitDevice.get("centerMileage"));
// 2.1 循环遍历检查项目比较【开始-结束】来映射关联关系 // 2.1 循环遍历检查项目比较【开始-结束】来映射关联关系
System.out.println("单元设备名称=" + unitDevice.get("unitCode"));
System.out.println("单元中心里程=" + centerMileage);
for (RailInspectionEquipmentItem checkItem : checkItemList) { for (RailInspectionEquipmentItem checkItem : checkItemList) {
// 1.2 处理检查项目是公里的情况 BigDecimal checkItemStartingMileage = checkItem.getCourseStartingMileage();
BigDecimal checkItemStartingMileage = checkItem.getCourseStartingMileage().multiply(new BigDecimal("1000")); BigDecimal checkItemEndMileage = checkItem.getCourseEndMileage();
checkItem.setCourseStartingMileage(checkItemStartingMileage); System.out.printf("检查项目[开始-结束]=[" + centerMileage + "-" + checkItemEndMileage + "]");
BigDecimal checkItemEndMileage = checkItem.getCourseEndMileage().multiply(new BigDecimal("1000"));
checkItem.setCourseEndMileage(checkItemEndMileage);
if (checkItemStartingMileage.compareTo(checkItemEndMileage) > 0) {
checkItemStartingMileage = checkItem.getCourseEndMileage();
checkItemEndMileage = checkItem.getCourseStartingMileage();
}
// 2.2.1 命中检查项目 // 2.2.1 命中检查项目
if (checkItemStartingMileage.compareTo(centerMileage) <= 0 && checkItemEndMileage.compareTo(centerMileage) > 0) { if (checkItemStartingMileage.compareTo(centerMileage) <= 0 && checkItemEndMileage.compareTo(centerMileage) > 0) {
...@@ -1360,6 +1369,8 @@ public class AnalysisAlgorithm { ...@@ -1360,6 +1369,8 @@ public class AnalysisAlgorithm {
break; break;
} }
} }
System.out.printf("\n\r");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment