Commit b8921cedaca8d2936542c608540dec9d5dd26e26

Authored by 廖磊
1 parent d2550f64

去掉原大间隔统计表的计算方法

src/main/java/com/bsth/entity/calc/CalcInterval.java
... ... @@ -7,86 +7,72 @@ import javax.persistence.GeneratedValue;
7 7 import javax.persistence.Id;
8 8 import javax.persistence.Table;
9 9  
  10 +/**
  11 + * @author bsth-a
  12 + *
  13 + */
10 14 @Entity
11   -@Table(name = "calc_interval")
  15 +@Table(name = "bsth_c_calc_interval")
12 16 public class CalcInterval {
13 17 /* 主键*/
14 18 @Id
15 19 @GeneratedValue
16   - private Long id;
  20 + private Integer id;
17 21 /* 公司代码*/
18   - private String gsdm;
19   - /* 公司名称*/
20   - private String gsname;
  22 + private String gsbm;
21 23 /* 分公司代码*/
22   - private String fgsdm;
23   - /* 分公司名称*/
24   - private String fgsname;
25   - /* 日期*/
26   - private Date rq;
  24 + private String fgsbm;
27 25 /* 日期字符串*/
28   - private String rqStr;
  26 + private String date;
29 27 /* 线路编码*/
30   - private String xl;
  28 + private String xlBm;
31 29 /* 线路名称*/
32 30 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() {
  31 + /*大间隔等级*/
  32 + private String level;
  33 + /*等级具体时间*/
  34 + private Integer levelTime;
  35 + /*全日大间隔次数*/
  36 + private Integer djgAll;
  37 + /*高峰大间隔次数*/
  38 + private Integer djgGf;
  39 + /*低谷大间隔次数*/
  40 + private Integer djgDg;
  41 + /*最大间隔时间*/
  42 + private Integer djgTime;
  43 + /*数据创建时间*/
  44 + private Date createtime;
  45 + /*数据修改时间*/
  46 + private Date updatetime;
  47 + public Integer getId() {
44 48 return id;
45 49 }
46   - public void setId(Long id) {
  50 + public void setId(Integer id) {
47 51 this.id = id;
48 52 }
49   - public String getGsdm() {
50   - return gsdm;
  53 + public String getGsbm() {
  54 + return gsbm;
51 55 }
52   - public void setGsdm(String gsdm) {
53   - this.gsdm = gsdm;
  56 + public void setGsbm(String gsbm) {
  57 + this.gsbm = gsbm;
54 58 }
55   - public String getGsname() {
56   - return gsname;
  59 + public String getFgsbm() {
  60 + return fgsbm;
57 61 }
58   - public void setGsname(String gsname) {
59   - this.gsname = gsname;
  62 + public void setFgsbm(String fgsbm) {
  63 + this.fgsbm = fgsbm;
60 64 }
61   - public String getFgsdm() {
62   - return fgsdm;
  65 + public String getDate() {
  66 + return date;
63 67 }
64   - public void setFgsdm(String fgsdm) {
65   - this.fgsdm = fgsdm;
  68 + public void setDate(String date) {
  69 + this.date = date;
66 70 }
67   - public String getFgsname() {
68   - return fgsname;
  71 + public String getXlBm() {
  72 + return xlBm;
69 73 }
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;
  74 + public void setXlBm(String xlBm) {
  75 + this.xlBm = xlBm;
90 76 }
91 77 public String getXlName() {
92 78 return xlName;
... ... @@ -94,35 +80,53 @@ public class CalcInterval {
94 80 public void setXlName(String xlName) {
95 81 this.xlName = xlName;
96 82 }
97   - public int getDjg() {
98   - return djg;
  83 + public String getLevel() {
  84 + return level;
99 85 }
100   - public void setDjg(int djg) {
101   - this.djg = djg;
  86 + public void setLevel(String level) {
  87 + this.level = level;
102 88 }
103   - public int getDjgM() {
104   - return djgM;
  89 + public Integer getLevelTime() {
  90 + return levelTime;
105 91 }
106   - public void setDjgM(int djgM) {
107   - this.djgM = djgM;
  92 + public void setLevelTime(Integer levelTime) {
  93 + this.levelTime = levelTime;
108 94 }
109   - public int getDjgA() {
110   - return djgA;
  95 + public Integer getDjgAll() {
  96 + return djgAll;
111 97 }
112   - public void setDjgA(int djgA) {
113   - this.djgA = djgA;
  98 + public void setDjgAll(Integer djgAll) {
  99 + this.djgAll = djgAll;
114 100 }
115   - public int getDjgTime() {
  101 + public Integer getDjgGf() {
  102 + return djgGf;
  103 + }
  104 + public void setDjgGf(Integer djgGf) {
  105 + this.djgGf = djgGf;
  106 + }
  107 + public Integer getDjgDg() {
  108 + return djgDg;
  109 + }
  110 + public void setDjgDg(Integer djgDg) {
  111 + this.djgDg = djgDg;
  112 + }
  113 + public Integer getDjgTime() {
116 114 return djgTime;
117 115 }
118   - public void setDjgTime(int djgTime) {
  116 + public void setDjgTime(Integer djgTime) {
119 117 this.djgTime = djgTime;
120 118 }
121   - public String getRemark() {
122   - return remark;
  119 + public Date getCreatetime() {
  120 + return createtime;
  121 + }
  122 + public void setCreatetime(Date createtime) {
  123 + this.createtime = createtime;
  124 + }
  125 + public Date getUpdatetime() {
  126 + return updatetime;
123 127 }
124   - public void setRemark(String remark) {
125   - this.remark = remark;
  128 + public void setUpdatetime(Date updatetime) {
  129 + this.updatetime = updatetime;
126 130 }
127 131  
128 132 }
... ...
src/main/java/com/bsth/service/calc/impl/CalcToolServiceImpl.java
1 1 package com.bsth.service.calc.impl;
2 2  
3   -import java.sql.ResultSet;
4   -import java.sql.SQLException;
5 3 import java.util.ArrayList;
6 4 import java.util.Date;
7 5 import java.util.HashMap;
... ... @@ -10,7 +8,6 @@ import java.util.List;
10 8 import java.util.Map;
11 9 import java.util.Set;
12 10  
13   -import com.bsth.entity.calc.CalcInterval;
14 11 import com.bsth.entity.calc.CalcWaybill;
15 12 import com.bsth.entity.realcontrol.ChildTaskPlan;
16 13 import com.bsth.entity.realcontrol.ScheduleRealInfo;
... ... @@ -19,14 +16,12 @@ import com.bsth.repository.calc.CalcIntervalRepository;
19 16 import com.bsth.repository.calc.CalcWaybillRepository;
20 17 import com.bsth.service.calc.CalcToolService;
21 18 import com.bsth.service.calc.CalcCulateMileageService;
22   -import com.bsth.service.report.CulateMileageService;
23 19 import com.bsth.util.Arith;
24 20  
25 21 import org.slf4j.Logger;
26 22 import org.slf4j.LoggerFactory;
27 23 import org.springframework.beans.factory.annotation.Autowired;
28 24 import org.springframework.jdbc.core.JdbcTemplate;
29   -import org.springframework.jdbc.core.RowMapper;
30 25 import org.springframework.stereotype.Service;
31 26  
32 27 /**
... ... @@ -35,11 +30,6 @@ import org.springframework.stereotype.Service;
35 30 @Service
36 31 public class CalcToolServiceImpl implements CalcToolService {
37 32  
38   - @Autowired
39   - private CalcWaybillRepository clacRepository;
40   -
41   - @Autowired
42   - private CalcIntervalRepository culcIntervalRepository;
43 33  
44 34 @Autowired
45 35 private CalcCulateMileageService culateMileageService;
... ... @@ -114,50 +104,6 @@ public class CalcToolServiceImpl implements CalcToolService {
114 104 listCal.addAll(this.cul(list_, lists_, xlList, djgList));
115 105 }
116 106 }
117   -
118   - //按线路计算大间隔
119   - /* if(list.size() > 0){
120   - ScheduleRealInfo s = list.get(0);
121   - Map<String, Object> culateDjg = culateMileageService.culateDjg(list, lineCode, xlList, djgList);
122   - CalcInterval interval = new CalcInterval();
123   - interval.setGsdm(s.getGsBm());
124   - interval.setGsname(s.getGsName());
125   - interval.setFgsdm(s.getFgsBm());
126   - interval.setFgsname(s.getFgsName());
127   - interval.setRq(s.getScheduleDate());
128   - interval.setRqStr(s.getScheduleDateStr());
129   - interval.setXl(s.getXlBm());
130   - interval.setXlName(s.getXlName());
131   - if(culateDjg.keySet().size() > 0){
132   - if(culateDjg.containsKey("djgcsq")){
133   - interval.setDjg(Integer.valueOf(culateDjg.get("djgcsq").toString()));
134   - } else {
135   - interval.setDjg(0);
136   - }
137   - if(culateDjg.containsKey("djgcsz")){
138   - interval.setDjgM(Integer.valueOf(culateDjg.get("djgcsz").toString()));
139   - } else {
140   - interval.setDjgM(0);
141   - }
142   - if(culateDjg.containsKey("djgcsw")){
143   - interval.setDjgA(Integer.valueOf(culateDjg.get("djgcsw").toString()));
144   - } else {
145   - interval.setDjgA(0);
146   - }
147   - if(culateDjg.containsKey("djgsj")){
148   - interval.setDjgTime(Integer.valueOf(culateDjg.get("djgsj").toString()));
149   - } else {
150   - interval.setDjgTime(0);
151   - }
152   - } else {
153   - interval.setDjg(0);
154   - interval.setDjgM(0);
155   - interval.setDjgA(0);
156   - interval.setDjgTime(0);
157   - }
158   - culcIntervalRepository.save(interval);
159   - }*/
160   -
161 107 while(true){
162 108 int i = 0, l = 0;
163 109 boolean flag = false;
... ...
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
... ... @@ -23,7 +23,6 @@ import com.bsth.common.ResponseCode;
23 23 import com.bsth.data.BasicData;
24 24 import com.bsth.entity.Line;
25 25 import com.bsth.entity.calc.CalcBusMileage;
26   -import com.bsth.entity.calc.CalcInterval;
27 26 import com.bsth.entity.calc.CalcLineMileage;
28 27 import com.bsth.entity.calc.CalcStatistics;
29 28 import com.bsth.entity.calc.CalcWaybill;
... ... @@ -32,7 +31,6 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
32 31 import com.bsth.entity.sys.Interval;
33 32 import com.bsth.repository.LineRepository;
34 33 import com.bsth.repository.calc.CalcBusMileageRepository;
35   -import com.bsth.repository.calc.CalcIntervalRepository;
36 34 import com.bsth.repository.calc.CalcLineMileageRepository;
37 35 import com.bsth.repository.calc.CalcStatisticsRepository;
38 36 import com.bsth.repository.calc.CalcWaybillRepository;
... ... @@ -68,9 +66,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
68 66 private CalcWaybillRepository calcRepository;
69 67  
70 68 @Autowired
71   - private CalcIntervalRepository calcIntervalRepository;
72   -
73   - @Autowired
74 69 private CalcStatisticsRepository calcStatisticsRepository;
75 70  
76 71 @Autowired
... ... @@ -163,10 +158,8 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
163 158 }
164 159 if(date.length() != 0 && line.length() != 0){
165 160 calcRepository.deleteByDateAndLine(date, line);
166   - //calcIntervalRepository.deleteByDateAndLine(date, line);
167 161 } else if(date.length() != 0){
168 162 calcRepository.deleteByDate(date);
169   - //calcIntervalRepository.deleteByDate(date);
170 163 } else {
171 164 newMap.put("status", ResponseCode.ERROR);
172 165 logger.error("save erro.", "日期不能为空");
... ... @@ -283,19 +276,15 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
283 276 List<String> keyList = new ArrayList<String>();
284 277 List<CalcWaybill> list = new ArrayList<CalcWaybill>();
285 278 List<CalcWaybill> lists = new ArrayList<CalcWaybill>();
286   - // List<CalcInterval> list_ = new ArrayList<CalcInterval>();
287 279 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
288 280 Map<String, List<CalcWaybill>> keyMap = new HashMap<String, List<CalcWaybill>>();
289   - // Map<String, List<CalcInterval>> keyMap_ = new HashMap<String, List<CalcInterval>>();
290 281  
291 282 if(line.equals("")){
292 283 //查询所有线路
293 284 list = calcRepository.scheduleByDateAndLineTj(line,date,date2,gsdm,fgsdm);
294   - // list_ = calcIntervalRepository.selectByDateAndLine(line, date, date2, gsdm, fgsdm);
295 285 }else{
296 286 //查询单条线路
297 287 list = calcRepository.scheduleByDateAndLineTj2(line,date,date2);
298   - // list_ = calcIntervalRepository.selectByDateAndLine(line, date, date2);
299 288 }
300 289  
301 290 for(CalcWaybill c : list){
... ... @@ -306,12 +295,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
306 295 }
307 296 keyMap.get(key).add(c);
308 297 }
309   - /*for(CalcInterval c : list_){
310   - String key = c.getXlName();
311   - if(!keyMap_.containsKey(key))
312   - keyMap_.put(key, new ArrayList<CalcInterval>());
313   - keyMap_.get(key).add(c);
314   - }*/
315 298 Collections.sort(keyList, new AccountXlbmStr());
316 299 for(String key : keyList){
317 300 CalcWaybill calc = keyMap.get(key).get(0);
... ... @@ -356,26 +339,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
356 339 calc.setSjfyylc(Arith.add(calc.getSjfyylc(), calc.getLjfyylc()));
357 340 lists.add(calc);
358 341 }
359   - /*CalcInterval sum_ = new CalcInterval();
360   - sum_.setXlName("合计");
361   - sum_.setDjgTime(0);
362   - for(String key : keyMap_.keySet()){
363   - CalcInterval calc = keyMap_.get(key).get(0);
364   - for(int i = 1; i < keyMap_.get(key).size(); i++){
365   - CalcInterval calc_ = keyMap_.get(key).get(i);
366   - calc.setDjg(calc.getDjg() + calc_.getDjg());
367   - calc.setDjgM(calc.getDjgM() + calc_.getDjgM());
368   - calc.setDjgA(calc.getDjgA() + calc_.getDjgA());
369   - if(calc_.getDjgTime() > calc.getDjgTime())
370   - calc.setDjgTime(calc_.getDjgTime());
371   - }
372   - sum_.setDjg(sum_.getDjg() + calc.getDjg());
373   - sum_.setDjgM(sum_.getDjgM() + calc.getDjgM());
374   - sum_.setDjgA(sum_.getDjgA() + calc.getDjgA());
375   - if(calc.getDjgTime() > sum_.getDjgTime())
376   - sum_.setDjgTime(calc.getDjgTime());
377   - }*/
378   -
379 342 CalcWaybill sum = new CalcWaybill();
380 343 sum.setXlName("合计");
381 344 for(CalcWaybill c : lists){
... ... @@ -459,22 +422,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
459 422 m.put("dtbc", c.getDtbc());
460 423 m.put("dtbc_m", c.getDtbczgf());
461 424 m.put("dtbc_a", c.getDtbcwgf());
462   - /*if(keyMap_.containsKey(c.getXlName()) || c.getXlName().equals("合计")){
463   - CalcInterval calc;
464   - if(c.getXlName().equals("合计"))
465   - calc = sum_;
466   - else
467   - calc = keyMap_.get(c.getXlName()).get(0);
468   - m.put("djg", calc.getDjg());
469   - m.put("djg_m", calc.getDjgM());
470   - m.put("djg_a", calc.getDjgA());
471   - m.put("djg_time", calc.getDjgTime());
472   - } else {
473   - m.put("djg", 0);
474   - m.put("djg_m", 0);
475   - m.put("djg_a", 0);
476   - m.put("djg_time", 0);
477   - }*/
478 425 resList.add(m);
479 426 }
480 427  
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -5285,20 +5285,22 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5285 5285 fcsjm = String.valueOf(fcsjActural_ - fcsj_);
5286 5286 }
5287 5287 }
5288   - String[] dfsj_s =schedule.getDfsj().split(":");
5289   - Long dfsj_ = Long.parseLong(dfsj_s[0]) * 60 + Long.parseLong(dfsj_s[1]);
5290   - if ((dfsj_ - fcsjActural_) > 0) {
5291   - if(dfsj_ - fcsjActural_>1200){
5292   - dfsjm=String.valueOf(1440-(dfsj_ - fcsjActural_));
5293   - }else{
5294   - dfsjk = String.valueOf(dfsj_ - fcsjActural_);
5295   - }
5296   - } else {
5297   - if(fcsjActural_ - dfsj_>1200){
5298   - dfsjk= String.valueOf(1440-(fcsjActural_ - dfsj_));
5299   - }else{
5300   - dfsjm = String.valueOf(fcsjActural_ - dfsj_);
5301   - }
  5288 + if(df.equals("df")){
  5289 + String[] dfsj_s =schedule.getDfsj().split(":");
  5290 + Long dfsj_ = Long.parseLong(dfsj_s[0]) * 60 + Long.parseLong(dfsj_s[1]);
  5291 + if ((dfsj_ - fcsjActural_) > 0) {
  5292 + if(dfsj_ - fcsjActural_>1200){
  5293 + dfsjm=String.valueOf(1440-(dfsj_ - fcsjActural_));
  5294 + }else{
  5295 + dfsjk = String.valueOf(dfsj_ - fcsjActural_);
  5296 + }
  5297 + } else {
  5298 + if(fcsjActural_ - dfsj_>1200){
  5299 + dfsjk= String.valueOf(1440-(fcsjActural_ - dfsj_));
  5300 + }else{
  5301 + dfsjm = String.valueOf(fcsjActural_ - dfsj_);
  5302 + }
  5303 + }
5302 5304 }
5303 5305 }
5304 5306 if(df.equals("df")){
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -852,12 +852,12 @@ public class ReportServiceImpl implements ReportService{
852 852 String sqlPc=" (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,2 as xh FROM "
853 853 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
854 854 + " fcsj <='"+minfcsj+"' and bc_type!='ldks'"
855   - + " and bc_type !='region') "
  855 + + " and bc_type !='region' and bc_type !='venting' and bc_type !='major') "
856 856 + " union "
857 857 + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,1 as xh FROM "
858 858 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
859 859 + " fcsj > '"+minfcsj+"' and bc_type!='ldks' "
860   - + " and bc_type !='region') "
  860 + + " and bc_type !='region' and bc_type !='venting' and bc_type !='major') "
861 861 + " order by xh, lp,fcsj";
862 862 Map<String, Object> map=new HashMap<String,Object>();
863 863 List<Map<String, Object>> list= jdbcTemplate.query(sqlPc,
... ...