Commit ac4452a2bc96a46fb76b6b71f66e23d8a0330b4f

Authored by 潘钊
2 parents 0456d096 b855b368

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

src/main/java/com/bsth/entity/schedule/temp/SchedulePlanRuleResult.java
... ... @@ -27,20 +27,22 @@ public class SchedulePlanRuleResult {
27 27  
28 28 /** 排班规则id */
29 29 private String ruleId;
30   - /** 启用日期 */
  30 + /** 启用日期(用于md5计算) */
31 31 private Date qyrq;
32 32 /** 车辆配置id */
33 33 private String ccId;
34 34 /** 车辆自编号 */
35 35 private String ccZbh;
36 36  
37   - /** 路牌id列表字符串 */
  37 + /** 路牌id列表字符串(用于md5计算) */
38 38 @Column(length = 1000)
39 39 private String gids;
40 40 /** 路牌名字列表字符串 */
41 41 private String gnames;
42 42 /** 翻到哪个路牌索引 */
43 43 private String gidindex;
  44 + /** 原始的起始路牌索引(用于md5计算) */
  45 + private String origingidindex;
44 46 /** 人员配置id列表字符串 */
45 47 @Column(length = 1000)
46 48 private String ecids;
... ... @@ -81,8 +83,8 @@ public class SchedulePlanRuleResult {
81 83 "(xl_id,xl_name,rule_id,cc_id,cc_zbh," +
82 84 "gids,gnames,gidindex,ecids,ecdbbms,ecindex," +
83 85 "ttinfo_id,ttinfo_name,schedule_date," +
84   - "sysuser_id,sysuser_name,create_date, qyrq) " +
85   - "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  86 + "sysuser_id,sysuser_name,create_date, qyrq, origingidindex) " +
  87 + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
86 88  
87 89 return sql;
88 90 }
... ... @@ -106,7 +108,7 @@ public class SchedulePlanRuleResult {
106 108 ps.setString(16, this.getSysuserName());
107 109 ps.setTimestamp(17, new java.sql.Timestamp(this.getCreateDate().getTime()));
108 110 ps.setDate(18, new java.sql.Date(this.getQyrq().getTime()));
109   -
  111 + ps.setString(19, this.getOrigingidindex());
110 112  
111 113 }
112 114  
... ... @@ -261,4 +263,12 @@ public class SchedulePlanRuleResult {
261 263 public void setQyrq(Date qyrq) {
262 264 this.qyrq = qyrq;
263 265 }
  266 +
  267 + public String getOrigingidindex() {
  268 + return origingidindex;
  269 + }
  270 +
  271 + public void setOrigingidindex(String origingidindex) {
  272 + this.origingidindex = origingidindex;
  273 + }
264 274 }
... ...
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
... ... @@ -1569,7 +1569,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1569 1569  
1570 1570 jhbc++;
1571 1571 jhlc += lc;
1572   - if(schedule.getStatus() == 2){
  1572 + if(schedule.getStatus() != -1){
1573 1573 sjbc++;
1574 1574 sjlc += lc;
1575 1575 } else if(schedule.getStatus() == -1){
... ... @@ -1622,37 +1622,37 @@ public class BusIntervalServiceImpl implements BusIntervalService {
1622 1622 tempMap.put("lcbfb", df.format(jhlc>0?(double)sjlc/jhlc*100:0)+"%");
1623 1623 tempMap.put("lzbc", lzbc);
1624 1624 tempMap.put("lzlc", lzlc);
1625   - tempMap.put("lzbfb", df.format(jhlc>0?(double)lzlc/jhlc*100:0)+"%");
  1625 + tempMap.put("lzbfb", df.format(jhlc>0?(double)lzbc/jhbc*100:0)+"%");
1626 1626 tempMap.put("dmbc", dmbc);
1627 1627 tempMap.put("dmlc", dmlc);
1628   - tempMap.put("dmbfb", df.format(jhlc>0?(double)dmlc/jhlc*100:0)+"%");
  1628 + tempMap.put("dmbfb", df.format(jhlc>0?(double)dmbc/jhbc*100:0)+"%");
1629 1629 tempMap.put("gzbc", gzbc);
1630 1630 tempMap.put("gzlc", gzlc);
1631   - tempMap.put("gzbfb", df.format(jhlc>0?(double)gzlc/jhlc*100:0)+"%");
  1631 + tempMap.put("gzbfb", df.format(jhlc>0?(double)gzbc/jhbc*100:0)+"%");
1632 1632 tempMap.put("jfbc", jfbc);
1633 1633 tempMap.put("jflc", jflc);
1634   - tempMap.put("jfbfb", df.format(jhlc>0?(double)jflc/jhlc*100:0)+"%");
  1634 + tempMap.put("jfbfb", df.format(jhlc>0?(double)jfbc/jhbc*100:0)+"%");
1635 1635 tempMap.put("zsbc", zsbc);
1636 1636 tempMap.put("zslc", zslc);
1637   - tempMap.put("zsbfb", df.format(jhlc>0?(double)zslc/jhlc*100:0)+"%");
  1637 + tempMap.put("zsbfb", df.format(jhlc>0?(double)zsbc/jhbc*100:0)+"%");
1638 1638 tempMap.put("qrbc", qrbc);
1639 1639 tempMap.put("qrlc", qrlc);
1640   - tempMap.put("qrbfb", df.format(jhlc>0?(double)qrlc/jhlc*100:0)+"%");
  1640 + tempMap.put("qrbfb", df.format(jhlc>0?(double)qrbc/jhbc*100:0)+"%");
1641 1641 tempMap.put("qcbc", qcbc);
1642 1642 tempMap.put("qclc", qclc);
1643   - tempMap.put("qcbfb", df.format(jhlc>0?(double)qclc/jhlc*100:0)+"%");
  1643 + tempMap.put("qcbfb", df.format(jhlc>0?(double)qcbc/jhbc*100:0)+"%");
1644 1644 tempMap.put("kxbc", kxbc);
1645 1645 tempMap.put("kxlc", kxlc);
1646   - tempMap.put("kxbfb", df.format(jhlc>0?(double)kxlc/jhlc*100:0)+"%");
  1646 + tempMap.put("kxbfb", df.format(jhlc>0?(double)kxbc/jhbc*100:0)+"%");
1647 1647 tempMap.put("qhbc", qhbc);
1648 1648 tempMap.put("qhlc", qhlc);
1649   - tempMap.put("qhbfb", df.format(jhlc>0?(double)qhlc/jhlc*100:0)+"%");
  1649 + tempMap.put("qhbfb", df.format(jhlc>0?(double)qhbc/jhbc*100:0)+"%");
1650 1650 tempMap.put("wybc", wybc);
1651 1651 tempMap.put("wylc", wylc);
1652   - tempMap.put("wybfb", df.format(jhlc>0?(double)wylc/jhlc*100:0)+"%");
  1652 + tempMap.put("wybfb", df.format(jhlc>0?(double)wybc/jhbc*100:0)+"%");
1653 1653 tempMap.put("qtbc", qtbc);
1654 1654 tempMap.put("qtlc", qtlc);
1655   - tempMap.put("qtbfb", df.format(jhlc>0?(double)qtlc/jhlc*100:0)+"%");
  1655 + tempMap.put("qtbfb", df.format(jhlc>0?(double)qtbc/jhbc*100:0)+"%");
1656 1656  
1657 1657 resList.add(tempMap);
1658 1658 }
... ...
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
1 1 package com.bsth.service.schedule.impl;
2 2  
3   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
4   -import com.bsth.entity.schedule.SchedulePlanInfo;
5   -import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
6   -import com.bsth.util.ReportUtils;
7   -import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.jdbc.core.JdbcTemplate;
9   -import org.springframework.jdbc.core.RowMapper;
10   -import org.springframework.stereotype.Service;
11   -
12 3 import java.math.BigDecimal;
  4 +import java.net.URLEncoder;
13 5 import java.sql.ResultSet;
14 6 import java.sql.SQLException;
15 7 import java.text.DecimalFormat;
16 8 import java.text.NumberFormat;
17 9 import java.text.ParseException;
18 10 import java.text.SimpleDateFormat;
19   -import java.util.*;
20   -
  11 +import java.util.ArrayList;
  12 +import java.util.Collections;
  13 +import java.util.Date;
  14 +import java.util.HashMap;
  15 +import java.util.HashSet;
  16 +import java.util.Iterator;
  17 +import java.util.List;
  18 +import java.util.Map;
  19 +import java.util.Set;
21 20  
22 21 import org.springframework.beans.factory.annotation.Autowired;
23 22 import org.springframework.jdbc.core.JdbcTemplate;
... ... @@ -404,20 +403,22 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
404 403 }
405 404 }
406 405  
407   - if(!schedule.getBcType().equals("in") && !schedule.getBcType().equals("out")){
408   - String clZbh = schedule.getClZbh();
409   - if(!listMap.containsKey(clZbh))
410   - listMap.put(clZbh, new ArrayList<ScheduleRealInfo>());
411   - listMap.get(clZbh).add(schedule);
  406 + if(!schedule.getBcType().equals("in") && !schedule.getBcType().equals("out")
  407 + && schedule.getFcsjActual() != null){
  408 +// String clZbh = schedule.getClZbh();
  409 + String xlDir = schedule.getXlDir();
  410 + if(!listMap.containsKey(xlDir))
  411 + listMap.put(xlDir, new ArrayList<ScheduleRealInfo>());
  412 + listMap.get(xlDir).add(schedule);
412 413 }
413 414 }
414 415  
415 416 //求首末班准点率
416   - for(String clZbh : listMap.keySet()){
  417 + for(String xlDir : listMap.keySet()){
417 418 Map<Integer, ScheduleRealInfo> temp = new HashMap<Integer, ScheduleRealInfo>();
418 419 List <ScheduleRealInfo> tempList = new ArrayList<ScheduleRealInfo>();
419 420 List<Integer> sort = new ArrayList<Integer>();
420   - for(ScheduleRealInfo schedule : listMap.get(clZbh)){
  421 + for(ScheduleRealInfo schedule : listMap.get(xlDir)){
421 422 String[] split = schedule.getFcsj().split(":");
422 423 int min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]);
423 424 temp.put(min, schedule);
... ... @@ -762,7 +763,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
762 763 return modelMap;
763 764 }
764 765  
765   -// @Override
  766 + @Override
766 767 public Map<String, Object> scheduleAnaly_sum(Map<String, Object> map) {
767 768 DecimalFormat df = new DecimalFormat("00");
768 769 NumberFormat nf = NumberFormat.getNumberInstance();
... ... @@ -867,101 +868,122 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
867 868 {
868 869 Map<String, Object> m0 = new HashMap<String, Object>();
869 870 m0.put("time", "首~6:30");
870   - m0.put("upbc", "0");m0.put("dnbc", "0");
871   - m0.put("upys", "--");m0.put("dnys", "--");
  871 + m0.put("upbc", "0"); m0.put("dnbc", "0");
  872 + m0.put("upys", "--"); m0.put("dnys", "--");
872 873 m0.put("pjys", "--");
873 874 tempList.add(m0);
874 875 Map<String, Object> m1 = new HashMap<String, Object>();
875 876 m1.put("time", "6:31~8:30");
876   - m1.put("upbc", "0");m1.put("dnbc", "0");
877   - m1.put("upys", "--");m1.put("dnys", "--");
  877 + m1.put("upbc", "0"); m1.put("dnbc", "0");
  878 + m1.put("upys", "--"); m1.put("dnys", "--");
878 879 m1.put("pjys", "--");
879 880 tempList.add(m1);
880 881 Map<String, Object> m2 = new HashMap<String, Object>();
881 882 m2.put("time", "8:31~11:00");
882   - m2.put("upbc", "0");m2.put("dnbc", "0");
883   - m2.put("upys", "--");m2.put("dnys", "--");
  883 + m2.put("upbc", "0"); m2.put("dnbc", "0");
  884 + m2.put("upys", "--"); m2.put("dnys", "--");
884 885 m2.put("pjys", "--");
885 886 tempList.add(m2);
886 887 Map<String, Object> m3 = new HashMap<String, Object>();
887 888 m3.put("time", "11:01~13:30");
888   - m3.put("upbc", "0");m3.put("dnbc", "0");
889   - m3.put("upys", "--");m3.put("dnys", "--");
  889 + m3.put("upbc", "0"); m3.put("dnbc", "0");
  890 + m3.put("upys", "--"); m3.put("dnys", "--");
890 891 m3.put("pjys", "--");
891 892 tempList.add(m3);
892 893 Map<String, Object> m4 = new HashMap<String, Object>();
893 894 m4.put("time", "13:31~16:00");
894   - m4.put("upbc", "0");m4.put("dnbc", "0");
895   - m4.put("upys", "--");m4.put("dnys", "--");
  895 + m4.put("upbc", "0"); m4.put("dnbc", "0");
  896 + m4.put("upys", "--"); m4.put("dnys", "--");
896 897 m4.put("pjys", "--");
897 898 tempList.add(m4);
898 899 Map<String, Object> m5 = new HashMap<String, Object>();
899 900 m5.put("time", "16:01~18:00");
900   - m5.put("upbc", "0");m5.put("dnbc", "0");
901   - m5.put("upys", "--");m5.put("dnys", "--");
  901 + m5.put("upbc", "0"); m5.put("dnbc", "0");
  902 + m5.put("upys", "--"); m5.put("dnys", "--");
902 903 m5.put("pjys", "--");
903 904 tempList.add(m5);
904 905 Map<String, Object> m6 = new HashMap<String, Object>();
905 906 m6.put("time", "18:01~20:30");
906   - m6.put("upbc", "0");m6.put("dnbc", "0");
907   - m6.put("upys", "--");m6.put("dnys", "--");
  907 + m6.put("upbc", "0"); m6.put("dnbc", "0");
  908 + m6.put("upys", "--"); m6.put("dnys", "--");
908 909 m6.put("pjys", "--");
909 910 tempList.add(m6);
910 911 Map<String, Object> m7 = new HashMap<String, Object>();
911 912 m7.put("time", "20:31~末");
912   - m7.put("upbc", "0");m7.put("dnbc", "0");
913   - m7.put("upys", "--");m7.put("dnys", "--");
  913 + m7.put("upbc", "0"); m7.put("dnbc", "0");
  914 + m7.put("upys", "--"); m7.put("dnys", "--");
914 915 m7.put("pjys", "--");
915 916 tempList.add(m7);
916 917 }
917 918  
  919 + String companyName = "";
  920 + String subCompanyName = "";
  921 +
918 922 //按时间段分组
919 923 for(ScheduleRealInfo schedule : list){
  924 + if(companyName.length()==0&&schedule.getGsName()!=null
  925 + &&schedule.getGsName().trim().length()!=0){
  926 + companyName = schedule.getGsName();
  927 + }
  928 + if(subCompanyName.length()==0&&schedule.getFgsName()!=null
  929 + &&schedule.getFgsName().trim().length()!=0){
  930 + subCompanyName = schedule.getFgsName();
  931 + }
  932 +
920 933 if(schedule.getFcsjActualTime()!=null && schedule.getZdsjActualTime()!=null){
921 934 Long fcsjA = schedule.getFcsjActualTime();
922   - if(fcsjA <= 6*60+30){
  935 + if(!schedule.getRealExecDate().equals(schedule.getScheduleDateStr())
  936 + || fcsjA > 20*60+30){
  937 + if(!keyMap.containsKey("20:31~末"))
  938 + keyMap.put("20:31~末", new ArrayList<ScheduleRealInfo>());
  939 + keyMap.get("20:31~末").add(schedule);
  940 +
  941 + } else if(fcsjA <= 6*60+30){
  942 +
923 943 if(!keyMap.containsKey("首~6:30"))
924 944 keyMap.put("首~6:30", new ArrayList<ScheduleRealInfo>());
925 945 keyMap.get("首~6:30").add(schedule);
926   - }
927   - if(fcsjA > 6*60+30 && fcsjA <= 8*60+30){
  946 +
  947 + } else if(fcsjA > 6*60+30 && fcsjA <= 8*60+30){
  948 +
928 949 if(!keyMap.containsKey("6:31~8:30"))
929 950 keyMap.put("6:31~8:30", new ArrayList<ScheduleRealInfo>());
930 951 keyMap.get("6:31~8:30").add(schedule);
931   - }
932   - if(fcsjA > 8*60+30 && fcsjA <= 11*60){
  952 +
  953 + } else if(fcsjA > 8*60+30 && fcsjA <= 11*60){
  954 +
933 955 if(!keyMap.containsKey("8:31~11:00"))
934 956 keyMap.put("8:31~11:00", new ArrayList<ScheduleRealInfo>());
935 957 keyMap.get("8:31~11:00").add(schedule);
936   - }
937   - if(fcsjA > 11*60 && fcsjA <= 13*60+30){
  958 +
  959 + } else if(fcsjA > 11*60 && fcsjA <= 13*60+30){
  960 +
938 961 if(!keyMap.containsKey("11:01~13:30"))
939 962 keyMap.put("11:01~13:30", new ArrayList<ScheduleRealInfo>());
940 963 keyMap.get("11:01~13:30").add(schedule);
941   - }
942   - if(fcsjA > 13*60+30 && fcsjA <= 16*60){
  964 +
  965 + } else if(fcsjA > 13*60+30 && fcsjA <= 16*60){
  966 +
943 967 if(!keyMap.containsKey("13:31~16:00"))
944 968 keyMap.put("13:31~16:00", new ArrayList<ScheduleRealInfo>());
945 969 keyMap.get("13:31~16:00").add(schedule);
946   - }
947   - if(fcsjA > 16*60 && fcsjA <= 18*60){
  970 +
  971 + } else if(fcsjA > 16*60 && fcsjA <= 18*60){
  972 +
948 973 if(!keyMap.containsKey("16:01~18:00"))
949 974 keyMap.put("16:01~18:00", new ArrayList<ScheduleRealInfo>());
950 975 keyMap.get("16:01~18:00").add(schedule);
951   - }
952   - if(fcsjA > 18*60 && fcsjA <= 20*60+30){
  976 +
  977 + } else if(fcsjA > 18*60 && fcsjA <= 20*60+30){
  978 +
953 979 if(!keyMap.containsKey("18:01~20:30"))
954 980 keyMap.put("18:01~20:30", new ArrayList<ScheduleRealInfo>());
955 981 keyMap.get("18:01~20:30").add(schedule);
956 982 }
957   - if(fcsjA > 20*60+30){
958   - if(!keyMap.containsKey("20:31~末"))
959   - keyMap.put("20:31~末", new ArrayList<ScheduleRealInfo>());
960   - keyMap.get("20:31~末").add(schedule);
961   - }
962 983 }
963 984 }
964 985  
  986 + boolean flag = false;
965 987 for(String key : keyMap.keySet()){
966 988 Map<String, Object> m = null;
967 989 for(Map<String, Object> map2 : tempList){
... ... @@ -972,6 +994,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
972 994 int upbc = 0, dnbc = 0;
973 995 long upys = 0, dnys = 0;
974 996 for(ScheduleRealInfo schedule : keyMap.get(key)){
  997 + flag = true;
975 998 if(schedule.getXlDir().equals("0")){
976 999 upbc++;
977 1000 upys += schedule.getZdsjActualTime() - schedule.getFcsjActualTime();
... ... @@ -979,15 +1002,25 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
979 1002 dnbc++;
980 1003 dnys += schedule.getZdsjActualTime() - schedule.getFcsjActualTime();
981 1004 }
  1005 +
  1006 + if(schedule.getXlName() != null && schedule.getXlName().trim().length() != 0){
  1007 + m.put("line", schedule.getXlName());
  1008 + }
982 1009 }
983 1010 m.put("upbc", upbc);
984 1011 m.put("dnbc", dnbc);
985   - m.put("upys", nf.format((float)upys / upbc));
986   - m.put("dnys", nf.format((float)dnys / dnbc));
987   - m.put("pjys", nf.format((float) (upys + dnys) / (upbc + dnbc)));
  1012 + m.put("upys", upbc > 0 ? nf.format((float)upys / upbc) : "/");
  1013 + m.put("dnys", dnbc > 0 ? nf.format((float)dnys / dnbc) : "/");
  1014 + m.put("pjys", (upbc + dnbc) > 0 ? nf.format((float) (upys + dnys) / (upbc + dnbc)) : "/");
  1015 + m.put("company", companyName.trim());
  1016 + m.put("subCompany", subCompanyName.trim());
988 1017 }
989 1018  
990   - modelMap.put("dataList", tempList);
  1019 + if(flag){
  1020 + modelMap.put("dataList", tempList);
  1021 + } else {
  1022 + modelMap.put("dataList", new ArrayList<Map<String, Object>>());
  1023 + }
991 1024  
992 1025 //导出
993 1026 if(type.equals("export")){
... ... @@ -1180,6 +1213,10 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1180 1213 }
1181 1214 }
1182 1215  
  1216 + if(longList0.size() == 0 && longList1.size() == 0){
  1217 + continue;
  1218 + }
  1219 +
1183 1220 if(longList0.size() != 0){
1184 1221 Collections.sort(longList0);
1185 1222 ScheduleRealInfo shouban0 = temp0.get(longList0.get(0));
... ... @@ -1297,7 +1334,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1297 1334 return resList;
1298 1335 }
1299 1336  
1300   -// @Override
  1337 + @Override
1301 1338 public List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map) {
1302 1339 NumberFormat nf = NumberFormat.getNumberInstance();
1303 1340 nf.setMinimumFractionDigits(2);
... ... @@ -1355,6 +1392,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1355 1392 }
1356 1393 }
1357 1394  
  1395 + if(longList0.size() == 0 && longList1.size() == 0){
  1396 + continue;
  1397 + }
1358 1398 int jhbc = 0;
1359 1399 int sjbc = 0;
1360 1400  
... ... @@ -1415,7 +1455,6 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1415 1455 tempMap.put("subCompany", subCompanyName);
1416 1456 tempMap.put("line", key);
1417 1457 resList.add(tempMap);
1418   - System.out.println(tempMap);
1419 1458 }
1420 1459  
1421 1460 if(type.equals("export")){
... ... @@ -1427,8 +1466,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1427 1466 try {
1428 1467 listI.add(resList.iterator());
1429 1468 String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
1430   - ee.excelReplace(listI, new Object[] { m }, path+"mould/firstAndLastBus.xls",
1431   - path+"export/线路首末班" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
  1469 + ee.excelReplace(listI, new Object[] { m }, path+"mould/firstAndLastBus_sum.xls",
  1470 + path+"export/线路首末班准点率" + sdfSimple.format(sdfMonth.parse(date)) + ".xls");
1432 1471 } catch (Exception e) {
1433 1472 // TODO: handle exception
1434 1473 e.printStackTrace();
... ...
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
... ... @@ -358,6 +358,7 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
358 358 // 执行完毕销毁,有日志的也要关闭
359 359 session.dispose();
360 360  
  361 +// logger.info("错误总数={}", result.getInfos().size());
361 362 // for (ValidateResults_output.ValidInfo validInfo: result.getInfos()) {
362 363 // logger.info(validInfo.getDesc());
363 364 // }
... ...
src/main/java/com/bsth/service/schedule/rules/ScheduleRuleServiceImpl.java
... ... @@ -119,6 +119,7 @@ public class ScheduleRuleServiceImpl implements ScheduleRuleService {
119 119 obj.setScheduleDate(rs.getDate("schedule_date"));
120 120 obj.setGidindex(rs.getString("gidindex"));
121 121 obj.setEcindex(rs.getString("ecindex"));
  122 + obj.setOrigingidindex(rs.getString("origingidindex"));
122 123  
123 124 // 其他字段没用
124 125 return obj;
... ...
src/main/java/com/bsth/service/schedule/rules/validate/ValidRepeatBcFunction.java
... ... @@ -47,12 +47,14 @@ public class ValidRepeatBcFunction implements AccumulateFunction {
47 47  
48 48 @Override
49 49 public Serializable createContext() {
  50 + System.out.println("create");
50 51 return new RepeatBcInfo();
51 52 }
52 53  
53 54 @Override
54 55 public void init(Serializable serializable) throws Exception {
55 56 // TODO:
  57 + System.out.println("init");
56 58 }
57 59  
58 60 @Override
... ... @@ -82,12 +84,20 @@ public class ValidRepeatBcFunction implements AccumulateFunction {
82 84  
83 85 @Override
84 86 public boolean supportsReverse() {
85   - return false;
  87 + return true;
86 88 }
87 89  
88 90 @Override
89   - public void reverse(Serializable serializable, Object o) throws Exception {
  91 + public void reverse(Serializable context, Object o) throws Exception {
  92 + RepeatBcInfo repeatBcInfo = (RepeatBcInfo) context;
  93 + SchedulePlanInfo schedulePlanInfo = (SchedulePlanInfo) o;
90 94  
  95 + String key = schedulePlanInfo.getLp() + "_" + schedulePlanInfo.getFcsj();
  96 + repeatBcInfo.lpBcFcsjCount.remove(key);
  97 +
  98 + if (!repeatBcInfo.validInfoList.isEmpty()) { // 全部清空
  99 + repeatBcInfo.validInfoList.clear();
  100 + }
91 101 }
92 102  
93 103 @Override
... ...
src/main/resources/rules/shiftloop_fb_2.drl
... ... @@ -88,7 +88,9 @@ rule &quot;calcu_days_1_&quot;
88 88 String ruleMd5 = Md5Util.getMd5(
89 89 String.valueOf($qyrq.getMillis()) +
90 90 "_" +
91   - $sri.getSelf().getLpIds()
  91 + $sri.getSelf().getLpIds() +
  92 + "_" +
  93 + $sri.getSelf().getLpStart().toString()
92 94 );
93 95 cdrp.setRuleMd5(ruleMd5);
94 96 // 人员范围个数
... ... @@ -136,7 +138,9 @@ rule &quot;calcu_days_2_&quot;
136 138 String ruleMd5 = Md5Util.getMd5(
137 139 String.valueOf($qyrq.getMillis()) +
138 140 "_" +
139   - $sri.getSelf().getLpIds()
  141 + $sri.getSelf().getLpIds() +
  142 + "_" +
  143 + $sri.getSelf().getLpStart().toString()
140 144 );
141 145 cdrp.setRuleMd5(ruleMd5);
142 146 // 人员范围个数
... ... @@ -187,7 +191,9 @@ rule &quot;Calcu_SchedulePlanRuleResult_wrap&quot;
187 191 String md5 = Md5Util.getMd5(
188 192 String.valueOf($sprr.getQyrq().getTime()) +
189 193 "_" +
190   - $sprr.getGids()
  194 + $sprr.getGids() +
  195 + "_" +
  196 + $sprr.getOrigingidindex()
191 197 );
192 198  
193 199 // System.out.println("修改后的md5:" + md5 + "车辆:" + $sprr.getCcZbh());
... ... @@ -350,7 +356,7 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻
350 356 schedulePlanRuleResult.setRuleId($ruleId);
351 357 schedulePlanRuleResult.setCcId($cid);
352 358 schedulePlanRuleResult.setCcZbh($srf.getCarConfigInfo().getCl().getInsideCode());
353   - schedulePlanRuleResult.setGids($srf.getLpIds());
  359 + schedulePlanRuleResult.setGids($srf.getLpIds()); // 参与md5计算
354 360 schedulePlanRuleResult.setGnames($srf.getLpNames());
355 361 schedulePlanRuleResult.setGidindex(String.valueOf($lpindex));
356 362 schedulePlanRuleResult.setEcids($srf.getRyConfigIds());
... ... @@ -359,7 +365,8 @@ rule &quot;Calcu_loop2_1_&quot; // 路牌在时刻表中存在,就翻
359 365 schedulePlanRuleResult.setScheduleDate($csd2.toDate());
360 366 schedulePlanRuleResult.setTtinfoId($ttinfoId);
361 367 schedulePlanRuleResult.setTtinfoName($ttinfoName);
362   - schedulePlanRuleResult.setQyrq($sri.getQyrq().toDate());
  368 + schedulePlanRuleResult.setQyrq($sri.getQyrq().toDate()); // 参与md5计算
  369 + schedulePlanRuleResult.setOrigingidindex(String.valueOf($sri.getSelf().getLpStart())); // 参与md5计算
363 370  
364 371 scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult);
365 372  
... ...
src/main/resources/rules/validplan.drl
... ... @@ -46,11 +46,11 @@ rule &quot;Valid_repeat_bc&quot; // 验证是否存在重复班次
46 46 when
47 47 $lp: Loop_param($sd: start_date, $ed: end_date)
48 48 eval($sd.isBefore($ed) || $sd.isEqual($ed))
49   - $spiList: ArrayList() from collect (SchedulePlanInfo(scheduleDate.getTime() == $sd.millis))
  49 + $spiList: ArrayList() from collect (SchedulePlanInfo(scheduleDate.getTime() == $sd.getMillis()))
50 50 $infos: ArrayList() from accumulate ($spi: SchedulePlanInfo() from $spiList, vrb($spi))
51 51 then
52 52 // TODO:
53   -// log.info("日期={},班次重复错误数={}", $sd, $infos.size());
  53 + log.info("日期={},班次重复错误数={}", $sd, $infos.size());
54 54  
55 55 validResult.getInfos().addAll($infos);
56 56  
... ...
src/main/resources/static/pages/forms/mould/firstAndLastBus_sum.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/mould/scheduleAnaly_sum.xls
No preview for this file type
src/main/resources/static/pages/forms/statement/firstAndLastBus.html
... ... @@ -207,7 +207,6 @@
207 207 params['company'] = company;
208 208 params['subCompany'] = subCompany;
209 209 params['line'] = line;
210   - params['line'] = line;
211 210 params['date'] = date;
212 211 params['type'] = "query";
213 212 $(".hidden").removeClass("hidden");
... ... @@ -225,11 +224,14 @@
225 224 }
226 225  
227 226 $("#export").on("click",function(){
  227 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  228 + layer.msg("请选择时间!");
  229 + return;
  230 + }
228 231 var params = {};
229 232 params['company'] = company;
230 233 params['subCompany'] = subCompany;
231 234 params['line'] = line;
232   - params['line'] = line;
233 235 params['date'] = date;
234 236 params['type'] = "export";
235 237 $get('/pcpc/firstAndLastBus', params, function(result){
... ... @@ -248,22 +250,50 @@
248 250 <td>{{obj.company}}</td>
249 251 <td>{{obj.subCompany}}</td>
250 252 <td>{{obj.line}}</td>
251   - <td>{{obj.qdzFirst0}}</td>
252   - <td>{{obj.jhfcFirst0}}</td>
253   - <td>{{obj.sjfcFirst0}}</td>
254   - <td>{{obj.delayFirst0}}</td>
255   - <td>{{obj.qdzLast0}}</td>
256   - <td>{{obj.jhfcLast0}}</td>
257   - <td>{{obj.sjfcLast0}}</td>
258   - <td>{{obj.delayLast0}}</td>
259   - <td>{{obj.qdzFirst1}}</td>
260   - <td>{{obj.jhfcFirst1}}</td>
261   - <td>{{obj.sjfcFirst1}}</td>
262   - <td>{{obj.delayFirst1}}</td>
263   - <td>{{obj.qdzLast1}}</td>
264   - <td>{{obj.jhfcLast1}}</td>
265   - <td>{{obj.sjfcLast1}}</td>
266   - <td>{{obj.delayLast1}}</td>
  253 + {{if obj.delayFirst0 != '/' && obj.delayFirst0 != '0'}}
  254 + <td style="background-color: #FF9999">{{obj.qdzFirst0}}</td>
  255 + <td style="background-color: #FF9999">{{obj.jhfcFirst0}}</td>
  256 + <td style="background-color: #FF9999">{{obj.sjfcFirst0}}</td>
  257 + <td style="background-color: #FF9999">{{obj.delayFirst0}}</td>
  258 + {{else}}
  259 + <td>{{obj.qdzFirst0}}</td>
  260 + <td>{{obj.jhfcFirst0}}</td>
  261 + <td>{{obj.sjfcFirst0}}</td>
  262 + <td>{{obj.delayFirst0}}</td>
  263 + {{/if}}
  264 + {{if obj.delayLast0 != '/' && obj.delayLast0 != '0'}}
  265 + <td style="background-color: #FF9999">{{obj.qdzLast0}}</td>
  266 + <td style="background-color: #FF9999">{{obj.jhfcLast0}}</td>
  267 + <td style="background-color: #FF9999">{{obj.sjfcLast0}}</td>
  268 + <td style="background-color: #FF9999">{{obj.delayLast0}}</td>
  269 + {{else}}
  270 + <td>{{obj.qdzLast0}}</td>
  271 + <td>{{obj.jhfcLast0}}</td>
  272 + <td>{{obj.sjfcLast0}}</td>
  273 + <td>{{obj.delayLast0}}</td>
  274 + {{/if}}
  275 + {{if obj.delayFirst1 != '/' && obj.delayFirst1 != '0'}}
  276 + <td style="background-color: #FF9999">{{obj.qdzFirst1}}</td>
  277 + <td style="background-color: #FF9999">{{obj.jhfcFirst1}}</td>
  278 + <td style="background-color: #FF9999">{{obj.sjfcFirst1}}</td>
  279 + <td style="background-color: #FF9999">{{obj.delayFirst1}}</td>
  280 + {{else}}
  281 + <td>{{obj.qdzFirst1}}</td>
  282 + <td>{{obj.jhfcFirst1}}</td>
  283 + <td>{{obj.sjfcFirst1}}</td>
  284 + <td>{{obj.delayFirst1}}</td>
  285 + {{/if}}
  286 + {{if obj.delayLast1 != '/' && obj.delayLast1 != '0'}}
  287 + <td style="background-color: #FF9999">{{obj.qdzLast1}}</td>
  288 + <td style="background-color: #FF9999">{{obj.jhfcLast1}}</td>
  289 + <td style="background-color: #FF9999">{{obj.sjfcLast1}}</td>
  290 + <td style="background-color: #FF9999">{{obj.delayLast1}}</td>
  291 + {{else}}
  292 + <td>{{obj.qdzLast1}}</td>
  293 + <td>{{obj.jhfcLast1}}</td>
  294 + <td>{{obj.sjfcLast1}}</td>
  295 + <td>{{obj.delayLast1}}</td>
  296 + {{/if}}
267 297 </tr>
268 298 {{/each}}
269 299 {{if list.length == 0}}
... ...
src/main/resources/static/pages/forms/statement/firstAndLastBus_sum.html
... ... @@ -205,6 +205,10 @@
205 205 }
206 206  
207 207 $("#export").on("click",function(){
  208 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  209 + layer.msg("请选择时间!");
  210 + return;
  211 + }
208 212 var params = {};
209 213 params['company'] = company;
210 214 params['subCompany'] = subCompany;
... ... @@ -212,8 +216,8 @@
212 216 params['line'] = line;
213 217 params['date'] = date;
214 218 params['type'] = "export";
215   - $get('/pcpc/firstAndLastBus', params, function(result){
216   - window.open("/downloadFile/download?fileName=线路首末班"+moment(date).format("YYYYMMDD"));
  219 + $get('/pcpc/firstAndLastBus_sum', params, function(result){
  220 + window.open("/downloadFile/download?fileName=线路首末班准点率"+moment(date).format("YYYYMMDD"));
217 221 });
218 222 });
219 223  
... ...
src/main/resources/static/pages/forms/statement/scheduleAnaly_sum.html
... ... @@ -11,14 +11,16 @@
11 11 .table-bordered > thead > tr > th,
12 12 .table-bordered > thead > tr > td {
13 13 border-bottom-width: 2px; }
14   -
15 14 .table > tbody + tbody {
16 15 border-top: 1px solid; }
  16 + #forms > tbody > tr{
  17 + background-color: #FFFFFF;
  18 + }
17 19 </style>
18 20  
19 21 <div class="page-head">
20 22 <div class="page-title">
21   - <h1>时刻表分析</h1>
  23 + <h1>时刻表分析(汇总)</h1>
22 24 </div>
23 25 </div>
24 26  
... ... @@ -70,6 +72,9 @@
70 72 <thead>
71 73 <tr class="hidden">
72 74 <th style="display: none;"></th>
  75 + <th>公司</th>
  76 + <th>分公司</th>
  77 + <th>线路</th>
73 78 <th>时间段</th>
74 79 <th>上行班次</th>
75 80 <th>下行班次</th>
... ... @@ -196,6 +201,8 @@
196 201 jsDoQuery(true);
197 202 });
198 203  
  204 + var companyName = "";
  205 + var subCompanyName = "";
199 206 var line = $("#line").val();
200 207 var startDate = $("#startDate").val();
201 208 var endDate = $("#endDate").val();
... ... @@ -232,7 +239,7 @@
232 239 $(".hidden").removeClass("hidden");
233 240 $get('/pcpc/scheduleAnaly_sum', params, function(result){
234 241 // 把数据填充到模版中
235   - var tbodyHtml = template('list_scheduleAnaly',{list:result.dataList});
  242 + var tbodyHtml = template('list_scheduleAnaly',{list:result.dataList, companyName:companyName, subCompanyName:subCompanyName});
236 243 // 把渲染好的模版html文本追加到表格中
237 244 $('#forms tbody').html(tbodyHtml);
238 245  
... ... @@ -362,6 +369,11 @@
362 369 {{each list as obj i}}
363 370 <tr>
364 371 <th style="display: none;"></th>
  372 + {{if i == 0}}
  373 + <td rowspan='8'>{{obj.company}}</td>
  374 + <td rowspan='8'>{{obj.subCompany}}</td>
  375 + <td rowspan='8'>{{obj.line}}</td>
  376 + {{/if}}
365 377 <td>{{obj.time}}</td>
366 378 <td>{{obj.upbc}}</td>
367 379 <td>{{obj.dnbc}}</td>
... ... @@ -372,7 +384,7 @@
372 384 {{/each}}
373 385 {{if list.length == 0}}
374 386 <tr>
375   - <td colspan="6"><h6 class="muted">没有找到相关数据</h6></td>
  387 + <td colspan="9"><h6 class="muted">没有找到相关数据</h6></td>
376 388 </tr>
377 389 {{/if}}
378 390 </script>
379 391 \ No newline at end of file
... ...
src/test/resources/testdata/test6.txt
... ... @@ -7,6 +7,13 @@ update bsth_c_s_sp_rule_rst a
7 7 set a.qyrq = (select qyrq from bsth_c_s_sr1_flat where id = a.rule_id)
8 8 where a.qyrq is null;
9 9  
  10 +select * from bsth_c_s_sp_rule_rst
  11 +where origingidindex is null;
  12 +
  13 +update bsth_c_s_sp_rule_rst a
  14 +set a.origingidindex = (select lp_start from bsth_c_s_sr1_flat where id = a.rule_id)
  15 +where a.origingidindex is null;
  16 +
10 17 970
11 18 789
12 19 604
... ...