Commit fe97ad3d84a4916e3ed31b727012a7641a3f8860
1 parent
291f3d59
写给赵冲的出车率公里接口
Showing
1 changed file
with
43 additions
and
0 deletions
src/main/java/com/bsth/server_rs/bigdata/BigdateService.java
| @@ -1033,5 +1033,48 @@ public class BigdateService { | @@ -1033,5 +1033,48 @@ public class BigdateService { | ||
| 1033 | }); | 1033 | }); |
| 1034 | return list; | 1034 | return list; |
| 1035 | } | 1035 | } |
| 1036 | + | ||
| 1037 | + /** | ||
| 1038 | + * 赵冲需要的数据接口 | ||
| 1039 | + * | ||
| 1040 | + */ | ||
| 1041 | + @GET | ||
| 1042 | + @Path("/findByCompany/{company}/date/{date}") | ||
| 1043 | + public List<Map<String, Object>> findByCompany(@PathParam("company") String company, | ||
| 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" | ||
| 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," | ||
| 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 " | ||
| 1050 | + + " (SELECT * from bsth_c_calc_sheet where date='"+date+"') b on a.line_code=b.xl" | ||
| 1051 | + + " left join (select * from bsth_c_calc_count where date='"+date+"') c on a.line_code=c.xl " | ||
| 1052 | + + " left join (select * from bsth_c_calc_count where date='"+date+"' " | ||
| 1053 | + + " and xl_name like '%机场%') d on a.line_code=d.xl " | ||
| 1054 | + + " where a.nature in ('yxl','cgxl','gjxl','csbs','cctxl')) t " | ||
| 1055 | + + " where t.date is not null "; | ||
| 1056 | + if(!company.equals("all")){ | ||
| 1057 | + sql +=" and t.company='"+company+"'"; | ||
| 1058 | + } | ||
| 1059 | + sql +=" group by t.company,t.date"; | ||
| 1060 | + | ||
| 1061 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 1062 | + new RowMapper<Map<String, Object>>(){ | ||
| 1063 | + @Override | ||
| 1064 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 1065 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 1066 | + m.put("gs_name", getGs(rs.getString("gs_code"))); | ||
| 1067 | + m.put("gs_code",rs.getString("gs_code")); | ||
| 1068 | + m.put("date", rs.getString("date")); | ||
| 1069 | + m.put("jhccs", rs.getString("jhccs")); | ||
| 1070 | + m.put("ccs", rs.getString("ccs")); | ||
| 1071 | + m.put("ccl", rs.getString("ccl")); | ||
| 1072 | + m.put("sum_mileage", rs.getString("sum_mileage")); | ||
| 1073 | + m.put("airpor_mileage", rs.getString("airpor_mileage")); | ||
| 1074 | + return m; | ||
| 1075 | + } | ||
| 1076 | + }); | ||
| 1077 | + return list; | ||
| 1078 | + } | ||
| 1036 | 1079 | ||
| 1037 | } | 1080 | } |