Commit f6dce257e0a46239dcab648658793cb6815c2487

Authored by 潘钊
2 parents 0a25dd1b 50206784

Merge branch 'minhang' into pudong

Showing 28 changed files with 685 additions and 147 deletions
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
@@ -45,8 +45,8 @@ public class RealMapController { @@ -45,8 +45,8 @@ public class RealMapController {
45 * @Description: TODO(获取线路的站点,路段路由) 45 * @Description: TODO(获取线路的站点,路段路由)
46 */ 46 */
47 @RequestMapping(value = "/findRouteByLine") 47 @RequestMapping(value = "/findRouteByLine")
48 - public Map<String, Object> findRouteByLine(@RequestParam String lineCode) {  
49 - return realMapService.findRouteByLine(lineCode); 48 + public Map<String, Object> findRouteByLine(@RequestParam String idx) {
  49 + return realMapService.findRouteByLine(idx);
50 } 50 }
51 51
52 @RequestMapping(value = "/multiRouteByLine") 52 @RequestMapping(value = "/multiRouteByLine")
src/main/java/com/bsth/entity/schedule/rule/RerunRule.java
@@ -73,10 +73,21 @@ public class RerunRule extends BEntity { @@ -73,10 +73,21 @@ public class RerunRule extends BEntity {
73 /** 车辆配置 */ 73 /** 车辆配置 */
74 @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) 74 @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
75 private CarConfigInfo useCarConfig; 75 private CarConfigInfo useCarConfig;
  76 +
  77 + private Integer cl; // 冗余字段(车辆id)
  78 + private String clZbh; // 冗余字段(车辆自编号)
  79 +
76 /** 人员配置 */ 80 /** 人员配置 */
77 @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY) 81 @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
78 private EmployeeConfigInfo useEmployeeConfig; 82 private EmployeeConfigInfo useEmployeeConfig;
79 83
  84 + private Integer j; // 冗余字段(驾驶员Id)
  85 + private String jGh; // 冗余字段(驾驶员工号)
  86 + private String jName; // 冗余字段(驾驶员姓名)
  87 + private Integer s; // 冗余字段(售票员Id)
  88 + private String sGh; // 冗余字段(售票员工号)
  89 + private String sName; // 冗余字段(售票员姓名)
  90 +
80 /** 是否删除(标记) */ 91 /** 是否删除(标记) */
81 @Column(nullable = false) 92 @Column(nullable = false)
82 private Boolean isCancel = false; 93 private Boolean isCancel = false;
@@ -176,4 +187,68 @@ public class RerunRule extends BEntity { @@ -176,4 +187,68 @@ public class RerunRule extends BEntity {
176 public void setRerunTtinfodetailFcsjs(String rerunTtinfodetailFcsjs) { 187 public void setRerunTtinfodetailFcsjs(String rerunTtinfodetailFcsjs) {
177 this.rerunTtinfodetailFcsjs = rerunTtinfodetailFcsjs; 188 this.rerunTtinfodetailFcsjs = rerunTtinfodetailFcsjs;
178 } 189 }
  190 +
  191 + public Integer getCl() {
  192 + return cl;
  193 + }
  194 +
  195 + public void setCl(Integer cl) {
  196 + this.cl = cl;
  197 + }
  198 +
  199 + public String getClZbh() {
  200 + return clZbh;
  201 + }
  202 +
  203 + public void setClZbh(String clZbh) {
  204 + this.clZbh = clZbh;
  205 + }
  206 +
  207 + public Integer getJ() {
  208 + return j;
  209 + }
  210 +
  211 + public void setJ(Integer j) {
  212 + this.j = j;
  213 + }
  214 +
  215 + public String getjGh() {
  216 + return jGh;
  217 + }
  218 +
  219 + public void setjGh(String jGh) {
  220 + this.jGh = jGh;
  221 + }
  222 +
  223 + public String getjName() {
  224 + return jName;
  225 + }
  226 +
  227 + public void setjName(String jName) {
  228 + this.jName = jName;
  229 + }
  230 +
  231 + public Integer getS() {
  232 + return s;
  233 + }
  234 +
  235 + public void setS(Integer s) {
  236 + this.s = s;
  237 + }
  238 +
  239 + public String getsGh() {
  240 + return sGh;
  241 + }
  242 +
  243 + public void setsGh(String sGh) {
  244 + this.sGh = sGh;
  245 + }
  246 +
  247 + public String getsName() {
  248 + return sName;
  249 + }
  250 +
  251 + public void setsName(String sName) {
  252 + this.sName = sName;
  253 + }
179 } 254 }
src/main/java/com/bsth/repository/oil/YlbRepository.java
@@ -27,6 +27,29 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -27,6 +27,29 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
27 + " xlbm like %?4% and nbbm like %?5% ",nativeQuery=true) 27 + " xlbm like %?4% and nbbm like %?5% ",nativeQuery=true)
28 List<Ylb> obtainYlbefore(String rq,String gsbm,String fgsbm,String xlbm,String nbbm); 28 List<Ylb> obtainYlbefore(String rq,String gsbm,String fgsbm,String xlbm,String nbbm);
29 29
  30 +
  31 + /**
  32 + * 获取当天日期前的最大的日期中最大进出顺序的数据
  33 + *
  34 + */
  35 + @Transactional
  36 + @Modifying
  37 + @Query(value="select y.* from (select max(d.id) as id ,d.nbbm from ("
  38 + + " select b.rq,b.nbbm,max(b.jcsx) as jcsx from ("
  39 + + " select max(t.rq) as rq ,t.nbbm from bsth_c_ylb t "
  40 + + " where to_days(t.rq)< to_days(?1) "
  41 + + " and t.ssgsdm like %?2% and t.fgsdm like %?3% "
  42 + + " and t.xlbm like %?4% and t.nbbm like %?5% group by nbbm ) a "
  43 + + " left join bsth_c_ylb b on a.rq=b.rq and a.nbbm=b.nbbm "
  44 + + " where b.ssgsdm like %?2% and b.fgsdm like %?3% and "
  45 + + " b.xlbm like %?4% and b.nbbm like %?5% group by b.rq,b.nbbm) c"
  46 + + " left join bsth_c_ylb d on c.rq=d.rq and c.nbbm=d.nbbm and c.jcsx=d.jcsx "
  47 + + " where d.ssgsdm like %?2% and d.fgsdm like %?3% and d.xlbm like %?4% "
  48 + + " and d.nbbm like %?5% group by d.nbbm) x left join "
  49 + + " bsth_c_ylb y on x.id=y.id where y.ssgsdm like %?2% and y.fgsdm like %?3% "
  50 + + " and y.xlbm like %?4% and y.nbbm like %?5%",nativeQuery=true)
  51 + List<Ylb> listMaxRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm);
  52 +
30 /** 53 /**
31 * 当天YLB信息 54 * 当天YLB信息
32 * @param rq 55 * @param rq
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -164,8 +164,8 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -164,8 +164,8 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
164 List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2); 164 List<ScheduleRealInfo> scheduleByDateAndLineYbb(String line,String date,String date2);
165 165
166 166
167 - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY clZbh,fcsj")  
168 - List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm); 167 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh,min(s.fcsj) as fcsj ) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% and s.clZbh like %?5% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY clZbh,fcsj")
  168 + List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String nbbm);
169 169
170 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir") 170 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
171 List<ScheduleRealInfo> setLD(String date); 171 List<ScheduleRealInfo> setLD(String date);
src/main/java/com/bsth/security/WebSecurityConfig.java
@@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @@ -36,7 +36,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
36 public void configure(WebSecurity web) throws Exception { 36 public void configure(WebSecurity web) throws Exception {
37 // 白名单 37 // 白名单
38 web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, 38 web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA,
39 - Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS); 39 + Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES);
40 } 40 }
41 41
42 @Override 42 @Override
src/main/java/com/bsth/security/filter/LoginInterceptor.java
@@ -3,10 +3,11 @@ package com.bsth.security.filter; @@ -3,10 +3,11 @@ package com.bsth.security.filter;
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.bsth.common.Constants; 4 import com.bsth.common.Constants;
5 import com.bsth.common.ResponseCode; 5 import com.bsth.common.ResponseCode;
6 -import com.bsth.filter.BaseFilter;  
7 import com.bsth.util.RequestUtils; 6 import com.bsth.util.RequestUtils;
8 import org.springframework.security.core.Authentication; 7 import org.springframework.security.core.Authentication;
9 import org.springframework.security.core.context.SecurityContextHolder; 8 import org.springframework.security.core.context.SecurityContextHolder;
  9 +import org.springframework.util.AntPathMatcher;
  10 +import org.springframework.util.PathMatcher;
10 11
11 import javax.servlet.*; 12 import javax.servlet.*;
12 import javax.servlet.http.HttpServletRequest; 13 import javax.servlet.http.HttpServletRequest;
@@ -23,40 +24,67 @@ import java.util.Map; @@ -23,40 +24,67 @@ import java.util.Map;
23 * @date 2016年3月24日 上午11:49:20 24 * @date 2016年3月24日 上午11:49:20
24 * 25 *
25 */ 26 */
26 -public class LoginInterceptor extends BaseFilter { 27 +public class LoginInterceptor implements Filter {
  28 +
  29 + private final PathMatcher pathMatcher = new AntPathMatcher();
  30 +
  31 + /**
  32 + * 白名单
  33 + * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证
  34 + */
  35 + private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE,
  36 + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES };
  37 +
27 38
28 @Override 39 @Override
29 public void destroy() { 40 public void destroy() {
30 41
31 } 42 }
32 43
  44 +
33 @Override 45 @Override
34 public void init(FilterConfig filterConfig) throws ServletException { 46 public void init(FilterConfig filterConfig) throws ServletException {
35 47
36 } 48 }
37 49
38 @Override 50 @Override
39 - public void doFilter(HttpServletRequest request,  
40 - HttpServletResponse response, FilterChain chain)  
41 - throws IOException, ServletException {  
42 - Authentication authentication = SecurityContextHolder.getContext().getAuthentication();  
43 -  
44 - if(null == authentication){  
45 - //没有登录  
46 -  
47 - if(RequestUtils.isAjaxRequest(request)){  
48 - Map<String, Object> map = new HashMap<>();  
49 - map.put("status",  
50 - ResponseCode.NO_AUTHENTICATION);  
51 - response.getWriter().print(JSON.toJSONString(map));  
52 - }  
53 - else  
54 - response.sendRedirect(Constants.LOGIN_PAGE); 51 + public void doFilter(ServletRequest request, ServletResponse response,
  52 + FilterChain chain) throws IOException, ServletException {
  53 +
  54 + HttpServletRequest httpRequest = (HttpServletRequest) request;
  55 + HttpServletResponse httpResponse = (HttpServletResponse) response;
  56 +
  57 + String currentURL = httpRequest.getServletPath();
  58 +
  59 + if (!isWhiteURL(currentURL)) {
  60 + Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
55 61
56 - return; 62 + if(null == authentication){
  63 + //没有登录
  64 +
  65 + if(RequestUtils.isAjaxRequest(httpRequest)){
  66 + Map<String, Object> map = new HashMap<>();
  67 + map.put("status",
  68 + ResponseCode.NO_AUTHENTICATION);
  69 + response.getWriter().print(JSON.toJSONString(map));
  70 + }
  71 + else
  72 + httpResponse.sendRedirect(Constants.LOGIN_PAGE);
  73 +
  74 + return;
  75 + }
57 } 76 }
58 77
59 chain.doFilter(request, response); 78 chain.doFilter(request, response);
60 } 79 }
61 80
  81 + private boolean isWhiteURL(String currentURL) {
  82 + for (String whiteURL : whiteListURLs) {
  83 + if (pathMatcher.match(whiteURL, currentURL)) {
  84 + return true;
  85 + }
  86 + }
  87 + return false;
  88 + }
  89 +
62 } 90 }
src/main/java/com/bsth/service/oil/impl/CwjyServiceImpl.java
@@ -276,17 +276,22 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw @@ -276,17 +276,22 @@ public class CwjyServiceImpl extends BaseServiceImpl&lt;Cwjy,Integer&gt; implements Cw
276 // TODO Auto-generated method stub 276 // TODO Auto-generated method stub
277 String rq=map.get("rq").toString(); 277 String rq=map.get("rq").toString();
278 String nbbm=map.get("nbbh").toString(); 278 String nbbm=map.get("nbbh").toString();
  279 + String gsdm=map.get("gsdm_like").toString();
  280 +
  281 + String fgsdm=map.get("fgsdm_like").toString();
279 String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm," 282 String sql="SELECT a.gsdm as gsdm,a.fgsdm as fgsdm,a.nbbm as nbbm,"
280 + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy," 283 + "b.jyggh as jyggh,b.jzl as jzl ,b.stationid as stationid,b.jsy as jsy,"
281 + "b.nylx as nylx,b.yj as yj,b.bz as bz,b.id as id ,c.jsy as ldgh FROM bsth_c_cwjy a "+ 284 + "b.nylx as nylx,b.yj as yj,b.bz as bz,b.id as id ,c.jsy as ldgh FROM bsth_c_cwjy a "+
282 " left join (" 285 " left join ("
283 + " select * from bsth_c_ylxxb b " 286 + " select * from bsth_c_ylxxb b "
284 - + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1) b " + 287 + + "where to_days(b.yyrq)=to_days('"+rq+"') and jylx=1 "
  288 + + " and gsdm = '"+gsdm+"') b " +
285 " on a.nbbm=b.nbbm " 289 " on a.nbbm=b.nbbm "
286 + "left join (select nbbm,group_concat(jsy) as jsy " 290 + "left join (select nbbm,group_concat(jsy) as jsy "
287 - + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) group by nbbm "+ 291 + + "from bsth_c_ylb where to_days(rq)= to_days('"+rq+"' ) "
  292 + + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' group by nbbm "+
288 " ) c on a.nbbm=c.nbbm " 293 " ) c on a.nbbm=c.nbbm "
289 - + "where a.nbbm like '%"+nbbm+"%'"; 294 + + "where a.nbbm like '%"+nbbm+"%' and a.gsdm='"+gsdm+"' and a.fgsdm ='"+fgsdm+"'";
290 295
291 List<Ylxxb> yList= jdbcTemplate.query(sql, 296 List<Ylxxb> yList= jdbcTemplate.query(sql,
292 new RowMapper<Ylxxb>(){ 297 new RowMapper<Ylxxb>(){
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
@@ -102,7 +102,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -102,7 +102,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
102 //当天YLXXB信息 102 //当天YLXXB信息
103 // List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq); 103 // List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq);
104 //前一天所有车辆最后进场班次信息 104 //前一天所有车辆最后进场班次信息
105 - List<Ylb> ylListBe=repository.obtainYlbefore(rq,"","","",""); 105 +// List<Ylb> ylListBe=repository.obtainYlbefore(rq,"","","","");
  106 + List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, "", "", "", "");
106 List<Cyl> clyList=cylRepository.obtainCyl("",""); 107 List<Cyl> clyList=cylRepository.obtainCyl("","");
107 //从排班表中计算出行驶的总里程 108 //从排班表中计算出行驶的总里程
108 List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", rq, "", "", "", ""); 109 List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", rq, "", "", "", "");
@@ -240,7 +241,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -240,7 +241,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
240 // 当天YLXXB信息 241 // 当天YLXXB信息
241 List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm); 242 List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm);
242 // 前一天所有车辆最后进场班次信息 243 // 前一天所有车辆最后进场班次信息
243 - List<Ylb> ylListBe = repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm); 244 +// List<Ylb> ylListBe = repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm);
  245 + List<Ylb> ylListBe =repository.listMaxRqJcsx(rq, gsbm, fgsbm, line, nbbm);
244 List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm); 246 List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm);
245 // 从排班表中计算出行驶的总里程 247 // 从排班表中计算出行驶的总里程
246 List<Map<String, Object>> listpb = scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm); 248 List<Map<String, Object>> listpb = scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm);
@@ -325,7 +327,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -325,7 +327,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
325 t.setNbbm(map.get("clZbh").toString()); 327 t.setNbbm(map.get("clZbh").toString());
326 t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); 328 t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
327 t.setZlc(map.get("totalKilometers") == null ? 0.0 329 t.setZlc(map.get("totalKilometers") == null ? 0.0
328 - : Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); 330 + : Double.parseDouble(map.get("totalKilometers").toString()));
329 t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); 331 t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
330 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); 332 t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
331 t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); 333 t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
@@ -451,13 +453,21 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -451,13 +453,21 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
451 nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()), t.getCzyl()),yh); 453 nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()), t.getCzyl()),yh);
452 //把进场油量的小数和整数分别取出 454 //把进场油量的小数和整数分别取出
453 // int ylxs=(int) nextJzyl; 10.6--11 10.3--10 455 // int ylxs=(int) nextJzyl; 10.6--11 10.3--10
454 - long l=Math.round(nextJzyl);  
455 - double ylxs=l*100/100;  
456 -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));  
457 - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));  
458 - t.setYh(yh);  
459 - t.setJzyl(ylxs);  
460 - nextJzyl=ylxs; 456 + if(zlc>0){
  457 + long l=Math.round(nextJzyl);
  458 + double ylxs=l*100/100;
  459 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  460 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  461 + t.setYh(yh);
  462 + t.setJzyl(ylxs);
  463 + nextJzyl=ylxs;
  464 + }else{
  465 + t.setYh(yh);
  466 + t.setJzyl(nextJzyl);
  467 + }
  468 +
  469 +
  470 +
461 } else { 471 } else {
462 t.setCzyl(nextJzyl); 472 t.setCzyl(nextJzyl);
463 Double yh=0.0; 473 Double yh=0.0;
@@ -465,16 +475,21 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -465,16 +475,21 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
465 yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); 475 yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
466 } 476 }
467 nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()),nextJzyl),yh); 477 nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()),nextJzyl),yh);
468 - long l=Math.round(nextJzyl);  
469 - double ylxs=l*100/100;  
470 -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));  
471 - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));  
472 - t.setYh(yh);  
473 - t.setJzyl(ylxs);  
474 - nextJzyl= ylxs; 478 + if(zlc>0){
  479 + long l=Math.round(nextJzyl);
  480 + double ylxs=l*100/100;
  481 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  482 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  483 + t.setYh(yh);
  484 + t.setJzyl(ylxs);
  485 + nextJzyl=ylxs;
  486 + }else{
  487 + t.setYh(yh);
  488 + t.setJzyl(nextJzyl);
  489 + }
475 } 490 }
476 repository.save(t); 491 repository.save(t);
477 - for (int z = 0; z < cylList.size(); z++) { 492 + /*for (int z = 0; z < cylList.size(); z++) {
478 Cyl cyl = cylList.get(z); 493 Cyl cyl = cylList.get(z);
479 if (t.getNbbm().equals(cyl.getNbbm())) { 494 if (t.getNbbm().equals(cyl.getNbbm())) {
480 cyl.setCyl(t.getJzyl()); 495 cyl.setCyl(t.getJzyl());
@@ -482,7 +497,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -482,7 +497,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
482 break; 497 break;
483 } 498 }
484 cylRepository.save(cyl); 499 cylRepository.save(cyl);
485 - } 500 + }*/
486 } 501 }
487 map2.put("status", ResponseCode.SUCCESS); 502 map2.put("status", ResponseCode.SUCCESS);
488 } 503 }
@@ -687,7 +702,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -687,7 +702,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
687 if(map.get("nbbm_eq")!=null){ 702 if(map.get("nbbm_eq")!=null){
688 nbbm=map.get("nbbm_eq").toString(); 703 nbbm=map.get("nbbm_eq").toString();
689 } 704 }
690 - List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); 705 +// List<Ylb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm);
  706 + List<Ylb> ylListBe=repository.listMaxRqJcsx(rq, gsbm, fgsbm, xlbm, nbbm);
691 List<Cyl> cylList=cylRepository.obtainCyl(nbbm, gsbm); 707 List<Cyl> cylList=cylRepository.obtainCyl(nbbm, gsbm);
692 List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); 708 List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm");
693 List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); 709 List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm);
@@ -751,11 +767,11 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -751,11 +767,11 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
751 t.setYh(0.0); 767 t.setYh(0.0);
752 if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ 768 if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
753 repository.save(t); 769 repository.save(t);
754 - if(null!=cyl){ 770 + /*if(null!=cyl){
755 cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl())); 771 cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl()));
756 cyl.setUpdatetime(y1.getYyrq()); 772 cyl.setUpdatetime(y1.getYyrq());
757 cylRepository.save(cyl); 773 cylRepository.save(cyl);
758 - } 774 + }*/
759 } 775 }
760 } 776 }
761 } 777 }
@@ -1048,7 +1064,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1048,7 +1064,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1048 t.setRylx(rylx); 1064 t.setRylx(rylx);
1049 t.setId(jsonObject.getInteger("id"));*/ 1065 t.setId(jsonObject.getInteger("id"));*/
1050 repository.ylbUpdate(id, czyl, jzyl, yh, sh, shyy, ns, rylx,yhlx); 1066 repository.ylbUpdate(id, czyl, jzyl, yh, sh, shyy, ns, rylx,yhlx);
1051 - for (int z = 0; z < cylList.size(); z++) { 1067 + /*for (int z = 0; z < cylList.size(); z++) {
1052 Cyl cyl = cylList.get(z); 1068 Cyl cyl = cylList.get(z);
1053 if (nbbm.equals(cyl.getNbbm())) { 1069 if (nbbm.equals(cyl.getNbbm())) {
1054 cyl.setCyl(jzyl); 1070 cyl.setCyl(jzyl);
@@ -1056,7 +1072,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1056,7 +1072,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1056 break; 1072 break;
1057 } 1073 }
1058 cylRepository.save(cyl); 1074 cylRepository.save(cyl);
1059 - } 1075 + }*/
1060 } 1076 }
1061 // List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList"); 1077 // List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList");
1062 1078
@@ -1139,13 +1155,18 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1139,13 +1155,18 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1139 yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); 1155 yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
1140 } 1156 }
1141 nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh())); 1157 nextJzyl =Arith.sub(Arith.add(t.getJzl(), t.getCzyl()), Arith.add(yh, t.getSh()));
1142 - long l=Math.round(nextJzyl);  
1143 - double ylxs=l*100/100;  
1144 -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));  
1145 - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));  
1146 - t.setJzyl(ylxs);  
1147 - t.setYh(yh);  
1148 - nextJzyl=ylxs; 1158 + if(zlc>0){
  1159 + long l=Math.round(nextJzyl);
  1160 + double ylxs=l*100/100;
  1161 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  1162 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  1163 + t.setYh(yh);
  1164 + t.setJzyl(ylxs);
  1165 + nextJzyl=ylxs;
  1166 + }else{
  1167 + t.setYh(yh);
  1168 + t.setJzyl(nextJzyl);
  1169 + }
1149 } else { 1170 } else {
1150 if(t.getId()==id){ 1171 if(t.getId()==id){
1151 t.setSh(sh); 1172 t.setSh(sh);
@@ -1157,16 +1178,21 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1157,16 +1178,21 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1157 yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); 1178 yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
1158 } 1179 }
1159 nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh())); 1180 nextJzyl = Arith.sub(Arith.add(t.getJzl(), nextJzyl), Arith.add(yh, t.getSh()));
1160 - long l=Math.round(nextJzyl);  
1161 - double ylxs=l*100/100;  
1162 -// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));  
1163 - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));  
1164 - t.setJzyl(ylxs);  
1165 - t.setYh(yh);  
1166 - nextJzyl=ylxs; 1181 + if(zlc>0){
  1182 + long l=Math.round(nextJzyl);
  1183 + double ylxs=l*100/100;
  1184 +// nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
  1185 + yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl));
  1186 + t.setYh(yh);
  1187 + t.setJzyl(ylxs);
  1188 + nextJzyl=ylxs;
  1189 + }else{
  1190 + t.setYh(yh);
  1191 + t.setJzyl(nextJzyl);
  1192 + }
1167 } 1193 }
1168 repository.save(t); 1194 repository.save(t);
1169 - for (int z = 0; z < cylList.size(); z++) { 1195 + /*for (int z = 0; z < cylList.size(); z++) {
1170 Cyl cyl = cylList.get(z); 1196 Cyl cyl = cylList.get(z);
1171 if (t.getNbbm().equals(cyl.getNbbm())) { 1197 if (t.getNbbm().equals(cyl.getNbbm())) {
1172 cyl.setCyl(t.getJzyl()); 1198 cyl.setCyl(t.getJzyl());
@@ -1174,7 +1200,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1174,7 +1200,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1174 break; 1200 break;
1175 } 1201 }
1176 cylRepository.save(cyl); 1202 cylRepository.save(cyl);
1177 - } 1203 + }*/
1178 } 1204 }
1179 newMap.put("status", ResponseCode.SUCCESS); 1205 newMap.put("status", ResponseCode.SUCCESS);
1180 } 1206 }
src/main/java/com/bsth/service/realcontrol/RealMapService.java
@@ -10,7 +10,7 @@ public interface RealMapService { @@ -10,7 +10,7 @@ public interface RealMapService {
10 10
11 Map<String,Object> carParkSpatialData(); 11 Map<String,Object> carParkSpatialData();
12 12
13 - Map<String,Object> findRouteByLine(String lineCode); 13 + Map<String, Object> findRouteByLine(String idx);
14 14
15 Map<String,Object> findRouteAndStationByLine(String lineCode); 15 Map<String,Object> findRouteAndStationByLine(String lineCode);
16 16
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
@@ -2,11 +2,14 @@ package com.bsth.service.realcontrol.impl; @@ -2,11 +2,14 @@ package com.bsth.service.realcontrol.impl;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.realcontrol.dto.StationSpatialData; 4 import com.bsth.controller.realcontrol.dto.StationSpatialData;
  5 +import com.bsth.data.gpsdata.arrival.utils.GeoUtils;
5 import com.bsth.entity.CarPark; 6 import com.bsth.entity.CarPark;
6 import com.bsth.service.realcontrol.RealMapService; 7 import com.bsth.service.realcontrol.RealMapService;
7 import com.bsth.service.realcontrol.dto.SectionRouteCoords; 8 import com.bsth.service.realcontrol.dto.SectionRouteCoords;
8 import com.bsth.util.TransGPS; 9 import com.bsth.util.TransGPS;
9 import com.google.common.base.Splitter; 10 import com.google.common.base.Splitter;
  11 +import com.google.common.collect.ArrayListMultimap;
  12 +import com.vividsolutions.jts.geom.*;
10 import org.slf4j.Logger; 13 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory; 14 import org.slf4j.LoggerFactory;
12 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
@@ -74,10 +77,17 @@ public class RealMapServiceImpl implements RealMapService { @@ -74,10 +77,17 @@ public class RealMapServiceImpl implements RealMapService {
74 } 77 }
75 78
76 @Override 79 @Override
77 - public Map<String, Object> findRouteByLine(String lineCode) { 80 + public Map<String, Object> findRouteByLine(String idx) {
78 Map<String, Object> rs = new HashMap<>(); 81 Map<String, Object> rs = new HashMap<>();
79 - String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code=? and r.destroy=0 order by sectionroute_code";  
80 - List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class), lineCode); 82 + StringBuilder inCond = new StringBuilder("(");
  83 + List<String> codeList = Splitter.on(",").splitToList(idx);
  84 + for(String lineCode : codeList){
  85 + inCond.append("'" + lineCode + "',");
  86 + }
  87 + inCond.deleteCharAt(inCond.length() - 1).append(")");
  88 +
  89 + String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code in "+inCond.toString()+" and r.destroy=0 order by sectionroute_code";
  90 + List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class));
81 91
82 //排序 92 //排序
83 Collections.sort(list, new Comparator<SectionRouteCoords>() { 93 Collections.sort(list, new Comparator<SectionRouteCoords>() {
@@ -87,28 +97,40 @@ public class RealMapServiceImpl implements RealMapService { @@ -87,28 +97,40 @@ public class RealMapServiceImpl implements RealMapService {
87 } 97 }
88 }); 98 });
89 99
90 - List<String> upList = new ArrayList<>(),  
91 - downList = new ArrayList<>();  
92 -  
93 - String vectorStr = ""; 100 + ArrayListMultimap<String, SectionRouteCoords> listMultimap = ArrayListMultimap.create();
94 for (SectionRouteCoords sr : list) { 101 for (SectionRouteCoords sr : list) {
95 - vectorStr = sr.getGsectionVector();  
96 - vectorStr = vectorStr.substring(11, vectorStr.length() - 2);  
97 -  
98 - if (sr.getDirections() == 0)  
99 - upList.add(vectorStr);  
100 - else  
101 - downList.add(vectorStr); 102 + //按lineCode 分组
  103 + listMultimap.put(sr.getLineCode(), sr);
  104 + }
  105 + //坐标转换
  106 + Map<String, Object> subMap;
  107 + Set<String> ks = listMultimap.keySet();
  108 + List<SectionRouteCoords> sublist;
  109 + List<String> upList,downList;
  110 + String vectorStr = "";
  111 + for(String k : ks){
  112 + subMap = new HashMap<>();
  113 + sublist = listMultimap.get(k);
  114 + upList = new ArrayList<>();
  115 + downList = new ArrayList<>();
  116 + for(SectionRouteCoords sr : sublist){
  117 + vectorStr = sr.getGsectionVector();
  118 + vectorStr = vectorStr.substring(11, vectorStr.length() - 2);
  119 + if (sr.getDirections() == 0)
  120 + upList.add(vectorStr);
  121 + else
  122 + downList.add(vectorStr);
  123 + }
  124 + subMap.put("up", upList);
  125 + //subMap.put("upJoins", jointCoords(upList));
  126 + subMap.put("down", downList);
  127 + subMap.put("up_bd", multiWgsToBd(upList));
  128 + subMap.put("down_bd", multiWgsToBd(downList));
  129 + subMap.put("up_gcj", multiWgsToGcj(upList));
  130 + subMap.put("down_gcj", multiWgsToGcj(downList));
  131 +
  132 + rs.put(k, subMap);
102 } 133 }
103 -  
104 - rs.put("up", upList);  
105 - rs.put("down", downList);  
106 - rs.put("up_bd", multiWgsToBd(upList));  
107 - rs.put("down_bd", multiWgsToBd(downList));  
108 - rs.put("up_gcj", multiWgsToGcj(upList));  
109 - rs.put("down_gcj", multiWgsToGcj(downList));  
110 -  
111 - rs.put("lineId", lineCode);  
112 return rs; 134 return rs;
113 } 135 }
114 136
@@ -227,4 +249,115 @@ public class RealMapServiceImpl implements RealMapService { @@ -227,4 +249,115 @@ public class RealMapServiceImpl implements RealMapService {
227 } 249 }
228 return gcjList; 250 return gcjList;
229 } 251 }
  252 +
  253 + /**
  254 + * 将相连的路段拼接起来,去掉接口覆盖区域。
  255 + * 主要因为前端地图绘制时,过多的路段会带来性能消耗。在这里提前拼接好以减少路段数量
  256 + * @param list
  257 + * @return
  258 + */
  259 + private List<String> jointCoords(List<String> list){
  260 + List<String> rs = new ArrayList<>();
  261 + int len = list.size();
  262 + if(len == 0)
  263 + return rs;
  264 +
  265 + StringBuilder joinstr = new StringBuilder(list.get(0));
  266 + String str;
  267 + for(int i = 1; i < len; i ++){
  268 + str = jointCoords(joinstr.toString(), list.get(i));
  269 + if(str != null)
  270 + joinstr.append("," + str);
  271 + else{
  272 + rs.add(joinstr.toString());
  273 + joinstr = new StringBuilder(list.get(i));
  274 + }
  275 + }
  276 + rs.add(joinstr.toString());
  277 + return rs;
  278 + }
  279 +
  280 + static GeometryFactory geometryFactory = new GeometryFactory();
  281 + private String jointCoords(String c1, String c2){
  282 + String rs=null;
  283 + LineString s1 = createLineString(c1);
  284 + LineString s2 = createLineString(c2);
  285 +
  286 + if(s1.intersects(s2)){
  287 + Geometry g = s1.intersection(s2);
  288 + Point inPoint = geometryFactory.createPoint(g.getCoordinates()[0]);//第一个交点
  289 +
  290 + //第一条线截断至交点
  291 + rs = truncationEnd(s1, inPoint);
  292 + //第二条线从交点开始
  293 + rs += ("," + truncationStart(s2, inPoint));
  294 + }
  295 + return rs;
  296 + }
  297 +
  298 + private LineString createLineString(String c){
  299 + List<String> list = Splitter.on(",").splitToList(c);
  300 +
  301 + Coordinate[] cds = new Coordinate[list.size()];
  302 + String[] strs;
  303 + for(int i = 0; i < list.size(); i ++){
  304 + strs = list.get(i).split(" ");
  305 + cds[i] = new Coordinate(Float.parseFloat(strs[1]), Float.parseFloat(strs[0]));
  306 + }
  307 + return geometryFactory.createLineString(cds);
  308 + }
  309 +
  310 + private String truncationEnd(LineString lineString, Point p){
  311 + Coordinate[] all = lineString.getCoordinates();
  312 + LineString sl;
  313 +
  314 + Coordinate[] cs;
  315 + StringBuilder sb = new StringBuilder("");
  316 + double threshold = 0.1,distance;
  317 + for(int i = 0; i < all.length - 1; i ++){
  318 + cs = new Coordinate[2];
  319 + cs[0] = all[i];
  320 + cs[1] = all[i + 1];
  321 + sl = geometryFactory.createLineString(cs);
  322 +
  323 + sb.append("," + cs[0].y + " " + cs[0].x);
  324 + distance = GeoUtils.getDistanceFromLine(sl, p);
  325 + if(distance < threshold){
  326 + sb.append("," + p.getY() + " " + p.getX());
  327 + break;
  328 + }
  329 + else
  330 + sb.append("," + cs[1].y + " " + cs[1].x);
  331 + }
  332 + sb.deleteCharAt(0);
  333 + return sb.toString();
  334 + }
  335 +
  336 + private String truncationStart(LineString lineString, Point p){
  337 + Coordinate[] all = lineString.getCoordinates();
  338 + LineString sl;
  339 +
  340 + Coordinate[] cs;
  341 + StringBuilder sb = new StringBuilder("");
  342 + double threshold = 0.1,distance;
  343 + for(int i = 0; i < all.length - 1; i ++){
  344 + cs = new Coordinate[2];
  345 + cs[0] = all[i];
  346 + cs[1] = all[i + 1];
  347 + sl = geometryFactory.createLineString(cs);
  348 +
  349 + distance = GeoUtils.getDistanceFromLine(sl, p);
  350 + if(distance < threshold){
  351 + sb.append("," + p.getY() + " " + p.getX());
  352 + sb.append("," + cs[1].y + " " + cs[1].x);
  353 + break;
  354 + }
  355 + else{
  356 + sb.append("," + cs[0].y + " " + cs[0].x);
  357 + sb.append("," + cs[1].y + " " + cs[1].x);
  358 + }
  359 + }
  360 + sb.deleteCharAt(0);
  361 + return sb.toString();
  362 + }
230 } 363 }
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -2728,12 +2728,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2728,12 +2728,13 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2728 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1)); 2728 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
2729 // String date = "2016-09-20"; 2729 // String date = "2016-09-20";
2730 // System.out.println("shijian1:"+new Date()); 2730 // System.out.println("shijian1:"+new Date());
2731 - List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm); 2731 + List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm,nbbm);
2732 // System.out.println("shijian2:"+new Date()); 2732 // System.out.println("shijian2:"+new Date());
2733 // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); 2733 // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
2734 List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date,gsbm,fgsbm); 2734 List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date,gsbm,fgsbm);
2735 // System.out.println("shijian3:"+new Date()); 2735 // System.out.println("shijian3:"+new Date());
2736 for (int x = 0; x < yesterdayDataList.size(); x++) { 2736 for (int x = 0; x < yesterdayDataList.size(); x++) {
  2737 +
2737 String jName = yesterdayDataList.get(x).get("jGh").toString(); 2738 String jName = yesterdayDataList.get(x).get("jGh").toString();
2738 String clZbh = yesterdayDataList.get(x).get("clZbh").toString(); 2739 String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
2739 2740
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
@@ -12,6 +12,7 @@ import com.bsth.service.schedule.exception.ScheduleException; @@ -12,6 +12,7 @@ import com.bsth.service.schedule.exception.ScheduleException;
12 import com.bsth.service.schedule.rules.ScheduleRuleService; 12 import com.bsth.service.schedule.rules.ScheduleRuleService;
13 import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input; 13 import com.bsth.service.schedule.rules.plan.PlanCalcuParam_input;
14 import com.bsth.service.schedule.rules.plan.PlanResult; 14 import com.bsth.service.schedule.rules.plan.PlanResult;
  15 +import com.bsth.service.schedule.rules.rerun.RerunRule_input;
15 import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; 16 import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
16 import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; 17 import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
17 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; 18 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
@@ -101,7 +102,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -101,7 +102,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
101 // 执行完毕销毁,有日志的也要关闭 102 // 执行完毕销毁,有日志的也要关闭
102 session.dispose(); 103 session.dispose();
103 104
104 - logger.info("循环规则输出={}", scheduleResults_output.showGuideboardDesc1()); 105 +// logger.info("循环规则输出={}", scheduleResults_output.showGuideboardDesc1());
105 106
106 return scheduleResults_output; 107 return scheduleResults_output;
107 } 108 }
@@ -258,6 +259,8 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -258,6 +259,8 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
258 PlanResult planResult = SchedulePlanWithOutRerun(schedulePlan); 259 PlanResult planResult = SchedulePlanWithOutRerun(schedulePlan);
259 260
260 // TODO 3、确定套跑规则 261 // TODO 3、确定套跑规则
  262 + List<RerunRule_input> rerunRule_inputs = scheduleRuleService.findRerunrule(schedulePlan.getXl().getId());
  263 + logger.info("套跑数量 {} 组", rerunRule_inputs.size());
261 264
262 // 4、保存数据(jdbcTemplate 批量插入) 265 // 4、保存数据(jdbcTemplate 批量插入)
263 Date start4 = new Date(); 266 Date start4 = new Date();
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
@@ -98,10 +98,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -98,10 +98,10 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
98 public List<Map<String, Object>> findZdAndTcc(int lineid, int xldir) { 98 public List<Map<String, Object>> findZdAndTcc(int lineid, int xldir) {
99 String sql = "select * from " + 99 String sql = "select * from " +
100 "(" + 100 "(" +
101 - "select station_code as zcode, station_name as zname from bsth_c_stationroute " + 101 + "select station_code as zcode, station_name as zname, concat(station_name, '(站点)') as aname from bsth_c_stationroute " +
102 "where destroy = 0 and line = ? and directions = ? " + 102 "where destroy = 0 and line = ? and directions = ? " +
103 "union all " + 103 "union all " +
104 - "select park_code as zcode, park_name as zname from bsth_c_car_park " + 104 + "select park_code as zcode, park_name as zname, concat(park_name, '(停车场)') as aname from bsth_c_car_park " +
105 "where destroy = 0 " + 105 "where destroy = 0 " +
106 ") a "; 106 ") a ";
107 107
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleService.java
@@ -3,6 +3,7 @@ package com.bsth.service.schedule.rules; @@ -3,6 +3,7 @@ package com.bsth.service.schedule.rules;
3 import com.bsth.entity.schedule.SchedulePlan; 3 import com.bsth.entity.schedule.SchedulePlan;
4 import com.bsth.entity.schedule.SchedulePlanInfo; 4 import com.bsth.entity.schedule.SchedulePlanInfo;
5 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; 5 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult;
  6 +import com.bsth.service.schedule.rules.rerun.RerunRule_input;
6 7
7 import java.util.Date; 8 import java.util.Date;
8 import java.util.List; 9 import java.util.List;
@@ -42,5 +43,13 @@ public interface ScheduleRuleService { @@ -42,5 +43,13 @@ public interface ScheduleRuleService {
42 * @param dateto 结束日期 43 * @param dateto 结束日期
43 */ 44 */
44 void deelteSchedulePlanInfo(Integer xlid, Date datefrom, Date dateto); 45 void deelteSchedulePlanInfo(Integer xlid, Date datefrom, Date dateto);
  46 +
  47 + /**
  48 + * 查找线路的套跑规则,并封装成规则输入对象。
  49 + * @param xlid
  50 + * @return
  51 + */
  52 + List<RerunRule_input> findRerunrule(Integer xlid);
  53 +
45 } 54 }
46 55
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleServiceImpl.java
@@ -3,13 +3,11 @@ package com.bsth.service.schedule.rules; @@ -3,13 +3,11 @@ package com.bsth.service.schedule.rules;
3 import com.bsth.entity.schedule.SchedulePlan; 3 import com.bsth.entity.schedule.SchedulePlan;
4 import com.bsth.entity.schedule.SchedulePlanInfo; 4 import com.bsth.entity.schedule.SchedulePlanInfo;
5 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult; 5 import com.bsth.entity.schedule.temp.SchedulePlanRuleResult;
  6 +import com.bsth.service.schedule.rules.rerun.RerunRule_input;
6 import org.slf4j.Logger; 7 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
9 -import org.springframework.jdbc.core.BatchPreparedStatementSetter;  
10 -import org.springframework.jdbc.core.JdbcTemplate;  
11 -import org.springframework.jdbc.core.PreparedStatementCreator;  
12 -import org.springframework.jdbc.core.RowMapper; 10 +import org.springframework.jdbc.core.*;
13 import org.springframework.jdbc.support.GeneratedKeyHolder; 11 import org.springframework.jdbc.support.GeneratedKeyHolder;
14 import org.springframework.jdbc.support.KeyHolder; 12 import org.springframework.jdbc.support.KeyHolder;
15 import org.springframework.stereotype.Service; 13 import org.springframework.stereotype.Service;
@@ -37,6 +35,75 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService { @@ -37,6 +35,75 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService {
37 private JdbcTemplate jdbcTemplate; 35 private JdbcTemplate jdbcTemplate;
38 36
39 @Override 37 @Override
  38 + public List<RerunRule_input> findRerunrule(Integer xlid) {
  39 + String sql = "select " +
  40 + "rerun_type as type " +
  41 + ", rerun_xl as m_xl " +
  42 + ", rerun_ttinfo as m_ttinfo " +
  43 + ", rerun_lp as m_lp " +
  44 + ", rerun_ttinfodetail_fcsjs as m_fcsjs " +
  45 + ", use_xl as s_dylp_xl " +
  46 + ", use_lp as s_dylp_lp " +
  47 + ", cl as s_dybc_cl " +
  48 + ", cl_zbh as s_dybc_clzbh " +
  49 + ", j as s_dybc_j " +
  50 + ", j_gh as s_dybc_jgh " +
  51 + ", j_name as s_dybc_jname " +
  52 + ", s as s_dybc_s " +
  53 + ", s_gh as s_dybc_sgh " +
  54 + ", s_name as s_dybc_sname " +
  55 + "from bsth_c_s_rerun_rule " +
  56 + "where rerun_xl = ? ";
  57 +
  58 + final List<RerunRule_input> rerunRule_inputs = new ArrayList<>();
  59 +
  60 + jdbcTemplate.query(sql, new Object[]{xlid}, new RowCallbackHandler() {
  61 + @Override
  62 + public void processRow(ResultSet resultSet) throws SQLException {
  63 + // 发车时间
  64 + String[] fcsjs = resultSet.getString("m_fcsjs").split(",");
  65 + for (String fcsj: fcsjs) {
  66 + RerunRule_input rerunRule_input = new RerunRule_input();
  67 + rerunRule_input.setXl(String.valueOf(resultSet.getInt("m_xl")));
  68 + rerunRule_input.setTtinfo(String.valueOf(resultSet.getLong("m_ttinfo")));
  69 + rerunRule_input.setLp(String.valueOf(resultSet.getLong("m_lp")));
  70 + rerunRule_input.setFcsj(fcsj);
  71 +
  72 + rerunRule_input.setType(resultSet.getString("type"));
  73 + // 对应班次类型
  74 + if ("dybc".equals(resultSet.getString("type"))) {
  75 + rerunRule_input.setS_xl(String.valueOf(resultSet.getInt("s_dylp_xl")));
  76 + rerunRule_input.setS_lp(String.valueOf(resultSet.getLong("s_dylp_lp")));
  77 + } else if ("dylp".equals(resultSet.getString("type"))) {
  78 + rerunRule_input.setCl(resultSet.getInt("s_dybc_cl"));
  79 + rerunRule_input.setZbh(resultSet.getString("s_dybc_clzbh"));
  80 + rerunRule_input.setJ(resultSet.getInt("s_dybc_j"));
  81 + rerunRule_input.setJgh(resultSet.getString("s_dybc_jgh"));
  82 + rerunRule_input.setJname(resultSet.getString("s_dybc_jname"));
  83 + rerunRule_input.setS(resultSet.getInt("s_dybc_s"));
  84 + rerunRule_input.setSgh(resultSet.getString("s_dybc_sgh"));
  85 + rerunRule_input.setSname(resultSet.getString("s_dybc_sname"));
  86 + }
  87 +
  88 + rerunRule_inputs.add(rerunRule_input);
  89 + }
  90 +
  91 + }
  92 + });
  93 +
  94 + return rerunRule_inputs;
  95 + }
  96 +
  97 + public void test() {
  98 + jdbcTemplate.query("", new RowCallbackHandler() {
  99 + @Override
  100 + public void processRow(ResultSet resultSet) throws SQLException {
  101 +
  102 + }
  103 + });
  104 + }
  105 +
  106 + @Override
40 public List<SchedulePlanRuleResult> findLastByXl(String xlid, Date from) { 107 public List<SchedulePlanRuleResult> findLastByXl(String xlid, Date from) {
41 String sql = "select * from bsth_c_s_sp_rule_rst a " + 108 String sql = "select * from bsth_c_s_sp_rule_rst a " +
42 "where exists (select 1 from " + 109 "where exists (select 1 from " +
src/main/java/com/bsth/service/schedule/rules/rerun/RerunRule_input.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.rerun;
  2 +
  3 +/**
  4 + * Created by xu on 17/4/26.
  5 + */
  6 +public class RerunRule_input {
  7 + private String xl; // 主线路Id
  8 + private String ttinfo; // 时刻表Id
  9 + private String lp; // 路牌
  10 + private String fcsj; // 发车时间
  11 +
  12 + private String type; // 套跑类型(dylp-对应路牌, dybc-对应班车)
  13 + private String s_xl; // 对应路牌,线路Id
  14 + private String s_lp; // 对应路牌,路牌Id
  15 +
  16 + private Integer cl; // 对应班车,车辆Id
  17 + private String zbh; // 对应班车,车辆自编号
  18 + private Integer j; // 对应班车,驾驶员Id
  19 + private String jgh; // 对应班车,驾驶员工号
  20 + private String jname; // 对应班车,驾驶员姓名
  21 + private Integer s; // 对应班车,售票员Id
  22 + private String sgh; // 对应班车,售票员工号
  23 + private String sname; // 对应班车,售票员姓名
  24 +
  25 + public String getXl() {
  26 + return xl;
  27 + }
  28 +
  29 + public void setXl(String xl) {
  30 + this.xl = xl;
  31 + }
  32 +
  33 + public String getTtinfo() {
  34 + return ttinfo;
  35 + }
  36 +
  37 + public void setTtinfo(String ttinfo) {
  38 + this.ttinfo = ttinfo;
  39 + }
  40 +
  41 + public String getLp() {
  42 + return lp;
  43 + }
  44 +
  45 + public void setLp(String lp) {
  46 + this.lp = lp;
  47 + }
  48 +
  49 + public String getFcsj() {
  50 + return fcsj;
  51 + }
  52 +
  53 + public void setFcsj(String fcsj) {
  54 + this.fcsj = fcsj;
  55 + }
  56 +
  57 + public String getType() {
  58 + return type;
  59 + }
  60 +
  61 + public void setType(String type) {
  62 + this.type = type;
  63 + }
  64 +
  65 + public String getS_xl() {
  66 + return s_xl;
  67 + }
  68 +
  69 + public void setS_xl(String s_xl) {
  70 + this.s_xl = s_xl;
  71 + }
  72 +
  73 + public String getS_lp() {
  74 + return s_lp;
  75 + }
  76 +
  77 + public void setS_lp(String s_lp) {
  78 + this.s_lp = s_lp;
  79 + }
  80 +
  81 + public Integer getCl() {
  82 + return cl;
  83 + }
  84 +
  85 + public void setCl(Integer cl) {
  86 + this.cl = cl;
  87 + }
  88 +
  89 + public String getZbh() {
  90 + return zbh;
  91 + }
  92 +
  93 + public void setZbh(String zbh) {
  94 + this.zbh = zbh;
  95 + }
  96 +
  97 + public Integer getJ() {
  98 + return j;
  99 + }
  100 +
  101 + public void setJ(Integer j) {
  102 + this.j = j;
  103 + }
  104 +
  105 + public String getJgh() {
  106 + return jgh;
  107 + }
  108 +
  109 + public void setJgh(String jgh) {
  110 + this.jgh = jgh;
  111 + }
  112 +
  113 + public String getJname() {
  114 + return jname;
  115 + }
  116 +
  117 + public void setJname(String jname) {
  118 + this.jname = jname;
  119 + }
  120 +
  121 + public Integer getS() {
  122 + return s;
  123 + }
  124 +
  125 + public void setS(Integer s) {
  126 + this.s = s;
  127 + }
  128 +
  129 + public String getSgh() {
  130 + return sgh;
  131 + }
  132 +
  133 + public void setSgh(String sgh) {
  134 + this.sgh = sgh;
  135 + }
  136 +
  137 + public String getSname() {
  138 + return sname;
  139 + }
  140 +
  141 + public void setSname(String sname) {
  142 + this.sname = sname;
  143 + }
  144 +}
src/main/resources/application-dev.properties
@@ -6,7 +6,7 @@ spring.jpa.hibernate.ddl-auto= update @@ -6,7 +6,7 @@ spring.jpa.hibernate.ddl-auto= update
6 spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy 6 spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
7 #DATABASE 7 #DATABASE
8 spring.jpa.database= MYSQL 8 spring.jpa.database= MYSQL
9 -spring.jpa.show-sql= true 9 +spring.jpa.show-sql= false
10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver 10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver
11 spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false 11 spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
12 spring.datasource.username= root 12 spring.datasource.username= root
src/main/resources/rules/shiftloop_fb_2.drl
@@ -76,7 +76,7 @@ rule &quot;calcu_days_1_&quot; @@ -76,7 +76,7 @@ rule &quot;calcu_days_1_&quot;
76 76
77 insert(cdrp); 77 insert(cdrp);
78 78
79 - log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $fromDate, $toDate); 79 +// log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $fromDate, $toDate);
80 80
81 end 81 end
82 82
@@ -108,7 +108,7 @@ rule &quot;calcu_days_2_&quot; @@ -108,7 +108,7 @@ rule &quot;calcu_days_2_&quot;
108 108
109 insert(cdrp); 109 insert(cdrp);
110 110
111 - log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $qyrq, $toDate); 111 +// log.info("总共需要排班的天数 sdays={} ruleId={} from={} to={}", (p2.getDays() + 1), $ruleId, $qyrq, $toDate);
112 112
113 end 113 end
114 114
@@ -169,7 +169,7 @@ rule &quot;calcu_days_1_with_result&quot; @@ -169,7 +169,7 @@ rule &quot;calcu_days_1_with_result&quot;
169 ) 169 )
170 then 170 then
171 // 修正排班数据 171 // 修正排班数据
172 - log.info("准备修正 ruleId={} historyDate={}", $ruleId, $scheduleDate); 172 +// log.info("准备修正 ruleId={} historyDate={}", $ruleId, $scheduleDate);
173 173
174 $cdrp.setCalcu_index_lp(Integer.valueOf($self.getGidindex())); 174 $cdrp.setCalcu_index_lp(Integer.valueOf($self.getGidindex()));
175 $cdrp.setCalcu_index_ry(Integer.valueOf($self.getEcindex())); 175 $cdrp.setCalcu_index_ry(Integer.valueOf($self.getEcindex()));
@@ -211,8 +211,8 @@ rule &quot;Calcu_loop1_1_&quot; // 路牌在时刻表中存在,就翻 @@ -211,8 +211,8 @@ rule &quot;Calcu_loop1_1_&quot; // 路牌在时刻表中存在,就翻
211 $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize); 211 $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);
212 $cdrp.setCalcu_start_date_1($csd1.plusDays(1)); 212 $cdrp.setCalcu_start_date_1($csd1.plusDays(1));
213 213
214 - log.info("Calcu_loop1_1_ ruleId={}, calcu_index_lp/ry={}/{}",  
215 - $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry()); 214 +// log.info("Calcu_loop1_1_ ruleId={}, calcu_index_lp/ry={}/{}",
  215 +// $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry());
216 216
217 update($cdrp); 217 update($cdrp);
218 end 218 end
@@ -233,8 +233,8 @@ rule &quot;Calcu_loop1_2_&quot; // 路牌在时刻表中不存在,就不翻 @@ -233,8 +233,8 @@ rule &quot;Calcu_loop1_2_&quot; // 路牌在时刻表中不存在,就不翻
233 then 233 then
234 $cdrp.setCalcu_start_date_1($csd1.plusDays(1)); 234 $cdrp.setCalcu_start_date_1($csd1.plusDays(1));
235 235
236 - log.info("Calcu_loop1_2_ ruleId={}, calcu_index_lp/ry={}/{}",  
237 - $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry()); 236 +// log.info("Calcu_loop1_2_ ruleId={}, calcu_index_lp/ry={}/{}",
  237 +// $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry());
238 238
239 update($cdrp); 239 update($cdrp);
240 end 240 end
@@ -304,8 +304,8 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻 @@ -304,8 +304,8 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻
304 scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult); 304 scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult);
305 305
306 306
307 - log.info("Calcu_loop2_1_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",  
308 - $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2); 307 +// log.info("Calcu_loop2_1_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
  308 +// $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2);
309 309
310 update($cdrp); 310 update($cdrp);
311 end 311 end
@@ -359,8 +359,8 @@ rule &quot;Calcu_loop2_2_&quot; // 路牌在时刻表中不存在,就不翻 @@ -359,8 +359,8 @@ rule &quot;Calcu_loop2_2_&quot; // 路牌在时刻表中不存在,就不翻
359 // 359 //
360 // scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult); 360 // scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult);
361 361
362 - log.info("Calcu_loop2_2_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",  
363 - $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2); 362 +// log.info("Calcu_loop2_2_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
  363 +// $ruleId, $cdrp.getCalcu_index_lp(), $cdrp.getCalcu_index_ry(), $csd2, $ced2);
364 364
365 update($cdrp); 365 update($cdrp);
366 end 366 end
src/main/resources/rules/ttinfo.drl
@@ -82,7 +82,7 @@ rule &quot;calcu_days&quot; @@ -82,7 +82,7 @@ rule &quot;calcu_days&quot;
82 cdr.setCalcu_end_date(($toDate)); 82 cdr.setCalcu_end_date(($toDate));
83 cdr.setXlId($xlId); 83 cdr.setXlId($xlId);
84 84
85 - log.info("总共需要计算的天数 calcu_days={} 之后的计算从第1天开始 ", p.getDays() + 1); 85 +// log.info("总共需要计算的天数 calcu_days={} 之后的计算从第1天开始 ", p.getDays() + 1);
86 86
87 insert(cdr); // 插入fact数据,进入下一个阶段 87 insert(cdr); // 插入fact数据,进入下一个阶段
88 end 88 end
@@ -107,7 +107,7 @@ rule &quot;calcu_ttinfo_enable&quot; @@ -107,7 +107,7 @@ rule &quot;calcu_ttinfo_enable&quot;
107 cter.setTtInfo_input_list($ttInfo_input_list); 107 cter.setTtInfo_input_list($ttInfo_input_list);
108 cter.setCalcu_date($calcu_date); 108 cter.setCalcu_date($calcu_date);
109 109
110 - log.info("启用的时刻表:xlId={} 时刻表个数={}", $xlId, $ttInfo_input_list.size()); 110 +// log.info("启用的时刻表:xlId={} 时刻表个数={}", $xlId, $ttInfo_input_list.size());
111 111
112 insert (cter); 112 insert (cter);
113 113
@@ -130,7 +130,7 @@ rule &quot;calcu_ttinfo_special_day&quot; // 特殊日期匹配 @@ -130,7 +130,7 @@ rule &quot;calcu_ttinfo_special_day&quot; // 特殊日期匹配
130 $calcu_days_result.setCalcu_date(new_calcu_date); 130 $calcu_days_result.setCalcu_date(new_calcu_date);
131 $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek()); 131 $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
132 132
133 - log.info("启用特殊日期时刻表:xlId={} 时刻表个数={} 特殊日期={}", $xlId, $ttinfolist.size(), $calcu_date); 133 +// log.info("启用特殊日期时刻表:xlId={} 时刻表个数={} 特殊日期={}", $xlId, $ttinfolist.size(), $calcu_date);
134 134
135 // $ttinfolist按时间倒排序,result输出 135 // $ttinfolist按时间倒排序,result输出
136 Collections.sort($ttinfolist); 136 Collections.sort($ttinfolist);
@@ -161,7 +161,7 @@ rule &quot;calcu_ttinfo_normal_day&quot; // 平日匹配 @@ -161,7 +161,7 @@ rule &quot;calcu_ttinfo_normal_day&quot; // 平日匹配
161 $calcu_days_result.setCalcu_date(new_calcu_date); 161 $calcu_days_result.setCalcu_date(new_calcu_date);
162 $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek()); 162 $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
163 163
164 - log.info("启用常规日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={} 路牌size={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday, $lpInfoResults.size()); 164 +// log.info("启用常规日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={} 路牌size={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday, $lpInfoResults.size());
165 165
166 // $ttinfolist按时间倒排序,result输出 166 // $ttinfolist按时间倒排序,result输出
167 Collections.sort($ttinfolist); 167 Collections.sort($ttinfolist);
@@ -192,7 +192,7 @@ rule &quot;calcu_ttinfo_other_day&quot; // 都没有的情况下,匹配 @@ -192,7 +192,7 @@ rule &quot;calcu_ttinfo_other_day&quot; // 都没有的情况下,匹配
192 $calcu_days_result.setCalcu_date(new_calcu_date); 192 $calcu_days_result.setCalcu_date(new_calcu_date);
193 $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek()); 193 $calcu_days_result.setCalcu_weekday(new_calcu_date.getDayOfWeek());
194 194
195 - log.info("启用默认日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday); 195 +// log.info("启用默认日期时刻表:xlId={} 时刻表个数={} 常规日期={} 星期几={}", $xlId, $ttinfolist.size(), $calcu_date, $calcu_weekday);
196 196
197 // $ttinfolist按时间倒排序,result输出 197 // $ttinfolist按时间倒排序,result输出
198 Collections.sort($ttinfolist); 198 Collections.sort($ttinfolist);
src/main/resources/static/pages/control/lineallot/allot.html
@@ -421,7 +421,22 @@ @@ -421,7 +421,22 @@
421 421
422 function cacheRoute(lsData, cb) { 422 function cacheRoute(lsData, cb) {
423 //showLoad('缓存线路路由信息...'); 423 //showLoad('缓存线路路由信息...');
424 - var i = 0, cacheData = {}; 424 + //拼接线路编码
  425 + var idx='';
  426 + $.each(lsData, function () {
  427 + idx+=(this.lineCode + ',');
  428 + });
  429 + idx=idx.substr(0, idx.length - 1);
  430 + $.get('/realMap/findRouteByLine', {idx: idx}, function (rs) {
  431 + if (rs) {
  432 + //cacheData[item.lineCode] = rs;
  433 + for(var lineCode in rs){
  434 + storage.setItem(lineCode + '_route', JSON.stringify(rs[lineCode]));
  435 + }
  436 + cb && cb();
  437 + }
  438 + });
  439 +/* var i = 0, cacheData = {};
425 (function () { 440 (function () {
426 if (i >= lsData.length) { 441 if (i >= lsData.length) {
427 //写入localStorage 442 //写入localStorage
@@ -442,7 +457,7 @@ @@ -442,7 +457,7 @@
442 f(); 457 f();
443 } 458 }
444 }); 459 });
445 - })(); 460 + })();*/
446 } 461 }
447 462
448 //历史纪录 463 //历史纪录
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/edit.html
@@ -181,7 +181,7 @@ @@ -181,7 +181,7 @@
181 <div class="col-md-3"> 181 <div class="col-md-3">
182 <sa-Select5 name="useCarConfig" 182 <sa-Select5 name="useCarConfig"
183 model="ctrl.rerunManageForSave" 183 model="ctrl.rerunManageForSave"
184 - cmaps="{'useCarConfig.id' : 'id'}" 184 + cmaps="{'useCarConfig.id' : 'id', 'cl': 'cl.id', 'clZbh': 'cl.insideCode'}"
185 dcname="useCarConfig.id" 185 dcname="useCarConfig.id"
186 icname="id" 186 icname="id"
187 dsparams="{{ {type: 'ajax', param:{'type': 'all', 'isCancel_eq': false}, atype:'cci2' } | json }}" 187 dsparams="{{ {type: 'ajax', param:{'type': 'all', 'isCancel_eq': false}, atype:'cci2' } | json }}"
@@ -203,7 +203,7 @@ @@ -203,7 +203,7 @@
203 <div class="col-md-5"> 203 <div class="col-md-5">
204 <sa-Select5 name="useEmployeeConfig" 204 <sa-Select5 name="useEmployeeConfig"
205 model="ctrl.rerunManageForSave" 205 model="ctrl.rerunManageForSave"
206 - cmaps="{'useEmployeeConfig.id' : 'id'}" 206 + cmaps="{'useEmployeeConfig.id' : 'id', 'j': 'jsy.id', 'jGh': 'jsy.jobCode', 'jName': 'jsy.personnelName', 's': 'spy.id', 'sGh': 'spy.jobCode', 'sName': 'spy.personnelName'}"
207 dcname="useEmployeeConfig.id" 207 dcname="useEmployeeConfig.id"
208 icname="id" 208 icname="id"
209 dsparams="{{ {type: 'ajax', param:{'type': 'all', 'isCancel_eq': false}, atype:'eci3' } | json }}" 209 dsparams="{{ {type: 'ajax', param:{'type': 'all', 'isCancel_eq': false}, atype:'eci3' } | json }}"
src/main/resources/static/pages/scheduleApp/module/core/rerunManage/form.html
@@ -181,7 +181,7 @@ @@ -181,7 +181,7 @@
181 <div class="col-md-3"> 181 <div class="col-md-3">
182 <sa-Select5 name="useCarConfig" 182 <sa-Select5 name="useCarConfig"
183 model="ctrl.rerunManageForSave" 183 model="ctrl.rerunManageForSave"
184 - cmaps="{'useCarConfig.id' : 'id'}" 184 + cmaps="{'useCarConfig.id' : 'id', 'cl': 'cl.id', 'clZbh': 'cl.insideCode'}"
185 dcname="useCarConfig.id" 185 dcname="useCarConfig.id"
186 icname="id" 186 icname="id"
187 dsparams="{{ {type: 'ajax', param:{'type': 'all', 'isCancel_eq': false}, atype:'cci2' } | json }}" 187 dsparams="{{ {type: 'ajax', param:{'type': 'all', 'isCancel_eq': false}, atype:'cci2' } | json }}"
@@ -203,7 +203,7 @@ @@ -203,7 +203,7 @@
203 <div class="col-md-5"> 203 <div class="col-md-5">
204 <sa-Select5 name="useEmployeeConfig" 204 <sa-Select5 name="useEmployeeConfig"
205 model="ctrl.rerunManageForSave" 205 model="ctrl.rerunManageForSave"
206 - cmaps="{'useEmployeeConfig.id' : 'id'}" 206 + cmaps="{'useEmployeeConfig.id' : 'id', 'j': 'jsy.id', 'jGh': 'jsy.jobCode', 'jName': 'jsy.personnelName', 's': 'spy.id', 'sGh': 'spy.jobCode', 'sName': 'spy.personnelName'}"
207 dcname="useEmployeeConfig.id" 207 dcname="useEmployeeConfig.id"
208 icname="id" 208 icname="id"
209 dsparams="{{ {type: 'ajax', param:{'type': 'all', 'isCancel_eq': false}, atype:'eci3' } | json }}" 209 dsparams="{{ {type: 'ajax', param:{'type': 'all', 'isCancel_eq': false}, atype:'eci3' } | json }}"
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail.html
@@ -95,9 +95,9 @@ @@ -95,9 +95,9 @@
95 icname="zcode" 95 icname="zcode"
96 dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.TimeTableDetailForSave.xl.id, 'xldir': ctrl.TimeTableDetailForSave.xlDir}, atype:'zd_tcc' } | json }}" 96 dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.TimeTableDetailForSave.xl.id, 'xldir': ctrl.TimeTableDetailForSave.xlDir}, atype:'zd_tcc' } | json }}"
97 iterobjname="item" 97 iterobjname="item"
98 - iterobjexp="item.zname" 98 + iterobjexp="item.aname"
99 searchph="请输拼音..." 99 searchph="请输拼音..."
100 - searchexp="this.zname" 100 + searchexp="this.aname"
101 required > 101 required >
102 </sa-Select5> 102 </sa-Select5>
103 </div> 103 </div>
@@ -116,9 +116,9 @@ @@ -116,9 +116,9 @@
116 icname="zcode" 116 icname="zcode"
117 dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.TimeTableDetailForSave.xl.id, 'xldir': ctrl.TimeTableDetailForSave.xlDir}, atype:'zd_tcc' } | json }}" 117 dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.TimeTableDetailForSave.xl.id, 'xldir': ctrl.TimeTableDetailForSave.xlDir}, atype:'zd_tcc' } | json }}"
118 iterobjname="item" 118 iterobjname="item"
119 - iterobjexp="item.zname" 119 + iterobjexp="item.aname"
120 searchph="请输拼音..." 120 searchph="请输拼音..."
121 - searchexp="this.zname" 121 + searchexp="this.aname"
122 required > 122 required >
123 </sa-Select5> 123 </sa-Select5>
124 </div> 124 </div>
src/main/resources/static/pages/scheduleApp/module/core/ttInfoManage/detailedit/edit-detail2.html
@@ -76,9 +76,9 @@ @@ -76,9 +76,9 @@
76 icname="zcode" 76 icname="zcode"
77 dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.xlid, 'xldir': ctrl.tt.xlDir}, atype:'zd_tcc' } | json }}" 77 dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.xlid, 'xldir': ctrl.tt.xlDir}, atype:'zd_tcc' } | json }}"
78 iterobjname="item" 78 iterobjname="item"
79 - iterobjexp="item.zname" 79 + iterobjexp="item.aname"
80 searchph="请输拼音..." 80 searchph="请输拼音..."
81 - searchexp="this.zname" 81 + searchexp="this.aname"
82 required > 82 required >
83 </sa-Select5> 83 </sa-Select5>
84 </div> 84 </div>
@@ -93,9 +93,9 @@ @@ -93,9 +93,9 @@
93 icname="zcode" 93 icname="zcode"
94 dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.xlid, 'xldir': ctrl.tt.xlDir}, atype:'zd_tcc' } | json }}" 94 dsparams="{{ {type: 'ajax', param:{'lineid': ctrl.xlid, 'xldir': ctrl.tt.xlDir}, atype:'zd_tcc' } | json }}"
95 iterobjname="item" 95 iterobjname="item"
96 - iterobjexp="item.zname" 96 + iterobjexp="item.aname"
97 searchph="请输拼音..." 97 searchph="请输拼音..."
98 - searchexp="this.zname" 98 + searchexp="this.aname"
99 required > 99 required >
100 </sa-Select5> 100 </sa-Select5>
101 </div> 101 </div>
src/main/resources/static/real_control_v2/js/data/data_gps.js
@@ -18,7 +18,13 @@ var gb_data_gps = (function () { @@ -18,7 +18,13 @@ var gb_data_gps = (function () {
18 $.ajax({ 18 $.ajax({
19 url: '/gps/real/line', 19 url: '/gps/real/line',
20 data: {lineCodes: gb_data_basic.line_idx}, 20 data: {lineCodes: gb_data_basic.line_idx},
  21 + dataType: 'json',
21 success: function (rs) { 22 success: function (rs) {
  23 + //用定时的gps来检测session断开
  24 + if(rs.status && rs.status==407){
  25 + location.href = '/login.html';
  26 + return;
  27 + }
22 refreshData(rs); 28 refreshData(rs);
23 cb(); 29 cb();
24 }, 30 },
src/main/resources/static/real_control_v2/js/line_schedule/search.js
@@ -36,20 +36,20 @@ var gb_sch_search = (function() { @@ -36,20 +36,20 @@ var gb_sch_search = (function() {
36 }); 36 });
37 } 37 }
38 //驾驶员对照 38 //驾驶员对照
39 - /* var group_jsy = gb_common.extractJsy(schArr);  
40 - jsy_pinyins = [];  
41 - for(var jsy in group_jsy){  
42 - jsy_pinyins.push({  
43 - fullChars: pinyin.getFullChars(jsy).toUpperCase(),  
44 - camelChars: pinyin.getCamelChars(jsy),  
45 - val: jsy  
46 - });  
47 - }*/ 39 + /* var group_jsy = gb_common.extractJsy(schArr);
  40 + jsy_pinyins = [];
  41 + for(var jsy in group_jsy){
  42 + jsy_pinyins.push({
  43 + fullChars: pinyin.getFullChars(jsy).toUpperCase(),
  44 + camelChars: pinyin.getCamelChars(jsy),
  45 + val: jsy
  46 + });
  47 + }*/
48 _input = $(this); 48 _input = $(this);
49 }) 49 })
50 .on('blur', ips, function() { 50 .on('blur', ips, function() {
51 if ($(this).val() == ''){ 51 if ($(this).val() == ''){
52 - reset_all($(this).parents('li.line_schedule')); 52 + reset_all($(this).parents('li.line_schedule'));
53 } 53 }
54 }); 54 });
55 55
@@ -153,7 +153,7 @@ var gb_sch_search = (function() { @@ -153,7 +153,7 @@ var gb_sch_search = (function() {
153 value = 'st' + sm.format(fs2) + 'et' + em.format(fs2); 153 value = 'st' + sm.format(fs2) + 'et' + em.format(fs2);
154 } 154 }
155 155
156 - var threeBefore = moment().format('HH') < '03'; 156 + var threeBefore = moment().format('HH') < '02';
157 157
158 if(sm) { 158 if(sm) {
159 gbRange.st = sm.format('x'); 159 gbRange.st = sm.format('x');
@@ -177,7 +177,7 @@ var gb_sch_search = (function() { @@ -177,7 +177,7 @@ var gb_sch_search = (function() {
177 /** 177 /**
178 * 按驾驶员搜索 178 * 按驾驶员搜索
179 179
180 - var searchJsy = function (v, release) { 180 + var searchJsy = function (v, release) {
181 var rs = []; 181 var rs = [];
182 v = v.split('JSY')[1]; 182 v = v.split('JSY')[1];
183 183
@@ -244,7 +244,7 @@ var gb_sch_search = (function() { @@ -244,7 +244,7 @@ var gb_sch_search = (function() {
244 if(searchType=='timeRange') 244 if(searchType=='timeRange')
245 filterScheduleByTimeRange(this); 245 filterScheduleByTimeRange(this);
246 /*if(searchType=='jsy') 246 /*if(searchType=='jsy')
247 - filterScheduleByJsy(this, v);*/ 247 + filterScheduleByJsy(this, v);*/
248 }); 248 });
249 gbRange = {}; 249 gbRange = {};
250 } 250 }
@@ -311,7 +311,7 @@ var gb_sch_search = (function() { @@ -311,7 +311,7 @@ var gb_sch_search = (function() {
311 /** 311 /**
312 * 根据驾驶员过滤表格 312 * 根据驾驶员过滤表格
313 313
314 - var filterScheduleByJsy = function (tbody, jsy) { 314 + var filterScheduleByJsy = function (tbody, jsy) {
315 315
316 }*/ 316 }*/
317 317
@@ -343,7 +343,7 @@ var gb_sch_search = (function() { @@ -343,7 +343,7 @@ var gb_sch_search = (function() {
343 343
344 return moment(array[0]+array[1], 'HHmm'); 344 return moment(array[0]+array[1], 'HHmm');
345 } 345 }
346 - 346 +
347 function splitBefore(str, size) { 347 function splitBefore(str, size) {
348 var len = str.length; 348 var len = str.length;
349 if(len==size) 349 if(len==size)
src/main/resources/static/real_control_v2/main.html
@@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
48 <div class="uk-width-4-10"> 48 <div class="uk-width-4-10">
49 <div class="uk-panel"> 49 <div class="uk-panel">
50 <h2 class="north-logo"> 50 <h2 class="north-logo">
51 - <i class="uk-icon-life-ring"></i> 浦东公交线路调度 51 + <i class="uk-icon-life-ring"></i> 闵行公交线路调度
52 </h2> 52 </h2>
53 </div> 53 </div>
54 </div> 54 </div>
src/test/resources/testdata/problem.properties
@@ -11,4 +11,7 @@ @@ -11,4 +11,7 @@
11 ##11=人员基础信息导入问题,工号前要加公司代码 11 ##11=人员基础信息导入问题,工号前要加公司代码
12 12=套跑规则嵌入到主排班规则中 12 12=套跑规则嵌入到主排班规则中
13 13=导入数据功能,需要加用户名 13 13=导入数据功能,需要加用户名
14 -14=路牌编号自动生成  
15 \ No newline at end of file 14 \ No newline at end of file
  15 +14=路牌编号自动生成
  16 +15=时刻表导入的时候表头后面不需要加数字
  17 +16=时间框中文
  18 +