企业spark案例 —— 出租车轨迹图表展示(头歌)
创始人
2024-11-28 06:05:47

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")
    List findTaxiTrendNumByType(String type);
    /**********begin**********/
    @Select("SELECT _time FROM taxi_trend GROUP BY _time ")
    List 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**********/
}
 

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 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")
    @ResponseBody
    public 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 taxiPlatform = mainMapper.findTaxiPlatform();
        List resultList = new ArrayList<>();
        for (String s : taxiPlatform) {
            List serviceNumByPlatform = 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:




   
   








相关内容

热门资讯

延安12345 | 拍照只会比... 近日,“剪刀手拍照会泄露指纹信息”冲上热搜,不少网友表示,没想到手指轻轻比个“耶”,竟可能把自己的隐...
填补世界空白的“大国重器”正式... 今天(8日),一项填补世界空白的“大国重器”正式上岗!我国自主研发的全球首套盾构超高压“三元混合气”...
科技助力唱“主角” 数字“新农... 科技助力唱“主角” 数字“新农具”耕出“智慧”丰收田 央视网消息:在湖北黄冈市,依托当地政府打造的...
数字技术赋能乡村振兴——以福建... 胡冰川 当下,数字技术正成为驱动农业农村高质量发展的新质生产力。数字农业以物联网、大数据、人工智能、...
构建智能体EDA方法论:挑战与... 工具与方法论之间的关系是双向的。工具赋能方法论,方法论依赖工具的功能特性及其所提供的数据。然而,当前...