充电桩调度
This commit is contained in:
@@ -43,6 +43,13 @@ public class CdzThread implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
init();
|
init();
|
||||||
while (isRun) {
|
while (isRun) {
|
||||||
|
try {
|
||||||
|
dispatch();
|
||||||
|
Thread.sleep(1500);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.getMessage(),e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,7 +176,6 @@ public class CdzThread implements Runnable {
|
|||||||
/**
|
/**
|
||||||
* 创建充电任务
|
* 创建充电任务
|
||||||
*
|
*
|
||||||
* @param srgvList
|
|
||||||
*/
|
*/
|
||||||
private void createChargingInJob(List<DeviceSrgv> srgvList) {
|
private void createChargingInJob(List<DeviceSrgv> srgvList) {
|
||||||
srgvList.sort((o1, o2) -> o2.getBattery() - o1.getBattery());
|
srgvList.sort((o1, o2) -> o2.getBattery() - o1.getBattery());
|
||||||
@@ -187,7 +193,7 @@ public class CdzThread implements Runnable {
|
|||||||
DeviceCdz cdz = null;
|
DeviceCdz cdz = null;
|
||||||
Optional<DeviceCdz> min = cdzList.stream().filter(c -> c.getSzcs().equals(floor)).min((o1, o2) -> {
|
Optional<DeviceCdz> min = cdzList.stream().filter(c -> c.getSzcs().equals(floor)).min((o1, o2) -> {
|
||||||
Integer distance1 = Math.abs(o1.getSzcs());
|
Integer distance1 = Math.abs(o1.getSzcs());
|
||||||
Integer distance2 = Math.abs(floor);
|
Integer distance2 = Math.abs(o2.getSzcs());
|
||||||
return distance1 - distance2;
|
return distance1 - distance2;
|
||||||
});
|
});
|
||||||
if (min.isPresent()) {
|
if (min.isPresent()) {
|
||||||
@@ -221,7 +227,6 @@ public class CdzThread implements Runnable {
|
|||||||
/**
|
/**
|
||||||
* 创建充电任务
|
* 创建充电任务
|
||||||
*
|
*
|
||||||
* @param deviceSrgv
|
|
||||||
*/
|
*/
|
||||||
private void createChargingOutJob(DeviceSrgv deviceSrgv, DeviceCdz cdz) {
|
private void createChargingOutJob(DeviceSrgv deviceSrgv, DeviceCdz cdz) {
|
||||||
SrgvChargingJob srgvChargingJobParam = new SrgvChargingJob();
|
SrgvChargingJob srgvChargingJobParam = new SrgvChargingJob();
|
||||||
|
|||||||
Reference in New Issue
Block a user