Commit 41e4a388b234f475f459c66b3d9cc55210337013
1 parent
27368090
调度预案配置
Showing
4 changed files
with
33 additions
and
2 deletions
src/main/java/com/bsth/data/zndd/AutomaticSch.java
| ... | ... | @@ -2,6 +2,7 @@ package com.bsth.data.zndd; |
| 2 | 2 | |
| 3 | 3 | import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | +import com.alibaba.fastjson.TypeReference; | |
| 5 | 6 | import com.bsth.data.BasicData; |
| 6 | 7 | import com.bsth.data.adjg.domain.LargeGap; |
| 7 | 8 | import com.bsth.data.directive.DayOfDirectives; |
| ... | ... | @@ -12,9 +13,11 @@ import com.bsth.data.schedule.ScheduleComparator; |
| 12 | 13 | import com.bsth.data.schedule.late_adjust.LateAdjustHandle; |
| 13 | 14 | import com.bsth.entity.directive.D60; |
| 14 | 15 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 16 | +import com.bsth.entity.zndd.ZnddYuAn; | |
| 15 | 17 | import com.bsth.repository.StationRouteRepository; |
| 16 | 18 | import com.bsth.service.directive.DirectiveService; |
| 17 | 19 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 20 | +import com.bsth.service.zndd.ZnddYuAnService; | |
| 18 | 21 | import com.bsth.util.HttpClientUtils; |
| 19 | 22 | import com.google.gson.Gson; |
| 20 | 23 | import org.apache.commons.lang3.StringUtils; |
| ... | ... | @@ -22,6 +25,7 @@ import org.slf4j.Logger; |
| 22 | 25 | import org.slf4j.LoggerFactory; |
| 23 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 24 | 27 | import org.springframework.stereotype.Component; |
| 28 | + | |
| 25 | 29 | import java.text.ParseException; |
| 26 | 30 | import java.text.SimpleDateFormat; |
| 27 | 31 | import java.util.*; |
| ... | ... | @@ -53,6 +57,8 @@ public class AutomaticSch { |
| 53 | 57 | carMonitor carMonitor; |
| 54 | 58 | @Autowired |
| 55 | 59 | BasicData basicData; |
| 60 | + @Autowired | |
| 61 | + ZnddYuAnService znddYuAnService; | |
| 56 | 62 | |
| 57 | 63 | Queue<Map> queue = new LinkedList<>(); |
| 58 | 64 | |
| ... | ... | @@ -442,4 +448,18 @@ public class AutomaticSch { |
| 442 | 448 | long rangeLong = (((long) (new Random().nextDouble() * (max - min)))) + min; |
| 443 | 449 | return rangeLong; |
| 444 | 450 | } |
| 451 | + | |
| 452 | + //调度预案的配置情况 | |
| 453 | + public String penum(String type, String types){ | |
| 454 | + List<ZnddYuAn> znyanList = znddYuAnService.yuanList(type,types); | |
| 455 | + for (ZnddYuAn zn : znyanList){ | |
| 456 | + Map<String, Object> jsonMap = JSON.parseObject(zn.getJsonDate(), new TypeReference<HashMap<String, Object>>() {}); | |
| 457 | + | |
| 458 | + String typetext = jsonMap.get("type").toString(); | |
| 459 | + if(type.equals("pz")){ | |
| 460 | + return typetext; | |
| 461 | + } | |
| 462 | + } | |
| 463 | + return null; | |
| 464 | + } | |
| 445 | 465 | } | ... | ... |
src/main/java/com/bsth/repository/zndd/ZnddYuAnRepository.java
| ... | ... | @@ -7,9 +7,14 @@ import org.springframework.data.jpa.repository.Modifying; |
| 7 | 7 | import org.springframework.data.jpa.repository.Query; |
| 8 | 8 | import org.springframework.stereotype.Repository; |
| 9 | 9 | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 10 | 12 | @Repository |
| 11 | 13 | public interface ZnddYuAnRepository extends BaseRepository<ZnddYuAn, Integer> { |
| 12 | 14 | @Modifying |
| 13 | 15 | @Query(value="delete from ZnddYuAn sr where sr.type = ?1") |
| 14 | 16 | void deleteType(String type); |
| 17 | + | |
| 18 | + @Query(value="select sr from ZnddYuAn sr where sr.type = ?1 and sr.types = ?2") | |
| 19 | + List<ZnddYuAn> yuanlist(String type,String types); | |
| 15 | 20 | } | ... | ... |
src/main/java/com/bsth/service/zndd/ZnddYuAnService.java
| 1 | 1 | package com.bsth.service.zndd; |
| 2 | 2 | |
| 3 | -import com.bsth.entity.GeoPremise; | |
| 4 | 3 | import com.bsth.entity.zndd.ZnddYuAn; |
| 5 | 4 | import com.bsth.service.BaseService; |
| 6 | 5 | |
| 6 | +import java.util.List; | |
| 7 | 7 | import java.util.Map; |
| 8 | 8 | |
| 9 | 9 | public interface ZnddYuAnService extends BaseService<ZnddYuAn, Integer> { |
| 10 | 10 | |
| 11 | 11 | |
| 12 | 12 | Map<String, Object> addMap(Map<String, Object> params); |
| 13 | + | |
| 14 | + | |
| 15 | + List<ZnddYuAn> yuanList(String type, String types); | |
| 13 | 16 | } | ... | ... |
src/main/java/com/bsth/service/zndd/impl/ZnddYuAnServiceImpl.java
| ... | ... | @@ -13,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 13 | 13 | import org.springframework.stereotype.Service; |
| 14 | 14 | import org.springframework.transaction.annotation.Transactional; |
| 15 | 15 | |
| 16 | -import java.util.Arrays; | |
| 17 | 16 | import java.util.HashMap; |
| 18 | 17 | import java.util.List; |
| 19 | 18 | import java.util.Map; |
| ... | ... | @@ -61,4 +60,8 @@ public class ZnddYuAnServiceImpl extends BaseServiceImpl<ZnddYuAn, Integer> impl |
| 61 | 60 | |
| 62 | 61 | return rs; |
| 63 | 62 | } |
| 63 | + | |
| 64 | + public List<ZnddYuAn> yuanList(String type,String types){ | |
| 65 | + return znddYuAnRepository.yuanlist(type, types); | |
| 66 | + } | |
| 64 | 67 | } | ... | ... |