Commit 6359c104 authored by hkl's avatar hkl

修改代码

parent b690f3e5
......@@ -163,7 +163,7 @@ public class AnalysisAlgorithm {
BigDecimal labourCheckScore = (BigDecimal) unitDevice.get("labourCheckScore");
if (labourCheckScore == null) {
analysisBatchUnitDevice.setLabourCheck(0);
analysisBatchUnitDevice.setLabourCheckScore(new BigDecimal("-1"));
analysisBatchUnitDevice.setLabourCheckScore(null); // 设置空值
} else {
analysisBatchUnitDevice.setLabourCheck(1);
analysisBatchUnitDevice.setLabourCheckScore(labourCheckScore);
......@@ -174,7 +174,7 @@ public class AnalysisAlgorithm {
BigDecimal railDeviceCheckScore = (BigDecimal) unitDevice.get("railDeviceCheckScore");
if (null == railDeviceCheckScore) {
analysisBatchUnitDevice.setRailDeviceCheck(0);
analysisBatchUnitDevice.setRailDeviceCheckScore(new BigDecimal("-1"));
analysisBatchUnitDevice.setRailDeviceCheckScore(null);
} else {
analysisBatchUnitDevice.setRailDeviceCheck(1);
analysisBatchUnitDevice.setRailDeviceCheckScore(railDeviceCheckScore);
......@@ -190,7 +190,7 @@ public class AnalysisAlgorithm {
BigDecimal railVehicleCheckScore = (BigDecimal) unitDevice.get("railVehicleCheckScore");
if (null == railVehicleCheckScore) {
analysisBatchUnitDevice.setRailVehicleCheck(0);
analysisBatchUnitDevice.setRailVehicleCheckScore(new BigDecimal("-1"));
analysisBatchUnitDevice.setRailVehicleCheckScore(null);
} else {
analysisBatchUnitDevice.setRailVehicleCheck(1);
analysisBatchUnitDevice.setRailVehicleCheckScore(railVehicleCheckScore);
......@@ -205,7 +205,7 @@ public class AnalysisAlgorithm {
BigDecimal addInstrumentCheckScore = (BigDecimal) unitDevice.get("addInstrumentCheckScore");
if (null == addInstrumentCheckScore) {
analysisBatchUnitDevice.setAddDeviceCheck(0);
analysisBatchUnitDevice.setAddDeviceCheckScore(new BigDecimal("-1"));
analysisBatchUnitDevice.setAddDeviceCheckScore(null);
} else {
analysisBatchUnitDevice.setAddDeviceCheck(1);
analysisBatchUnitDevice.setAddDeviceCheckScore(railVehicleCheckScore);
......@@ -234,7 +234,7 @@ public class AnalysisAlgorithm {
}
}
} else {
unitScore = new BigDecimal("-1");
unitScore = null;
unitScoreLevelStr = "无";
unitScoreLevel = 4;
}
......@@ -1289,11 +1289,23 @@ public class AnalysisAlgorithm {
List<MovementCheckDataUnitDeviceMap> movementCheckDataUnitDeviceMaps = new ArrayList<>();
// 1 获取轨检仪静态检查
List<RailInspectionEquipmentItem> checkItemList = railInspectionEquipmentItemService.lambdaQuery().eq(RailInspectionEquipmentItem::getRailInspectionEquipmentId, checkDataMap.getEkId()).list();
// 1.1 获取轨检仪静态检查
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();
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.循环单元设备根据单元设备的中心里程落在检查项目【开始-结束】这个区间视为这个区间的单元设备第第一个就行了
for (Map<String, Object> unitDevice : unitDeviceList) {
......@@ -1301,16 +1313,13 @@ public class AnalysisAlgorithm {
BigDecimal centerMileage = Convert.toBigDecimal(unitDevice.get("centerMileage"));
// 2.1 循环遍历检查项目比较【开始-结束】来映射关联关系
System.out.println("单元设备名称=" + unitDevice.get("unitCode"));
System.out.println("单元中心里程=" + centerMileage);
for (RailInspectionEquipmentItem checkItem : checkItemList) {
// 1.2 处理检查项目是公里的情况
BigDecimal checkItemStartingMileage = checkItem.getCourseStartingMileage().multiply(new BigDecimal("1000"));
checkItem.setCourseStartingMileage(checkItemStartingMileage);
BigDecimal checkItemEndMileage = checkItem.getCourseEndMileage().multiply(new BigDecimal("1000"));
checkItem.setCourseEndMileage(checkItemEndMileage);
if (checkItemStartingMileage.compareTo(checkItemEndMileage) > 0) {
checkItemStartingMileage = checkItem.getCourseEndMileage();
checkItemEndMileage = checkItem.getCourseStartingMileage();
}
BigDecimal checkItemStartingMileage = checkItem.getCourseStartingMileage();
BigDecimal checkItemEndMileage = checkItem.getCourseEndMileage();
System.out.printf("检查项目[开始-结束]=[" + centerMileage + "-" + checkItemEndMileage + "]");
// 2.2.1 命中检查项目
if (checkItemStartingMileage.compareTo(centerMileage) <= 0 && checkItemEndMileage.compareTo(centerMileage) > 0) {
......@@ -1360,6 +1369,8 @@ public class AnalysisAlgorithm {
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