Commit e80841473dece308a68d46f9abba66add6586566
1 parent
7a72d561
update
Showing
29 changed files
with
1052 additions
and
38 deletions
src/main/java/com/bsth/controller/forecast/SampleController.java
0 → 100644
| 1 | +package com.bsth.controller.forecast; | |
| 2 | + | |
| 3 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 4 | +import org.springframework.web.bind.annotation.RestController; | |
| 5 | + | |
| 6 | +import com.bsth.controller.BaseController; | |
| 7 | +import com.bsth.entity.forecast.Sample; | |
| 8 | + | |
| 9 | +@RestController | |
| 10 | +@RequestMapping("sample") | |
| 11 | +public class SampleController extends BaseController<Sample, Long>{ | |
| 12 | + | |
| 13 | +} | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -63,7 +63,7 @@ public class GpsRealData implements CommandLineRunner{ |
| 63 | 63 | @Override |
| 64 | 64 | public void run(String... arg0) throws Exception { |
| 65 | 65 | logger.info("gpsDataLoader,20,8"); |
| 66 | - //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 8, TimeUnit.SECONDS); | |
| 66 | + Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 8, TimeUnit.SECONDS); | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | public static GpsEntity add(GpsEntity gps) { | ... | ... |
src/main/java/com/bsth/data/pilot80/PilotReport.java
| ... | ... | @@ -283,7 +283,7 @@ public class PilotReport { |
| 283 | 283 | |
| 284 | 284 | public void clear(String lineCode){ |
| 285 | 285 | logger.info("清除 80数据 before: " + d80MultiMap.size()); |
| 286 | - d80MultiMap.removeAll(lineCode); | |
| 286 | + d80MultiMap.removeAll(Integer.parseInt(lineCode)); | |
| 287 | 287 | logger.info("清除 80数据 after: " + d80MultiMap.size()); |
| 288 | 288 | } |
| 289 | 289 | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -25,6 +25,9 @@ import com.alibaba.fastjson.JSONArray; |
| 25 | 25 | import com.bsth.Application; |
| 26 | 26 | import com.bsth.data.LineConfigData; |
| 27 | 27 | import com.bsth.data.directive.FirstScheduleCheckThread; |
| 28 | +import com.bsth.data.schedule.thread.ScheduleLateThread; | |
| 29 | +import com.bsth.data.schedule.thread.SchedulePstThread; | |
| 30 | +import com.bsth.data.schedule.thread.ScheduleRefreshThread; | |
| 28 | 31 | import com.bsth.entity.realcontrol.LineConfig; |
| 29 | 32 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 30 | 33 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| ... | ... | @@ -99,6 +102,9 @@ public class DayOfSchedule implements CommandLineRunner { |
| 99 | 102 | |
| 100 | 103 | @Autowired |
| 101 | 104 | FirstScheduleCheckThread firstScheduleCheckThread; |
| 105 | + | |
| 106 | + @Autowired | |
| 107 | + ScheduleLateThread scheduleLateThread; | |
| 102 | 108 | |
| 103 | 109 | @Override |
| 104 | 110 | public void run(String... arg0) throws Exception { |
| ... | ... | @@ -108,6 +114,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 108 | 114 | Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS); |
| 109 | 115 | //首班出场指令补发器 |
| 110 | 116 | Application.mainServices.scheduleWithFixedDelay(firstScheduleCheckThread, 60, 60, TimeUnit.SECONDS); |
| 117 | + //班次误点扫描 | |
| 118 | + Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS); | |
| 111 | 119 | } |
| 112 | 120 | |
| 113 | 121 | public Map<String, String> getCurrSchDate() { |
| ... | ... | @@ -268,6 +276,7 @@ public class DayOfSchedule implements CommandLineRunner { |
| 268 | 276 | * @Description: TODO(从计划排班表加载数据) |
| 269 | 277 | */ |
| 270 | 278 | public List<ScheduleRealInfo> loadPlanSch(String lineCode, String schDate) { |
| 279 | + logger.info("从计划排班表恢复排班,lineCode: " + lineCode + ", schDate: " + schDate); | |
| 271 | 280 | List<ScheduleRealInfo> realList = new ArrayList<>(); |
| 272 | 281 | |
| 273 | 282 | try { |
| ... | ... | @@ -580,4 +589,8 @@ public class DayOfSchedule implements CommandLineRunner { |
| 580 | 589 | public Set<String> allCar(){ |
| 581 | 590 | return nbbmScheduleMap.keySet(); |
| 582 | 591 | } |
| 592 | + | |
| 593 | + public Collection<ScheduleRealInfo> findAll(){ | |
| 594 | + return nbbmScheduleMap.values(); | |
| 595 | + } | |
| 583 | 596 | } | ... | ... |
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
src/main/java/com/bsth/data/schedule/thread/ScheduleLateThread.java
0 → 100644
| 1 | +package com.bsth.data.schedule.thread; | |
| 2 | + | |
| 3 | + | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.Collections; | |
| 6 | +import java.util.Comparator; | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.stereotype.Component; | |
| 11 | + | |
| 12 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 13 | +import com.bsth.data.schedule.ScheduleComparator; | |
| 14 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 15 | +import com.bsth.websocket.handler.SendUtils; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * | |
| 19 | + * @ClassName: ScheduleLateThread | |
| 20 | + * @Description: TODO(班次误点扫描线程) | |
| 21 | + * @author PanZhao | |
| 22 | + * @date 2016年8月31日 下午3:09:02 | |
| 23 | + * | |
| 24 | + */ | |
| 25 | +@Component | |
| 26 | +public class ScheduleLateThread extends Thread{ | |
| 27 | + | |
| 28 | + @Autowired | |
| 29 | + DayOfSchedule dayOfSchedule; | |
| 30 | + | |
| 31 | + @Autowired | |
| 32 | + SendUtils sendUtils; | |
| 33 | + | |
| 34 | + private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.FCSJ(); | |
| 35 | + | |
| 36 | + @Override | |
| 37 | + public void run() { | |
| 38 | + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()); | |
| 39 | + Collections.sort(all, cpm); | |
| 40 | + | |
| 41 | + long t = System.currentTimeMillis(); | |
| 42 | + int size = all.size(); | |
| 43 | + | |
| 44 | + ScheduleRealInfo sch; | |
| 45 | + for(int i = 0; i < size; i ++){ | |
| 46 | + sch = all.get(i); | |
| 47 | + if(sch.getDfsjT() > t) | |
| 48 | + break; | |
| 49 | + | |
| 50 | + if(sch.getStatus() == 0 && sch.getFcsjActual() == null){ | |
| 51 | + //应发未发 | |
| 52 | + sch.setLate(true); | |
| 53 | + //通知客户端 | |
| 54 | + sendUtils.refreshSch(sch); | |
| 55 | + } | |
| 56 | + } | |
| 57 | + } | |
| 58 | +} | ... | ... |
src/main/java/com/bsth/data/schedule/SchedulePstThread.java renamed to src/main/java/com/bsth/data/schedule/thread/SchedulePstThread.java
| 1 | -package com.bsth.data.schedule; | |
| 1 | +package com.bsth.data.schedule.thread; | |
| 2 | 2 | |
| 3 | 3 | import java.util.LinkedList; |
| 4 | 4 | |
| 5 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 6 | import org.springframework.stereotype.Component; |
| 7 | 7 | |
| 8 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 8 | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 9 | 10 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 10 | 11 | ... | ... |
src/main/java/com/bsth/data/schedule/ScheduleRefreshThread.java renamed to src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
| 1 | -package com.bsth.data.schedule; | |
| 1 | +package com.bsth.data.schedule.thread; | |
| 2 | 2 | |
| 3 | 3 | import java.util.Collection; |
| 4 | 4 | import java.util.Set; |
| ... | ... | @@ -13,6 +13,7 @@ import com.bsth.data.LineConfigData; |
| 13 | 13 | import com.bsth.data.arrival.ArrivalData_GPS; |
| 14 | 14 | import com.bsth.data.directive.DayOfDirectives; |
| 15 | 15 | import com.bsth.data.pilot80.PilotReport; |
| 16 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 16 | 17 | import com.bsth.entity.realcontrol.LineConfig; |
| 17 | 18 | |
| 18 | 19 | /** | ... | ... |
src/main/java/com/bsth/entity/forecast/Sample.java
0 → 100644
| 1 | +package com.bsth.entity.forecast; | |
| 2 | + | |
| 3 | + | |
| 4 | +import javax.persistence.Entity; | |
| 5 | +import javax.persistence.GeneratedValue; | |
| 6 | +import javax.persistence.Id; | |
| 7 | +import javax.persistence.Table; | |
| 8 | +import javax.persistence.Transient; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * | |
| 12 | + * @ClassName: Sample | |
| 13 | + * @Description: TODO(站点耗时预测样本) | |
| 14 | + * @author PanZhao | |
| 15 | + * @date 2016年8月31日 上午9:50:49 | |
| 16 | + * | |
| 17 | + */ | |
| 18 | +@Entity | |
| 19 | +@Table(name = "bsth_forecast_sample") | |
| 20 | +public class Sample { | |
| 21 | + | |
| 22 | + @Id | |
| 23 | + @GeneratedValue | |
| 24 | + private Long id; | |
| 25 | + | |
| 26 | + private Integer lineCode; | |
| 27 | + | |
| 28 | + // 开始时间 | |
| 29 | + private String sDate; | |
| 30 | + @Transient | |
| 31 | + private Long sTime; | |
| 32 | + | |
| 33 | + // 结束时间 | |
| 34 | + private String eDate; | |
| 35 | + @Transient | |
| 36 | + private Long eTime; | |
| 37 | + | |
| 38 | + // 开始站点 | |
| 39 | + private String sStation; | |
| 40 | + | |
| 41 | + // 结束站点 | |
| 42 | + private String eStation; | |
| 43 | + | |
| 44 | + // 0:gps分析生成, 1:人工录入 | |
| 45 | + private int type; | |
| 46 | + | |
| 47 | + private String tag; | |
| 48 | + | |
| 49 | + //行驶时间 | |
| 50 | + private Float runTime; | |
| 51 | + | |
| 52 | + private int updown; | |
| 53 | + | |
| 54 | + public Long getId() { | |
| 55 | + return id; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setId(Long id) { | |
| 59 | + this.id = id; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public String getsDate() { | |
| 63 | + return sDate; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setsDate(String sDate) { | |
| 67 | + this.sDate = sDate; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public Long getsTime() { | |
| 71 | + return sTime; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setsTime(Long sTime) { | |
| 75 | + this.sTime = sTime; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public String geteDate() { | |
| 79 | + return eDate; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void seteDate(String eDate) { | |
| 83 | + this.eDate = eDate; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public Long geteTime() { | |
| 87 | + return eTime; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void seteTime(Long eTime) { | |
| 91 | + this.eTime = eTime; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public String getsStation() { | |
| 95 | + return sStation; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setsStation(String sStation) { | |
| 99 | + this.sStation = sStation; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public String geteStation() { | |
| 103 | + return eStation; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void seteStation(String eStation) { | |
| 107 | + this.eStation = eStation; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public int getType() { | |
| 111 | + return type; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setType(int type) { | |
| 115 | + this.type = type; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public String getTag() { | |
| 119 | + return tag; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public void setTag(String tag) { | |
| 123 | + this.tag = tag; | |
| 124 | + } | |
| 125 | + | |
| 126 | + public Float getRunTime() { | |
| 127 | + return runTime; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public void setRunTime(Float runTime) { | |
| 131 | + this.runTime = runTime; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public Integer getLineCode() { | |
| 135 | + return lineCode; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public void setLineCode(Integer lineCode) { | |
| 139 | + this.lineCode = lineCode; | |
| 140 | + } | |
| 141 | + | |
| 142 | + public int getUpdown() { | |
| 143 | + return updown; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public void setUpdown(int updown) { | |
| 147 | + this.updown = updown; | |
| 148 | + } | |
| 149 | +} | ... | ... |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| ... | ... | @@ -140,7 +140,7 @@ public class ScheduleRealInfo { |
| 140 | 140 | private boolean sflj; |
| 141 | 141 | |
| 142 | 142 | /** 是否误点*/ |
| 143 | - private boolean isLate; | |
| 143 | + private boolean late; | |
| 144 | 144 | |
| 145 | 145 | /**实际里程*/ |
| 146 | 146 | private Float realMileage; |
| ... | ... | @@ -459,14 +459,6 @@ public class ScheduleRealInfo { |
| 459 | 459 | this.status = status; |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - public boolean isLate() { | |
| 463 | - return isLate; | |
| 464 | - } | |
| 465 | - | |
| 466 | - public void setLate(boolean isLate) { | |
| 467 | - this.isLate = isLate; | |
| 468 | - } | |
| 469 | - | |
| 470 | 462 | public Float getRealMileage() { |
| 471 | 463 | return realMileage; |
| 472 | 464 | } |
| ... | ... | @@ -756,4 +748,12 @@ public class ScheduleRealInfo { |
| 756 | 748 | public void setTwinsSch(ScheduleRealInfo twinsSch) { |
| 757 | 749 | this.twinsSch = twinsSch; |
| 758 | 750 | } |
| 751 | + | |
| 752 | + public boolean isLate() { | |
| 753 | + return late; | |
| 754 | + } | |
| 755 | + | |
| 756 | + public void setLate(boolean late) { | |
| 757 | + this.late = late; | |
| 758 | + } | |
| 759 | 759 | } | ... | ... |
src/main/java/com/bsth/repository/forecast/SampleRepository.java
0 → 100644
| 1 | +package com.bsth.repository.forecast; | |
| 2 | + | |
| 3 | +import org.springframework.stereotype.Repository; | |
| 4 | + | |
| 5 | +import com.bsth.entity.forecast.Sample; | |
| 6 | +import com.bsth.repository.BaseRepository; | |
| 7 | + | |
| 8 | +@Repository | |
| 9 | +public interface SampleRepository extends BaseRepository<Sample, Long>{ | |
| 10 | + | |
| 11 | +} | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveService.java
| ... | ... | @@ -4,9 +4,6 @@ package com.bsth.service.directive; |
| 4 | 4 | import java.util.List; |
| 5 | 5 | import java.util.Map; |
| 6 | 6 | |
| 7 | -import org.springframework.data.domain.Page; | |
| 8 | -import org.springframework.data.domain.PageRequest; | |
| 9 | - | |
| 10 | 7 | import com.bsth.entity.directive.D60; |
| 11 | 8 | import com.bsth.entity.directive.D64; |
| 12 | 9 | import com.bsth.entity.directive.D80; | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| ... | ... | @@ -40,6 +40,8 @@ import com.bsth.security.util.SecurityUtils; |
| 40 | 40 | import com.bsth.service.impl.BaseServiceImpl; |
| 41 | 41 | import com.bsth.util.DateUtils; |
| 42 | 42 | import com.bsth.websocket.handler.RealControlSocketHandler; |
| 43 | +import com.fasterxml.jackson.core.JsonProcessingException; | |
| 44 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
| 43 | 45 | import com.google.common.base.Splitter; |
| 44 | 46 | |
| 45 | 47 | @Service |
| ... | ... | @@ -165,10 +167,17 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 165 | 167 | */ |
| 166 | 168 | @Override |
| 167 | 169 | public void sendD60ToPage(ScheduleRealInfo sch) { |
| 168 | - JSONObject json = new JSONObject(); | |
| 169 | - json.put("fn", "directive"); | |
| 170 | - json.put("t", sch); | |
| 171 | - socketHandler.sendMessageToLine(sch.getXlBm(), json.toJSONString()); | |
| 170 | + Map<String, Object> map = new HashMap<>(); | |
| 171 | + map.put("fn", sch); | |
| 172 | + map.put("t", sch); | |
| 173 | + | |
| 174 | + ObjectMapper mapper = new ObjectMapper(); | |
| 175 | + | |
| 176 | + try { | |
| 177 | + socketHandler.sendMessageToLine(sch.getXlBm(), mapper.writeValueAsString(map)); | |
| 178 | + } catch (JsonProcessingException e) { | |
| 179 | + logger.error("", e); | |
| 180 | + } | |
| 172 | 181 | } |
| 173 | 182 | |
| 174 | 183 | @Override | ... | ... |
src/main/java/com/bsth/service/forecast/SampleService.java
0 → 100644
src/main/java/com/bsth/service/forecast/SampleServiceImpl.java
0 → 100644
src/main/java/com/bsth/service/sys/impl/ModuleServiceImpl.java
| 1 | 1 | package com.bsth.service.sys.impl; |
| 2 | 2 | |
| 3 | 3 | import java.util.ArrayList; |
| 4 | +import java.util.Collections; | |
| 5 | +import java.util.Comparator; | |
| 4 | 6 | import java.util.HashMap; |
| 5 | 7 | import java.util.HashSet; |
| 6 | 8 | import java.util.List; |
| ... | ... | @@ -8,6 +10,8 @@ import java.util.Map; |
| 8 | 10 | import java.util.Set; |
| 9 | 11 | |
| 10 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | +import org.springframework.data.domain.Sort; | |
| 14 | +import org.springframework.data.domain.Sort.Direction; | |
| 11 | 15 | import org.springframework.stereotype.Service; |
| 12 | 16 | |
| 13 | 17 | import com.bsth.common.ResponseCode; |
| ... | ... | @@ -60,7 +64,7 @@ public class ModuleServiceImpl extends BaseServiceImpl<Module, Integer> implemen |
| 60 | 64 | SysUser user = SecurityUtils.getCurrentUser(); |
| 61 | 65 | Set<Role> roles = user.getRoles(); |
| 62 | 66 | |
| 63 | - List<Module> all = (List<Module>) moduleRepository.findAll() | |
| 67 | + List<Module> all = (List<Module>) moduleRepository.findAll(new Sort(Direction.ASC, "id")) | |
| 64 | 68 | ,results = new ArrayList<>(); |
| 65 | 69 | |
| 66 | 70 | Map<Integer, Module> map = new HashMap<>(); | ... | ... |
src/main/java/com/bsth/websocket/handler/SendUtils.java
| ... | ... | @@ -155,7 +155,8 @@ public class SendUtils{ |
| 155 | 155 | try{ |
| 156 | 156 | ScheduleRealInfo twins = sch.getTwinsSch(); |
| 157 | 157 | if(twins != null |
| 158 | - && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2){ | |
| 158 | + && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2 | |
| 159 | + && twins.getBcType().equals("out")){ | |
| 159 | 160 | |
| 160 | 161 | twins.setFcsjActualAll(sch.getFcsjActualTime()); |
| 161 | 162 | //刷新关联的出场班次 |
| ... | ... | @@ -171,7 +172,8 @@ public class SendUtils{ |
| 171 | 172 | try{ |
| 172 | 173 | ScheduleRealInfo twins = sch.getTwinsSch(); |
| 173 | 174 | if(twins != null |
| 174 | - && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2){ | |
| 175 | + && lineConfigData.get(sch.getXlBm()).getOutConfig() == 2 | |
| 176 | + && twins.getBcType().equals("in")){ | |
| 175 | 177 | |
| 176 | 178 | twins.setZdsjActualAll(sch.getZdsjActualTime()); |
| 177 | 179 | //刷新关联的出场班次 | ... | ... |
src/main/resources/datatools/config-dev.properties
| ... | ... | @@ -4,13 +4,13 @@ |
| 4 | 4 | datatools.kettle_properties=/datatools/kettle.properties |
| 5 | 5 | # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正) |
| 6 | 6 | #数据库ip地址 |
| 7 | -datatools.kvars_dbip=127.0.0.1 | |
| 7 | +datatools.kvars_dbip=192.168.168.201 | |
| 8 | 8 | #数据库用户名 |
| 9 | 9 | datatools.kvars_dbuname=root |
| 10 | 10 | #数据库密码 |
| 11 | -datatools.kvars_dbpwd= | |
| 11 | +datatools.kvars_dbpwd=123456 | |
| 12 | 12 | #数据库库名 |
| 13 | -datatools.kvars_dbdname=control | |
| 13 | +datatools.kvars_dbdname=mh_control | |
| 14 | 14 | |
| 15 | 15 | # 3、上传数据配置信息 |
| 16 | 16 | # 上传文件目录配置(根据不同的环境需要修正) | ... | ... |
src/main/resources/ms-jdbc.properties
| 1 | 1 | ms.mysql.driver= com.mysql.jdbc.Driver |
| 2 | -ms.mysql.url= jdbc:mysql://192.168.168.201:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 2 | +ms.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8 | |
| 3 | 3 | ms.mysql.username= root |
| 4 | -ms.mysql.password= 123456 | |
| 4 | +ms.mysql.password= panzhao | |
| 5 | 5 | |
| 6 | 6 | #ms.mysql.driver= com.mysql.jdbc.Driver |
| 7 | 7 | #ms.mysql.url= jdbc:mysql://192.168.168.171:3306/ms?useUnicode=true&characterEncoding=utf-8 | ... | ... |
src/main/resources/static/pages/control/line/css/lineControl.css
| ... | ... | @@ -2554,6 +2554,8 @@ span.nt-coord:before{ |
| 2554 | 2554 | margin: 8px 0; |
| 2555 | 2555 | } |
| 2556 | 2556 | |
| 2557 | + | |
| 2558 | + | |
| 2557 | 2559 | tr.linjia td:nth-child(1):AFTER { |
| 2558 | 2560 | content: "\f173"; |
| 2559 | 2561 | font: normal normal normal 14px/1 FontAwesome; |
| ... | ... | @@ -2565,6 +2567,21 @@ tr.linjia td:nth-child(1):AFTER { |
| 2565 | 2567 | padding: 1px 3px 1px 3px; |
| 2566 | 2568 | background: #e7505a; |
| 2567 | 2569 | border-radius: 15px; |
| 2570 | + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12); | |
| 2571 | +} | |
| 2572 | + | |
| 2573 | +tr.child_task td:nth-child(1):AFTER{ | |
| 2574 | + content: "Z"; | |
| 2575 | + font: normal normal normal 14px/1 FontAwesome; | |
| 2576 | + position: absolute; | |
| 2577 | + right: 1px; | |
| 2578 | + bottom: 2px; | |
| 2579 | + color: #ffffff; | |
| 2580 | + padding: 1px 3px 1px 3px; | |
| 2581 | + background: #3598dc; | |
| 2582 | + border-radius: 15px; | |
| 2583 | + font-weight: bold; | |
| 2584 | + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12); | |
| 2568 | 2585 | } |
| 2569 | 2586 | |
| 2570 | 2587 | .device_event_str{ | ... | ... |
src/main/resources/static/pages/control/line/js/data.js
| ... | ... | @@ -197,10 +197,6 @@ var _data = (function(){ |
| 197 | 197 | if(!lineLpMap[lineCode][this.lpName]) |
| 198 | 198 | lineLpMap[lineCode][this.lpName] = []; |
| 199 | 199 | lineLpMap[lineCode][this.lpName].push(this); |
| 200 | - //车辆 ——> 班次数组 | |
| 201 | - /*if(!clSchMap[this.clZbh]) | |
| 202 | - clSchMap[this.clZbh] = []; | |
| 203 | - clSchMap[this.clZbh].push(this);*/ | |
| 204 | 200 | }); |
| 205 | 201 | |
| 206 | 202 | //按发车时间排序 | ... | ... |
src/main/resources/static/pages/control/line/js/rightMenu.js
| ... | ... | @@ -571,14 +571,15 @@ var _menu = (function() { |
| 571 | 571 | var params = $('form#schinfoFineTune').serializeJSON(); |
| 572 | 572 | |
| 573 | 573 | if(!customFormValidate('form#schinfoFineTune'))return; |
| 574 | - | |
| 574 | + | |
| 575 | + var loadIndex = layer.msg('操作中...', {icon: 16}); | |
| 575 | 576 | $post('/realSchedule/schInfoFineTune', params, function(rs){ |
| 576 | 577 | layer.close(index); |
| 578 | + layer.close(loadIndex); | |
| 579 | + | |
| 577 | 580 | if(rs.ts) |
| 578 | 581 | _alone.refreshScheduleArray(rs.ts); |
| 579 | 582 | |
| 580 | - /*if(rs.nextSch) | |
| 581 | - _alone.refreshSchedule(rs.nextSch);*/ | |
| 582 | 583 | }); |
| 583 | 584 | }); |
| 584 | 585 | } | ... | ... |
src/main/resources/static/pages/control/line/temps/alone_tp.html
| ... | ... | @@ -104,7 +104,7 @@ |
| 104 | 104 | <!-- 班次table --> |
| 105 | 105 | <script id="alone_plan_table_temp" type="text/html"> |
| 106 | 106 | {{each list as item i}} |
| 107 | -<tr data-id={{item.id}} class="{{if item.sflj}}linjia{{/if}}"> | |
| 107 | +<tr data-id={{item.id}} class="{{if item.sflj}}linjia{{/if}} {{if item.cTasks.length > 0}} child_task {{/if}}"> | |
| 108 | 108 | <td name="lineNo"></td> |
| 109 | 109 | <td data-name="lpName"><a href="javascript:;">{{item.lpName}}</a></td> |
| 110 | 110 | |
| ... | ... | @@ -138,7 +138,8 @@ |
| 138 | 138 | |
| 139 | 139 | {{else if item.status == 1}} |
| 140 | 140 | <td data-name="sjfcsj" class="tl-zzzx sfsj-item">{{item.fcsjActual}}<span class="fcsj-diff">{{item.fcsj_diff}}</span></td> |
| 141 | - | |
| 141 | +{{else if item.status == 0 && item.late}} | |
| 142 | + <td data-name="sjfcsj" class="tl-wd sfsj-item">{{item.fcsjActual}}<span class="fcsj-diff">{{item.fcsj_diff}}</span></td> | |
| 142 | 143 | {{else }} |
| 143 | 144 | <td data-name="sjfcsj" class="sfsj-item">{{item.fcsjActual}}<span class="fcsj-diff">{{item.fcsj_diff}}</span></td> |
| 144 | 145 | {{/if}} | ... | ... |
src/main/resources/static/pages/forecast/gps/gpsMain.html
0 → 100644
src/main/resources/static/pages/forecast/real/realForecast.html
0 → 100644
src/main/resources/static/pages/forecast/sample/css/main.css
0 → 100644
| 1 | +#lineConfigPanel{ | |
| 2 | + background: #fff; | |
| 3 | + overflow: hidden; | |
| 4 | + font-family: 'Segoe UI',Arial,'Microsoft Yahei',sans-serif !important; | |
| 5 | + min-width: 1392px; | |
| 6 | +} | |
| 7 | + | |
| 8 | +#lineConfigPanel h1{ | |
| 9 | + -webkit-margin-start: 23px; | |
| 10 | + color: rgb(92, 97, 102); | |
| 11 | + margin-bottom: 1em; | |
| 12 | + margin-top: 21px; | |
| 13 | + font-size: 1.5em; | |
| 14 | +} | |
| 15 | + | |
| 16 | +#lineConfigPanel .line_config_tree ul { | |
| 17 | + list-style-type: none; | |
| 18 | + padding: 0; | |
| 19 | + height: 100% !important; | |
| 20 | +} | |
| 21 | + | |
| 22 | +#lineConfigPanel .line_config_tree ul li{ | |
| 23 | + -webkit-border-start: 6px solid transparent; | |
| 24 | + -webkit-padding-start: 18px; | |
| 25 | + -webkit-user-select: none; | |
| 26 | + cursor: pointer; | |
| 27 | +} | |
| 28 | + | |
| 29 | +#lineConfigPanel .line_config_tree ul li.selected{ | |
| 30 | + -webkit-border-start-color: #1bbc9b; | |
| 31 | + cursor: default; | |
| 32 | + pointer-events: none; | |
| 33 | +} | |
| 34 | + | |
| 35 | +#lineConfigPanel .line_config_tree ul li button{ | |
| 36 | + background-color: white; | |
| 37 | + border: 0; | |
| 38 | + color: #999; | |
| 39 | + cursor: pointer; | |
| 40 | + font: inherit; | |
| 41 | + line-height: 1.417em; | |
| 42 | + margin: 6px 0; | |
| 43 | + padding: 0; | |
| 44 | +} | |
| 45 | + | |
| 46 | +#lineConfigPanel .line_config_tree ul li.selected button{ | |
| 47 | + color: #1bbc9b; | |
| 48 | +} | |
| 49 | + | |
| 50 | +#lineConfigPanel #trafficChart{ | |
| 51 | + display: inline-block; | |
| 52 | + width: calc(100% - 152px); | |
| 53 | + vertical-align: top; | |
| 54 | + height: 100%; | |
| 55 | +} | |
| 56 | + | |
| 57 | +#lineConfigPanel #trafficChart .sample_tags{ | |
| 58 | + width: 100%; | |
| 59 | + height: 65px; | |
| 60 | + text-align: right; | |
| 61 | + padding: 20px 40px 0; | |
| 62 | +} | |
| 63 | + | |
| 64 | +#lineConfigPanel #trafficChart .sample_tags a.tag{ | |
| 65 | + display: inline-block; | |
| 66 | + line-height: 1; | |
| 67 | + vertical-align: baseline; | |
| 68 | + background-color: #E8E8E8; | |
| 69 | + padding: .5833em .833em; | |
| 70 | + color: rgba(0,0,0,.6); | |
| 71 | + text-transform: none; | |
| 72 | + font-weight: 700; | |
| 73 | + border: 0 solid transparent; | |
| 74 | + border-radius: .28571429rem !important; | |
| 75 | + -webkit-transition: background .1s ease; | |
| 76 | + transition: background .1s ease; | |
| 77 | + font-size: .85714286rem; | |
| 78 | + margin: .8em .5em .5em 0; | |
| 79 | + font-weight: 400; | |
| 80 | +} | |
| 81 | + | |
| 82 | +#lineConfigPanel #trafficChart svg{ | |
| 83 | + width: 100%; | |
| 84 | + height: calc(100% - 65px); | |
| 85 | +} | |
| 86 | + | |
| 87 | +#lineConfigPanel #trafficChart svg circle{ | |
| 88 | + fill: #b9b7b7; | |
| 89 | + r: 6; | |
| 90 | + stroke: rgb(253, 253, 253); | |
| 91 | + stroke-width: 3; | |
| 92 | +} | |
| 93 | + | |
| 94 | +#lineConfigPanel #trafficChart svg path{ | |
| 95 | + stroke-width: 6.4px; | |
| 96 | + opacity: 0.9; | |
| 97 | + stroke: #b2afaf; | |
| 98 | + cursor: pointer; | |
| 99 | +} | |
| 100 | + | |
| 101 | +#lineConfigPanel #trafficChart svg path.active{ | |
| 102 | + stroke: #1bbc9b; | |
| 103 | +} | |
| 104 | + | |
| 105 | +#lineConfigPanel #trafficChart svg text{ | |
| 106 | + font-size: 85%; | |
| 107 | + fill: #6b6666; | |
| 108 | + font-weight: bold; | |
| 109 | +} | |
| 110 | + | |
| 111 | +#lineConfigPanel #trafficChart .sample_tags a.tag.active{ | |
| 112 | + background-color: #1bbc9b; | |
| 113 | + color: white; | |
| 114 | +} | |
| 115 | + | |
| 116 | +.line_config_tree{ | |
| 117 | + width: 155px; | |
| 118 | + float: left; | |
| 119 | + height: 100%; | |
| 120 | +} | |
| 121 | + | |
| 122 | +#lineConfigPanel .slimScrollBar{ | |
| 123 | + border-radius: 7px !important; | |
| 124 | + background: rgb(176, 173, 173) !important; | |
| 125 | + width: 4px !important; | |
| 126 | +} | |
| 127 | + | |
| 128 | +.line_config_content{ | |
| 129 | + width: calc(100% - 155px); | |
| 130 | + float: left; | |
| 131 | + height: 100%; | |
| 132 | +} | |
| 133 | + | |
| 134 | +.line_config_content .body{ | |
| 135 | + height: 100% !important; | |
| 136 | + overflow: auto; | |
| 137 | + color: rgb(48, 57, 66); | |
| 138 | + overflow: hidden; | |
| 139 | +} | |
| 140 | + | |
| 141 | +.left_station_route{ | |
| 142 | + height: 100%; | |
| 143 | + width: 147px; | |
| 144 | + display: inline-block; | |
| 145 | + padding-top: 7px; | |
| 146 | +} | |
| 147 | + | |
| 148 | + .left_station_route ul{ | |
| 149 | + list-style-type: none; | |
| 150 | + padding-left: 0; | |
| 151 | +} | |
| 152 | + | |
| 153 | +.left_station_route ul li{ | |
| 154 | + -webkit-user-select: none; | |
| 155 | + margin: 8px 0; | |
| 156 | +} | |
| 157 | + | |
| 158 | +.left_station_route ul.list li:FIRST-CHILD { | |
| 159 | + margin-top: 0px; | |
| 160 | +} | |
| 161 | + | |
| 162 | +.left_station_route .tabbable-line ul li div{ | |
| 163 | + padding-left: 10px; | |
| 164 | + display: block; | |
| 165 | + white-space: nowrap; | |
| 166 | + overflow: hidden; | |
| 167 | + text-overflow: ellipsis; | |
| 168 | +} | |
| 169 | + | |
| 170 | +.left_station_route .tabbable-line ul li div a{ | |
| 171 | + color: #605f5f; | |
| 172 | + text-decoration: none; | |
| 173 | +} | |
| 174 | + | |
| 175 | +.left_station_route ul.list li:FIRST-CHILD div a{ | |
| 176 | + cursor: default; | |
| 177 | + color: #bbbaba; | |
| 178 | +} | |
| 179 | + | |
| 180 | +.left_station_route .tabbable-line .tab-content{ | |
| 181 | + height: 100% !important; | |
| 182 | + padding: 20px 0 0; | |
| 183 | +} | |
| 184 | + | |
| 185 | +rect.station_rect{ | |
| 186 | + fill: #949595; | |
| 187 | + height: 24px; | |
| 188 | + rx: 3px; | |
| 189 | +} | |
| 190 | + | |
| 191 | +rect.f_rect{ | |
| 192 | + height: 20px; | |
| 193 | + fill: #32c2a5; | |
| 194 | + rx: 3px; | |
| 195 | +} | |
| 196 | + | |
| 197 | +#lineConfigPanel #trafficChart svg text.f_text{ | |
| 198 | + fill: #ffffff; | |
| 199 | +} | |
| 200 | + | |
| 201 | +.select2-container--open{ | |
| 202 | + z-index: 100000000; | |
| 203 | +} | |
| 0 | 204 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/forecast/sample/js/svg.js
0 → 100644
| 1 | +var sampleSvg = (function(){ | |
| 2 | + | |
| 3 | + var rowNum = 5 | |
| 4 | + ,itemWidth = 240 | |
| 5 | + , rowHeight = 130 | |
| 6 | + , _count | |
| 7 | + , margin | |
| 8 | + , _opt | |
| 9 | + , svg | |
| 10 | + , _data; | |
| 11 | + | |
| 12 | + var stationMapp = {}; | |
| 13 | + //路由 | |
| 14 | + var routes; | |
| 15 | + //X比例尺 | |
| 16 | + var scaleX = function(d, i){ | |
| 17 | + var r = parseInt(i / rowNum) | |
| 18 | + ,x = (i % rowNum) * itemWidth; | |
| 19 | + | |
| 20 | + if(r % 2 != 0) | |
| 21 | + x = itemWidth * (rowNum - 1) - x ; | |
| 22 | + return x + margin; | |
| 23 | + } | |
| 24 | + //Y 比例尺 | |
| 25 | + var scaleY = function(d, i){ | |
| 26 | + return (parseInt(i / rowNum)) * rowHeight + 60; | |
| 27 | + }; | |
| 28 | + | |
| 29 | + var dx = function(d){return d.cx;}; | |
| 30 | + var dy = function(d){return d.cy;}; | |
| 31 | + var text = function(d){return d.stationName;} | |
| 32 | + var transform = function(d, i){ | |
| 33 | + var size = d.stationName.length | |
| 34 | + ,dx = size / 2 * 12 | |
| 35 | + ,dy = -15; | |
| 36 | + | |
| 37 | + if((i + 1) % rowNum == 1 && i != 0) | |
| 38 | + dy += 40; | |
| 39 | + return 'translate(-'+dx+', '+dy+')'; | |
| 40 | + } | |
| 41 | + | |
| 42 | + var line = d3.svg.line().x(function(d) { | |
| 43 | + return d.cx; | |
| 44 | + }).y(function(d) { | |
| 45 | + return d.cy; | |
| 46 | + }); | |
| 47 | + | |
| 48 | + var dataId = function(d, i){ | |
| 49 | + if(i >= _count - 1) | |
| 50 | + return null; | |
| 51 | + else | |
| 52 | + return _opt.rts[i + 1].stationCode; | |
| 53 | + } | |
| 54 | + | |
| 55 | + function draw(opt){ | |
| 56 | + $('#trafficChart svg').remove(); | |
| 57 | + svg = d3.select('#trafficChart').append('svg'); | |
| 58 | + //容器宽度 | |
| 59 | + var width = $('#trafficChart svg').width(); | |
| 60 | + margin = (width - (rowNum - 1) * itemWidth) / 2; | |
| 61 | + var rts = opt.rts | |
| 62 | + _count = rts.length; | |
| 63 | + _opt = opt; | |
| 64 | + routes = rts; | |
| 65 | + //附加坐标 | |
| 66 | + $.each(rts , function(i, obj){ | |
| 67 | + obj.cx = scaleX(obj, i); | |
| 68 | + obj.cy = scaleY(obj, i); | |
| 69 | + stationMapp[obj.stationCode] = obj.stationName; | |
| 70 | + }); | |
| 71 | + | |
| 72 | + //画线 | |
| 73 | + svg.selectAll('path').data(rts) | |
| 74 | + .enter().append('path') | |
| 75 | + .attr('d', function(d, i){ | |
| 76 | + if(i == _count - 1) | |
| 77 | + return; | |
| 78 | + return line([d, rts[i + 1]]); | |
| 79 | + }) | |
| 80 | + .attr('data-id', dataId) | |
| 81 | + .attr('data-group', function(d, i){return dataId(d, i - 1) + '_' + dataId(null, i)}) | |
| 82 | + .on('click', function(){popAddModal($(this).data('id'))}); | |
| 83 | + | |
| 84 | + //画点 | |
| 85 | + svg.selectAll('circle').data(rts) | |
| 86 | + .enter().append('circle') | |
| 87 | + .attr('cx', dx) | |
| 88 | + .attr('cy', dy) | |
| 89 | + | |
| 90 | + //站点名 | |
| 91 | + drawText(rts); | |
| 92 | + //显示tags | |
| 93 | + showTags(); | |
| 94 | + } | |
| 95 | + | |
| 96 | + $('#trafficChart').on('click', '.sample_tags a.tag', function(){ | |
| 97 | + $('.sample_tags a.tag.active').removeClass('active'); | |
| 98 | + $(this).addClass('active'); | |
| 99 | + var tag = $(this).text(); | |
| 100 | + clearRunTimeE(); | |
| 101 | + //show | |
| 102 | + showRunTimeE(_data[tag]) | |
| 103 | + | |
| 104 | + }); | |
| 105 | + | |
| 106 | + function showRunTimeE(rs){ | |
| 107 | + //改变path颜色 | |
| 108 | + $.each(rs, function(){ | |
| 109 | + var group = this.sStation + '_' + this.eStation | |
| 110 | + ,path = $('#trafficChart path[data-group='+group+']') | |
| 111 | + ,d = path.attr('d'); | |
| 112 | + this.cp = analysePath(d); | |
| 113 | + path.attr('class', 'active') | |
| 114 | + .attr('data-sid', this.id); | |
| 115 | + }); | |
| 116 | + | |
| 117 | + //背景 | |
| 118 | + svg.selectAll('.f_rect') | |
| 119 | + .data(rs).enter().append('rect') | |
| 120 | + .attr('x', function(d){return d.cp[0]}) | |
| 121 | + .attr('y', function(d){return d.cp[1]}) | |
| 122 | + .attr('transform', 'translate(-4, -14)') | |
| 123 | + .attr('width', function(d){ | |
| 124 | + return (d.runTime + '').length * 7 + 20; | |
| 125 | + }) | |
| 126 | + .classed('f_rect', true); | |
| 127 | + | |
| 128 | + //时间text | |
| 129 | + svg.selectAll('.f_text') | |
| 130 | + .data(rs).enter().append('text') | |
| 131 | + .attr('x', function(d){return d.cp[0]}) | |
| 132 | + .attr('y', function(d){return d.cp[1]}) | |
| 133 | + .attr('class', 'f_text') | |
| 134 | + .text(function(d){return d.runTime + 'm'}); | |
| 135 | + } | |
| 136 | + | |
| 137 | + | |
| 138 | + function clearRunTimeE(){ | |
| 139 | + $('#trafficChart path.active').removeAttr('class'); | |
| 140 | + $('.f_rect,.f_text').remove(); | |
| 141 | + } | |
| 142 | + | |
| 143 | + function showTags(){ | |
| 144 | + //查询 耗时信息 | |
| 145 | + $.get('/sample/all', {'lineCode_eq': _opt.lineCode, 'updown_eq': _opt.updown}, function(rs){ | |
| 146 | + //按tag分组数据 | |
| 147 | + _data = {}; | |
| 148 | + var tags = '';// | |
| 149 | + $.each(rs, function(i, d){ | |
| 150 | + if(!_data[d.tag]){ | |
| 151 | + _data[d.tag] = []; | |
| 152 | + tags += '<a class="tag">'+d.tag+'</a>'; | |
| 153 | + } | |
| 154 | + _data[d.tag].push(d); | |
| 155 | + }); | |
| 156 | + $('#trafficChart .sample_tags').html(tags); | |
| 157 | + //选中第一个tag | |
| 158 | + $('#trafficChart .sample_tags a.tag:eq(0)').click(); | |
| 159 | + }); | |
| 160 | + } | |
| 161 | + | |
| 162 | + function drawText(rts){ | |
| 163 | + svg.selectAll('text').data(rts) | |
| 164 | + .enter().append('text') | |
| 165 | + .attr('x', dx) | |
| 166 | + .attr('y', dy) | |
| 167 | + .attr('transform', transform) | |
| 168 | + .text(text) | |
| 169 | + } | |
| 170 | + | |
| 171 | + var tagRange = {'早高峰': {s: '06:31', e: '08:30'}, '平峰': {s: '08:31', e: '16:00'}, '晚高峰': {s: '16:01', e: '18:00'}}; | |
| 172 | + function popAddModal(id){ | |
| 173 | + //var eid = id ,sid = prve(id); | |
| 174 | + //if(!sid)return; | |
| 175 | + | |
| 176 | + //var opts = {sid: sid, eid: eid, sName: stationMapp[sid], eName: stationMapp[eid]}; | |
| 177 | + $.get('/pages/forecast/sample/modal.html', function(rs){ | |
| 178 | + var index = layer.open({ | |
| 179 | + type: 1, | |
| 180 | + area: '550px', | |
| 181 | + content: rs, | |
| 182 | + shift: 5, | |
| 183 | + // title: '...', | |
| 184 | + success: function(){ | |
| 185 | + $('#forecast_sample_modal').trigger('init', {_opt: _opt, _data: _data, id: id}); | |
| 186 | + /*$("#addSampleForm select[name=tag]").select2({ | |
| 187 | + maximumSelectionLength: 1, | |
| 188 | + tags: true | |
| 189 | + }) | |
| 190 | + .on('change', function(){ | |
| 191 | + var t = $(this).val(); | |
| 192 | + if(tagRange[t]){ | |
| 193 | + $("#addSampleForm input[name=sDate]").val(tagRange[t].s); | |
| 194 | + $("#addSampleForm input[name=eDate]").val(tagRange[t].e); | |
| 195 | + } | |
| 196 | + }); | |
| 197 | + | |
| 198 | + //提交 | |
| 199 | + $('#addSampleForm .confirm').on('click', function(){ | |
| 200 | + if(customFormValidate('#addSampleForm')){ | |
| 201 | + console.log(_opt); | |
| 202 | + var param = $('#addSampleForm').serializeJSON(); | |
| 203 | + param.lineCode = _opt.lineCode; | |
| 204 | + param.updown = _opt.updown; | |
| 205 | + $post('/sample', param, function(){layer.close(index);}); | |
| 206 | + } | |
| 207 | + });*/ | |
| 208 | + } | |
| 209 | + }); | |
| 210 | + }); | |
| 211 | + } | |
| 212 | + | |
| 213 | + | |
| 214 | + var drawObject = { | |
| 215 | + draw: draw , | |
| 216 | + popAddModal: popAddModal | |
| 217 | + } | |
| 218 | + | |
| 219 | + //分析path d 路径中间点 | |
| 220 | + function analysePath(d){ | |
| 221 | + d = d.replace('M', ''); | |
| 222 | + var sp = d.split('L')[0].split(',') | |
| 223 | + ,ep = d.split('L')[1].split(',') | |
| 224 | + ,cp = []; | |
| 225 | + sp[0] = parseInt(sp[0]); | |
| 226 | + sp[1] = parseInt(sp[1]); | |
| 227 | + ep[0] = parseInt(ep[0]); | |
| 228 | + ep[1] = parseInt(ep[1]); | |
| 229 | + | |
| 230 | + cp = sp; | |
| 231 | + var diff; | |
| 232 | + if(sp[0] != ep[0]){ | |
| 233 | + diff = Math.abs(sp[0] - ep[0]) / 2 - 16; | |
| 234 | + cp[0] = sp[0] > ep[0]?ep[0]+diff:sp[0]+diff; | |
| 235 | + cp[1] -= 10; | |
| 236 | + } | |
| 237 | + else if(sp[1] != ep[1]){ | |
| 238 | + diff = Math.abs(sp[1] - ep[1]) / 2; | |
| 239 | + cp[1] = sp[1] > ep[1]?ep[1]+diff:sp[1]+diff; | |
| 240 | + | |
| 241 | + cp[0] += 10; | |
| 242 | + } | |
| 243 | + return cp; | |
| 244 | + } | |
| 245 | + | |
| 246 | + /** | |
| 247 | + * 自定义表单校验 | |
| 248 | + */ | |
| 249 | + function customFormValidate(f){ | |
| 250 | + var rs = true; | |
| 251 | + //所有可见的项 | |
| 252 | + var es = $('input,select', f); | |
| 253 | + | |
| 254 | + for(var i = 0, e; e = es[i++];){ | |
| 255 | + if($(e).attr('required') && ( $(e).val() == null || $(e).val() == '')){ | |
| 256 | + if($(e).hasClass('select2-hidden-accessible')) | |
| 257 | + $(e).next().find('.select2-selection').addClass('custom-val-error'); | |
| 258 | + else | |
| 259 | + $(e).addClass('custom-val-error'); | |
| 260 | + rs = false; | |
| 261 | + } | |
| 262 | + else{ | |
| 263 | + if($(e).hasClass('select2-hidden-accessible')) | |
| 264 | + $(e).next().find('.select2-selection').removeClass('custom-val-error'); | |
| 265 | + else | |
| 266 | + $(e).removeClass('custom-val-error'); | |
| 267 | + } | |
| 268 | + } | |
| 269 | + | |
| 270 | + if(!rs){ | |
| 271 | + layer.alert('数据完整性校验失败,请检查输入项', {icon: 2, title: '操作失败', shift: 5}); | |
| 272 | + } | |
| 273 | + return rs; | |
| 274 | + } | |
| 275 | + return drawObject; | |
| 276 | +})(); | |
| 0 | 277 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/forecast/sample/main.html
0 → 100644
| 1 | +<link href="/pages/forecast/sample/css/main.css" rel="stylesheet" type="text/css" /> | |
| 2 | +<div id="lineConfigPanel"> | |
| 3 | + <div class="line_config_tree" > | |
| 4 | + <h1 >线路</h1> | |
| 5 | + <ul></ul> | |
| 6 | + </div> | |
| 7 | + | |
| 8 | + <div class="line_config_content"> | |
| 9 | + <div class="body "> | |
| 10 | + <div class="left_station_route"> | |
| 11 | + <div class="tabbable-line" style="height: 100%;"> | |
| 12 | + <ul class="nav nav-tabs "> | |
| 13 | + <li class="active"><a href="#tab_up" data-toggle="tab" | |
| 14 | + aria-expanded="true"> 上 行 </a></li> | |
| 15 | + <li class=""><a href="#tab_down" data-toggle="tab" | |
| 16 | + aria-expanded="false"> 下 行 </a></li> | |
| 17 | + </ul> | |
| 18 | + <div class="tab-content" > | |
| 19 | + <div class="tab-pane active" id="tab_up"> | |
| 20 | + <ul class="list"> | |
| 21 | + </ul> | |
| 22 | + </div> | |
| 23 | + <div class="tab-pane" id="tab_down"> | |
| 24 | + <ul class="list"> | |
| 25 | + </ul> | |
| 26 | + </div> | |
| 27 | + </div> | |
| 28 | + </div> | |
| 29 | + </div> | |
| 30 | + | |
| 31 | + <div id="trafficChart" > | |
| 32 | + <div class="sample_tags"></div> | |
| 33 | + </div> | |
| 34 | + </div> | |
| 35 | + </div> | |
| 36 | +</div> | |
| 37 | + | |
| 38 | +<script id="forecast_sample_tree_item_temp" type="text/html"> | |
| 39 | +{{each array as line }} | |
| 40 | +<li data-code={{line.lineCode}}> | |
| 41 | + <button>{{line.name}}</button> | |
| 42 | +</li> | |
| 43 | +{{/each}} | |
| 44 | +</script> | |
| 45 | + | |
| 46 | +<script id="forecast_sample_route_temp" type="text/html"> | |
| 47 | +{{each list as route i}} | |
| 48 | +<li> | |
| 49 | + <div> <a class="sample_route_item" data-id="{{route.stationCode}}">{{route.stationName}}</a><div> | |
| 50 | +</li> | |
| 51 | +{{/each}} | |
| 52 | +</script> | |
| 53 | + | |
| 54 | +<script src="/pages/forecast/sample/js/svg.js"></script> | |
| 55 | +<script> | |
| 56 | +!function(){ | |
| 57 | + //站点路由信息 | |
| 58 | + var routes = {}; | |
| 59 | + | |
| 60 | + var $panel = $('#lineConfigPanel') | |
| 61 | + ,$body = $('.line_config_content .body'); | |
| 62 | + var h = $('.page-container>.page-sidebar-wrapper>.page-sidebar').height(); | |
| 63 | + $panel.css('height', h - 18); | |
| 64 | + | |
| 65 | + //线路滚动条 | |
| 66 | + $('.line_config_tree ul').slimscroll({ | |
| 67 | + height : 'calc(100% - 68px)', | |
| 68 | + alwaysVisible : true, | |
| 69 | + opacity : .8 | |
| 70 | + }); | |
| 71 | + | |
| 72 | + //路由 | |
| 73 | + $('.left_station_route .tab-content').slimscroll({ | |
| 74 | + height : 'calc(100% - 46px)', | |
| 75 | + opacity : .8 | |
| 76 | + }); | |
| 77 | + | |
| 78 | + //上下行切换事件 | |
| 79 | + $('.left_station_route .tabbable-line ul li').on('click', function(){setTimeout(drawSvg, 300);}); | |
| 80 | + | |
| 81 | + $get('/line/all', {destroy_eq:0}, function(rs){ | |
| 82 | + var itemsHtml = template('forecast_sample_tree_item_temp', {array: rs}); | |
| 83 | + $('.line_config_tree ul').html(itemsHtml) | |
| 84 | + .find('li:eq(0)').click(); | |
| 85 | + }); | |
| 86 | + | |
| 87 | + $panel.on('click', '.line_config_tree li', function(){ | |
| 88 | + $('.line_config_tree li.selected').removeClass('selected'); | |
| 89 | + $(this).addClass('selected'); | |
| 90 | + | |
| 91 | + //显示路由信息 | |
| 92 | + showRouteInfo(); | |
| 93 | + }); | |
| 94 | + | |
| 95 | + function showRouteInfo(){ | |
| 96 | + $.get('/stationroute/all', {'line.lineCode_eq': getLineCode(), 'destroy_eq': 0} | |
| 97 | + ,function(rs){ | |
| 98 | + rs.sort(function(a, b){ | |
| 99 | + return a.stationRouteCode - b.stationRouteCode; | |
| 100 | + }); | |
| 101 | + var temp = 'forecast_sample_route_temp'; | |
| 102 | + //上下行分组 | |
| 103 | + var ups = [],downs = []; | |
| 104 | + $.each(rs, function(){ | |
| 105 | + if(this.directions == 0) | |
| 106 | + ups.push(this); | |
| 107 | + else | |
| 108 | + downs.push(this); | |
| 109 | + }); | |
| 110 | + | |
| 111 | + $('#tab_up ul').html(template(temp, {list: ups})); | |
| 112 | + $('#tab_down ul').html(template(temp, {list: downs})); | |
| 113 | + | |
| 114 | + routes.ups = ups; | |
| 115 | + routes.downs = downs; | |
| 116 | + | |
| 117 | + drawSvg(); | |
| 118 | + }); | |
| 119 | + } | |
| 120 | + | |
| 121 | + function showLoad(text){ | |
| 122 | + return layer.msg(text, {icon: 16, time: 0, shade: 0.3}); | |
| 123 | + } | |
| 124 | + | |
| 125 | + function getUpdown(){ | |
| 126 | + var activePanel = $('.left_station_route .tab-content .tab-pane.active') | |
| 127 | + ,updown = -1 | |
| 128 | + ,id = activePanel.attr('id'); | |
| 129 | + | |
| 130 | + if(id == 'tab_up') | |
| 131 | + updown = 0; | |
| 132 | + else if(id == 'tab_down') | |
| 133 | + updown = 1; | |
| 134 | + | |
| 135 | + return updown; | |
| 136 | + } | |
| 137 | + | |
| 138 | + function getLineCode(){ | |
| 139 | + return $('.line_config_tree li.selected').data('code'); | |
| 140 | + } | |
| 141 | + | |
| 142 | + function drawSvg(){ | |
| 143 | + //绘制svg | |
| 144 | + var rts = [], updown = getUpdown(); | |
| 145 | + if(updown === 0) | |
| 146 | + rts = routes.ups; | |
| 147 | + else if(updown === 1) | |
| 148 | + rts = routes.downs; | |
| 149 | + sampleSvg.draw({lineCode: getLineCode(), rts: rts, updown: getUpdown()}); | |
| 150 | + } | |
| 151 | + | |
| 152 | + $('#lineConfigPanel').on('click', '.sample_route_item', function(){ | |
| 153 | + sampleSvg.popAddModal($(this).data('id')); | |
| 154 | + }) | |
| 155 | +}(); | |
| 156 | +</script> | |
| 0 | 157 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/forecast/sample/modal.html
0 → 100644
| 1 | +<div id="forecast_sample_modal"> | |
| 2 | +</div> | |
| 3 | + | |
| 4 | +<script id="forecast_addSample_temp" type="text/html"> | |
| 5 | +<form class="form-horizontal" role="form" style="padding: 35px 25px;" id="addSampleForm"> | |
| 6 | + <input type="hidden" name="sStation" value="{{sid}}"/> | |
| 7 | + <input type="hidden" name="eStation" value="{{eid}}"/> | |
| 8 | + <div class="form-body"> | |
| 9 | + <div class="form-group"> | |
| 10 | + <label class="col-md-3 control-label">开始站:</label> | |
| 11 | + <div class="col-md-9"> | |
| 12 | + <input type="text" class="form-control " value="{{sName}}" readonly> | |
| 13 | + </div> | |
| 14 | + </div> | |
| 15 | + <div class="form-group"> | |
| 16 | + <label class="col-md-3 control-label">截止站:</label> | |
| 17 | + <div class="col-md-9"> | |
| 18 | + <input type="text" class="form-control" value="{{eName}}" readonly> | |
| 19 | + </div> | |
| 20 | + </div> | |
| 21 | + <div class="form-group"> | |
| 22 | + <label class="col-md-3 control-label">标签:</label> | |
| 23 | + <div class="col-md-9"> | |
| 24 | + <select class="form-control" name="tag" multiple required> | |
| 25 | + <option value="早高峰">早高峰</option> | |
| 26 | + <option value="平峰">平峰</option> | |
| 27 | + <option value="晚高峰">晚高峰</option> | |
| 28 | + </select> | |
| 29 | + </div> | |
| 30 | + </div> | |
| 31 | + <div class="form-group"> | |
| 32 | + <label class="col-md-3 control-label">时段:</label> | |
| 33 | + <div class="col-md-4" style="padding-right: 0;"> | |
| 34 | + <input type="time" class="form-control" name="sDate" required> | |
| 35 | + </div> | |
| 36 | + <div class="col-md-1" style="margin-top: 10px;font-size: 85%;color: gray;">至</div> | |
| 37 | + <div class="col-md-4" style="padding-left: 0;"> | |
| 38 | + <input type="time" class="form-control" name="eDate" required> | |
| 39 | + </div> | |
| 40 | + </div> | |
| 41 | + <div class="form-group"> | |
| 42 | + <label class="col-md-3 control-label">耗时(分):</label> | |
| 43 | + <div class="col-md-9"> | |
| 44 | + <input type="number" class="form-control" name="runTime" required> | |
| 45 | + </div> | |
| 46 | + </div> | |
| 47 | + </div> | |
| 48 | +<br> | |
| 49 | + <div class="form-actions"> | |
| 50 | + <div class="row"> | |
| 51 | + <div class="col-md-offset-4 col-md-8"> | |
| 52 | + <button type="button" class="btn green confirm"><i class="fa fa-check"></i> 提交</button> | |
| 53 | + <button type="button" class="btn layui-layer-close">取消</button> | |
| 54 | + </div> | |
| 55 | + </div> | |
| 56 | + </div> | |
| 57 | +</form> | |
| 58 | +</script> | |
| 59 | + | |
| 60 | +<script> | |
| 61 | +!function(){ | |
| 62 | + var _data,_opt,id; | |
| 63 | + | |
| 64 | + | |
| 65 | + $('#forecast_sample_modal').on('init', function(e, rs){ | |
| 66 | + _data = rs._data; | |
| 67 | + _opt = rs._opt; | |
| 68 | + id = rs.id; | |
| 69 | + //console.log(rs); | |
| 70 | + }); | |
| 71 | + | |
| 72 | + | |
| 73 | + function prve(that){ | |
| 74 | + for(var i = 0; i < _opt.rts.length; i ++){ | |
| 75 | + if(routes[i].stationCode == that){ | |
| 76 | + if(i == 0) | |
| 77 | + return null; | |
| 78 | + return routes[i - 1].stationCode; | |
| 79 | + } | |
| 80 | + } | |
| 81 | + | |
| 82 | + return null; | |
| 83 | + } | |
| 84 | +}(); | |
| 85 | +</script> | |
| 0 | 86 | \ No newline at end of file | ... | ... |