Commit 8c64ce08e7e288b3fc0b42b79ef85b1d9ac802fc

Authored by 廖磊
1 parent df2151cf

更改最早发车时间获取方法

src/main/java/com/bsth/repository/LineRepository.java
... ... @@ -39,6 +39,9 @@ public interface LineRepository extends BaseRepository<Line, Integer> {
39 39  
40 40 @Query(value = " SELECT l FROM Line l where l.name like ?1")
41 41 List<Line> findLine(String line);
  42 +
  43 + @Query(value = " SELECT l FROM Line l where l.lineCode = ?1")
  44 + List<Line> findLineByCode(String lineCode);
42 45  
43 46 public Line findByLineCode(String string);
44 47  
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -783,11 +783,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
783 783 state = state + "+1";
784 784 type = "ASC";
785 785 }
786   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
787   - + " id = ("
788   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
789   - + ")";
790   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  786 + String minfcsj="02:00";
  787 + List<Line> lineList=lineRepository.findLineByCode(line);
  788 + if(lineList.size()>0){
  789 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  790 + + " id = ("
  791 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  792 + + ")";
  793 + minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  794 + }
791 795 String sqlPlan ="select * from (select * from ("
792 796 + " select min(s.id) as id,s.j_Gh as jGh,s.cl_Zbh as clZbh, "
793 797 + " s.lp_Name as lpName,s.j_Name as jName,max(s.schedule_date_str) as dateStr ,"
... ... @@ -902,11 +906,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
902 906 // map=new HashMap<String,Object>();
903 907  
904 908 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
905   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
906   - + " id = ("
907   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
908   - + ")";
909   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  909 + String minfcsj="02:00";
  910 + List<Line> lineList=lineRepository.findLineByCode(line);
  911 + if(lineList.size()>0){
  912 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  913 + + " id = ("
  914 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  915 + + ")";
  916 + minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  917 + }
910 918 String[] minSjs = minfcsj.split(":");
911 919 Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
912 920  
... ... @@ -2076,11 +2084,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2076 2084 List<ScheduleRealInfo> list = null;
2077 2085 list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
2078 2086 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
2079   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
2080   - + " id = ("
2081   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
2082   - + ")";
2083   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  2087 + String minfcsj="02:00";
  2088 + List<Line> lineList=lineRepository.findLineByCode(line);
  2089 + if(lineList.size()>0){
  2090 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  2091 + + " id = ("
  2092 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  2093 + + ")";
  2094 + minfcsj= jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  2095 + }
2084 2096 String[] minSjs = minfcsj.split(":");
2085 2097 Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
2086 2098  
... ... @@ -2177,11 +2189,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2177 2189 List<ScheduleRealInfo> list = null;
2178 2190 list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line);
2179 2191 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
2180   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
2181   - + " id = ("
2182   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
2183   - + ")";
2184   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  2192 + String minfcsj="02:00";
  2193 + List<Line> lineList=lineRepository.findLineByCode(line);
  2194 + if(lineList.size()>0){
  2195 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  2196 + + " id = ("
  2197 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  2198 + + ")";
  2199 + minfcsj= jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  2200 + }
2185 2201 String[] minSjs = minfcsj.split(":");
2186 2202 Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
2187 2203  
... ... @@ -4352,11 +4368,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4352 4368 // map=new HashMap<String,Object>();
4353 4369  
4354 4370 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
4355   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
4356   - + " id = ("
4357   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(listpl.get(0).getXlBm()) +"'"
4358   - + ")";
4359   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  4371 + String minfcsj="02:00";
  4372 + List<Line> lineList=lineRepository.findLineByCode(listpl.get(0).getXlBm());
  4373 + if(lineList.size()>0){
  4374 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  4375 + + " id = ("
  4376 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  4377 + + ")";
  4378 + minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  4379 + }
4360 4380 String[] minSjs = minfcsj.split(":");
4361 4381 Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
4362 4382  
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -373,11 +373,15 @@ public class ReportServiceImpl implements ReportService{
373 373 DecimalFormat df = new DecimalFormat("#0.00");
374 374 // TODO Auto-generated method stub
375 375 //最早营运时间 区分夜宵线
376   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
377   - + " id = ("
378   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
379   - + ")";
380   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  376 + String minfcsj="02:00";
  377 + List<Line> lineList=lineRepository.findLineByCode(line);
  378 + if(lineList.size()>0){
  379 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  380 + + " id = ("
  381 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  382 + + ")";
  383 + minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  384 + }
381 385 String[] minSjs = minfcsj.split(":");
382 386 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);
383 387 //查询时间里程
... ... @@ -774,11 +778,15 @@ public class ReportServiceImpl implements ReportService{
774 778 List<Map<String, Object>> list =new ArrayList<>();
775 779 // TODO Auto-generated method stub
776 780 //最早营运时间 区分夜宵线
777   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
778   - + " id = ("
779   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
780   - + ")";
781   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  781 + String minfcsj="02:00";
  782 + List<Line> lineList=lineRepository.findLineByCode(line);
  783 + if(lineList.size()>0){
  784 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  785 + + " id = ("
  786 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  787 + + ")";
  788 + minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  789 + }
782 790  
783 791 //查询全程
784 792 String sqlqc="select t.* from ( "
... ... @@ -859,8 +867,15 @@ public class ReportServiceImpl implements ReportService{
859 867 public List<Map<String, Object>> tbodyTime5(String line, String ttinfo) {
860 868 // TODO Auto-generated method stub
861 869 //最早营运时间 区分夜宵线
862   - String sqlMinYysj="select start_opt from bsth_c_line_config where line = '"+BasicData.lineId2CodeMap.inverse().get(line) +"'";
863   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  870 + String minfcsj="02:00";
  871 + List<Line> lineList=lineRepository.findLineByCode(line);
  872 + if(lineList.size()>0){
  873 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  874 + + " id = ("
  875 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  876 + + ")";
  877 + minfcsj= jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  878 + }
864 879 String[] minSjs = minfcsj.split(":");
865 880 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);
866 881 //查询时间里程
... ... @@ -2266,11 +2281,15 @@ public class ReportServiceImpl implements ReportService{
2266 2281 @Override
2267 2282 public List<Map<String, Object>> queryInOutStrtions(String line, String date, int zd,String lzsj) {
2268 2283 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
2269   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
2270   - + " id = ("
2271   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
2272   - + ")";
2273   - String minfcsj=jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  2284 + String minfcsj="02:00";
  2285 + List<Line> lineList=lineRepository.findLineByCode(line);
  2286 + if(lineList.size()>0){
  2287 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  2288 + + " id = ("
  2289 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  2290 + + ")";
  2291 + minfcsj= jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  2292 + }
2274 2293 List<ArrivalInfo> arrInfoList=this.load4(line, date, zd,minfcsj);
2275 2294  
2276 2295 //查询线路所有的站点
... ...
src/main/java/com/bsth/service/report/impl/SheetServiceImpl.java
... ... @@ -149,20 +149,15 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
149 149 // String line =map.get("line").toString();
150 150 // String date =map.get("date").toString();
151 151 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
152   - String sqlMinYysj="select start_opt from bsth_c_line_config where "
153   - + " id = ("
154   - + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
155   - + ")";
156   - List<String> listMin=jdbcTemplate.query(sqlMinYysj,
157   - new RowMapper<String>(){
158   - @Override
159   - public String mapRow(ResultSet rs, int rowNum) throws SQLException {
160   - String s=rs.getString("start_opt");
161   - return s;
162   - }
163   - });
164   - if(listMin.size()>0){
165   - String minfcsj=listMin.get(0);
  152 + String minfcsj="02:00";
  153 + List<Line> lineList=lineRepository.findLineByCode(line);
  154 + if(lineList.size()>0){
  155 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  156 + + " id = ("
  157 + + "select max(id) from bsth_c_line_config where line ='"+lineList.get(0).getId() +"'"
  158 + + ")";
  159 + minfcsj= jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  160 + }
166 161 String[] minSjs = minfcsj.split(":");
167 162 //车辆最早发车时间 用了过滤超第二天0点的数据
168 163 Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
... ... @@ -602,7 +597,6 @@ public class SheetServiceImpl extends BaseServiceImpl&lt;Sheet, Integer&gt; implements
602 597 fage=false;
603 598 }
604 599 }
605   - }
606 600 return listAdd;
607 601 }
608 602  
... ...