企业spark案例 —出租车轨迹分析( 二 )

findTaxiTrendTime();@Select("select _taxi from taxi_trend group by _taxi")List findTaxiType();@Select("SELECT _type from taxi_servicenum GROUP BY _type")List findTaxiPlatform();@Select("SELECT _serviceType FROM taxi_servicenum GROUP BY _serviceType ORDER BY _serviceType")List findAllTaxiService();@Select("SELECT _num FROM taxi_servicenum WHERE _type = #{Platform} order BY _serviceType ")List findServiceNumByPlatform(String Platform);/**********end**********/}
V层:
index.html
src="http://www.kingceram.com/post/echarts.min.js">src="http://www.kingceram.com/post/jquery-3.1.1.min.js">

>var myChart = echarts.init(document.getElementById('main'));$.ajax({/**********begin**********/url: "/Line_Chart",/**********end**********/success: function (data) {option = {title: {text: '各出租车平台年使用率'},tooltip: {trigger: 'axis'},legend: {data: ['A', 'B', 'C']},grid: {left: '3%',right: '4%',bottom: '3%',containLabel: true},toolbox: {feature: {saveAsImage: {}}},xAxis: {type: 'category',boundaryGap: false,/**********begin**********/data:data.timeList/**********end**********/},yAxis: {type: 'value'},/**********begin**********/series:data.resultData/**********end**********/};myChart.setOption(option);},dataType: "json",type: "post"});var myChart2 = echarts.init(document.getElementById('main2'));$.ajax({/**********begin**********/url:"/Radar_Chart",/**********end**********/success:function (data) {option = {title: {text: '各平台各服务数量'},tooltip: {},legend: {/**********begin**********/data:data.taxiPlatform/**********end**********/},radar: {name: {textStyle: {color: '#fff',backgroundColor: '#999',borderRadius: 3,padding: [3, 5]}},/**********begin**********/indicator:data.indicator/**********end**********/},series: [{type: 'radar',/**********begin**********/data:data.resultData/**********end**********/}]};myChart2.setOption(option);},dataType:"json",type:"post"});
C层:
:
【企业spark案例 —出租车轨迹分析】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;@Controllerpublic class MainController {/**********begin**********/@AutowiredMainMapper mainMapper;@RequestMapping("/index")public String index() {return "index";}@RequestMapping("/Line_Chart")@ResponseBodypublic Map Line_Chart() {List taxiType = mainMapper.findTaxiType();Map map = new HashMap<>();List resultList = new ArrayList<>();for (String s : taxiType) {List list = mainMapper.findTaxiTrendNumByType(s);Chart_Line chart_line = new Chart_Line(s, "line", list);resultList.add(chart_line);}List taxiTrendTimeList = mainMapper.findTaxiTrendTime();map.put("timeList", taxiTrendTimeList);map.put("resultData", resultList);return map;}@RequestMapping("/Radar_Chart")@ResponseBodypublic Map Radar_Chart() {Map map = new HashMap<>();List allTaxiService = mainMapper.findAllTaxiService();List> indicatorList = new ArrayList<>();for (String s : allTaxiService) {HashMap stringIntegerHashMap = new HashMap<>();stringIntegerHashMap.put("name", s);stringIntegerHashMap.put("max", 100);indicatorList.add(stringIntegerHashMap);}List