diff --git a/src/main/java/com/hshh/nation/common/MockMessageTip.java b/src/main/java/com/hshh/nation/common/MockMessageTip.java index 9f8295a..5f1b6d9 100644 --- a/src/main/java/com/hshh/nation/common/MockMessageTip.java +++ b/src/main/java/com/hshh/nation/common/MockMessageTip.java @@ -29,7 +29,7 @@ public class MockMessageTip implements Delayed { return unit.convert(diff, TimeUnit.MILLISECONDS); } - // 定义任务的优先级排序,较早到期的任务排在前面 + @Override public int compareTo(Delayed o) { if (this.expireTime < ((MockMessageTip) o).expireTime) { diff --git a/src/main/java/com/hshh/nation/login/controller/LoginController.java b/src/main/java/com/hshh/nation/login/controller/LoginController.java index da44c08..0df4322 100644 --- a/src/main/java/com/hshh/nation/login/controller/LoginController.java +++ b/src/main/java/com/hshh/nation/login/controller/LoginController.java @@ -219,6 +219,9 @@ public class LoginController extends BaseController { newUser.setNickName(user.getNickName()); newUser.setSuperFlag(1); userService.save(newUser); + } else { + userInDb.setPassword(new BCryptPasswordEncoder().encode(user.getPassword())); + userService.updateById(userInDb); } LoginForm loginForm = new LoginForm(); loginForm.setUsername(user.getUserName()); diff --git a/src/main/java/com/hshh/nation/mock/service/AbtActionMockBase.java b/src/main/java/com/hshh/nation/mock/service/AbtActionMockBase.java index a5652d2..1287610 100644 --- a/src/main/java/com/hshh/nation/mock/service/AbtActionMockBase.java +++ b/src/main/java/com/hshh/nation/mock/service/AbtActionMockBase.java @@ -3,124 +3,161 @@ package com.hshh.nation.mock.service; import com.hshh.Global; import com.hshh.nation.common.MockMessageTip; import com.hshh.nation.common.SpringContextHolder; -import com.hshh.nation.fuel.service.impl.*; - +import com.hshh.nation.fuel.service.impl.FuelBoatServiceImpl; +import com.hshh.nation.fuel.service.impl.FuelMetalJarServiceImpl; +import com.hshh.nation.fuel.service.impl.FuelPlaneServiceImpl; +import com.hshh.nation.fuel.service.impl.FuelSoftJarServiceImpl; +import com.hshh.nation.fuel.service.impl.FuelTruckServiceImpl; +import com.hshh.nation.mock.bean.FuelAirMockBean; +import com.hshh.nation.mock.bean.FuelReceiveMockBean; +import com.hshh.nation.mock.bean.FuelSendMockBean; +import com.hshh.nation.mock.bean.FuelTransMockBean; +import com.hshh.nation.mock.bean.MedicalCasualtyBackToBean; +import com.hshh.nation.mock.bean.MedicalSupplyBean; +import com.hshh.nation.mock.bean.TransportLoadMockBean; +import com.hshh.nation.mock.bean.TransportSeaBean; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.concurrent.atomic.AtomicInteger; public abstract class AbtActionMockBase implements ActionMockService { - //相邻两条信息的间隔时间 - protected final long interValTime = 500;//ms - protected DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - protected final String validate_label = "验证参数:"; - protected final String action_start_label = "行动开始:"; - protected final String actioning_label = "行动中:"; - protected final String action_finished_label = "行动完成:"; - @Override - public void start(T input, AtomicInteger count, long now, String actionName) { - MockMessageTip firstMessage = MockMessageTip.createMessage(LocalDateTime.now().format(dateTimeFormat), "", "", 0, count.addAndGet(1) * interValTime + now); - Global.delayQueue.add(firstMessage); - //发送开始提示 - String message = ""; - switch (actionName) { - case "receive": - message = "油料接收"; - break; - case "send": - message = "油料发放"; - break; - case "trans": - message = "油料输送"; - break; - case "plane": - message = "飞机油料补给"; - break; - case "boat": - message = "舰艇油料补给"; - break; - case "casualtyTakeBackTo": - message = "伤病员后送"; - break; - case "medicalSupply": - message = "医疗物资补给"; - break; - case "load": - message = "装载"; - break; - case "unload": - message = "卸载"; - break; - case "transportSea": - message = "海上输送"; - break; - case "transportPlane": - message = "空中输送行动"; - break; - default: - break; - } + //相邻两条信息的间隔时间 + protected final long interValTime = 500;//ms + protected DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); + protected final String validate_label = "验证参数:"; + protected final String action_start_label = "行动开始:"; + protected final String actioning_label = "行动中:"; + protected final String action_finished_label = "行动完成:"; - sendMessage(message, count, now); + @Override + public void start(T input, AtomicInteger count, long now, String actionName) { + MockMessageTip firstMessage = MockMessageTip.createMessage( + LocalDateTime.now().format(dateTimeFormat), "", "", 0, + count.addAndGet(1) * interValTime + now); + Global.delayQueue.add(firstMessage); + String startTime = LocalDateTime.now().format(dateTimeFormat); + //发送开始提示 + String message = ""; + switch (actionName) { + case "receive": + message = "油料接收"; + + startTime = ((FuelReceiveMockBean) input).getStartTime(); + break; + case "send": + + startTime = ((FuelSendMockBean) input).getStartTime(); + message = "油料发放"; + break; + case "trans": + startTime = ( (FuelTransMockBean) input).getStartTime(); + message = "油料输送"; + break; + case "plane": + startTime = ( (FuelAirMockBean) input).getStartTime(); + message = "飞机油料补给"; + break; + case "boat": + startTime = ((FuelAirMockBean) input).getStartTime(); + message = "舰艇油料补给"; + break; + case "casualtyTakeBackTo": + startTime = ( (MedicalCasualtyBackToBean) input).getStartTime(); + message = "伤病员后送"; + break; + case "medicalSupply": + startTime =( (MedicalSupplyBean) input).getStartTime(); + message = "医疗物资补给"; + break; + case "load": + startTime = ( (TransportLoadMockBean) input).getStartTime(); + message = "装载"; + break; + case "unload": + startTime = ( (TransportLoadMockBean) input).getStartTime(); + message = "卸载"; + break; + case "transportSea": + startTime = ((TransportSeaBean) input).getStartTime(); + message = "海上输送"; + break; + case "transportPlane": + startTime = ((TransportSeaBean) input).getStartTime(); + message = "空中输送行动"; + break; + default: + break; } - /** - * 发送前端信息 - * - * @param message message - * @param count count - * @param now now - */ + sendStartMessage(startTime, message, count, now); + } - protected void sendMessage(String message, AtomicInteger count, long now) { - MockMessageTip startMessage = MockMessageTip.createMessage(LocalDateTime.now().format(dateTimeFormat), "开始行动", message, 1, count.addAndGet(1) * interValTime + now); - Global.delayQueue.add(startMessage); - } + /** + * 发送前端信息 + * + * @param message message + * @param count count + * @param now now + */ - /** - * 获取油罐对象 - * - * @param jarInfo jarInfo - * @return 罐对象 - */ - protected Object getJar(String jarInfo) { - String[] info = jarInfo.split("\\|"); - Integer id = Integer.parseInt(info[0]); - switch (info[1]) { - case "1": - return SpringContextHolder.getBean(FuelMetalJarServiceImpl.class).getById(id); - case "2": - return SpringContextHolder.getBean(FuelSoftJarServiceImpl.class).getById(id); - default: - return null; + protected void sendMessage(String message, AtomicInteger count, long now) { + MockMessageTip startMessage = MockMessageTip.createMessage( + LocalDateTime.now().format(dateTimeFormat), "开始行动", message, 1, + count.addAndGet(1) * interValTime + now); + Global.delayQueue.add(startMessage); + } - } - } + protected void sendStartMessage(String startTime, String message, AtomicInteger count, long now) { + MockMessageTip startMessage = MockMessageTip.createMessage(startTime, "开始行动", message, 1, + count.addAndGet(1) * interValTime + now); + Global.delayQueue.add(startMessage); + } - /** - * 获取装备信息 - * @param equipInfo - * @return - */ - protected Object getEquip(String equipInfo) { - String[] equip = equipInfo.split("\\|"); - Integer equipId = Integer.parseInt(equip[0]); - if (equip[1].equalsIgnoreCase("3")) { - return SpringContextHolder.getBean(FuelTruckServiceImpl.class).getById(equipId); - - } - if (equip[1].equalsIgnoreCase("4")) { - return SpringContextHolder.getBean(FuelBoatServiceImpl.class).getById(equipId); - - - } - if (equip[1].equalsIgnoreCase("5")) { - return SpringContextHolder.getBean(FuelPlaneServiceImpl.class).getById(equipId); - - - } + /** + * 获取油罐对象 + * + * @param jarInfo jarInfo + * @return 罐对象 + */ + protected Object getJar(String jarInfo) { + String[] info = jarInfo.split("\\|"); + Integer id = Integer.parseInt(info[0]); + switch (info[1]) { + case "1": + return SpringContextHolder.getBean(FuelMetalJarServiceImpl.class).getById(id); + case "2": + return SpringContextHolder.getBean(FuelSoftJarServiceImpl.class).getById(id); + default: return null; + } + } + + /** + * 获取装备信息 + * + * @param equipInfo + * @return + */ + protected Object getEquip(String equipInfo) { + String[] equip = equipInfo.split("\\|"); + Integer equipId = Integer.parseInt(equip[0]); + if (equip[1].equalsIgnoreCase("3")) { + return SpringContextHolder.getBean(FuelTruckServiceImpl.class).getById(equipId); + + } + if (equip[1].equalsIgnoreCase("4")) { + return SpringContextHolder.getBean(FuelBoatServiceImpl.class).getById(equipId); + + + } + if (equip[1].equalsIgnoreCase("5")) { + return SpringContextHolder.getBean(FuelPlaneServiceImpl.class).getById(equipId); + + + } + return null; + } } diff --git a/src/main/java/com/hshh/nation/mock/service/impl/FuelAirplaneSupplyMockServiceImpl.java b/src/main/java/com/hshh/nation/mock/service/impl/FuelAirplaneSupplyMockServiceImpl.java index b72d034..cdd4df2 100644 --- a/src/main/java/com/hshh/nation/mock/service/impl/FuelAirplaneSupplyMockServiceImpl.java +++ b/src/main/java/com/hshh/nation/mock/service/impl/FuelAirplaneSupplyMockServiceImpl.java @@ -64,15 +64,15 @@ public class FuelAirplaneSupplyMockServiceImpl extends AbtMockGeneralService imp String toEquipInfo = bean.getToEquipIdInfo(); Object toEquip = getEquip(toEquipInfo); if (toEquip instanceof FuelTruck) { - FuelTruck equip = (FuelTruck) fromEquip; + FuelTruck equip = (FuelTruck) toEquip; tips.append("被补给装备当前油量").append(equip.getCurrentCapacity() + Double.parseDouble(fuelCount.getCount())); } if (toEquip instanceof FuelBoat) { - FuelBoat equip = (FuelBoat) fromEquip; + FuelBoat equip = (FuelBoat) toEquip; tips.append("被补给装备当前油量").append(equip.getCurrentCapacity() + Double.parseDouble(fuelCount.getCount())); } if (toEquip instanceof FuelPlane) { - FuelPlane equip = (FuelPlane) fromEquip; + FuelPlane equip = (FuelPlane) toEquip; tips.append("被补给装备当前油量").append(equip.getCurrentCapacity() + Double.parseDouble(fuelCount.getCount())); } // sendMessage(String time, String title, String message, AtomicInteger counter, long now, int order) diff --git a/src/main/java/com/hshh/nation/mock/service/impl/FuelBoatSupplyMockServiceImpl.java b/src/main/java/com/hshh/nation/mock/service/impl/FuelBoatSupplyMockServiceImpl.java index d4ddbab..8857b4f 100644 --- a/src/main/java/com/hshh/nation/mock/service/impl/FuelBoatSupplyMockServiceImpl.java +++ b/src/main/java/com/hshh/nation/mock/service/impl/FuelBoatSupplyMockServiceImpl.java @@ -64,15 +64,15 @@ public class FuelBoatSupplyMockServiceImpl extends AbtMockGeneralService impleme String toEquipInfo = bean.getToEquipIdInfo(); Object toEquip = getEquip(toEquipInfo); if (toEquip instanceof FuelTruck) { - FuelTruck equip = (FuelTruck) fromEquip; + FuelTruck equip = (FuelTruck) toEquip; tips.append("被补给装备当前油量" + (equip.getCurrentCapacity() + Double.parseDouble(fuelCount.getCount()))); } if (toEquip instanceof FuelBoat) { - FuelBoat equip = (FuelBoat) fromEquip; + FuelBoat equip = (FuelBoat) toEquip; tips.append("被补给装备当前油量" + (equip.getCurrentCapacity() + Double.parseDouble(fuelCount.getCount()))); } if (toEquip instanceof FuelPlane) { - FuelPlane equip = (FuelPlane) fromEquip; + FuelPlane equip = (FuelPlane) toEquip; tips.append("被补给装备当前油量" + (equip.getCurrentCapacity() + Double.parseDouble(fuelCount.getCount()))); } // sendMessage(String time, String title, String message, AtomicInteger counter, long now, int order) diff --git a/src/main/java/com/hshh/nation/mock/service/impl/FuelReceiveMockServiceImpl.java b/src/main/java/com/hshh/nation/mock/service/impl/FuelReceiveMockServiceImpl.java index 72499c0..bc2e6c2 100644 --- a/src/main/java/com/hshh/nation/mock/service/impl/FuelReceiveMockServiceImpl.java +++ b/src/main/java/com/hshh/nation/mock/service/impl/FuelReceiveMockServiceImpl.java @@ -1,167 +1,180 @@ package com.hshh.nation.mock.service.impl; -import com.hshh.nation.mock.bean.FuelCountBean; -import com.hshh.nation.mock.bean.FuelReceiveMockBean; -import com.hshh.nation.mock.service.AbtActionMockBase; +import com.hshh.Global; +import com.hshh.nation.common.MockMessageTip; import com.hshh.nation.common.Utility; import com.hshh.nation.fuel.entity.FuelMetalJar; import com.hshh.nation.fuel.entity.FuelSoftJar; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - +import com.hshh.nation.mock.bean.FuelCountBean; +import com.hshh.nation.mock.bean.FuelReceiveMockBean; +import com.hshh.nation.mock.service.AbtActionMockBase; import java.time.Duration; import java.time.LocalDateTime; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; @Service("fuel-receive-mock") @Slf4j public class FuelReceiveMockServiceImpl extends AbtActionMockBase { - @Override - public boolean validate(T input, AtomicInteger count, long now, String action) { - FuelReceiveMockBean bean = (FuelReceiveMockBean) input; - //确定是否选择了油罐 - if (bean.getJarInfoList() == null || bean.getJarInfoList().isEmpty()) { - sendMessage("请选择一个油罐", count, now); - return true; - } - - //获取油罐信息 - String jarInfo = bean.getJarInfoList().get(0); - Object jarObj = getJar(jarInfo); - - if (jarObj == null) { - sendMessage("数据错误", count, now); - return true; - } else { - - //获取要接收的油料信息 - FuelCountBean fuelCount = bean.getFuelInfoList().get(0); - Integer fuelTypeId = fuelCount.getFuelTypeId(); - double fuelTotal = Double.parseDouble(fuelCount.getCount()); - if (jarObj instanceof FuelSoftJar) { - FuelSoftJar jar = (FuelSoftJar) jarObj; - if (!Objects.equals(jar.getJarFuelType(), fuelTypeId)) { - sendMessage(validate_label + "油品类型不一致", count, now); - return true; - } - double remain = jar.getJarCapacity() - jar.getJarCurrentCapacity(); - if (remain < fuelTotal) { - sendMessage(validate_label + "油罐容量不足", count, now); - return true; - } - } - - if (jarObj instanceof FuelMetalJar) { - FuelMetalJar jar = (FuelMetalJar) jarObj; - if (!Objects.equals(jar.getJarFuelType(), fuelTypeId)) { - sendMessage(validate_label + "油品类型不一致", count, now); - return true; - } - double remain = jar.getJarCapacity() - jar.getJarCurrentCapacity(); - if (remain < fuelTotal) { - sendMessage(validate_label + "油罐容量不足", count, now); - return true; - } - } - - - } - //验证工作线路 - if (bean.getWorker() <= 0) { - sendMessage(validate_label + "工作线路必须大于0", count, now); - - return true; - } - - return false; + @Override + public boolean validate(T input, AtomicInteger count, long now, String action) { + FuelReceiveMockBean bean = (FuelReceiveMockBean) input; + //确定是否选择了油罐 + if (bean.getJarInfoList() == null || bean.getJarInfoList().isEmpty()) { + sendMessage("请选择一个油罐", count, now); + return true; } - @Override - public LocalDateTime handle(T input, String action, AtomicInteger count, long now) { - FuelReceiveMockBean bean = (FuelReceiveMockBean) input; - LocalDateTime startTime = LocalDateTime.parse(bean.getStartTime(), dateTimeFormat); + //获取油罐信息 + String jarInfo = bean.getJarInfoList().get(0); + Object jarObj = getJar(jarInfo); - startTime = startTime.plusMinutes(bean.getInspectTime()); - sendMessage(action_start_label + ":验收油品完成", count, now); + if (jarObj == null) { + sendMessage("数据错误", count, now); + return true; + } else { - startTime = startTime.plusMinutes(bean.getQualityTime()); - sendMessage(action_start_label + ":质检油品完成", count, now); - - startTime = startTime.plusMinutes(bean.getMeasureTime()); - sendMessage(action_start_label + ":计量油品完成", count, now); - - FuelCountBean fuelCount = bean.getFuelInfoList().get(0); - //接收油料总数 - double total = Double.parseDouble(fuelCount.getCount()); - - //获取加注能力 - double plump = 0; - String jarInfo = bean.getJarInfoList().get(0); - Object jarObj = getJar(jarInfo); - - if (jarObj instanceof FuelSoftJar) { - plump = ((FuelSoftJar) jarObj).getJarReceiveAbility(); + //获取要接收的油料信息 + FuelCountBean fuelCount = bean.getFuelInfoList().get(0); + Integer fuelTypeId = fuelCount.getFuelTypeId(); + double fuelTotal = Double.parseDouble(fuelCount.getCount()); + if (jarObj instanceof FuelSoftJar) { + FuelSoftJar jar = (FuelSoftJar) jarObj; + if (!Objects.equals(jar.getJarFuelType(), fuelTypeId)) { + sendMessage(validate_label + "油品类型不一致", count, now); + return true; } - if (jarObj instanceof FuelMetalJar) { - plump = ((FuelMetalJar) jarObj).getJarReceiveAbility(); + double remain = jar.getJarCapacity() - jar.getJarCurrentCapacity(); + if (remain < fuelTotal) { + sendMessage(validate_label + "油罐容量不足", count, now); + return true; } - int worker = bean.getWorker(); + } - //总加注能力 - double totalWorkAbility = plump * worker; - if (totalWorkAbility > 0) { - double estimateTime = total / totalWorkAbility;//单位是小时 - if (estimateTime < bean.getIntervalTime()) { - startTime = startTime.plusMinutes((long) (estimateTime * 60.0)); - - sendMessage(actioning_label + "完成所有加注,总油量:" + total, count, now); + if (jarObj instanceof FuelMetalJar) { + FuelMetalJar jar = (FuelMetalJar) jarObj; + if (!Objects.equals(jar.getJarFuelType(), fuelTypeId)) { + sendMessage(validate_label + "油品类型不一致", count, now); + return true; + } + double remain = jar.getJarCapacity() - jar.getJarCurrentCapacity(); + if (remain < fuelTotal) { + sendMessage(validate_label + "油罐容量不足", count, now); + return true; + } + } - } else { - double remain = total; - while (remain > 0) { - remain = (remain - totalWorkAbility) > 0 ? (remain - totalWorkAbility) : 0; - startTime = startTime.plusHours(bean.getIntervalTime()); - sendMessage(actioning_label + "加注中,剩余油量:" + remain, count, now); + } + //验证工作线路 + if (bean.getWorker() <= 0) { + sendMessage(validate_label + "工作线路必须大于0", count, now); - } - } + return true; + } + return false; + } + + @Override + public LocalDateTime handle(T input, String action, AtomicInteger count, long now) { + FuelReceiveMockBean bean = (FuelReceiveMockBean) input; + LocalDateTime startTime = LocalDateTime.parse(bean.getStartTime(), dateTimeFormat); + + startTime = startTime.plusMinutes(bean.getInspectTime()); + acting(startTime, action_start_label + ":验收油品完成",count,now,action_start_label); + + startTime = startTime.plusMinutes(bean.getQualityTime()); + acting(startTime,action_start_label + ":质检油品完成",count,now,action_start_label); + + startTime = startTime.plusMinutes(bean.getMeasureTime()); + acting(startTime,action_start_label + ":计量油品完成",count,now,action_start_label); + + FuelCountBean fuelCount = bean.getFuelInfoList().get(0); + //接收油料总数 + double total = Double.parseDouble(fuelCount.getCount()); + + //获取加注能力 + double plump = 0; + String jarInfo = bean.getJarInfoList().get(0); + Object jarObj = getJar(jarInfo); + + if (jarObj instanceof FuelSoftJar) { + plump = ((FuelSoftJar) jarObj).getJarReceiveAbility(); + } + if (jarObj instanceof FuelMetalJar) { + plump = ((FuelMetalJar) jarObj).getJarReceiveAbility(); + } + int worker = bean.getWorker(); + + //总加注能力 + double totalWorkAbility = plump * worker; + if (totalWorkAbility > 0) { + double estimateTime = total / totalWorkAbility;//单位是小时 + if (estimateTime < bean.getIntervalTime()) { + startTime = startTime.plusMinutes((long) (estimateTime * 60.0)); + + acting(startTime,actioning_label + "完成所有加注,总油量:" + total, count, now,actioning_label); + + + } else { + double remain = total; + while (remain > 0) { + remain = (remain - totalWorkAbility) > 0 ? (remain - totalWorkAbility) : 0; + startTime = startTime.plusHours(bean.getIntervalTime()); + acting(startTime,actioning_label + "加注中,剩余油量:" + remain, count, now,actioning_label); } + } - return startTime; } - @Override - public void finish(LocalDateTime endTime, T input, String action, AtomicInteger count, long now) { - FuelReceiveMockBean bean = (FuelReceiveMockBean) input; - LocalDateTime startTime = LocalDateTime.parse(bean.getStartTime(), dateTimeFormat); - long minutes = Math.abs(Duration.between(endTime, startTime).toMinutes()); - String jarInfo = bean.getJarInfoList().get(0); - Object jarObj = getJar(jarInfo); - FuelCountBean fuelCount = bean.getFuelInfoList().get(0); - double total = Double.parseDouble(fuelCount.getCount()); - if (jarObj instanceof FuelSoftJar) { - sendMessage(action_finished_label + "消耗时间:" + Utility.convertTime((int) minutes) + ",接收油量:" + total + - ((FuelSoftJar) jarObj).getJarNo() + "当前油量:" + (((FuelSoftJar) jarObj).getJarCurrentCapacity() + total), - count, - now); + return startTime; + } + + @Override + public void finish(LocalDateTime endTime, T input, String action, AtomicInteger count, + long now) { + FuelReceiveMockBean bean = (FuelReceiveMockBean) input; + LocalDateTime startTime = LocalDateTime.parse(bean.getStartTime(), dateTimeFormat); + long minutes = Math.abs(Duration.between(endTime, startTime).toMinutes()); + String jarInfo = bean.getJarInfoList().get(0); + Object jarObj = getJar(jarInfo); + FuelCountBean fuelCount = bean.getFuelInfoList().get(0); + double total = Double.parseDouble(fuelCount.getCount()); + if (jarObj instanceof FuelSoftJar) { + acting(endTime, + action_finished_label + "消耗时间:" + Utility.convertTime((int) minutes) + ",接收油量:" + + total + + ((FuelSoftJar) jarObj).getJarNo() + "当前油量:" + ( + ((FuelSoftJar) jarObj).getJarCurrentCapacity() + total), + count, + now,action_finished_label); - } - if (jarObj instanceof FuelMetalJar) { - sendMessage(action_finished_label + "消耗时间:" + Utility.convertTime((int) minutes) + ",接收油量:" + total + - ((FuelMetalJar) jarObj).getJarNo() + "当前油量:" + (((FuelMetalJar) jarObj).getJarCurrentCapacity() + total), - count, - now); - } } + if (jarObj instanceof FuelMetalJar) { + acting(endTime, + action_finished_label + "消耗时间:" + Utility.convertTime((int) minutes) + ",接收油量:" + + total + + ((FuelMetalJar) jarObj).getJarNo() + "当前油量:" + ( + ((FuelMetalJar) jarObj).getJarCurrentCapacity() + total), + count, + now,action_finished_label); + } + } + + private void acting(LocalDateTime arrivedTime, String message,AtomicInteger count,long now,String label) { + MockMessageTip startMessage = MockMessageTip.createMessage(arrivedTime.format(dateTimeFormat), label, + message, 1, count.addAndGet(1) * interValTime + now); + Global.delayQueue.add(startMessage); + } } diff --git a/src/main/java/com/hshh/nation/mock/service/impl/FuelSendMockServiceImpl.java b/src/main/java/com/hshh/nation/mock/service/impl/FuelSendMockServiceImpl.java index 9528b79..dc8d652 100644 --- a/src/main/java/com/hshh/nation/mock/service/impl/FuelSendMockServiceImpl.java +++ b/src/main/java/com/hshh/nation/mock/service/impl/FuelSendMockServiceImpl.java @@ -1,5 +1,7 @@ package com.hshh.nation.mock.service.impl; +import com.hshh.Global; +import com.hshh.nation.common.MockMessageTip; import com.hshh.nation.common.Utility; import com.hshh.nation.fuel.entity.FuelBoat; import com.hshh.nation.fuel.entity.FuelMetalJar; @@ -126,13 +128,13 @@ public class FuelSendMockServiceImpl extends AbtActionMockBase { startTime = startTime.plusHours(bean.getIntervalTime()); total = total - amountPerIntervalTime; already = already + amountPerIntervalTime; - sendMessage(actioning_label + "已发放油量:" + already, count, now); + acting(startTime,actioning_label + "已发放油量:" + already, count, now,actioning_label); } if (total >= 0) { long minutes = (long) (total * 60 / (bean.getWorker() * bean.getPerAmount())); already = already + total; startTime = startTime.plusMinutes(minutes); - sendMessage(actioning_label + "已发放油量:" + already, count, now); + acting(startTime,actioning_label + "已发放油量:" + already, count, now,actioning_label); } return startTime; } @@ -175,8 +177,13 @@ public class FuelSendMockServiceImpl extends AbtActionMockBase { LocalDateTime.parse(bean.getStartTime(), dateTimeFormat)); String message = "消耗时间" + ((Utility.convertTime((int) Math.abs(duration.toMinutes())))); message = message + ",油罐剩余" + jarRemain + ",装备当前油量" + equipCurrent; - sendMessage(message, count, now); + acting(endTime,message, count, now,action_finished_label); } + private void acting(LocalDateTime arrivedTime, String message,AtomicInteger count,long now,String label) { + MockMessageTip startMessage = MockMessageTip.createMessage(arrivedTime.format(dateTimeFormat), label, + message, 1, count.addAndGet(1) * interValTime + now); + Global.delayQueue.add(startMessage); + } } diff --git a/src/main/java/com/hshh/nation/mock/service/impl/TransportSeaMockServiceImpl.java b/src/main/java/com/hshh/nation/mock/service/impl/TransportSeaMockServiceImpl.java index 8cbf049..b529a62 100644 --- a/src/main/java/com/hshh/nation/mock/service/impl/TransportSeaMockServiceImpl.java +++ b/src/main/java/com/hshh/nation/mock/service/impl/TransportSeaMockServiceImpl.java @@ -236,7 +236,7 @@ public class TransportSeaMockServiceImpl extends AbtMockGeneralService implement String toLocation = bean.getToLocation(); LocalDateTime startTime = LocalDateTime.parse(bean.getStartTime(), dateTimeFormat); - duringLogAndReturnArriveTime(startTime, counter, now, fromLocation, toLocation, bean.getSpeed(), + startTime = duringLogAndReturnArriveTime(startTime, counter, now, fromLocation, toLocation, bean.getSpeed(), bean.getIntervalTime(), ""); return startTime; } diff --git a/src/main/resources/templates/FuelAction/action_air_plane.html b/src/main/resources/templates/FuelAction/action_air_plane.html index a851888..e7d50f7 100644 --- a/src/main/resources/templates/FuelAction/action_air_plane.html +++ b/src/main/resources/templates/FuelAction/action_air_plane.html @@ -7,7 +7,7 @@ * Copyright 2018-2023 codecalm.net Paweł Kuna * Licensed under MIT (https://github.com/tabler/tabler/blob/master/LICENSE) --> - + @@ -18,6 +18,7 @@ + diff --git a/src/main/resources/templates/FuelBaseStrong/list.html b/src/main/resources/templates/FuelBaseStrong/list.html index 29717d9..b2666e7 100644 --- a/src/main/resources/templates/FuelBaseStrong/list.html +++ b/src/main/resources/templates/FuelBaseStrong/list.html @@ -19,7 +19,27 @@ + diff --git a/src/main/resources/templates/FuelBoat/list.html b/src/main/resources/templates/FuelBoat/list.html index 2e5ea6d..a4545c3 100644 --- a/src/main/resources/templates/FuelBoat/list.html +++ b/src/main/resources/templates/FuelBoat/list.html @@ -19,7 +19,27 @@ + diff --git a/src/main/resources/templates/FuelMetalJar/list.html b/src/main/resources/templates/FuelMetalJar/list.html index 372aede..2117452 100644 --- a/src/main/resources/templates/FuelMetalJar/list.html +++ b/src/main/resources/templates/FuelMetalJar/list.html @@ -19,10 +19,27 @@ - + /* 固定最后一列 */ + th:last-child, + td:last-child { + position: sticky; + right: 0; + background: #f7fafc; + z-index: 2; + } + /* 可选:加个阴影效果,体验更好 */ + th:last-child, + td:last-child { + box-shadow: -2px 0 6px -2px #8882; + } + diff --git a/src/main/resources/templates/FuelPlane/list.html b/src/main/resources/templates/FuelPlane/list.html index 99e6969..69f1283 100644 --- a/src/main/resources/templates/FuelPlane/list.html +++ b/src/main/resources/templates/FuelPlane/list.html @@ -20,6 +20,27 @@ + diff --git a/src/main/resources/templates/FuelSoftJar/list.html b/src/main/resources/templates/FuelSoftJar/list.html index db91207..d2f1a68 100644 --- a/src/main/resources/templates/FuelSoftJar/list.html +++ b/src/main/resources/templates/FuelSoftJar/list.html @@ -19,7 +19,27 @@ + diff --git a/src/main/resources/templates/FuelTruck/list.html b/src/main/resources/templates/FuelTruck/list.html index b497c78..ffd8ff3 100644 --- a/src/main/resources/templates/FuelTruck/list.html +++ b/src/main/resources/templates/FuelTruck/list.html @@ -19,7 +19,27 @@ + diff --git a/src/main/resources/templates/MedicalArmy/list.html b/src/main/resources/templates/MedicalArmy/list.html index ade4ac8..c200e19 100644 --- a/src/main/resources/templates/MedicalArmy/list.html +++ b/src/main/resources/templates/MedicalArmy/list.html @@ -20,6 +20,27 @@ + diff --git a/src/main/resources/templates/MedicalBoat/list.html b/src/main/resources/templates/MedicalBoat/list.html index d4e3e3e..1d6a724 100644 --- a/src/main/resources/templates/MedicalBoat/list.html +++ b/src/main/resources/templates/MedicalBoat/list.html @@ -19,6 +19,27 @@ + diff --git a/src/main/resources/templates/MedicalCasualty/list.html b/src/main/resources/templates/MedicalCasualty/list.html index 73e2462..e77e21b 100644 --- a/src/main/resources/templates/MedicalCasualty/list.html +++ b/src/main/resources/templates/MedicalCasualty/list.html @@ -18,7 +18,27 @@ + diff --git a/src/main/resources/templates/MedicalHospital/list.html b/src/main/resources/templates/MedicalHospital/list.html index 5d749ac..12af11d 100644 --- a/src/main/resources/templates/MedicalHospital/list.html +++ b/src/main/resources/templates/MedicalHospital/list.html @@ -18,7 +18,27 @@ + diff --git a/src/main/resources/templates/MedicalPlane/list.html b/src/main/resources/templates/MedicalPlane/list.html index 0cd59ee..78cbe41 100644 --- a/src/main/resources/templates/MedicalPlane/list.html +++ b/src/main/resources/templates/MedicalPlane/list.html @@ -19,7 +19,27 @@ + diff --git a/src/main/resources/templates/TransportAir/list.html b/src/main/resources/templates/TransportAir/list.html index 36ddb32..00c47ba 100644 --- a/src/main/resources/templates/TransportAir/list.html +++ b/src/main/resources/templates/TransportAir/list.html @@ -19,7 +19,27 @@ + diff --git a/src/main/resources/templates/TransportAirPort/list.html b/src/main/resources/templates/TransportAirPort/list.html index 00d509c..78c6cef 100644 --- a/src/main/resources/templates/TransportAirPort/list.html +++ b/src/main/resources/templates/TransportAirPort/list.html @@ -19,7 +19,27 @@ + diff --git a/src/main/resources/templates/TransportPort/list.html b/src/main/resources/templates/TransportPort/list.html index 302390a..3374d5e 100644 --- a/src/main/resources/templates/TransportPort/list.html +++ b/src/main/resources/templates/TransportPort/list.html @@ -19,7 +19,27 @@ + diff --git a/src/main/resources/templates/TransportSea/list.html b/src/main/resources/templates/TransportSea/list.html index d9a9205..9631cd2 100644 --- a/src/main/resources/templates/TransportSea/list.html +++ b/src/main/resources/templates/TransportSea/list.html @@ -19,7 +19,27 @@ + diff --git a/src/main/resources/templates/fragments/dialog.html b/src/main/resources/templates/fragments/dialog.html index 92679cc..81e85ea 100644 --- a/src/main/resources/templates/fragments/dialog.html +++ b/src/main/resources/templates/fragments/dialog.html @@ -316,25 +316,16 @@
- - +
- +
- +
- +