内容:针对进出机场的航班数进行统计。
学时:6学时
知识点:机场当前负荷统计
重点:数据绑定、后台请求
1、确定设计图,引入ECharts组件
2、后台请求数据
3、Vue页面绑定数据
4、实现设计效果
1、前端核心代码:kongguan_web/src/components/echart/AirPortCountChart.vue
2、后端核心代码:BigData-KongGuan/src/main/java/com/qrsoft/controller/CompanyController.java
实现效果如下图左侧红色框内所示。
... 接下文 ...
... 接上文 ...
... 接下文 ...
import request from '../../utils/request'
const baseUrl = "/api"
/**
* 扇区架次数动态统计
*/
export function findATCTime() {
return request({
url: baseUrl + "/atc/findATCTime",
method: "GET"
})
}
/**
* 获取各个扇区通话饱和度
*/
export function findCallSaturation() {
return request({
url: baseUrl + "/callSaturation/findCallSaturation",
method: "GET"
})
}
/**
* 年度告警分类统计
*/
export function annualWarningStatisticsByCategory() {
return request({
url: baseUrl + "/warnFlightHistory/annualWarningStatisticsByCategory",
method: "GET"
})
}
/**
* 机场当前负荷统计
*/
export function getAirPortCount() {
return request({
url: baseUrl + "/company/getAirPortCount",
method: "GET"
})
}
/**
* 获取从青岛起飞航班数前十的航线
* @returns {AxiosPromise}
*/
export function findByLimit() {
return request({
url: baseUrl + "/airLine/findByLimit",
method: "GET"
})
}
package com.qrsoft.controller;
import com.qrsoft.common.Result;
import com.qrsoft.service.AftnService;
import com.qrsoft.service.CompanyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "航空公司航班数,和航班延误数")
@RestController
@RequestMapping("/api/company")
public class CompanyController {
@Autowired
private CompanyService service;
@Autowired
private AftnService aftnService;
/**
* 查询指挥航空公司航班数,和航班延误数
*/
@ApiOperation(value = "查询指挥航空公司航班数,和航班延误数")
@GetMapping("/findCompanyDelay")
public Result findCompanyDelay(){
return service.findCompanyDelay();
}
@ApiOperation(value = "查询指挥航空公司架次数占比")
@GetMapping("/findCompanyByCompanyAll")
public Result findCompanyByCompanyAll(){
return service.findCompanyByCompanyAll();
}
@ApiOperation(value = "机场当前负荷统计")
@GetMapping("/getAirPortCount")
public Result getAirPortCount(){
return aftnService.getAirPortCount();
}
}
package com.qrsoft.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qrsoft.common.Result;
import com.qrsoft.common.ResultConstants;
import com.qrsoft.entity.Aftn;
import com.qrsoft.mapper.AftnMapper;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class AftnService extends ServiceImpl {
public Result getAirPortCount() {
List aftnList = baseMapper.getAftnList();
return new Result(ResultConstants.SUCCESS, ResultConstants.C_SUCCESS, aftnList);
}
}
package com.qrsoft.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("kg_aftn")
//报文
public class Aftn implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@TableField(value = "send_time")
private String sendTime;
@TableField(value = "area_source")
private String areaSource;
@TableField(value = "plan_source")
private String planSource;
@TableField(value = "acid")
private String acid;
@TableField(value = "adep")
private String adep;
@TableField(value = "ades")
private String ades;
@TableField(value = "stod")
private String stod;
@TableField(value = "stoa")
private String stoa;
@TableField(value = "aftn_status")
private String aftnStatus;
@TableField(value = "execute_date")
private String executeDate;
@TableField(value = "ssr_code")
private String ssrCode;
@TableField(value = "fly_type")
private String flyType;
@TableField(value = "aircraft_type")
private String aircraftType;
@TableField(value = "tail_flow")
private String tailFlow;
@TableField(value = "plan_height")
private String planHeight;
@TableField(value = "plan_speed")
private String planSpeed;
@TableField(exist = false)
private String airCname;
@TableField(exist = false)
private Integer adepCount;
@TableField(exist = false)
private Integer adesCount;
}
package com.qrsoft.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qrsoft.entity.Aftn;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Mapper
public interface AftnMapper extends BaseMapper {
//获取机场飞机起飞的数量
@Select("select kg_airport.AIRPORT_CNAME as airCname,count(*) as adepCount\n" +
"from kg_airport INNER JOIN kg_aftn on kg_airport.AIRPORT_CODE4 = kg_aftn.adep\n" +
"GROUP BY kg_aftn.adep;")
List getAftnByAdep();
//获取机场飞机降落的数量
@Select("select kg_airport.AIRPORT_CNAME as airCname,count(*) as adesCount\n" +
"from kg_airport INNER JOIN kg_aftn on kg_airport.AIRPORT_CODE4 = kg_aftn.ades\n" +
"GROUP BY kg_aftn.ades")
List getAftnByAdes();
@Select("SELECT\n" +
"adep.airCname,adep.adepCount,ades.adesCount\n" +
"FROM\n" +
"(\n" +
"SELECT\n" +
"kg_airport.AIRPORT_CNAME AS airCname,\n" +
"count(*) AS adesCount \n" +
"FROM\n" +
"kg_airport\n" +
"INNER JOIN kg_aftn ON kg_airport.AIRPORT_CODE4 = kg_aftn.ades \n" +
"GROUP BY\n" +
"kg_aftn.ades \n" +
") AS ades right JOIN (\n" +
"SELECT\n" +
"kg_airport.AIRPORT_CNAME AS airCname,\n" +
"count(*) AS adepCount \n" +
"FROM\n" +
"kg_airport\n" +
"INNER JOIN kg_aftn ON kg_airport.AIRPORT_CODE4 = kg_aftn.adep \n" +
"GROUP BY\n" +
"kg_aftn.adep \n" +
") AS adep ON ades.airCname = adep.airCname")
List getAftnList();
}
... 略 ...
import AirLine from "../../components/AirLine";
import Section from "../../components/Section";
import WarnStatistice from "../../components/WarnStatistice";
import Delay from "../../components/Delay";
import {hasPermission} from "../../utils/permission";
import SectorFlightChart from "../../components/echart/SectorFlightChart";
import SectorCallChart from "../../components/echart/SectorCallChart";
import YearWarningChart from "../../components/echart/YearWarningChart";
import AirPortCountChart from "../../components/echart/AirPortCountChart";
export default {
data() {
return {
};
},
mounted() {
},
components: {AirLine, Section, WarnStatistice, Delay,SectorFlightChart,SectorCallChart,YearWarningChart,AirPortCountChart},
methods: {
isShow(permission){
return hasPermission(permission);
}
}
... 略 ...
例如:查看MySQL是否正常启动。
[email protected] dev /root/kongguan_web
vue-cli-service serve --open