Commit c2dfbe79a3f73acd9cdb1f5d5ee43354aef86963

Authored by 廖磊
1 parent 543c40f0

添加了一个首末班次发车准点率的实时计算全天计算的统计接口

src/main/java/com/bsth/server_rs/bigdata/BigdataService.java
@@ -35,6 +35,8 @@ public class BigdataService { @@ -35,6 +35,8 @@ public class BigdataService {
35 JdbcTemplate jdbcTemplate; 35 JdbcTemplate jdbcTemplate;
36 36
37 DecimalFormat df = new DecimalFormat("0.00"); 37 DecimalFormat df = new DecimalFormat("0.00");
  38 +
  39 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
38 40
39 /* 41 /*
40 * 线路接口开始 42 * 线路接口开始
@@ -1005,7 +1007,7 @@ public class BigdataService { @@ -1005,7 +1007,7 @@ public class BigdataService {
1005 + " where date>='"+starDate+"' and date<= '"+endDate+"'"; 1007 + " where date>='"+starDate+"' and date<= '"+endDate+"'";
1006 if(!line.equals("all")){ 1008 if(!line.equals("all")){
1007 sql +=" and xl='"+line+"'"; 1009 sql +=" and xl='"+line+"'";
1008 - } 1010 + }
1009 1011
1010 List<Map<String, Object>> list=jdbcTemplate.query(sql, 1012 List<Map<String, Object>> list=jdbcTemplate.query(sql,
1011 new RowMapper<Map<String, Object>>(){ 1013 new RowMapper<Map<String, Object>>(){
@@ -1212,4 +1214,72 @@ public class BigdataService { @@ -1212,4 +1214,72 @@ public class BigdataService {
1212 return list; 1214 return list;
1213 } 1215 }
1214 1216
  1217 + @GET
  1218 + @Path("/departureTime/starDate/{starDate}/endDate/{endDate}/line/{line}")
  1219 + public List<Map<String, Object>> departureTime(@PathParam("starDate") String starDate,
  1220 + @PathParam("endDate") String endDate,@PathParam("line") String line) {
  1221 + String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz,"
  1222 + + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz,"
  1223 + + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz,"
  1224 + + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
  1225 + + " jhszfcs,sjszfczds,szfczdl,"
  1226 + + " create_date from bsth_c_calc_count "
  1227 + + " where date>='"+starDate+"' and date<= '"+endDate+"'";
  1228 + if(!line.equals("all")){
  1229 + sql +=" and xl='"+line+"'";
  1230 + }
  1231 +
  1232 + List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1233 + new RowMapper<Map<String, Object>>(){
  1234 + @Override
  1235 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1236 + Map<String, Object> m=new HashMap<String,Object>();
  1237 + m.put("lineCode",rs.getString("xl"));
  1238 + m.put("lineName", rs.getString("xl_name"));
  1239 + m.put("date", rs.getString("date"));
  1240 +
  1241 + m.put("jhbc", rs.getString("jhbc"));
  1242 + m.put("sjbc", rs.getString("sjbc"));
  1243 + m.put("bczxl", rs.getString("bczxl"));
  1244 + m.put("jhbcz", rs.getString("jhbcz"));
  1245 +
  1246 + m.put("jhcc", rs.getString("jhcc"));
  1247 + m.put("sjcc", rs.getString("sjcc"));
  1248 + m.put("ccl", rs.getString("ccl"));
  1249 + m.put("jhccz", rs.getString("jhccz"));
  1250 +
  1251 + m.put("jhyylc", rs.getString("jhyylc"));
  1252 + m.put("sjyylc", rs.getString("sjyylc"));
  1253 + m.put("jhyylcz", rs.getString("jhyylcz"));
  1254 + m.put("jhkslc", rs.getString("jhkslc"));
  1255 + m.put("sjkslc", rs.getString("sjkslc"));
  1256 + m.put("jhkslcz", rs.getString("jhkslcz"));
  1257 +
  1258 + m.put("jhgfbcs", rs.getString("jhssgfbcs"));
  1259 + m.put("sjgfbcs", rs.getString("sjgfbcs"));
  1260 + m.put("jhgfbcsz", rs.getString("jhgfbcsz"));
  1261 + m.put("jhdgbcs", rs.getString("jhssdgbcs"));
  1262 + m.put("sjdgbcs", rs.getString("sjdgbcs"));
  1263 + m.put("jhdgbcsz", rs.getString("jhdgbcsz"));
  1264 +
  1265 + m.put("jhsmbcs", rs.getString("jhsmbcs"));
  1266 + m.put("sjsmbczds", rs.getString("sjsmbczds"));
  1267 + m.put("smbczdl", rs.getString("smbczdl"));
  1268 + m.put("jhsmbcsz", rs.getString("jhsmbcsz"));
  1269 + m.put("sjsmbczdsz", rs.getString("sjsmbczdsz"));
  1270 + m.put("smbczdlz", rs.getString("smbczdlz"));
  1271 +
  1272 + m.put("jhszfcs", rs.getString("jhszfcs"));
  1273 + m.put("sjszfczds", rs.getString("sjszfczds"));
  1274 + m.put("szfczdl", rs.getString("szfczdl"));
  1275 +
  1276 + Date date = new Date();
  1277 + date.setTime(rs.getTimestamp("create_date").getTime());
  1278 + m.put("createDate", sdf.format(date));
  1279 + return m;
  1280 + }
  1281 + });
  1282 + return list;
  1283 + }
  1284 +
1215 } 1285 }