Commit 4363653c8832f559ad089892a9e74007d3134231

Authored by 廖磊
1 parent fe97ad3d

新加指标接口

src/main/java/com/bsth/server_rs/bigdata/BigdateService.java
@@ -1044,7 +1044,7 @@ public class BigdateService { @@ -1044,7 +1044,7 @@ public class BigdateService {
1044 @PathParam("date") String date) { 1044 @PathParam("date") String date) {
1045 String sql="select t.company as gs_code,t.date,SUM(t.jhcczgf) as jhccs ,SUM(t.sjcczgf) as ccs,AVG(ccl) as ccl" 1045 String sql="select t.company as gs_code,t.date,SUM(t.jhcczgf) as jhccs ,SUM(t.sjcczgf) as ccs,AVG(ccl) as ccl"
1046 + " ,SUM(t.sjzgl*1000)/1000 as sum_mileage ,SUM(jcgl*1000)/1000 as airpor_mileage " 1046 + " ,SUM(t.sjzgl*1000)/1000 as sum_mileage ,SUM(jcgl*1000)/1000 as airpor_mileage "
1047 - + " from (select a.line_code,a.b.date,a.company,b.jhcczgf,b.sjcczgf," 1047 + + " from (select a.line_code,b.date,a.company,b.jhcczgf,b.sjcczgf,"
1048 + " round(if(ifnull(b.sjcczgf/b.jhcczgf,0)>1,1,ifnull(b.sjcczgf/b.jhcczgf,0)),3) as ccl,c.sjzgl ," 1048 + " round(if(ifnull(b.sjcczgf/b.jhcczgf,0)>1,1,ifnull(b.sjcczgf/b.jhcczgf,0)),3) as ccl,c.sjzgl ,"
1049 + " ifnull(d.sjzgl,0) as jcgl from bsth_c_line a LEFT JOIN " 1049 + " ifnull(d.sjzgl,0) as jcgl from bsth_c_line a LEFT JOIN "
1050 + " (SELECT * from bsth_c_calc_sheet where date='"+date+"') b on a.line_code=b.xl" 1050 + " (SELECT * from bsth_c_calc_sheet where date='"+date+"') b on a.line_code=b.xl"
@@ -1076,5 +1076,62 @@ public class BigdateService { @@ -1076,5 +1076,62 @@ public class BigdateService {
1076 }); 1076 });
1077 return list; 1077 return list;
1078 } 1078 }
1079 - 1079 + @GET
  1080 + @Path("/findTarget/gs/{gs}/fgs/{fgs}/date/{date}")
  1081 + public List<Map<String, Object>> findTarget(@PathParam("gs") String gs,@PathParam("fgs") String fgs,
  1082 + @PathParam("date") String date) {
  1083 + String sql="";
  1084 + if(fgs.equals("all")){
  1085 + sql ="select x.gsdm,'' as fgsdm,x.smb_zdl,x.zgf_ccl,y.yylc_zxl,y.szfc_zdl,y.bc_zxl from ("
  1086 + + " select b.gsdm,round(avg(if(ifnull(b.sjcczgf/b.jhcczgf,0)>1,1,ifnull(b.sjcczgf/b.jhcczgf,0))),3)as zgf_ccl,"
  1087 + + " round(avg(ifnull(b.smbfczdl,0)),3) as smb_zdl from "
  1088 + + " bsth_c_calc_sheet b where b.date like '%"+date+"%' "
  1089 + + " and b.xl in(select a.line_code from bsth_c_line a where "
  1090 + + " a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) group by b.gsdm ) x "
  1091 + + " left join (select c.gsdm,round(avg(if(CONVERT(c.yylczxl,DECIMAL(9,2))>100,100,c.yylczxl)),3) as yylc_zxl,"
  1092 + + " round(avg(if(CONVERT(c.szfczdl,DECIMAL(9,2))>100,100,c.szfczdl)),3) as szfc_zdl,"
  1093 + + " round(avg(if(CONVERT(c.bczxl,DECIMAL(9,2))>100,100,c.bczxl)),3) as bc_zxl "
  1094 + + " from bsth_c_calc_count c where c.date like '%"+date+"%' and "
  1095 + + " c.xl in(select a.line_code from bsth_c_line a where a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) "
  1096 + + " group by c.gsdm ) y on x.gsdm=y.gsdm where 1=1 ";
  1097 +
  1098 + }else{
  1099 + sql ="select x.gsdm,x.fgsdm,x.smb_zdl,x.zgf_ccl,y.yylc_zxl,y.szfc_zdl,y.bc_zxl from ("
  1100 + + " select b.gsdm,b.fgsdm,round(avg(if(ifnull(b.sjcczgf/b.jhcczgf,0)>1,1,ifnull(b.sjcczgf/b.jhcczgf,0))),3)as zgf_ccl,"
  1101 + + " round(avg(ifnull(b.smbfczdl,0)),3) as smb_zdl from "
  1102 + + " bsth_c_calc_sheet b where b.date like '%"+date+"%' "
  1103 + + " and b.xl in(select a.line_code from bsth_c_line a where "
  1104 + + " a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) group by b.gsdm,b.fgsdm ) x "
  1105 + + " left join (select c.gsdm,c.fgsdm,round(avg(if(CONVERT(c.yylczxl,DECIMAL(9,2))>100,100,c.yylczxl)),3) as yylc_zxl,"
  1106 + + " round(avg(if(CONVERT(c.szfczdl,DECIMAL(9,2))>100,100,c.szfczdl)),3) as szfc_zdl,"
  1107 + + " round(avg(if(CONVERT(c.bczxl,DECIMAL(9,2))>100,100,c.bczxl)),3) as bc_zxl "
  1108 + + " from bsth_c_calc_count c where c.date like '%"+date+"%' and "
  1109 + + " c.xl in(select a.line_code from bsth_c_line a where a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) "
  1110 + + " group by c.gsdm,c.fgsdm ) y on x.gsdm=y.gsdm and x.fgsdm=y.fgsdm where 1=1 ";
  1111 +
  1112 + }
  1113 + if(!gs.equals("all")){
  1114 + sql += " and x.gsdm='"+gs+"'";
  1115 + }
  1116 +
  1117 + if(!fgs.equals("all")){
  1118 + sql += " and x.fgsdm='"+fgs+"'";
  1119 + }
  1120 + List<Map<String, Object>> list=jdbcTemplate.query(sql,
  1121 + new RowMapper<Map<String, Object>>(){
  1122 + @Override
  1123 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  1124 + Map<String, Object> m=new HashMap<String,Object>();
  1125 + m.put("gsdm", getGs(rs.getString("gsdm")));
  1126 + m.put("fgsdm",rs.getString("fgsdm"));
  1127 + m.put("smb_zdl", rs.getString("smb_zdl"));
  1128 + m.put("zgf_ccl", rs.getString("zgf_ccl"));
  1129 + m.put("yylc_zxl", rs.getString("yylc_zxl"));
  1130 + m.put("szfc_zdl", rs.getString("szfc_zdl"));
  1131 + m.put("bc_zxl", rs.getString("bc_zxl"));
  1132 + return m;
  1133 + }
  1134 + });
  1135 + return list;
  1136 + }
1080 } 1137 }