Commit e031a93d by 罗胜

2022-01-07 00:02

1.油量分析和导出excel从单表获取数据
parent 03465474
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ejweb.modules.airport.dao.OilAnalysisDao">
<select id="getOilAnalysisData" resultType="com.ejweb.modules.airport.entity.OilAnalysisEntity">
<select id="getExcelOilAnalysisData1" resultType="com.ejweb.modules.airport.entity.OilAnalysisEntity">
select DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i')as std,
DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i:%s')as stdExcel,
sta.flight_no,
......@@ -18,8 +18,17 @@
airdep.city_name as depAirPortName,
airArr.airport_icao as arrIcaoId,
airdep.airport_icao as depIcaoId,
IFNULL(fat.verify_ac_type,'') as acTypeName
IFNULL(fat.verify_ac_type,'') as acTypeName,
sta.airline_oil,
sta.remark_msg,
sta.alt1_fuel,
sta.alt1_distance,
sta.alt1_time,
sta.alt2_fuel,
sta.alt2_time,
sta.alt2_distance,
sta.cruising_altitude,
sta.e_e_t as eet
from foc_flight_dynamics_sta sta
left join foc_airports airArr on airArr.airport_iata = sta.arr_iata_id
left join foc_airports airdep on airdep.airport_iata = sta.dep_iata_id
......@@ -69,4 +78,201 @@
</select>
<select id="getExcelOilAnalysisData" resultType="com.ejweb.modules.airport.entity.OilAnalysisEntity">
select DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i')as std,
DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i:%s')as stdExcel,
sta.flight_no,
sta.ac_no,
sta.dispatcher_name,
IFNULL(sta.dispatcher_account,'') as dispatcherAccount,
sta.total_oil,
sta.dep_iata_id,
sta.arr_iata_id,
sta.extra_oil_fuel_reason,
DATE_FORMAT(sta.update_date, '%Y/%m/%d')as updateDate,
DATE_FORMAT(sta.update_time, '%Y/%m/%d %H:%i:%s')as updateTime,
sta.arr_air_port_name,
sta.dep_air_port_name,
sta.arr_icao_id,
sta.dep_icao_id,
IFNULL(sta.ac_type_name,'') as acTypeName,
sta.airline_oil,
sta.remark_msg,
sta.alt1_fuel,
sta.alt1_distance,
sta.alt1_time,
sta.alt2_fuel,
sta.alt2_time,
sta.alt2_distance,
sta.cruising_altitude,
sta.e_e_t as eet
from foc_flight_dynamics_sta sta
where 1=1
<if test="arrIata!=null and arrIata!='' ">
and sta.arr_iata_id = #{arrIata}
</if>
<if test="depIata!=null and depIata!='' ">
and sta.dep_iata_id = #{depIata}
</if>
<if test="flightNo!=null and flightNo!='' ">
and sta.flight_no = #{flightNo}
</if>
<if test="dispatcherZH!=null and dispatcherZH!=''">
and sta.dispatcher_account LIKE CONCAT('%',#{dispatcherZH}, '%')
</if>
<if test="dispatcherENG!=null and dispatcherENG!=''">
and sta.dispatcher_name LIKE CONCAT('%',#{dispatcherENG}, '%')
</if>
<if test="minDepTime !=null and minDepTime!=''">
and sta.std <![CDATA[>=]]> date_format(#{minDepTime},'%Y-%c-%d %H:%i')
</if>
<if test="maxDepTime !=null and maxDepTime!=''">
and sta.std <![CDATA[<]]> date_format(#{maxDepTime},'%Y-%c-%d %H:%i')
</if>
<if test="mintotalOil !=null and mintotalOil!=''">
and substring_index(sta.total_oil,'KGS',1) >= #{mintotalOil}
</if>
<if test="maxtotalOil !=null and maxtotalOil!=''">
and substring_index(sta.total_oil,'KGS',1) <![CDATA[<]]> #{maxtotalOil}
</if>
group by sta.std,sta.flight_no
order by sta.std desc
</select>
<select id="getOilAnalysisData1" resultType="com.ejweb.modules.airport.entity.OilAnalysisEntity">
select DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i')as std,
sta.flight_no,
sta.ac_no,
sta.dispatcher_name,
IFNULL(u.name,'') as dispatcherAccount,
sta.total_oil,
sta.dep_iata_id,
sta.arr_iata_id,
sta.extra_oil_fuel_reason,
airArr.city_name as arrAirPortName,
airdep.city_name as depAirPortName,
DATE_FORMAT(sta.update_date, '%Y/%m/%d')as updateDate,
DATE_FORMAT(sta.update_time, '%Y/%m/%d %H:%i:%s')as updateTime,
IFNULL(acType.type_name,'') as acTypeName
from foc_flight_dynamics_sta sta
left join foc_airports airArr on airArr.LoginName = sta.arr_iata_id
left join foc_airports airdep on airdep.airport_iata = sta.dep_iata_id
left join foc_ac_type acType on acType.flight_no = sta.ac_no
left join sys_user u on u.login_name = sta.dispatcher_name
where 1=1
<if test="arrIata!=null and arrIata!='' ">
and sta.arr_iata_id = #{arrIata}
</if>
<if test="depIata!=null and depIata!='' ">
and sta.dep_iata_id = #{depIata}
</if>
<if test="flightNo!=null and flightNo!='' ">
and sta.flight_no = #{flightNo}
</if>
<if test="dispatcherZH!=null and dispatcherZH!=''">
and u.name LIKE CONCAT('%',#{dispatcherZH}, '%')
</if>
<if test="dispatcherENG!=null and dispatcherENG!=''">
and sta.dispatcher_name LIKE CONCAT('%',#{dispatcherENG}, '%')
</if>
<if test="minDepTime !=null and minDepTime!=''">
and sta.std <![CDATA[>=]]> date_format(#{minDepTime},'%Y-%c-%d %H:%i')
</if>
<if test="maxDepTime !=null and maxDepTime!=''">
and sta.std <![CDATA[<]]> date_format(#{maxDepTime},'%Y-%c-%d %H:%i')
</if>
<if test="mintotalOil !=null and mintotalOil!=''">
and substring_index(sta.total_oil,'KGS',1) >= #{mintotalOil}
</if>
<if test="maxtotalOil !=null and maxtotalOil!=''">
and substring_index(sta.total_oil,'KGS',1) <![CDATA[<]]> #{maxtotalOil}
</if>
group by sta.std,sta.flight_no
order by sta.std desc
</select>
<select id="getOilAnalysisData" resultType="com.ejweb.modules.airport.entity.OilAnalysisEntity">
select DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i')as std,
sta.flight_no,
sta.ac_no,
sta.dispatcher_name,
sta.dispatcher_account,
sta.total_oil,
sta.dep_iata_id,
sta.arr_iata_id,
sta.extra_oil_fuel_reason,
sta.arr_air_port_name,
sta.dep_air_port_name,
DATE_FORMAT(sta.update_date, '%Y/%m/%d')as updateDate,
DATE_FORMAT(sta.update_time, '%Y/%m/%d %H:%i:%s')as updateTime,
sta.ac_type_name
from foc_flight_dynamics_sta sta
where 1=1
<if test="arrIata!=null and arrIata!='' ">
and sta.arr_iata_id = #{arrIata}
</if>
<if test="depIata!=null and depIata!='' ">
and sta.dep_iata_id = #{depIata}
</if>
<if test="flightNo!=null and flightNo!='' ">
and sta.flight_no = #{flightNo}
</if>
<if test="dispatcherZH!=null and dispatcherZH!=''">
and u.name LIKE CONCAT('%',#{dispatcherZH}, '%')
</if>
<if test="dispatcherENG!=null and dispatcherENG!=''">
and sta.dispatcher_name LIKE CONCAT('%',#{dispatcherENG}, '%')
</if>
<if test="minDepTime !=null and minDepTime!=''">
and sta.std <![CDATA[>=]]> date_format(#{minDepTime},'%Y-%c-%d %H:%i')
</if>
<if test="maxDepTime !=null and maxDepTime!=''">
and sta.std <![CDATA[<]]> date_format(#{maxDepTime},'%Y-%c-%d %H:%i')
</if>
<if test="mintotalOil !=null and mintotalOil!=''">
and substring_index(sta.total_oil,'KGS',1) >= #{mintotalOil}
</if>
<if test="maxtotalOil !=null and maxtotalOil!=''">
and substring_index(sta.total_oil,'KGS',1) <![CDATA[<]]> #{maxtotalOil}
</if>
group by sta.std,sta.flight_no
order by sta.std desc
</select>
</mapper>
\ No newline at end of file
......@@ -78,4 +78,5 @@ public class RequestBean {
public String toString() {
return JSON.toJSONString(this);
}
}
......@@ -111,6 +111,7 @@ public class BasicVerifyFilter implements Filter {
if (content != null) {
message = "无效请求";
BaseUserBean baseUserBean = JSON.parseObject(content, BaseUserBean.class);
// BaseUserBean baseUserBean = JSON.parseObject("{\"userSign\":\"1000849147\"}", BaseUserBean.class); //测试使用
String userSign = baseUserBean.getUserSign();
if (userSign != null && !"".equals(userSign) && !"undefind".equals(userSign)) {
ServletContext context = request.getServletContext();
......@@ -161,4 +162,8 @@ public class BasicVerifyFilter implements Filter {
}
}
}
public static void main(String[] args) {
System.out.println(1638349534590L-1638349534589L);
}
}
......@@ -12,7 +12,9 @@ import com.ejweb.modules.airport.entity.OilAnalysisEntity;
import com.ejweb.modules.airport.service.OilAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
......@@ -33,6 +35,9 @@ public class OilAnalysisController {
PageEntity<OilAnalysisEntity> list = null;
ResponseBean responseBean = new ResponseBean();
OilAnalysisBean bean = requestBean.getObjectBean(OilAnalysisBean.class);
// OilAnalysisBean bean =new OilAnalysisBean(); //测试使用
// bean.setPageNo(20);
// bean.setPageSize(10);
list = oilAnalysisService.getAnalysisData(bean, true);
if (list == null) {
responseBean.setMessage(GConstants.EMPTY);
......@@ -46,6 +51,7 @@ public class OilAnalysisController {
return responseBean;
}
@RequestMapping(value = "/oilAnalysisExport")
public ResponseBean newExport(RequestBean requestBean, HttpServletResponse response) {
ResponseBean responseBean = new ResponseBean();
......@@ -59,6 +65,7 @@ public class OilAnalysisController {
String fileName = "油量分析统计(油量单位:KGS).xlsx";
try {
new ExportExcel("油量分析统计(油量单位:KGS)", OilAnalysisEntity.class).setDataList(list).write(response, fileName).dispose();
// new ExportExcel("油量分析统计(油量单位:KGS)", OilAnalysisEntity.class).setDataList(list).writeFile("D:\\"+fileName).dispose();
} catch (IOException e) {
responseBean.setMessage("导出数据失败" + e.getMessage());
return responseBean;
......
......@@ -12,4 +12,7 @@ public interface OilAnalysisDao extends BaseDao {
// 查询油量分析数据
List<OilAnalysisEntity> getOilAnalysisData(OilAnalysisBean bean);
// 导出查询油量分析数据
List<OilAnalysisEntity> getExcelOilAnalysisData(OilAnalysisBean bean);
}
......@@ -79,11 +79,112 @@ public class OilAnalysisEntity {
@ExcelField(title="数据更新时间", type=0, align=1, sort=50 )
private String updateTime; // 数据更新时间
@ExcelField(title="航线耗油", type=0, align=1, sort=51 )
private String airlineOil; // 航线耗油
@ExcelField(title="签派放行备注", type=0, align=1, sort=52 )
private String remarkMsg; // 签派放行备注
@ExcelField(title="目的机场到第一备降所需油量", type=0, align=1, sort=53 )
private String alt1Fuel; // 目的机场到第一备降所需油量
@ExcelField(title="目的机场到第一备降所需时间", type=0, align=1, sort=54 )
private String alt1Time; // 目的机场到第一备降所需时间
@ExcelField(title="目的机场到第一备降距离", type=0, align=1, sort=55 )
private String alt1Distance; // 目的机场到第一备降距离
@ExcelField(title="目的机场到第二备降所需油量", type=0, align=1, sort=56 )
private String alt2Fuel; // 目的机场到第二备降所需油量
@ExcelField(title="目的机场到第二备降所需时间", type=0, align=1, sort=57 )
private String alt2Time; // 目的机场到第二备降所需时间
@ExcelField(title="目的机场到第二备降距离", type=0, align=1, sort=58 )
private String alt2Distance; // 目的机场到第二备降距离
@ExcelField(title="巡航高度", type=0, align=1, sort=59 )
private String cruisingAltitude; // 巡航高度
@ExcelField(title="EET", type=0, align=1, sort=60 )
private String eeT; // EET
private String updateDate; // 数据更新时间
private String extraOilFuelReason; // 额外油加注原因
private String totalOil; // 总油量
private String std; // 计划起飞时间
public String getAirlineOil() {
return airlineOil;
}
public void setAirlineOil(String airlineOil) {
this.airlineOil = airlineOil;
}
public String getRemarkMsg() {
return remarkMsg;
}
public void setRemarkMsg(String remarkMsg) {
this.remarkMsg = remarkMsg;
}
public String getAlt1Fuel() {
return alt1Fuel;
}
public void setAlt1Fuel(String alt1Fuel) {
this.alt1Fuel = alt1Fuel;
}
public String getAlt1Time() {
return alt1Time;
}
public void setAlt1Time(String alt1Time) {
this.alt1Time = alt1Time;
}
public String getAlt1Distance() {
return alt1Distance;
}
public void setAlt1Distance(String alt1Distance) {
this.alt1Distance = alt1Distance;
}
public String getAlt2Fuel() {
return alt2Fuel;
}
public void setAlt2Fuel(String alt2Fuel) {
this.alt2Fuel = alt2Fuel;
}
public String getAlt2Time() {
return alt2Time;
}
public void setAlt2Time(String alt2Time) {
this.alt2Time = alt2Time;
}
public String getAlt2Distance() {
return alt2Distance;
}
public void setAlt2Distance(String alt2Distance) {
this.alt2Distance = alt2Distance;
}
public String getCruisingAltitude() {
return cruisingAltitude;
}
public void setCruisingAltitude(String cruisingAltitude) {
this.cruisingAltitude = cruisingAltitude;
}
public String getEeT() {
return eeT;
}
public void setEeT(String eET) {
this.eeT = eET;
}
public String getDepIcaoId() {
return depIcaoId;
}
......
......@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
@Service
......@@ -19,6 +20,8 @@ public class OilAnalysisService extends BaseService<OilAnalysisDao> {
@Autowired
protected OilAnalysisDao oilAnalysisDao;
public PageEntity<OilAnalysisEntity> getAnalysisData(OilAnalysisBean bean, Boolean isPage) {
if (isPage == true) {
......@@ -36,9 +39,12 @@ public class OilAnalysisService extends BaseService<OilAnalysisDao> {
}
PageInfo<OilAnalysisEntity> pageInfo = null;
List<OilAnalysisEntity> oilAnalysisEntityList = oilAnalysisDao.getOilAnalysisData(bean);
List<OilAnalysisEntity> oilAnalysisEntityList =null;
if(isPage){
oilAnalysisEntityList= oilAnalysisDao.getOilAnalysisData(bean);
}else{
oilAnalysisEntityList = oilAnalysisDao.getExcelOilAnalysisData(bean);
}
for (OilAnalysisEntity oilAnalysisEntity : oilAnalysisEntityList) {
int index = oilAnalysisEntityList.indexOf(oilAnalysisEntity);
oilAnalysisEntity.setNo(index + 1);
......@@ -140,5 +146,4 @@ public class OilAnalysisService extends BaseService<OilAnalysisDao> {
}
}
......@@ -323,7 +323,11 @@ public class CallController {
ResponseBean responseBean = new ResponseBean();
CallRecordListBean bean = requestBean.getObjectBean(CallRecordListBean.class);
// CallRecordListBean bean=new CallRecordListBean();
// bean.setUserId("1000849147");
// bean.setPageNo(0);
// bean.setPageSize(10);
// String message=null;
String message = callService.validate(bean);
if (message == null) {// 校验通过
Boolean show = false;
......
......@@ -54,14 +54,15 @@ public class CallService extends BaseService<CallDao> {
Date startTime = DateUtils.addDays(current, -3);
bean.setStartTime(DateFormatUtils.format(startTime, "yyyy-MM-dd 00:00:00"));
bean.setEndTime(DateFormatUtils.format(current, "yyyy-MM-dd 23:59:59"));
// List<CallRecordListEntity> callRecordList = dao.getCallRecordList(bean);
// 必须紧贴dao的查询方法
PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
pageInfo = new PageInfo<CallRecordListEntity>(dao.getCallRecordList(bean));
if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL
return null;
}
// if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL
//
// return null;
// }
List<CallRecordListEntity> list = pageInfo.getList();
if (list == null || list.size() == 0) {// 如果没有数据则返回NULL
return null;
......@@ -140,7 +141,6 @@ public class CallService extends BaseService<CallDao> {
bean.setMobileNubmer00("00"+bean.getPhoneNumer());
List<CallPhoneInfoListEntity> callList = dao.findUserByCallRecord(bean);
if(callList == null || callList.size() == 0){// 没有匹配到席位信息
List<CallPhoneInfoListEntity> seatList = dao.findSeatListByCallPhone(bean);
if(seatList == null || seatList.size() == 0){// 没有匹配到通话记录信息
......
......@@ -82,7 +82,10 @@ public class UserController {
String message = userService.validate(requestBean, errors);
if (message == null) {
UserFindByCodeBean reqUserBean = requestBean.getObjectBean(UserFindByCodeBean.class);
// reqUserBean.setUsercode("1000154873");
message = userService.validate(reqUserBean, errors);
message=null;
if (message == null) {
UserEntity userEntity = userService.findByCode(reqUserBean.getUsercode());
message = userService.validate(userEntity, errors);
......
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
</web-app>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment