Commit d0dedf6e662cbf9fa0226f864b63c51e2ed000e2
1 parent
2238b2d1
保存统计日报查询结果,快速查询
Showing
14 changed files
with
2161 additions
and
56 deletions
src/main/java/com/bsth/controller/calc/CalcWaybillController.java
| @@ -6,6 +6,7 @@ import java.util.Map; | @@ -6,6 +6,7 @@ import java.util.Map; | ||
| 6 | 6 | ||
| 7 | import com.bsth.common.ResponseCode; | 7 | import com.bsth.common.ResponseCode; |
| 8 | import com.bsth.controller.BaseController; | 8 | import com.bsth.controller.BaseController; |
| 9 | +import com.bsth.entity.calc.CalcStatistics; | ||
| 9 | import com.bsth.entity.calc.CalcWaybill; | 10 | import com.bsth.entity.calc.CalcWaybill; |
| 10 | import com.bsth.service.calc.CalcWaybillService; | 11 | import com.bsth.service.calc.CalcWaybillService; |
| 11 | 12 | ||
| @@ -26,19 +27,26 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer> | @@ -26,19 +27,26 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer> | ||
| 26 | 27 | ||
| 27 | @RequestMapping(value="/generateNew") | 28 | @RequestMapping(value="/generateNew") |
| 28 | public Map<String, Object> generateNews(@RequestParam Map<String, Object> map) throws Exception{ | 29 | public Map<String, Object> generateNews(@RequestParam Map<String, Object> map) throws Exception{ |
| 29 | - String date = "", line = ""; | 30 | + String date = "", line = "", key=""; |
| 30 | if(map.get("date")!=null){ | 31 | if(map.get("date")!=null){ |
| 31 | date=map.get("date").toString().trim(); | 32 | date=map.get("date").toString().trim(); |
| 32 | } | 33 | } |
| 33 | if(map.get("line")!=null){ | 34 | if(map.get("line")!=null){ |
| 34 | line=map.get("line").toString().trim(); | 35 | line=map.get("line").toString().trim(); |
| 35 | } | 36 | } |
| 37 | + if(map.get("key")!=null){ | ||
| 38 | + key=map.get("key").toString().trim(); | ||
| 39 | + } | ||
| 36 | 40 | ||
| 37 | Map<String, Object> m = new HashMap<String, Object>(); | 41 | Map<String, Object> m = new HashMap<String, Object>(); |
| 38 | try { | 42 | try { |
| 39 | 43 | ||
| 40 | m = calcWaybillService.generateNew(date, line); | 44 | m = calcWaybillService.generateNew(date, line); |
| 41 | 45 | ||
| 46 | + if(key.length() == 0){ | ||
| 47 | + m.put("status", calcWaybillService.calcDaily(date, line)); | ||
| 48 | + } | ||
| 49 | + | ||
| 42 | } catch (Exception e) { | 50 | } catch (Exception e) { |
| 43 | // TODO: handle exception | 51 | // TODO: handle exception |
| 44 | e.printStackTrace(); | 52 | e.printStackTrace(); |
| @@ -82,4 +90,61 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer> | @@ -82,4 +90,61 @@ public class CalcWaybillController extends BaseController<CalcWaybill, Integer> | ||
| 82 | return calcWaybillService.statisticsDailyTj(gsdm,fgsdm,line,date,date2,xlName,type); | 90 | return calcWaybillService.statisticsDailyTj(gsdm,fgsdm,line,date,date2,xlName,type); |
| 83 | } | 91 | } |
| 84 | 92 | ||
| 93 | + @RequestMapping(value="/generateDaliy") | ||
| 94 | + public Map<String, Object> generateDaliy(@RequestParam Map<String, Object> map) throws Exception{ | ||
| 95 | + String date = "", line = ""; | ||
| 96 | + if(map.containsKey("date") && map.get("date")!=null){ | ||
| 97 | + date=map.get("date").toString().trim(); | ||
| 98 | + } | ||
| 99 | + if(map.containsKey("line") && map.get("line")!=null){ | ||
| 100 | + line=map.get("line").toString().trim(); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + Map<String, Object> m = new HashMap<String, Object>(); | ||
| 104 | + try { | ||
| 105 | + | ||
| 106 | + m.put("status", calcWaybillService.calcDaily(date, line)); | ||
| 107 | + | ||
| 108 | + } catch (Exception e) { | ||
| 109 | + // TODO: handle exception | ||
| 110 | + e.printStackTrace(); | ||
| 111 | + m.put("status", ResponseCode.ERROR); | ||
| 112 | + return m; | ||
| 113 | + } | ||
| 114 | + return m; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + @RequestMapping(value="/calcStatisticsDaily") | ||
| 118 | + public List<CalcStatistics> calcStatisticsDaily(@RequestParam Map<String, Object> map){ | ||
| 119 | + String gsdm=""; | ||
| 120 | + if(map.get("gsdm")!=null){ | ||
| 121 | + gsdm=map.get("gsdm").toString().trim(); | ||
| 122 | + } | ||
| 123 | + String fgsdm=""; | ||
| 124 | + if(map.get("fgsdm")!=null){ | ||
| 125 | + fgsdm=map.get("fgsdm").toString().trim(); | ||
| 126 | + } | ||
| 127 | + String line=""; | ||
| 128 | + if(map.get("line")!=null){ | ||
| 129 | + line=map.get("line").toString().trim(); | ||
| 130 | + } | ||
| 131 | + String date=""; | ||
| 132 | + if(map.get("date")!=null){ | ||
| 133 | + date=map.get("date").toString().trim(); | ||
| 134 | + } | ||
| 135 | + String date2=""; | ||
| 136 | + if(map.get("date2")!=null){ | ||
| 137 | + date2=map.get("date2").toString().trim(); | ||
| 138 | + } | ||
| 139 | + String xlName=""; | ||
| 140 | + if(map.get("xlName")!=null){ | ||
| 141 | + xlName=map.get("xlName").toString().trim(); | ||
| 142 | + } | ||
| 143 | + String type=""; | ||
| 144 | + if(map.get("type")!=null){ | ||
| 145 | + type=map.get("type").toString().trim(); | ||
| 146 | + } | ||
| 147 | + return calcWaybillService.calcStatisticsDaily(gsdm,fgsdm,line,date,date2,xlName,type); | ||
| 148 | + } | ||
| 149 | + | ||
| 85 | } | 150 | } |
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
| @@ -3,6 +3,7 @@ package com.bsth.data.schedule.thread; | @@ -3,6 +3,7 @@ package com.bsth.data.schedule.thread; | ||
| 3 | import com.bsth.data.directive.DayOfDirectives; | 3 | import com.bsth.data.directive.DayOfDirectives; |
| 4 | import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess; | 4 | import com.bsth.data.gpsdata_v2.handlers.overspeed.OverspeedProcess; |
| 5 | import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; | 5 | import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread; |
| 6 | +import com.bsth.service.calc.CalcWaybillService; | ||
| 6 | import com.bsth.service.oil.DlbService; | 7 | import com.bsth.service.oil.DlbService; |
| 7 | import com.bsth.data.safe_driv.SafeDrivCenter; | 8 | import com.bsth.data.safe_driv.SafeDrivCenter; |
| 8 | import com.bsth.service.oil.YlbService; | 9 | import com.bsth.service.oil.YlbService; |
| @@ -31,6 +32,9 @@ public class CalcOilThread extends Thread{ | @@ -31,6 +32,9 @@ public class CalcOilThread extends Thread{ | ||
| 31 | 32 | ||
| 32 | @Autowired | 33 | @Autowired |
| 33 | DayOfDirectives dayOfDirectives; | 34 | DayOfDirectives dayOfDirectives; |
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + CalcWaybillService calcWaybillService; | ||
| 34 | 38 | ||
| 35 | @Override | 39 | @Override |
| 36 | public void run() { | 40 | public void run() { |
| @@ -42,6 +46,9 @@ public class CalcOilThread extends Thread{ | @@ -42,6 +46,9 @@ public class CalcOilThread extends Thread{ | ||
| 42 | logger.info("开始计算班次准点率...."); | 46 | logger.info("开始计算班次准点率...."); |
| 43 | sheetService.saveSheetList(""); | 47 | sheetService.saveSheetList(""); |
| 44 | logger.info("计算班次准点率结束!"); | 48 | logger.info("计算班次准点率结束!"); |
| 49 | + logger.info("开始保存统计日报...."); | ||
| 50 | + calcWaybillService.calcDaily("", ""); | ||
| 51 | + logger.info("统计日报保存完成!"); | ||
| 45 | } catch(Exception e){ | 52 | } catch(Exception e){ |
| 46 | logger.error("计算路单里程加注量失败",e); | 53 | logger.error("计算路单里程加注量失败",e); |
| 47 | } | 54 | } |
src/main/java/com/bsth/entity/calc/CalcInterval.java
0 → 100644
| 1 | +package com.bsth.entity.calc; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +import javax.persistence.Entity; | ||
| 6 | +import javax.persistence.GeneratedValue; | ||
| 7 | +import javax.persistence.Id; | ||
| 8 | +import javax.persistence.Table; | ||
| 9 | + | ||
| 10 | +@Entity | ||
| 11 | +@Table(name = "calc_interval") | ||
| 12 | +public class CalcInterval { | ||
| 13 | + /* 主键*/ | ||
| 14 | + @Id | ||
| 15 | + @GeneratedValue | ||
| 16 | + private Long id; | ||
| 17 | + /* 公司代码*/ | ||
| 18 | + private String gsdm; | ||
| 19 | + /* 公司名称*/ | ||
| 20 | + private String gsname; | ||
| 21 | + /* 分公司代码*/ | ||
| 22 | + private String fgsdm; | ||
| 23 | + /* 分公司名称*/ | ||
| 24 | + private String fgsname; | ||
| 25 | + /* 日期*/ | ||
| 26 | + private Date rq; | ||
| 27 | + /* 日期字符串*/ | ||
| 28 | + private String rqStr; | ||
| 29 | + /* 线路编码*/ | ||
| 30 | + private String xl; | ||
| 31 | + /* 线路名称*/ | ||
| 32 | + private String xlName; | ||
| 33 | + /* 大间隔次数*/ | ||
| 34 | + private int djg; | ||
| 35 | + /* 大间隔次数(早高峰)*/ | ||
| 36 | + private int djgM; | ||
| 37 | + /* 大间隔次数(晚高峰)*/ | ||
| 38 | + private int djgA; | ||
| 39 | + /* 最大大间隔时间*/ | ||
| 40 | + private int djgTime; | ||
| 41 | + /* 备注*/ | ||
| 42 | + private String remark; | ||
| 43 | + public Long getId() { | ||
| 44 | + return id; | ||
| 45 | + } | ||
| 46 | + public void setId(Long id) { | ||
| 47 | + this.id = id; | ||
| 48 | + } | ||
| 49 | + public String getGsdm() { | ||
| 50 | + return gsdm; | ||
| 51 | + } | ||
| 52 | + public void setGsdm(String gsdm) { | ||
| 53 | + this.gsdm = gsdm; | ||
| 54 | + } | ||
| 55 | + public String getGsname() { | ||
| 56 | + return gsname; | ||
| 57 | + } | ||
| 58 | + public void setGsname(String gsname) { | ||
| 59 | + this.gsname = gsname; | ||
| 60 | + } | ||
| 61 | + public String getFgsdm() { | ||
| 62 | + return fgsdm; | ||
| 63 | + } | ||
| 64 | + public void setFgsdm(String fgsdm) { | ||
| 65 | + this.fgsdm = fgsdm; | ||
| 66 | + } | ||
| 67 | + public String getFgsname() { | ||
| 68 | + return fgsname; | ||
| 69 | + } | ||
| 70 | + public void setFgsname(String fgsname) { | ||
| 71 | + this.fgsname = fgsname; | ||
| 72 | + } | ||
| 73 | + public Date getRq() { | ||
| 74 | + return rq; | ||
| 75 | + } | ||
| 76 | + public void setRq(Date rq) { | ||
| 77 | + this.rq = rq; | ||
| 78 | + } | ||
| 79 | + public String getRqStr() { | ||
| 80 | + return rqStr; | ||
| 81 | + } | ||
| 82 | + public void setRqStr(String rqStr) { | ||
| 83 | + this.rqStr = rqStr; | ||
| 84 | + } | ||
| 85 | + public String getXl() { | ||
| 86 | + return xl; | ||
| 87 | + } | ||
| 88 | + public void setXl(String xl) { | ||
| 89 | + this.xl = xl; | ||
| 90 | + } | ||
| 91 | + public String getXlName() { | ||
| 92 | + return xlName; | ||
| 93 | + } | ||
| 94 | + public void setXlName(String xlName) { | ||
| 95 | + this.xlName = xlName; | ||
| 96 | + } | ||
| 97 | + public int getDjg() { | ||
| 98 | + return djg; | ||
| 99 | + } | ||
| 100 | + public void setDjg(int djg) { | ||
| 101 | + this.djg = djg; | ||
| 102 | + } | ||
| 103 | + public int getDjgM() { | ||
| 104 | + return djgM; | ||
| 105 | + } | ||
| 106 | + public void setDjgM(int djgM) { | ||
| 107 | + this.djgM = djgM; | ||
| 108 | + } | ||
| 109 | + public int getDjgA() { | ||
| 110 | + return djgA; | ||
| 111 | + } | ||
| 112 | + public void setDjgA(int djgA) { | ||
| 113 | + this.djgA = djgA; | ||
| 114 | + } | ||
| 115 | + public int getDjgTime() { | ||
| 116 | + return djgTime; | ||
| 117 | + } | ||
| 118 | + public void setDjgTime(int djgTime) { | ||
| 119 | + this.djgTime = djgTime; | ||
| 120 | + } | ||
| 121 | + public String getRemark() { | ||
| 122 | + return remark; | ||
| 123 | + } | ||
| 124 | + public void setRemark(String remark) { | ||
| 125 | + this.remark = remark; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | +} |
src/main/java/com/bsth/entity/calc/CalcStatistics.java
0 → 100644
| 1 | +package com.bsth.entity.calc; | ||
| 2 | + | ||
| 3 | +import java.util.Date; | ||
| 4 | + | ||
| 5 | +import javax.persistence.Entity; | ||
| 6 | +import javax.persistence.GeneratedValue; | ||
| 7 | +import javax.persistence.Id; | ||
| 8 | +import javax.persistence.Table; | ||
| 9 | + | ||
| 10 | +@Entity | ||
| 11 | +@Table(name = "calc_statistics") | ||
| 12 | +public class CalcStatistics { | ||
| 13 | + /* 主键*/ | ||
| 14 | + @Id | ||
| 15 | + @GeneratedValue | ||
| 16 | + private Long id; | ||
| 17 | + /* 日期*/ | ||
| 18 | + private Date date; | ||
| 19 | + /* 日期字符串*/ | ||
| 20 | + private String dateStr; | ||
| 21 | + /* 线路编码*/ | ||
| 22 | + private String xl; | ||
| 23 | + /* 线路名称*/ | ||
| 24 | + private String xlName; | ||
| 25 | + /* 公司代码*/ | ||
| 26 | + private String gsdm; | ||
| 27 | + /* 分公司代码*/ | ||
| 28 | + private String fgsdm; | ||
| 29 | + /* 计划总公里*/ | ||
| 30 | + private Double jhzlc; | ||
| 31 | + /* 计划营运公里*/ | ||
| 32 | + private Double jhyylc; | ||
| 33 | + /* 计划空驶公里*/ | ||
| 34 | + private Double jhkslc; | ||
| 35 | + /* 实际总公里*/ | ||
| 36 | + private Double sjzlc; | ||
| 37 | + /* 实际营运公里*/ | ||
| 38 | + private Double sjyylc; | ||
| 39 | + /* 实际空驶公里*/ | ||
| 40 | + private Double sjkslc; | ||
| 41 | + /* 少驶公里*/ | ||
| 42 | + private Double sslc; | ||
| 43 | + /* 少驶班次*/ | ||
| 44 | + private int ssbc; | ||
| 45 | + /* 路阻公里*/ | ||
| 46 | + private Double lzlc; | ||
| 47 | + /* 吊慢公里*/ | ||
| 48 | + private Double dmlc; | ||
| 49 | + /* 故障公里*/ | ||
| 50 | + private Double gzlc; | ||
| 51 | + /* 纠纷公里*/ | ||
| 52 | + private Double jflc; | ||
| 53 | + /* 肇事公里*/ | ||
| 54 | + private Double zslc; | ||
| 55 | + /* 缺人公里*/ | ||
| 56 | + private Double qrlc; | ||
| 57 | + /* 缺车公里*/ | ||
| 58 | + private Double qclc; | ||
| 59 | + /* 客稀公里*/ | ||
| 60 | + private Double kxlc; | ||
| 61 | + /* 气候公里*/ | ||
| 62 | + private Double qhlc; | ||
| 63 | + /* 援外公里*/ | ||
| 64 | + private Double ywlc; | ||
| 65 | + /* 其他公里*/ | ||
| 66 | + private Double qtlc; | ||
| 67 | + /* 临加公里*/ | ||
| 68 | + private Double ljlc; | ||
| 69 | + /* 计划班次*/ | ||
| 70 | + private int jhbcq; | ||
| 71 | + /* 计划班次(早高峰)*/ | ||
| 72 | + private int jhbcz; | ||
| 73 | + /* 计划班次(晚高峰)*/ | ||
| 74 | + private int jhbcw; | ||
| 75 | + /* 实际班次*/ | ||
| 76 | + private int sjbcq; | ||
| 77 | + /* 实际班次(早高峰)*/ | ||
| 78 | + private int sjbcz; | ||
| 79 | + /* 实际班次(晚高峰)*/ | ||
| 80 | + private int sjbcw; | ||
| 81 | + /* 临加班次*/ | ||
| 82 | + private int ljbcq; | ||
| 83 | + /* 临加班次(早高峰)*/ | ||
| 84 | + private int ljbcz; | ||
| 85 | + /* 临加班次(晚高峰)*/ | ||
| 86 | + private int ljbcw; | ||
| 87 | + /* 放站班次*/ | ||
| 88 | + private int fzbcq; | ||
| 89 | + /* 放站班次(早高峰)*/ | ||
| 90 | + private int fzbcz; | ||
| 91 | + /* 放站班次(晚高峰)*/ | ||
| 92 | + private int fzbcw; | ||
| 93 | + /* 调头班次*/ | ||
| 94 | + private int dtbcq; | ||
| 95 | + /* 调头班次(早高峰)*/ | ||
| 96 | + private int dtbcz; | ||
| 97 | + /* 调头班次(晚高峰)*/ | ||
| 98 | + private int dtbcw; | ||
| 99 | + /* 大间隔次数*/ | ||
| 100 | + private int djgq; | ||
| 101 | + /* 大间隔次数(早高峰)*/ | ||
| 102 | + private int djgz; | ||
| 103 | + /* 大间隔次数(晚高峰)*/ | ||
| 104 | + private int djgw; | ||
| 105 | + /* 最大大间隔时间*/ | ||
| 106 | + private int djgsj; | ||
| 107 | + /* 备注*/ | ||
| 108 | + private String remark; | ||
| 109 | + | ||
| 110 | + | ||
| 111 | + public Long getId() { | ||
| 112 | + return id; | ||
| 113 | + } | ||
| 114 | + public void setId(Long id) { | ||
| 115 | + this.id = id; | ||
| 116 | + } | ||
| 117 | + public Date getDate() { | ||
| 118 | + return date; | ||
| 119 | + } | ||
| 120 | + public void setDate(Date date) { | ||
| 121 | + this.date = date; | ||
| 122 | + } | ||
| 123 | + public String getDateStr() { | ||
| 124 | + return dateStr; | ||
| 125 | + } | ||
| 126 | + public void setDateStr(String dateStr) { | ||
| 127 | + this.dateStr = dateStr; | ||
| 128 | + } | ||
| 129 | + public String getXl() { | ||
| 130 | + return xl; | ||
| 131 | + } | ||
| 132 | + public void setXl(String xl) { | ||
| 133 | + this.xl = xl; | ||
| 134 | + } | ||
| 135 | + public String getXlName() { | ||
| 136 | + return xlName; | ||
| 137 | + } | ||
| 138 | + public void setXlName(String xlName) { | ||
| 139 | + this.xlName = xlName; | ||
| 140 | + } | ||
| 141 | + public String getGsdm() { | ||
| 142 | + return gsdm; | ||
| 143 | + } | ||
| 144 | + public void setGsdm(String gsdm) { | ||
| 145 | + this.gsdm = gsdm; | ||
| 146 | + } | ||
| 147 | + public String getFgsdm() { | ||
| 148 | + return fgsdm; | ||
| 149 | + } | ||
| 150 | + public void setFgsdm(String fgsdm) { | ||
| 151 | + this.fgsdm = fgsdm; | ||
| 152 | + } | ||
| 153 | + public Double getJhzlc() { | ||
| 154 | + return jhzlc; | ||
| 155 | + } | ||
| 156 | + public void setJhzlc(Double jhzlc) { | ||
| 157 | + this.jhzlc = jhzlc; | ||
| 158 | + } | ||
| 159 | + public Double getJhyylc() { | ||
| 160 | + return jhyylc; | ||
| 161 | + } | ||
| 162 | + public void setJhyylc(Double jhyylc) { | ||
| 163 | + this.jhyylc = jhyylc; | ||
| 164 | + } | ||
| 165 | + public Double getJhkslc() { | ||
| 166 | + return jhkslc; | ||
| 167 | + } | ||
| 168 | + public void setJhkslc(Double jhkslc) { | ||
| 169 | + this.jhkslc = jhkslc; | ||
| 170 | + } | ||
| 171 | + public Double getSjzlc() { | ||
| 172 | + return sjzlc; | ||
| 173 | + } | ||
| 174 | + public void setSjzlc(Double sjzlc) { | ||
| 175 | + this.sjzlc = sjzlc; | ||
| 176 | + } | ||
| 177 | + public Double getSjyylc() { | ||
| 178 | + return sjyylc; | ||
| 179 | + } | ||
| 180 | + public void setSjyylc(Double sjyylc) { | ||
| 181 | + this.sjyylc = sjyylc; | ||
| 182 | + } | ||
| 183 | + public Double getSjkslc() { | ||
| 184 | + return sjkslc; | ||
| 185 | + } | ||
| 186 | + public void setSjkslc(Double sjkslc) { | ||
| 187 | + this.sjkslc = sjkslc; | ||
| 188 | + } | ||
| 189 | + public Double getSslc() { | ||
| 190 | + return sslc; | ||
| 191 | + } | ||
| 192 | + public void setSslc(Double sslc) { | ||
| 193 | + this.sslc = sslc; | ||
| 194 | + } | ||
| 195 | + public int getSsbc() { | ||
| 196 | + return ssbc; | ||
| 197 | + } | ||
| 198 | + public void setSsbc(int ssbc) { | ||
| 199 | + this.ssbc = ssbc; | ||
| 200 | + } | ||
| 201 | + public Double getLzlc() { | ||
| 202 | + return lzlc; | ||
| 203 | + } | ||
| 204 | + public void setLzlc(Double lzlc) { | ||
| 205 | + this.lzlc = lzlc; | ||
| 206 | + } | ||
| 207 | + public Double getDmlc() { | ||
| 208 | + return dmlc; | ||
| 209 | + } | ||
| 210 | + public void setDmlc(Double dmlc) { | ||
| 211 | + this.dmlc = dmlc; | ||
| 212 | + } | ||
| 213 | + public Double getGzlc() { | ||
| 214 | + return gzlc; | ||
| 215 | + } | ||
| 216 | + public void setGzlc(Double gzlc) { | ||
| 217 | + this.gzlc = gzlc; | ||
| 218 | + } | ||
| 219 | + public Double getJflc() { | ||
| 220 | + return jflc; | ||
| 221 | + } | ||
| 222 | + public void setJflc(Double jflc) { | ||
| 223 | + this.jflc = jflc; | ||
| 224 | + } | ||
| 225 | + public Double getZslc() { | ||
| 226 | + return zslc; | ||
| 227 | + } | ||
| 228 | + public void setZslc(Double zslc) { | ||
| 229 | + this.zslc = zslc; | ||
| 230 | + } | ||
| 231 | + public Double getQrlc() { | ||
| 232 | + return qrlc; | ||
| 233 | + } | ||
| 234 | + public void setQrlc(Double qrlc) { | ||
| 235 | + this.qrlc = qrlc; | ||
| 236 | + } | ||
| 237 | + public Double getQclc() { | ||
| 238 | + return qclc; | ||
| 239 | + } | ||
| 240 | + public void setQclc(Double qclc) { | ||
| 241 | + this.qclc = qclc; | ||
| 242 | + } | ||
| 243 | + public Double getKxlc() { | ||
| 244 | + return kxlc; | ||
| 245 | + } | ||
| 246 | + public void setKxlc(Double kxlc) { | ||
| 247 | + this.kxlc = kxlc; | ||
| 248 | + } | ||
| 249 | + public Double getQhlc() { | ||
| 250 | + return qhlc; | ||
| 251 | + } | ||
| 252 | + public void setQhlc(Double qhlc) { | ||
| 253 | + this.qhlc = qhlc; | ||
| 254 | + } | ||
| 255 | + public Double getYwlc() { | ||
| 256 | + return ywlc; | ||
| 257 | + } | ||
| 258 | + public void setYwlc(Double ywlc) { | ||
| 259 | + this.ywlc = ywlc; | ||
| 260 | + } | ||
| 261 | + public Double getQtlc() { | ||
| 262 | + return qtlc; | ||
| 263 | + } | ||
| 264 | + public void setQtlc(Double qtlc) { | ||
| 265 | + this.qtlc = qtlc; | ||
| 266 | + } | ||
| 267 | + public Double getLjlc() { | ||
| 268 | + return ljlc; | ||
| 269 | + } | ||
| 270 | + public void setLjlc(Double ljlc) { | ||
| 271 | + this.ljlc = ljlc; | ||
| 272 | + } | ||
| 273 | + public int getJhbcq() { | ||
| 274 | + return jhbcq; | ||
| 275 | + } | ||
| 276 | + public void setJhbcq(int jhbcq) { | ||
| 277 | + this.jhbcq = jhbcq; | ||
| 278 | + } | ||
| 279 | + public int getJhbcz() { | ||
| 280 | + return jhbcz; | ||
| 281 | + } | ||
| 282 | + public void setJhbcz(int jhbcz) { | ||
| 283 | + this.jhbcz = jhbcz; | ||
| 284 | + } | ||
| 285 | + public int getJhbcw() { | ||
| 286 | + return jhbcw; | ||
| 287 | + } | ||
| 288 | + public void setJhbcw(int jhbcw) { | ||
| 289 | + this.jhbcw = jhbcw; | ||
| 290 | + } | ||
| 291 | + public int getSjbcq() { | ||
| 292 | + return sjbcq; | ||
| 293 | + } | ||
| 294 | + public void setSjbcq(int sjbcq) { | ||
| 295 | + this.sjbcq = sjbcq; | ||
| 296 | + } | ||
| 297 | + public int getSjbcz() { | ||
| 298 | + return sjbcz; | ||
| 299 | + } | ||
| 300 | + public void setSjbcz(int sjbcz) { | ||
| 301 | + this.sjbcz = sjbcz; | ||
| 302 | + } | ||
| 303 | + public int getSjbcw() { | ||
| 304 | + return sjbcw; | ||
| 305 | + } | ||
| 306 | + public void setSjbcw(int sjbcw) { | ||
| 307 | + this.sjbcw = sjbcw; | ||
| 308 | + } | ||
| 309 | + public int getLjbcq() { | ||
| 310 | + return ljbcq; | ||
| 311 | + } | ||
| 312 | + public void setLjbcq(int ljbcq) { | ||
| 313 | + this.ljbcq = ljbcq; | ||
| 314 | + } | ||
| 315 | + public int getLjbcz() { | ||
| 316 | + return ljbcz; | ||
| 317 | + } | ||
| 318 | + public void setLjbcz(int ljbcz) { | ||
| 319 | + this.ljbcz = ljbcz; | ||
| 320 | + } | ||
| 321 | + public int getLjbcw() { | ||
| 322 | + return ljbcw; | ||
| 323 | + } | ||
| 324 | + public void setLjbcw(int ljbcw) { | ||
| 325 | + this.ljbcw = ljbcw; | ||
| 326 | + } | ||
| 327 | + public int getFzbcq() { | ||
| 328 | + return fzbcq; | ||
| 329 | + } | ||
| 330 | + public void setFzbcq(int fzbcq) { | ||
| 331 | + this.fzbcq = fzbcq; | ||
| 332 | + } | ||
| 333 | + public int getFzbcz() { | ||
| 334 | + return fzbcz; | ||
| 335 | + } | ||
| 336 | + public void setFzbcz(int fzbcz) { | ||
| 337 | + this.fzbcz = fzbcz; | ||
| 338 | + } | ||
| 339 | + public int getFzbcw() { | ||
| 340 | + return fzbcw; | ||
| 341 | + } | ||
| 342 | + public void setFzbcw(int fzbcw) { | ||
| 343 | + this.fzbcw = fzbcw; | ||
| 344 | + } | ||
| 345 | + public int getDtbcq() { | ||
| 346 | + return dtbcq; | ||
| 347 | + } | ||
| 348 | + public void setDtbcq(int dtbcq) { | ||
| 349 | + this.dtbcq = dtbcq; | ||
| 350 | + } | ||
| 351 | + public int getDtbcz() { | ||
| 352 | + return dtbcz; | ||
| 353 | + } | ||
| 354 | + public void setDtbcz(int dtbcz) { | ||
| 355 | + this.dtbcz = dtbcz; | ||
| 356 | + } | ||
| 357 | + public int getDtbcw() { | ||
| 358 | + return dtbcw; | ||
| 359 | + } | ||
| 360 | + public void setDtbcw(int dtbcw) { | ||
| 361 | + this.dtbcw = dtbcw; | ||
| 362 | + } | ||
| 363 | + public int getDjgq() { | ||
| 364 | + return djgq; | ||
| 365 | + } | ||
| 366 | + public void setDjgq(int djgq) { | ||
| 367 | + this.djgq = djgq; | ||
| 368 | + } | ||
| 369 | + public int getDjgz() { | ||
| 370 | + return djgz; | ||
| 371 | + } | ||
| 372 | + public void setDjgz(int djgz) { | ||
| 373 | + this.djgz = djgz; | ||
| 374 | + } | ||
| 375 | + public int getDjgw() { | ||
| 376 | + return djgw; | ||
| 377 | + } | ||
| 378 | + public void setDjgw(int djgw) { | ||
| 379 | + this.djgw = djgw; | ||
| 380 | + } | ||
| 381 | + public int getDjgsj() { | ||
| 382 | + return djgsj; | ||
| 383 | + } | ||
| 384 | + public void setDjgsj(int djgsj) { | ||
| 385 | + this.djgsj = djgsj; | ||
| 386 | + } | ||
| 387 | + public String getRemark() { | ||
| 388 | + return remark; | ||
| 389 | + } | ||
| 390 | + public void setRemark(String remark) { | ||
| 391 | + this.remark = remark; | ||
| 392 | + } | ||
| 393 | + | ||
| 394 | +} |
src/main/java/com/bsth/repository/calc/CalcIntervalRepository.java
0 → 100644
| 1 | +package com.bsth.repository.calc; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +import javax.transaction.Transactional; | ||
| 6 | + | ||
| 7 | +import com.bsth.entity.calc.CalcInterval; | ||
| 8 | +import com.bsth.repository.BaseRepository; | ||
| 9 | + | ||
| 10 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 11 | +import org.springframework.data.jpa.repository.Query; | ||
| 12 | +import org.springframework.stereotype.Repository; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | +@Repository | ||
| 18 | +public interface CalcIntervalRepository extends BaseRepository<CalcInterval, Integer>{ | ||
| 19 | + | ||
| 20 | + //按照时间段统计,公司下线路 | ||
| 21 | + @Query(value="select DISTINCT c from CalcInterval c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.xl") | ||
| 22 | + List<CalcInterval> selectByDateAndLine(String line,String date,String date2,String gsdm,String fgsdm); | ||
| 23 | + | ||
| 24 | + //按照时间段统计,单条线路 | ||
| 25 | + @Query(value="select DISTINCT c from CalcInterval c where c.xl = ?1 and c.rqStr between ?2 and ?3 order by c.xl") | ||
| 26 | + List<CalcInterval> selectByDateAndLine(String line,String date,String date2); | ||
| 27 | + | ||
| 28 | + //按照日期和线路删除数据 | ||
| 29 | + @Modifying | ||
| 30 | + @Transactional | ||
| 31 | + @Query(value = "delete CalcInterval c where c.rqStr=?1 and c.xl=?2") | ||
| 32 | + void deleteByDateAndLine(String date, String line); | ||
| 33 | + | ||
| 34 | + //按照日期删除数据 | ||
| 35 | + @Modifying | ||
| 36 | + @Transactional | ||
| 37 | + @Query(value = "delete CalcInterval c where c.rqStr=?1") | ||
| 38 | + void deleteByDate(String date); | ||
| 39 | + | ||
| 40 | +} |
src/main/java/com/bsth/repository/calc/CalcStatisticsRepository.java
0 → 100644
| 1 | +package com.bsth.repository.calc; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +import javax.transaction.Transactional; | ||
| 6 | + | ||
| 7 | +import com.bsth.entity.calc.CalcStatistics; | ||
| 8 | +import com.bsth.entity.calc.CalcWaybill; | ||
| 9 | +import com.bsth.repository.BaseRepository; | ||
| 10 | + | ||
| 11 | +import org.springframework.data.jpa.repository.Modifying; | ||
| 12 | +import org.springframework.data.jpa.repository.Query; | ||
| 13 | +import org.springframework.stereotype.Repository; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * | ||
| 17 | + */ | ||
| 18 | +@Repository | ||
| 19 | +public interface CalcStatisticsRepository extends BaseRepository<CalcStatistics, Integer>{ | ||
| 20 | + | ||
| 21 | + //按照时间段统计,公司下线路 | ||
| 22 | + @Query(value="select DISTINCT c from CalcStatistics c where c.xl like %?1% and c.dateStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% order by c.xl") | ||
| 23 | + List<CalcStatistics> selectByDateAndLineTj(String line,String date,String date2,String gsdm,String fgsdm); | ||
| 24 | + | ||
| 25 | + //按照时间段统计,单条线路 | ||
| 26 | + @Query(value="select DISTINCT c from CalcStatistics c where c.xl = ?1 and c.dateStr between ?2 and ?3 order by c.xl") | ||
| 27 | + List<CalcStatistics> selectByDateAndLineTj2(String line,String date,String date2); | ||
| 28 | + | ||
| 29 | + //按照日期和线路删除数据 | ||
| 30 | + @Modifying | ||
| 31 | + @Transactional | ||
| 32 | + @Query(value = "delete CalcStatistics c where c.dateStr=?1 and c.xl=?2") | ||
| 33 | + void deleteByDateAndLine(String date, String line); | ||
| 34 | + | ||
| 35 | + //按照日期删除数据 | ||
| 36 | + @Modifying | ||
| 37 | + @Transactional | ||
| 38 | + @Query(value = "delete CalcStatistics c where c.dateStr=?1") | ||
| 39 | + void deleteByDate(String date); | ||
| 40 | + | ||
| 41 | +} |
src/main/java/com/bsth/service/calc/CalcCulateMileageService.java
| 1 | package com.bsth.service.calc; | 1 | package com.bsth.service.calc; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | +import java.util.Map; | ||
| 4 | 5 | ||
| 5 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 6 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 7 | +import com.bsth.entity.sys.Interval; | ||
| 6 | 8 | ||
| 7 | 9 | ||
| 8 | public interface CalcCulateMileageService { | 10 | public interface CalcCulateMileageService { |
| @@ -25,6 +27,7 @@ public interface CalcCulateMileageService { | @@ -25,6 +27,7 @@ public interface CalcCulateMileageService { | ||
| 25 | double culateLbgl(List<ScheduleRealInfo> lists);//烂班公里 | 27 | double culateLbgl(List<ScheduleRealInfo> lists);//烂班公里 |
| 26 | double culateCJLC(List<ScheduleRealInfo> lists,String item);//烂班公里详细 | 28 | double culateCJLC(List<ScheduleRealInfo> lists,String item);//烂班公里详细 |
| 27 | int culateDtfzbc(List<ScheduleRealInfo> lists,String type,String item);//掉头放站班次 | 29 | int culateDtfzbc(List<ScheduleRealInfo> lists,String type,String item);//掉头放站班次 |
| 30 | + Map<String, Object> culateDjg(List<ScheduleRealInfo> lists,String line, List<Map<String, Object>> xlList, List<Interval> djgList);//大间隔 | ||
| 28 | 31 | ||
| 29 | } | 32 | } |
| 30 | 33 |
src/main/java/com/bsth/service/calc/CalcToolService.java
| 1 | package com.bsth.service.calc; | 1 | package com.bsth.service.calc; |
| 2 | 2 | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | +import java.util.Map; | ||
| 4 | 5 | ||
| 5 | import com.bsth.entity.calc.CalcWaybill; | 6 | import com.bsth.entity.calc.CalcWaybill; |
| 7 | +import com.bsth.entity.sys.Interval; | ||
| 6 | 8 | ||
| 7 | /** | 9 | /** |
| 8 | * Created by 17/11/16. | 10 | * Created by 17/11/16. |
| 9 | */ | 11 | */ |
| 10 | public interface CalcToolService { | 12 | public interface CalcToolService { |
| 11 | 13 | ||
| 12 | - List<CalcWaybill> findAll(String date, String line); | 14 | + List<CalcWaybill> findAll(String date, String line, List<Map<String, Object>> xlList, List<Interval> djgList); |
| 13 | 15 | ||
| 14 | } | 16 | } |
src/main/java/com/bsth/service/calc/CalcWaybillService.java
| @@ -3,6 +3,7 @@ package com.bsth.service.calc; | @@ -3,6 +3,7 @@ package com.bsth.service.calc; | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | import java.util.Map; | 4 | import java.util.Map; |
| 5 | 5 | ||
| 6 | +import com.bsth.entity.calc.CalcStatistics; | ||
| 6 | import com.bsth.entity.calc.CalcWaybill; | 7 | import com.bsth.entity.calc.CalcWaybill; |
| 7 | import com.bsth.service.BaseService; | 8 | import com.bsth.service.BaseService; |
| 8 | 9 | ||
| @@ -14,5 +15,12 @@ public interface CalcWaybillService extends BaseService<CalcWaybill, Integer> { | @@ -14,5 +15,12 @@ public interface CalcWaybillService extends BaseService<CalcWaybill, Integer> { | ||
| 14 | Map<String, Object> generateNew(String date, String line) throws Exception; | 15 | Map<String, Object> generateNew(String date, String line) throws Exception; |
| 15 | 16 | ||
| 16 | List<Map<String, Object>> statisticsDailyTj(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type); | 17 | List<Map<String, Object>> statisticsDailyTj(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type); |
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * @param rq 格式如:2018-03-22(留空""默认当前日期前一天) | ||
| 21 | + * @param line (留空""默认全部线路) | ||
| 22 | + */ | ||
| 23 | + String calcDaily(String rq, String line) throws Exception; | ||
| 17 | 24 | ||
| 25 | + List<CalcStatistics> calcStatisticsDaily(String gsdm,String fgsdm, String line, String date, String date2, String xlName, String type); | ||
| 18 | } | 26 | } |
src/main/java/com/bsth/service/calc/impl/CalcCulateMileageServiceImpl.java
| 1 | package com.bsth.service.calc.impl; | 1 | package com.bsth.service.calc.impl; |
| 2 | 2 | ||
| 3 | +import java.text.DecimalFormat; | ||
| 4 | +import java.text.ParseException; | ||
| 5 | +import java.text.SimpleDateFormat; | ||
| 6 | +import java.util.ArrayList; | ||
| 7 | +import java.util.Collections; | ||
| 8 | +import java.util.Comparator; | ||
| 9 | +import java.util.HashMap; | ||
| 3 | import java.util.Iterator; | 10 | import java.util.Iterator; |
| 4 | import java.util.List; | 11 | import java.util.List; |
| 12 | +import java.util.Map; | ||
| 5 | import java.util.Set; | 13 | import java.util.Set; |
| 6 | 14 | ||
| 7 | import org.apache.commons.lang.StringUtils; | 15 | import org.apache.commons.lang.StringUtils; |
| @@ -11,8 +19,10 @@ import org.springframework.stereotype.Service; | @@ -11,8 +19,10 @@ import org.springframework.stereotype.Service; | ||
| 11 | 19 | ||
| 12 | import com.bsth.entity.realcontrol.ChildTaskPlan; | 20 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 13 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 21 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 22 | +import com.bsth.entity.sys.Interval; | ||
| 14 | import com.bsth.service.calc.CalcCulateMileageService; | 23 | import com.bsth.service.calc.CalcCulateMileageService; |
| 15 | import com.bsth.util.Arith; | 24 | import com.bsth.util.Arith; |
| 25 | +import com.bsth.util.ComparableChild; | ||
| 16 | 26 | ||
| 17 | @Service | 27 | @Service |
| 18 | public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ | 28 | public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ |
| @@ -234,7 +244,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ | @@ -234,7 +244,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ | ||
| 234 | double sjgl =0; | 244 | double sjgl =0; |
| 235 | for (int i = 0; i < lists.size(); i++) { | 245 | for (int i = 0; i < lists.size(); i++) { |
| 236 | ScheduleRealInfo scheduleRealInfo=lists.get(i); | 246 | ScheduleRealInfo scheduleRealInfo=lists.get(i); |
| 237 | -// if(!scheduleRealInfo.isSflj()){ | 247 | + if(!scheduleRealInfo.isSflj()){ |
| 238 | Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | 248 | Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); |
| 239 | if(childTaskPlans.isEmpty()){ | 249 | if(childTaskPlans.isEmpty()){ |
| 240 | if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | 250 | if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") |
| @@ -264,7 +274,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ | @@ -264,7 +274,7 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ | ||
| 264 | } | 274 | } |
| 265 | } | 275 | } |
| 266 | } | 276 | } |
| 267 | -// } | 277 | + } |
| 268 | } | 278 | } |
| 269 | return sjgl; | 279 | return sjgl; |
| 270 | } | 280 | } |
| @@ -670,4 +680,196 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ | @@ -670,4 +680,196 @@ public class CalcCulateMileageServiceImpl implements CalcCulateMileageService{ | ||
| 670 | } | 680 | } |
| 671 | return bc; | 681 | return bc; |
| 672 | } | 682 | } |
| 683 | + | ||
| 684 | + public ScheduleRealInfo checkBc(ScheduleRealInfo s){ | ||
| 685 | + //如果班次有子任务 且 子任务中有属于营运的。把该子任务的发车时间设置成班次的发车时间 | ||
| 686 | + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual(); | ||
| 687 | + if(fcsj.equals("")){ | ||
| 688 | + Set<ChildTaskPlan> childTaskPlans = s.getcTasks(); | ||
| 689 | + if(!childTaskPlans.isEmpty()){ | ||
| 690 | + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans); | ||
| 691 | + Collections.sort(listit, new ComparableChild()); | ||
| 692 | + for (int i = 0; i < listit.size(); i++) { | ||
| 693 | + ChildTaskPlan c=listit.get(i); | ||
| 694 | + if(!c.isDestroy()){ | ||
| 695 | + if(c.getMileageType().equals("service")){ | ||
| 696 | + s.setFcsjActual(c.getStartDate()); | ||
| 697 | + break; | ||
| 698 | + } | ||
| 699 | + | ||
| 700 | + } | ||
| 701 | + } | ||
| 702 | + } | ||
| 703 | + } | ||
| 704 | + return s; | ||
| 705 | + } | ||
| 706 | + | ||
| 707 | + public Map<String, Object> listDjg(int peak,int trough,List<ScheduleRealInfo> listInfo,String grade){ | ||
| 708 | + DecimalFormat df = new DecimalFormat("#0.00"); | ||
| 709 | + Collections.sort(listInfo, new ComparableAcuals()); | ||
| 710 | + List<ScheduleRealInfo> listInfo0=new ArrayList<ScheduleRealInfo>(); | ||
| 711 | + List<ScheduleRealInfo> listInfo1=new ArrayList<ScheduleRealInfo>(); | ||
| 712 | + for (int i = 0; i < listInfo.size(); i++) { | ||
| 713 | + ScheduleRealInfo s=listInfo.get(i); | ||
| 714 | + if(s.getXlDir().equals("0")){ | ||
| 715 | + listInfo0.add(s); | ||
| 716 | + }else{ | ||
| 717 | + listInfo0.add(s); | ||
| 718 | + } | ||
| 719 | + } | ||
| 720 | + Map<String, Object> map=new HashMap<String,Object>(); | ||
| 721 | + int djgcsz=0; | ||
| 722 | + int djgcsw=0; | ||
| 723 | + int djgcsq=0; | ||
| 724 | + long djcsj=0l; | ||
| 725 | + for (int i = 0; i < listInfo0.size(); i++) { | ||
| 726 | + ScheduleRealInfo s=listInfo.get(i); | ||
| 727 | + Long fcsjTime=s.getFcsjActualTime(); | ||
| 728 | + String time=s.getFcsjActual(); | ||
| 729 | + String[] fcsjStr = time.split(":"); | ||
| 730 | + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); | ||
| 731 | + if(i<listInfo.size()-1){ | ||
| 732 | + Long djg=0l; | ||
| 733 | + Long fscjNext=listInfo.get(i+1).getFcsjActualTime(); | ||
| 734 | + if((fcsj>=zgf1&&fcsj<=zgf2)){ | ||
| 735 | + djg = (long) (peak*60*1000); | ||
| 736 | + if(fscjNext-fcsjTime>djg){ | ||
| 737 | + djgcsz ++; | ||
| 738 | + djgcsq ++; | ||
| 739 | + if(fscjNext-fcsjTime>djcsj){ | ||
| 740 | + djcsj=(fscjNext-fcsjTime)/60000; | ||
| 741 | + } | ||
| 742 | + } | ||
| 743 | + }else if((fcsj>=wgf1&&fcsj<=wgf2)){ | ||
| 744 | + djg = (long) (peak*60*1000); | ||
| 745 | + if(fscjNext-fcsjTime>djg){ | ||
| 746 | + djgcsw ++; | ||
| 747 | + djgcsq ++; | ||
| 748 | + if(fscjNext-fcsjTime>djcsj){ | ||
| 749 | + djcsj=(fscjNext-fcsjTime)/60000; | ||
| 750 | + } | ||
| 751 | + } | ||
| 752 | + }else{ | ||
| 753 | + djg = (long) (trough*60*1000); | ||
| 754 | + if(fscjNext-fcsjTime>djg){ | ||
| 755 | + djgcsq ++; | ||
| 756 | + if(fscjNext-fcsjTime>djcsj){ | ||
| 757 | + djcsj=(fscjNext-fcsjTime)/60000; | ||
| 758 | + } | ||
| 759 | + } | ||
| 760 | + } | ||
| 761 | + } | ||
| 762 | + } | ||
| 763 | + for (int i = 0; i < listInfo1.size(); i++) { | ||
| 764 | + ScheduleRealInfo s=listInfo.get(i); | ||
| 765 | + Long fcsjTime=s.getFcsjActualTime(); | ||
| 766 | + String time=s.getFcsjActual(); | ||
| 767 | + String[] fcsjStr = time.split(":"); | ||
| 768 | + long fcsj= Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]); | ||
| 769 | + if(i<listInfo.size()-1){ | ||
| 770 | + Long djg=0l; | ||
| 771 | + Long fscjNext=listInfo.get(i+1).getFcsjActualTime(); | ||
| 772 | + if(fcsj>=zgf1&&fcsj<=zgf2){ | ||
| 773 | + djg = (long) (peak*60*1000); | ||
| 774 | + if(fscjNext-fcsjTime>djg){ | ||
| 775 | + djgcsz ++; | ||
| 776 | + djgcsq ++; | ||
| 777 | + if(fscjNext-fcsjTime>djcsj){ | ||
| 778 | + djcsj=(fscjNext-fcsjTime)/60000; | ||
| 779 | + } | ||
| 780 | + } | ||
| 781 | + }else if(fcsj>=wgf1&&fcsj<=wgf2){ | ||
| 782 | + djg = (long) (peak*60*1000); | ||
| 783 | + if(fscjNext-fcsjTime>djg){ | ||
| 784 | + djgcsw ++; | ||
| 785 | + djgcsq ++; | ||
| 786 | + if(fscjNext-fcsjTime>djcsj){ | ||
| 787 | + djcsj=(fscjNext-fcsjTime)/60000; | ||
| 788 | + } | ||
| 789 | + } | ||
| 790 | + }else{ | ||
| 791 | + djg = (long) (trough*60*1000); | ||
| 792 | + if(fscjNext-fcsjTime>djg){ | ||
| 793 | + djgcsq ++; | ||
| 794 | + if(fscjNext-fcsjTime>djcsj){ | ||
| 795 | + djcsj=(fscjNext-fcsjTime)/60000; | ||
| 796 | + } | ||
| 797 | + } | ||
| 798 | + } | ||
| 799 | + } | ||
| 800 | + } | ||
| 801 | + | ||
| 802 | + map.put("djgcsz", djgcsz); | ||
| 803 | + map.put("djgcsw", djgcsw); | ||
| 804 | + map.put("djgcsq", djgcsq); | ||
| 805 | + map.put("djgsj", djcsj); | ||
| 806 | + return map; | ||
| 807 | + } | ||
| 808 | + | ||
| 809 | + @Override | ||
| 810 | + public Map<String, Object> culateDjg(List<ScheduleRealInfo> lists, | ||
| 811 | + String line, List<Map<String, Object>> xlList, List<Interval> djgList) { | ||
| 812 | + // TODO Auto-generated method stub | ||
| 813 | + | ||
| 814 | + | ||
| 815 | + // TODO Auto-generated method stub | ||
| 816 | + List<ScheduleRealInfo> list=lists; | ||
| 817 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 818 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm"); | ||
| 819 | +// Collections.sort(listInfo,new ComparableAcuals()); | ||
| 820 | + | ||
| 821 | + for (int i = 0; i < xlList.size(); i++) { | ||
| 822 | + String lineCode=xlList.get(i).get("line").toString(); | ||
| 823 | + String grade =xlList.get(i).get("grade")==null?"1":xlList.get(i).get("grade").toString(); | ||
| 824 | + int peak=0; | ||
| 825 | + int trough=0; | ||
| 826 | + for (int j = 0; j < djgList.size(); j++) { | ||
| 827 | + Interval il=djgList.get(j); | ||
| 828 | + if(il.getLevel().equals(grade)){ | ||
| 829 | + peak=il.getPeak(); | ||
| 830 | + trough=il.getTrough(); | ||
| 831 | + continue; | ||
| 832 | + } | ||
| 833 | + } | ||
| 834 | + List<ScheduleRealInfo> listInfo=new ArrayList<ScheduleRealInfo>(); | ||
| 835 | + for (int j = 0; j < list.size(); j++) { | ||
| 836 | + ScheduleRealInfo sinfo=list.get(j); | ||
| 837 | + try { | ||
| 838 | + if(sinfo.getXlBm().equals(lineCode)){ | ||
| 839 | + ScheduleRealInfo s=checkBc(sinfo); | ||
| 840 | + String fcsj=s.getFcsjActual()==null?"":s.getFcsjActual(); | ||
| 841 | + if(!fcsj.equals("")){ | ||
| 842 | + Long fcsjAcual = sdf.parse(s.getRealExecDate() + " " + s.getFcsjActual()).getTime(); | ||
| 843 | + s.setFcsjActualTime(fcsjAcual); | ||
| 844 | + s.setFcsjActual(fcsj); | ||
| 845 | + listInfo.add(s); | ||
| 846 | + } | ||
| 847 | + } | ||
| 848 | + } catch (ParseException e) { | ||
| 849 | + // TODO Auto-generated catch block | ||
| 850 | + e.printStackTrace(); | ||
| 851 | + } | ||
| 852 | + } | ||
| 853 | + | ||
| 854 | + if(listInfo.size()>0){ | ||
| 855 | + m=listDjg(peak,trough,listInfo,grade); | ||
| 856 | + }else{ | ||
| 857 | + m.put("djgcsz", "0"); | ||
| 858 | + m.put("djgcsw", "0"); | ||
| 859 | + m.put("djgcsq", "0"); | ||
| 860 | + m.put("djgsj", "0"); | ||
| 861 | + } | ||
| 862 | + } | ||
| 863 | + return m; | ||
| 864 | + } | ||
| 673 | } | 865 | } |
| 866 | + | ||
| 867 | +class ComparableAcuals implements Comparator<ScheduleRealInfo>{ | ||
| 868 | + | ||
| 869 | + @Override | ||
| 870 | + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { | ||
| 871 | + // TODO Auto-generated method stub | ||
| 872 | + return o1.getFcsjActualTime().compareTo(o2.getFcsjActualTime()); | ||
| 873 | + } | ||
| 874 | + | ||
| 875 | +} | ||
| 674 | \ No newline at end of file | 876 | \ No newline at end of file |
src/main/java/com/bsth/service/calc/impl/CalcToolServiceImpl.java
| @@ -9,9 +9,14 @@ import java.util.List; | @@ -9,9 +9,14 @@ import java.util.List; | ||
| 9 | import java.util.Map; | 9 | import java.util.Map; |
| 10 | import java.util.Set; | 10 | import java.util.Set; |
| 11 | 11 | ||
| 12 | +import javax.swing.text.Keymap; | ||
| 13 | + | ||
| 14 | +import com.bsth.entity.calc.CalcInterval; | ||
| 12 | import com.bsth.entity.calc.CalcWaybill; | 15 | import com.bsth.entity.calc.CalcWaybill; |
| 13 | import com.bsth.entity.realcontrol.ChildTaskPlan; | 16 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 14 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 17 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 18 | +import com.bsth.entity.sys.Interval; | ||
| 19 | +import com.bsth.repository.calc.CalcIntervalRepository; | ||
| 15 | import com.bsth.repository.calc.CalcWaybillRepository; | 20 | import com.bsth.repository.calc.CalcWaybillRepository; |
| 16 | import com.bsth.service.calc.CalcToolService; | 21 | import com.bsth.service.calc.CalcToolService; |
| 17 | import com.bsth.service.calc.CalcCulateMileageService; | 22 | import com.bsth.service.calc.CalcCulateMileageService; |
| @@ -35,11 +40,11 @@ public class CalcToolServiceImpl implements CalcToolService { | @@ -35,11 +40,11 @@ public class CalcToolServiceImpl implements CalcToolService { | ||
| 35 | private CalcWaybillRepository clacRepository; | 40 | private CalcWaybillRepository clacRepository; |
| 36 | 41 | ||
| 37 | @Autowired | 42 | @Autowired |
| 38 | - private CalcCulateMileageService culateMileageService; | 43 | + private CalcIntervalRepository culcIntervalRepository; |
| 39 | 44 | ||
| 40 | @Autowired | 45 | @Autowired |
| 41 | - private CulateMileageService culateMileageService2; | ||
| 42 | - | 46 | + private CalcCulateMileageService culateMileageService; |
| 47 | + | ||
| 43 | @Autowired | 48 | @Autowired |
| 44 | JdbcTemplate jdbcTemplate; | 49 | JdbcTemplate jdbcTemplate; |
| 45 | 50 | ||
| @@ -48,7 +53,7 @@ public class CalcToolServiceImpl implements CalcToolService { | @@ -48,7 +53,7 @@ public class CalcToolServiceImpl implements CalcToolService { | ||
| 48 | 53 | ||
| 49 | 54 | ||
| 50 | @Override | 55 | @Override |
| 51 | - public List<CalcWaybill> findAll(String rq, String lineCode) { | 56 | + public List<CalcWaybill> findAll(String rq, String lineCode, List<Map<String, Object>> xlList, List<Interval> djgList) { |
| 52 | List<CalcWaybill> listCal=new ArrayList<CalcWaybill>(); | 57 | List<CalcWaybill> listCal=new ArrayList<CalcWaybill>(); |
| 53 | List<ScheduleRealInfo> list = clacRepository.findAllSchedule(rq,lineCode); | 58 | List<ScheduleRealInfo> list = clacRepository.findAllSchedule(rq,lineCode); |
| 54 | String sql ="select r.j_gh ,r.s_gh,r.cl_zbh,r.xl_bm, r.lp_name FROM" | 59 | String sql ="select r.j_gh ,r.s_gh,r.cl_zbh,r.xl_bm, r.lp_name FROM" |
| @@ -104,9 +109,30 @@ public class CalcToolServiceImpl implements CalcToolService { | @@ -104,9 +109,30 @@ public class CalcToolServiceImpl implements CalcToolService { | ||
| 104 | 109 | ||
| 105 | //计算方法 | 110 | //计算方法 |
| 106 | if(list_.size()>0){ | 111 | if(list_.size()>0){ |
| 107 | - listCal.addAll(this.cul(list_, lists_)); | 112 | + listCal.addAll(this.cul(list_, lists_, xlList, djgList)); |
| 108 | } | 113 | } |
| 109 | } | 114 | } |
| 115 | + | ||
| 116 | + //按线路计算大间隔 | ||
| 117 | + if(list.size() > 0){ | ||
| 118 | + ScheduleRealInfo s = list.get(0); | ||
| 119 | + Map<String, Object> culateDjg = culateMileageService.culateDjg(list, lineCode, xlList, djgList); | ||
| 120 | + CalcInterval interval = new CalcInterval(); | ||
| 121 | + interval.setGsdm(s.getGsBm()); | ||
| 122 | + interval.setGsname(s.getGsName()); | ||
| 123 | + interval.setFgsdm(s.getFgsBm()); | ||
| 124 | + interval.setFgsname(s.getFgsName()); | ||
| 125 | + interval.setRq(s.getScheduleDate()); | ||
| 126 | + interval.setRqStr(s.getScheduleDateStr()); | ||
| 127 | + interval.setXl(s.getXlBm()); | ||
| 128 | + interval.setXlName(s.getXlName()); | ||
| 129 | + interval.setDjg(Integer.valueOf(culateDjg.get("djgcsq").toString())); | ||
| 130 | + interval.setDjgM(Integer.valueOf(culateDjg.get("djgcsz").toString())); | ||
| 131 | + interval.setDjgA(Integer.valueOf(culateDjg.get("djgcsw").toString())); | ||
| 132 | + interval.setDjgTime(Integer.valueOf(culateDjg.get("djgsj").toString())); | ||
| 133 | + culcIntervalRepository.save(interval); | ||
| 134 | + } | ||
| 135 | + | ||
| 110 | while(true){ | 136 | while(true){ |
| 111 | int i = 0, l = 0; | 137 | int i = 0, l = 0; |
| 112 | boolean flag = false; | 138 | boolean flag = false; |
| @@ -145,7 +171,7 @@ public class CalcToolServiceImpl implements CalcToolService { | @@ -145,7 +171,7 @@ public class CalcToolServiceImpl implements CalcToolService { | ||
| 145 | } | 171 | } |
| 146 | 172 | ||
| 147 | //list_ 全部班次 lists_执行了的班次(实到实发不为空) | 173 | //list_ 全部班次 lists_执行了的班次(实到实发不为空) |
| 148 | - private List<CalcWaybill> cul(List<ScheduleRealInfo> list_,List<ScheduleRealInfo> lists_){ | 174 | + private List<CalcWaybill> cul(List<ScheduleRealInfo> list_,List<ScheduleRealInfo> list_s, List<Map<String, Object>> xlList, List<Interval> djgList){ |
| 149 | List<CalcWaybill> list=new ArrayList<CalcWaybill>(); | 175 | List<CalcWaybill> list=new ArrayList<CalcWaybill>(); |
| 150 | if(list_.size()>0){ | 176 | if(list_.size()>0){ |
| 151 | Date date=list_.get(0).getScheduleDate(); | 177 | Date date=list_.get(0).getScheduleDate(); |
| @@ -167,20 +193,20 @@ public class CalcToolServiceImpl implements CalcToolService { | @@ -167,20 +193,20 @@ public class CalcToolServiceImpl implements CalcToolService { | ||
| 167 | int jhyybcWgf=culateMileageService.culateJhyybc(list_, "wgf"); | 193 | int jhyybcWgf=culateMileageService.culateJhyybc(list_, "wgf"); |
| 168 | double jhyylc=culateMileageService.culateJhyylc(list_); | 194 | double jhyylc=culateMileageService.culateJhyylc(list_); |
| 169 | double jhfyylc=culateMileageService.culateJhfyylc(list_); | 195 | double jhfyylc=culateMileageService.culateJhfyylc(list_); |
| 170 | - int sjyybc=culateMileageService.culateSjyybc(lists_, ""); | ||
| 171 | - int sjyybcZgf=culateMileageService.culateSjyybc(lists_, "zgf"); | ||
| 172 | - int sjyybcWgf=culateMileageService.culateSjyybc(lists_, "wgf"); | ||
| 173 | - double sjyylc=culateMileageService.culateSjyylc(lists_);//驾售共有 | ||
| 174 | - double sjyylc_j=culateMileageService.culateSjyylc_j(lists_);//无售 | ||
| 175 | - double sjfyylc=culateMileageService.culateSjfyylc(lists_);//驾售 | ||
| 176 | - double sjfyylc_j=culateMileageService.culateSjfyylc_j(lists_);//无售 | ||
| 177 | - int ljbc=culateMileageService.culateLjbc(lists_, ""); | ||
| 178 | - int ljbcZgf=culateMileageService.culateLjbc(lists_, "zgf"); | ||
| 179 | - int ljbcWgf=culateMileageService.culateLjbc(lists_, "wgf"); | ||
| 180 | - double ljyylc=culateMileageService.culateLjyylc(lists_);//驾售 | ||
| 181 | - double ljyylc_j=culateMileageService.culateLjyylc_j(lists_);//无售 | ||
| 182 | - double ljfyylc=culateMileageService.culateLjfyylc(lists_);//驾售 | ||
| 183 | - double ljfyylc_j=culateMileageService.culateLjfyylc_j(lists_);//无售 | 196 | + int sjyybc=culateMileageService.culateSjyybc(list_s, ""); |
| 197 | + int sjyybcZgf=culateMileageService.culateSjyybc(list_s, "zgf"); | ||
| 198 | + int sjyybcWgf=culateMileageService.culateSjyybc(list_s, "wgf"); | ||
| 199 | + double sjyylc=culateMileageService.culateSjyylc(list_s);//驾售共有 | ||
| 200 | + double sjyylc_j=culateMileageService.culateSjyylc_j(list_s);//无售 | ||
| 201 | + double sjfyylc=culateMileageService.culateSjfyylc(list_s);//驾售 | ||
| 202 | + double sjfyylc_j=culateMileageService.culateSjfyylc_j(list_s);//无售 | ||
| 203 | + int ljbc=culateMileageService.culateLjbc(list_s, ""); | ||
| 204 | + int ljbcZgf=culateMileageService.culateLjbc(list_s, "zgf"); | ||
| 205 | + int ljbcWgf=culateMileageService.culateLjbc(list_s, "wgf"); | ||
| 206 | + double ljyylc=culateMileageService.culateLjyylc(list_s);//驾售 | ||
| 207 | + double ljyylc_j=culateMileageService.culateLjyylc_j(list_s);//无售 | ||
| 208 | + double ljfyylc=culateMileageService.culateLjfyylc(list_s);//驾售 | ||
| 209 | + double ljfyylc_j=culateMileageService.culateLjfyylc_j(list_s);//无售 | ||
| 184 | int lbbc=culateMileageService.culateLbbc(list_); | 210 | int lbbc=culateMileageService.culateLbbc(list_); |
| 185 | double lblc=culateMileageService.culateLbgl(list_); | 211 | double lblc=culateMileageService.culateLbgl(list_); |
| 186 | double ssgl_lz= culateMileageService.culateCJLC(list_, "路阻"); | 212 | double ssgl_lz= culateMileageService.culateCJLC(list_, "路阻"); |
| @@ -199,12 +225,12 @@ public class CalcToolServiceImpl implements CalcToolService { | @@ -199,12 +225,12 @@ public class CalcToolServiceImpl implements CalcToolService { | ||
| 199 | double ssgl_cj=culateMileageService.culateCJLC(list_, "抽减"); | 225 | double ssgl_cj=culateMileageService.culateCJLC(list_, "抽减"); |
| 200 | double ssgl_qt=culateMileageService.culateCJLC(list_, "其他"); | 226 | double ssgl_qt=culateMileageService.culateCJLC(list_, "其他"); |
| 201 | double ssgl_qtz=Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj,ssgl_qt)); | 227 | double ssgl_qtz=Arith.add(Arith.add(ssgl_pc, ssgl_by), Arith.add(ssgl_cj,ssgl_qt)); |
| 202 | - int fzbc=culateMileageService.culateDtfzbc(lists_, "major", "");//放站 | ||
| 203 | - int fzbcZgf=culateMileageService.culateDtfzbc(lists_, "major", "zgf"); | ||
| 204 | - int fzbcWgf=culateMileageService.culateDtfzbc(lists_, "major", "wgf"); | ||
| 205 | - int zfbc=culateMileageService.culateDtfzbc(lists_, "venting", "");//直放 | ||
| 206 | - int zfbcZgf=culateMileageService.culateDtfzbc(lists_, "venting", "zgf"); | ||
| 207 | - int zfbcWgf=culateMileageService.culateDtfzbc(lists_, "venting", "wgf"); | 228 | + int fzbc=culateMileageService.culateDtfzbc(list_s, "major", "");//放站 |
| 229 | + int fzbcZgf=culateMileageService.culateDtfzbc(list_s, "major", "zgf"); | ||
| 230 | + int fzbcWgf=culateMileageService.culateDtfzbc(list_s, "major", "wgf"); | ||
| 231 | + int zfbc=culateMileageService.culateDtfzbc(list_s, "venting", "");//直放 | ||
| 232 | + int zfbcZgf=culateMileageService.culateDtfzbc(list_s, "venting", "zgf"); | ||
| 233 | + int zfbcWgf=culateMileageService.culateDtfzbc(list_s, "venting", "wgf"); | ||
| 208 | CalcWaybill t=new CalcWaybill(); | 234 | CalcWaybill t=new CalcWaybill(); |
| 209 | t.setRq(date); | 235 | t.setRq(date); |
| 210 | t.setRqStr(dateStr); | 236 | t.setRqStr(dateStr); |
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
| @@ -2,9 +2,15 @@ package com.bsth.service.calc.impl; | @@ -2,9 +2,15 @@ package com.bsth.service.calc.impl; | ||
| 2 | 2 | ||
| 3 | import java.sql.ResultSet; | 3 | import java.sql.ResultSet; |
| 4 | import java.sql.SQLException; | 4 | import java.sql.SQLException; |
| 5 | +import java.text.SimpleDateFormat; | ||
| 5 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
| 7 | +import java.util.Calendar; | ||
| 8 | +import java.util.Collections; | ||
| 9 | +import java.util.Comparator; | ||
| 10 | +import java.util.Date; | ||
| 6 | import java.util.HashMap; | 11 | import java.util.HashMap; |
| 7 | import java.util.HashSet; | 12 | import java.util.HashSet; |
| 13 | +import java.util.Iterator; | ||
| 8 | import java.util.List; | 14 | import java.util.List; |
| 9 | import java.util.Map; | 15 | import java.util.Map; |
| 10 | import java.util.Set; | 16 | import java.util.Set; |
| @@ -12,13 +18,25 @@ import java.util.Set; | @@ -12,13 +18,25 @@ import java.util.Set; | ||
| 12 | import javax.transaction.Transactional; | 18 | import javax.transaction.Transactional; |
| 13 | 19 | ||
| 14 | import com.bsth.common.ResponseCode; | 20 | import com.bsth.common.ResponseCode; |
| 21 | +import com.bsth.entity.calc.CalcInterval; | ||
| 22 | +import com.bsth.entity.calc.CalcStatistics; | ||
| 15 | import com.bsth.entity.calc.CalcWaybill; | 23 | import com.bsth.entity.calc.CalcWaybill; |
| 24 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | ||
| 25 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 26 | +import com.bsth.entity.sys.Interval; | ||
| 27 | +import com.bsth.repository.calc.CalcIntervalRepository; | ||
| 28 | +import com.bsth.repository.calc.CalcStatisticsRepository; | ||
| 16 | import com.bsth.repository.calc.CalcWaybillRepository; | 29 | import com.bsth.repository.calc.CalcWaybillRepository; |
| 30 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 17 | import com.bsth.service.calc.CalcToolService; | 31 | import com.bsth.service.calc.CalcToolService; |
| 18 | import com.bsth.service.calc.CalcWaybillService; | 32 | import com.bsth.service.calc.CalcWaybillService; |
| 19 | import com.bsth.service.impl.BaseServiceImpl; | 33 | import com.bsth.service.impl.BaseServiceImpl; |
| 34 | +import com.bsth.service.report.CulateMileageService; | ||
| 20 | import com.bsth.util.Arith; | 35 | import com.bsth.util.Arith; |
| 21 | -import com.bsth.util.BatchSaveUtils; | 36 | +import com.bsth.util.ReportUtils; |
| 37 | +import com.github.stuxuhai.jpinyin.PinyinException; | ||
| 38 | +import com.github.stuxuhai.jpinyin.PinyinFormat; | ||
| 39 | +import com.github.stuxuhai.jpinyin.PinyinHelper; | ||
| 22 | 40 | ||
| 23 | import org.slf4j.Logger; | 41 | import org.slf4j.Logger; |
| 24 | import org.slf4j.LoggerFactory; | 42 | import org.slf4j.LoggerFactory; |
| @@ -34,12 +52,24 @@ import org.springframework.stereotype.Service; | @@ -34,12 +52,24 @@ import org.springframework.stereotype.Service; | ||
| 34 | public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer> implements CalcWaybillService { | 52 | public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer> implements CalcWaybillService { |
| 35 | 53 | ||
| 36 | @Autowired | 54 | @Autowired |
| 37 | - private CalcWaybillRepository clacRepository; | 55 | + private CalcWaybillRepository calcRepository; |
| 38 | 56 | ||
| 39 | @Autowired | 57 | @Autowired |
| 40 | - private CalcToolService calcToolService; | 58 | + private CalcIntervalRepository calcIntervalRepository; |
| 41 | 59 | ||
| 42 | @Autowired | 60 | @Autowired |
| 61 | + private CalcStatisticsRepository calcStatisticsRepository; | ||
| 62 | + | ||
| 63 | + @Autowired | ||
| 64 | + private CalcToolService calcToolService; | ||
| 65 | + | ||
| 66 | + @Autowired | ||
| 67 | + private CulateMileageService culateService; | ||
| 68 | + | ||
| 69 | + @Autowired | ||
| 70 | + private ScheduleRealInfoRepository scheduleRealInfoRepository; | ||
| 71 | + | ||
| 72 | + @Autowired | ||
| 43 | JdbcTemplate jdbcTemplate; | 73 | JdbcTemplate jdbcTemplate; |
| 44 | 74 | ||
| 45 | 75 | ||
| @@ -54,9 +84,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -54,9 +84,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 54 | try { | 84 | try { |
| 55 | 85 | ||
| 56 | if(date.length() != 0 && line.length() != 0){ | 86 | if(date.length() != 0 && line.length() != 0){ |
| 57 | - clacRepository.deleteByDateAndLine(date, line); | 87 | + calcRepository.deleteByDateAndLine(date, line); |
| 88 | + calcIntervalRepository.deleteByDateAndLine(date, line); | ||
| 58 | } else if(date.length() != 0){ | 89 | } else if(date.length() != 0){ |
| 59 | - clacRepository.deleteByDate(date); | 90 | + calcRepository.deleteByDate(date); |
| 91 | + calcIntervalRepository.deleteByDate(date); | ||
| 60 | } else { | 92 | } else { |
| 61 | newMap.put("status", ResponseCode.ERROR); | 93 | newMap.put("status", ResponseCode.ERROR); |
| 62 | logger.error("save erro.", "日期不能为空"); | 94 | logger.error("save erro.", "日期不能为空"); |
| @@ -84,21 +116,60 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -84,21 +116,60 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 84 | m.put("start_opt", rs.getString("start_opt")); | 116 | m.put("start_opt", rs.getString("start_opt")); |
| 85 | m.put("line_code", rs.getString("line_code")); | 117 | m.put("line_code", rs.getString("line_code")); |
| 86 | return m; | 118 | return m; |
| 87 | - }}); | ||
| 88 | - | 119 | + }}); |
| 120 | + | ||
| 121 | + String xlSql="select line_code,spac_grade from bsth_c_line"; | ||
| 122 | + if(line.length() != 0){ | ||
| 123 | + xlSql += " where line_code ='"+line+"'"; | ||
| 124 | + } | ||
| 125 | + List<Map<String, Object>> xlList=jdbcTemplate.query(xlSql, new RowMapper<Map<String, Object>>() { | ||
| 126 | + @Override | ||
| 127 | + public Map<String, Object> mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 128 | + Map<String, Object> map=new HashMap<String,Object>(); | ||
| 129 | + map.put("line",arg0.getString("line_code")); | ||
| 130 | + map.put("grade", arg0.getString("spac_grade")); | ||
| 131 | + return map; | ||
| 132 | + }}); | ||
| 133 | + Map<String, List<Map<String, Object>>> xlMap = new HashMap<String, List<Map<String, Object>>>(); | ||
| 134 | + for(Map<String, Object> m : xlList){ | ||
| 135 | + if(m.containsKey("line") && m.get("line").toString().trim().length() > 0){ | ||
| 136 | + String key = m.get("line").toString(); | ||
| 137 | + if(!xlMap.containsKey(key)) | ||
| 138 | + xlMap.put(key, new ArrayList<Map<String, Object>>()); | ||
| 139 | + xlMap.get(key).add(m); | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + //查询大间隔时间 | ||
| 143 | + String djgSql="select * from bsth_c_interval"; | ||
| 144 | + List<Interval> djgList=jdbcTemplate.query(djgSql, new RowMapper<Interval>() { | ||
| 145 | + @Override | ||
| 146 | + public Interval mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 147 | + Interval m=new Interval(); | ||
| 148 | + m.setLevel(arg0.getString("level")); | ||
| 149 | + m.setPeak(arg0.getInt("peak")); | ||
| 150 | + m.setTrough(arg0.getInt("trough")); | ||
| 151 | + return m; | ||
| 152 | + }}); | ||
| 153 | + | ||
| 89 | Set<String> lineSet = new HashSet<String>(); | 154 | Set<String> lineSet = new HashSet<String>(); |
| 90 | for (int i = 0; i < listLineConfig.size(); i++) { | 155 | for (int i = 0; i < listLineConfig.size(); i++) { |
| 91 | Map<String, Object> m =listLineConfig.get(i); | 156 | Map<String, Object> m =listLineConfig.get(i); |
| 92 | String lineCode=m.get("line_code").toString().trim(); | 157 | String lineCode=m.get("line_code").toString().trim(); |
| 93 | - String startOpt=m.get("start_opt").toString().trim(); | 158 | +// String startOpt=m.get("start_opt").toString().trim(); |
| 94 | if(!lineSet.add(lineCode)) | 159 | if(!lineSet.add(lineCode)) |
| 95 | continue; | 160 | continue; |
| 96 | 161 | ||
| 97 | - List<CalcWaybill> findAll = calcToolService.findAll(date, lineCode); | 162 | + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); |
| 163 | + if(xlMap.containsKey(lineCode) && xlMap.get(lineCode) != null){ | ||
| 164 | + tempList = xlMap.get(lineCode); | ||
| 165 | + } | ||
| 98 | 166 | ||
| 99 | -// new BatchSaveUtils<CalcWaybill>().saveList2(findAll, CalcWaybill.class); | 167 | + List<CalcWaybill> findAll = calcToolService.findAll(date, lineCode, tempList, djgList); |
| 100 | 168 | ||
| 101 | - clacRepository.save(findAll); | 169 | +// new BatchSaveUtils<CalcWaybill>().saveList2(findAll, CalcWaybill.class); |
| 170 | + | ||
| 171 | +// if(xlMap.get(lineCode).size() == 0) | ||
| 172 | + calcRepository.save(findAll); | ||
| 102 | } | 173 | } |
| 103 | 174 | ||
| 104 | newMap.put("status", ResponseCode.SUCCESS); | 175 | newMap.put("status", ResponseCode.SUCCESS); |
| @@ -116,28 +187,41 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -116,28 +187,41 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 116 | public List<Map<String, Object>> statisticsDailyTj(String gsdm, | 187 | public List<Map<String, Object>> statisticsDailyTj(String gsdm, |
| 117 | String fgsdm, String line, String date, String date2, | 188 | String fgsdm, String line, String date, String date2, |
| 118 | String xlName, String type) { | 189 | String xlName, String type) { |
| 119 | - | 190 | + |
| 191 | + List<String> keyList = new ArrayList<String>(); | ||
| 120 | List<CalcWaybill> list = new ArrayList<CalcWaybill>(); | 192 | List<CalcWaybill> list = new ArrayList<CalcWaybill>(); |
| 121 | List<CalcWaybill> lists = new ArrayList<CalcWaybill>(); | 193 | List<CalcWaybill> lists = new ArrayList<CalcWaybill>(); |
| 194 | + List<CalcInterval> list_ = new ArrayList<CalcInterval>(); | ||
| 122 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | 195 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); |
| 123 | Map<String, List<CalcWaybill>> keyMap = new HashMap<String, List<CalcWaybill>>(); | 196 | Map<String, List<CalcWaybill>> keyMap = new HashMap<String, List<CalcWaybill>>(); |
| 197 | + Map<String, List<CalcInterval>> keyMap_ = new HashMap<String, List<CalcInterval>>(); | ||
| 124 | 198 | ||
| 125 | if(line.equals("")){ | 199 | if(line.equals("")){ |
| 126 | //查询所有线路 | 200 | //查询所有线路 |
| 127 | - list = clacRepository.scheduleByDateAndLineTj(line,date,date2,gsdm,fgsdm); | 201 | + list = calcRepository.scheduleByDateAndLineTj(line,date,date2,gsdm,fgsdm); |
| 202 | + list_ = calcIntervalRepository.selectByDateAndLine(line, date, date2, gsdm, fgsdm); | ||
| 128 | }else{ | 203 | }else{ |
| 129 | //查询单条线路 | 204 | //查询单条线路 |
| 130 | - list = clacRepository.scheduleByDateAndLineTj2(line,date,date2); | 205 | + list = calcRepository.scheduleByDateAndLineTj2(line,date,date2); |
| 206 | + list_ = calcIntervalRepository.selectByDateAndLine(line, date, date2); | ||
| 131 | } | 207 | } |
| 132 | 208 | ||
| 133 | for(CalcWaybill c : list){ | 209 | for(CalcWaybill c : list){ |
| 134 | String key = c.getXlName(); | 210 | String key = c.getXlName(); |
| 135 | if(!keyMap.containsKey(key)){ | 211 | if(!keyMap.containsKey(key)){ |
| 136 | keyMap.put(key, new ArrayList<CalcWaybill>()); | 212 | keyMap.put(key, new ArrayList<CalcWaybill>()); |
| 213 | + keyList.add(key); | ||
| 137 | } | 214 | } |
| 138 | keyMap.get(key).add(c); | 215 | keyMap.get(key).add(c); |
| 139 | } | 216 | } |
| 140 | - for(String key : keyMap.keySet()){ | 217 | + for(CalcInterval c : list_){ |
| 218 | + String key = c.getXlName(); | ||
| 219 | + if(!keyMap_.containsKey(key)) | ||
| 220 | + keyMap_.put(key, new ArrayList<CalcInterval>()); | ||
| 221 | + keyMap_.get(key).add(c); | ||
| 222 | + } | ||
| 223 | + Collections.sort(keyList, new AccountXlbmStr()); | ||
| 224 | + for(String key : keyList){ | ||
| 141 | CalcWaybill calc = keyMap.get(key).get(0); | 225 | CalcWaybill calc = keyMap.get(key).get(0); |
| 142 | for(int i = 1; i < keyMap.get(key).size(); i++){ | 226 | for(int i = 1; i < keyMap.get(key).size(); i++){ |
| 143 | CalcWaybill c= keyMap.get(key).get(i); | 227 | CalcWaybill c= keyMap.get(key).get(i); |
| @@ -171,15 +255,32 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -171,15 +255,32 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 171 | calc.setFzbc(calc.getFzbc() + c.getFzbc()); | 255 | calc.setFzbc(calc.getFzbc() + c.getFzbc()); |
| 172 | calc.setFzbczgf(calc.getFzbczgf() + c.getFzbczgf()); | 256 | calc.setFzbczgf(calc.getFzbczgf() + c.getFzbczgf()); |
| 173 | calc.setFzbcwgf(calc.getFzbcwgf() + c.getFzbcwgf()); | 257 | calc.setFzbcwgf(calc.getFzbcwgf() + c.getFzbcwgf()); |
| 174 | - calc.setDtbc(calc.getDtbc() + c.getFzbc()); | 258 | + calc.setDtbc(calc.getDtbc() + c.getDtbc()); |
| 175 | calc.setDtbczgf(calc.getDtbczgf() + c.getDtbczgf()); | 259 | calc.setDtbczgf(calc.getDtbczgf() + c.getDtbczgf()); |
| 176 | calc.setDtbcwgf(calc.getDtbcwgf() + c.getDtbcwgf()); | 260 | calc.setDtbcwgf(calc.getDtbcwgf() + c.getDtbcwgf()); |
| 177 | - | ||
| 178 | } | 261 | } |
| 179 | calc.setSjyylc(Arith.add(calc.getSjyylc(), calc.getLjyylc())); | 262 | calc.setSjyylc(Arith.add(calc.getSjyylc(), calc.getLjyylc())); |
| 180 | - System.out.println(); | ||
| 181 | lists.add(calc); | 263 | lists.add(calc); |
| 182 | } | 264 | } |
| 265 | + CalcInterval sum_ = new CalcInterval(); | ||
| 266 | + sum_.setXlName("合计"); | ||
| 267 | + sum_.setDjgTime(0); | ||
| 268 | + for(String key : keyMap_.keySet()){ | ||
| 269 | + CalcInterval calc = keyMap_.get(key).get(0); | ||
| 270 | + for(int i = 1; i < keyMap_.get(key).size(); i++){ | ||
| 271 | + CalcInterval calc_ = keyMap_.get(key).get(i); | ||
| 272 | + calc.setDjg(calc.getDjg() + calc_.getDjg()); | ||
| 273 | + calc.setDjgM(calc.getDjgM() + calc_.getDjgM()); | ||
| 274 | + calc.setDjgA(calc.getDjgA() + calc_.getDjgA()); | ||
| 275 | + if(calc_.getDjgTime() > calc.getDjgTime()) | ||
| 276 | + calc.setDjgTime(calc_.getDjgTime()); | ||
| 277 | + } | ||
| 278 | + sum_.setDjg(sum_.getDjg() + calc.getDjg()); | ||
| 279 | + sum_.setDjgM(sum_.getDjgM() + calc.getDjgM()); | ||
| 280 | + sum_.setDjgA(sum_.getDjgA() + calc.getDjgA()); | ||
| 281 | + if(calc.getDjgTime() > sum_.getDjgTime()) | ||
| 282 | + sum_.setDjgTime(calc.getDjgTime()); | ||
| 283 | + } | ||
| 183 | 284 | ||
| 184 | CalcWaybill sum = new CalcWaybill(); | 285 | CalcWaybill sum = new CalcWaybill(); |
| 185 | sum.setXlName("合计"); | 286 | sum.setXlName("合计"); |
| @@ -187,7 +288,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -187,7 +288,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 187 | sum.setJhyylc(Arith.add(sum.getJhyylc()!=null?sum.getJhyylc():0, c.getJhyylc())); | 288 | sum.setJhyylc(Arith.add(sum.getJhyylc()!=null?sum.getJhyylc():0, c.getJhyylc())); |
| 188 | sum.setJhfyylc(Arith.add(sum.getJhfyylc()!=null?sum.getJhfyylc():0, c.getJhfyylc())); | 289 | sum.setJhfyylc(Arith.add(sum.getJhfyylc()!=null?sum.getJhfyylc():0, c.getJhfyylc())); |
| 189 | sum.setSjyylc(Arith.add(sum.getSjyylc()!=null?sum.getSjyylc():0, c.getSjyylc())); | 290 | sum.setSjyylc(Arith.add(sum.getSjyylc()!=null?sum.getSjyylc():0, c.getSjyylc())); |
| 291 | + sum.setLjyylc(Arith.add(sum.getLjyylc()!=null?sum.getLjyylc():0, c.getLjyylc())); | ||
| 190 | sum.setSjfyylc(Arith.add(sum.getSjfyylc()!=null?sum.getSjfyylc():0, c.getSjfyylc())); | 292 | sum.setSjfyylc(Arith.add(sum.getSjfyylc()!=null?sum.getSjfyylc():0, c.getSjfyylc())); |
| 293 | + sum.setLjfyylc(Arith.add(sum.getLjfyylc()!=null?sum.getLjfyylc():0, c.getLjfyylc())); | ||
| 191 | sum.setLblc(Arith.add(sum.getLblc()!=null?sum.getLblc():0, c.getLblc())); | 294 | sum.setLblc(Arith.add(sum.getLblc()!=null?sum.getLblc():0, c.getLblc())); |
| 192 | sum.setLbbc(sum.getLbbc() + c.getLbbc()); | 295 | sum.setLbbc(sum.getLbbc() + c.getLbbc()); |
| 193 | sum.setLblcLz(Arith.add(sum.getLblcLz()!=null?sum.getLblcLz():0, c.getLblcLz())); | 296 | sum.setLblcLz(Arith.add(sum.getLblcLz()!=null?sum.getLblcLz():0, c.getLblcLz())); |
| @@ -214,7 +317,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -214,7 +317,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 214 | sum.setFzbc(sum.getFzbc() + c.getFzbc()); | 317 | sum.setFzbc(sum.getFzbc() + c.getFzbc()); |
| 215 | sum.setFzbczgf(sum.getFzbczgf() + c.getFzbczgf()); | 318 | sum.setFzbczgf(sum.getFzbczgf() + c.getFzbczgf()); |
| 216 | sum.setFzbcwgf(sum.getFzbcwgf() + c.getFzbcwgf()); | 319 | sum.setFzbcwgf(sum.getFzbcwgf() + c.getFzbcwgf()); |
| 217 | - sum.setDtbc(sum.getDtbc() + c.getFzbc()); | 320 | + sum.setDtbc(sum.getDtbc() + c.getDtbc()); |
| 218 | sum.setDtbczgf(sum.getDtbczgf() + c.getDtbczgf()); | 321 | sum.setDtbczgf(sum.getDtbczgf() + c.getDtbczgf()); |
| 219 | sum.setDtbcwgf(sum.getDtbcwgf() + c.getDtbcwgf()); | 322 | sum.setDtbcwgf(sum.getDtbcwgf() + c.getDtbcwgf()); |
| 220 | } | 323 | } |
| @@ -228,9 +331,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -228,9 +331,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 228 | m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc())); | 331 | m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc())); |
| 229 | m.put("jhlc", c.getJhyylc()); | 332 | m.put("jhlc", c.getJhyylc()); |
| 230 | m.put("jcclc", c.getJhfyylc()); | 333 | m.put("jcclc", c.getJhfyylc()); |
| 231 | - m.put("sjzgl", Arith.add(c.getSjyylc(), c.getSjfyylc())); | ||
| 232 | - m.put("sjgl", c.getSjyylc()); | ||
| 233 | - m.put("sjksgl", c.getSjfyylc()); | 334 | + m.put("sjzgl", Arith.add(Arith.add(c.getSjyylc(), c.getLjyylc()), Arith.add(c.getSjfyylc(), c.getLjfyylc()))); |
| 335 | + m.put("sjgl", Arith.add(c.getSjyylc(), c.getLjyylc())); | ||
| 336 | + m.put("sjksgl", Arith.add(c.getSjfyylc(), c.getLjfyylc())); | ||
| 234 | m.put("ssgl", c.getLblc()); | 337 | m.put("ssgl", c.getLblc()); |
| 235 | m.put("ssbc", c.getLbbc()); | 338 | m.put("ssbc", c.getLbbc()); |
| 236 | m.put("ssgl_lz", c.getLblcLz()); | 339 | m.put("ssgl_lz", c.getLblcLz()); |
| @@ -260,14 +363,350 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | @@ -260,14 +363,350 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer | ||
| 260 | m.put("dtbc", c.getDtbc()); | 363 | m.put("dtbc", c.getDtbc()); |
| 261 | m.put("dtbc_m", c.getDtbczgf()); | 364 | m.put("dtbc_m", c.getDtbczgf()); |
| 262 | m.put("dtbc_a", c.getDtbcwgf()); | 365 | m.put("dtbc_a", c.getDtbcwgf()); |
| 263 | - m.put("djg", 0); | ||
| 264 | - m.put("djg_m", 0); | ||
| 265 | - m.put("djg_a", 0); | ||
| 266 | - m.put("djg_time", 0); | 366 | + if(keyMap_.containsKey(c.getXlName()) || c.getXlName().equals("合计")){ |
| 367 | + CalcInterval calc; | ||
| 368 | + if(c.getXlName().equals("合计")) | ||
| 369 | + calc = sum_; | ||
| 370 | + else | ||
| 371 | + calc = keyMap_.get(c.getXlName()).get(0); | ||
| 372 | + m.put("djg", calc.getDjg()); | ||
| 373 | + m.put("djg_m", calc.getDjgM()); | ||
| 374 | + m.put("djg_a", calc.getDjgA()); | ||
| 375 | + m.put("djg_time", calc.getDjgTime()); | ||
| 376 | + } else { | ||
| 377 | + m.put("djg", 0); | ||
| 378 | + m.put("djg_m", 0); | ||
| 379 | + m.put("djg_a", 0); | ||
| 380 | + m.put("djg_time", 0); | ||
| 381 | + } | ||
| 267 | resList.add(m); | 382 | resList.add(m); |
| 268 | } | 383 | } |
| 269 | 384 | ||
| 270 | return resList; | 385 | return resList; |
| 271 | } | 386 | } |
| 272 | 387 | ||
| 388 | + /** | ||
| 389 | + * @param rq 格式如:2018-03-22(留空""默认当前日期前一天) | ||
| 390 | + * @param line (留空""默认全部线路) | ||
| 391 | + */ | ||
| 392 | + @Transactional | ||
| 393 | + @Override | ||
| 394 | + public String calcDaily(String rq, String line) throws Exception{ | ||
| 395 | + String result = ""; | ||
| 396 | + try { | ||
| 397 | + if(rq == null || rq.trim().length() == 0){ | ||
| 398 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | ||
| 399 | + Date dNow = new Date(); //当前时间 | ||
| 400 | + Date dBefore = new Date(); | ||
| 401 | + Calendar calendar = Calendar.getInstance(); //得到日历 | ||
| 402 | + calendar.setTime(dNow);//把当前时间赋给日历 | ||
| 403 | + calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天 | ||
| 404 | + dBefore = calendar.getTime(); //得到前一天的时间 | ||
| 405 | + rq = sdf.format(dBefore); | ||
| 406 | + } else { | ||
| 407 | + rq = rq.trim(); | ||
| 408 | + } | ||
| 409 | + if(line == null || line.trim().length() == 0){ | ||
| 410 | + line = ""; | ||
| 411 | + } else { | ||
| 412 | + line = line.trim(); | ||
| 413 | + } | ||
| 414 | + | ||
| 415 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | ||
| 416 | + List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); | ||
| 417 | + List<ScheduleRealInfo> lists = new ArrayList<ScheduleRealInfo>(); | ||
| 418 | + | ||
| 419 | + String xlSql="select gs_bm, fgs_bm from bsth_c_s_sp_info_real where schedule_date_str = '"+rq+"'"; | ||
| 420 | + if(line.trim().length() > 0) | ||
| 421 | + xlSql += " and xl_bm = '"+line+"'"; | ||
| 422 | + xlSql += " group by gs_bm, fgs_bm"; | ||
| 423 | + List<Map<String, String>> gsList=jdbcTemplate.query(xlSql, new RowMapper<Map<String, String>>() { | ||
| 424 | + @Override | ||
| 425 | + public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException { | ||
| 426 | + Map<String, String> m = new HashMap<String, String>(); | ||
| 427 | + m.put("gsdm", arg0.getString("gs_bm")); | ||
| 428 | + m.put("fgsdm", arg0.getString("fgs_bm")); | ||
| 429 | + return m; | ||
| 430 | + }}); | ||
| 431 | + | ||
| 432 | + //查询所有线路 | ||
| 433 | + for(Map<String, String> m : gsList){ | ||
| 434 | + list.addAll(scheduleRealInfoRepository.scheduleByDateAndLineTj(line, rq, rq, m.get("gsdm"), m.get("fgsdm"))); | ||
| 435 | + } | ||
| 436 | + | ||
| 437 | + for (int i = 0; i < list.size(); i++) { | ||
| 438 | + ScheduleRealInfo s=list.get(i); | ||
| 439 | + Set<ChildTaskPlan> cts = s.getcTasks(); | ||
| 440 | + if(cts != null && cts.size() > 0){ | ||
| 441 | + list_s.add(s); | ||
| 442 | + }else{ | ||
| 443 | + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){ | ||
| 444 | + list_s.add(s); | ||
| 445 | + } | ||
| 446 | + } | ||
| 447 | + } | ||
| 448 | + List<CalcStatistics> lMap = new ArrayList<CalcStatistics>(); | ||
| 449 | + for (int i = 0; i < list.size(); i++) { | ||
| 450 | + if(i<list.size()-1){ | ||
| 451 | + if(list.get(i+1).getXlBm().equals(list.get(i).getXlBm())){ | ||
| 452 | + lists.add(list.get(i)); | ||
| 453 | + }else{ | ||
| 454 | + lists.add(list.get(i)); | ||
| 455 | + CalcStatistics s=staticTj(lists); | ||
| 456 | + lMap.add(s); | ||
| 457 | + lists=new ArrayList<ScheduleRealInfo>(); | ||
| 458 | + } | ||
| 459 | + }else{ | ||
| 460 | + if(list.get(i).getXlBm().equals(list.get(i-1).getXlBm())){ | ||
| 461 | + lists.add(list.get(i)); | ||
| 462 | + CalcStatistics s=staticTj(lists); | ||
| 463 | + lMap.add(s); | ||
| 464 | + }else{ | ||
| 465 | + lists=new ArrayList<ScheduleRealInfo>(); | ||
| 466 | + lists.add(list.get(i)); | ||
| 467 | + CalcStatistics s=staticTj(lists); | ||
| 468 | + lMap.add(s); | ||
| 469 | + } | ||
| 470 | + } | ||
| 471 | + } | ||
| 472 | +// Collections.sort(lMap,new AccountXlbm()); | ||
| 473 | + | ||
| 474 | + if(line.trim().length() > 0){ | ||
| 475 | + calcStatisticsRepository.deleteByDateAndLine(rq, line); | ||
| 476 | + } else { | ||
| 477 | + calcStatisticsRepository.deleteByDate(rq); | ||
| 478 | + } | ||
| 479 | + calcStatisticsRepository.save(lMap); | ||
| 480 | + result = "success"; | ||
| 481 | + } catch (Exception e) { | ||
| 482 | + // TODO: handle exception | ||
| 483 | + throw e; | ||
| 484 | + }finally{ | ||
| 485 | + logger.info("result:"+result); | ||
| 486 | + } | ||
| 487 | + return result; | ||
| 488 | + } | ||
| 489 | + | ||
| 490 | + public final CalcStatistics staticTj(List<ScheduleRealInfo> list){ | ||
| 491 | + | ||
| 492 | + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>(); | ||
| 493 | + for(int i=0;i<list.size();i++){ | ||
| 494 | + ScheduleRealInfo s=list.get(i); | ||
| 495 | + Set<ChildTaskPlan> cts = s.getcTasks(); | ||
| 496 | + if(cts != null && cts.size() > 0){ | ||
| 497 | + lists.add(s); | ||
| 498 | + }else{ | ||
| 499 | + if(s.getZdsjActual()!=null&& s.getFcsjActual()!=null){ | ||
| 500 | + lists.add(s); | ||
| 501 | + } | ||
| 502 | + } | ||
| 503 | + } | ||
| 504 | +// Map<String, Object> map = new HashMap<String, Object>(); | ||
| 505 | + CalcStatistics s = new CalcStatistics(); | ||
| 506 | + if(list.size() > 0){ | ||
| 507 | + ScheduleRealInfo sche = list.get(0); | ||
| 508 | + s.setXl(sche.getXlBm()); | ||
| 509 | + s.setXlName(sche.getXlName()); | ||
| 510 | + s.setDate(sche.getScheduleDate()); | ||
| 511 | + s.setDateStr(sche.getScheduleDateStr()); | ||
| 512 | + s.setGsdm(sche.getGsBm()); | ||
| 513 | + s.setFgsdm(sche.getFgsBm()); | ||
| 514 | + | ||
| 515 | + double jhyygl=culateService.culateJhgl(list);//计划营运公里 | ||
| 516 | + double jhjcclc= culateService.culateJhJccgl(list);//计划进出场公里(计划空驶公里) | ||
| 517 | + s.setJhyylc(jhyygl); | ||
| 518 | + s.setJhkslc(jhjcclc); | ||
| 519 | + s.setJhzlc(Arith.add(jhyygl, jhjcclc)); | ||
| 520 | + | ||
| 521 | + double ljgl= culateService.culateLjgl(lists); | ||
| 522 | + double sjyygl= culateService.culateSjgl(lists); | ||
| 523 | + double zyygl= Arith.add(sjyygl,ljgl); | ||
| 524 | + | ||
| 525 | + double sjjccgl=culateService.culateJccgl(lists); | ||
| 526 | + double sjksgl=culateService.culateKsgl(lists); | ||
| 527 | + double zksgl=Arith.add(sjjccgl, sjksgl); | ||
| 528 | + s.setSjyylc(zyygl); | ||
| 529 | + s.setSjkslc(zksgl); | ||
| 530 | + s.setSjzlc(Arith.add(zyygl, zksgl)); | ||
| 531 | + | ||
| 532 | + s.setSslc(culateService.culateLbgl(list)); | ||
| 533 | + s.setSsbc(culateService.culateLbbc(list)); | ||
| 534 | + | ||
| 535 | + //计划+临加-少驶=实驶 | ||
| 536 | +// double jl=Arith.sub(Arith.add(jhyygl, ljgl),ssgl); | ||
| 537 | +// if(jl==zyygl){ | ||
| 538 | +// map.put("zt", 0); | ||
| 539 | +// }else{ | ||
| 540 | +// map.put("zt", 1); | ||
| 541 | +// } | ||
| 542 | + | ||
| 543 | + s.setLzlc(culateService.culateCJLC(list, "路阻")); | ||
| 544 | + s.setDmlc(culateService.culateCJLC(list, "吊慢")); | ||
| 545 | + s.setGzlc(culateService.culateCJLC(list, "故障")); | ||
| 546 | + s.setJflc(culateService.culateCJLC(list, "纠纷")); | ||
| 547 | + s.setZslc(culateService.culateCJLC(list, "肇事")); | ||
| 548 | + s.setQrlc(culateService.culateCJLC(list, "缺人")); | ||
| 549 | + s.setQclc(culateService.culateCJLC(list, "缺车")); | ||
| 550 | + s.setKxlc(culateService.culateCJLC(list, "客稀")); | ||
| 551 | + s.setQhlc(culateService.culateCJLC(list, "气候")); | ||
| 552 | + s.setYwlc(culateService.culateCJLC(list, "援外")); | ||
| 553 | + double ssgl_pc=culateService.culateCJLC(list, "配车"); | ||
| 554 | + double ssgl_by=culateService.culateCJLC(list, "保养"); | ||
| 555 | + double ssgl_cj=culateService.culateCJLC(list, "抽减"); | ||
| 556 | + double ssgl_qt=culateService.culateCJLC(list, "其他"); | ||
| 557 | + s.setQtlc(Arith.add(Arith.add(ssgl_pc, ssgl_by),Arith.add(ssgl_cj, ssgl_qt))); | ||
| 558 | + s.setLjlc(ljgl); | ||
| 559 | + | ||
| 560 | + s.setJhbcq(culateService.culateJhbc(list,"")); | ||
| 561 | + s.setJhbcz(culateService.culateJhbc(list, "zgf")); | ||
| 562 | + s.setJhbcw(culateService.culateJhbc(list, "wgf")); | ||
| 563 | + s.setSjbcq(culateService.culateSjbc(lists,"")); | ||
| 564 | + s.setSjbcz(culateService.culateSjbc(lists,"zgf")); | ||
| 565 | + s.setSjbcw(culateService.culateSjbc(lists,"wgf")); | ||
| 566 | + s.setLjbcq(culateService.culateLjbc(lists,"")); | ||
| 567 | + s.setLjbcz(culateService.culateLjbc(lists,"zgf")); | ||
| 568 | + s.setLjbcw(culateService.culateLjbc(lists,"wgf")); | ||
| 569 | + s.setFzbcq(culateService.culateFzbc(lists, "")); | ||
| 570 | + s.setFzbcz(culateService.culateFzbc(lists, "zgf")); | ||
| 571 | + s.setFzbcw(culateService.culateFzbc(lists, "wgf")); | ||
| 572 | + s.setDtbcq(0); | ||
| 573 | + s.setDtbcz(0); | ||
| 574 | + s.setDtbcw(0); | ||
| 575 | + Map<String, Object> m_=culateService.culateDjg(lists, list.get(0).getXlBm()); | ||
| 576 | + if(m_.containsKey("djgcsq") && m_.get("djgcsq")!=null) | ||
| 577 | + s.setDjgq(Integer.valueOf(m_.get("djgcsq").toString())); | ||
| 578 | + else | ||
| 579 | + s.setDjgq(0); | ||
| 580 | + if(m_.containsKey("djgcsz") && m_.get("djgcsz")!=null) | ||
| 581 | + s.setDjgz(Integer.valueOf(m_.get("djgcsz").toString())); | ||
| 582 | + else | ||
| 583 | + s.setDjgz(0); | ||
| 584 | + if(m_.containsKey("djgcsw") && m_.get("djgcsw")!=null) | ||
| 585 | + s.setDjgw(Integer.valueOf(m_.get("djgcsw").toString())); | ||
| 586 | + else | ||
| 587 | + s.setDjgw(0); | ||
| 588 | + if(m_.containsKey("djgsj") && m_.get("djgsj")!=null) | ||
| 589 | + s.setDjgsj(Integer.valueOf(m_.get("djgsj").toString())); | ||
| 590 | + else | ||
| 591 | + s.setDjgsj(0); | ||
| 592 | + } | ||
| 593 | + return s; | ||
| 594 | + } | ||
| 595 | + | ||
| 596 | + class AccountXlbm implements Comparator<Map<String, Object>>{ | ||
| 597 | + @Override | ||
| 598 | + public int compare(Map<String, Object> o1, Map<String, Object> o2) { | ||
| 599 | + // TODO Auto-generated method stub | ||
| 600 | +// PinyinHelper.convertToPinyinString(ppy.getName(), | ||
| 601 | +// "" , PinyinFormat.WITHOUT_TONE) | ||
| 602 | + return o1.get("xlNamePy").toString().compareTo( | ||
| 603 | + o2.get("xlNamePy").toString()); | ||
| 604 | + } | ||
| 605 | + } | ||
| 606 | + | ||
| 607 | + class AccountXlbmStr implements Comparator<String>{ | ||
| 608 | + @Override | ||
| 609 | + public int compare(String o1, String o2) { | ||
| 610 | + // TODO Auto-generated method stub | ||
| 611 | + return o1.compareTo(o2); | ||
| 612 | + } | ||
| 613 | + } | ||
| 614 | + | ||
| 615 | + @Override | ||
| 616 | + public List<CalcStatistics> calcStatisticsDaily(String gsdm, String fgsdm, | ||
| 617 | + String line, String date, String date2, String xlName, String type) { | ||
| 618 | + // TODO Auto-generated method stub | ||
| 619 | + List<CalcStatistics> list = new ArrayList<CalcStatistics>(); | ||
| 620 | + if(line.length() > 0){ | ||
| 621 | + list = calcStatisticsRepository.selectByDateAndLineTj2(line, date, date2); | ||
| 622 | + } else { | ||
| 623 | + list = calcStatisticsRepository.selectByDateAndLineTj(line, date, date2, gsdm, fgsdm); | ||
| 624 | + } | ||
| 625 | + | ||
| 626 | + List<CalcStatistics> resList = new ArrayList<CalcStatistics>(); | ||
| 627 | + Map<String, List<CalcStatistics>> keyMap = new HashMap<String, List<CalcStatistics>>(); | ||
| 628 | + List<String> keyList = new ArrayList<String>(); | ||
| 629 | + | ||
| 630 | + for(CalcStatistics s : list){ | ||
| 631 | + try { | ||
| 632 | + String key = PinyinHelper.convertToPinyinString(s.getXlName(), "" , PinyinFormat.WITHOUT_TONE); | ||
| 633 | + if(!keyMap.containsKey(key)){ | ||
| 634 | + keyMap.put(key, new ArrayList<CalcStatistics>()); | ||
| 635 | + keyList.add(key); | ||
| 636 | + } | ||
| 637 | + keyMap.get(key).add(s); | ||
| 638 | + } catch (PinyinException e) { | ||
| 639 | + // TODO Auto-generated catch block | ||
| 640 | + e.printStackTrace(); | ||
| 641 | + } | ||
| 642 | + } | ||
| 643 | + Collections.sort(keyList, new AccountXlbmStr()); | ||
| 644 | + | ||
| 645 | + for(String key : keyList){ | ||
| 646 | + if(keyMap.get(key).size() > 0){ | ||
| 647 | + CalcStatistics s = keyMap.get(key).get(0); | ||
| 648 | + if(keyMap.get(key).size() > 1) | ||
| 649 | + for(int i = 1; i < keyMap.get(key).size(); i++){ | ||
| 650 | + CalcStatistics s_ = keyMap.get(key).get(i); | ||
| 651 | + s = addStatistics(s, s_); | ||
| 652 | + } | ||
| 653 | + resList.add(s); | ||
| 654 | + } | ||
| 655 | + } | ||
| 656 | + | ||
| 657 | + if(resList.size() > 0){ | ||
| 658 | + CalcStatistics temp = new CalcStatistics(); | ||
| 659 | + temp.setXlName("合计"); | ||
| 660 | + for(CalcStatistics s : resList){ | ||
| 661 | + temp = addStatistics(temp, s); | ||
| 662 | + } | ||
| 663 | + resList.add(temp); | ||
| 664 | + } | ||
| 665 | + | ||
| 666 | + return resList; | ||
| 667 | + } | ||
| 668 | + | ||
| 669 | + public CalcStatistics addStatistics(CalcStatistics s, CalcStatistics s_){ | ||
| 670 | + s.setJhzlc(Arith.add(s.getJhzlc()!=null?s.getJhzlc():0, s_.getJhzlc())); | ||
| 671 | + s.setJhyylc(Arith.add(s.getJhyylc()!=null?s.getJhyylc():0, s_.getJhyylc())); | ||
| 672 | + s.setJhkslc(Arith.add(s.getJhkslc()!=null?s.getJhkslc():0, s_.getJhkslc())); | ||
| 673 | + s.setSjzlc(Arith.add(s.getSjzlc()!=null?s.getSjzlc():0, s_.getSjzlc())); | ||
| 674 | + s.setSjyylc(Arith.add(s.getSjyylc()!=null?s.getSjyylc():0, s_.getSjyylc())); | ||
| 675 | + s.setSjkslc(Arith.add(s.getSjkslc()!=null?s.getSjkslc():0, s_.getSjkslc())); | ||
| 676 | + s.setSslc(Arith.add(s.getSslc()!=null?s.getSslc():0, s_.getSslc())); | ||
| 677 | + s.setSsbc(s.getSsbc() + s_.getSsbc()); | ||
| 678 | + s.setLzlc(Arith.add(s.getLzlc()!=null?s.getLzlc():0, s_.getLzlc())); | ||
| 679 | + s.setDmlc(Arith.add(s.getDmlc()!=null?s.getDmlc():0, s_.getDmlc())); | ||
| 680 | + s.setGzlc(Arith.add(s.getGzlc()!=null?s.getGzlc():0, s_.getGzlc())); | ||
| 681 | + s.setJflc(Arith.add(s.getJflc()!=null?s.getJflc():0, s_.getJflc())); | ||
| 682 | + s.setZslc(Arith.add(s.getZslc()!=null?s.getZslc():0, s_.getZslc())); | ||
| 683 | + s.setQrlc(Arith.add(s.getQrlc()!=null?s.getQrlc():0, s_.getQrlc())); | ||
| 684 | + s.setQclc(Arith.add(s.getQclc()!=null?s.getQclc():0, s_.getQclc())); | ||
| 685 | + s.setKxlc(Arith.add(s.getKxlc()!=null?s.getKxlc():0, s_.getKxlc())); | ||
| 686 | + s.setQhlc(Arith.add(s.getQhlc()!=null?s.getQhlc():0, s_.getQhlc())); | ||
| 687 | + s.setYwlc(Arith.add(s.getYwlc()!=null?s.getYwlc():0, s_.getYwlc())); | ||
| 688 | + s.setQtlc(Arith.add(s.getQtlc()!=null?s.getQtlc():0, s_.getQtlc())); | ||
| 689 | + s.setLjlc(Arith.add(s.getLjlc()!=null?s.getLjlc():0, s_.getLjlc())); | ||
| 690 | + s.setJhbcq(s.getJhbcq() + s_.getJhbcq()); | ||
| 691 | + s.setJhbcz(s.getJhbcz() + s_.getJhbcz()); | ||
| 692 | + s.setJhbcw(s.getJhbcw() + s_.getJhbcw()); | ||
| 693 | + s.setSjbcq(s.getSjbcq() + s_.getSjbcq()); | ||
| 694 | + s.setSjbcz(s.getSjbcz() + s_.getSjbcz()); | ||
| 695 | + s.setSjbcw(s.getSjbcw() + s_.getSjbcw()); | ||
| 696 | + s.setLjbcq(s.getLjbcq() + s_.getLjbcq()); | ||
| 697 | + s.setLjbcz(s.getLjbcz() + s_.getLjbcz()); | ||
| 698 | + s.setLjbcw(s.getLjbcw() + s_.getLjbcw()); | ||
| 699 | + s.setFzbcq(s.getFzbcq() + s_.getFzbcq()); | ||
| 700 | + s.setFzbcz(s.getFzbcz() + s_.getFzbcz()); | ||
| 701 | + s.setFzbcw(s.getFzbcw() + s_.getFzbcw()); | ||
| 702 | + s.setDtbcq(s.getDtbcq() + s_.getDtbcq()); | ||
| 703 | + s.setDtbcz(s.getDtbcz() + s_.getDtbcz()); | ||
| 704 | + s.setDtbcw(s.getDtbcw() + s_.getDtbcw()); | ||
| 705 | + s.setDjgq(s.getDjgq() + s_.getDjgq()); | ||
| 706 | + s.setDjgz(s.getDjgz() + s_.getDjgz()); | ||
| 707 | + s.setDjgw(s.getDjgw() + s_.getDjgw()); | ||
| 708 | + s.setDjgsj(s.getDjgsj()>s_.getDjgsj()?s.getDjgsj():s_.getDjgsj()); | ||
| 709 | + return s; | ||
| 710 | + } | ||
| 711 | + | ||
| 273 | } | 712 | } |
src/main/resources/static/pages/forms/statement/statisticsDailyCalc.html
0 → 100644
| 1 | +<style type="text/css"> | ||
| 2 | + .table-bordered { | ||
| 3 | + border: 1px solid; } | ||
| 4 | + .table-bordered > thead > tr > th, | ||
| 5 | + .table-bordered > thead > tr > td, | ||
| 6 | + .table-bordered > tbody > tr > th, | ||
| 7 | + .table-bordered > tbody > tr > td, | ||
| 8 | + .table-bordered > tfoot > tr > th, | ||
| 9 | + .table-bordered > tfoot > tr > td { | ||
| 10 | + border: 1px solid; } | ||
| 11 | + .table-bordered > thead > tr > th, | ||
| 12 | + .table-bordered > thead > tr > td { | ||
| 13 | + border-bottom-width: 2px; } | ||
| 14 | + | ||
| 15 | + .table > tbody + tbody { | ||
| 16 | + border-top: 1px solid; } | ||
| 17 | + | ||
| 18 | + #forms > thead > tr> td >span{ | ||
| 19 | + width: 5px; | ||
| 20 | + word-wrap: break-word; | ||
| 21 | + letter-spacing: 20px; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + #forms > thead > tr> td >label{ | ||
| 25 | + word-break: keep-all;white-space:nowrap; | ||
| 26 | + } | ||
| 27 | +</style> | ||
| 28 | + | ||
| 29 | +<div class="page-head"> | ||
| 30 | + <div class="page-title"> | ||
| 31 | + <h1>统计日报</h1> | ||
| 32 | + </div> | ||
| 33 | +</div> | ||
| 34 | + | ||
| 35 | +<!-- <div class="row"> --> | ||
| 36 | + <div class="col-md-12 portlet light porttlet-fit bordered" style="height:calc(100% - 56px)"> | ||
| 37 | +<!-- <div> --> | ||
| 38 | + <div class="portlet-title"> | ||
| 39 | + <form class="form-inline" action=""> | ||
| 40 | + <div style="display: inline-block; " id="gsdmDiv"> | ||
| 41 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 42 | + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select> | ||
| 43 | + </div> | ||
| 44 | + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv"> | ||
| 45 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 46 | + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select> | ||
| 47 | + </div> | ||
| 48 | + <div style="margin-top: 2px"></div> | ||
| 49 | + <div style="display: inline-block;"> | ||
| 50 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 51 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 52 | + </div> | ||
| 53 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 54 | + <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 55 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 56 | + </div> | ||
| 57 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 58 | + <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 59 | + <input class="form-control" type="text" id="date2" style="width: 180px;"/> | ||
| 60 | + </div> | ||
| 61 | + <div class="form-group"> | ||
| 62 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | ||
| 63 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 64 | + </div> | ||
| 65 | + </form> | ||
| 66 | + </div> | ||
| 67 | + <div class="portlet-body" id="tjrbBody" style="overflow:auto;height: calc(100% - 80px)"> | ||
| 68 | + <div class="table-container" style="margin-top: 10px;min-width: 906px"> | ||
| 69 | + <label>早高峰:6:31~8:30 晚高峰:16:01~18:00</label> | ||
| 70 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 71 | + <thead> | ||
| 72 | + <tr> | ||
| 73 | + <th colspan="44"><label id="tjrq"></label> 线路统计日报</th> | ||
| 74 | + </tr> | ||
| 75 | + <tr> | ||
| 76 | + <td rowspan="3"><span >路线名</span></td> | ||
| 77 | + <td colspan="20">全日营运里程(公里)</td> | ||
| 78 | + <td colspan="15">全日营运班次</td> | ||
| 79 | + <td colspan="9">大间隔情况</td> | ||
| 80 | + </tr> | ||
| 81 | + <tr> | ||
| 82 | + <td rowspan="2"><label>计划总</label> | ||
| 83 | + <label>公里 </label></td> | ||
| 84 | + <td rowspan="2"><label>计划营</label><label>运公里</label></td> | ||
| 85 | + <td rowspan="2"><label>计划空</label><label>驶公里</label></td> | ||
| 86 | + <td rowspan="2"><label>实际</label><label>总公里</label></td> | ||
| 87 | + <td rowspan="2"><label>实际营</label><label>运公里</label></td> | ||
| 88 | + <td rowspan="2"><label>实际空</label><label>驶公里</label></td> | ||
| 89 | + <td rowspan="2"><span>少驶公里</span></td> | ||
| 90 | + <td rowspan="2"><span>少驶班次</span></td> | ||
| 91 | + <td colspan="11">少驶原因(公里)</td> | ||
| 92 | + <td rowspan="2"><span >临加公里</span></td> | ||
| 93 | + <td colspan="3">计划班次</td> | ||
| 94 | + <td colspan="3">实际班次</td> | ||
| 95 | + <td colspan="3">临加班次</td> | ||
| 96 | + <td colspan="3">放站班次</td> | ||
| 97 | + <td colspan="3">调头班次</td> | ||
| 98 | + <td colspan="3">发生次数</td> | ||
| 99 | + <td rowspan="2">最大间隔时间(分)</td> | ||
| 100 | + <td rowspan="2">原因</td> | ||
| 101 | + </tr> | ||
| 102 | + <tr> | ||
| 103 | + <td><span >路阻</span></td> | ||
| 104 | + <td><span>吊慢</span></td> | ||
| 105 | + <td><span >故障</span></td> | ||
| 106 | + <td><span >纠纷</span></td> | ||
| 107 | + <td><span >肇事</span></td> | ||
| 108 | + <td><span>缺人</span></td> | ||
| 109 | + <td><span>缺车</span></td> | ||
| 110 | + <td><span >客稀</span></td> | ||
| 111 | + <td><span>气候</span></td> | ||
| 112 | + <td><span>援外</span></td> | ||
| 113 | + <td><span>其他</span></td> | ||
| 114 | + <td><span>全日</span></td> | ||
| 115 | + <td><span>早高峰</span></td> | ||
| 116 | + <td><span>晚高峰</span></td> | ||
| 117 | + <td><span>全日</span></td> | ||
| 118 | + <td><span>早高峰</span></td> | ||
| 119 | + <td><span>晚高峰</span></td> | ||
| 120 | + <td><span>全日</span></td> | ||
| 121 | + <td><span>早高峰</span></td> | ||
| 122 | + <td><span>晚高峰</span></td> | ||
| 123 | + <td><span>全日</span></td> | ||
| 124 | + <td><span>早高峰</span></td> | ||
| 125 | + <td><span>晚高峰</span></td> | ||
| 126 | + <td><span>全日</span></td> | ||
| 127 | + <td><span>早高峰</span></td> | ||
| 128 | + <td><span>晚高峰</span></td> | ||
| 129 | + <td><span>全日</span></td> | ||
| 130 | + <td><span>早高峰</span></td> | ||
| 131 | + <td><span>晚高峰</span></td> | ||
| 132 | + </tr> | ||
| 133 | + </thead> | ||
| 134 | + <tbody class="statisticsDailyCalc"> | ||
| 135 | + | ||
| 136 | + </tbody> | ||
| 137 | + </table> | ||
| 138 | + </div> | ||
| 139 | + </div> | ||
| 140 | + </div> | ||
| 141 | + </div> | ||
| 142 | +</div> | ||
| 143 | + | ||
| 144 | +<script> | ||
| 145 | + $(function(){ | ||
| 146 | + $('#export').attr('disabled', "true"); | ||
| 147 | + | ||
| 148 | + // 关闭左侧栏 | ||
| 149 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 150 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 151 | + | ||
| 152 | + var d = new Date(); | ||
| 153 | + d.setTime(d.getTime() - 1*1000*60*60*24); | ||
| 154 | + var year = d.getFullYear(); | ||
| 155 | + var month = d.getMonth() + 1; | ||
| 156 | + var day = d.getDate(); | ||
| 157 | + if(month < 10) | ||
| 158 | + month = "0" + month; | ||
| 159 | + if(day < 10) | ||
| 160 | + day = "0" + day; | ||
| 161 | + var dateTime = year + "-" + month + "-" + day; | ||
| 162 | + $("#date").datetimepicker({ | ||
| 163 | + format : 'YYYY-MM-DD', | ||
| 164 | + locale : 'zh-cn', | ||
| 165 | + maxDate : dateTime | ||
| 166 | + }); | ||
| 167 | + $("#date2").datetimepicker({ | ||
| 168 | + format : 'YYYY-MM-DD', | ||
| 169 | + locale : 'zh-cn', | ||
| 170 | + maxDate : dateTime | ||
| 171 | + }); | ||
| 172 | + $("#date").val(dateTime); | ||
| 173 | + $("#date2").val(dateTime); | ||
| 174 | + | ||
| 175 | + | ||
| 176 | + var fage=false; | ||
| 177 | + var obj = []; | ||
| 178 | + var xlList; | ||
| 179 | + $.get('/report/lineList',function(result){ | ||
| 180 | + xlList=result; | ||
| 181 | + $.get('/user/companyData', function(result){ | ||
| 182 | + obj = result; | ||
| 183 | + var options = ''; | ||
| 184 | + for(var i = 0; i < obj.length; i++){ | ||
| 185 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + if(obj.length ==0){ | ||
| 189 | + $("#gsdmDiv").css('display','none'); | ||
| 190 | + }else if(obj.length ==1){ | ||
| 191 | + $("#gsdmDiv").css('display','none'); | ||
| 192 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 193 | + $('#fgsdmDiv').css('display','none'); | ||
| 194 | + } | ||
| 195 | + $('#gsdm').html(options); | ||
| 196 | + updateCompany(); | ||
| 197 | + }); | ||
| 198 | + }) | ||
| 199 | + $("#gsdm").on("change",updateCompany); | ||
| 200 | + function updateCompany(){ | ||
| 201 | + var company = $('#gsdm').val(); | ||
| 202 | + var options = ''; | ||
| 203 | + for(var i = 0; i < obj.length; i++){ | ||
| 204 | + if(obj[i].companyCode == company){ | ||
| 205 | + var children = obj[i].children; | ||
| 206 | + for(var j = 0; j < children.length; j++){ | ||
| 207 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 208 | + } | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + $('#fgsdm').html(options); | ||
| 212 | +// initXl(); | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + var tempData = {}; | ||
| 216 | + $.get('/report/lineList',function(xlList){ | ||
| 217 | + var data = []; | ||
| 218 | + data.push({id: " ", text: "全部线路"}); | ||
| 219 | + $.get('/user/companyData', function(result){ | ||
| 220 | + for(var i = 0; i < result.length; i++){ | ||
| 221 | + var companyCode = result[i].companyCode; | ||
| 222 | + var children = result[i].children; | ||
| 223 | + for(var j = 0; j < children.length; j++){ | ||
| 224 | + var code = children[j].code; | ||
| 225 | + for(var k=0;k < xlList.length;k++ ){ | ||
| 226 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | ||
| 227 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 228 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | ||
| 229 | + } | ||
| 230 | + } | ||
| 231 | + } | ||
| 232 | + } | ||
| 233 | + initPinYinSelect2('#line',data,''); | ||
| 234 | + | ||
| 235 | + }); | ||
| 236 | + }); | ||
| 237 | + | ||
| 238 | + $("#line").on("change", function(){ | ||
| 239 | + if($("#line").val() == " "){ | ||
| 240 | + $("#gsdm").attr("disabled", false); | ||
| 241 | + $("#fgsdm").attr("disabled", false); | ||
| 242 | + } else { | ||
| 243 | + var temp = tempData[$("#line").val()].split(":"); | ||
| 244 | + $("#gsdm").val(temp[0]); | ||
| 245 | + updateCompany(); | ||
| 246 | + $("#fgsdm").val(temp[1]); | ||
| 247 | + $("#gsdm").attr("disabled", true); | ||
| 248 | + $("#fgsdm").attr("disabled", true); | ||
| 249 | + } | ||
| 250 | + }); | ||
| 251 | + | ||
| 252 | + | ||
| 253 | + var line =""; | ||
| 254 | + var xlName =""; | ||
| 255 | + var date = ""; | ||
| 256 | + var date2 =""; | ||
| 257 | + var gsdm=""; | ||
| 258 | + var fgsdm=""; | ||
| 259 | + $("#query").on("click",function(){ | ||
| 260 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 261 | + layer.msg("请选择时间范围!"); | ||
| 262 | + return; | ||
| 263 | + } | ||
| 264 | + if($("#date2").val() == null || $("#date2").val().trim().length == 0){ | ||
| 265 | + layer.msg("请选择时间范围!"); | ||
| 266 | + return; | ||
| 267 | + } | ||
| 268 | +// $("#tjrbBody").height($(window).height()-100); | ||
| 269 | + line = $("#line").val(); | ||
| 270 | + xlName = $("#select2-line-container").html(); | ||
| 271 | + date = $("#date").val(); | ||
| 272 | + date2 =$("#date2").val(); | ||
| 273 | + gsdm =$("#gsdm").val(); | ||
| 274 | + fgsdm=$("#fgsdm").val(); | ||
| 275 | + if(line=="请选择"){ | ||
| 276 | + line=""; | ||
| 277 | + } | ||
| 278 | + if(date==null || date =="" ||date2==null || date2 ==""){ | ||
| 279 | + layer.msg('请选择时间段.'); | ||
| 280 | + }else{ | ||
| 281 | + $("#tjrq").html(date+"至"+date2); | ||
| 282 | + var params = {}; | ||
| 283 | + params['gsdm'] = gsdm; | ||
| 284 | + params['fgsdm'] =fgsdm ; | ||
| 285 | + params['line'] = line; | ||
| 286 | + params['date'] = date; | ||
| 287 | + params['date2'] = date2; | ||
| 288 | + params['xlName'] = xlName; | ||
| 289 | + params['type'] = "query"; | ||
| 290 | + var i = layer.load(2); | ||
| 291 | +// $get('/realSchedule/statisticsDailyTj',params,function(result){ | ||
| 292 | + $get('/calcWaybill/statisticsDailyTj',params,function(result){ | ||
| 293 | + // 把数据填充到模版中 | ||
| 294 | + var tbodyHtml = template('statisticsDailyCalc',{list:result}); | ||
| 295 | + // 把渲染好的模版html文本追加到表格中 | ||
| 296 | + $('#forms .statisticsDailyCalc').html(tbodyHtml); | ||
| 297 | + layer.close(i); | ||
| 298 | + | ||
| 299 | + if(result.length == 0) | ||
| 300 | + $("#export").attr('disabled',"true"); | ||
| 301 | + else | ||
| 302 | + $("#export").removeAttr("disabled"); | ||
| 303 | + }); | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + }); | ||
| 307 | +// $("#tjrbBody").height($(window).height()-100); | ||
| 308 | + $("#export").on("click",function(){ | ||
| 309 | + var params = {}; | ||
| 310 | + params['gsdm'] = gsdm; | ||
| 311 | + params['fgsdm'] =fgsdm ; | ||
| 312 | + params['line'] = line; | ||
| 313 | + params['date'] = date; | ||
| 314 | + params['date2'] = date2; | ||
| 315 | + params['xlName'] = xlName; | ||
| 316 | + params['type'] = "export"; | ||
| 317 | + $get('/realSchedule/statisticsDailyTj',params,function(result){ | ||
| 318 | + window.open("/downloadFile/download?fileName=统计日报"+moment(date).format("YYYYMMDD")); | ||
| 319 | + }); | ||
| 320 | + }); | ||
| 321 | + | ||
| 322 | + }); | ||
| 323 | +</script> | ||
| 324 | +<script type="text/html" id="statisticsDailyCalc"> | ||
| 325 | + {{each list as obj i}} | ||
| 326 | + <tr {{if obj.zt==1}}style='color: red'{{/if}}> | ||
| 327 | + <td>{{obj.xlName}}</td> | ||
| 328 | + <td>{{obj.jhzlc}}</td> | ||
| 329 | + <td>{{obj.jhlc}}</td> | ||
| 330 | + <td>{{obj.jcclc}}</td> | ||
| 331 | + <td>{{obj.sjzgl}}</td> | ||
| 332 | + <td>{{obj.sjgl}}</td> | ||
| 333 | + <td>{{obj.sjksgl}}</td> | ||
| 334 | + <td>{{obj.ssgl}}</td> | ||
| 335 | + <td>{{obj.ssbc}}</td> | ||
| 336 | + <td>{{obj.ssgl_lz}}</td> | ||
| 337 | + <td>{{obj.ssgl_dm}}</td> | ||
| 338 | + <td>{{obj.ssgl_gz}}</td> | ||
| 339 | + <td>{{obj.ssgl_jf}}</td> | ||
| 340 | + <td>{{obj.ssgl_zs}}</td> | ||
| 341 | + <td>{{obj.ssgl_qr}}</td> | ||
| 342 | + <td>{{obj.ssgl_qc}}</td> | ||
| 343 | + <td>{{obj.ssgl_kx}}</td> | ||
| 344 | + <td>{{obj.ssgl_qh}}</td> | ||
| 345 | + <td>{{obj.ssgl_yw}}</td> | ||
| 346 | + <td>{{obj.ssgl_other}}</td> | ||
| 347 | + <td>{{obj.ljgl}}</td> | ||
| 348 | + <td>{{obj.jhbc}}</td> | ||
| 349 | + <td>{{obj.jhbc_m}}</td> | ||
| 350 | + <td>{{obj.jhbc_a}}</td> | ||
| 351 | + <td>{{obj.sjbc}}</td> | ||
| 352 | + <td>{{obj.sjbc_m}}</td> | ||
| 353 | + <td>{{obj.sjbc_a}}</td> | ||
| 354 | + <td>{{obj.ljbc}}</td> | ||
| 355 | + <td>{{obj.ljbc_m}}</td> | ||
| 356 | + <td>{{obj.ljbc_a}}</td> | ||
| 357 | + <td>{{obj.fzbc}}</td> | ||
| 358 | + <td>{{obj.fzbc_m}}</td> | ||
| 359 | + <td>{{obj.fzbc_a}}</td> | ||
| 360 | + <td>{{obj.dtbc}}</td> | ||
| 361 | + <td>{{obj.dtbc_m}}</td> | ||
| 362 | + <td>{{obj.dtbc_a}}</td> | ||
| 363 | + <td>{{obj.djg}}</td> | ||
| 364 | + <td>{{obj.djg_m}}</td> | ||
| 365 | + <td>{{obj.djg_a}}</td> | ||
| 366 | + <td>{{obj.djg_time}}</td> | ||
| 367 | + <td> </td> | ||
| 368 | + </tr> | ||
| 369 | + {{/each}} | ||
| 370 | + {{if list.length == 0}} | ||
| 371 | + <tr> | ||
| 372 | + <td colspan="44"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 373 | + </tr> | ||
| 374 | + {{/if}} | ||
| 375 | +</script> | ||
| 0 | \ No newline at end of file | 376 | \ No newline at end of file |
src/main/resources/static/pages/forms/statement/statisticsDailyCalc2.html
0 → 100644
| 1 | +<style type="text/css"> | ||
| 2 | + .table-bordered { | ||
| 3 | + border: 1px solid; } | ||
| 4 | + .table-bordered > thead > tr > th, | ||
| 5 | + .table-bordered > thead > tr > td, | ||
| 6 | + .table-bordered > tbody > tr > th, | ||
| 7 | + .table-bordered > tbody > tr > td, | ||
| 8 | + .table-bordered > tfoot > tr > th, | ||
| 9 | + .table-bordered > tfoot > tr > td { | ||
| 10 | + border: 1px solid; } | ||
| 11 | + .table-bordered > thead > tr > th, | ||
| 12 | + .table-bordered > thead > tr > td { | ||
| 13 | + border-bottom-width: 2px; } | ||
| 14 | + | ||
| 15 | + .table > tbody + tbody { | ||
| 16 | + border-top: 1px solid; } | ||
| 17 | + | ||
| 18 | + #forms > thead > tr> td >span{ | ||
| 19 | + width: 5px; | ||
| 20 | + word-wrap: break-word; | ||
| 21 | + letter-spacing: 20px; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + #forms > thead > tr> td >label{ | ||
| 25 | + word-break: keep-all;white-space:nowrap; | ||
| 26 | + } | ||
| 27 | +</style> | ||
| 28 | + | ||
| 29 | +<div class="page-head"> | ||
| 30 | + <div class="page-title"> | ||
| 31 | + <h1>统计日报</h1> | ||
| 32 | + </div> | ||
| 33 | +</div> | ||
| 34 | + | ||
| 35 | +<!-- <div class="row"> --> | ||
| 36 | + <div class="col-md-12 portlet light porttlet-fit bordered" style="height:calc(100% - 56px)"> | ||
| 37 | +<!-- <div> --> | ||
| 38 | + <div class="portlet-title"> | ||
| 39 | + <form class="form-inline" action=""> | ||
| 40 | + <div style="display: inline-block; " id="gsdmDiv"> | ||
| 41 | + <span class="item-label" style="width: 80px;">公司: </span> | ||
| 42 | + <select class="form-control" name="company" id="gsdm" style="width: 180px;"></select> | ||
| 43 | + </div> | ||
| 44 | + <div style="display: inline-block; margin-left: 29px;" id="fgsdmDiv"> | ||
| 45 | + <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 46 | + <select class="form-control" name="subCompany" id="fgsdm" style="width: 180px;"></select> | ||
| 47 | + </div> | ||
| 48 | + <div style="margin-top: 2px"></div> | ||
| 49 | + <div style="display: inline-block;"> | ||
| 50 | + <span class="item-label" style="width: 80px;">线路: </span> | ||
| 51 | + <select class="form-control" name="line" id="line" style="width: 180px;"></select> | ||
| 52 | + </div> | ||
| 53 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 54 | + <span class="item-label" style="width: 80px;">开始时间: </span> | ||
| 55 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 56 | + </div> | ||
| 57 | + <div style="display: inline-block;margin-left: 15px;"> | ||
| 58 | + <span class="item-label" style="width: 80px;">结束时间: </span> | ||
| 59 | + <input class="form-control" type="text" id="date2" style="width: 180px;"/> | ||
| 60 | + </div> | ||
| 61 | + <div class="form-group"> | ||
| 62 | + <input class="btn btn-default" type="button" id="query" value="查询"/> | ||
| 63 | + <input class="btn btn-default" type="button" id="export" value="导出"/> | ||
| 64 | + </div> | ||
| 65 | + </form> | ||
| 66 | + </div> | ||
| 67 | + <div class="portlet-body" id="tjrbBody" style="overflow:auto;height: calc(100% - 80px)"> | ||
| 68 | + <div class="table-container" style="margin-top: 10px;min-width: 906px"> | ||
| 69 | + <label>早高峰:6:31~8:30 晚高峰:16:01~18:00</label> | ||
| 70 | + <table class="table table-bordered table-hover table-checkable" id="forms"> | ||
| 71 | + <thead> | ||
| 72 | + <tr> | ||
| 73 | + <th colspan="44"><label id="tjrq"></label> 线路统计日报</th> | ||
| 74 | + </tr> | ||
| 75 | + <tr> | ||
| 76 | + <td rowspan="3"><span >路线名</span></td> | ||
| 77 | + <td colspan="20">全日营运里程(公里)</td> | ||
| 78 | + <td colspan="15">全日营运班次</td> | ||
| 79 | + <td colspan="9">大间隔情况</td> | ||
| 80 | + </tr> | ||
| 81 | + <tr> | ||
| 82 | + <td rowspan="2"><label>计划总</label> | ||
| 83 | + <label>公里 </label></td> | ||
| 84 | + <td rowspan="2"><label>计划营</label><label>运公里</label></td> | ||
| 85 | + <td rowspan="2"><label>计划空</label><label>驶公里</label></td> | ||
| 86 | + <td rowspan="2"><label>实际</label><label>总公里</label></td> | ||
| 87 | + <td rowspan="2"><label>实际营</label><label>运公里</label></td> | ||
| 88 | + <td rowspan="2"><label>实际空</label><label>驶公里</label></td> | ||
| 89 | + <td rowspan="2"><span>少驶公里</span></td> | ||
| 90 | + <td rowspan="2"><span>少驶班次</span></td> | ||
| 91 | + <td colspan="11">少驶原因(公里)</td> | ||
| 92 | + <td rowspan="2"><span >临加公里</span></td> | ||
| 93 | + <td colspan="3">计划班次</td> | ||
| 94 | + <td colspan="3">实际班次</td> | ||
| 95 | + <td colspan="3">临加班次</td> | ||
| 96 | + <td colspan="3">放站班次</td> | ||
| 97 | + <td colspan="3">调头班次</td> | ||
| 98 | + <td colspan="3">发生次数</td> | ||
| 99 | + <td rowspan="2">最大间隔时间(分)</td> | ||
| 100 | + <td rowspan="2">原因</td> | ||
| 101 | + </tr> | ||
| 102 | + <tr> | ||
| 103 | + <td><span >路阻</span></td> | ||
| 104 | + <td><span>吊慢</span></td> | ||
| 105 | + <td><span >故障</span></td> | ||
| 106 | + <td><span >纠纷</span></td> | ||
| 107 | + <td><span >肇事</span></td> | ||
| 108 | + <td><span>缺人</span></td> | ||
| 109 | + <td><span>缺车</span></td> | ||
| 110 | + <td><span >客稀</span></td> | ||
| 111 | + <td><span>气候</span></td> | ||
| 112 | + <td><span>援外</span></td> | ||
| 113 | + <td><span>其他</span></td> | ||
| 114 | + <td><span>全日</span></td> | ||
| 115 | + <td><span>早高峰</span></td> | ||
| 116 | + <td><span>晚高峰</span></td> | ||
| 117 | + <td><span>全日</span></td> | ||
| 118 | + <td><span>早高峰</span></td> | ||
| 119 | + <td><span>晚高峰</span></td> | ||
| 120 | + <td><span>全日</span></td> | ||
| 121 | + <td><span>早高峰</span></td> | ||
| 122 | + <td><span>晚高峰</span></td> | ||
| 123 | + <td><span>全日</span></td> | ||
| 124 | + <td><span>早高峰</span></td> | ||
| 125 | + <td><span>晚高峰</span></td> | ||
| 126 | + <td><span>全日</span></td> | ||
| 127 | + <td><span>早高峰</span></td> | ||
| 128 | + <td><span>晚高峰</span></td> | ||
| 129 | + <td><span>全日</span></td> | ||
| 130 | + <td><span>早高峰</span></td> | ||
| 131 | + <td><span>晚高峰</span></td> | ||
| 132 | + </tr> | ||
| 133 | + </thead> | ||
| 134 | + <tbody class="statisticsDailyCalc2"> | ||
| 135 | + | ||
| 136 | + </tbody> | ||
| 137 | + </table> | ||
| 138 | + </div> | ||
| 139 | + </div> | ||
| 140 | + </div> | ||
| 141 | + </div> | ||
| 142 | +</div> | ||
| 143 | + | ||
| 144 | +<script> | ||
| 145 | + $(function(){ | ||
| 146 | + $('#export').attr('disabled', "true"); | ||
| 147 | + | ||
| 148 | + // 关闭左侧栏 | ||
| 149 | + if (!$('body').hasClass('page-sidebar-closed')) | ||
| 150 | + $('.menu-toggler.sidebar-toggler').click(); | ||
| 151 | + | ||
| 152 | + var d = new Date(); | ||
| 153 | + d.setTime(d.getTime() - 1*1000*60*60*24); | ||
| 154 | + var year = d.getFullYear(); | ||
| 155 | + var month = d.getMonth() + 1; | ||
| 156 | + var day = d.getDate(); | ||
| 157 | + if(month < 10) | ||
| 158 | + month = "0" + month; | ||
| 159 | + if(day < 10) | ||
| 160 | + day = "0" + day; | ||
| 161 | + var dateTime = year + "-" + month + "-" + day; | ||
| 162 | + $("#date").datetimepicker({ | ||
| 163 | + format : 'YYYY-MM-DD', | ||
| 164 | + locale : 'zh-cn', | ||
| 165 | + maxDate : dateTime | ||
| 166 | + }); | ||
| 167 | + $("#date2").datetimepicker({ | ||
| 168 | + format : 'YYYY-MM-DD', | ||
| 169 | + locale : 'zh-cn', | ||
| 170 | + maxDate : dateTime | ||
| 171 | + }); | ||
| 172 | + $("#date").val(dateTime); | ||
| 173 | + $("#date2").val(dateTime); | ||
| 174 | + | ||
| 175 | + | ||
| 176 | + var fage=false; | ||
| 177 | + var obj = []; | ||
| 178 | + var xlList; | ||
| 179 | + $.get('/report/lineList',function(result){ | ||
| 180 | + xlList=result; | ||
| 181 | + $.get('/user/companyData', function(result){ | ||
| 182 | + obj = result; | ||
| 183 | + var options = ''; | ||
| 184 | + for(var i = 0; i < obj.length; i++){ | ||
| 185 | + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + if(obj.length ==0){ | ||
| 189 | + $("#gsdmDiv").css('display','none'); | ||
| 190 | + }else if(obj.length ==1){ | ||
| 191 | + $("#gsdmDiv").css('display','none'); | ||
| 192 | + if(obj[0].children.length == 1 || obj[0].children.length ==0) | ||
| 193 | + $('#fgsdmDiv').css('display','none'); | ||
| 194 | + } | ||
| 195 | + $('#gsdm').html(options); | ||
| 196 | + updateCompany(); | ||
| 197 | + }); | ||
| 198 | + }) | ||
| 199 | + $("#gsdm").on("change",updateCompany); | ||
| 200 | + function updateCompany(){ | ||
| 201 | + var company = $('#gsdm').val(); | ||
| 202 | + var options = ''; | ||
| 203 | + for(var i = 0; i < obj.length; i++){ | ||
| 204 | + if(obj[i].companyCode == company){ | ||
| 205 | + var children = obj[i].children; | ||
| 206 | + for(var j = 0; j < children.length; j++){ | ||
| 207 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | ||
| 208 | + } | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + $('#fgsdm').html(options); | ||
| 212 | +// initXl(); | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + var tempData = {}; | ||
| 216 | + $.get('/report/lineList',function(xlList){ | ||
| 217 | + var data = []; | ||
| 218 | + data.push({id: " ", text: "全部线路"}); | ||
| 219 | + $.get('/user/companyData', function(result){ | ||
| 220 | + for(var i = 0; i < result.length; i++){ | ||
| 221 | + var companyCode = result[i].companyCode; | ||
| 222 | + var children = result[i].children; | ||
| 223 | + for(var j = 0; j < children.length; j++){ | ||
| 224 | + var code = children[j].code; | ||
| 225 | + for(var k=0;k < xlList.length;k++ ){ | ||
| 226 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | ||
| 227 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 228 | + tempData[xlList[k]["xlbm"]] = companyCode+":"+code; | ||
| 229 | + } | ||
| 230 | + } | ||
| 231 | + } | ||
| 232 | + } | ||
| 233 | + initPinYinSelect2('#line',data,''); | ||
| 234 | + | ||
| 235 | + }); | ||
| 236 | + }); | ||
| 237 | + | ||
| 238 | + $("#line").on("change", function(){ | ||
| 239 | + if($("#line").val() == " "){ | ||
| 240 | + $("#gsdm").attr("disabled", false); | ||
| 241 | + $("#fgsdm").attr("disabled", false); | ||
| 242 | + } else { | ||
| 243 | + var temp = tempData[$("#line").val()].split(":"); | ||
| 244 | + $("#gsdm").val(temp[0]); | ||
| 245 | + updateCompany(); | ||
| 246 | + $("#fgsdm").val(temp[1]); | ||
| 247 | + $("#gsdm").attr("disabled", true); | ||
| 248 | + $("#fgsdm").attr("disabled", true); | ||
| 249 | + } | ||
| 250 | + }); | ||
| 251 | + | ||
| 252 | + | ||
| 253 | + var line =""; | ||
| 254 | + var xlName =""; | ||
| 255 | + var date = ""; | ||
| 256 | + var date2 =""; | ||
| 257 | + var gsdm=""; | ||
| 258 | + var fgsdm=""; | ||
| 259 | + $("#query").on("click",function(){ | ||
| 260 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 261 | + layer.msg("请选择时间范围!"); | ||
| 262 | + return; | ||
| 263 | + } | ||
| 264 | + if($("#date2").val() == null || $("#date2").val().trim().length == 0){ | ||
| 265 | + layer.msg("请选择时间范围!"); | ||
| 266 | + return; | ||
| 267 | + } | ||
| 268 | +// $("#tjrbBody").height($(window).height()-100); | ||
| 269 | + line = $("#line").val(); | ||
| 270 | + xlName = $("#select2-line-container").html(); | ||
| 271 | + date = $("#date").val(); | ||
| 272 | + date2 =$("#date2").val(); | ||
| 273 | + gsdm =$("#gsdm").val(); | ||
| 274 | + fgsdm=$("#fgsdm").val(); | ||
| 275 | + if(line=="请选择"){ | ||
| 276 | + line=""; | ||
| 277 | + } | ||
| 278 | + if(date==null || date =="" ||date2==null || date2 ==""){ | ||
| 279 | + layer.msg('请选择时间段.'); | ||
| 280 | + }else{ | ||
| 281 | + $("#tjrq").html(date+"至"+date2); | ||
| 282 | + var params = {}; | ||
| 283 | + params['gsdm'] = gsdm; | ||
| 284 | + params['fgsdm'] =fgsdm ; | ||
| 285 | + params['line'] = line; | ||
| 286 | + params['date'] = date; | ||
| 287 | + params['date2'] = date2; | ||
| 288 | + params['xlName'] = xlName; | ||
| 289 | + params['type'] = "query"; | ||
| 290 | + var i = layer.load(2); | ||
| 291 | +// $get('/realSchedule/statisticsDailyTj',params,function(result){ | ||
| 292 | + $get('/calcWaybill/calcStatisticsDaily',params,function(result){ | ||
| 293 | + // 把数据填充到模版中 | ||
| 294 | + var tbodyHtml = template('statisticsDailyCalc2',{list:result}); | ||
| 295 | + // 把渲染好的模版html文本追加到表格中 | ||
| 296 | + $('#forms .statisticsDailyCalc2').html(tbodyHtml); | ||
| 297 | + layer.close(i); | ||
| 298 | + | ||
| 299 | + if(result.length == 0) | ||
| 300 | + $("#export").attr('disabled',"true"); | ||
| 301 | + else | ||
| 302 | + $("#export").removeAttr("disabled"); | ||
| 303 | + }); | ||
| 304 | + } | ||
| 305 | + | ||
| 306 | + }); | ||
| 307 | +// $("#tjrbBody").height($(window).height()-100); | ||
| 308 | + $("#export").on("click",function(){ | ||
| 309 | + var params = {}; | ||
| 310 | + params['gsdm'] = gsdm; | ||
| 311 | + params['fgsdm'] =fgsdm ; | ||
| 312 | + params['line'] = line; | ||
| 313 | + params['date'] = date; | ||
| 314 | + params['date2'] = date2; | ||
| 315 | + params['xlName'] = xlName; | ||
| 316 | + params['type'] = "export"; | ||
| 317 | + $get('/realSchedule/statisticsDailyTj',params,function(result){ | ||
| 318 | + window.open("/downloadFile/download?fileName=统计日报"+moment(date).format("YYYYMMDD")); | ||
| 319 | + }); | ||
| 320 | + }); | ||
| 321 | + | ||
| 322 | + }); | ||
| 323 | +</script> | ||
| 324 | +<script type="text/html" id="statisticsDailyCalc2"> | ||
| 325 | + {{each list as obj i}} | ||
| 326 | + <tr {{if obj.zt==1}}style='color: red'{{/if}}> | ||
| 327 | + <td>{{obj.xlName}}</td> | ||
| 328 | + <td>{{obj.jhzlc}}</td> | ||
| 329 | + <td>{{obj.jhyylc}}</td> | ||
| 330 | + <td>{{obj.jhkslc}}</td> | ||
| 331 | + <td>{{obj.sjzlc}}</td> | ||
| 332 | + <td>{{obj.sjyylc}}</td> | ||
| 333 | + <td>{{obj.sjkslc}}</td> | ||
| 334 | + <td>{{obj.sslc}}</td> | ||
| 335 | + <td>{{obj.ssbc}}</td> | ||
| 336 | + <td>{{obj.lzlc}}</td> | ||
| 337 | + <td>{{obj.dmlc}}</td> | ||
| 338 | + <td>{{obj.gzlc}}</td> | ||
| 339 | + <td>{{obj.jflc}}</td> | ||
| 340 | + <td>{{obj.zslc}}</td> | ||
| 341 | + <td>{{obj.qrlc}}</td> | ||
| 342 | + <td>{{obj.qclc}}</td> | ||
| 343 | + <td>{{obj.kxlc}}</td> | ||
| 344 | + <td>{{obj.qhlc}}</td> | ||
| 345 | + <td>{{obj.ywlc}}</td> | ||
| 346 | + <td>{{obj.qtlc}}</td> | ||
| 347 | + <td>{{obj.ljlc}}</td> | ||
| 348 | + <td>{{obj.jhbcq}}</td> | ||
| 349 | + <td>{{obj.jhbcz}}</td> | ||
| 350 | + <td>{{obj.jhbcw}}</td> | ||
| 351 | + <td>{{obj.sjbcq}}</td> | ||
| 352 | + <td>{{obj.sjbcz}}</td> | ||
| 353 | + <td>{{obj.sjbcw}}</td> | ||
| 354 | + <td>{{obj.ljbcq}}</td> | ||
| 355 | + <td>{{obj.ljbcz}}</td> | ||
| 356 | + <td>{{obj.ljbcw}}</td> | ||
| 357 | + <td>{{obj.fzbcq}}</td> | ||
| 358 | + <td>{{obj.fzbcz}}</td> | ||
| 359 | + <td>{{obj.fzbcw}}</td> | ||
| 360 | + <td>{{obj.dtbcq}}</td> | ||
| 361 | + <td>{{obj.dtbcz}}</td> | ||
| 362 | + <td>{{obj.dtbcw}}</td> | ||
| 363 | + <td>{{obj.djgq}}</td> | ||
| 364 | + <td>{{obj.djgz}}</td> | ||
| 365 | + <td>{{obj.djgw}}</td> | ||
| 366 | + <td>{{obj.djgsj}}</td> | ||
| 367 | + <td> </td> | ||
| 368 | + </tr> | ||
| 369 | + {{/each}} | ||
| 370 | + {{if list.length == 0}} | ||
| 371 | + <tr> | ||
| 372 | + <td colspan="44"><h6 class="muted">没有找到相关数据</h6></td> | ||
| 373 | + </tr> | ||
| 374 | + {{/if}} | ||
| 375 | +</script> | ||
| 0 | \ No newline at end of file | 376 | \ No newline at end of file |