大数据 分布式 企业spark案例 —— 出租车轨迹图表展示(头歌) - findTaxiPlatform()
MainMapper.java:
package net.educoder.app.mapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import java.util.List; @Mapper public interface MainMapper { //参考 @Select("SELECT _num from taxi_trend WHERE _taxi = #{type} ORDER BY _time") ListfindTaxiTrendNumByType(String type); /**********begin**********/ @Select("SELECT _time FROM taxi_trend GROUP BY _time ") ListfindTaxiTrendTime(); @Select("select _taxi from taxi_trend group by _taxi") ListfindTaxiType(); @Select("SELECT _type from taxi_servicenum GROUP BY _type") ListfindTaxiPlatform(); @Select("SELECT _serviceType FROM taxi_servicenum GROUP BY _serviceType ORDER BY _serviceType") ListfindAllTaxiService(); @Select("SELECT _num FROM taxi_servicenum WHERE _type = #{Platform} order BY _serviceType ") ListfindServiceNumByPlatform(String Platform); /**********end**********/ }
MainController.java:
package net.educoder.app.controller; import net.educoder.app.entity.Chart_Line; import net.educoder.app.entity.Chart_Radar; import net.educoder.app.mapper.MainMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller public class MainController { /**********begin**********/ @Autowired MainMapper mainMapper; @RequestMapping("/index") public String index() { return "index"; } @RequestMapping("/Line_Chart") @ResponseBody public MapLine_Chart() { ListtaxiType = mainMapper.findTaxiType(); Mapmap = new HashMap<>(); ListresultList = new ArrayList<>(); for (String s : taxiType) { Listlist = mainMapper.findTaxiTrendNumByType(s); Chart_Line chart_line = new Chart_Line(s, "line", list); resultList.add(chart_line); } ListtaxiTrendTimeList = mainMapper.findTaxiTrendTime(); map.put("timeList", taxiTrendTimeList); map.put("resultData", resultList); return map; } @RequestMapping("/Radar_Chart") @ResponseBody public MapRadar_Chart() { Mapmap = new HashMap<>(); ListallTaxiService = mainMapper.findAllTaxiService(); List> indicatorList = new ArrayList<>(); for (String s : allTaxiService) { HashMapstringIntegerHashMap = new HashMap<>(); stringIntegerHashMap.put("name", s); stringIntegerHashMap.put("max", 100); indicatorList.add(stringIntegerHashMap); } ListtaxiPlatform = mainMapper.findTaxiPlatform(); ListresultList = new ArrayList<>(); for (String s : taxiPlatform) { ListserviceNumByPlatform = mainMapper.findServiceNumByPlatform(s); Chart_Radar chart_radar = new Chart_Radar(s, serviceNumByPlatform); resultList.add(chart_radar); } map.put("resultData", resultList); map.put("legendData", taxiPlatform); map.put("indicator", indicatorList); return map; } /**********end**********/ }
index.html:
精彩文章
评论可见,查看隐藏内容,大数据 拼多多帮助力入口