Commit 2baff217ade8b6c2562ce23d07ce11bff5c82168

Authored by 徐烜
2 parents ac0795e2 e73b4f61

Merge branch 'minhang' of http://222.66.0.204:8090//panzhaov5/bsth_control into minhang

src/main/java/com/bsth/controller/BaseController.java
@@ -24,37 +24,34 @@ import java.util.List; @@ -24,37 +24,34 @@ import java.util.List;
24 import java.util.Map; 24 import java.util.Map;
25 25
26 /** 26 /**
27 - *  
28 - * @ClassName: BaseController  
29 - * @Description: TODO(基础的Controller实现)  
30 - * @author PanZhao  
31 - * @date 2016年3月17日 下午12:44:06  
32 - *  
33 * @param <T> 27 * @param <T>
34 * @param <ID> 主键类型 28 * @param <ID> 主键类型
  29 + * @author PanZhao
  30 + * @ClassName: BaseController
  31 + * @Description: TODO(基础的Controller实现)
  32 + * @date 2016年3月17日 下午12:44:06
35 */ 33 */
36 public class BaseController<T, ID extends Serializable> { 34 public class BaseController<T, ID extends Serializable> {
37 -  
38 - @Autowired  
39 - protected BaseService<T, ID> baseService; 35 +
  36 + @Autowired
  37 + protected BaseService<T, ID> baseService;
40 @Autowired 38 @Autowired
41 DataImportExportService dataImportExportService; 39 DataImportExportService dataImportExportService;
42 -  
43 - /**  
44 - *  
45 - * @Title: list  
46 - * @Description: TODO(多条件分页查询)  
47 - * @param @param map 查询条件  
48 - * @param @param page 页码  
49 - * @param @param size 每页显示数量  
50 - * @throws  
51 - */  
52 - @RequestMapping(method = RequestMethod.GET)  
53 - public Page<T> list(@RequestParam Map<String, Object> map,  
54 - @RequestParam(defaultValue = "0") int page,  
55 - @RequestParam(defaultValue = "10") int size,  
56 - @RequestParam(defaultValue = "id") String order,  
57 - @RequestParam(defaultValue = "DESC") String direction){ 40 +
  41 + /**
  42 + * @param @param map 查询条件
  43 + * @param @param page 页码
  44 + * @param @param size 每页显示数量
  45 + * @throws
  46 + * @Title: list
  47 + * @Description: TODO(多条件分页查询)
  48 + */
  49 + @RequestMapping(method = RequestMethod.GET)
  50 + public Page<T> list(@RequestParam Map<String, Object> map,
  51 + @RequestParam(defaultValue = "0") int page,
  52 + @RequestParam(defaultValue = "10") int size,
  53 + @RequestParam(defaultValue = "id") String order,
  54 + @RequestParam(defaultValue = "DESC") String direction) {
58 55
59 // 允许多个字段排序,order可以写单个字段,也可以写多个字段 56 // 允许多个字段排序,order可以写单个字段,也可以写多个字段
60 // 多个字段格式:{col1},{col2},{col3},....,{coln} 57 // 多个字段格式:{col1},{col2},{col3},....,{coln}
@@ -81,60 +78,57 @@ public class BaseController&lt;T, ID extends Serializable&gt; { @@ -81,60 +78,57 @@ public class BaseController&lt;T, ID extends Serializable&gt; {
81 } else { 78 } else {
82 throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致"); 79 throw new RuntimeException("多字段排序参数格式问题,排序顺序和字段数不一致");
83 } 80 }
84 - }  
85 -  
86 - /**  
87 - *  
88 - * @Title: list  
89 - * @Description: TODO(多条件查询)  
90 - * @param @param map  
91 - * @throws  
92 - */  
93 - @RequestMapping(value = "/all", method = RequestMethod.GET)  
94 - public Iterable<T> list(@RequestParam Map<String, Object> map){  
95 - return baseService.list(map);  
96 - }  
97 -  
98 - /**  
99 - *  
100 - * @Title: save  
101 - * @Description: TODO(持久化对象)  
102 - * @param @param t  
103 - * @param @return 设定文件  
104 - * @return Map<String,Object> {status: 1(成功),-1(失败)}  
105 - * @throws  
106 - */  
107 - @RequestMapping(method = RequestMethod.POST)  
108 - public Map<String, Object> save(T t){  
109 - return baseService.save(t);  
110 - }  
111 -  
112 - /**  
113 - *  
114 - * @Title: findById  
115 - * @Description: TODO(根据主键获取单个对象)  
116 - * @param @param id  
117 - * @throws  
118 - */  
119 - @RequestMapping(value="/{id}",method = RequestMethod.GET)  
120 - public T findById(@PathVariable("id") ID id){  
121 - return baseService.findById(id);  
122 - }  
123 -  
124 - /**  
125 - *  
126 - * @Title: delete  
127 - * @Description: TODO(根据主键删除对象)  
128 - * @param @param id  
129 - * @throws  
130 - */  
131 - @RequestMapping(value="/{id}",method = RequestMethod.DELETE)  
132 - public Map<String, Object> delete(@PathVariable("id") ID id){  
133 - return baseService.delete(id);  
134 - } 81 + }
  82 +
  83 + /**
  84 + * @param @param map
  85 + * @throws
  86 + * @Title: list
  87 + * @Description: TODO(多条件查询)
  88 + */
  89 + @RequestMapping(value = "/all", method = RequestMethod.GET)
  90 + public Iterable<T> list(@RequestParam Map<String, Object> map) {
  91 + return baseService.list(map);
  92 + }
  93 +
  94 + /**
  95 + * @param @param t
  96 + * @param @return 设定文件
  97 + * @return Map<String,Object> {status: 1(成功),-1(失败)}
  98 + * @throws
  99 + * @Title: save
  100 + * @Description: TODO(持久化对象)
  101 + */
  102 + @RequestMapping(method = RequestMethod.POST)
  103 + public Map<String, Object> save(T t) {
  104 + return baseService.save(t);
  105 + }
  106 +
  107 + /**
  108 + * @param @param id
  109 + * @throws
  110 + * @Title: findById
  111 + * @Description: TODO(根据主键获取单个对象)
  112 + */
  113 + @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  114 + public T findById(@PathVariable("id") ID id) {
  115 + return baseService.findById(id);
  116 + }
  117 +
  118 + /**
  119 + * @param @param id
  120 + * @throws
  121 + * @Title: delete
  122 + * @Description: TODO(根据主键删除对象)
  123 + */
  124 + @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
  125 + public Map<String, Object> delete(@PathVariable("id") ID id) {
  126 + return baseService.delete(id);
  127 + }
135 128
136 /** 129 /**
137 * 上传数据文件,并使用ktr转换文件导入数据。 130 * 上传数据文件,并使用ktr转换文件导入数据。
  131 + *
138 * @param file 132 * @param file
139 * @return 133 * @return
140 * @throws Exception 134 * @throws Exception
@@ -163,6 +157,7 @@ public class BaseController&lt;T, ID extends Serializable&gt; { @@ -163,6 +157,7 @@ public class BaseController&lt;T, ID extends Serializable&gt; {
163 157
164 /** 158 /**
165 * 使用ktr导出数据。 159 * 使用ktr导出数据。
  160 + *
166 * @param response 161 * @param response
167 * @throws Exception 162 * @throws Exception
168 */ 163 */
@@ -241,5 +236,5 @@ public class BaseController&lt;T, ID extends Serializable&gt; { @@ -241,5 +236,5 @@ public class BaseController&lt;T, ID extends Serializable&gt; {
241 // 默认返回异常,子类如果要使用导入功能,必须覆写此方法,指定ktr文件类路径 236 // 默认返回异常,子类如果要使用导入功能,必须覆写此方法,指定ktr文件类路径
242 throw new RuntimeException("必须override,并指定ktr classpath"); 237 throw new RuntimeException("必须override,并指定ktr classpath");
243 } 238 }
244 - 239 +
245 } 240 }
src/main/java/com/bsth/controller/gps/GpsController.java
@@ -15,77 +15,85 @@ import java.util.Map; @@ -15,77 +15,85 @@ import java.util.Map;
15 @RequestMapping("gps") 15 @RequestMapping("gps")
16 public class GpsController { 16 public class GpsController {
17 17
18 - @Autowired  
19 - GpsRealData gpsRealData;  
20 -  
21 - @Autowired  
22 - GpsService gpsService;  
23 -  
24 - @RequestMapping(value = "/real/all")  
25 - public Map<String, Object> search(@RequestParam Map<String, Object> map,  
26 - @RequestParam(defaultValue = "0") int page,  
27 - @RequestParam(defaultValue = "15") int size,  
28 - @RequestParam(defaultValue = "timestamp") String order,  
29 - @RequestParam(defaultValue = "DESC") String direction){  
30 -  
31 -  
32 - return gpsService.search(map, page, size, order, direction);  
33 - }  
34 -  
35 - @RequestMapping(value = "/real/line/{lineCode}")  
36 - public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) {  
37 - return gpsRealData.getByLine(lineCode);  
38 - }  
39 -  
40 - @RequestMapping(value = "/real/line")  
41 - public List<GpsEntity> findByLineCodes(@RequestParam String lineCodes) {  
42 - return gpsRealData.get(Splitter.on(",").splitToList(lineCodes));  
43 - }  
44 -  
45 - @RequestMapping(value = "/allDevices")  
46 - public Iterable<String> allDevices(){  
47 - return gpsRealData.allDevices();  
48 - }  
49 -  
50 - @RequestMapping(value = "/removeRealGps", method = RequestMethod.POST)  
51 - public Map<String, Object> removeRealGps(@RequestParam String device){  
52 - return gpsService.removeRealGps(device);  
53 - }  
54 -  
55 - /**  
56 - *  
57 - * @Title: history @Description: TODO(这个方法给测试页面用) @throws  
58 - */  
59 - @RequestMapping(value = "/history/{device}")  
60 - public List<Map<String, Object>> history(@PathVariable("device") String device, @RequestParam Long startTime,  
61 - @RequestParam Long endTime, @RequestParam int directions) {  
62 -  
63 - return gpsService.history(device, startTime, endTime, directions);  
64 - }  
65 -  
66 - @RequestMapping(value = "/gpsHistory/multiple")  
67 - public List<Map<String, Object>> gpsHistory(@RequestParam String[] nbbmArray, @RequestParam Long st,  
68 - @RequestParam Long et) {  
69 - return gpsService.history(nbbmArray, st, et);  
70 - } 18 + @Autowired
  19 + GpsRealData gpsRealData;
  20 +
  21 + @Autowired
  22 + GpsService gpsService;
  23 +
  24 + @RequestMapping(value = "/real/all")
  25 + public Map<String, Object> search(@RequestParam Map<String, Object> map,
  26 + @RequestParam(defaultValue = "0") int page,
  27 + @RequestParam(defaultValue = "15") int size,
  28 + @RequestParam(defaultValue = "timestamp") String order,
  29 + @RequestParam(defaultValue = "DESC") String direction) {
  30 +
  31 +
  32 + return gpsService.search(map, page, size, order, direction);
  33 + }
  34 +
  35 + @RequestMapping(value = "/real/line/{lineCode}")
  36 + public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) {
  37 + return gpsRealData.getByLine(lineCode);
  38 + }
  39 +
  40 + @RequestMapping(value = "/real/line")
  41 + public List<GpsEntity> findByLineCodes(@RequestParam String lineCodes) {
  42 + return gpsRealData.get(Splitter.on(",").splitToList(lineCodes));
  43 + }
  44 +
  45 + @RequestMapping(value = "/allDevices")
  46 + public Iterable<String> allDevices() {
  47 + return gpsRealData.allDevices();
  48 + }
  49 +
  50 + @RequestMapping(value = "/removeRealGps", method = RequestMethod.POST)
  51 + public Map<String, Object> removeRealGps(@RequestParam String device) {
  52 + return gpsService.removeRealGps(device);
  53 + }
  54 +
  55 + /**
  56 + * @Title: history @Description: TODO(这个方法给测试页面用) @throws
  57 + */
  58 + @RequestMapping(value = "/history/{device}")
  59 + public List<Map<String, Object>> history(@PathVariable("device") String device, @RequestParam Long startTime,
  60 + @RequestParam Long endTime, @RequestParam int directions) {
  61 +
  62 + return gpsService.history(device, startTime, endTime, directions);
  63 + }
  64 +
  65 + @RequestMapping(value = "/gpsHistory/multiple")
  66 + public List<Map<String, Object>> gpsHistory(@RequestParam String[] nbbmArray, @RequestParam Long st,
  67 + @RequestParam Long et) {
  68 + return gpsService.history(nbbmArray, st, et);
  69 + }
71 70
72 /*@RequestMapping(value = "/analyse/ram") 71 /*@RequestMapping(value = "/analyse/ram")
73 - public List<ArrivalInfo> ramData(@RequestParam String nbbm) { 72 + public List<ArrivalInfo> ramData(@RequestParam String nbbm) {
74 return ArrivalDataBuffer.allMap.get(nbbm); 73 return ArrivalDataBuffer.allMap.get(nbbm);
75 }*/ 74 }*/
76 75
77 - @RequestMapping(value = "/Car2DeviceId")  
78 - public Map<String, String> findCarDeviceIdMap() {  
79 - return BasicData.deviceId2NbbmMap.inverse();  
80 - }  
81 -  
82 - @RequestMapping(value = "/buffAera")  
83 - public Map<String, Object> findBuffAeraByCode(@RequestParam String code,@RequestParam String type){  
84 - return gpsService.findBuffAeraByCode(code, type);  
85 - }  
86 -  
87 - @RequestMapping(value = "/findRoadSpeed")  
88 - public Map<String, Object> findRoadSpeed(@RequestParam String lineCode){  
89 - return gpsService.findRoadSpeed(lineCode);  
90 - } 76 + @RequestMapping(value = "/Car2DeviceId")
  77 + public Map<String, String> findCarDeviceIdMap() {
  78 + return BasicData.deviceId2NbbmMap.inverse();
  79 + }
  80 +
  81 + @RequestMapping(value = "/buffAera")
  82 + public Map<String, Object> findBuffAeraByCode(@RequestParam String code, @RequestParam String type) {
  83 + return gpsService.findBuffAeraByCode(code, type);
  84 + }
  85 +
  86 + @RequestMapping(value = "/findRoadSpeed")
  87 + public Map<String, Object> findRoadSpeed(@RequestParam String lineCode) {
  88 + return gpsService.findRoadSpeed(lineCode);
  89 + }
  90 +
  91 + /**
  92 + * gps补全
  93 + * @return
  94 + */
  95 + @RequestMapping(value = "/gpsCompletion", method = RequestMethod.POST)
  96 + public Map<String, Object> gpsCompletion(@RequestParam long schId) {
  97 + return gpsService.gpsCompletion(schId);
  98 + }
91 } 99 }
src/main/java/com/bsth/controller/realcontrol/PageForwardingController.java 0 → 100644
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.entity.sys.SysUser;
  4 +import com.bsth.security.util.SecurityUtils;
  5 +import org.springframework.stereotype.Controller;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.servlet.ModelAndView;
  8 +
  9 +/**
  10 + * 线调登入页面转发
  11 + * Created by panzhao on 2017/1/21.
  12 + */
  13 +@Controller
  14 +@RequestMapping("real_control")
  15 +public class PageForwardingController {
  16 +
  17 + @RequestMapping("/v2")
  18 + public ModelAndView v2(){
  19 + ModelAndView mv = new ModelAndView();
  20 + SysUser user = SecurityUtils.getCurrentUser();
  21 +
  22 + //班次管理员
  23 + if(user.getUserName().equals("bcgly")){
  24 + mv.setViewName("/real_control_v2/sch_manage/sch_imitate.html");
  25 + }
  26 + //正常线调主页
  27 + else
  28 + mv.setViewName("/real_control_v2/main.html");
  29 + return mv;
  30 + }
  31 +}
src/main/java/com/bsth/controller/sys/UserController.java
@@ -217,7 +217,7 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; { @@ -217,7 +217,7 @@ public class UserController extends BaseController&lt;SysUser, Integer&gt; {
217 * 确认新密码 217 * 确认新密码
218 * @return 218 * @return
219 */ 219 */
220 - @RequestMapping("/changePWD") 220 + @RequestMapping(value = "/changePWD", method = RequestMethod.POST)
221 public String changePWD(@RequestParam String oldPWD, @RequestParam String newPWD, @RequestParam String cnewPWD) { 221 public String changePWD(@RequestParam String oldPWD, @RequestParam String newPWD, @RequestParam String cnewPWD) {
222 SysUser sysUser = SecurityUtils.getCurrentUser(); 222 SysUser sysUser = SecurityUtils.getCurrentUser();
223 String msg = ""; 223 String msg = "";
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -341,6 +341,13 @@ public class DayOfSchedule implements CommandLineRunner { @@ -341,6 +341,13 @@ public class DayOfSchedule implements CommandLineRunner {
341 if (StringUtils.isEmpty(sch.getFcsj())) 341 if (StringUtils.isEmpty(sch.getFcsj()))
342 sch.setFcsj("00:00"); 342 sch.setFcsj("00:00");
343 343
  344 + if(sch.getFcsj().equals("24:00"))
  345 + sch.setFcsj("23:59");
  346 +
  347 + if(sch.getFcsj().substring(0, 2).equals("24")){
  348 + sch.setFcsj("00" + sch.getFcsj().substring(2));
  349 + }
  350 +
344 fcsj = sch.getFcsj().trim(); 351 fcsj = sch.getFcsj().trim();
345 //处理一下发车时间格式没有:号的问题 352 //处理一下发车时间格式没有:号的问题
346 if (fcsj.indexOf(":") == -1 && fcsj.length() >= 4) { 353 if (fcsj.indexOf(":") == -1 && fcsj.length() >= 4) {
@@ -823,8 +830,8 @@ public class DayOfSchedule implements CommandLineRunner { @@ -823,8 +830,8 @@ public class DayOfSchedule implements CommandLineRunner {
823 first = executeCurr(nbbm); 830 first = executeCurr(nbbm);
824 831
825 if(first.getBcType().equals("out") 832 if(first.getBcType().equals("out")
826 - && first.getDfsjT() < second.getDfsjT()  
827 - && doneSum(nbbm) == 0 && second.getDfsjT() > time) 833 + && first.getDfsjT() < second.getDfsjT()
  834 + && doneSum(nbbm) == 0 && second.getDfsjT() > time)
828 return true; 835 return true;
829 } catch (Exception e) { 836 } catch (Exception e) {
830 logger.error("", e); 837 logger.error("", e);
@@ -840,10 +847,10 @@ public class DayOfSchedule implements CommandLineRunner { @@ -840,10 +847,10 @@ public class DayOfSchedule implements CommandLineRunner {
840 847
841 public int stopTimePlan(Object task) { 848 public int stopTimePlan(Object task) {
842 849
843 - ScheduleRealInfo sch = prev((ScheduleRealInfo) task); 850 + ScheduleRealInfo sch = prev((ScheduleRealInfo) task);
844 851
845 - sch.getzdsj  
846 - return -1; 852 + sch.getzdsj
  853 + return -1;
847 }*/ 854 }*/
848 855
849 /** 856 /**
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -181,6 +181,9 @@ public class ScheduleRealInfo { @@ -181,6 +181,9 @@ public class ScheduleRealInfo {
181 //是否有GPS信号 181 //是否有GPS信号
182 private boolean online; 182 private boolean online;
183 183
  184 + /** 是否有补发GPS信号 */
  185 + private boolean reissue;
  186 +
184 public boolean isDfAuto() { 187 public boolean isDfAuto() {
185 return dfAuto; 188 return dfAuto;
186 } 189 }
@@ -819,4 +822,12 @@ public class ScheduleRealInfo { @@ -819,4 +822,12 @@ public class ScheduleRealInfo {
819 public void setAdjustExps(String adjustExps) { 822 public void setAdjustExps(String adjustExps) {
820 this.adjustExps = adjustExps; 823 this.adjustExps = adjustExps;
821 } 824 }
  825 +
  826 + public boolean isReissue() {
  827 + return reissue;
  828 + }
  829 +
  830 + public void setReissue(boolean reissue) {
  831 + this.reissue = reissue;
  832 + }
822 } 833 }
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
1 package com.bsth.repository.realcontrol; 1 package com.bsth.repository.realcontrol;
2 2
3 import com.bsth.entity.realcontrol.ScheduleRealInfo; 3 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +import com.bsth.entity.schedule.CarConfigInfo;
4 import com.bsth.repository.BaseRepository; 5 import com.bsth.repository.BaseRepository;
  6 +import org.springframework.data.domain.Page;
  7 +import org.springframework.data.domain.Pageable;
  8 +import org.springframework.data.jpa.domain.Specification;
5 import org.springframework.data.jpa.repository.EntityGraph; 9 import org.springframework.data.jpa.repository.EntityGraph;
6 import org.springframework.data.jpa.repository.Modifying; 10 import org.springframework.data.jpa.repository.Modifying;
7 import org.springframework.data.jpa.repository.Query; 11 import org.springframework.data.jpa.repository.Query;
@@ -131,4 +135,16 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -131,4 +135,16 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
131 @Query(value="select new map(xlBm as xlBm) from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm ORDER BY xlBm") 135 @Query(value="select new map(xlBm as xlBm) from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 GROUP BY xlBm ORDER BY xlBm")
132 List<Map<String,Object>> setDDRBGroup(String date); 136 List<Map<String,Object>> setDDRBGroup(String date);
133 137
  138 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  139 + @Override
  140 + Page<ScheduleRealInfo> findAll(Specification<ScheduleRealInfo> spec, Pageable pageable);
  141 +
  142 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  143 + @Override
  144 + List<ScheduleRealInfo> findAll(Specification<ScheduleRealInfo> spec);
  145 +
  146 + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH)
  147 + @Override
  148 + List<ScheduleRealInfo> findAll();
  149 +
134 } 150 }
src/main/java/com/bsth/service/gps/GpsService.java
@@ -16,4 +16,6 @@ public interface GpsService { @@ -16,4 +16,6 @@ public interface GpsService {
16 Map<String,Object> removeRealGps(String device); 16 Map<String,Object> removeRealGps(String device);
17 17
18 Map<String,Object> findRoadSpeed(String lineCode); 18 Map<String,Object> findRoadSpeed(String lineCode);
  19 +
  20 + Map<String,Object> gpsCompletion(long schId);
19 } 21 }
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
@@ -5,8 +5,11 @@ import com.bsth.data.BasicData; @@ -5,8 +5,11 @@ import com.bsth.data.BasicData;
5 import com.bsth.data.arrival.ArrivalEntity; 5 import com.bsth.data.arrival.ArrivalEntity;
6 import com.bsth.data.gpsdata.GpsEntity; 6 import com.bsth.data.gpsdata.GpsEntity;
7 import com.bsth.data.gpsdata.GpsRealData; 7 import com.bsth.data.gpsdata.GpsRealData;
  8 +import com.bsth.data.schedule.DayOfSchedule;
  9 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
8 import com.bsth.repository.CarParkRepository; 10 import com.bsth.repository.CarParkRepository;
9 import com.bsth.repository.StationRepository; 11 import com.bsth.repository.StationRepository;
  12 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
10 import com.bsth.util.DateUtils; 13 import com.bsth.util.DateUtils;
11 import com.bsth.util.TransGPS; 14 import com.bsth.util.TransGPS;
12 import com.bsth.util.TransGPS.Location; 15 import com.bsth.util.TransGPS.Location;
@@ -47,6 +50,12 @@ public class GpsServiceImpl implements GpsService { @@ -47,6 +50,12 @@ public class GpsServiceImpl implements GpsService {
47 @Autowired 50 @Autowired
48 JdbcTemplate jdbcTemplate; 51 JdbcTemplate jdbcTemplate;
49 52
  53 + @Autowired
  54 + DayOfSchedule dayOfSchedule;
  55 +
  56 + @Autowired
  57 + ScheduleRealInfoRepository scheduleRealInfoRepository;
  58 +
50 // 历史gps查询 59 // 历史gps查询
51 @Override 60 @Override
52 public List<Map<String, Object>> history(String device, Long startTime, Long endTime, int directions) { 61 public List<Map<String, Object>> history(String device, Long startTime, Long endTime, int directions) {
@@ -203,7 +212,7 @@ public class GpsServiceImpl implements GpsService { @@ -203,7 +212,7 @@ public class GpsServiceImpl implements GpsService {
203 conn = DBUtils_MS.getConnection(); 212 conn = DBUtils_MS.getConnection();
204 ps = conn.prepareStatement(sql); 213 ps = conn.prepareStatement(sql);
205 ps.setInt(1, dayOfYear); 214 ps.setInt(1, dayOfYear);
206 - /* ps.setArray(2, conn.createArrayOf("VARCHAR", devices)); */ 215 + /* ps.setArray(2, conn.createArrayOf("VARCHAR", devices)); */
207 ps.setLong(2, st * 1000); 216 ps.setLong(2, st * 1000);
208 ps.setLong(3, et * 1000); 217 ps.setLong(3, et * 1000);
209 218
@@ -411,6 +420,96 @@ public class GpsServiceImpl implements GpsService { @@ -411,6 +420,96 @@ public class GpsServiceImpl implements GpsService {
411 return rs; 420 return rs;
412 } 421 }
413 422
  423 + /**
  424 + * gps补全
  425 + *
  426 + * @param schId
  427 + * @return
  428 + */
  429 + @Override
  430 + public Map<String, Object> gpsCompletion(long schId) {
  431 + Map<String, Object> rs = new HashMap<>();
  432 +
  433 + try {
  434 + ScheduleRealInfo sch = dayOfSchedule.get(schId);
  435 + if (sch == null) {
  436 + rs.put("status", ResponseCode.ERROR);
  437 + rs.put("msg", "找不到对应班次!!!");
  438 + return rs;
  439 + }
  440 +
  441 + if(sch.isReissue()){
  442 + rs.put("status", ResponseCode.ERROR);
  443 + rs.put("msg", "你不能重复这个操作");
  444 + return rs;
  445 + }
  446 +
  447 + String sql = "select * from bsth_gps_template where line_id='" + sch.getXlBm() + "' and up_down=" + sch.getXlDir();
  448 + List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
  449 +
  450 + if(list.size() == 0){
  451 + rs.put("status", ResponseCode.ERROR);
  452 + rs.put("msg", "缺少模板数据,请联系系统管理员!!");
  453 + return rs;
  454 + }
  455 + //排序
  456 + Collections.sort(list, new Comparator<Map<String, Object>>() {
  457 + @Override
  458 + public int compare(Map<String, Object> o1, Map<String, Object> o2) {
  459 + return (int) (Long.parseLong(o1.get("ts").toString()) - Long.parseLong(o2.get("ts").toString()));
  460 + }
  461 + });
  462 + Map<String, Object> fs = list.get(0);
  463 + //替换设备号和时间
  464 + int diff = (int) (sch.getDfsjT() - Long.parseLong(fs.get("ts").toString()) - 1000 * 70);
  465 +
  466 + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(sch.getClZbh());
  467 + for(Map<String, Object> map : list){
  468 + map.put("device_id", deviceId);
  469 + map.put("ts", Long.parseLong(map.get("ts").toString()) + diff);
  470 + }
  471 +
  472 + String sqlBefore = "insert into bsth_c_template("
  473 + ,sqlValues = " values(";
  474 +
  475 + Set<String> ks = fs.keySet();
  476 + for(String k : ks){
  477 + sqlBefore += (k + ",");
  478 + sqlValues += "?,";
  479 + }
  480 + sqlBefore = sqlBefore.substring(0, sqlBefore.length() - 1) + ", create_ts)";
  481 + sqlValues = sqlValues.substring(0, sqlValues.length() - 1) + ", "+System.currentTimeMillis()+")";
  482 + sql = sqlBefore + " " + sqlValues;
  483 +
  484 + Connection conn = DBUtils_MS.getConnection();
  485 + conn.setAutoCommit(false);
  486 + ps = conn.prepareStatement(sql);
  487 + int fsize = ks.size();
  488 + List<Object> vs;
  489 + for(Map<String, Object> map : list){
  490 + vs = new ArrayList<>(map.values());
  491 + for(int i = 0; i < fsize; i ++){
  492 + ps.setObject(i + 1, vs.get(i));
  493 + }
  494 + ps.addBatch();
  495 + }
  496 + ps.executeBatch();
  497 + conn.commit();
  498 +
  499 + rs.put("status", ResponseCode.SUCCESS);
  500 +
  501 + //标记班次
  502 + sch.setReissue(true);
  503 + scheduleRealInfoRepository.save(sch);
  504 +
  505 + rs.put("status", ResponseCode.SUCCESS);
  506 + } catch (Exception e) {
  507 + logger.error("", e);
  508 + rs.put("status", ResponseCode.ERROR);
  509 + }
  510 + return rs;
  511 + }
  512 +
414 private void sortGpsList(final Field f, List<GpsEntity> rs) { 513 private void sortGpsList(final Field f, List<GpsEntity> rs) {
415 Collections.sort(rs, new Comparator<GpsEntity>() { 514 Collections.sort(rs, new Comparator<GpsEntity>() {
416 515
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -328,10 +328,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -328,10 +328,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{
328 if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("lpName")+"") 328 if((schRealInfo.get("xlBm")+"").equals(scheduleRealInfo.getXlBm()) && (schRealInfo.get("lpName")+"")
329 .equals(scheduleRealInfo.getLpName()) 329 .equals(scheduleRealInfo.getLpName())
330 && (schRealInfo.get("clZbh")+"").equals(scheduleRealInfo.getClZbh())){ 330 && (schRealInfo.get("clZbh")+"").equals(scheduleRealInfo.getClZbh())){
331 - if(scheduleRealInfo.getFcsjActual() == null ||scheduleRealInfo.getBcType().equals("in") 331 +
  332 + if(scheduleRealInfo.isDestroy()){
  333 + if(scheduleRealInfo.isReissue()){
  334 + scheduleRealInfo.setFcsjActualAll(scheduleRealInfo.getDfsj());
  335 + scheduleRealInfo.setZdsjActualAll(scheduleRealInfo.getZdsj());
  336 + }
  337 + else
  338 + continue;
  339 + }
  340 +
  341 + if(scheduleRealInfo.getBcType().equals("in")
332 || scheduleRealInfo.getBcType().equals("out")){ 342 || scheduleRealInfo.getBcType().equals("out")){
333 continue; 343 continue;
334 } 344 }
  345 +
335 scheduleRealInfo.getQdzCode(); 346 scheduleRealInfo.getQdzCode();
336 sf.append("<LD>"); 347 sf.append("<LD>");
337 sf.append("<SJGH>"+scheduleRealInfo.getjGh()+"</SJGH>"); 348 sf.append("<SJGH>"+scheduleRealInfo.getjGh()+"</SJGH>");
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -2365,7 +2365,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2365,7 +2365,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2365 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); 2365 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
2366 int jhbc = 0,cjbc = 0,ljbc = 0; 2366 int jhbc = 0,cjbc = 0,ljbc = 0;
2367 double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0; 2367 double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
2368 - float addMileage = 0l,remMileage = 0l; 2368 + float addMileage = 0l,remMileage = 0l, addgl = 0, remgl = 0;
2369 int xyz=1; 2369 int xyz=1;
2370 Map<String,Object> map; 2370 Map<String,Object> map;
2371 for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){ 2371 for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){
@@ -2375,6 +2375,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2375,6 +2375,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2375 //烂班里程(主任务烂班), 2375 //烂班里程(主任务烂班),
2376 //临加里程(主任务临加), 2376 //临加里程(主任务临加),
2377 //计划班次,烂班班次,增加班次 2377 //计划班次,烂班班次,增加班次
  2378 + double jh = 0, sj = 0;
2378 tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); 2379 tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
2379 if(scheduleRealInfo.isSflj()){ 2380 if(scheduleRealInfo.isSflj()){
2380 ljbc++; 2381 ljbc++;
@@ -2382,7 +2383,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2382,7 +2383,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2382 if( !(scheduleRealInfo.getBcType().equals("in") 2383 if( !(scheduleRealInfo.getBcType().equals("in")
2383 ||scheduleRealInfo.getBcType().equals("out")) ){ 2384 ||scheduleRealInfo.getBcType().equals("out")) ){
2384 jhbc++; 2385 jhbc++;
2385 - jhlc += tempJhlc; 2386 + jh += tempJhlc;
2386 } 2387 }
2387 if(scheduleRealInfo.getStatus() == -1){ 2388 if(scheduleRealInfo.getStatus() == -1){
2388 remMileage += tempJhlc; 2389 remMileage += tempJhlc;
@@ -2405,7 +2406,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2405,7 +2406,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2405 if(scheduleRealInfo.isSflj()){ 2406 if(scheduleRealInfo.isSflj()){
2406 addMileage += tempJhlc; 2407 addMileage += tempJhlc;
2407 } 2408 }
2408 - yygl += tempJhlc; 2409 + sj += tempJhlc;
2409 } 2410 }
2410 } 2411 }
2411 }else{ 2412 }else{
@@ -2429,7 +2430,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2429,7 +2430,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2429 if(scheduleRealInfo.isSflj()){ 2430 if(scheduleRealInfo.isSflj()){
2430 addMileage += tempJhlc; 2431 addMileage += tempJhlc;
2431 } 2432 }
2432 - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); 2433 + sj += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2433 } 2434 }
2434 } 2435 }
2435 } 2436 }
@@ -2480,6 +2481,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2480,6 +2481,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2480 e.printStackTrace(); 2481 e.printStackTrace();
2481 } 2482 }
2482 } 2483 }
  2484 + jhlc += jh;
  2485 + yygl += sj;
  2486 + if(jh > sj){
  2487 + remgl += jh - sj;
  2488 + } else {
  2489 + addgl += sj - jh;
  2490 + }
2483 } 2491 }
2484 } 2492 }
2485 2493
@@ -2496,17 +2504,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2496,17 +2504,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2496 map.put("jzl", jzl); 2504 map.put("jzl", jzl);
2497 map.put("jhlc", format.format(jhlc+jcclc)); 2505 map.put("jhlc", format.format(jhlc+jcclc));
2498 map.put("yygljh", format.format(jhlc)); 2506 map.put("yygljh", format.format(jhlc));
2499 - map.put("ssgl", format.format(remMileage)); 2507 + map.put("ssgl", format.format(remgl));
2500 map.put("ksgl", format.format(ksgl)); 2508 map.put("ksgl", format.format(ksgl));
2501 - map.put("yyglsj", format.format(yygl+remMileage)); 2509 + map.put("yyglsj", format.format(yygl));
2502 map.put("jhbc", jhbc); 2510 map.put("jhbc", jhbc);
2503 map.put("jcclc", jcclc); 2511 map.put("jcclc", jcclc);
2504 2512
2505 - map.put("ljgl", format.format(addMileage)); 2513 + map.put("ljgl", format.format(addgl));
2506 map.put("ssbc", cjbc); 2514 map.put("ssbc", cjbc);
2507 map.put("ysgl", format.format(yygl)); 2515 map.put("ysgl", format.format(yygl));
2508 map.put("sjbc", jhbc-cjbc+ljbc); 2516 map.put("sjbc", jhbc-cjbc+ljbc);
2509 - map.put("zgl", format.format(yygl+remMileage+ksgl+jcclc)); 2517 + map.put("zgl", format.format(yygl+ksgl+jcclc));
2510 map.put("ljbc", ljbc); 2518 map.put("ljbc", ljbc);
2511 String zdp="",zwdp="",wdp=""; 2519 String zdp="",zwdp="",wdp="";
2512 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm"); 2520 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
@@ -2557,7 +2565,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2557,7 +2565,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2557 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); 2565 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
2558 int jhbc = 0,cjbc = 0,ljbc = 0; 2566 int jhbc = 0,cjbc = 0,ljbc = 0;
2559 double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0; 2567 double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0,jcclc=0;
2560 - float addMileage = 0l,remMileage = 0l; 2568 + float addMileage = 0l,remMileage = 0l, addgl = 0, remgl = 0;
2561 Map<String,Object> map = new HashMap<String, Object>(); 2569 Map<String,Object> map = new HashMap<String, Object>();
2562 for(ScheduleRealInfo scheduleRealInfo : list){ 2570 for(ScheduleRealInfo scheduleRealInfo : list){
2563 if(scheduleRealInfo != null){ 2571 if(scheduleRealInfo != null){
@@ -2565,6 +2573,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2565,6 +2573,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2565 //烂班里程(主任务烂班), 2573 //烂班里程(主任务烂班),
2566 //临加里程(主任务临加), 2574 //临加里程(主任务临加),
2567 //计划班次,烂班班次,增加班次 2575 //计划班次,烂班班次,增加班次
  2576 + double jh = 0, sj = 0;
2568 tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); 2577 tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
2569 if(scheduleRealInfo.isSflj()){ 2578 if(scheduleRealInfo.isSflj()){
2570 ljbc++; 2579 ljbc++;
@@ -2572,7 +2581,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2572,7 +2581,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2572 if( !(scheduleRealInfo.getBcType().equals("in") 2581 if( !(scheduleRealInfo.getBcType().equals("in")
2573 ||scheduleRealInfo.getBcType().equals("out")) ){ 2582 ||scheduleRealInfo.getBcType().equals("out")) ){
2574 jhbc++; 2583 jhbc++;
2575 - jhlc += tempJhlc; 2584 + jh += tempJhlc;
2576 } 2585 }
2577 2586
2578 if(scheduleRealInfo.getStatus() == -1){ 2587 if(scheduleRealInfo.getStatus() == -1){
@@ -2597,7 +2606,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2597,7 +2606,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2597 if(scheduleRealInfo.isSflj()){ 2606 if(scheduleRealInfo.isSflj()){
2598 addMileage += tempJhlc; 2607 addMileage += tempJhlc;
2599 } 2608 }
2600 - yygl += tempJhlc; 2609 + sj += tempJhlc;
2601 } 2610 }
2602 } 2611 }
2603 }else{ 2612 }else{
@@ -2621,26 +2630,33 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2621,26 +2630,33 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2621 if(scheduleRealInfo.isSflj()){ 2630 if(scheduleRealInfo.isSflj()){
2622 addMileage += tempJhlc; 2631 addMileage += tempJhlc;
2623 } 2632 }
2624 - yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); 2633 + sj += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
2625 } 2634 }
2626 } 2635 }
2627 } 2636 }
2628 } 2637 }
  2638 + jhlc += jh;
  2639 + yygl += sj;
  2640 + if(jh > sj){
  2641 + remgl += jh - sj;
  2642 + } else if(sj > jh){
  2643 + addgl += sj - jh;
  2644 + }
2629 } 2645 }
2630 } 2646 }
2631 map.put("jhlc", format.format(jhlc+jcclc)); 2647 map.put("jhlc", format.format(jhlc+jcclc));
2632 map.put("yygljh", format.format(jhlc)); 2648 map.put("yygljh", format.format(jhlc));
2633 - map.put("ssgl", format.format(remMileage)); 2649 + map.put("ssgl", format.format(remgl));
2634 map.put("ksgl", format.format(ksgl)); 2650 map.put("ksgl", format.format(ksgl));
2635 - map.put("yyglsj", format.format(yygl+remMileage)); 2651 + map.put("yyglsj", format.format(yygl));
2636 map.put("jhbc", jhbc); 2652 map.put("jhbc", jhbc);
2637 map.put("jcclc", jcclc); 2653 map.put("jcclc", jcclc);
2638 2654
2639 - map.put("ljgl", format.format(addMileage)); 2655 + map.put("ljgl", format.format(addgl));
2640 map.put("ssbc", cjbc); 2656 map.put("ssbc", cjbc);
2641 map.put("ysgl", format.format(yygl)); 2657 map.put("ysgl", format.format(yygl));
2642 map.put("sjbc", jhbc-cjbc+ljbc); 2658 map.put("sjbc", jhbc-cjbc+ljbc);
2643 - map.put("zgl", format.format(yygl+remMileage+ksgl+jcclc)); 2659 + map.put("zgl", format.format(yygl+ksgl+jcclc));
2644 map.put("ljbc", ljbc); 2660 map.put("ljbc", ljbc);
2645 2661
2646 return map; 2662 return map;
src/main/resources/static/pages/control/lineallot/allot.html
1 <style> 1 <style>
2 -.line-select{  
3 - border: 1px solid #ddd;  
4 - height: 350px;  
5 - margin-top: 15px;  
6 - box-shadow: 0 2px 5px 0 rgba(221, 221, 221, 0.24), 0 2px 10px 0 rgba(221, 221, 221, 0.24);  
7 -}  
8 -  
9 -.line-select.selected{  
10 - height: 190px;  
11 -}  
12 -  
13 -.line-select .company{  
14 - font-family: 仿宋;  
15 - font-weight: 600;  
16 -}  
17 -  
18 -.line-select .line{  
19 - display: inline-block;  
20 - padding: 8px;  
21 - min-width: 85px;  
22 - text-align: center;  
23 - border: 1px solid #C1C1C1;  
24 - color: #666;  
25 - border-radius: 5px !important;  
26 - margin: 5px;  
27 -}  
28 -  
29 -.line-select .line.active{  
30 - color: white;  
31 - background: #32C5D2;  
32 - border: 1px solid #32C5D2;  
33 -}  
34 -  
35 -.line-select-cont{  
36 - text-align: left;  
37 - overflow: auto;  
38 - height: 270px;  
39 - padding-right: 0px;  
40 -}  
41 -  
42 -.line-select-cont .slimScrollBar{  
43 - background: rgb(50, 197, 210) !important;  
44 - border-radius: 5px !important;  
45 -}  
46 -  
47 -.line-select .search-input{  
48 - margin: 25px 0 5px 0;  
49 - padding-left: 0;  
50 -}  
51 -  
52 -.line-select .search-input .input-icon-lg{  
53 - box-shadow: 0 2px 5px 0 rgba(194, 202, 216, 0.49), 0 2px 10px 0 rgba(194, 202, 216, 0.49) !important;  
54 -}  
55 -  
56 -.line-select .fa-search{  
57 - color: #32c5d2 !important;  
58 -}  
59 -  
60 -.line-select .fa-plus-circle{  
61 - cursor: pointer;  
62 - transform: rotate(43deg);  
63 -}  
64 -  
65 -.line-select .fa-plus-circle:hover{  
66 - color: #A9A9A9;  
67 -}  
68 -  
69 -.selected .line{  
70 - display: inline-block !important;  
71 -}  
72 -.load-text{  
73 - position: absolute;  
74 - top: 50%;  
75 - left: 50%;  
76 - transform: translate(-50%);  
77 - font-size: 14px;  
78 - font-family: 仿宋;  
79 -}  
80 -  
81 -/* .selected a{  
82 - position: absolute;  
83 - bottom: 20px;  
84 -}  
85 -.selected a.btn{  
86 - bottom: 10px;  
87 -} */  
88 -  
89 -.lb_panel{  
90 - position: absolute;  
91 - bottom: 20px;  
92 -}  
93 -  
94 -.lb_panel a{  
95 - margin-right: 5px;  
96 -}  
97 -  
98 -.gotoControl.red{  
99 - background: #ec7b7b;  
100 - border-color: #ec7b7b;  
101 -}  
102 -  
103 -.gotoControl.red:hover{  
104 - background: #d96262;  
105 - border-color: #d96262;  
106 -}  
107 -  
108 -#resetBtn,#historyBtn{  
109 - vertical-align: bottom;  
110 - display: inline-block;  
111 - margin-bottom: 3px;  
112 -}  
113 -  
114 -/** 闵行没有分公司,直接隐藏 */  
115 -.company,.sub-company{  
116 - display: none !important;  
117 -} 2 + .line-select {
  3 + border: 1px solid #ddd;
  4 + height: 350px;
  5 + margin-top: 15px;
  6 + box-shadow: 0 2px 5px 0 rgba(221, 221, 221, 0.24), 0 2px 10px 0 rgba(221, 221, 221, 0.24);
  7 + }
  8 +
  9 + .line-select.selected {
  10 + height: 190px;
  11 + }
  12 +
  13 + .line-select .company {
  14 + font-family: 仿宋;
  15 + font-weight: 600;
  16 + }
  17 +
  18 + .line-select .line {
  19 + display: inline-block;
  20 + padding: 8px;
  21 + min-width: 85px;
  22 + text-align: center;
  23 + border: 1px solid #C1C1C1;
  24 + color: #666;
  25 + border-radius: 5px !important;
  26 + margin: 5px;
  27 + }
  28 +
  29 + .line-select .line.active {
  30 + color: white;
  31 + background: #32C5D2;
  32 + border: 1px solid #32C5D2;
  33 + }
  34 +
  35 + .line-select-cont {
  36 + text-align: left;
  37 + overflow: auto;
  38 + height: 270px;
  39 + padding-right: 0px;
  40 + }
  41 +
  42 + .line-select-cont .slimScrollBar {
  43 + background: rgb(50, 197, 210) !important;
  44 + border-radius: 5px !important;
  45 + }
  46 +
  47 + .line-select .search-input {
  48 + margin: 25px 0 5px 0;
  49 + padding-left: 0;
  50 + }
  51 +
  52 + .line-select .search-input .input-icon-lg {
  53 + box-shadow: 0 2px 5px 0 rgba(194, 202, 216, 0.49), 0 2px 10px 0 rgba(194, 202, 216, 0.49) !important;
  54 + }
  55 +
  56 + .line-select .fa-search {
  57 + color: #32c5d2 !important;
  58 + }
  59 +
  60 + .line-select .fa-plus-circle {
  61 + cursor: pointer;
  62 + transform: rotate(43deg);
  63 + }
  64 +
  65 + .line-select .fa-plus-circle:hover {
  66 + color: #A9A9A9;
  67 + }
  68 +
  69 + .selected .line {
  70 + display: inline-block !important;
  71 + }
  72 +
  73 + .load-text {
  74 + position: absolute;
  75 + top: 50%;
  76 + left: 50%;
  77 + transform: translate(-50%);
  78 + font-size: 14px;
  79 + font-family: 仿宋;
  80 + }
  81 +
  82 + /* .selected a{
  83 + position: absolute;
  84 + bottom: 20px;
  85 + }
  86 + .selected a.btn{
  87 + bottom: 10px;
  88 + } */
  89 +
  90 + .lb_panel {
  91 + position: absolute;
  92 + bottom: 20px;
  93 + }
  94 +
  95 + .lb_panel a {
  96 + margin-right: 5px;
  97 + }
  98 +
  99 + .gotoControl.red {
  100 + background: #ec7b7b;
  101 + border-color: #ec7b7b;
  102 + }
  103 +
  104 + .gotoControl.red:hover {
  105 + background: #d96262;
  106 + border-color: #d96262;
  107 + }
  108 +
  109 + #resetBtn, #historyBtn {
  110 + vertical-align: bottom;
  111 + display: inline-block;
  112 + margin-bottom: 3px;
  113 + }
  114 +
  115 + /** 闵行没有分公司,直接隐藏 */
  116 + .company, .sub-company {
  117 + display: none !important;
  118 + }
118 </style> 119 </style>
119 120
120 <div class="page-head"> 121 <div class="page-head">
121 - <div class="page-title">  
122 - <h1>线路分配</h1>  
123 - </div> 122 + <div class="page-title">
  123 + <h1>线路分配</h1>
  124 + </div>
124 </div> 125 </div>
125 126
126 <ul class="page-breadcrumb breadcrumb"> 127 <ul class="page-breadcrumb breadcrumb">
127 - <li><a href="/pages/home.html" data-pjax>首页</a> <i  
128 - class="fa fa-circle"></i></li>  
129 - <li><span class="active">线路调度管理</span> <i class="fa fa-circle"></i></li>  
130 - <li><span class="active">线路分配</span></li> 128 + <li><a href="/pages/home.html" data-pjax>首页</a> <i
  129 + class="fa fa-circle"></i></li>
  130 + <li><span class="active">线路调度管理</span> <i class="fa fa-circle"></i></li>
  131 + <li><span class="active">线路分配</span></li>
131 </ul> 132 </ul>
132 133
133 <div class="portlet light bordered"> 134 <div class="portlet light bordered">
134 - <div class="portlet-title">  
135 - <div class="caption">  
136 - <i class="icon-social-dribbble font-green"></i> <span  
137 - class="caption-subject font-green bold uppercase">选择线路</span>  
138 - </div>  
139 - </div>  
140 - <div class="portlet-body">  
141 - <div class="row" style="margin-bottom: 30px;">  
142 - <div class="col-md-8 col-sm-12 col-md-offset-2" style="text-align: center;">  
143 - <div class="col-md-12 line-select" >  
144 - <div class="col-md-12 search-input" >  
145 - <div class="col-md-6" style="padding-left: 0;">  
146 - <div class="input-icon input-icon-lg right" >  
147 - <i class="fa fa-search"></i>  
148 - <input type="text" id="searchLineInput" class="form-control input-lg" placeholder="搜索线路"> </div>  
149 - </div>  
150 - </div>  
151 - <div class="line-select-cont col-md-12" >  
152 - <div class="line-select-body" style="margin-top: 20px;">  
153 - <span class="load-text">加载中...</span>  
154 - </div>  
155 - </div> 135 + <div class="portlet-title">
  136 + <div class="caption">
  137 + <i class="icon-social-dribbble font-green"></i> <span
  138 + class="caption-subject font-green bold uppercase">选择线路</span>
  139 + </div>
  140 + </div>
  141 + <div class="portlet-body">
  142 + <div class="row" style="margin-bottom: 30px;">
  143 + <div class="col-md-8 col-sm-12 col-md-offset-2" style="text-align: center;">
  144 + <div class="col-md-12 line-select">
  145 + <div class="col-md-12 search-input">
  146 + <div class="col-md-6" style="padding-left: 0;">
  147 + <div class="input-icon input-icon-lg right">
  148 + <i class="fa fa-search"></i>
  149 + <input type="text" id="searchLineInput" class="form-control input-lg"
  150 + placeholder="搜索线路"></div>
  151 + </div>
  152 + </div>
  153 + <div class="line-select-cont col-md-12">
  154 + <div class="line-select-body" style="margin-top: 20px;">
  155 + <span class="load-text">加载中...</span>
  156 + </div>
  157 + </div>
156 </div> 158 </div>
157 - 159 +
158 <div class="col-md-12 line-select selected" style="text-align: left;"> 160 <div class="col-md-12 line-select selected" style="text-align: left;">
159 - <h5 style="font-family: 仿宋; display: block;">已选中线路</h5>  
160 - <div class="selected-body"></div>  
161 -  
162 - <div class="lb_panel">  
163 - <a href="javascript:;" class="btn btn-lg blue gotoControl red" data-status=1>  
164 - <i class="fa fa-power-off"></i> 主调模式 </a>  
165 -  
166 - <a href="javascript:;" id="monitor" class="btn btn-lg grey gotoControl" data-status=0>  
167 - <i class="fa fa-tv"></i> 监控模式 </a>  
168 - &nbsp;  
169 - <a href="javascript:;" id="resetBtn" style="left: 120px;color: #3598DC;">  
170 - <i class="fa fa-history"></i> 重置</a>  
171 -  
172 - <a href="javascript:;" id="historyBtn" style="left: 180px;color: #f36a5a;">  
173 - <i class="fa fa-history"></i> 历史纪录 </a>  
174 - </div> 161 + <h5 style="font-family: 仿宋; display: block;">已选中线路</h5>
  162 + <div class="selected-body"></div>
  163 +
  164 + <div class="lb_panel">
  165 + <a href="javascript:;" class="btn btn-lg blue gotoControl red" data-status=1>
  166 + <i class="fa fa-power-off"></i> 主调模式 </a>
  167 +
  168 + <a href="javascript:;" id="monitor" class="btn btn-lg grey gotoControl" data-status=0>
  169 + <i class="fa fa-tv"></i> 监控模式 </a>
  170 + &nbsp;
  171 + <a href="javascript:;" id="resetBtn" style="left: 120px;color: #3598DC;">
  172 + <i class="fa fa-history"></i> 重置</a>
  173 +
  174 + <a href="javascript:;" id="historyBtn" style="left: 180px;color: #f36a5a;">
  175 + <i class="fa fa-history"></i> 历史纪录 </a>
  176 + </div>
175 </div> 177 </div>
176 - </div>  
177 - </div>  
178 - </div> 178 + </div>
  179 + </div>
  180 + </div>
179 </div> 181 </div>
180 182
181 <div class="clone_line"> 183 <div class="clone_line">
182 </div> 184 </div>
183 185
184 <script id="line_select_cont_temp" type="text/html"> 186 <script id="line_select_cont_temp" type="text/html">
185 -{{each data as obj company}}  
186 - <h3 class="company" >{{company}}</h3>  
187 - {{each data[company] as subObj subCompany}}  
188 - <h5 class="sub-company" style="font-family: 仿宋;">{{company}}_{{subCompany}}</h5>  
189 - {{each data[company][subCompany] as line i}}  
190 - <div class="line" name="line_{{line.lineCode}}" data-id={{line.lineCode}}>{{line.name}}</div>  
191 - {{/each}}  
192 - {{/each}}  
193 -{{/each}} 187 + {{each data as obj company}}
  188 + <h3 class="company">{{company}}</h3>
  189 + {{each data[company] as subObj subCompany}}
  190 + <h5 class="sub-company" style="font-family: 仿宋;">{{company}}_{{subCompany}}</h5>
  191 + {{each data[company][subCompany] as line i}}
  192 + <div class="line" name="line_{{line.lineCode}}" data-id={{line.lineCode}}>{{line.name}}</div>
  193 + {{/each}}
  194 + {{/each}}
  195 + {{/each}}
194 </script> 196 </script>
195 <script src="/assets/js/eventproxy.js"></script> 197 <script src="/assets/js/eventproxy.js"></script>
196 <script> 198 <script>
197 -$(function(){  
198 - //大写字母映射  
199 - var camelChars = {};  
200 - //全拼映射  
201 - var fullChars = {};  
202 - //中文映射  
203 - var zhChars = {};  
204 - //合并所有映射  
205 - var allChars = {};  
206 -  
207 - //线路编码映射  
208 - var lineIdMap = {};  
209 -  
210 - //线路编码和名称对照 (写入localStorage,线调用)  
211 - var lineIds = {};  
212 -  
213 - var storage = window.localStorage;  
214 -  
215 - $get('/line/all', {destroy_eq:0}, function(allLine){  
216 - $('#searchLineInput').focus();  
217 - //按公司分组  
218 - var companyJson = groupData(allLine, 'company');  
219 - //按分公司分组  
220 - for(var company in companyJson){  
221 - companyJson[company] = groupData(companyJson[company], 'brancheCompany');  
222 - }  
223 -  
224 - var htmlStr = template('line_select_cont_temp', {data: companyJson});  
225 - $('.line-select-body').html(htmlStr)  
226 - .slimscroll({//滚动条  
227 - height: '270px'  
228 - });  
229 -  
230 - //替换公司编码  
231 -/* var gsmap = {};  
232 - $get('/business/all', null, function(array){  
233 - $.each(array, function(i, gs){  
234 - var k = gs.upCode + '_' + gs.businessCode;  
235 - if(gs.upCode === '88'){  
236 - k = gs.businessCode;  
237 - }  
238 - gsmap[k] = gs.businessName;  
239 - });  
240 -  
241 - $.each($('.company,.sub-company'), function(j , e){  
242 - var k = $(e).text();  
243 - gsmap[k] && $(e).text(gsmap[k]);  
244 - })  
245 - }); */  
246 -  
247 - //映射  
248 - $.each(allLine, function(s, line){  
249 - camelChars[pinyin.getCamelChars(line.name)] = line.lineCode;  
250 - fullChars[pinyin.getFullChars(line.name).toUpperCase()] = line.lineCode;  
251 - zhChars[line.name] = line.lineCode;  
252 - lineIdMap[line.lineCode] = line;  
253 -  
254 - lineIds[line.lineCode] = line.name;  
255 - });  
256 - //合并映射  
257 - $.extend(allChars, camelChars, fullChars, zhChars);  
258 -  
259 - //线路选中事件  
260 - $('.line-select-body .line').on('click', function(){  
261 - if($(this).hasClass('active')){  
262 - $(this).removeClass('active');  
263 - $('.selected-body .line[name='+$(this).attr('name')+']').remove();  
264 - }  
265 - else{  
266 - $(this).addClass('active');  
267 - $('.selected-body').append($(this).clone());  
268 - }  
269 - });  
270 -  
271 - storage.setItem('lineIds', JSON.stringify(lineIds));  
272 - });  
273 -  
274 - //搜索框事件  
275 - $('#searchLineInput').on('keyup', filterLines);  
276 -  
277 - $('.line-select .input-icon i').on('click', function(){  
278 - if($(this).hasClass('fa-plus-circle')){  
279 - $('#searchLineInput').val('');  
280 - filterLines();  
281 - }  
282 - });  
283 -  
284 - $('.selected-body').on('click', '.line', function(){  
285 - $('.line-select-body .line[name='+$(this).attr('name')+']').removeClass('active');  
286 - $(this).remove();  
287 - });  
288 -  
289 - //确定  
290 - $('.gotoControl').on('click', function(){  
291 - var lines = $('.selected-body .line');  
292 - if(lines.length == 0){  
293 - layer.alert('你还没有选择线路!',{icon: 3});  
294 - return;  
295 - }  
296 -  
297 - showLoad('更新缓存信息...');  
298 - //将选择的线路写入localstorage  
299 - var lsData = [];  
300 - $.each(lines, function(i, e){  
301 - lsData.push(lineIdMap[$(e).data('id')]);  
302 - });  
303 - storage.setItem('lineControlItems', JSON.stringify(lsData));  
304 -  
305 - var operationMode = $(this).data('status');  
306 - //监控模式还是主调模式  
307 - storage.setItem('operationMode', operationMode);  
308 -  
309 - var ep = new EventProxy();  
310 - //缓存车辆自编号和设备号对照  
311 - cacheCar2DeviceId(function(){  
312 - delayEmit(ep, 'cacheRoute');  
313 - });  
314 -  
315 - //缓存线路路由  
316 - ep.tail('cacheRoute', function(){  
317 - cacheRoute(lsData, function(cacheData){  
318 - delayEmit(ep, 'checkLineConfig');  
319 - });  
320 - });  
321 -  
322 - //检查线路配置信息  
323 - ep.tail('checkLineConfig', function(){  
324 - checkLineConfig(lsData, function(rs){  
325 - if(rs.status == 0)  
326 - delayEmit(ep, 'gotoControl', rs);  
327 - else if(rs.status == 1)  
328 - delayEmit(ep, 'initLineConfig', rs);  
329 - });  
330 - });  
331 -  
332 - //初始化没有 线路配置信息 的线路  
333 - ep.tail('initLineConfig',function(rs){  
334 - initLineConfig(rs.not, function(){  
335 - delayEmit(ep, 'gotoControl', rs);  
336 - });  
337 - });  
338 -  
339 - //进入线调  
340 - ep.tail('gotoControl', function(){  
341 - //alert('进入线调');  
342 - layer.closeAll();  
343 - //loadPage('/pages/control/line/index.html');  
344 - window.location.href="/real_control_v2/main.html";  
345 - });  
346 - });  
347 -  
348 - function checkLineConfig(lsData, cb){  
349 - showLoad('检查线路配置信息...');  
350 - var lineCodeArray = [];  
351 - $.each(lsData, function(){  
352 - lineCodeArray.push(this.lineCode);  
353 - });  
354 -  
355 - $.ajax({  
356 - url: '/lineConfig/check',  
357 - traditional: true,  
358 - data: {codeArray: lineCodeArray},  
359 - method: 'POST',  
360 - success: cb  
361 - });  
362 - }  
363 -  
364 - function initLineConfig(arr, cb){  
365 - var i = 0;  
366 - (function(){  
367 - if(i >= arr.length){  
368 - cb && cb();  
369 - return;  
370 - }  
371 - var f = arguments.callee  
372 - ,lineCode = arr[i];  
373 -  
374 - showLoad('初始化'+lineIds[lineCode]+'配置信息...');  
375 - $.post('/lineConfig/init/' + lineCode, function(rs){  
376 - if(rs == 1){  
377 - i ++;  
378 - f();  
379 - }  
380 - });  
381 - })();  
382 - }  
383 -  
384 - function cacheCar2DeviceId(cb){  
385 - //showLoad('缓存基础对照信息...');  
386 - $.get('/gps/Car2DeviceId', function(rs){  
387 - storage.setItem('car2DeviceId', JSON.stringify(rs));  
388 - cb && cb();  
389 - });  
390 - }  
391 -  
392 - function cacheRoute(lsData, cb){  
393 - //showLoad('缓存线路路由信息...');  
394 - var i = 0, cacheData = {};  
395 - (function(){  
396 - if(i >= lsData.length){  
397 - //写入localStorage  
398 - for(var lineCode in cacheData)  
399 - storage.setItem(lineCode + '_route', JSON.stringify(cacheData[lineCode]));  
400 -  
401 - cb && cb();  
402 - return;  
403 - }  
404 - var f = arguments.callee  
405 - ,item = lsData[i];  
406 -  
407 - $.get('/realMap/findRouteByLine', {lineCode: item.lineCode}, function(rs){  
408 - //$.get('/realSchedule/findRouteByLine', {lineCode: item.lineCode}, function(rs){  
409 - if(rs && rs.lineId){  
410 - cacheData[item.lineCode] = rs;  
411 - i ++;  
412 - f();  
413 - }  
414 - });  
415 - })();  
416 - }  
417 -  
418 - //历史纪录  
419 - $('#historyBtn').on('click', function(){  
420 - var lineControlItems = window.localStorage.getItem('lineControlItems');  
421 - if(!lineControlItems){  
422 - layer.alert('没有在当前电脑找到历史纪录!',{icon: 3});  
423 - return;  
424 - }  
425 - else{  
426 - var array = JSON.parse(lineControlItems);  
427 - clear();  
428 - $.each(array, function(i, line){  
429 - $('.line-select-body .line[name=line_'+line.lineCode+']').click();  
430 - });  
431 - }  
432 - });  
433 -  
434 - //重置  
435 - $('#resetBtn').on('click', clear);  
436 -  
437 - function clear(){  
438 - $('.line-select-body .line.active').removeClass('active');  
439 - $('.selected-body .line').remove();  
440 -  
441 - $('.line-select .input-icon i.fa-plus-circle').click();  
442 - filterLines();  
443 - }  
444 -  
445 - function filterLines(){  
446 - var t = $('#searchLineInput').val().toUpperCase()  
447 - ,es = []  
448 - ,bs = $('.line-select-body .line, .line-select-body .company, .line-select-body .sub-company')  
449 - ,icon = $('.line-select .input-icon i');  
450 -  
451 - if(!t){  
452 - bs.show();  
453 - icon.removeClass('fa-plus-circle').addClass('fa-search');  
454 - return;  
455 - }  
456 - else  
457 - icon.removeClass('fa-search').addClass('fa-plus-circle');  
458 -  
459 - for(var c in allChars){  
460 - if(c.indexOf(t) != -1)  
461 - es.push('.line-select-body .line[name=line_' + allChars[c] + ']');  
462 - }  
463 -  
464 - bs.hide();  
465 - $.each(es, function(i, e){  
466 - $(e).show();  
467 - });  
468 - }  
469 -  
470 - function groupData(array, g){  
471 - var groups = {}, key;  
472 -  
473 - $.each(array, function(i, item){  
474 - key = item[g];  
475 - if(!groups[key])  
476 - groups[key] = [];  
477 -  
478 - groups[key].push(item);  
479 - });  
480 -  
481 - return groups;  
482 - }  
483 -  
484 - function showLoad(text){  
485 - layer.msg(text, {icon: 16, time: 0, shade: 0.3});  
486 - }  
487 -  
488 - function delayEmit(ep, t, p){  
489 - setTimeout(function(){  
490 - ep.emit(t, p);  
491 - }, 300);  
492 - }  
493 -}); 199 + $(function () {
  200 + //大写字母映射
  201 + var camelChars = {};
  202 + //全拼映射
  203 + var fullChars = {};
  204 + //中文映射
  205 + var zhChars = {};
  206 + //合并所有映射
  207 + var allChars = {};
  208 +
  209 + //线路编码映射
  210 + var lineIdMap = {};
  211 +
  212 + //线路编码和名称对照 (写入localStorage,线调用)
  213 + var lineIds = {};
  214 +
  215 + var storage = window.localStorage;
  216 +
  217 + $get('/line/all', {destroy_eq: 0}, function (allLine) {
  218 + $('#searchLineInput').focus();
  219 + //按公司分组
  220 + var companyJson = groupData(allLine, 'company');
  221 + //按分公司分组
  222 + for (var company in companyJson) {
  223 + companyJson[company] = groupData(companyJson[company], 'brancheCompany');
  224 + }
  225 +
  226 + var htmlStr = template('line_select_cont_temp', {data: companyJson});
  227 + $('.line-select-body').html(htmlStr)
  228 + .slimscroll({//滚动条
  229 + height: '270px'
  230 + });
  231 +
  232 + //替换公司编码
  233 + /* var gsmap = {};
  234 + $get('/business/all', null, function(array){
  235 + $.each(array, function(i, gs){
  236 + var k = gs.upCode + '_' + gs.businessCode;
  237 + if(gs.upCode === '88'){
  238 + k = gs.businessCode;
  239 + }
  240 + gsmap[k] = gs.businessName;
  241 + });
  242 +
  243 + $.each($('.company,.sub-company'), function(j , e){
  244 + var k = $(e).text();
  245 + gsmap[k] && $(e).text(gsmap[k]);
  246 + })
  247 + }); */
  248 +
  249 + //映射
  250 + $.each(allLine, function (s, line) {
  251 + camelChars[pinyin.getCamelChars(line.name)] = line.lineCode;
  252 + fullChars[pinyin.getFullChars(line.name).toUpperCase()] = line.lineCode;
  253 + zhChars[line.name] = line.lineCode;
  254 + lineIdMap[line.lineCode] = line;
  255 +
  256 + lineIds[line.lineCode] = line.name;
  257 + });
  258 + //合并映射
  259 + $.extend(allChars, camelChars, fullChars, zhChars);
  260 +
  261 + //线路选中事件
  262 + $('.line-select-body .line').on('click', function () {
  263 + if ($(this).hasClass('active')) {
  264 + $(this).removeClass('active');
  265 + $('.selected-body .line[name=' + $(this).attr('name') + ']').remove();
  266 + }
  267 + else {
  268 + $(this).addClass('active');
  269 + $('.selected-body').append($(this).clone());
  270 + }
  271 + });
  272 +
  273 + storage.setItem('lineIds', JSON.stringify(lineIds));
  274 + });
  275 +
  276 + //搜索框事件
  277 + $('#searchLineInput').on('keyup', filterLines);
  278 +
  279 + $('.line-select .input-icon i').on('click', function () {
  280 + if ($(this).hasClass('fa-plus-circle')) {
  281 + $('#searchLineInput').val('');
  282 + filterLines();
  283 + }
  284 + });
  285 +
  286 + $('.selected-body').on('click', '.line', function () {
  287 + $('.line-select-body .line[name=' + $(this).attr('name') + ']').removeClass('active');
  288 + $(this).remove();
  289 + });
  290 +
  291 + //确定
  292 + $('.gotoControl').on('click', function () {
  293 + var lines = $('.selected-body .line');
  294 + if (lines.length == 0) {
  295 + layer.alert('你还没有选择线路!', {icon: 3});
  296 + return;
  297 + }
  298 +
  299 + showLoad('更新缓存信息...');
  300 + //将选择的线路写入localstorage
  301 + var lsData = [];
  302 + $.each(lines, function (i, e) {
  303 + lsData.push(lineIdMap[$(e).data('id')]);
  304 + });
  305 + storage.setItem('lineControlItems', JSON.stringify(lsData));
  306 +
  307 + var operationMode = $(this).data('status');
  308 + //监控模式还是主调模式
  309 + storage.setItem('operationMode', operationMode);
  310 +
  311 + var ep = new EventProxy();
  312 + //缓存车辆自编号和设备号对照
  313 + cacheCar2DeviceId(function () {
  314 + delayEmit(ep, 'cacheRoute');
  315 + });
  316 +
  317 + //缓存线路路由
  318 + ep.tail('cacheRoute', function () {
  319 + cacheRoute(lsData, function (cacheData) {
  320 + delayEmit(ep, 'checkLineConfig');
  321 + });
  322 + });
  323 +
  324 + //检查线路配置信息
  325 + ep.tail('checkLineConfig', function () {
  326 + checkLineConfig(lsData, function (rs) {
  327 + if (rs.status == 0)
  328 + delayEmit(ep, 'gotoControl', rs);
  329 + else if (rs.status == 1)
  330 + delayEmit(ep, 'initLineConfig', rs);
  331 + });
  332 + });
  333 +
  334 + //初始化没有 线路配置信息 的线路
  335 + ep.tail('initLineConfig', function (rs) {
  336 + initLineConfig(rs.not, function () {
  337 + delayEmit(ep, 'gotoControl', rs);
  338 + });
  339 + });
  340 +
  341 + //进入线调
  342 + ep.tail('gotoControl', function () {
  343 + //alert('进入线调');
  344 + layer.closeAll();
  345 + //loadPage('/pages/control/line/index.html');
  346 + window.location.href = "/real_control/v2";
  347 + });
  348 + });
  349 +
  350 + function checkLineConfig(lsData, cb) {
  351 + showLoad('检查线路配置信息...');
  352 + var lineCodeArray = [];
  353 + $.each(lsData, function () {
  354 + lineCodeArray.push(this.lineCode);
  355 + });
  356 +
  357 + $.ajax({
  358 + url: '/lineConfig/check',
  359 + traditional: true,
  360 + data: {codeArray: lineCodeArray},
  361 + method: 'POST',
  362 + success: cb
  363 + });
  364 + }
  365 +
  366 + function initLineConfig(arr, cb) {
  367 + var i = 0;
  368 + (function () {
  369 + if (i >= arr.length) {
  370 + cb && cb();
  371 + return;
  372 + }
  373 + var f = arguments.callee
  374 + , lineCode = arr[i];
  375 +
  376 + showLoad('初始化' + lineIds[lineCode] + '配置信息...');
  377 + $.post('/lineConfig/init/' + lineCode, function (rs) {
  378 + if (rs == 1) {
  379 + i++;
  380 + f();
  381 + }
  382 + });
  383 + })();
  384 + }
  385 +
  386 + function cacheCar2DeviceId(cb) {
  387 + //showLoad('缓存基础对照信息...');
  388 + $.get('/gps/Car2DeviceId', function (rs) {
  389 + storage.setItem('car2DeviceId', JSON.stringify(rs));
  390 + cb && cb();
  391 + });
  392 + }
  393 +
  394 + function cacheRoute(lsData, cb) {
  395 + //showLoad('缓存线路路由信息...');
  396 + var i = 0, cacheData = {};
  397 + (function () {
  398 + if (i >= lsData.length) {
  399 + //写入localStorage
  400 + for (var lineCode in cacheData)
  401 + storage.setItem(lineCode + '_route', JSON.stringify(cacheData[lineCode]));
  402 +
  403 + cb && cb();
  404 + return;
  405 + }
  406 + var f = arguments.callee
  407 + , item = lsData[i];
  408 +
  409 + $.get('/realMap/findRouteByLine', {lineCode: item.lineCode}, function (rs) {
  410 + //$.get('/realSchedule/findRouteByLine', {lineCode: item.lineCode}, function(rs){
  411 + if (rs && rs.lineId) {
  412 + cacheData[item.lineCode] = rs;
  413 + i++;
  414 + f();
  415 + }
  416 + });
  417 + })();
  418 + }
  419 +
  420 + //历史纪录
  421 + $('#historyBtn').on('click', function () {
  422 + var lineControlItems = window.localStorage.getItem('lineControlItems');
  423 + if (!lineControlItems) {
  424 + layer.alert('没有在当前电脑找到历史纪录!', {icon: 3});
  425 + return;
  426 + }
  427 + else {
  428 + var array = JSON.parse(lineControlItems);
  429 + clear();
  430 + $.each(array, function (i, line) {
  431 + $('.line-select-body .line[name=line_' + line.lineCode + ']').click();
  432 + });
  433 + }
  434 + });
  435 +
  436 + //重置
  437 + $('#resetBtn').on('click', clear);
  438 +
  439 + function clear() {
  440 + $('.line-select-body .line.active').removeClass('active');
  441 + $('.selected-body .line').remove();
  442 +
  443 + $('.line-select .input-icon i.fa-plus-circle').click();
  444 + filterLines();
  445 + }
  446 +
  447 + function filterLines() {
  448 + var t = $('#searchLineInput').val().toUpperCase()
  449 + , es = []
  450 + , bs = $('.line-select-body .line, .line-select-body .company, .line-select-body .sub-company')
  451 + , icon = $('.line-select .input-icon i');
  452 +
  453 + if (!t) {
  454 + bs.show();
  455 + icon.removeClass('fa-plus-circle').addClass('fa-search');
  456 + return;
  457 + }
  458 + else
  459 + icon.removeClass('fa-search').addClass('fa-plus-circle');
  460 +
  461 + for (var c in allChars) {
  462 + if (c.indexOf(t) != -1)
  463 + es.push('.line-select-body .line[name=line_' + allChars[c] + ']');
  464 + }
  465 +
  466 + bs.hide();
  467 + $.each(es, function (i, e) {
  468 + $(e).show();
  469 + });
  470 + }
  471 +
  472 + function groupData(array, g) {
  473 + var groups = {}, key;
  474 +
  475 + $.each(array, function (i, item) {
  476 + key = item[g];
  477 + if (!groups[key])
  478 + groups[key] = [];
  479 +
  480 + groups[key].push(item);
  481 + });
  482 +
  483 + return groups;
  484 + }
  485 +
  486 + function showLoad(text) {
  487 + layer.msg(text, {icon: 16, time: 0, shade: 0.3});
  488 + }
  489 +
  490 + function delayEmit(ep, t, p) {
  491 + setTimeout(function () {
  492 + ep.emit(t, p);
  493 + }, 300);
  494 + }
  495 + });
494 </script> 496 </script>
495 \ No newline at end of file 497 \ No newline at end of file
src/main/resources/static/pages/permission/user/changePWD.html
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <!-- BEGIN VALIDATION STATES--> 3 <!-- BEGIN VALIDATION STATES-->
4 <div class="portlet light portlet-fit portlet-form bordered"> 4 <div class="portlet light portlet-fit portlet-form bordered">
5 <div class="portlet-body"> 5 <div class="portlet-body">
6 - <form action="/user/changePWD" class="form-horizontal" id="changePWD"> 6 + <form class="form-horizontal" id="changePWDForm">
7 <div class="form-group" style="margin-top: 60px"> 7 <div class="form-group" style="margin-top: 60px">
8 <label class="control-label col-md-5">原始密码: 8 <label class="control-label col-md-5">原始密码:
9 </label> 9 </label>
@@ -48,7 +48,8 @@ @@ -48,7 +48,8 @@
48 <script> 48 <script>
49 $(function(){ 49 $(function(){
50 $("#confirm").on("click",function(){ 50 $("#confirm").on("click",function(){
51 - $.get('/user/changePWD',null,function(){ 51 + var data = $('#changePWDForm').serializeJSON();
  52 + $.post('/user/changePWD',data,function(){
52 53
53 }); 54 });
54 }); 55 });
src/main/resources/static/real_control_v2/css/main.css
@@ -711,6 +711,7 @@ li.map-panel { @@ -711,6 +711,7 @@ li.map-panel {
711 width: 33%; 711 width: 33%;
712 } 712 }
713 713
  714 +/*
714 #schedule-lp_change-modal .sch-list { 715 #schedule-lp_change-modal .sch-list {
715 margin-top: 25px; 716 margin-top: 25px;
716 } 717 }
@@ -762,4 +763,52 @@ li.map-panel { @@ -762,4 +763,52 @@ li.map-panel {
762 #schedule-lp_change-modal .sch-list .sch-item.reverse dl dd:nth-of-type(4) { 763 #schedule-lp_change-modal .sch-list .sch-item.reverse dl dd:nth-of-type(4) {
763 width: 33%; 764 width: 33%;
764 border-right:0; 765 border-right:0;
765 -}  
766 \ No newline at end of file 766 \ No newline at end of file
  767 +}*/
  768 +
  769 +
  770 +#schedule-lp_change-modal .sch-list dl dd {
  771 + font-size: 14px;
  772 +}
  773 +
  774 +#schedule-lp_change-modal .sch-list dl dt:nth-of-type(1), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(1) {
  775 + width: 9%;
  776 + border-left: 1px solid #dedede;
  777 +}
  778 +
  779 +#schedule-lp_change-modal .sch-list dl dt:nth-of-type(2), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(2) {
  780 + width: 30%;
  781 +}
  782 +
  783 +#schedule-lp_change-modal .sch-list dl dt:nth-of-type(3), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(3) {
  784 + width: 28%;
  785 +}
  786 +
  787 +#schedule-lp_change-modal .sch-list dl dt:nth-of-type(4), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(4) {
  788 + width: 17%;
  789 +}
  790 +
  791 +#schedule-lp_change-modal .sch-list dl dt:nth-of-type(5), #schedule-lp_change-modal .sch-list dl dd:nth-of-type(5) {
  792 + width: 15%;
  793 +}
  794 +
  795 +
  796 +#schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(1), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(1) {
  797 + width: 9%;
  798 + border-left: 1px solid #dedede;
  799 +}
  800 +
  801 +#schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(2), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(2) {
  802 + width: 15%;
  803 +}
  804 +
  805 +#schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(3), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(3) {
  806 + width: 17%;
  807 +}
  808 +
  809 +#schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(4), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(4) {
  810 + width: 28%;
  811 +}
  812 +
  813 +#schedule-lp_change-modal .sch-list.reverse dl dt:nth-of-type(5), #schedule-lp_change-modal .sch-list.reverse dl dd:nth-of-type(5) {
  814 + width: 30%;
  815 +}
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/lp_change.html
@@ -6,139 +6,131 @@ @@ -6,139 +6,131 @@
6 6
7 <div class="uk-grid uk-grid-divider"> 7 <div class="uk-grid uk-grid-divider">
8 <div class="uk-width-1-2"> 8 <div class="uk-width-1-2">
9 - <form class="uk-form"> 9 + <form class="uk-form uk-form-horizontal">
10 <fieldset> 10 <fieldset>
11 线路 11 线路
12 - <select name="lineSelect" style="width: 140px;"></select> 12 + <select name="lineSelect" data-order="0" style="width: 140px;"></select>
13 &emsp; 13 &emsp;
14 路牌 14 路牌
15 - <select name="lpName" style="width: 90px;"></select> 15 + <select name="lpName" data-order="0" style="width: 90px;"></select>
16 </fieldset> 16 </fieldset>
17 - </form>  
18 - <div class="sch-list">  
19 - <div class="sch-item">  
20 - <dl>  
21 - <dd>S0568/钱存哗</dd>  
22 - <dd>S0J-046</dd>  
23 - <dd>5</dd>  
24 - <dd>07:58</dd>  
25 - </dl>  
26 - <dl>  
27 - <dd>S0568/钱存哗</dd>  
28 - <dd>S0J-046</dd>  
29 - <dd>5</dd>  
30 - <dd>07:58</dd>  
31 - </dl>  
32 - <dl>  
33 - <dd>S0568/钱存哗</dd>  
34 - <dd>S0J-046</dd>  
35 - <dd>5</dd>  
36 - <dd>07:58</dd>  
37 - </dl>  
38 - <dl>  
39 - <dd>S0568/钱存哗</dd>  
40 - <dd>S0J-046</dd>  
41 - <dd>5</dd>  
42 - <dd>07:58</dd>  
43 - </dl>  
44 - <dl>  
45 - <dd>S0568/钱存哗</dd>  
46 - <dd>S0J-046</dd>  
47 - <dd>5</dd>  
48 - <dd>07:58</dd>  
49 - </dl>  
50 - <dl>  
51 - <dd>S0568/钱存哗</dd>  
52 - <dd>S0J-046</dd>  
53 - <dd>5</dd>  
54 - <dd>07:58</dd>  
55 - </dl>  
56 - <dl>  
57 - <dd>S0568/钱存哗</dd>  
58 - <dd>S0J-046</dd>  
59 - <dd>5</dd>  
60 - <dd>07:58</dd>  
61 - </dl> 17 +
  18 + <div class="ct_table sch-list" style="margin-top: 14px;">
  19 + <div class="ct_table_head">
  20 + <dl>
  21 + <dt><input type="checkbox"></dt>
  22 + <dt>驾驶员</dt>
  23 + <dt>车辆</dt>
  24 + <dt>路牌</dt>
  25 + <dt>时间</dt>
  26 + </dl>
  27 + </div>
  28 + <div class="ct_table_body">
  29 + </div>
62 </div> 30 </div>
63 - </div> 31 + </form>
64 </div> 32 </div>
65 <div class="uk-width-1-2"> 33 <div class="uk-width-1-2">
66 <form class="uk-form uk-form-horizontal"> 34 <form class="uk-form uk-form-horizontal">
67 <fieldset> 35 <fieldset>
68 线路 36 线路
69 - <select name="lineSelect" style="width: 140px;"></select> 37 + <select name="lineSelect" data-order="1" style="width: 140px;"></select>
70 &emsp; 38 &emsp;
71 路牌 39 路牌
72 - <select name="lpName" style="width: 90px;"></select> 40 + <select name="lpName" data-order="1" style="width: 90px;"></select>
73 </fieldset> 41 </fieldset>
74 - </form>  
75 - <div class="sch-list">  
76 - <div class="sch-item reverse">  
77 - <dl>  
78 - <dd>07:58</dd>  
79 - <dd>5</dd>  
80 - <dd>S0J-046</dd>  
81 - <dd>S0568/钱存哗</dd>  
82 - </dl>  
83 - <dl>  
84 - <dd>07:58</dd>  
85 - <dd>5</dd>  
86 - <dd>S0J-046</dd>  
87 - <dd>S0568/钱存哗</dd>  
88 - </dl>  
89 - <dl>  
90 - <dd>07:58</dd>  
91 - <dd>5</dd>  
92 - <dd>S0J-046</dd>  
93 - <dd>S0568/钱存哗</dd>  
94 - </dl>  
95 - <dl>  
96 - <dd>07:58</dd>  
97 - <dd>5</dd>  
98 - <dd>S0J-046</dd>  
99 - <dd>S0568/钱存哗</dd>  
100 - </dl>  
101 - <dl>  
102 - <dd>07:58</dd>  
103 - <dd>5</dd>  
104 - <dd>S0J-046</dd>  
105 - <dd>S0568/钱存哗</dd>  
106 - </dl>  
107 - <dl>  
108 - <dd>07:58</dd>  
109 - <dd>5</dd>  
110 - <dd>S0J-046</dd>  
111 - <dd>S0568/钱存哗</dd>  
112 - </dl>  
113 - <dl>  
114 - <dd>07:58</dd>  
115 - <dd>5</dd>  
116 - <dd>S0J-046</dd>  
117 - <dd>S0568/钱存哗</dd>  
118 - </dl> 42 +
  43 + <div class="ct_table sch-list reverse" style="margin-top: 14px;">
  44 + <div class="ct_table_head">
  45 + <dl>
  46 + <dt><input type="checkbox"></dt>
  47 + <dt>时间</dt>
  48 + <dt>路牌</dt>
  49 + <dt>车辆</dt>
  50 + <dt>驾驶员</dt>
  51 + </dl>
  52 + </div>
  53 + <div class="ct_table_body ">
  54 + </div>
119 </div> 55 </div>
120 - </div> 56 + </form>
121 </div> 57 </div>
122 </div> 58 </div>
123 59
124 - <div class="uk-modal-footer uk-text-right" > 60 + <div class="uk-modal-footer uk-text-right">
  61 + <div style="float: left;font-size: 13px;">
  62 + <a> 清除未勾选班次</a>
  63 + </div>
125 <button type="button" class="uk-button uk-modal-close">取消</button> 64 <button type="button" class="uk-button uk-modal-close">取消</button>
126 <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;提交</button> 65 <button type="submit" class="uk-button uk-button-primary"><i class="uk-icon-check"></i> &nbsp;提交</button>
127 </div> 66 </div>
128 </div> 67 </div>
129 68
130 - <script id="schedule-lp_change-form-temp" type="text/html">  
131 - 69 + <script id="schedule-lp_change-list-temp" type="text/html">
  70 + {{if order == 0}}
  71 + {{each array as sch i}}
  72 + <dl>
  73 + <dd><input type="checkbox"></dd>
  74 + <dd>{{sch.jGh}}/{{sch.jName}}</dd>
  75 + <dd>{{sch.clZbh}}</dd>
  76 + <dd>{{sch.lpName}}</dd>
  77 + <dd>{{sch.dfsj}}</dd>
  78 + </dl>
  79 + {{/each}}
  80 + {{else if order == 1}}
  81 + {{each array as sch i}}
  82 + <dl>
  83 + <dd><input type="checkbox"></dd>
  84 + <dd>{{sch.dfsj}}</dd>
  85 + <dd>{{sch.lpName}}</dd>
  86 + <dd>{{sch.clZbh}}</dd>
  87 + <dd>{{sch.jGh}}/{{sch.jName}}</dd>
  88 + </dl>
  89 + {{/each}}
  90 + {{/if}}
132 </script> 91 </script>
133 92
134 <script> 93 <script>
135 (function () { 94 (function () {
136 var modal = '#schedule-lp_change-modal' 95 var modal = '#schedule-lp_change-modal'
137 - , sch; 96 + , sch, list = [{}, {}];
138 $(modal).on('init', function (e, data) { 97 $(modal).on('init', function (e, data) {
139 e.stopPropagation(); 98 e.stopPropagation();
140 sch = data.sch; 99 sch = data.sch;
141 100
  101 +
  102 + //线路切换事件
  103 + $('[name=lineSelect]', modal).on('change', function () {
  104 + var order = $(this).data('order')
  105 + ,lineCode = $(this).val();
  106 +
  107 + var array = gb_common.get_vals(gb_schedule_table.findScheduleByLine(lineCode));
  108 + //按路牌分组
  109 + list[order] = gb_common.groupBy(array, 'lpName');
  110 + //设置路牌下拉框
  111 + var lpSelect = $(this).next('select'), ops='';
  112 + $.each(gb_common.get_keys(list[order]), function (i, lp) {
  113 + ops += '<option value="'+lp+'">'+lp+'</option>';
  114 + });
  115 + lpSelect.html(ops);
  116 + });
  117 +
  118 + //路牌切换事件
  119 + $('[name=lpName]', modal).on('change', function () {
  120 + var order = $(this).data('order')
  121 + ,lp = $(this).val();
  122 +
  123 + var htmlStr = template('schedule-lp_change-list-temp', {array: list[order][lp], order: order});
  124 + $('.sch-list .ct_table_body', modal).eq(order).html(htmlStr);
  125 + });
  126 +
  127 +
  128 + //线路下拉框
  129 + var lineOps = '';
  130 + $.each(gb_data_basic.activeLines, function () {
  131 + lineOps += '<option value="' + this.lineCode + '">' + this.name + '</option>';
  132 + });
  133 + $('[name=lineSelect]', modal).html(lineOps);
142 }); 134 });
143 })(); 135 })();
144 </script> 136 </script>
src/main/resources/static/real_control_v2/fragments/line_schedule/context_menu/sub_task/add_sub_task_range_turn.html
@@ -345,7 +345,7 @@ @@ -345,7 +345,7 @@
345 * 为班次添加备注 345 * 为班次添加备注
346 */ 346 */
347 var remarks = '调头' + $('[name=endDate]', csf).val() + ' 因 ' + $('#turnReason', modal).val() + '在' + $('[name=endStation] option:selected', csf).text() + '调头'; 347 var remarks = '调头' + $('[name=endDate]', csf).val() + ' 因 ' + $('#turnReason', modal).val() + '在' + $('[name=endStation] option:selected', csf).text() + '调头';
348 - gb_schedule_table.addRemarks([sch, nextSch], remarks); 348 + gb_schedule_table.addRemarks([sch, nextSch], gb_common.trim(remarks, 'g'));
349 UIkit.modal(modal).hide(); 349 UIkit.modal(modal).hide();
350 $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch}); 350 $('#schedule-lj_zrw-modal .main-schedule-table').trigger('refresh', {sch: sch});
351 return; 351 return;
src/main/resources/static/real_control_v2/fragments/north/nav/all_devices.html
@@ -154,7 +154,7 @@ @@ -154,7 +154,7 @@
154 if (resetPagination) 154 if (resetPagination)
155 pagination(rs.totalPages + 1, rs.page); 155 pagination(rs.totalPages + 1, rs.page);
156 }) 156 })
157 - } 157 + };
158 158
159 var resetPagination = true; 159 var resetPagination = true;
160 var pagination = function(pages, currentPage) { 160 var pagination = function(pages, currentPage) {
@@ -172,7 +172,7 @@ @@ -172,7 +172,7 @@
172 }); 172 });
173 173
174 resetPagination = false; 174 resetPagination = false;
175 - } 175 + };
176 176
177 var callbackHandler={ 177 var callbackHandler={
178 change_line: function(device){ 178 change_line: function(device){
src/main/resources/static/real_control_v2/js/common.js
@@ -131,9 +131,9 @@ var gb_common = (function () { @@ -131,9 +131,9 @@ var gb_common = (function () {
131 var data = groupBy(get_vals(allGps), 'lineId'); 131 var data = groupBy(get_vals(allGps), 'lineId');
132 var name; 132 var name;
133 for (var code in data) { 133 for (var code in data) {
134 - try{ 134 + try {
135 name = gb_data_basic.codeToLine[code].name; 135 name = gb_data_basic.codeToLine[code].name;
136 - }catch(e) { 136 + } catch (e) {
137 continue; 137 continue;
138 } 138 }
139 139
@@ -286,7 +286,7 @@ var gb_common = (function () { @@ -286,7 +286,7 @@ var gb_common = (function () {
286 // } 286 // }
287 // } 287 // }
288 288
289 - var accAdd = function(a, b) { 289 + var accAdd = function (a, b) {
290 var c, d, e; 290 var c, d, e;
291 try { 291 try {
292 c = a.toString().split(".")[1].length; 292 c = a.toString().split(".")[1].length;
@@ -307,10 +307,12 @@ var gb_common = (function () { @@ -307,10 +307,12 @@ var gb_common = (function () {
307 e = b.toString(); 307 e = b.toString();
308 try { 308 try {
309 c += d.split(".")[1].length; 309 c += d.split(".")[1].length;
310 - } catch (f) {} 310 + } catch (f) {
  311 + }
311 try { 312 try {
312 c += e.split(".")[1].length; 313 c += e.split(".")[1].length;
313 - } catch (f) {} 314 + } catch (f) {
  315 + }
314 return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c); 316 return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
315 } 317 }
316 318
@@ -329,6 +331,15 @@ var gb_common = (function () { @@ -329,6 +331,15 @@ var gb_common = (function () {
329 return e = Math.pow(10, Math.max(c, d)), (a * e - b * e) / e; 331 return e = Math.pow(10, Math.max(c, d)), (a * e - b * e) / e;
330 }; 332 };
331 333
  334 + var trim = function (str, is_global) {
  335 + var result;
  336 + result = str.replace(/(^\s+)|(\s+$)/g, "");
  337 + if (is_global.toLowerCase() == "g") {
  338 + result = result.replace(/\s/g, "");
  339 + }
  340 + return result;
  341 + };
  342 +
332 return { 343 return {
333 reqCode80: reqCode80, 344 reqCode80: reqCode80,
334 groupBy: groupBy, 345 groupBy: groupBy,
@@ -344,8 +355,10 @@ var gb_common = (function () { @@ -344,8 +355,10 @@ var gb_common = (function () {
344 personAutocomplete: personAutocomplete, 355 personAutocomplete: personAutocomplete,
345 carAutocomplete: carAutocomplete, 356 carAutocomplete: carAutocomplete,
346 init_autocomplete: init_autocomplete, 357 init_autocomplete: init_autocomplete,
347 - accAdd : accAdd,  
348 - numSubtr: numSubtr 358 + init_autocom_pinyin: init_autocom_pinyin,
  359 + accAdd: accAdd,
  360 + numSubtr: numSubtr,
  361 + trim: trim
349 362
350 //whichTransitionEvent:whichTransitionEvent 363 //whichTransitionEvent:whichTransitionEvent
351 }; 364 };
src/main/resources/static/real_control_v2/js/main.js
@@ -142,7 +142,7 @@ var enable_submit_btn = function (form) { @@ -142,7 +142,7 @@ var enable_submit_btn = function (form) {
142 if (subBtn) { 142 if (subBtn) {
143 subBtn.removeClass('disabled').removeAttr('disabled'); 143 subBtn.removeClass('disabled').removeAttr('disabled');
144 } 144 }
145 -} 145 +};
146 146
147 var disabled_submit_btn = function (form) { 147 var disabled_submit_btn = function (form) {
148 var subBtn = $('button[type=submit]', form); 148 var subBtn = $('button[type=submit]', form);
src/main/resources/static/real_control_v2/sch_manage/sch_imitate.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html lang="zh-cn" style="height: 100%;">
  3 +
  4 +<head>
  5 + <meta charset="UTF-8">
  6 + <title>班次管理</title>
  7 + <!-- uikit core style-->
  8 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/css/uikit.gradient.min.css"/>
  9 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.gradient.min.css"/>
  10 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.gradient.min.css"/>
  11 + <link rel="stylesheet"
  12 + href="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.gradient.min.css"/>
  13 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/uikit-2.27.1/components/accordion.gradient.min.css"/>
  14 + <!-- jquery contextMenu style -->
  15 + <link rel="stylesheet" href="/real_control_v2/assets/css/jquery.contextMenu.min.css"/>
  16 + <!-- formvalidation style -->
  17 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/formvalidation/formValidation.min.css"/>
  18 +
  19 + <link rel="stylesheet" href="/real_control_v2/css/pace.css"/>
  20 +
  21 + <style>
  22 + /** 图例 */
  23 +
  24 + .tl-yzx {
  25 + background: #c1ddf0;
  26 + border-top: 1px solid #ebebeb !important;
  27 + color: #444;
  28 + }
  29 +
  30 + .tl-xxfc {
  31 + background: #ff7878;
  32 + color: #f1f1f1;
  33 + }
  34 +
  35 + .tl-wd {
  36 + background: rgb(255, 255, 0);
  37 + color: #444;
  38 + }
  39 +
  40 + .tl-xxsd {
  41 + background: #e2de94;
  42 + color: #444;
  43 + }
  44 +
  45 + .tl-xxrd {
  46 + background: #c1ddf0;
  47 + border-top: 1px solid #ebebeb !important;
  48 + color: #444;
  49 + }
  50 +
  51 + .tl-qrlb {
  52 + background: #7B6B24;
  53 + color: #EAEBEC;
  54 + font-size: 13px;
  55 + }
  56 +
  57 + .tl-qrlb::before {
  58 + content: '烂班';
  59 + }
  60 +
  61 + .tl-zzzx {
  62 + background: #96F396;
  63 + color: #444;
  64 + }
  65 +
  66 + ::-webkit-scrollbar {
  67 + width: 15px;
  68 + height: 16px;
  69 + }
  70 +
  71 + ::-webkit-scrollbar-track, ::-webkit-scrollbar-thumb {
  72 + border-radius: 999px;
  73 + border: 5px solid transparent;
  74 + }
  75 +
  76 + ::-webkit-scrollbar-track {
  77 + box-shadow: 1px 1px 5px rgba(0, 0, 0, .2) inset;
  78 + }
  79 +
  80 + ::-webkit-scrollbar-thumb {
  81 + min-height: 20px;
  82 + background-clip: content-box;
  83 + box-shadow: 0 0 0 5px rgba(0, 0, 0, .2) inset;
  84 + }
  85 +
  86 + ::-webkit-scrollbar-corner {
  87 + background: transparent;
  88 + }
  89 +
  90 + .search-box {
  91 + width: calc(100% - 70px);
  92 + margin: auto;
  93 + margin-top: 20px;
  94 + border-radius: 5px;
  95 + border: 1px solid lightgrey;
  96 + }
  97 +
  98 + .uk-panel-box {
  99 + box-shadow: 0px 1px 4px 0 rgba(125, 122, 122, 0.2), 0px 1px 7px 0 rgba(96, 95, 95, 0.19);
  100 + }
  101 +
  102 + .table-wrap.up {
  103 + border: 1px solid #5E96D2;
  104 + box-shadow: 3px 3px 12px 0 rgba(94, 150, 210, 0.28), 3px 3px 12px 0 rgba(94, 150, 210, 0.28);
  105 + border-radius: 5px;
  106 + height: 100%;
  107 + }
  108 +
  109 + .table-wrap.down {
  110 + border: 1px solid #e33c3c;
  111 + box-shadow: -3px 3px 11px 0 rgba(201, 33, 33, 0.22), -3px 3px 12px 0 rgba(201, 33, 33, 0.17);
  112 + border-radius: 5px;
  113 + height: 100%;
  114 + }
  115 +
  116 + table {
  117 + table-layout: fixed;
  118 + }
  119 +
  120 + table tr td {
  121 + white-space: nowrap;
  122 + overflow: hidden;
  123 + text-overflow: ellipsis;
  124 + }
  125 +
  126 + .context-menu-active {
  127 + background: #9afe9a !important;
  128 + }
  129 +
  130 + .shade-loading{
  131 + position: absolute;
  132 + top: 0;
  133 + left: 0;
  134 + z-index: 999;
  135 + width: 100%;
  136 + height: 100%;
  137 + background: rgb(255, 255, 255);
  138 + opacity: .5;
  139 + display: none;
  140 + }
  141 +
  142 + .shade-loading .center{
  143 + position: absolute;
  144 + margin: auto;
  145 + top: 50%;
  146 + left: 50%;
  147 + top: calc(50% - 50px);
  148 + left: calc(50% - 50px);
  149 + background: #2600ff;
  150 + color: #fff;
  151 + padding: 2px 5px;
  152 + border-radius: 3px;
  153 + }
  154 + .sch-lock-icon{
  155 + color: red;
  156 + font-size: 18px;
  157 + }
  158 + </style>
  159 +</head>
  160 +
  161 +<body style="height: 100%;overflow: hidden;">
  162 +<div class="north uk-width-1-1 uk-panel-box" style="background: #000;">
  163 + <div class="uk-grid uk-grid-match">
  164 + <div class="uk-width-4-10">
  165 + <div class="uk-panel">
  166 + <h2 class="north-logo" style="color: #f1f1f1;">
  167 + <i class="uk-icon-life-ring"></i> 闵行公交线路调度班次管理
  168 + </h2>
  169 + </div>
  170 + </div>
  171 + </div>
  172 +</div>
  173 +
  174 +<div class="main-container" style="height: calc(100% - 62px);">
  175 + <div style="height: 90px">
  176 + <div class="uk-panel uk-panel-box search-box">
  177 + <form class="uk-form search-form">
  178 + <fieldset data-uk-margin>
  179 + <span class="horizontal-field">日期</span>
  180 + <input type="date" name="scheduleDateStr_eq" disabled>
  181 + &emsp;
  182 + <span class="horizontal-field">线路</span>
  183 + <select name="xlBm_eq"></select>
  184 + &emsp;
  185 + <span class="horizontal-field">车辆</span>
  186 + <div class="uk-autocomplete uk-form autocomplete-cars">
  187 + <input type="text" name="clZbh_eq" placeholder="车辆自编号">
  188 + </div>
  189 + &emsp;
  190 + <span class="horizontal-field">驾驶员工号</span>
  191 + <div class="uk-autocomplete uk-form autocomplete-persion">
  192 + <input type="text" name="jGh_eq" placeholder="驾驶员工号">
  193 + </div>
  194 + &emsp;
  195 + <button class="uk-button" id="searchSchBtn">检索</button>
  196 + </fieldset>
  197 + </form>
  198 + </div>
  199 + </div>
  200 + <div class="uk-grid uk-grid-small uk-grid-divider " style="height: calc(100% - 120px)">
  201 + <div class="uk-width-1-2" style="padding-left: 45px;height: 100%;">
  202 + <div class="uk-overflow-container table-wrap up">
  203 + <table class="uk-table uk-table-striped uk-table-hover">
  204 + <thead>
  205 + <tr>
  206 + <th width="10%">序号</th>
  207 + <th width="10%">路牌</th>
  208 + <th width="15%">车辆</th>
  209 + <th width="10%">应到</th>
  210 + <th width="10%">实到</th>
  211 + <th width="15%">计发</th>
  212 + <th width="10%">待发</th>
  213 + <th width="10%">实发</th>
  214 + <th width="10%">备注</th>
  215 + </tr>
  216 + </thead>
  217 + <tbody></tbody>
  218 + </table>
  219 + </div>
  220 +
  221 + </div>
  222 + <div class="uk-width-1-2 " style="padding-right: 45px;height: 100%;">
  223 + <div class="uk-overflow-container table-wrap down">
  224 + <table class="uk-table uk-table-striped uk-table-hover">
  225 + <thead>
  226 + <tr>
  227 + <th width="10%">序号</th>
  228 + <th width="10%">路牌</th>
  229 + <th width="15%">车辆</th>
  230 + <th width="10%">应到</th>
  231 + <th width="10%">实到</th>
  232 + <th width="15%">计发</th>
  233 + <th width="10%">待发</th>
  234 + <th width="10%">实发</th>
  235 + <th width="10%">备注</th>
  236 + </tr>
  237 + </thead>
  238 + <tbody>
  239 + </tbody>
  240 + </table>
  241 + </div>
  242 + </div>
  243 + </div>
  244 +</div>
  245 +
  246 +<div class="shade-loading">
  247 + <div class="center">
  248 + <i class="uk-icon-spinner uk-icon-spin"></i> 请稍等...
  249 + </div>
  250 +</div>
  251 +
  252 +<script id="sch-imitate-list-temp" type="text/html">
  253 + {{each list as sch i}}
  254 + <tr data-id="{{sch.id}}">
  255 + <td>{{i + 1}}</td>
  256 + <td>{{sch.lpName}}</td>
  257 + <td>{{sch.clZbh}}</td>
  258 + <td>{{sch.qdzArrDateJH}}</td>
  259 + <td>{{sch.qdzArrDateSJ}}</td>
  260 + <td>{{sch.fcsj}}
  261 + {{if sch.bcType == "out"}}
  262 + <span class="uk-badge uk-badge-success">出场</span>
  263 + {{else if sch.bcType == "in"}}
  264 + <span class="uk-badge uk-badge-warning">进场</span>
  265 + {{else if sch.bcType == "venting"}}
  266 + <span class="uk-badge uk-badge-danger">直放</span>
  267 + {{else if sch.bcType == "major"}}
  268 + <span class="uk-badge uk-badge-danger">放站</span>
  269 + {{/if}}
  270 + {{if sch.sflj}}
  271 + <span class="uk-badge uk-badge-danger">临加</span>
  272 + {{/if}}
  273 + {{if sch.cTasks.length > 0}}
  274 + <span class="uk-badge uk-badge-notification">{{sch.cTasks.length}}</span>
  275 + {{/if}}
  276 + </td>
  277 + <td>{{sch.dfsj}}</td>
  278 + <td class="{{if sch.status==-1}}
  279 + tl-qrlb
  280 + {{else if sch.status==2}}
  281 + tl-yzx
  282 + {{else if sch.status==1}}
  283 + tl-zzzx
  284 + {{/if}}{{if reissue}}tl-reissue-success{{/if}}">
  285 + {{sch.fcsjActual}}
  286 + </td>
  287 + <td>
  288 + {{if sch.reissue}}
  289 + <i class="uk-icon-lock sch-lock-icon" ></i>
  290 + {{/if}}
  291 + {{sch.remarks}}
  292 + </td>
  293 + </tr>
  294 + {{/each}}
  295 +</script>
  296 +
  297 +<!-- jquery -->
  298 +<script src="/real_control_v2/assets/js/jquery.min.js"></script>
  299 +<!-- jquery.serializejson JSON序列化插件 -->
  300 +<script src="/assets/plugins/jquery.serializejson.js"></script>
  301 +<!-- moment.js 日期处理类库 -->
  302 +<script src="/assets/plugins/moment-with-locales.js"></script>
  303 +<!-- common js -->
  304 +<script src="/real_control_v2/js/common.js"></script>
  305 +<!-- art-template 模版引擎 -->
  306 +<script src="/assets/plugins/template.js"></script>
  307 +<!-- EventProxy -->
  308 +<script src="/assets/js/eventproxy.js"></script>
  309 +<!-- uikit core -->
  310 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/uikit.min.js"></script>
  311 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/notify.min.js"></script>
  312 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/pagination.min.js"></script>
  313 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/tooltip.min.js"></script>
  314 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/autocomplete.min.js"></script>
  315 +<script src="/real_control_v2/assets/plugins/uikit-2.27.1/components/timepicker.min.js"></script>
  316 +
  317 +<!-- jquery contextMenu -->
  318 +<script src="/real_control_v2/assets/js/jquery.contextMenu.min.js"></script>
  319 +<script src="/real_control_v2/assets/js/jquery.ui.position.min.js"></script>
  320 +<!-- simple pinyin -->
  321 +<script src="/assets/plugins/pinyin.js"></script>
  322 +<script>
  323 +
  324 + $(document).ajaxComplete(function (event, jqxhr, settings, thrownError) {
  325 + try {
  326 + if (JSON.parse(jqxhr.responseText).status == 407) {
  327 + window.location.href = '/';
  328 + }
  329 + } catch (e) {
  330 +
  331 + }
  332 + });
  333 +
  334 + (function () {
  335 + var dateStr = moment().format('YYYY-MM-DD')
  336 + , dateInput = $('[name=scheduleDateStr_eq]');
  337 + dateInput.val(dateStr);
  338 +
  339 + var codeToName, schArray = {};
  340 + //线路 autocomplete
  341 + $.get('/basic/lineCode2Name', function (rs) {
  342 + var opts = '';
  343 + for (var code in rs) {
  344 + opts += '<option value="' + code + '">' + rs[code] + '</option>';
  345 + }
  346 + $('[name=xlBm_eq]').html(opts);
  347 + });
  348 +
  349 + //检索
  350 + $('.search-form').on('submit', function () {
  351 + var data = $(this).serializeJSON();
  352 + data['scheduleDateStr_eq'] = dateInput.val();
  353 +
  354 + gb_common.$get('/realSchedule/all', data, function (list) {
  355 + $.each(list, function () {
  356 + schArray[this.id] = this;
  357 + });
  358 + //计算起点应到时间
  359 + calcYDSDDate(list);
  360 + var geoupData = gb_common.groupBy(list.sort(schSort), 'xlDir');
  361 + //上行
  362 + var htmlStr = template('sch-imitate-list-temp', {list: geoupData[0]});
  363 + $('.table-wrap.up table tbody').html(htmlStr);
  364 + //下行
  365 + var htmlStr = template('sch-imitate-list-temp', {list: geoupData[1]});
  366 + $('.table-wrap.down table tbody').html(htmlStr);
  367 + });
  368 + return false;
  369 + });
  370 +
  371 + //模拟轨迹
  372 + var gps_imitate = function (schId) {
  373 + var sch = schArray[schId];
  374 + if(sch.reissue){
  375 + UIkit.notify("<i class='uk-icon-times'></i> 你不能对一个班次重复操作!", {
  376 + status: 'danger'
  377 + });
  378 + return;
  379 + }
  380 + alt_confirm('确定班次信息? ' + sch.xlName + '、起点 ' + sch.qdzName + ' , 终点 ' + sch.zdzName + ' 、待发 ' + sch.dfsj, function () {
  381 + $('.shade-loading').show();
  382 + gb_common.$post('/gps/gpsCompletion', {schId: schId}, function (rs) {
  383 + $('.shade-loading').hide();
  384 + $('.search-form').trigger('submit');
  385 + });
  386 + }, '我确定是这个班次');
  387 + };
  388 +
  389 + var callbackHandler = {
  390 + gps_imitate: gps_imitate
  391 + }
  392 +
  393 + $.contextMenu({
  394 + selector: '.table-wrap table tbody tr',
  395 + //className: 'schedule-ct-menu',
  396 + callback: function (key, options) {
  397 + var schId = $('.table-wrap tr.context-menu-active').data('id');
  398 + callbackHandler[key] && callbackHandler[key](schId);
  399 + },
  400 + items: {
  401 + 'gps_imitate': {
  402 + name: '模拟轨迹'
  403 + }
  404 + }
  405 + });
  406 +
  407 +
  408 + var alt_confirm = function (content, succ, okBtn) {
  409 + var modalEl = UIkit.modal.confirm(content, function () {
  410 + succ && succ();
  411 + modalEl.hide();
  412 + }, {
  413 + labels: {
  414 + Ok: okBtn,
  415 + Cancel: '取消'
  416 + }
  417 + , center: true
  418 + });
  419 + };
  420 +
  421 +
  422 + /* 计算应到实到时间 */
  423 + var calcYDSDDate = function (list) {
  424 + var clGroupData = gb_common.groupBy(list, 'clZbh'), array, len;
  425 + for(var nbbm in clGroupData){
  426 + array = clGroupData[nbbm];
  427 + array.sort(schSort);
  428 +
  429 + len = array.length - 1;
  430 + for(var i = 0; i < len; i ++){
  431 + if(array[i].zdzName == array[i + 1].qdzName){
  432 + array[i + 1].qdzArrDateJH = array[i].zdsj;
  433 + array[i + 1].qdzArrDateSJ = array[i].zdsjActual;
  434 + }
  435 + }
  436 + }
  437 + };
  438 +
  439 + var schSort = function (a, b) {
  440 + return a.dfsj.localeCompare(b.dfsj);
  441 + }
  442 + })();
  443 +</script>
  444 +</body>
  445 +
  446 +</html>