Commit a64f2c0a53109485faac2198590d164223907d26
1 parent
4363653c
赵冲需要接口 早高峰出车率
Showing
1 changed file
with
9 additions
and
7 deletions
src/main/java/com/bsth/server_rs/bigdata/BigdateService.java
| ... | ... | @@ -1080,32 +1080,34 @@ public class BigdateService { |
| 1080 | 1080 | @Path("/findTarget/gs/{gs}/fgs/{fgs}/date/{date}") |
| 1081 | 1081 | public List<Map<String, Object>> findTarget(@PathParam("gs") String gs,@PathParam("fgs") String fgs, |
| 1082 | 1082 | @PathParam("date") String date) { |
| 1083 | + SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); | |
| 1084 | + String d=sdf.format(new Date()); | |
| 1083 | 1085 | String sql=""; |
| 1084 | - if(fgs.equals("all")){ | |
| 1086 | + if(gs.equals("all")){ | |
| 1085 | 1087 | 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," | |
| 1088 | + + " 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," | |
| 1087 | 1089 | + " round(avg(ifnull(b.smbfczdl,0)),3) as smb_zdl from " |
| 1088 | - + " bsth_c_calc_sheet b where b.date like '%"+date+"%' " | |
| 1090 | + + " bsth_c_calc_sheet b where b.date like '%"+date+"%' and b.date<'"+d+"' " | |
| 1089 | 1091 | + " and b.xl in(select a.line_code from bsth_c_line a where " |
| 1090 | 1092 | + " a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) group by b.gsdm ) x " |
| 1091 | 1093 | + " left join (select c.gsdm,round(avg(if(CONVERT(c.yylczxl,DECIMAL(9,2))>100,100,c.yylczxl)),3) as yylc_zxl," |
| 1092 | 1094 | + " round(avg(if(CONVERT(c.szfczdl,DECIMAL(9,2))>100,100,c.szfczdl)),3) as szfc_zdl," |
| 1093 | 1095 | + " 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 " | |
| 1096 | + + " from bsth_c_calc_count c where c.date like '%"+date+"%' and c.date<'"+d+"' and " | |
| 1095 | 1097 | + " c.xl in(select a.line_code from bsth_c_line a where a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) " |
| 1096 | 1098 | + " group by c.gsdm ) y on x.gsdm=y.gsdm where 1=1 "; |
| 1097 | 1099 | |
| 1098 | 1100 | }else{ |
| 1099 | 1101 | 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," | |
| 1102 | + + " 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," | |
| 1101 | 1103 | + " round(avg(ifnull(b.smbfczdl,0)),3) as smb_zdl from " |
| 1102 | - + " bsth_c_calc_sheet b where b.date like '%"+date+"%' " | |
| 1104 | + + " bsth_c_calc_sheet b where b.date like '%"+date+"%' and b.date<'"+d+"' " | |
| 1103 | 1105 | + " and b.xl in(select a.line_code from bsth_c_line a where " |
| 1104 | 1106 | + " a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) group by b.gsdm,b.fgsdm ) x " |
| 1105 | 1107 | + " 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 | 1108 | + " round(avg(if(CONVERT(c.szfczdl,DECIMAL(9,2))>100,100,c.szfczdl)),3) as szfc_zdl," |
| 1107 | 1109 | + " 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 " | |
| 1110 | + + " from bsth_c_calc_count c where c.date like '%"+date+"%' and c.date <'"+d+"' and " | |
| 1109 | 1111 | + " c.xl in(select a.line_code from bsth_c_line a where a.nature in ('yxl','cgxl','gjxl','csbs','cctxl') ) " |
| 1110 | 1112 | + " group by c.gsdm,c.fgsdm ) y on x.gsdm=y.gsdm and x.fgsdm=y.fgsdm where 1=1 "; |
| 1111 | 1113 | ... | ... |