Commit 53a6bca0b21e4ec8e644fe57462a0e274d975011

Authored by 廖磊
1 parent 0d4caf81

班次到离站处理分表数据

src/main/java/com/bsth/repository/LineRepository.java
... ... @@ -48,7 +48,7 @@ public interface LineRepository extends BaseRepository<Line, Integer> {
48 48 @Query(value = " SELECT l FROM Line l where l.company like ?1 and l.brancheCompany like ?2 and l.lineCode like ?3")
49 49 public List<Line> findLineBygsBm(String gsBm, String fgsBm, String line);
50 50  
51   - @Query("SELECT L FROM Line L where L.destroy=0 and remove !=1")
  51 + @Query("SELECT L FROM Line L where L.destroy=0 and L.remove !=1")
52 52 List<Line> findAllService();
53 53  
54 54  
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -96,7 +96,7 @@ public class ReportServiceImpl implements ReportService{
96 96 Long date1=simpleDateFormat.parse(date+" "+sjfc+":00").getTime();
97 97 Long date2=simpleDateFormat.parse(date+" "+sjdd+":00").getTime();
98 98 Date dates=simpleDateFormat.parse(date+" 00:00:00");
99   - List<ArrivalInfo> lists=load(line,sbbb,date1,date2,dates);
  99 + List<ArrivalInfo> lists=load(line,sbbb,date1,date2,dates,date);
100 100  
101 101 for(int i=0;i<lists.size();i++){
102 102 ArrivalInfo t1=lists.get(i);
... ... @@ -123,7 +123,7 @@ public class ReportServiceImpl implements ReportService{
123 123 }
124 124  
125 125  
126   - public List<ArrivalInfo> load(String line,String sbbb,Long date1,Long date2,Date dates){
  126 + public List<ArrivalInfo> load(String line,String sbbb,Long date1,Long date2,Date dates,String date){
127 127 List<ArrivalInfo> list = null;
128 128 Calendar cal = Calendar.getInstance();
129 129 cal.setTime(dates);
... ... @@ -133,8 +133,8 @@ public class ReportServiceImpl implements ReportService{
133 133 Connection conn = null;
134 134 PreparedStatement ps = null;
135 135 ResultSet rs = null;
136   -
137   - String sql = "select * from bsth_c_arrival_info where device_id=? AND line_id=? AND weeks_year=? AND ts > ? AND ts <=? order by ts";
  136 + String year=date.substring(0,4);
  137 + String sql = "select * from bsth_c_arrival_info_"+year+" where device_id=? AND line_id=? AND weeks_year=? AND ts > ? AND ts <=? order by ts";
138 138 try{
139 139 conn = DBUtils_MS.getConnection();
140 140 ps = conn.prepareStatement(sql);
... ... @@ -194,7 +194,7 @@ public class ReportServiceImpl implements ReportService{
194 194 Long date2=simpleDateFormat.parse(ddsj+":00").getTime();
195 195 Date dates1=simpleDateFormat.parse(fcsj+":00");
196 196 Date dates2=simpleDateFormat.parse(ddsj+":00");
197   - List<ArrivalInfo> lists=load2(line,date1,date2,dates1,dates2,zd,zdlx);
  197 + List<ArrivalInfo> lists=load2(line,date1,date2,dates1,dates2,zd,zdlx,fcsj);
198 198  
199 199 for(int i=0;i<lists.size();i++){
200 200 ArrivalInfo t1=lists.get(i);
... ... @@ -224,7 +224,7 @@ public class ReportServiceImpl implements ReportService{
224 224 }
225 225  
226 226  
227   - public List<ArrivalInfo> load2(String line,Long date1,Long date2,Date dates1,Date dates2,String zd,String zdlx){
  227 + public List<ArrivalInfo> load2(String line,Long date1,Long date2,Date dates1,Date dates2,String zd,String zdlx,String fcsj){
228 228 List<ArrivalInfo> list = null;
229 229 Calendar cal = Calendar.getInstance();
230 230 cal.setTime(dates1);
... ... @@ -235,8 +235,8 @@ public class ReportServiceImpl implements ReportService{
235 235 Connection conn = null;
236 236 PreparedStatement ps = null;
237 237 ResultSet rs = null;
238   -
239   - String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year>=? "
  238 + String year=fcsj.substring(0,4);
  239 + String sql = "select * from bsth_c_arrival_info_"+year+" where line_id=? AND weeks_year>=? "
240 240 + " AND weeks_year<=? AND ts > ? AND ts <=? AND up_down=? AND stop_no like ? order by ts";
241 241 try{
242 242 conn = DBUtils_MS.getConnection();
... ... @@ -2179,8 +2179,8 @@ public class ReportServiceImpl implements ReportService{
2179 2179 Connection conn = null;
2180 2180 PreparedStatement ps = null;
2181 2181 ResultSet rs = null;
2182   -
2183   - String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year=? "
  2182 + String year=date.substring(0,4);
  2183 + String sql = "select * from bsth_c_arrival_info_"+year+" where line_id=? AND weeks_year=? "
2184 2184 + " AND ts >= ? AND ts <=? AND up_down=? order by device_id,ts";
2185 2185 try{
2186 2186 conn = DBUtils_MS.getConnection();
... ... @@ -2229,8 +2229,8 @@ public class ReportServiceImpl implements ReportService{
2229 2229 Connection conn = null;
2230 2230 PreparedStatement ps = null;
2231 2231 ResultSet rs = null;
2232   -
2233   - String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year=? "
  2232 + String year=date.substring(0,4);
  2233 + String sql = "select * from bsth_c_arrival_info_"+year+" where line_id=? AND weeks_year=? "
2234 2234 + " AND ts >= ? AND ts <=? AND up_down=? order by device_id,ts";
2235 2235 try{
2236 2236 conn = DBUtils_MS.getConnection();
... ... @@ -3529,7 +3529,7 @@ public class ReportServiceImpl implements ReportService{
3529 3529 Long date1 = simpleDateFormat.parse(date+" 00:00:01").getTime();
3530 3530 Long date2=simpleDateFormat.parse(date+" 23:59:59").getTime();
3531 3531 Date dates=simpleDateFormat.parse(date+" 00:00:00");
3532   - List<ArrivalInfo> lists=load_online(line,date1,date2,dates);
  3532 + List<ArrivalInfo> lists=load_online(line,date1,date2,dates,date);
3533 3533 for (int i = 0; i < list.size(); i++) {
3534 3534 String nbbm=list.get(i);
3535 3535 String sbbb=BasicData.deviceId2NbbmMap.inverse().get(nbbm);
... ... @@ -3582,7 +3582,7 @@ public class ReportServiceImpl implements ReportService{
3582 3582 return map;
3583 3583 }
3584 3584  
3585   - public List<ArrivalInfo> load_online(String line,Long date1,Long date2,Date dates){
  3585 + public List<ArrivalInfo> load_online(String line,Long date1,Long date2,Date dates,String date){
3586 3586 List<ArrivalInfo> list = null;
3587 3587 Calendar cal = Calendar.getInstance();
3588 3588 cal.setTime(dates);
... ... @@ -3592,8 +3592,8 @@ public class ReportServiceImpl implements ReportService{
3592 3592 Connection conn = null;
3593 3593 PreparedStatement ps = null;
3594 3594 ResultSet rs = null;
3595   -
3596   - String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year=? AND ts > ? AND ts <=? order by ts";
  3595 + String year=date.substring(0,4);
  3596 + String sql = "select * from bsth_c_arrival_info_"+year+" where line_id=? AND weeks_year=? AND ts > ? AND ts <=? order by ts";
3597 3597 try{
3598 3598 conn = DBUtils_MS.getConnection();
3599 3599 ps = conn.prepareStatement(sql);
... ...