运行图发布后删除旧的派班计划

This commit is contained in:
joylink_zhangsai 2021-01-27 19:18:18 +08:00
parent ec71cf4c20
commit 447b0e861a
3 changed files with 24 additions and 7 deletions

View File

@ -9,6 +9,7 @@ import club.joylink.rtss.dao.SchedulingPlanDAO;
import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.cache.ICacheService;
import club.joylink.rtss.services.simulation.SchedulingService;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.util.VersionUtil;
import club.joylink.rtss.vo.UserVO;
@ -59,6 +60,9 @@ public class RunPlanTemplateService implements IRunPlanTemplateService {
@Autowired
private ICacheService iCacheService;
@Autowired
private SchedulingService schedulingService;
/**
* 运行图草稿发布
*
@ -105,7 +109,8 @@ public class RunPlanTemplateService implements IRunPlanTemplateService {
version.setVersion(VersionUtil.generateNext(findVersion(oldPlan.getId())));
runPlanTemplateVersionDAO.insert(version);
}
iCacheService.remove(BusinessConsts.CachePrefix.Plan + templatePlan.getId());
iCacheService.remove(BusinessConsts.CachePrefix.Plan + templatePlan.getId()); //删除运行图缓存
schedulingService.deleteByRunPlanId(templatePlan.getId());
}
@Override

View File

@ -70,4 +70,9 @@ public interface SchedulingService {
* @return
*/
SchedulingPlanNewVO queryCommonSchedulingPlanOfDay(Long mapId, LocalDate day);
/**
* 根据运行图id删除派班计划
*/
void deleteByRunPlanId(Long runPlanId);
}

View File

@ -1,5 +1,11 @@
package club.joylink.rtss.services.simulation;
import club.joylink.rtss.dao.SchedulingPlanDAO;
import club.joylink.rtss.entity.SchedulingPlan;
import club.joylink.rtss.entity.SchedulingPlanExample;
import club.joylink.rtss.services.ILoadPlanService;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.services.IRunPlanTemplateService;
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService;
@ -9,12 +15,6 @@ import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.plan.SchedulingTrainPlan;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.dao.SchedulingPlanDAO;
import club.joylink.rtss.entity.SchedulingPlan;
import club.joylink.rtss.entity.SchedulingPlanExample;
import club.joylink.rtss.services.ILoadPlanService;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.services.IRunPlanTemplateService;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.map.MapVO;
@ -269,6 +269,13 @@ public class SchedulingServiceImpl implements SchedulingService {
return null;
}
@Override
public void deleteByRunPlanId(Long runPlanId) {
SchedulingPlanExample example = new SchedulingPlanExample();
example.createCriteria().andRunPlanIdEqualTo(runPlanId);
schedulingPlanDAO.deleteByExample(example);
}
@Override
public SchedulingPlanNewVO queryUserSchedulingPlanDateFirst(Long userId, Long templateId, LocalDate date) {
SchedulingPlanExample example = new SchedulingPlanExample();