Commit 1b24416bec36fd61f71d8eb1eacbb9e8df6063bc

Authored by 娄高锋
1 parent 5fb2e6f8

SQL注入漏洞;

src/main/java/com/bsth/server_rs/bigdata/BigdataService.java
... ... @@ -103,9 +103,11 @@ public class BigdataService {
103 103 }
104 104 public Map<String, Long> getEndtime(String date){
105 105 Map<String, Long> map=new HashMap<String,Long>();
  106 + List<String> objList = new ArrayList<String>();
106 107 String sql="select xl,endtime from bsth_c_calc_count "
107   - + " where date='"+date+"' ";
108   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  108 + + " where date = ? ";
  109 + objList.add(date);
  110 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
109 111 new RowMapper<Map<String, Object>>(){
110 112 @Override
111 113 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -203,13 +205,15 @@ public class BigdataService {
203 205 @GET
204 206 @Path("/line/company/{companyId}")
205 207 public List<Map<String, Object>> findLineByCompany(@PathParam("companyId") String companyId) {
  208 + List<String> objList = new ArrayList<String>();
206 209 String sql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level,"
207 210 + " a.shanghai_linecode, a.nature from "
208 211 + " bsth_c_line a left join bsth_c_line_config b "
209 212 + " on a.id=b.line where "
210 213 + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 "
211   - + " and a.remove=0 and a.company = '"+companyId+"'";
212   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  214 + + " and a.remove=0 and a.company = ?";
  215 + objList.add(companyId);
  216 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
213 217 new RowMapper<Map<String, Object>>(){
214 218 @Override
215 219 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -281,13 +285,15 @@ public class BigdataService {
281 285 @GET
282 286 @Path("/line/{lineCode}")
283 287 public List<Map<String, Object>> findLineByCode(@PathParam("lineCode") String lineCode) {
  288 + List<String> objList = new ArrayList<String>();
284 289 String sql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level,"
285 290 + " a.shanghai_linecode, a.nature from "
286 291 + " bsth_c_line a left join bsth_c_line_config b "
287 292 + " on a.id=b.line where "
288 293 + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 "
289   - + " and a.remove=0 and a.line_code = '"+lineCode+"'";
290   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  294 + + " and a.remove=0 and a.line_code = ?";
  295 + objList.add(lineCode);
  296 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
291 297 new RowMapper<Map<String, Object>>(){
292 298 @Override
293 299 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -359,13 +365,15 @@ public class BigdataService {
359 365 @GET
360 366 @Path("/line/level/{level}")
361 367 public List<Map<String, Object>> findLineByLevle(@PathParam("level") String level) {
  368 + List<String> objList = new ArrayList<String>();
362 369 String sql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level,"
363 370 + " a.shanghai_linecode, a.nature from "
364 371 + " bsth_c_line a left join bsth_c_line_config b "
365 372 + " on a.id=b.line where "
366 373 + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 "
367   - + " and a.remove=0 and a.level = '"+level+"'";
368   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  374 + + " and a.remove=0 and a.level = ?";
  375 + objList.add(level);
  376 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
369 377 new RowMapper<Map<String, Object>>(){
370 378 @Override
371 379 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -445,15 +453,18 @@ public class BigdataService {
445 453 @Path("/lineCar/{type}/date/{date}")
446 454 public List<Map<String, Object>> findLineCarByDate(@PathParam("type") String type,@PathParam("date") String date) {
447 455 String sql="";
  456 + List<String> objList = new ArrayList<String>();
448 457 if(type.equals("all")){
449 458 sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhccz as jhcc,t.sjcc"
450   - + " from bsth_c_calc_count t where t.date='"+date+"'";
  459 + + " from bsth_c_calc_count t where t.date = ?";
  460 + objList.add(date);
451 461 }
452 462 if(type.equals("actual")){
453 463 sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhcc as jhcc,t.sjcc"
454   - + " from bsth_c_calc_count t where t.date='"+date+"'";
  464 + + " from bsth_c_calc_count t where t.date = ?";
  465 + objList.add(date);
455 466 }
456   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  467 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
457 468 new RowMapper<Map<String, Object>>(){
458 469 @Override
459 470 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -478,18 +489,23 @@ public class BigdataService {
478 489 public List<Map<String, Object>> findLineCarByDateLine(@PathParam("type") String type,@PathParam("date") String date,
479 490 @PathParam("line") String line) {
480 491 String sql="";
  492 + List<String> objList = new ArrayList<String>();
481 493 if(type.equals("all")){
482 494 sql="select t.gsdm,t.xl,t.xl_name,t.jhccz as jhcc,t.sjcc"
483   - + " from bsth_c_calc_count t where t.date='"+date+"'"
484   - + " and xl ='"+line+"'";
  495 + + " from bsth_c_calc_count t where t.date = ?"
  496 + + " and xl = ?";
  497 + objList.add(date);
  498 + objList.add(line);
485 499 }
486 500 if(type.equals("actual")){
487 501 sql="select t.gsdm,t.xl,t.xl_name,t.jhcc as jhcc,t.sjcc"
488   - + " from bsth_c_calc_count t where t.date='"+date+"'"
489   - + " and xl ='"+line+"'";
  502 + + " from bsth_c_calc_count t where t.date = ?"
  503 + + " and xl = ?";
  504 + objList.add(date);
  505 + objList.add(line);
490 506  
491 507 }
492   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  508 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
493 509 new RowMapper<Map<String, Object>>(){
494 510 @Override
495 511 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -518,15 +534,18 @@ public class BigdataService {
518 534 @Path("/linePerson/{type}/date/{date}")
519 535 public List<Map<String, Object>> findLinePersonByDate(@PathParam("type") String type,@PathParam("date") String date) {
520 536 String sql="";
  537 + List<String> objList = new ArrayList<String>();
521 538 if(type.equals("all")){
522 539 sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprz as jhpr,t.sjpr"
523   - + " from bsth_c_calc_count t where t.date='"+date+"'";
  540 + + " from bsth_c_calc_count t where t.date = ?";
  541 + objList.add(date);
524 542 }
525 543 if(type.equals("actual")){
526 544 sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprss as jhpr,t.sjpr"
527   - + " from bsth_c_calc_count t where t.date='"+date+"'";
  545 + + " from bsth_c_calc_count t where t.date = ?";
  546 + objList.add(date);
528 547 }
529   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  548 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
530 549 new RowMapper<Map<String, Object>>(){
531 550 @Override
532 551 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -555,17 +574,22 @@ public class BigdataService {
555 574 public List<Map<String, Object>> findLinePersonByDateLine(@PathParam("type") String type,@PathParam("date") String date,
556 575 @PathParam("line") String line) {
557 576 String sql="";
  577 + List<String> objList = new ArrayList<String>();
558 578 if(type.equals("all")){
559 579 sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprz as jhpr,t.sjpr"
560   - + " from bsth_c_calc_count t where t.date='"+date+"'"
561   - + " and xl ='"+line+"'";
  580 + + " from bsth_c_calc_count t where t.date = ?"
  581 + + " and xl = ?";
  582 + objList.add(date);
  583 + objList.add(line);
562 584 }
563 585 if(type.equals("actual")){
564 586 sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhprss as jhpr,t.sjpr"
565   - + " from bsth_c_calc_count t where t.date='"+date+"'"
566   - + " and xl ='"+line+"'";
  587 + + " from bsth_c_calc_count t where t.date = ?"
  588 + + " and xl = ?";
  589 + objList.add(date);
  590 + objList.add(line);
567 591 }
568   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  592 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
569 593 new RowMapper<Map<String, Object>>(){
570 594 @Override
571 595 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -604,17 +628,20 @@ public class BigdataService {
604 628 public List<Map<String, Object>> findLineBcByDate(@PathParam("type") String type,
605 629 @PathParam("date") String date) {
606 630 String sql="";
  631 + List<String> objList = new ArrayList<String>();
607 632 if(type.equals("all")){
608 633 sql="select t.gsdm,t.xl,t.xl_name,t.jhbcz as jhbc,t.jhzgfbcz as jhzgfbc,"
609 634 + " t.jhwgfbcz as jhwgfbc,t.sjbc,t.sjzgfbc,t.sjwgfbc from bsth_c_calc_count t"
610   - + " where t.date='"+date+"'";
  635 + + " where t.date = ?";
  636 + objList.add(date);
611 637 }
612 638 if(type.equals("actual")){
613 639 sql="select t.gsdm,t.xl,t.xl_name,t.jhbc as jhbc,t.jhzgfbcss as jhzgfbc,"
614 640 + " t.jhwgfbcss as jhwgfbc,t.sjbc,t.sjzgfbc,t.sjwgfbc from bsth_c_calc_count t"
615   - + " where t.date='"+date+"'";
  641 + + " where t.date = ?";
  642 + objList.add(date);
616 643 }
617   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  644 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
618 645 new RowMapper<Map<String, Object>>(){
619 646 @Override
620 647 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -641,17 +668,22 @@ public class BigdataService {
641 668 public List<Map<String, Object>> findLineBcByDateLine(@PathParam("type") String type,
642 669 @PathParam("date") String date,@PathParam("line") String line) {
643 670 String sql="";
  671 + List<String> objList = new ArrayList<String>();
644 672 if(type.equals("all")){
645 673 sql="select t.gsdm,t.xl,t.xl_name,t.jhbcz as jhbc,t.jhzgfbcz as jhzgfbc,"
646 674 + " t.jhwgfbcz as jhwgfbc,t.sjbc,t.sjzgfbc,t.sjwgfbc from bsth_c_calc_count t "
647   - + " where t.date='"+date+"' and xl='"+line+"'";
  675 + + " where t.date = ? and xl = ?";
  676 + objList.add(date);
  677 + objList.add(line);
648 678 }
649 679 if(type.equals("actual")){
650 680 sql="select t.gsdm,t.xl,t.xl_name,t.jhbc as jhbc,t.jhzgfbcss as jhzgfbc,"
651 681 + " t.jhwgfbcss as jhwgfbc,t.sjbc,t.sjzgfbc,t.sjwgfbc from bsth_c_calc_count t"
652   - + " where t.date='"+date+"' and xl='"+line+"'";
  682 + + " where t.date = ? and xl = ?";
  683 + objList.add(date);
  684 + objList.add(line);
653 685 }
654   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  686 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
655 687 new RowMapper<Map<String, Object>>(){
656 688 @Override
657 689 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -685,17 +717,20 @@ public class BigdataService {
685 717 public List<Map<String, Object>> findLineLcByDate(@PathParam("type") String type,
686 718 @PathParam("date") String date) {
687 719 String sql="";
  720 + List<String> objList = new ArrayList<String>();
688 721 if(type.equals("all")){
689 722 sql="select t.gsdm,t.xl,t.xl_name,t.jhzglz as jhzlc,t.jhyylcz as jhyylc,"
690 723 + " t.jhkslcz as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t"
691   - + " where t.date='"+date+"'";
  724 + + " where t.date = ?";
  725 + objList.add(date);
692 726 }
693 727 if(type.equals("actual")){
694 728 sql="select t.gsdm,t.xl,t.xl_name,t.jhzgl as jhzlc,t.jhyylc as jhyylc,"
695 729 + " t.jhkslc as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t"
696   - + " where t.date='"+date+"'";
  730 + + " where t.date = ?";
  731 + objList.add(date);
697 732 }
698   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  733 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
699 734 new RowMapper<Map<String, Object>>(){
700 735 @Override
701 736 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -735,17 +770,22 @@ public class BigdataService {
735 770 public List<Map<String, Object>> findLineLcByDateLine(@PathParam("type") String type,
736 771 @PathParam("date") String date,@PathParam("line") String line) {
737 772 String sql="";
  773 + List<String> objList = new ArrayList<String>();
738 774 if(type.equals("all")){
739 775 sql="select t.gsdm,t.xl,t.xl_name,t.jhzglz as jhzlc,t.jhyylcz as jhyylc,"
740 776 + " t.jhkslcz as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t"
741   - + " where t.date='"+date+"' and xl ='"+line+"'";
  777 + + " where t.date = ? and xl = ?";
  778 + objList.add(date);
  779 + objList.add(line);
742 780 }
743 781 if(type.equals("actual")){
744 782 sql="select t.gsdm,t.xl,t.xl_name,t.jhzgl as jhzlc,t.jhyylc as jhyylc,"
745 783 + " t.jhkslc as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t"
746   - + " where t.date='"+date+"' and xl ='"+line+"'";
  784 + + " where t.date = ? and xl = ?";
  785 + objList.add(date);
  786 + objList.add(line);
747 787 }
748   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  788 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
749 789 new RowMapper<Map<String, Object>>(){
750 790 @Override
751 791 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -789,9 +829,11 @@ public class BigdataService {
789 829 @GET
790 830 @Path("/abnormal/executionRate/date/{date}")
791 831 public List<Map<String, Object>> executionRate(@PathParam("date") String date) {
  832 + List<String> objList = new ArrayList<String>();
792 833 String sql="select gs_name,show_date,xl_bm,xl_name from bsth_c_calc_push t"
793   - + " where t.date='"+date+"' and push_type in ('1','3')";
794   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  834 + + " where t.date = ? and push_type in ('1','3')";
  835 + objList.add(date);
  836 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
795 837 new RowMapper<Map<String, Object>>(){
796 838 @Override
797 839 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -811,9 +853,11 @@ public class BigdataService {
811 853 @GET
812 854 @Path("/abnormal/firstAndLast/date/{date}")
813 855 public List<Map<String, Object>> firstAndLast(@PathParam("date") String date) {
  856 + List<String> objList = new ArrayList<String>();
814 857 String sql="select gs_name,show_date,xl_bm,xl_name from bsth_c_calc_push t"
815   - + " where t.date='"+date+"' and push_type in ('2','3')";
816   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  858 + + " where t.date = ? and push_type in ('2','3')";
  859 + objList.add(date);
  860 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
817 861 new RowMapper<Map<String, Object>>(){
818 862 @Override
819 863 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -1001,15 +1045,20 @@ public class BigdataService {
1001 1045 @Path("/findByAll/starDate/{starDate}/endDate/{endDate}/line/{line}")
1002 1046 public List<Map<String, Object>> findMinhang(@PathParam("starDate") String starDate,
1003 1047 @PathParam("endDate") String endDate,@PathParam("line") String line) {
  1048 + List<String> objList = new ArrayList<String>();
1004 1049 String sql="select xl,xl_name,date,jhszfcs,sjszfczds,jhbc,sjbc,jhcc,sjcc,"
1005 1050 + " jhyylc,sjyylc,jhkslc,sjkslc,jhssgfbcs,sjgfbcs,jhssdgbcs,"
1006 1051 + " sjdgbcs from bsth_c_calc_count "
1007   - + " where date>='"+starDate+"' and date<= '"+endDate+"'";
  1052 + + " where date >= ? and date <= ?";
  1053 + objList.add(starDate);
  1054 + objList.add(endDate);
  1055 +
1008 1056 if(!line.equals("all")){
1009   - sql +=" and xl='"+line+"'";
  1057 + sql +=" and xl = ?";
  1058 + objList.add(line);
1010 1059 }
1011 1060  
1012   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1061 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
1013 1062 new RowMapper<Map<String, Object>>(){
1014 1063 @Override
1015 1064 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -1045,23 +1094,28 @@ public class BigdataService {
1045 1094 @Path("/findByCompany/{company}/date/{date}")
1046 1095 public List<Map<String, Object>> findByCompany(@PathParam("company") String company,
1047 1096 @PathParam("date") String date) {
  1097 + List<String> objList = new ArrayList<String>();
1048 1098 String sql="select t.company as gs_code,t.date,SUM(t.jhcczgf) as jhccs ,SUM(t.sjcczgf) as ccs,AVG(ccl) as ccl"
1049 1099 + " ,SUM(t.sjzgl*1000)/1000 as sum_mileage ,SUM(jcgl*1000)/1000 as airpor_mileage "
1050 1100 + " from (select a.line_code,b.date,a.company,b.jhcczgf,b.sjcczgf,"
1051 1101 + " round(if(ifnull(b.sjcczgf/b.jhcczgf,0)>1,1,ifnull(b.sjcczgf/b.jhcczgf,0)),3) as ccl,c.sjzgl ,"
1052 1102 + " ifnull(d.sjzgl,0) as jcgl from bsth_c_line a LEFT JOIN "
1053   - + " (SELECT * from bsth_c_calc_sheet where date='"+date+"') b on a.line_code=b.xl"
1054   - + " left join (select * from bsth_c_calc_count where date='"+date+"') c on a.line_code=c.xl "
1055   - + " left join (select * from bsth_c_calc_count where date='"+date+"' "
  1103 + + " (SELECT * from bsth_c_calc_sheet where date = ?) b on a.line_code=b.xl"
  1104 + + " left join (select * from bsth_c_calc_count where date = ?) c on a.line_code=c.xl "
  1105 + + " left join (select * from bsth_c_calc_count where date = ? "
1056 1106 + " and xl_name like '%机场%') d on a.line_code=d.xl "
1057 1107 + " where a.nature in ('yxl','cgxl','gjxl','csbs','cctxl')) t "
1058 1108 + " where t.date is not null ";
  1109 + objList.add(date);
  1110 + objList.add(date);
  1111 + objList.add(date);
1059 1112 if(!company.equals("all")){
1060   - sql +=" and t.company='"+company+"'";
  1113 + sql +=" and t.company = ?";
  1114 + objList.add(company);
1061 1115 }
1062 1116 sql +=" group by t.company,t.date";
1063 1117  
1064   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1118 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
1065 1119 new RowMapper<Map<String, Object>>(){
1066 1120 @Override
1067 1121 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -1086,43 +1140,54 @@ public class BigdataService {
1086 1140 SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
1087 1141 String d=sdf.format(new Date());
1088 1142 String sql="";
  1143 + List<String> objList = new ArrayList<String>();
1089 1144 if(gs.equals("all")){
1090 1145 sql ="select x.gsdm,'' as fgsdm,x.smb_zdl,x.zgf_ccl,y.yylc_zxl,y.szfc_zdl,y.bc_zxl from ("
1091 1146 + " select b.gsdm,round(avg(if(ifnull(b.sjcczgf/b.jhcczgf,0)>1,1,ifnull(b.sjcczgf/b.jhcczgf,0))),3)* 100 as zgf_ccl,"
1092 1147 + " round(avg(ifnull(b.smbfczdl,0)),3) as smb_zdl from "
1093   - + " bsth_c_calc_sheet b where b.date like '%"+date+"%' and b.date<'"+d+"' "
  1148 + + " bsth_c_calc_sheet b where b.date like ? and b.date < ? "
1094 1149 + " and b.xl in(select a.line_code from bsth_c_line a where "
1095 1150 + " a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) group by b.gsdm ) x "
1096 1151 + " left join (select c.gsdm,round(avg(if(CONVERT(c.yylczxl,DECIMAL(9,2))>100,100,c.yylczxl)),3) as yylc_zxl,"
1097 1152 + " round(avg(if(CONVERT(c.szfczdl,DECIMAL(9,2))>100,100,c.szfczdl)),3) as szfc_zdl,"
1098 1153 + " round(avg(if(CONVERT(c.bczxl,DECIMAL(9,2))>100,100,c.bczxl)),3) as bc_zxl "
1099   - + " from bsth_c_calc_count c where c.date like '%"+date+"%' and c.date<'"+d+"' and "
  1154 + + " from bsth_c_calc_count c where c.date like ? and c.date < ? and "
1100 1155 + " c.xl in(select a.line_code from bsth_c_line a where a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) "
1101 1156 + " group by c.gsdm ) y on x.gsdm=y.gsdm where 1=1 ";
  1157 + objList.add("%"+date+"%");
  1158 + objList.add(d);
  1159 + objList.add("%"+date+"%");
  1160 + objList.add(d);
1102 1161  
1103 1162 }else{
1104 1163 sql ="select x.gsdm,x.fgsdm,x.smb_zdl,x.zgf_ccl,y.yylc_zxl,y.szfc_zdl,y.bc_zxl from ("
1105 1164 + " select b.gsdm,b.fgsdm,round(avg(if(ifnull(b.sjcczgf/b.jhcczgf,0)>1,1,ifnull(b.sjcczgf/b.jhcczgf,0))),3) * 100 as zgf_ccl,"
1106 1165 + " round(avg(ifnull(b.smbfczdl,0)),3) as smb_zdl from "
1107   - + " bsth_c_calc_sheet b where b.date like '%"+date+"%' and b.date<'"+d+"' "
  1166 + + " bsth_c_calc_sheet b where b.date like ? and b.date < ? "
1108 1167 + " and b.xl in(select a.line_code from bsth_c_line a where "
1109 1168 + " a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) group by b.gsdm,b.fgsdm ) x "
1110 1169 + " left join (select c.gsdm,c.fgsdm,round(avg(if(CONVERT(c.yylczxl,DECIMAL(9,2))>100,100,c.yylczxl)),3) as yylc_zxl,"
1111 1170 + " round(avg(if(CONVERT(c.szfczdl,DECIMAL(9,2))>100,100,c.szfczdl)),3) as szfc_zdl,"
1112 1171 + " round(avg(if(CONVERT(c.bczxl,DECIMAL(9,2))>100,100,c.bczxl)),3) as bc_zxl "
1113   - + " from bsth_c_calc_count c where c.date like '%"+date+"%' and c.date <'"+d+"' and "
  1172 + + " from bsth_c_calc_count c where c.date like ? and c.date < ? and "
1114 1173 + " c.xl in(select a.line_code from bsth_c_line a where a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) "
1115 1174 + " group by c.gsdm,c.fgsdm ) y on x.gsdm=y.gsdm and x.fgsdm=y.fgsdm where 1=1 ";
  1175 + objList.add("%"+date+"%");
  1176 + objList.add(d);
  1177 + objList.add("%"+date+"%");
  1178 + objList.add(d);
1116 1179  
1117 1180 }
1118 1181 if(!gs.equals("all")){
1119   - sql += " and x.gsdm='"+gs+"'";
  1182 + sql += " and x.gsdm = ?";
  1183 + objList.add(gs);
1120 1184 }
1121 1185  
1122 1186 if(!fgs.equals("all")){
1123   - sql += " and x.fgsdm='"+fgs+"'";
  1187 + sql += " and x.fgsdm = ?";
  1188 + objList.add(fgs);
1124 1189 }
1125   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1190 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
1126 1191 new RowMapper<Map<String, Object>>(){
1127 1192 @Override
1128 1193 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -1150,14 +1215,18 @@ public class BigdataService {
1150 1215 @Path("/basicData/starDate/{starDate}/endDate/{endDate}/line/{line}")
1151 1216 public List<Map<String, Object>> basicData(@PathParam("starDate") String starDate,
1152 1217 @PathParam("endDate") String endDate,@PathParam("line") String line) {
  1218 + List<String> objList = new ArrayList<String>();
1153 1219 String sql="select gsdm,fgsdm,xl,xl_name,date,jhbc,sjbc,"
1154 1220 + " jhyylc,sjyylc,jhkslc,sjkslc,jhgfbcsz,sjgfbcs,jhdgbcsz,"
1155 1221 + " sjdgbcs from bsth_c_calc_count "
1156   - + " where date>='"+starDate+"' and date<= '"+endDate+"'";
  1222 + + " where date >= ? and date <= ?";
  1223 + objList.add(starDate);
  1224 + objList.add(endDate);
1157 1225 if(!line.equals("all")){
1158   - sql +=" and xl='"+line+"'";
  1226 + sql +=" and xl = ?";
  1227 + objList.add(line);
1159 1228 }
1160   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1229 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
1161 1230 new RowMapper<Map<String, Object>>(){
1162 1231 @Override
1163 1232 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -1187,14 +1256,18 @@ public class BigdataService {
1187 1256 @Path("/targetData/starDate/{starDate}/endDate/{endDate}/line/{line}")
1188 1257 public List<Map<String, Object>> targetData(@PathParam("starDate") String starDate,
1189 1258 @PathParam("endDate") String endDate,@PathParam("line") String line) {
  1259 + List<String> objList = new ArrayList<String>();
1190 1260 String sql="select gsdm,fgsdm,date,xl,xl_name,szfczdl,smbfczdl,"
1191 1261 + " round(if(ifnull(sjcczgf/jhcczgf,0)>1,1,ifnull(sjcczgf/jhcczgf,0)),3) * 100 as zgfccl , "
1192 1262 + " round(if(ifnull(sjcc/jhcc,0)>1,1,ifnull(sjcc/jhcc,0)),3) * 100 as ccl from bsth_c_calc_sheet "
1193   - + " where date>='"+starDate+"' and date<= '"+endDate+"'";
  1263 + + " where date >= ? and date <= ?";
  1264 + objList.add(starDate);
  1265 + objList.add(endDate);
1194 1266 if(!line.equals("all")){
1195   - sql +=" and xl='"+line+"'";
  1267 + sql +=" and xl = ?";
  1268 + objList.add(line);
1196 1269 }
1197   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1270 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
1198 1271 new RowMapper<Map<String, Object>>(){
1199 1272 @Override
1200 1273 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ... @@ -1218,18 +1291,22 @@ public class BigdataService {
1218 1291 @Path("/departureTime/starDate/{starDate}/endDate/{endDate}/line/{line}")
1219 1292 public List<Map<String, Object>> departureTime(@PathParam("starDate") String starDate,
1220 1293 @PathParam("endDate") String endDate,@PathParam("line") String line) {
  1294 + List<String> objList = new ArrayList<String>();
1221 1295 String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz,"
1222 1296 + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz,"
1223 1297 + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz,"
1224 1298 + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz,"
1225 1299 + " jhszfcs,sjszfczds,szfczdl,"
1226 1300 + " create_date from bsth_c_calc_count "
1227   - + " where date>='"+starDate+"' and date<= '"+endDate+"'";
  1301 + + " where date >= ? and date <= ?";
  1302 + objList.add(starDate);
  1303 + objList.add(endDate);
1228 1304 if(!line.equals("all")){
1229   - sql +=" and xl='"+line+"'";
  1305 + sql +=" and xl = ?";
  1306 + objList.add(line);
1230 1307 }
1231 1308  
1232   - List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1309 + List<Map<String, Object>> list=jdbcTemplate.query(sql, objList.toArray(),
1233 1310 new RowMapper<Map<String, Object>>(){
1234 1311 @Override
1235 1312 public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
... ...