Commit aeceea9ab3af3fe9a4c5304c489697de8eb10246

Authored by 廖磊
2 parents 691786ff 2cf239d5

Merge branch 'minhang' of

http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
src/main/java/com/bsth/entity/schedule/SchedulePlanInfo.java
@@ -3,6 +3,7 @@ package com.bsth.entity.schedule; @@ -3,6 +3,7 @@ package com.bsth.entity.schedule;
3 import com.bsth.entity.Line; 3 import com.bsth.entity.Line;
4 import com.bsth.service.schedule.rules.rerun.RerunRule_input; 4 import com.bsth.service.schedule.rules.rerun.RerunRule_input;
5 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; 5 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
  6 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
6 import org.apache.commons.lang3.StringUtils; 7 import org.apache.commons.lang3.StringUtils;
7 8
8 import javax.persistence.*; 9 import javax.persistence.*;
@@ -267,7 +268,8 @@ public class SchedulePlanInfo extends BEntity { @@ -267,7 +268,8 @@ public class SchedulePlanInfo extends BEntity {
267 List<EmployeeConfigInfo> employeeConfigInfoList, 268 List<EmployeeConfigInfo> employeeConfigInfoList,
268 SchedulePlan schedulePlan, 269 SchedulePlan schedulePlan,
269 boolean isFirstBc, // 是否第一个班次 270 boolean isFirstBc, // 是否第一个班次
270 - boolean isLastBc // 是否最后一个班次 271 + boolean isLastBc, // 是否最后一个班次
  272 + ScheduleRule_Type sType // 类型
271 ) { 273 ) {
272 274
273 // TODO:关联的公司名称 275 // TODO:关联的公司名称
@@ -294,47 +296,51 @@ public class SchedulePlanInfo extends BEntity { @@ -294,47 +296,51 @@ public class SchedulePlanInfo extends BEntity {
294 this.lpName = ttInfoDetail.getLp().getLpName(); 296 this.lpName = ttInfoDetail.getLp().getLpName();
295 297
296 // 关联的车辆信息 298 // 关联的车辆信息
297 - this.cl = carConfigInfo.getCl().getId(); // 车辆id  
298 - this.clZbh = carConfigInfo.getCl().getInsideCode(); // 自编号/内部编号 299 + if (sType == ScheduleRule_Type.NORMAL) {
  300 + this.cl = carConfigInfo.getCl().getId(); // 车辆id
  301 + this.clZbh = carConfigInfo.getCl().getInsideCode(); // 自编号/内部编号
  302 + }
299 303
300 // TODO:报道时间,出场时间没有 304 // TODO:报道时间,出场时间没有
301 // 关联的驾驶员 305 // 关联的驾驶员
302 - EmployeeConfigInfo employeeConfigInfo = null;  
303 - if (isFb) {  
304 - if (employeeConfigInfoList.size() > 1) {  
305 - employeeConfigInfo = employeeConfigInfoList.get(1); 306 + if (sType == ScheduleRule_Type.NORMAL) {
  307 + EmployeeConfigInfo employeeConfigInfo = null;
  308 + if (isFb) {
  309 + if (employeeConfigInfoList.size() > 1) {
  310 + employeeConfigInfo = employeeConfigInfoList.get(1);
  311 + } else {
  312 + employeeConfigInfo = employeeConfigInfoList.get(0);
  313 + }
306 } else { 314 } else {
307 employeeConfigInfo = employeeConfigInfoList.get(0); 315 employeeConfigInfo = employeeConfigInfoList.get(0);
308 } 316 }
309 - } else {  
310 - employeeConfigInfo = employeeConfigInfoList.get(0);  
311 - }  
312 317
313 - this.j = employeeConfigInfo.getJsy().getId(); 318 + this.j = employeeConfigInfo.getJsy().getId();
314 // this.jGh = employeeConfigInfo.getJsy().getJobCode(); 319 // this.jGh = employeeConfigInfo.getJsy().getJobCode();
315 - if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {  
316 - String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");  
317 - if (jsy_temp.length > 1) {  
318 - this.jGh = jsy_temp[1];  
319 - } else {  
320 - this.jGh = jsy_temp[0];  
321 - }  
322 - }  
323 - this.jName = employeeConfigInfo.getJsy().getPersonnelName();  
324 - // 关联的售票员  
325 - if (employeeConfigInfo.getSpy() != null) {  
326 - this.s = employeeConfigInfo.getSpy().getId();  
327 -// this.sGh = employeeConfigInfo.getSpy().getJobCode();  
328 - if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {  
329 - String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");  
330 - if (spy_temp.length > 1) {  
331 - this.sGh = spy_temp[1]; 320 + if (StringUtils.isNotEmpty(employeeConfigInfo.getJsy().getJobCode())) {
  321 + String[] jsy_temp = employeeConfigInfo.getJsy().getJobCode().split("-");
  322 + if (jsy_temp.length > 1) {
  323 + this.jGh = jsy_temp[1];
332 } else { 324 } else {
333 - this.sGh = spy_temp[0]; 325 + this.jGh = jsy_temp[0];
334 } 326 }
335 } 327 }
  328 + this.jName = employeeConfigInfo.getJsy().getPersonnelName();
  329 + // 关联的售票员
  330 + if (employeeConfigInfo.getSpy() != null) {
  331 + this.s = employeeConfigInfo.getSpy().getId();
  332 +// this.sGh = employeeConfigInfo.getSpy().getJobCode();
  333 + if (StringUtils.isNotEmpty(employeeConfigInfo.getSpy().getJobCode())) {
  334 + String[] spy_temp = employeeConfigInfo.getSpy().getJobCode().split("-");
  335 + if (spy_temp.length > 1) {
  336 + this.sGh = spy_temp[1];
  337 + } else {
  338 + this.sGh = spy_temp[0];
  339 + }
  340 + }
336 341
337 - this.sName = employeeConfigInfo.getSpy().getPersonnelName(); 342 + this.sName = employeeConfigInfo.getSpy().getPersonnelName();
  343 + }
338 } 344 }
339 345
340 // 时刻明细数据 346 // 时刻明细数据
@@ -360,42 +366,44 @@ public class SchedulePlanInfo extends BEntity { @@ -360,42 +366,44 @@ public class SchedulePlanInfo extends BEntity {
360 this.remark = ttInfoDetail.getRemark(); 366 this.remark = ttInfoDetail.getRemark();
361 367
362 // 使用车辆配置的停车场信息 368 // 使用车辆配置的停车场信息
363 - String pzType = carConfigInfo.getPzType(); // 配置类型  
364 - if (pzType != null && !pzType.equals("BSY")) {  
365 - if ("ZW".equals(pzType)) { // 只看早晚进出场  
366 - if (isFirstBc) { // 第一个班次是出场 369 + if (sType == ScheduleRule_Type.NORMAL) {
  370 + String pzType = carConfigInfo.getPzType(); // 配置类型
  371 + if (pzType != null && !pzType.equals("BSY")) {
  372 + if ("ZW".equals(pzType)) { // 只看早晚进出场
  373 + if (isFirstBc) { // 第一个班次是出场
367 // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id 374 // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id
368 - this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code  
369 - this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name 375 + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code
  376 + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name
370 377
371 - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc();  
372 - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); 378 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc();
  379 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue();
373 380
374 - } else if (isLastBc) { // 最后一个班次是进场 381 + } else if (isLastBc) { // 最后一个班次是进场
375 // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id 382 // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id
376 - this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code  
377 - this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name 383 + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code
  384 + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name
378 385
379 - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc();  
380 - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue();  
381 - } 386 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc();
  387 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue();
  388 + }
382 389
383 - } else if ("FS".equals(pzType)) { // 所有进出场  
384 - if ("out".equals(this.bcType)) { // 出场班次 390 + } else if ("FS".equals(pzType)) { // 所有进出场
  391 + if ("out".equals(this.bcType)) { // 出场班次
385 // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id 392 // this.qdz = carConfigInfo.getTcc().getId(); // 起点站-停车场id
386 - this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code  
387 - this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name 393 + this.qdzCode = carConfigInfo.getTcc().getParkCode(); // 起点站-停车场code
  394 + this.qdzName = carConfigInfo.getTcc().getParkName(); // 起点站-停车场name
388 395
389 - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc();  
390 - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue(); 396 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpOutLc() : carConfigInfo.getDownOutLc();
  397 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpOutSj().intValue() : carConfigInfo.getDownOutSj().intValue();
391 398
392 - } else if ("in".equals(this.bcType)) { 399 + } else if ("in".equals(this.bcType)) {
393 // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id 400 // this.zdz = carConfigInfo.getTcc().getId(); // 终点站-停车场id
394 - this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code  
395 - this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name 401 + this.zdzCode = carConfigInfo.getTcc().getParkCode(); // 终点站-停车场code
  402 + this.zdzName = carConfigInfo.getTcc().getParkName(); // 终点站-停车场name
396 403
397 - this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc();  
398 - this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue(); 404 + this.jhlc = "0".equals(this.xlDir) ? carConfigInfo.getUpInLc() : carConfigInfo.getDownInLc();
  405 + this.bcsj = "0".equals(this.xlDir) ? carConfigInfo.getUpInSj().intValue() : carConfigInfo.getDownInSj().intValue();
  406 + }
399 } 407 }
400 } 408 }
401 } 409 }
src/main/java/com/bsth/repository/schedule/ScheduleRule1FlatRepository.java
@@ -29,4 +29,6 @@ public interface ScheduleRule1FlatRepository extends BaseRepository&lt;ScheduleRule @@ -29,4 +29,6 @@ public interface ScheduleRule1FlatRepository extends BaseRepository&lt;ScheduleRule
29 ScheduleRule1Flat findOneExtend(Long aLong); 29 ScheduleRule1Flat findOneExtend(Long aLong);
30 30
31 List<ScheduleRule1Flat> findByXl(Line line); 31 List<ScheduleRule1Flat> findByXl(Line line);
  32 +
  33 + List<ScheduleRule1Flat> findByXlId(Integer id);
32 } 34 }
src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -689,7 +689,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -689,7 +689,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
689 String bJwpoints[] = stationNameList.get(k)[0].toString().split(" "); 689 String bJwpoints[] = stationNameList.get(k)[0].toString().split(" ");
690 Point p2 = new Point(Double.parseDouble(bJwpoints[0]),Double.parseDouble(bJwpoints[1])); 690 Point p2 = new Point(Double.parseDouble(bJwpoints[0]),Double.parseDouble(bJwpoints[1]));
691 double jl = GeoUtils.getDistance(p1, p2); 691 double jl = GeoUtils.getDistance(p1, p2);
692 - if(jl<=120d) { 692 + if(jl<=20d) {
693 rsM.put("id", stationNameList.get(k)[1]); 693 rsM.put("id", stationNameList.get(k)[1]);
694 temp = true; 694 temp = true;
695 break; 695 break;
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -20,10 +20,10 @@ import com.bsth.service.traffic.YgcBasicDataService; @@ -20,10 +20,10 @@ import com.bsth.service.traffic.YgcBasicDataService;
20 import com.bsth.util.TimeUtils; 20 import com.bsth.util.TimeUtils;
21 import com.bsth.util.db.DBUtils_MS; 21 import com.bsth.util.db.DBUtils_MS;
22 import com.bsth.webService.trafficManage.geotool.services.InternalPortType; 22 import com.bsth.webService.trafficManage.geotool.services.InternalPortType;
23 -import com.bsth.webService.trafficManage.geotool.services.Internal;  
24 import com.bsth.webService.trafficManage.org.tempuri.Results; 23 import com.bsth.webService.trafficManage.org.tempuri.Results;
25 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; 24 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator;
26 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; 25 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap;
  26 +import org.apache.commons.lang.StringEscapeUtils;
27 import org.apache.commons.lang.StringUtils; 27 import org.apache.commons.lang.StringUtils;
28 import org.apache.commons.lang.time.DateUtils; 28 import org.apache.commons.lang.time.DateUtils;
29 import org.slf4j.Logger; 29 import org.slf4j.Logger;
@@ -373,7 +373,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -373,7 +373,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
373 counter = 0; 373 counter = 0;
374 sf.append("</DLDS>"); 374 sf.append("</DLDS>");
375 str = sf.toString().replace("'","");// 去掉'号 375 str = sf.toString().replace("'","");// 去掉'号
376 - Results results = ssop.setLD(userNameOther, passwordOther, str); 376 + Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str));
377 if(results.isSuccess()){ 377 if(results.isSuccess()){
378 result = "success"; 378 result = "success";
379 }else{ 379 }else{
@@ -387,7 +387,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -387,7 +387,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
387 if(counter > 0){ 387 if(counter > 0){
388 sf.append("</DLDS>"); 388 sf.append("</DLDS>");
389 str = sf.toString().replace("'","");// 去掉'号 389 str = sf.toString().replace("'","");// 去掉'号
390 - Results results = ssop.setLD(userNameOther, passwordOther, str); 390 + Results results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str));
391 if(results.isSuccess()){ 391 if(results.isSuccess()){
392 result = "success"; 392 result = "success";
393 }else{ 393 }else{
@@ -413,7 +413,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -413,7 +413,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
413 String result = "failure"; 413 String result = "failure";
414 try { 414 try {
415 String tmp = readXmlFromFile("E:/ld.txt"); 415 String tmp = readXmlFromFile("E:/ld.txt");
416 - Results rss = ssop.setLD(userNameOther, passwordOther, tmp); 416 + Results rss = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(tmp));
417 if(rss.isSuccess()){ 417 if(rss.isSuccess()){
418 result = "success"; 418 result = "success";
419 } 419 }
@@ -435,7 +435,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -435,7 +435,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
435 private String readXmlFromFile(String fileName) throws Exception { 435 private String readXmlFromFile(String fileName) throws Exception {
436 StringBuffer sf = new StringBuffer(""); 436 StringBuffer sf = new StringBuffer("");
437 File file = new File(fileName); 437 File file = new File(fileName);
438 - InputStreamReader reader = new InputStreamReader(new FileInputStream(file),"utf-8"); 438 + InputStreamReader reader = new InputStreamReader(new FileInputStream(file),"GBK");
439 BufferedReader bufferedReader = new BufferedReader(reader); 439 BufferedReader bufferedReader = new BufferedReader(reader);
440 String lineTxt = ""; 440 String lineTxt = "";
441 while((lineTxt = bufferedReader.readLine()) != null){ 441 while((lineTxt = bufferedReader.readLine()) != null){
@@ -964,47 +964,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -964,47 +964,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
964 * 下载全量的公交基础数据 964 * 下载全量的公交基础数据
965 */ 965 */
966 public String getDownLoadAllDataFile() { 966 public String getDownLoadAllDataFile() {
967 - String result = "success"; 967 + String result = "failure";
968 try { 968 try {
969 - Runtime currRuntime = Runtime.getRuntime ();  
970 -  
971 - int nFreeMemory = ( int ) (currRuntime.freeMemory() / 1024 / 1024);  
972 -  
973 - int nTotalMemory = ( int ) (currRuntime.totalMemory() / 1024 / 1024);  
974 -  
975 - System.out.println("zzz:"+nFreeMemory + "M/" + nTotalMemory +"M(free/total)");  
976 - portType = new Internal().getInternalHttpSoap11Endpoint();  
977 - byte[] res = portType.downloadAllDataFile("down_pdgj", "down_pdgj123");  
978 - String filePath = "E:\\ygc";  
979 - BufferedOutputStream bos = null;  
980 - FileOutputStream fos = null;  
981 - File file = null;  
982 try { 969 try {
983 - File dir = new File(filePath);  
984 - if(!dir.exists()&&dir.isDirectory()){//判断文件目录是否存在  
985 - dir.mkdirs(); 970 + if(ygcBasicDataService.download("admin","000000","abc.zip")){
  971 + result = "success";
986 } 972 }
987 - file = new File(filePath+"\\abc.rar");  
988 - fos = new FileOutputStream(file);  
989 - bos = new BufferedOutputStream(fos);  
990 - bos.write(res);  
991 } catch (Exception e) { 973 } catch (Exception e) {
992 e.printStackTrace(); 974 e.printStackTrace();
993 - } finally {  
994 - if (bos != null) {  
995 - try {  
996 - bos.close();  
997 - } catch (IOException e1) {  
998 - e1.printStackTrace();  
999 - }  
1000 - }  
1001 - if (fos != null) {  
1002 - try {  
1003 - fos.close();  
1004 - } catch (IOException e1) {  
1005 - e1.printStackTrace();  
1006 - }  
1007 - }  
1008 } 975 }
1009 } catch (Exception e) { 976 } catch (Exception e) {
1010 e.printStackTrace(); 977 e.printStackTrace();
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
@@ -30,6 +30,7 @@ import org.kie.api.runtime.KieSession; @@ -30,6 +30,7 @@ import org.kie.api.runtime.KieSession;
30 import org.slf4j.Logger; 30 import org.slf4j.Logger;
31 import org.slf4j.LoggerFactory; 31 import org.slf4j.LoggerFactory;
32 import org.springframework.beans.factory.annotation.Autowired; 32 import org.springframework.beans.factory.annotation.Autowired;
  33 +import org.springframework.beans.factory.annotation.Qualifier;
33 import org.springframework.stereotype.Service; 34 import org.springframework.stereotype.Service;
34 import org.springframework.transaction.annotation.Isolation; 35 import org.springframework.transaction.annotation.Isolation;
35 import org.springframework.transaction.annotation.Propagation; 36 import org.springframework.transaction.annotation.Propagation;
@@ -43,7 +44,13 @@ import java.util.*; @@ -43,7 +44,13 @@ import java.util.*;
43 @Service 44 @Service
44 public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> implements SchedulePlanService { 45 public class SchedulePlanServiceImpl extends BServiceImpl<SchedulePlan, Long> implements SchedulePlanService {
45 @Autowired 46 @Autowired
  47 + @Qualifier("kb1")
46 private KieBase kieBase; 48 private KieBase kieBase;
  49 +
  50 + @Autowired
  51 + @Qualifier("kb2")
  52 + private KieBase kieBase2;
  53 +
47 @Autowired 54 @Autowired
48 private ScheduleRule1FlatRepository scheduleRule1FlatRepository; 55 private ScheduleRule1FlatRepository scheduleRule1FlatRepository;
49 @Autowired 56 @Autowired
@@ -60,11 +67,49 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -60,11 +67,49 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
60 private BusinessRepository businessRepository; 67 private BusinessRepository businessRepository;
61 @Autowired 68 @Autowired
62 private ScheduleRuleService scheduleRuleService; 69 private ScheduleRuleService scheduleRuleService;
  70 + @Autowired
  71 + private RerunRuleRepository rerunRuleRepository;
63 72
64 /** 日志记录器 */ 73 /** 日志记录器 */
65 private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class); 74 private Logger logger = LoggerFactory.getLogger(SchedulePlanServiceImpl.class);
66 75
67 /** 76 /**
  77 + * 计算规则输入。
  78 + * @param schedulePlan
  79 + * @return
  80 + */
  81 + private List<ScheduleRule_input> calcuSrfList(SchedulePlan schedulePlan) {
  82 + // 1-1、构造drools规则输入数据,输出数据
  83 + // 全局计算参数
  84 + ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan);
  85 +
  86 + // 规则输出数据
  87 + List<ScheduleRule_input> scheduleRule_inputs = new ArrayList<>();
  88 +
  89 + // 1-2、构造drools session->载入数据->启动规则->计算->销毁session
  90 + // 创建session,内部配置的是stateful
  91 + KieSession session = kieBase2.newKieSession();
  92 + // 设置gloable对象,在drl中通过别名使用
  93 + session.setGlobal("sriList", scheduleRule_inputs);
  94 + session.setGlobal("log", logger); // 设置日志
  95 +
  96 + session.setGlobal("srf", scheduleRule1FlatRepository);
  97 + session.setGlobal("rrr", rerunRuleRepository);
  98 + session.setGlobal("srservice", scheduleRuleService);
  99 +
  100 + // 载入数据
  101 + session.insert(scheduleCalcuParam_input);
  102 +
  103 + // 执行rule
  104 + session.fireAllRules();
  105 +
  106 + // 执行完毕销毁,有日志的也要关闭
  107 + session.dispose();
  108 +
  109 + return scheduleRule_inputs;
  110 + }
  111 +
  112 + /**
68 * 循环规则输出。 113 * 循环规则输出。
69 * @param schedulePlan 排班计划对象 114 * @param schedulePlan 排班计划对象
70 * @param lpInfoResults_output 时刻表每日路牌的情况 115 * @param lpInfoResults_output 时刻表每日路牌的情况
@@ -76,13 +121,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im @@ -76,13 +121,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
76 // 全局计算参数 121 // 全局计算参数
77 ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan); 122 ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan);
78 // 每个规则对应的输入参数 123 // 每个规则对应的输入参数
79 - List<ScheduleRule_input> scheduleRule_inputs = new ArrayList<>();  
80 - List<ScheduleRule1Flat> scheduleRule1Flats = scheduleRule1FlatRepository.findByXl(schedulePlan.getXl());  
81 -  
82 - for (ScheduleRule1Flat scheduleRule1Flat: scheduleRule1Flats) {  
83 - ScheduleRule_input scheduleRule_input = new ScheduleRule_input(scheduleRule1Flat);  
84 - scheduleRule_inputs.add(scheduleRule_input);  
85 - } 124 + List<ScheduleRule_input> scheduleRule_inputs = calcuSrfList(schedulePlan);
86 125
87 // 规则输出数据 126 // 规则输出数据
88 ScheduleResults_output scheduleResults_output = new ScheduleResults_output(); 127 ScheduleResults_output scheduleResults_output = new ScheduleResults_output();
src/main/java/com/bsth/service/schedule/rules/MyDroolsConfiguration.java
@@ -28,7 +28,7 @@ public class MyDroolsConfiguration { @@ -28,7 +28,7 @@ public class MyDroolsConfiguration {
28 * 返回一个kiebase知识库,直接冲文件系统读入drl规则文件, 28 * 返回一个kiebase知识库,直接冲文件系统读入drl规则文件,
29 * TODO:以后需要从数据库读入规则文件,并重新创建kbase知识库。 29 * TODO:以后需要从数据库读入规则文件,并重新创建kbase知识库。
30 */ 30 */
31 - @Bean 31 + @Bean(name = "kb1")
32 public KieBase myKieBase() { 32 public KieBase myKieBase() {
33 // Drools 6开始引入kie统一接口(jboss的jbpm工作流也使用kie接口了),整个定义方式和5差别很大 33 // Drools 6开始引入kie统一接口(jboss的jbpm工作流也使用kie接口了),整个定义方式和5差别很大
34 // 这里使用全api方式创建知识库对象,不使用xml的方式,提供最大的灵活性 34 // 这里使用全api方式创建知识库对象,不使用xml的方式,提供最大的灵活性
@@ -100,4 +100,65 @@ public class MyDroolsConfiguration { @@ -100,4 +100,65 @@ public class MyDroolsConfiguration {
100 100
101 return kieBase; 101 return kieBase;
102 } 102 }
  103 +
  104 + /**
  105 + * 返回一个kiebase知识库,直接冲文件系统读入drl规则文件,
  106 + * TODO:以后需要从数据库读入规则文件,并重新创建kbase知识库。
  107 + */
  108 + @Bean(name = "kb2")
  109 + public KieBase myKieBase2() {
  110 + // Drools 6开始引入kie统一接口(jboss的jbpm工作流也使用kie接口了),整个定义方式和5差别很大
  111 + // 这里使用全api方式创建知识库对象,不使用xml的方式,提供最大的灵活性
  112 +
  113 + // 1、创建kieservices
  114 + KieServices kieServices = KieServices.Factory.get();
  115 + // 2、创建KieModuleModel,默认是由kmodule.xml的方式创建,这里使用api方式闯将
  116 + KieModuleModel kieModuleModel = kieServices.newKieModuleModel();
  117 + // 2.1、创建KieBaseModel,类似kmodule.xml中的kbase标签
  118 + KieBaseModel kieBaseModel1 = kieModuleModel.newKieBaseModel("KBase2")
  119 + .setDefault(true)
  120 + .setEqualsBehavior(EqualityBehaviorOption.EQUALITY)
  121 + .setEventProcessingMode(EventProcessingOption.STREAM);
  122 + // 2.2、创建与kbase关联的KieSessionModel,类似kmodule.xml中的kbase内的ksession标签
  123 + kieBaseModel1.newKieSessionModel("KSession1")
  124 + .setDefault(true)
  125 + .setType(KieSessionModel.KieSessionType.STATEFUL)
  126 + .setClockType(ClockTypeOption.get("realtime"));
  127 +
  128 + // 3、创建KieFileSystem,将模型xml,drl等写入,TODO:以后考虑从数据库中获取
  129 + KieFileSystem kfs = kieServices.newKieFileSystem();
  130 + // 3.1、写入KieBaseModel(内部包含了KieSessionModel的内容了,注意之前的KieSessionModel的创建方式)
  131 + kfs.writeKModuleXML(kieModuleModel.toXML());
  132 +
  133 + // 3.2、写入drl(写法超多,有点混乱)
  134 + // 这里使用文件的形式写入,TODO:以后考虑从数据库中读drl写入
  135 + // 注意kfs写的时候如果指定path,强制为src/main/resources/加上文件名,还有就是文件名不要重复否则会覆盖的
  136 +
  137 + kfs.write("src/main/resources/ruleWrap.drl", kieServices.getResources()
  138 + .newInputStreamResource(this.getClass().getResourceAsStream(
  139 + "/rules/ruleWrap.drl"), "UTF-8"));
  140 +
  141 + // TODO:还有其他drl....
  142 +
  143 + // 4、创建KieBuilder,使用KieFileSystem构建
  144 + KieBuilder kieBuilder = kieServices.newKieBuilder(kfs).buildAll();
  145 + Results results = kieBuilder.getResults();
  146 + if (results.hasMessages(Message.Level.ERROR))
  147 + throw new IllegalStateException("构建drools6错误:" + results.getMessages());
  148 +// if (results.hasMessages(Message.Level.ERROR)) {
  149 +// logger.info("构建drools6错误:" + results.getMessages());
  150 +// return null;
  151 +// }
  152 +
  153 + // 5、获取KieContainer
  154 + // TODO:ReleaseId用处很大,以后再议
  155 + ReleaseId releaseId = kieServices.getRepository().getDefaultReleaseId();
  156 + KieContainer kieContainer = kieServices.newKieContainer(releaseId);
  157 +
  158 + // 6、创建kbase
  159 + KieBaseConfiguration kieBaseConfiguration = kieServices.newKieBaseConfiguration();
  160 + KieBase kieBase = kieContainer.newKieBase("KBase2", kieBaseConfiguration);
  161 +
  162 + return kieBase;
  163 + }
103 } 164 }
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleResult_output.java
@@ -20,6 +20,9 @@ public class ScheduleResult_output { @@ -20,6 +20,9 @@ public class ScheduleResult_output {
20 /** 线路id */ 20 /** 线路id */
21 private String xlId; 21 private String xlId;
22 22
  23 + /** 排班输入规则类型 */
  24 + private ScheduleRule_Type sType = ScheduleRule_Type.NORMAL;
  25 +
23 public DateTime getSd() { 26 public DateTime getSd() {
24 return sd; 27 return sd;
25 } 28 }
@@ -67,4 +70,12 @@ public class ScheduleResult_output { @@ -67,4 +70,12 @@ public class ScheduleResult_output {
67 public void setXlId(String xlId) { 70 public void setXlId(String xlId) {
68 this.xlId = xlId; 71 this.xlId = xlId;
69 } 72 }
  73 +
  74 + public ScheduleRule_Type getsType() {
  75 + return sType;
  76 + }
  77 +
  78 + public void setsType(ScheduleRule_Type sType) {
  79 + this.sType = sType;
  80 + }
70 } 81 }
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_Type.java 0 → 100644
  1 +package com.bsth.service.schedule.rules.shiftloop;
  2 +
  3 +/**
  4 + * 排班规则_输入_输出_类型。
  5 + */
  6 +public enum ScheduleRule_Type {
  7 + NORMAL, // 正常类型
  8 + // 套跑类型,使用套跑规则当作实际规则。
  9 + // 有的线路所有路牌都没有规则,或者只有部份规则,
  10 + // 则需要先补充temp规则,路牌id,人员配置id,车辆配置id都设为'NULL'
  11 + // 最后套跑规则重新排班覆盖temp规则
  12 + RERUN
  13 +}
src/main/java/com/bsth/service/schedule/rules/shiftloop/ScheduleRule_input.java
@@ -37,6 +37,9 @@ public class ScheduleRule_input { @@ -37,6 +37,9 @@ public class ScheduleRule_input {
37 /** 车辆翻版(周一到周日是否启用) */ 37 /** 车辆翻版(周一到周日是否启用) */
38 private List<Boolean> weekdays = new ArrayList<>(); 38 private List<Boolean> weekdays = new ArrayList<>();
39 39
  40 + /** 排班输入规则类型 */
  41 + private ScheduleRule_Type sType = ScheduleRule_Type.NORMAL;
  42 +
40 /** 关联的原始规则 */ 43 /** 关联的原始规则 */
41 private ScheduleRule1Flat self; 44 private ScheduleRule1Flat self;
42 45
@@ -164,4 +167,11 @@ public class ScheduleRule_input { @@ -164,4 +167,11 @@ public class ScheduleRule_input {
164 this.self = self; 167 this.self = self;
165 } 168 }
166 169
  170 + public ScheduleRule_Type getsType() {
  171 + return sType;
  172 + }
  173 +
  174 + public void setsType(ScheduleRule_Type sType) {
  175 + this.sType = sType;
  176 + }
167 } 177 }
src/main/java/com/bsth/service/traffic/YgcBasicDataService.java
@@ -17,5 +17,14 @@ public interface YgcBasicDataService { @@ -17,5 +17,14 @@ public interface YgcBasicDataService {
17 * @return 17 * @return
18 */ 18 */
19 String invokeMethod(String methodName,String param); 19 String invokeMethod(String methodName,String param);
  20 +
  21 + /**
  22 + * 下载基础数据,并生成rar文件
  23 + * @param userName
  24 + * @param password
  25 + * @param saveFile
  26 + * @return
  27 + */
  28 + boolean download(String userName, String password, String saveFile);
20 } 29 }
21 30
src/main/java/com/bsth/service/traffic/impl/YgcBasicDataServiceImpl.java
@@ -68,7 +68,7 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ @@ -68,7 +68,7 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{
68 String flag = "failure"; 68 String flag = "failure";
69 try { 69 try {
70 // 调用接口下载基础数据 70 // 调用接口下载基础数据
71 - if(download(userName, DigestUtils.md5Hex(passWord), saveFile)){ 71 + if(download(userName, passWord, saveFile)){
72 // 读取基础数据zip 72 // 读取基础数据zip
73 StringBuffer sb = readZipFile(saveFile); 73 StringBuffer sb = readZipFile(saveFile);
74 // 解析xml 74 // 解析xml
@@ -99,10 +99,11 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ @@ -99,10 +99,11 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{
99 * @param saveFile 99 * @param saveFile
100 * @return 100 * @return
101 */ 101 */
102 - private boolean download(String userName, String password, String saveFile) 102 + public boolean download(String userName, String password, String saveFile)
103 { 103 {
104 try 104 try
105 { 105 {
  106 + password = DigestUtils.md5Hex(password);
106 OMElement data = buildDownloadEnvelope(userName, password); 107 OMElement data = buildDownloadEnvelope(userName, password);
107 ServiceClient sender = new ServiceClient(); 108 ServiceClient sender = new ServiceClient();
108 Options options = sender.getOptions(); 109 Options options = sender.getOptions();
@@ -123,6 +124,12 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{ @@ -123,6 +124,12 @@ public class YgcBasicDataServiceImpl implements YgcBasicDataService{
123 while ((read = is.read(buffer)) != -1) { 124 while ((read = is.read(buffer)) != -1) {
124 imageOutStream.write(buffer, 0, read); 125 imageOutStream.write(buffer, 0, read);
125 } 126 }
  127 + if(is != null){
  128 + is.close();
  129 + }
  130 + if(imageOutStream != null){
  131 + imageOutStream.close();
  132 + }
126 return true; 133 return true;
127 } catch (Exception e) { 134 } catch (Exception e) {
128 e.printStackTrace(); 135 e.printStackTrace();
src/main/resources/rules/plan.drl
@@ -27,7 +27,8 @@ import com.bsth.entity.schedule.SchedulePlanInfo; @@ -27,7 +27,8 @@ import com.bsth.entity.schedule.SchedulePlanInfo;
27 27
28 import org.slf4j.Logger 28 import org.slf4j.Logger
29 import org.joda.time.format.DateTimeFormat 29 import org.joda.time.format.DateTimeFormat
30 -import org.apache.commons.lang3.StringUtils; 30 +import org.apache.commons.lang3.StringUtils
  31 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
31 32
32 33
33 // 全局日志类(一般使用调用此规则的service类) 34 // 全局日志类(一般使用调用此规则的service类)
@@ -385,9 +386,11 @@ rule &quot;Calcu_SchedulePlanInfo&quot; @@ -385,9 +386,11 @@ rule &quot;Calcu_SchedulePlanInfo&quot;
385 // 路牌 386 // 路牌
386 String gid = sro.getGuideboardId(); 387 String gid = sro.getGuideboardId();
387 // 车辆配置 388 // 车辆配置
388 - CarConfigInfo carConfigInfo = (CarConfigInfo) $ccs.getCcMap().get(sro.getCarConfigId()); 389 + CarConfigInfo carConfigInfo = sro.getsType() == ScheduleRule_Type.NORMAL ?
  390 + (CarConfigInfo) $ccs.getCcMap().get(sro.getCarConfigId()) : null;
389 // 人员配置 391 // 人员配置
390 - List eclist = ecList(employeeConfigInfoRepository, sro.getEmployeeConfigId()); 392 + List eclist = sro.getsType() == ScheduleRule_Type.NORMAL ?
  393 + ecList(employeeConfigInfoRepository, sro.getEmployeeConfigId()) : null;
391 394
392 // 时刻表id 395 // 时刻表id
393 String ttInfoId = ttInfoId_sd($lr.getTtInfoMapLoop(), sd); 396 String ttInfoId = ttInfoId_sd($lr.getTtInfoMapLoop(), sd);
@@ -419,7 +422,8 @@ rule &quot;Calcu_SchedulePlanInfo&quot; @@ -419,7 +422,8 @@ rule &quot;Calcu_SchedulePlanInfo&quot;
419 eclist, 422 eclist,
420 $param.getSchedulePlan(), 423 $param.getSchedulePlan(),
421 wrap.getIsFirstBc(), 424 wrap.getIsFirstBc(),
422 - wrap.getIsLastBc() 425 + wrap.getIsLastBc(),
  426 + sro.getsType()
423 ); 427 );
424 428
425 // 获取公司,分公司信息 429 // 获取公司,分公司信息
src/main/resources/rules/ruleWrap.drl 0 → 100644
  1 +package com.bsth.service.schedule.rulewrap;
  2 +
  3 +import org.joda.time.*;
  4 +import java.util.*;
  5 +import org.slf4j.Logger;
  6 +
  7 +import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
  8 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  9 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
  10 +
  11 +import com.bsth.repository.schedule.RerunRuleRepository;
  12 +import com.bsth.repository.schedule.ScheduleRule1FlatRepository;
  13 +
  14 +import com.bsth.service.schedule.rules.rerun.RerunRule_input;
  15 +import com.bsth.service.schedule.rules.ScheduleRuleService;
  16 +
  17 +import com.bsth.entity.Line;
  18 +import com.bsth.entity.schedule.CarConfigInfo
  19 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  20 +
  21 +// 全局日志类(一般使用调用此规则的service类)
  22 +global Logger log;
  23 +
  24 +global ScheduleRule1FlatRepository srf;
  25 +global RerunRuleRepository rrr;
  26 +global ScheduleRuleService srservice;
  27 +global List sriList;
  28 +
  29 +
  30 +declare Sri_Wrap
  31 + xlId : String // 线路id
  32 + lpIds : List // 路牌id
  33 + srf : Object // ScheduleRule1Flat类型
  34 + sri : ScheduleRule_input; // ScheduleRule_input输入
  35 +end
  36 +
  37 +rule "rw1"
  38 + salience 1000
  39 + when
  40 + ScheduleCalcuParam_input(
  41 + $fromDate : fromDate,
  42 + $toDate : toDate,
  43 + $xlId: xlId
  44 + )
  45 + $srf : Object() from srf.findByXlId(Integer.parseInt($xlId))
  46 + then
  47 + // 创建Sri_Wrap
  48 + Sri_Wrap sw = new Sri_Wrap();
  49 + sw.setXlId($xlId);
  50 + sw.setSrf($srf);
  51 + ScheduleRule_input sri = new ScheduleRule_input((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf());
  52 + sw.setSri(sri);
  53 + sw.setLpIds(sri.getGuideboardIds());
  54 +
  55 + insert(sw);
  56 +
  57 +end
  58 +
  59 +rule "rw2"
  60 + salience 800
  61 + no-loop
  62 + when
  63 + ScheduleCalcuParam_input(
  64 + $fromDate : fromDate,
  65 + $toDate : toDate,
  66 + $xlId: xlId
  67 + )
  68 + $reu : RerunRule_input($lpId : lp) from srservice.findRerunrule(Integer.parseInt($xlId))
  69 + not Sri_Wrap(xlId == $xlId, lpIds contains $lpId)
  70 + then
  71 + // 套跑中有规则,主线路的路牌,主线路该路牌不存在,添加一个临时的,做处理
  72 + Sri_Wrap sw = new Sri_Wrap();
  73 + sw.setSrf(new com.bsth.entity.schedule.rule.ScheduleRule1Flat());
  74 + // 线路
  75 + Line xl = new Line();
  76 + xl.setId(Integer.valueOf($xlId));
  77 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setXl(xl);
  78 + // id
  79 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setId((new Date()).getTime());
  80 + // 启用日期
  81 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setQyrq($fromDate.toDate());
  82 + // 车辆配置
  83 + CarConfigInfo cci = new CarConfigInfo();
  84 + cci.setId(new Date().getTime());
  85 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setCarConfigInfo(cci);
  86 + // 人员配置
  87 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyConfigIds("TEMP");
  88 + // 人员搭班编码
  89 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyDbbms("TEMP");
  90 + // 起始人员
  91 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setRyStart(1);
  92 + // 路牌id
  93 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setLpIds($lpId);
  94 + // 起始路牌
  95 + ((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf()).setLpStart(1);
  96 +
  97 + ScheduleRule_input sri = new ScheduleRule_input((com.bsth.entity.schedule.rule.ScheduleRule1Flat) sw.getSrf());
  98 + sri.setsType(ScheduleRule_Type.RERUN);
  99 + sw.setSri(sri);
  100 +
  101 + sw.setXlId($xlId);
  102 +
  103 + List lpIds = new ArrayList();
  104 + lpIds.add($lpId);
  105 + sw.setLpIds(lpIds);
  106 +
  107 + insert(sw);
  108 +end
  109 +
  110 +rule "rw3"
  111 + salience 600
  112 + when
  113 + $sri_wrap : Sri_Wrap($sri : sri, $xlId: xlId, $lpIds : lpIds)
  114 + then
  115 + log.info("线路id={},lpids={}", $xlId, $lpIds);
  116 + sriList.add($sri);
  117 +end
0 \ No newline at end of file 118 \ No newline at end of file
src/main/resources/rules/shiftloop_fb_2.drl
@@ -9,6 +9,7 @@ import com.bsth.service.schedule.utils.Md5Util; @@ -9,6 +9,7 @@ import com.bsth.service.schedule.utils.Md5Util;
9 9
10 import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input; 10 import com.bsth.service.schedule.rules.shiftloop.ScheduleCalcuParam_input;
11 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; 11 import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input;
  12 +import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_Type;
12 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output; 13 import com.bsth.service.schedule.rules.shiftloop.ScheduleResult_output;
13 import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; 14 import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output;
14 15
@@ -342,33 +343,41 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻 @@ -342,33 +343,41 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻
342 ro.setCarConfigId($cid); 343 ro.setCarConfigId($cid);
343 ro.setXlId($xlid); 344 ro.setXlId($xlid);
344 345
  346 + // 类型
  347 + ro.setsType($sri.getsType());
  348 +
345 scheduleResult.getResults().add(ro); 349 scheduleResult.getResults().add(ro);
346 350
  351 +// log.info("gogoogogogogo");
  352 +
347 $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize); 353 $cdrp.setCalcu_index_lp(($lpindex + 1) % $lprangesize);
348 $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize); 354 $cdrp.setCalcu_index_ry(($ryindex + 1) % $ryrangesize);
349 $cdrp.setCalcu_start_date_2($csd2.plusDays(1)); 355 $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
350 356
351 - // 保存排班规则循环结果 --> SchedulePlanRuleResult  
352 - SchedulePlanRuleResult schedulePlanRuleResult = new SchedulePlanRuleResult($sp); 357 + if ($sri.getsType() == ScheduleRule_Type.NORMAL) {
  358 + // 保存排班规则循环结果 --> SchedulePlanRuleResult
  359 + SchedulePlanRuleResult schedulePlanRuleResult = new SchedulePlanRuleResult($sp);
353 // schedulePlanRuleResult.setXlId(String.valueOf($srf.getXl().getId())); 360 // schedulePlanRuleResult.setXlId(String.valueOf($srf.getXl().getId()));
354 - schedulePlanRuleResult.setXlId($srf.getXl().getId());  
355 - schedulePlanRuleResult.setXlName($srf.getXl().getName());  
356 - schedulePlanRuleResult.setRuleId($ruleId);  
357 - schedulePlanRuleResult.setCcId($cid);  
358 - schedulePlanRuleResult.setCcZbh($srf.getCarConfigInfo().getCl().getInsideCode());  
359 - schedulePlanRuleResult.setGids($srf.getLpIds()); // 参与md5计算  
360 - schedulePlanRuleResult.setGnames($srf.getLpNames());  
361 - schedulePlanRuleResult.setGidindex(String.valueOf($lpindex));  
362 - schedulePlanRuleResult.setEcids($srf.getRyConfigIds());  
363 - schedulePlanRuleResult.setEcdbbms($srf.getRyDbbms());  
364 - schedulePlanRuleResult.setEcindex(String.valueOf($ryindex));  
365 - schedulePlanRuleResult.setScheduleDate($csd2.toDate());  
366 - schedulePlanRuleResult.setTtinfoId($ttinfoId);  
367 - schedulePlanRuleResult.setTtinfoName($ttinfoName);  
368 - schedulePlanRuleResult.setQyrq($sri.getQyrq().toDate()); // 参与md5计算  
369 - schedulePlanRuleResult.setOrigingidindex(String.valueOf($sri.getSelf().getLpStart())); // 参与md5计算  
370 -  
371 - scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult); 361 + schedulePlanRuleResult.setXlId($srf.getXl().getId());
  362 + schedulePlanRuleResult.setXlName($srf.getXl().getName());
  363 + schedulePlanRuleResult.setRuleId($ruleId);
  364 + schedulePlanRuleResult.setCcId($cid);
  365 + schedulePlanRuleResult.setCcZbh($srf.getCarConfigInfo().getCl().getInsideCode());
  366 + schedulePlanRuleResult.setGids($srf.getLpIds()); // 参与md5计算
  367 + schedulePlanRuleResult.setGnames($srf.getLpNames());
  368 + schedulePlanRuleResult.setGidindex(String.valueOf($lpindex));
  369 + schedulePlanRuleResult.setEcids($srf.getRyConfigIds());
  370 + schedulePlanRuleResult.setEcdbbms($srf.getRyDbbms());
  371 + schedulePlanRuleResult.setEcindex(String.valueOf($ryindex));
  372 + schedulePlanRuleResult.setScheduleDate($csd2.toDate());
  373 + schedulePlanRuleResult.setTtinfoId($ttinfoId);
  374 + schedulePlanRuleResult.setTtinfoName($ttinfoName);
  375 + schedulePlanRuleResult.setQyrq($sri.getQyrq().toDate()); // 参与md5计算
  376 + schedulePlanRuleResult.setOrigingidindex(String.valueOf($sri.getSelf().getLpStart())); // 参与md5计算
  377 +
  378 + scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult);
  379 + }
  380 +
372 381
373 382
374 // log.info("Calcu_loop2_1_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}", 383 // log.info("Calcu_loop2_1_ ruleId={}, calcu_index_lp/ry={}/{}, from={}, to={}",
@@ -406,6 +415,9 @@ rule &quot;Calcu_loop2_2_&quot; // 路牌在时刻表中不存在,就不翻 @@ -406,6 +415,9 @@ rule &quot;Calcu_loop2_2_&quot; // 路牌在时刻表中不存在,就不翻
406 ro.setCarConfigId($cid); 415 ro.setCarConfigId($cid);
407 ro.setXlId($xlid); 416 ro.setXlId($xlid);
408 417
  418 + // 类型
  419 + ro.setsType($sri.getsType());
  420 +
409 scheduleResult.getResults().add(ro); 421 scheduleResult.getResults().add(ro);
410 422
411 $cdrp.setCalcu_start_date_2($csd2.plusDays(1)); 423 $cdrp.setCalcu_start_date_2($csd2.plusDays(1));
src/main/resources/static/pages/base/interval/add.html 0 → 100644
  1 +<!-- 片段标题 START -->
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>新增间隔信息</h1>
  5 + </div>
  6 +</div>
  7 +<!-- 片段标题 END -->
  8 +
  9 +<!-- 线路信息导航栏组件 START -->
  10 +<ul class="page-breadcrumb breadcrumb">
  11 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  13 + <li><a href="/pages/base/interval/list.html" data-pjax>间隔信息</a> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">新增间隔信息</span></li>
  15 +</ul>
  16 +<!-- 线路信息导航栏组件 END -->
  17 +
  18 +<!-- 信息容器组件 START -->
  19 +<div class="portlet light bordered">
  20 +
  21 + <!-- 信息容器组件标题 START -->
  22 + <div class="portlet-title">
  23 + <div class="caption">
  24 + <i class="icon-equalizer font-red-sunglo"></i>
  25 + <span class="caption-subject font-red-sunglo bold uppercase">新增间隔信息</span>
  26 + </div>
  27 + </div>
  28 + <!-- 信息容器组件标题 END -->
  29 +
  30 + <!-- 表单容器组件 START -->
  31 + <div class="portlet-body form" id="intervalAddForm">
  32 +
  33 + <!-- START FORM -->
  34 + <form action="/" class="form-horizontal" id="interval_add_form" >
  35 +
  36 + <!-- 错误提示信息组件 START -->
  37 + <div class="alert alert-danger display-hide">
  38 + <button class="close" data-close="alert"></button>
  39 + 您的输入有误,请检查下面的输入项
  40 + </div>
  41 + <!-- 错误提示信息组件 END -->
  42 +
  43 + <!-- 表单内容 START -->
  44 + <div class="form-body">
  45 +
  46 + <!-- 表单分组组件 form-group START -->
  47 + <div class="form-group">
  48 + <div class="col-md-12" style="margin-top:10px">
  49 + <label class="control-label col-md-5"> 间隔等级&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  50 + <div class="col-md-4">
  51 + <input type="text" class="form-control" name="level" id="level" placeholder="间隔等级">
  52 + </div>
  53 + </div>
  54 +
  55 + <div class="col-md-12" style="margin-top:10px">
  56 + <label class="control-label col-md-5"> 高峰间隔时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  57 + <div class="col-md-4">
  58 + <input type="text" class="form-control" name="peak" id="peak" placeholder="高峰间隔时间">
  59 + </div>
  60 + </div>
  61 +
  62 + <div class="col-md-12" style="margin-top:10px">
  63 + <label class="control-label col-md-5"> 低谷间隔时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  64 + <div class="col-md-4">
  65 + <input type="text" class="form-control" name="trough" id="trough" placeholder="低谷间隔时间">
  66 + </div>
  67 + </div>
  68 +
  69 + <div class="col-md-12" style="margin-top:10px" hidden>
  70 + <label class="control-label col-md-5"> 创建人&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  71 + <div class="col-md-4">
  72 + <input type="text" class="form-control" name="createBy" id="createBy" placeholder="创建人">
  73 + </div>
  74 + </div>
  75 +
  76 + </div>
  77 + <!-- 表单分组组件 form-group END -->
  78 +
  79 + <!-- 表单按钮组件 START -->
  80 + <div class="form-actions">
  81 + <div class="row">
  82 + <div class="col-md-offset-5 col-md-7">
  83 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  84 + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
  85 + </div>
  86 + </div>
  87 + </div>
  88 + <!-- 表单按钮组件 END -->
  89 + </form>
  90 + <!-- END FORM-->
  91 + </div>
  92 + <!-- 表单组件 END -->
  93 +</div>
  94 +<!-- 信息容器组件 END -->
  95 +
  96 +<!-- 线路信息修改片段JS模块 -->
  97 +<script src="/pages/base/interval/js/interval-add-form.js"></script>
0 \ No newline at end of file 98 \ No newline at end of file
src/main/resources/static/pages/base/interval/edit.html 0 → 100644
  1 +<!-- 片段标题 START -->
  2 +<div class="page-head">
  3 + <div class="page-title">
  4 + <h1>修改间隔信息</h1>
  5 + </div>
  6 +</div>
  7 +<!-- 片段标题 END -->
  8 +
  9 +<!-- 线路信息导航栏组件 START -->
  10 +<ul class="page-breadcrumb breadcrumb">
  11 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  12 + <li><span class="active">基础信息</span> <i class="fa fa-circle"></i></li>
  13 + <li><a href="/pages/base/interval/list.html" data-pjax>间隔信息</a> <i class="fa fa-circle"></i></li>
  14 + <li><span class="active">修改间隔信息</span></li>
  15 +</ul>
  16 +<!-- 线路信息导航栏组件 END -->
  17 +
  18 +<!-- 信息容器组件 START -->
  19 +<div class="portlet light bordered">
  20 +
  21 + <!-- 信息容器组件标题 START -->
  22 + <div class="portlet-title">
  23 + <div class="caption">
  24 + <i class="icon-equalizer font-red-sunglo"></i>
  25 + <span class="caption-subject font-red-sunglo bold uppercase">修改间隔信息</span>
  26 + </div>
  27 + </div>
  28 + <!-- 信息容器组件标题 END -->
  29 +
  30 + <!-- 表单容器组件 START -->
  31 + <div class="portlet-body form" id="intervalEditForm">
  32 +
  33 + <!-- START FORM -->
  34 + <form action="/" class="form-horizontal" id="interval_edit_form" >
  35 +
  36 + <!-- 错误提示信息组件 START -->
  37 + <div class="alert alert-danger display-hide">
  38 + <button class="close" data-close="alert"></button>
  39 + 您的输入有误,请检查下面的输入项
  40 + </div>
  41 + <!-- 错误提示信息组件 END -->
  42 +
  43 + <!-- 表单内容 START -->
  44 + <div class="form-body">
  45 + <input type="hidden" name="id" id="intervalId">
  46 +
  47 + <!-- 表单分组组件 form-group START -->
  48 + <div class="form-group">
  49 + <div class="col-md-12" style="margin-top:10px">
  50 + <label class="control-label col-md-5"> 间隔等级&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  51 + <div class="col-md-4">
  52 + <input type="text" class="form-control" name="level" id="levelInput" placeholder="间隔等级">
  53 + </div>
  54 + </div>
  55 +
  56 + <div class="col-md-12" style="margin-top:10px">
  57 + <label class="control-label col-md-5"> 高峰间隔时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  58 + <div class="col-md-4">
  59 + <input type="text" class="form-control" name="peak" id="peakInput" placeholder="高峰间隔时间">
  60 + </div>
  61 + </div>
  62 +
  63 + <div class="col-md-12" style="margin-top:10px">
  64 + <label class="control-label col-md-5"> 低谷间隔时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  65 + <div class="col-md-4">
  66 + <input type="text" class="form-control" name="trough" id="troughInput" placeholder="低谷间隔时间">
  67 + </div>
  68 + </div>
  69 +
  70 + <div class="col-md-12" style="margin-top:10px">
  71 + <label class="control-label col-md-5"> 创建人&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  72 + <div class="col-md-4">
  73 + <input type="text" class="form-control" name="createBy" id="createByInput" readonly>
  74 + </div>
  75 + </div>
  76 +
  77 + <div class="col-md-12" style="margin-top:10px">
  78 + <label class="control-label col-md-5"> 创建时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  79 + <div class="col-md-4">
  80 + <input type="text" class="form-control" name="createDate" id="createDateInput" disabled>
  81 + </div>
  82 + </div>
  83 +
  84 + <div class="col-md-12" style="margin-top:10px">
  85 + <label class="control-label col-md-5"> 修改人&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  86 + <div class="col-md-4">
  87 + <input type="text" class="form-control" name="updateBy" id="updateByInput" readonly>
  88 + </div>
  89 + </div>
  90 +
  91 + <div class="col-md-12" style="margin-top:10px">
  92 + <label class="control-label col-md-5"> 修改时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  93 + <div class="col-md-4">
  94 + <input type="text" class="form-control" name="updateDate" id="updateDateInput" disabled>
  95 + </div>
  96 + </div>
  97 +
  98 + </div>
  99 + <!-- 表单分组组件 form-group END -->
  100 +
  101 + <!-- 表单按钮组件 START -->
  102 + <div class="form-actions">
  103 + <div class="row">
  104 + <div class="col-md-offset-5 col-md-7">
  105 + <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  106 + <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
  107 + </div>
  108 + </div>
  109 + </div>
  110 + <!-- 表单按钮组件 END -->
  111 + </form>
  112 + <!-- END FORM-->
  113 + </div>
  114 + <!-- 表单组件 END -->
  115 +</div>
  116 +<!-- 信息容器组件 END -->
  117 +
  118 +<!-- 线路信息修改片段JS模块 -->
  119 +<script src="/pages/base/interval/js/interval-edit-form.js"></script>
0 \ No newline at end of file 120 \ No newline at end of file
src/main/resources/static/pages/base/interval/js/interval-add-form.js 0 → 100644
  1 +/**
  2 + * @description TODO(公司信息添加片段JS模块)
  3 + *
  4 + * @author bsth@lq
  5 + *
  6 + * @date 二〇一六年十月十八日 13:31:58
  7 + *
  8 + */
  9 +
  10 +$(function(){
  11 + // 定义表单
  12 + var form = $('#interval_add_form');
  13 + // 定义表单异常
  14 + var error = $('.alert-danger',form);
  15 + $.ajax({
  16 + type: "get",
  17 + async:false,
  18 + url: '/user/currentUser',
  19 + success: function (user) {
  20 + $("#createBy").val(user.userName);
  21 + }
  22 + })
  23 + // 表单验证
  24 + form.validate({
  25 + // 错误提示元素span对象
  26 + errorElement : 'span',
  27 + // 错误提示元素class名称
  28 + errorClass : 'help-block help-block-error',
  29 + // 验证错误获取焦点
  30 + focusInvalid : true,
  31 + // 需要验证的表单元素
  32 + rules : {
  33 + // 公司名称编码
  34 + 'level' : {
  35 + // 必填项
  36 + required : true,
  37 + // 最大长度
  38 + maxlength: 10
  39 + },
  40 + // 公司名称
  41 + 'peak' : {
  42 + // 必填项
  43 + required : true,
  44 + // 最大长度
  45 + maxlength: 10
  46 + },
  47 + // 公司名称
  48 + 'trough' : {
  49 + // 必填项
  50 + required : true,
  51 + // 最大长度
  52 + maxlength: 10
  53 + },
  54 + },
  55 + /**
  56 + * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
  57 + *
  58 + * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
  59 + */
  60 + invalidHandler : function(event, validator) {
  61 + // 显示表单未通过提示信息
  62 + error.show();
  63 + // 把提示信息放到指定的位置。
  64 + App.scrollTo(error, -200);
  65 + },
  66 + /**
  67 + * 类型:Callback。
  68 + *
  69 + * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
  70 + */
  71 + highlight : function(element) {
  72 + // 添加errorClass("has-error")到表单元素
  73 + $(element).closest('.form-group').addClass('has-error');
  74 +
  75 + },
  76 + /**
  77 + * 类型:Callback。
  78 + *
  79 + * 默认:移除errorClass("has-error")。与highlight操作相反
  80 + */
  81 + unhighlight : function(element) {
  82 + // 移除errorClass("has-error")
  83 + $(element).closest('.form-group').removeClass('has-error');
  84 +
  85 + },
  86 + /**
  87 + * 类型:String,Callback。
  88 + *
  89 + * 如果指定它,当验证通过时显示一个消息。
  90 + *
  91 + * 如果是String类型的,则添加该样式到标签中;
  92 + *
  93 + * 如果是一个回调函数,则将标签作为其唯一的参数。
  94 + */
  95 + success : function(label) {
  96 + // 当验证通过时,移除errorClass("has-error")
  97 + label.closest('.form-group').removeClass('has-error');
  98 + },
  99 +
  100 + /**
  101 + * 类型:Callback。
  102 + *
  103 + * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
  104 + */
  105 + submitHandler : function(f) {
  106 + // 隐藏错误提示
  107 + error.hide();
  108 + // 表单序列化
  109 + var params = form.serializeJSON();
  110 + console.log(params);
  111 + submit();
  112 + // 提交
  113 + function submit() {
  114 + // 添加数据
  115 + $post('/interval', params, function(result) {
  116 + // 如果返回结果不为空
  117 + if(result){
  118 + // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
  119 + if(result.status=='SUCCESS') {
  120 + // 弹出添加成功提示消息
  121 + layer.msg('添加成功...');
  122 + } else if(result.status=='ERROR') {
  123 + // 弹出添加失败提示消息
  124 + layer.msg('添加失败...');
  125 + }
  126 + }
  127 + // 返回list.html页面
  128 + //loadPage('list.html');
  129 + window.location.href = 'list.html';
  130 + });
  131 + }
  132 + }
  133 + });
  134 +});
0 \ No newline at end of file 135 \ No newline at end of file
src/main/resources/static/pages/base/interval/js/interval-edit-form.js 0 → 100644
  1 +/**
  2 + * @description TODO(间隔信息修改片段JS模块)
  3 + *
  4 + * @author bsth@zb
  5 + *
  6 + * @date 2017.08.01
  7 + *
  8 + */
  9 +
  10 +!function(){
  11 + // 获取参数ID
  12 + var intervalId = $.url().param('no');
  13 + // 如果参数ID不为空
  14 + if(intervalId) {
  15 + // 获取线路Id元素并设值
  16 + $('#intervalId').val(intervalId);
  17 + /** 根据ID查询详细信息 */
  18 + $get('/interval/' + intervalId ,null, function(result){
  19 + if(result) {
  20 + /** 填充修改线路表单元素值 @param:<result:数据结果集;interval_edit_form:表单元素> */
  21 + // 定义日期格式
  22 + var fs = 'YYYY-MM-DD'
  23 + // 设置日期
  24 + result.createDate = moment(result.createDate).format(fs);
  25 + result.updateDate = moment(result.updateDate).format(fs);
  26 + putFormData(result, '#interval_edit_form');
  27 + }
  28 + });
  29 + } else {
  30 + // 缺少ID
  31 + layer.confirm('【ID缺失,请点击返回,重新进行修改操作】', {btn : [ '返回' ],icon: 3, title:'提示'}, function(index){
  32 + // 关闭弹出层
  33 + layer.close(index);
  34 + // 跳转到list页面
  35 + loadPage('list.html');
  36 + });
  37 + }
  38 + // 定义表单
  39 + var form = $('#interval_edit_form');
  40 +
  41 + // 定义表单异常
  42 + var error = $('.alert-danger',form);
  43 + // 表单验证
  44 + form.validate({
  45 + // 错误提示元素span对象
  46 + errorElement : 'span',
  47 + // 错误提示元素class名称
  48 + errorClass : 'help-block help-block-error',
  49 + // 验证错误获取焦点
  50 + focusInvalid : true,
  51 + // 需要验证的表单元素
  52 + rules : {
  53 + // 公司名称编码
  54 + 'level' : {
  55 + // 必填项
  56 + required : true,
  57 + // 最大长度
  58 + maxlength: 10
  59 + },
  60 + // 公司名称
  61 + 'peak' : {
  62 + // 必填项
  63 + required : true,
  64 + // 最大长度
  65 + maxlength: 10
  66 + },
  67 + // 公司名称
  68 + 'trough' : {
  69 + // 必填项
  70 + required : true,
  71 + // 最大长度
  72 + maxlength: 10
  73 + },
  74 + },
  75 +
  76 + /**
  77 + * 类型:Callback。当未通过验证的表单提交时,可以在该回调函数中处理一些事情。
  78 + *
  79 + * 参数:该回调函数有两个参数:第一个为一个事件对象,第二个为验证器(validator)
  80 + */
  81 + invalidHandler : function(event, validator) {
  82 +
  83 + // 显示表单未通过提示信息
  84 + error.show();
  85 +
  86 + // 把提示信息放到指定的位置。
  87 + App.scrollTo(error, -200);
  88 + },
  89 +
  90 + /**
  91 + * 类型:Callback。
  92 + *
  93 + * 默认:添加errorClass("has-error")到表单元素。将未通过验证的表单元素设置高亮。
  94 + */
  95 + highlight : function(element) {
  96 +
  97 + // 添加errorClass("has-error")到表单元素
  98 + $(element).closest('.form-group').addClass('has-error');
  99 +
  100 + },
  101 +
  102 + /**
  103 + * 类型:Callback。
  104 + *
  105 + * 默认:移除errorClass("has-error")。与highlight操作相反
  106 + */
  107 + unhighlight : function(element) {
  108 +
  109 + // 移除errorClass("has-error")
  110 + $(element).closest('.form-group').removeClass('has-error');
  111 +
  112 + },
  113 +
  114 + /**
  115 + * 类型:String,Callback。
  116 + *
  117 + * 如果指定它,当验证通过时显示一个消息。
  118 + *
  119 + * 如果是String类型的,则添加该样式到标签中;
  120 + *
  121 + * 如果是一个回调函数,则将标签作为其唯一的参数。
  122 + */
  123 + success : function(label) {
  124 +
  125 + // 当验证通过时,移除errorClass("has-error")
  126 + label.closest('.form-group').removeClass('has-error');
  127 +
  128 + },
  129 + /**
  130 + * 类型:Callback。
  131 + *
  132 + * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
  133 + */
  134 + submitHandler : function(f) {
  135 + // 隐藏错误提示
  136 + error.hide();
  137 + // 表单序列化
  138 + $.ajax({
  139 + type: "get",
  140 + async:false,
  141 + url: '/user/currentUser',
  142 + success: function (user) {
  143 + $("#updateByInput").val(user.userName);
  144 + }
  145 + });
  146 + var params = form.serializeJSON();
  147 + console.log(params);
  148 + submit();
  149 + // 提交
  150 + function submit() {
  151 + // 修改数据
  152 + $post('/interval', params, function(result) {
  153 + // 如果返回结果不为空
  154 + if(result){
  155 + // 返回状态码为"SUCCESS" ,则添加成功;返回状态码为"ERROR" ,则添加失败
  156 + if(result.status=='SUCCESS') {
  157 + // 弹出添加成功提示消息
  158 + layer.msg('添加成功...');
  159 + } else if(result.status=='ERROR') {
  160 + // 弹出添加失败提示消息
  161 + layer.msg('添加失败...');
  162 + }
  163 + }
  164 + // 返回list.html页面
  165 + //loadPage('list.html');
  166 + window.location.href = 'list.html';
  167 + });
  168 + }
  169 + }
  170 + });
  171 +}();
0 \ No newline at end of file 172 \ No newline at end of file
src/main/resources/static/pages/base/interval/js/interval-list-table.js 0 → 100644
  1 +/**
  2 + *
  3 + * @JSName : list.js(站点信息list.html页面js)
  4 + *
  5 + * @Author : bsth@zb
  6 + *
  7 + * @Description : TODO(站点信息list.html页面js)
  8 + *
  9 + * @Data : 2017年8月1日 上午9:21:17
  10 + *
  11 + * @Version 公交调度系统BS版 0.1
  12 + *
  13 + */
  14 +
  15 +(function(){
  16 + // 关闭左侧栏
  17 + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
  18 + /** page : 当前页 initPag : */
  19 + var page = 0,initPag,storage = window.localStorage;
  20 + if(storage.xlName_AgursData!=null && storage.xlName_AgursData !='') {
  21 + $('.tipso-animation').children().remove();
  22 + // 延迟加载
  23 + setTimeout(function(){
  24 + $('.tipso-animation').tipso({
  25 + speed : 400,
  26 + background : '#0ed0e8',
  27 + color : '#ffffff',
  28 + position :'bottom',
  29 + width : 400,
  30 + delay : 100,
  31 + animationIn : 'fadeInDownBig',
  32 + animationOut : 'fadeOut',
  33 + offsetX : -50,
  34 + offsetY : -195,
  35 + content :'您可以通过点击重置按钮来清除对线路名称的记忆哦!',
  36 +
  37 + });
  38 + $('.tipso-animation').tipso('show');
  39 + setTimeout(function(){$('.tipso-animation').tipso('hide');},4000);
  40 + },200);
  41 + }
  42 +
  43 + /** 表格数据分页加载 */
  44 + loadTableDate(null,true);
  45 +
  46 + /** 重置按钮事件 */
  47 + $('tr.filter .filter-cancel').on('click',function(){
  48 + // 清空搜索框值
  49 + $('tr.filter input,select').val('').change();
  50 + $('.tipso-animation').tipso('hide');
  51 + storage.setItem('xlName_AgursData','');
  52 + // 重新加载表格数据
  53 + loadTableDate(null,true);
  54 + });
  55 +
  56 + /** 搜索按钮事件 */
  57 + $('tr.filter .filter-submit').on('click',function(){
  58 + var params = getParams();
  59 + page = 0;
  60 + /** 表格数据分页加载 @param:<params:搜索参数;true:是否重新分页> */
  61 + loadTableDate(params,true);
  62 + });
  63 +
  64 + function getParams() {
  65 + // cells 集合返回表格中所有(列)单元格的一个数组
  66 + var cells = $('tr.filter')[0].cells;
  67 + // 搜索参数集合
  68 + var params = {};
  69 + // 搜索字段名称
  70 + var name;
  71 + // 遍历cells数组
  72 + $.each(cells, function(i, cell){
  73 + // 获取第i列的input或者select集合
  74 + var items = $('input,select', cell);
  75 + // 遍历items集合
  76 + for(var j = 0, item; item = items[j++];){
  77 + // 获取字段名称
  78 + name = $(item).attr('name');
  79 + if(name){
  80 + // 赋取相对应的值
  81 + params[name] = $(item).val();
  82 + }
  83 + }
  84 + });
  85 + return params;
  86 + }
  87 +
  88 + /**
  89 + * 表格数据分页加载事件
  90 + *
  91 + * ------@param : 查询参数
  92 + *
  93 + * ------@isPon : 是否重新分页
  94 + *
  95 + */
  96 + function loadTableDate(param,isPon){
  97 + // 搜索参数
  98 + var params = {};
  99 + if(param) {
  100 + params = param;
  101 + }
  102 + // 排序(按id)
  103 + params['order'] = 'id';
  104 + //排序方向
  105 + params['direction'] = 'ASC';
  106 + // 记录当前页数
  107 + params['page'] = page;
  108 + // 弹出正在加载层
  109 + var i = layer.load(2);
  110 + // 异步请求获取表格数据
  111 + $.get('/interval',params,function(result){
  112 + // 添加序号
  113 + result.content.page = page;
  114 + // 把数据填充到模版中
  115 + var tbodyHtml = template('interval_list_temp',{list:result.content});
  116 + $('#datatable_interval tbody').html(tbodyHtml);
  117 + // 是重新分页且返回数据长度大于0
  118 + if(isPon && result.content.length > 0){
  119 + // 重新分页
  120 + initPag = true;
  121 + // 分页栏
  122 + showPagination(result);
  123 + }
  124 + // 关闭弹出加载层
  125 + layer.close(i);
  126 + });
  127 + }
  128 + /** 分页栏组件 */
  129 + function showPagination(data){
  130 + // 分页组件
  131 + $('#pagination').jqPaginator({
  132 + // 总页数
  133 + totalPages: data.totalPages,
  134 + // 中间显示页数
  135 + visiblePages: 6,
  136 + // 当前页
  137 + currentPage: page + 1,
  138 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  139 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  140 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  141 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  142 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  143 + onPageChange: function (num, type) {
  144 + if(initPag){
  145 + initPag = false;
  146 + return;
  147 + }
  148 + var pData = getParams();
  149 + if(pData.stationName_like!='' && pData.stationName_like != null) {
  150 + pData.stationName_like = pData.stationName_like.split('_')[0];
  151 + }
  152 + page = num - 1;
  153 + loadTableDate(pData, false);
  154 + }
  155 + });
  156 + }
  157 +})();
0 \ No newline at end of file 158 \ No newline at end of file
src/main/resources/static/pages/excep/mhspeedingList.html
@@ -32,9 +32,10 @@ @@ -32,9 +32,10 @@
32 <th width="3%">#</th> 32 <th width="3%">#</th>
33 <th width="4%">线路</th> 33 <th width="4%">线路</th>
34 <th width="6%">车辆自编号</th> 34 <th width="6%">车辆自编号</th>
35 - <th width="8%">上下行</th>  
36 - <th width="10%">开始时间</th>  
37 - <th width="10%">结束时间</th> 35 + <th width="6%">上下行</th>
  36 + <th width="8%">超速位置</th>
  37 + <th width="8%">开始时间</th>
  38 + <th width="8%">结束时间</th>
38 <th width="8%">持续时间</th> 39 <th width="8%">持续时间</th>
39 <th width="8%">查看轨迹</th> 40 <th width="8%">查看轨迹</th>
40 <th width="6%">操作</th> 41 <th width="6%">操作</th>
@@ -47,11 +48,6 @@ @@ -47,11 +48,6 @@
47 <td> 48 <td>
48 <select class="form-control" name="nbbm" id="nbbm" style="width: 100px;"></select> 49 <select class="form-control" name="nbbm" id="nbbm" style="width: 100px;"></select>
49 </td> 50 </td>
50 - <!-- <td>  
51 -  
52 - </td>  
53 - <td>  
54 - </td> -->  
55 <td> 51 <td>
56 <select class="form-control form-filter " name="updown" style="width: 90px;"> 52 <select class="form-control form-filter " name="updown" style="width: 90px;">
57 <option value="">请选择...</option> 53 <option value="">请选择...</option>
@@ -60,7 +56,9 @@ @@ -60,7 +56,9 @@
60 <option value="-1">无效</option> 56 <option value="-1">无效</option>
61 </select> 57 </select>
62 </td> 58 </td>
63 - <td> 59 + <td>
  60 + </td>
  61 + <td>
64 <input class="form-control" type="date" name="startDate" /> 62 <input class="form-control" type="date" name="startDate" />
65 </td> 63 </td>
66 <td> 64 <td>
@@ -114,6 +112,9 @@ @@ -114,6 +112,9 @@
114 {{/if}} 112 {{/if}}
115 </td> 113 </td>
116 <td> 114 <td>
  115 + {{obj.address}}
  116 + </td>
  117 + <td>
117 {{obj.timestampDate}} 118 {{obj.timestampDate}}
118 </td> 119 </td>
119 <td> 120 <td>
@@ -144,6 +145,7 @@ @@ -144,6 +145,7 @@
144 145
145 <script> 146 <script>
146 $(function(){ 147 $(function(){
  148 + if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
147 var page = 0, initPagination; 149 var page = 0, initPagination;
148 var icheckOptions = { 150 var icheckOptions = {
149 checkboxClass: 'icheckbox_flat-blue', 151 checkboxClass: 'icheckbox_flat-blue',
@@ -220,41 +222,55 @@ $(function(){ @@ -220,41 +222,55 @@ $(function(){
220 params['page'] = page; 222 params['page'] = page;
221 var i = layer.load(2); 223 var i = layer.load(2);
222 $get('/nowspeeding/pagequery' ,params, function(data){ 224 $get('/nowspeeding/pagequery' ,params, function(data){
223 - var bodyHtm = template('speeding_list_temp', {list: data.dataList});  
224 - $('#datatable_speeding tbody').html(bodyHtm)  
225 - .find('.icheck').iCheck(icheckOptions)  
226 - .on('ifChanged', iCheckChange);  
227 - if(pagination && data.dataList.length > 0){  
228 - //重新分页  
229 - initPagination = true;  
230 - showPagination(data);  
231 - }  
232 - layer.close(i);  
233 - $(".lookTrajectory").click(function(){  
234 - var vehicle = $(this).data('vehicle');  
235 - var startDate = $(this).data('startdate');  
236 - var endDate = $(this).data('enddate');  
237 - var lon = $(this).data('lon');  
238 - var lat = $(this).data('lat');  
239 - var endLon = $(this).data('endlon');  
240 - var endLat = $(this).data('endlat');  
241 - var lineid = $(this).data('lineid');  
242 - var upDown = $(this).data('updown');  
243 - var storage = window.localStorage;  
244 - storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat+","+lineid+","+upDown);  
245 - $.get('/pages/excep/speedingMap.html?',function (result) {  
246 - layer.open({  
247 - type: 1,  
248 - title:'<i class="uk-icon-play-circle"></i>轨迹回放',  
249 - shadeClose: true,  
250 - shade: true,  
251 - scrollbar: false,  
252 - maxmin: false, //开启最大化最小化按钮  
253 - area: ['100%', '100%'],  
254 - content:result,//内容  
255 - });  
256 - });  
257 - }) 225 + var listResult = data.dataList;
  226 + var index=0;
  227 + (function(){
  228 + var f = arguments.callee;
  229 + if(index >= listResult.length){
  230 + var bodyHtm = template('speeding_list_temp', {list:listResult});
  231 + $('#datatable_speeding tbody').html(bodyHtm).find('.icheck').iCheck(icheckOptions).on('ifChanged', iCheckChange);
  232 + if(pagination && data.dataList.length > 0){
  233 + //重新分页
  234 + initPagination = true;
  235 + showPagination(data);
  236 + }
  237 + layer.close(i);
  238 + $(".lookTrajectory").click(function(){
  239 + var vehicle = $(this).data('vehicle');
  240 + var startDate = $(this).data('startdate');
  241 + var endDate = $(this).data('enddate');
  242 + var lon = $(this).data('lon');
  243 + var lat = $(this).data('lat');
  244 + var endLon = $(this).data('endlon');
  245 + var endLat = $(this).data('endlat');
  246 + var lineid = $(this).data('lineid');
  247 + var upDown = $(this).data('updown');
  248 + var storage = window.localStorage;
  249 + storage.setItem("zbhAndDate",vehicle+","+startDate+","+endDate+","+lon+","+lat+","+endLon+","+endLat+","+lineid+","+upDown);
  250 + $.get('/pages/excep/speedingMap.html?',function (result) {
  251 + layer.open({
  252 + type: 1,
  253 + title:'<i class="uk-icon-play-circle"></i>轨迹回放',
  254 + shadeClose: true,
  255 + shade: true,
  256 + scrollbar: false,
  257 + maxmin: false, //开启最大化最小化按钮
  258 + area: ['100%', '100%'],
  259 + content:result,//内容
  260 + });
  261 + });
  262 + })
  263 + return;
  264 + }
  265 + var result = listResult[index];
  266 + new BMap.Geocoder().getLocation(new BMap.Point(result.lon,result.lat), function(rs){
  267 + var addComp = rs.addressComponents;
  268 + result.address = addComp.district+addComp.street+addComp.streetNumber;
  269 + f();
  270 + index++;
  271 + });
  272 + })();
  273 + console.log(listResult);
258 }); 274 });
259 } 275 }
260 276