Commit a9f3aed72b3f647c79ade05bc5d429f6f6b05fa8

Authored by 娄高锋
1 parent c4af1f7e

筛掉临港线路;给电科手机端的线路指标接口。

src/main/java/com/bsth/server_rs/bigdata/BigscreenService.java
@@ -257,15 +257,19 @@ public class BigscreenService { @@ -257,15 +257,19 @@ public class BigscreenService {
257 } 257 }
258 258
259 259
  260 + List<String> objList = new ArrayList<String>();
260 String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz," 261 String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz,"
261 + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz," 262 + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz,"
262 + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz," 263 + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz,"
263 + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz," 264 + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
264 + " jhszfcs,sjszfczds,szfczdl,create_date" 265 + " jhszfcs,sjszfczds,szfczdl,create_date"
265 - + " from bsth_c_calc_count "  
266 - + " where date >= '"+date2+"' and date <= '"+date+"'"; 266 + + " from bsth_c_calc_count where gsdm != '77'"
  267 + + " and date >= ? and date <= ?";
  268 + objList.add(date2);
  269 + objList.add(date);
267 270
268 List<Map<String, Object>> list=jdbcTemplate.query(sql, 271 List<Map<String, Object>> list=jdbcTemplate.query(sql,
  272 + objList.toArray(),
269 new RowMapper<Map<String, Object>>(){ 273 new RowMapper<Map<String, Object>>(){
270 @Override 274 @Override
271 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 275 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -414,7 +418,7 @@ public class BigscreenService { @@ -414,7 +418,7 @@ public class BigscreenService {
414 Map<String, Object> qkMap = qkList.get(datesMap.get(d)); 418 Map<String, Object> qkMap = qkList.get(datesMap.get(d));
415 long jh = 0, sj = 0; 419 long jh = 0, sj = 0;
416 for(ScheduleRealInfo s : findAll){ 420 for(ScheduleRealInfo s : findAll){
417 - if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路 421 + if(!("77".equals(s.getGsBm())) && s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路
418 if(!isInOut(s) && !s.isCcService() && s.getStatus() != -1 && s.getStatus() != 0){ 422 if(!isInOut(s) && !s.isCcService() && s.getStatus() != -1 && s.getStatus() != 0){
419 ++jh; 423 ++jh;
420 String sty = decimalToBinary(s.getRfidState()); 424 String sty = decimalToBinary(s.getRfidState());
@@ -468,7 +472,7 @@ public class BigscreenService { @@ -468,7 +472,7 @@ public class BigscreenService {
468 List<ScheduleRealInfo> listSche = new ArrayList<ScheduleRealInfo>(); 472 List<ScheduleRealInfo> listSche = new ArrayList<ScheduleRealInfo>();
469 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); 473 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
470 for(ScheduleRealInfo s : findAll){ 474 for(ScheduleRealInfo s : findAll){
471 - if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路 475 + if(!("77".equals(s.getGsBm())) && s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路
472 listSche.add(s); 476 listSche.add(s);
473 Set<ChildTaskPlan> cts = s.getcTasks(); 477 Set<ChildTaskPlan> cts = s.getcTasks();
474 if (cts != null && cts.size() > 0) { 478 if (cts != null && cts.size() > 0) {
@@ -688,15 +692,20 @@ public class BigscreenService { @@ -688,15 +692,20 @@ public class BigscreenService {
688 } 692 }
689 693
690 694
  695 + List<String> objList = new ArrayList<String>();
691 String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz," 696 String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz,"
692 + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz," 697 + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz,"
693 + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz," 698 + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz,"
694 + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz," 699 + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
695 + " jhszfcs,sjszfczds,szfczdl,create_date" 700 + " jhszfcs,sjszfczds,szfczdl,create_date"
696 + " from bsth_c_calc_count " 701 + " from bsth_c_calc_count "
697 - + " where date >= '"+date2+"' and date <= '"+date+"' and gsdm = '"+gsdm+"'"; 702 + + " where date >= ? and date <= ? and gsdm = ?";
  703 + objList.add(date2);
  704 + objList.add(date);
  705 + objList.add(gsdm);
698 706
699 List<Map<String, Object>> list=jdbcTemplate.query(sql, 707 List<Map<String, Object>> list=jdbcTemplate.query(sql,
  708 + objList.toArray(),
700 new RowMapper<Map<String, Object>>(){ 709 new RowMapper<Map<String, Object>>(){
701 @Override 710 @Override
702 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 711 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -1065,13 +1074,14 @@ public class BigscreenService { @@ -1065,13 +1074,14 @@ public class BigscreenService {
1065 } 1074 }
1066 } 1075 }
1067 1076
  1077 +
1068 String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz," 1078 String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz,"
1069 + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz," 1079 + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz,"
1070 + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz," 1080 + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz,"
1071 + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz," 1081 + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
1072 + " jhszfcs,sjszfczds,szfczdl,create_date" 1082 + " jhszfcs,sjszfczds,szfczdl,create_date"
1073 + " from bsth_c_calc_count " 1083 + " from bsth_c_calc_count "
1074 - + " where date = ? "; 1084 + + " where date = ? and gsdm != '77'";
1075 1085
1076 List<Map<String, Object>> list=jdbcTemplate.query(sql, new Object[]{date}, 1086 List<Map<String, Object>> list=jdbcTemplate.query(sql, new Object[]{date},
1077 new RowMapper<Map<String, Object>>(){ 1087 new RowMapper<Map<String, Object>>(){
@@ -1197,6 +1207,431 @@ public class BigscreenService { @@ -1197,6 +1207,431 @@ public class BigscreenService {
1197 return JSON.parseObject(JSON.toJSONString(resMap)); 1207 return JSON.parseObject(JSON.toJSONString(resMap));
1198 } 1208 }
1199 1209
  1210 + /**给电科手机端查线路指标(出车率)
  1211 + *
  1212 + */
  1213 + @GET
  1214 + @Path("/selectData/getDepartureBus/{company}/{branchCompany}")
  1215 + public JSONObject getDepartureBus(@PathParam("company") String company,
  1216 + @PathParam("branchCompany") String branchCompany){
  1217 + Map<String, Object> resMap = new HashMap<String, Object>();
  1218 + String date = sd.format(new Date());
  1219 + String gs = "", fgs = "";
  1220 + if(company.trim().length() > 0 && !("all".equals(company.trim()))){
  1221 + gs = company.trim();
  1222 + }
  1223 + if(branchCompany.trim().length() > 0 && !("all".equals(branchCompany.trim()))){
  1224 + fgs = branchCompany.trim();
  1225 + }
  1226 +
  1227 + String yyxlSql="SELECT line_code from bsth_c_line "
  1228 + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')";
  1229 + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql,
  1230 + new RowMapper<Map<String, Object>>(){
  1231 + @Override
  1232 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1233 + Map<String, Object> m=new HashMap<String,Object>();
  1234 + m.put("lineCode", rs.getString("line_code"));
  1235 + return m;
  1236 + }
  1237 + });
  1238 + Set<String> yyLine = new HashSet<String>();
  1239 + for(Map<String, Object> t : yyxlList){
  1240 + if(t.get("lineCode") != null){
  1241 + yyLine.add(t.get("lineCode").toString());
  1242 + }
  1243 + }
  1244 +
  1245 + List<String> objList = new ArrayList<String>();
  1246 + String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz,"
  1247 + + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz,"
  1248 + + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz,"
  1249 + + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
  1250 + + " jhszfcs,sjszfczds,szfczdl,create_date"
  1251 + + " from bsth_c_calc_count "
  1252 + + " where date = ? and gsdm != '77'";
  1253 + objList.add(date);
  1254 + if(fgs.length() > 0){
  1255 + sql +=" and gsdm = ? and fgsdm = ?";
  1256 + objList.add(gs);
  1257 + objList.add(fgs);
  1258 + } else if(gs.length() > 0){
  1259 + sql +=" and gsdm = ?";
  1260 + objList.add(gs);
  1261 + }
  1262 +
  1263 + List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1264 + objList.toArray(),
  1265 + new RowMapper<Map<String, Object>>(){
  1266 + @Override
  1267 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1268 + Map<String, Object> m=new HashMap<String,Object>();
  1269 + m.put("lineCode",rs.getString("xl"));
  1270 + m.put("lineName", rs.getString("xl_name"));
  1271 + m.put("date", rs.getString("date"));
  1272 +
  1273 + m.put("jhcc", rs.getString("jhcc"));
  1274 + m.put("sjcc", rs.getString("sjcc"));
  1275 + m.put("jhccz", rs.getString("jhccz"));
  1276 +
  1277 + Date date = new Date();
  1278 + date.setTime(rs.getTimestamp("create_date").getTime());
  1279 + m.put("createDate", sdf.format(date));
  1280 + return m;
  1281 + }
  1282 + });
  1283 +
  1284 + List<Map<String, Object>> detailsList = new ArrayList<Map<String, Object>>();
  1285 +
  1286 + long jh = 0, sj = 0;
  1287 +
  1288 + for(Map<String, Object> t : list){
  1289 + if(yyLine.contains(t.get("lineCode").toString())){
  1290 +
  1291 + Long plan = Long.valueOf(t.get("jhccz").toString());
  1292 + Long real = Long.valueOf(t.get("sjcc").toString());
  1293 +
  1294 + jh += plan;
  1295 + sj += real;
  1296 +
  1297 + Map<String, Object> detail = new HashMap<String, Object>();
  1298 + detail.put("lineName", t.get("lineName").toString());
  1299 + detail.put("plan", plan);
  1300 + detail.put("real", real);
  1301 + detail.put("ratio", plan>0?new BigDecimal(real*100l).divide(
  1302 + new BigDecimal(plan), 2, BigDecimal.ROUND_HALF_UP).doubleValue():"0");
  1303 + detailsList.add(detail);
  1304 + }
  1305 + }
  1306 +
  1307 + resMap.put("plan", jh);
  1308 + resMap.put("real", sj);
  1309 + resMap.put("ratio", jh>0?new BigDecimal(sj*100l).divide(
  1310 + new BigDecimal(jh), 2, BigDecimal.ROUND_HALF_UP).doubleValue():"0");
  1311 +
  1312 + resMap.put("detailsList", detailsList);
  1313 +
  1314 + return JSON.parseObject(JSON.toJSONString(resMap));
  1315 + }
  1316 +
  1317 + /**给电科手机端查线路指标(班次执行率)
  1318 + *
  1319 + */
  1320 + @GET
  1321 + @Path("/selectData/getFinishScheduleBus/{company}/{branchCompany}")
  1322 + public JSONObject getFinishScheduleBus(@PathParam("company") String company,
  1323 + @PathParam("branchCompany") String branchCompany){
  1324 + Map<String, Object> resMap = new HashMap<String, Object>();
  1325 + String date = sd.format(new Date());
  1326 + String gs = "", fgs = "";
  1327 + if(company.trim().length() > 0 && !("all".equals(company.trim()))){
  1328 + gs = company.trim();
  1329 + }
  1330 + if(branchCompany.trim().length() > 0 && !("all".equals(branchCompany.trim()))){
  1331 + fgs = branchCompany.trim();
  1332 + }
  1333 +
  1334 + String yyxlSql="SELECT line_code from bsth_c_line "
  1335 + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')";
  1336 + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql,
  1337 + new RowMapper<Map<String, Object>>(){
  1338 + @Override
  1339 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1340 + Map<String, Object> m=new HashMap<String,Object>();
  1341 + m.put("lineCode", rs.getString("line_code"));
  1342 + return m;
  1343 + }
  1344 + });
  1345 + Set<String> yyLine = new HashSet<String>();
  1346 + for(Map<String, Object> t : yyxlList){
  1347 + if(t.get("lineCode") != null){
  1348 + yyLine.add(t.get("lineCode").toString());
  1349 + }
  1350 + }
  1351 +
  1352 + List<String> objList = new ArrayList<String>();
  1353 + String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz,"
  1354 + + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz,"
  1355 + + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz,"
  1356 + + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
  1357 + + " jhszfcs,sjszfczds,szfczdl,create_date"
  1358 + + " from bsth_c_calc_count "
  1359 + + " where date = ? and gsdm != '77'";
  1360 + objList.add(date);
  1361 + if(fgs.length() > 0){
  1362 + sql +=" and gsdm = ? and fgsdm = ?";
  1363 + objList.add(gs);
  1364 + objList.add(fgs);
  1365 + } else if(gs.length() > 0){
  1366 + sql +=" and gsdm = ?";
  1367 + objList.add(gs);
  1368 + }
  1369 +
  1370 + List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1371 + objList.toArray(),
  1372 + new RowMapper<Map<String, Object>>(){
  1373 + @Override
  1374 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1375 + Map<String, Object> m=new HashMap<String,Object>();
  1376 + m.put("lineCode",rs.getString("xl"));
  1377 + m.put("lineName", rs.getString("xl_name"));
  1378 + m.put("date", rs.getString("date"));
  1379 +
  1380 + m.put("jhbc", rs.getString("jhbc"));
  1381 + m.put("sjbc", rs.getString("sjbc"));
  1382 +
  1383 + Date date = new Date();
  1384 + date.setTime(rs.getTimestamp("create_date").getTime());
  1385 + m.put("createDate", sdf.format(date));
  1386 + return m;
  1387 + }
  1388 + });
  1389 +
  1390 + List<Map<String, Object>> detailsList = new ArrayList<Map<String, Object>>();
  1391 +
  1392 + long jh = 0, sj = 0;
  1393 +
  1394 + for(Map<String, Object> t : list){
  1395 + if(yyLine.contains(t.get("lineCode").toString())){
  1396 +
  1397 + Long plan = Long.valueOf(t.get("jhbc").toString());
  1398 + Long real = Long.valueOf(t.get("sjbc").toString());
  1399 +
  1400 + jh += plan;
  1401 + sj += real;
  1402 +
  1403 + Map<String, Object> detail = new HashMap<String, Object>();
  1404 + detail.put("lineName", t.get("lineName").toString());
  1405 + detail.put("plan", plan);
  1406 + detail.put("real", real);
  1407 + detail.put("ratio", plan>0?new BigDecimal(real*100l).divide(
  1408 + new BigDecimal(plan), 2, BigDecimal.ROUND_HALF_UP).doubleValue():"0");
  1409 + detailsList.add(detail);
  1410 + }
  1411 + }
  1412 +
  1413 + resMap.put("plan", jh);
  1414 + resMap.put("real", sj);
  1415 + resMap.put("ratio", jh>0?new BigDecimal(sj*100l).divide(
  1416 + new BigDecimal(jh), 2, BigDecimal.ROUND_HALF_UP).doubleValue():"0");
  1417 +
  1418 + resMap.put("detailsList", detailsList);
  1419 +
  1420 + return JSON.parseObject(JSON.toJSONString(resMap));
  1421 + }
  1422 +
  1423 + /**给电科手机端查线路指标(首末班车发车准点率)
  1424 + *
  1425 + */
  1426 + @GET
  1427 + @Path("/selectData/getBeginAndEnd/{company}/{branchCompany}")
  1428 + public JSONObject getBeginAndEnd(@PathParam("company") String company,
  1429 + @PathParam("branchCompany") String branchCompany){
  1430 + Map<String, Object> resMap = new HashMap<String, Object>();
  1431 + String date = sd.format(new Date());
  1432 + String gs = "", fgs = "";
  1433 + if(company.trim().length() > 0 && !("all".equals(company.trim()))){
  1434 + gs = company.trim();
  1435 + }
  1436 + if(branchCompany.trim().length() > 0 && !("all".equals(branchCompany.trim()))){
  1437 + fgs = branchCompany.trim();
  1438 + }
  1439 +
  1440 + String yyxlSql="SELECT line_code from bsth_c_line "
  1441 + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')";
  1442 + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql,
  1443 + new RowMapper<Map<String, Object>>(){
  1444 + @Override
  1445 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1446 + Map<String, Object> m=new HashMap<String,Object>();
  1447 + m.put("lineCode", rs.getString("line_code"));
  1448 + return m;
  1449 + }
  1450 + });
  1451 + Set<String> yyLine = new HashSet<String>();
  1452 + for(Map<String, Object> t : yyxlList){
  1453 + if(t.get("lineCode") != null){
  1454 + yyLine.add(t.get("lineCode").toString());
  1455 + }
  1456 + }
  1457 +
  1458 + List<String> objList = new ArrayList<String>();
  1459 + String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz,"
  1460 + + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz,"
  1461 + + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz,"
  1462 + + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
  1463 + + " jhszfcs,sjszfczds,szfczdl,create_date"
  1464 + + " from bsth_c_calc_count "
  1465 + + " where date = ? and gsdm != '77'";
  1466 + objList.add(date);
  1467 + if(fgs.length() > 0){
  1468 + sql +=" and gsdm = ? and fgsdm = ?";
  1469 + objList.add(gs);
  1470 + objList.add(fgs);
  1471 + } else if(gs.length() > 0){
  1472 + sql +=" and gsdm = ?";
  1473 + objList.add(gs);
  1474 + }
  1475 +
  1476 + List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1477 + objList.toArray(),
  1478 + new RowMapper<Map<String, Object>>(){
  1479 + @Override
  1480 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1481 + Map<String, Object> m=new HashMap<String,Object>();
  1482 + m.put("lineCode",rs.getString("xl"));
  1483 + m.put("lineName", rs.getString("xl_name"));
  1484 + m.put("date", rs.getString("date"));
  1485 +
  1486 + m.put("jhsmbcs", rs.getString("jhsmbcs"));
  1487 + m.put("sjsmbczds", rs.getString("sjsmbczds"));
  1488 +
  1489 + Date date = new Date();
  1490 + date.setTime(rs.getTimestamp("create_date").getTime());
  1491 + m.put("createDate", sdf.format(date));
  1492 + return m;
  1493 + }
  1494 + });
  1495 +
  1496 + List<Map<String, Object>> detailsList = new ArrayList<Map<String, Object>>();
  1497 +
  1498 + long jh = 0, sj = 0;
  1499 +
  1500 + for(Map<String, Object> t : list){
  1501 + if(yyLine.contains(t.get("lineCode").toString())){
  1502 +
  1503 + Long plan = Long.valueOf(t.get("jhsmbcs").toString());
  1504 + Long real = Long.valueOf(t.get("sjsmbczds").toString());
  1505 +
  1506 + jh += plan;
  1507 + sj += real;
  1508 +
  1509 + Map<String, Object> detail = new HashMap<String, Object>();
  1510 + detail.put("lineName", t.get("lineName").toString());
  1511 + detail.put("plan", plan);
  1512 + detail.put("real", real);
  1513 + detail.put("ratio", plan>0?new BigDecimal(real*100l).divide(
  1514 + new BigDecimal(plan), 2, BigDecimal.ROUND_HALF_UP).doubleValue():"0");
  1515 + detailsList.add(detail);
  1516 + }
  1517 + }
  1518 +
  1519 + resMap.put("plan", jh);
  1520 + resMap.put("real", sj);
  1521 + resMap.put("ratio", jh>0?new BigDecimal(sj*100l).divide(
  1522 + new BigDecimal(jh), 2, BigDecimal.ROUND_HALF_UP).doubleValue():"0");
  1523 +
  1524 + resMap.put("detailsList", detailsList);
  1525 +
  1526 + return JSON.parseObject(JSON.toJSONString(resMap));
  1527 + }
  1528 +
  1529 + /**给电科手机端查线路指标(发车准点率)
  1530 + *
  1531 + */
  1532 + @GET
  1533 + @Path("/selectData/getPunctualBus/{company}/{branchCompany}")
  1534 + public JSONObject getPunctualBus(@PathParam("company") String company,
  1535 + @PathParam("branchCompany") String branchCompany){
  1536 + Map<String, Object> resMap = new HashMap<String, Object>();
  1537 + String date = sd.format(new Date());
  1538 + String gs = "", fgs = "";
  1539 + if(company.trim().length() > 0 && !("all".equals(company.trim()))){
  1540 + gs = company.trim();
  1541 + }
  1542 + if(branchCompany.trim().length() > 0 && !("all".equals(branchCompany.trim()))){
  1543 + fgs = branchCompany.trim();
  1544 + }
  1545 +
  1546 + String yyxlSql="SELECT line_code from bsth_c_line "
  1547 + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')";
  1548 + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql,
  1549 + new RowMapper<Map<String, Object>>(){
  1550 + @Override
  1551 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1552 + Map<String, Object> m=new HashMap<String,Object>();
  1553 + m.put("lineCode", rs.getString("line_code"));
  1554 + return m;
  1555 + }
  1556 + });
  1557 + Set<String> yyLine = new HashSet<String>();
  1558 + for(Map<String, Object> t : yyxlList){
  1559 + if(t.get("lineCode") != null){
  1560 + yyLine.add(t.get("lineCode").toString());
  1561 + }
  1562 + }
  1563 +
  1564 + List<String> objList = new ArrayList<String>();
  1565 + String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz,"
  1566 + + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz,"
  1567 + + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz,"
  1568 + + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
  1569 + + " jhszfcs,sjszfczds,szfczdl,create_date"
  1570 + + " from bsth_c_calc_count "
  1571 + + " where date = ? and gsdm != '77'";
  1572 + objList.add(date);
  1573 + if(fgs.length() > 0){
  1574 + sql +=" and gsdm = ? and fgsdm = ?";
  1575 + objList.add(gs);
  1576 + objList.add(fgs);
  1577 + } else if(gs.length() > 0){
  1578 + sql +=" and gsdm = ?";
  1579 + objList.add(gs);
  1580 + }
  1581 +
  1582 + List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1583 + objList.toArray(),
  1584 + new RowMapper<Map<String, Object>>(){
  1585 + @Override
  1586 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1587 + Map<String, Object> m=new HashMap<String,Object>();
  1588 + m.put("lineCode",rs.getString("xl"));
  1589 + m.put("lineName", rs.getString("xl_name"));
  1590 + m.put("date", rs.getString("date"));
  1591 +
  1592 + m.put("jhszfcs", rs.getString("jhszfcs"));
  1593 + m.put("sjszfczds", rs.getString("sjszfczds"));
  1594 +
  1595 + Date date = new Date();
  1596 + date.setTime(rs.getTimestamp("create_date").getTime());
  1597 + m.put("createDate", sdf.format(date));
  1598 + return m;
  1599 + }
  1600 + });
  1601 +
  1602 + List<Map<String, Object>> detailsList = new ArrayList<Map<String, Object>>();
  1603 +
  1604 + long jh = 0, sj = 0;
  1605 +
  1606 + for(Map<String, Object> t : list){
  1607 + if(yyLine.contains(t.get("lineCode").toString())){
  1608 +
  1609 + Long plan = Long.valueOf(t.get("jhszfcs").toString());
  1610 + Long real = Long.valueOf(t.get("sjszfczds").toString());
  1611 +
  1612 + jh += plan;
  1613 + sj += real;
  1614 +
  1615 + Map<String, Object> detail = new HashMap<String, Object>();
  1616 + detail.put("lineName", t.get("lineName").toString());
  1617 + detail.put("plan", plan);
  1618 + detail.put("real", real);
  1619 + detail.put("ratio", plan>0?new BigDecimal(real*100l).divide(
  1620 + new BigDecimal(plan), 2, BigDecimal.ROUND_HALF_UP).doubleValue():"0");
  1621 + detailsList.add(detail);
  1622 + }
  1623 + }
  1624 +
  1625 + resMap.put("plan", jh);
  1626 + resMap.put("real", sj);
  1627 + resMap.put("ratio", jh>0?new BigDecimal(sj*100l).divide(
  1628 + new BigDecimal(jh), 2, BigDecimal.ROUND_HALF_UP).doubleValue():"0");
  1629 +
  1630 + resMap.put("detailsList", detailsList);
  1631 +
  1632 + return JSON.parseObject(JSON.toJSONString(resMap));
  1633 + }
  1634 +
1200 @GET 1635 @GET
1201 @Path("/selectData/attendance") 1636 @Path("/selectData/attendance")
1202 public JSONObject attendance(){ 1637 public JSONObject attendance(){
@@ -1252,7 +1687,7 @@ public class BigscreenService { @@ -1252,7 +1687,7 @@ public class BigscreenService {
1252 List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAll(dates[i]); 1687 List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAll(dates[i]);
1253 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); 1688 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
1254 for(ScheduleRealInfo s : findAll){ 1689 for(ScheduleRealInfo s : findAll){
1255 - if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路 1690 + if(!("77".equals(s.getGsBm())) && s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路
1256 if(!isInOut(s)){ 1691 if(!isInOut(s)){
1257 Set<ChildTaskPlan> cts = s.getcTasks(); 1692 Set<ChildTaskPlan> cts = s.getcTasks();
1258 if (cts != null && cts.size() > 0) { 1693 if (cts != null && cts.size() > 0) {
@@ -1278,7 +1713,7 @@ public class BigscreenService { @@ -1278,7 +1713,7 @@ public class BigscreenService {
1278 1713
1279 for(ScheduleRealInfo s : findAll){ 1714 for(ScheduleRealInfo s : findAll){
1280 try { 1715 try {
1281 - if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路 1716 + if(!("77".equals(s.getGsBm())) && s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路
1282 if (s.isSflj() || isInOut(s)){ 1717 if (s.isSflj() || isInOut(s)){
1283 continue; 1718 continue;
1284 } 1719 }
@@ -1740,7 +2175,7 @@ public class BigscreenService { @@ -1740,7 +2175,7 @@ public class BigscreenService {
1740 + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz," 2175 + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
1741 + " jhszfcs,sjszfczds,szfczdl,jhzgl,sjzgl,create_date" 2176 + " jhszfcs,sjszfczds,szfczdl,jhzgl,sjzgl,create_date"
1742 + " from bsth_c_calc_count " 2177 + " from bsth_c_calc_count "
1743 - + " where date like '%"+month+"%'"; 2178 + + " where date like '%"+month+"%' and gsdm != '77'";
1744 2179
1745 List<Map<String, Object>> list=jdbcTemplate.query(sql, 2180 List<Map<String, Object>> list=jdbcTemplate.query(sql,
1746 new RowMapper<Map<String, Object>>(){ 2181 new RowMapper<Map<String, Object>>(){
@@ -2091,9 +2526,9 @@ public class BigscreenService { @@ -2091,9 +2526,9 @@ public class BigscreenService {
2091 + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz," 2526 + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
2092 + " jhszfcs,sjszfczds,szfczdl,jhzgl,sjzgl,create_date" 2527 + " jhszfcs,sjszfczds,szfczdl,jhzgl,sjzgl,create_date"
2093 + " from bsth_c_calc_count " 2528 + " from bsth_c_calc_count "
2094 - + " where date = '"+date+"'"; 2529 + + " where date = ? and gsdm != '77'";
2095 2530
2096 - List<Map<String, Object>> list=jdbcTemplate.query(sql, 2531 + List<Map<String, Object>> list=jdbcTemplate.query(sql, new Object[]{date},
2097 new RowMapper<Map<String, Object>>(){ 2532 new RowMapper<Map<String, Object>>(){
2098 @Override 2533 @Override
2099 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 2534 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -2214,7 +2649,7 @@ public class BigscreenService { @@ -2214,7 +2649,7 @@ public class BigscreenService {
2214 List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAll(date); 2649 List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAll(date);
2215 long jh = 0, sj = 0; 2650 long jh = 0, sj = 0;
2216 for(ScheduleRealInfo s : findAll){ 2651 for(ScheduleRealInfo s : findAll){
2217 - if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路 2652 + if(!("77".equals(s.getGsBm())) && s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路
2218 if(!isInOut(s) && !s.isCcService() && s.getStatus() != -1 && s.getStatus() != 0){ 2653 if(!isInOut(s) && !s.isCcService() && s.getStatus() != -1 && s.getStatus() != 0){
2219 if(s.getGsBm()!=null && sortMap.get(gsMap.get(s.getGsBm()!=null?s.getGsBm():"")) != null){ 2654 if(s.getGsBm()!=null && sortMap.get(gsMap.get(s.getGsBm()!=null?s.getGsBm():"")) != null){
2220 Map<String, Object> m = resList.get(sortMap.get(gsMap.get(s.getGsBm()))); 2655 Map<String, Object> m = resList.get(sortMap.get(gsMap.get(s.getGsBm())));
@@ -2381,8 +2816,9 @@ public class BigscreenService { @@ -2381,8 +2816,9 @@ public class BigscreenService {
2381 } 2816 }
2382 } 2817 }
2383 2818
2384 - String calcIntervalSql = "select * from bsth_c_calc_interval where date = '"+date+"' and sfyy = 1"; 2819 + String calcIntervalSql = "select * from bsth_c_calc_interval where date = ? and sfyy = 1 and gsbm != '77'";
2385 List<Map<String, Object>> calcIntervalList=jdbcTemplate.query(calcIntervalSql, 2820 List<Map<String, Object>> calcIntervalList=jdbcTemplate.query(calcIntervalSql,
  2821 + new Object[]{date},
2386 new RowMapper<Map<String, Object>>(){ 2822 new RowMapper<Map<String, Object>>(){
2387 @Override 2823 @Override
2388 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 2824 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -2397,8 +2833,9 @@ public class BigscreenService { @@ -2397,8 +2833,9 @@ public class BigscreenService {
2397 } 2833 }
2398 }); 2834 });
2399 2835
2400 - String calcIntervalDetailSql = "select * from bsth_c_calc_interval_detail where date = '"+date+"'"; 2836 + String calcIntervalDetailSql = "select * from bsth_c_calc_interval_detail where date = ?";
2401 List<Map<String, Object>> calcIntervalDetailList=jdbcTemplate.query(calcIntervalDetailSql, 2837 List<Map<String, Object>> calcIntervalDetailList=jdbcTemplate.query(calcIntervalDetailSql,
  2838 + new Object[]{date},
2402 new RowMapper<Map<String, Object>>(){ 2839 new RowMapper<Map<String, Object>>(){
2403 @Override 2840 @Override
2404 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 2841 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -2480,8 +2917,9 @@ public class BigscreenService { @@ -2480,8 +2917,9 @@ public class BigscreenService {
2480 d.setTime(d.getTime() - l*1000*60*60*24); 2917 d.setTime(d.getTime() - l*1000*60*60*24);
2481 String date1 = sdf.format(d); 2918 String date1 = sdf.format(d);
2482 2919
2483 - String calcIntervalSql = "select * from bsth_c_calc_interval where date = '"+date1+"' and sfyy = 1"; 2920 + String calcIntervalSql = "select * from bsth_c_calc_interval where date = ? and sfyy = 1 and gsbm != '77'";
2484 List<Map<String, Object>> calcIntervalList=jdbcTemplate.query(calcIntervalSql, 2921 List<Map<String, Object>> calcIntervalList=jdbcTemplate.query(calcIntervalSql,
  2922 + new Object[]{date1},
2485 new RowMapper<Map<String, Object>>(){ 2923 new RowMapper<Map<String, Object>>(){
2486 @Override 2924 @Override
2487 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { 2925 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -2567,9 +3005,10 @@ public class BigscreenService { @@ -2567,9 +3005,10 @@ public class BigscreenService {
2567 String minfcsj="02:00"; 3005 String minfcsj="02:00";
2568 String sqlMinYysj="select start_opt from bsth_c_line_config where " 3006 String sqlMinYysj="select start_opt from bsth_c_line_config where "
2569 + " id = (" 3007 + " id = ("
2570 - + "select max(id) from bsth_c_line_config where line ='"+ lineCode +"'" 3008 + + "select max(id) from bsth_c_line_config where line = ?"
2571 + ")"; 3009 + ")";
2572 List<String> list= jdbcTemplate.query(sqlMinYysj, 3010 List<String> list= jdbcTemplate.query(sqlMinYysj,
  3011 + new Object[]{lineCode},
2573 new RowMapper<String>(){ 3012 new RowMapper<String>(){
2574 @Override 3013 @Override
2575 public String mapRow(ResultSet rs, int rowNum) throws SQLException { 3014 public String mapRow(ResultSet rs, int rowNum) throws SQLException {
@@ -2595,7 +3034,7 @@ public class BigscreenService { @@ -2595,7 +3034,7 @@ public class BigscreenService {
2595 if(s.getBcType().equals("region") || isInOut(s)){ 3034 if(s.getBcType().equals("region") || isInOut(s)){
2596 continue; //区间班次与空驶班次不做首末班统计 3035 continue; //区间班次与空驶班次不做首末班统计
2597 } 3036 }
2598 - if(yyLine.containsKey(s.getXlBm())){ //只统计营运线路 3037 + if(!("77".equals(s.getGsBm())) && yyLine.containsKey(s.getXlBm())){ //只统计营运线路
2599 if(!(keyMap.containsKey(s.getXlBm()))){ 3038 if(!(keyMap.containsKey(s.getXlBm()))){
2600 keyMap.put(s.getXlBm(), new ArrayList<ScheduleRealInfo>()); 3039 keyMap.put(s.getXlBm(), new ArrayList<ScheduleRealInfo>());
2601 } 3040 }
@@ -2843,7 +3282,7 @@ public class BigscreenService { @@ -2843,7 +3282,7 @@ public class BigscreenService {
2843 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); 3282 List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>();
2844 Map<String, ScheduleRealInfo> scheduleMap = new HashMap<String, ScheduleRealInfo>(); 3283 Map<String, ScheduleRealInfo> scheduleMap = new HashMap<String, ScheduleRealInfo>();
2845 for(ScheduleRealInfo s : findAll){ 3284 for(ScheduleRealInfo s : findAll){
2846 - if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路 3285 + if(!("77".equals(s.getGsBm())) && s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路
2847 Set<ChildTaskPlan> cts = s.getcTasks(); 3286 Set<ChildTaskPlan> cts = s.getcTasks();
2848 if (cts != null && cts.size() > 0) { 3287 if (cts != null && cts.size() > 0) {
2849 list_s.add(s); 3288 list_s.add(s);