Commit 55c2a7ae2b2e339ecb646cc5ecbfbfea0c9efe25

Authored by 徐烜
1 parent 05e20a9a

update

src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
... ... @@ -21,4 +21,6 @@ public interface SchedulePlanInfoRepository extends BaseRepository<SchedulePlanI
21 21 @Query(value = "select s from SchedulePlanInfo s where scheduleDate=?1")
22 22 List<SchedulePlanInfo> findByDate(Date date);
23 23  
  24 + Long deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual(Integer xlid, Date startDate, Date endDate);
  25 +
24 26 }
... ...
src/main/java/com/bsth/service/schedule/SchedulePlanServiceImpl.java
... ... @@ -3,6 +3,7 @@ package com.bsth.service.schedule;
3 3 import com.bsth.entity.Line;
4 4 import com.bsth.entity.schedule.*;
5 5 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  6 +import com.bsth.repository.schedule.SchedulePlanInfoRepository;
6 7 import com.bsth.repository.schedule.SchedulePlanRepository;
7 8 import com.bsth.service.LineService;
8 9 import com.bsth.service.impl.BaseServiceImpl;
... ... @@ -37,6 +38,8 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl&lt;SchedulePlan, Long&gt;
37 38 private IStrategy strategy;
38 39 @Autowired
39 40 private SchedulePlanRepository schedulePlanRepository;
  41 + @Autowired
  42 + private SchedulePlanInfoRepository schedulePlanInfoRepository;
40 43  
41 44 @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
42 45 @Override
... ... @@ -79,6 +82,11 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl&lt;SchedulePlan, Long&gt;
79 82  
80 83 System.out.println(scheduleResults_output.showGuideboardDesc1());
81 84  
  85 + // 2-3、如果排班的数据之前已经有了,删除之前的数据
  86 + schedulePlanInfoRepository.deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual(
  87 + xl.getId(), schedulePlan.getScheduleFromTime(), schedulePlan.getScheduleToTime()
  88 + );
  89 +
82 90 // 3、根据规则返回,组合最后的输出数据
83 91 // 3-1、根据注入的策略服务,获取原始数据
84 92 Multimap<Long, TTInfoDetail> gbdTTinfoMaps = strategy.getGuideboardXlTTInfoDetailMaps(xl.getId()); // 路牌对应时刻明细
... ...