Commit 56067a6c by 罗胜

2022-03-24 罗胜

1.油量分析增加获取飞行计划接口睡觉
2.航班执行期监控增加A321neo机型
parent 91606b28
......@@ -44,7 +44,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.7</version>
<version>1.2.76</version>
</dependency>
<dependency>
......@@ -72,9 +72,11 @@
<artifactId>slf4j-jdk14</artifactId>
<version>1.8.0-beta4</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.6.6</version>
</dependency>
</dependencies>
<build>
<plugins>
......@@ -104,7 +106,7 @@
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.foc.DspReleaseInfoTask</mainClass>
<mainClass>com.foc.StatisticalTask</mainClass>
</transformer>
</transformers>
</configuration>
......
......@@ -42,5 +42,7 @@ public class DspReleaseInfoTask {
dates.add(LocalDate.now());
}
DspReleaseInfoService.addInfo(dates);
DspReleaseInfoService.addPltPlan(dates.get(0).plusDays(-1));
// DspReleaseInfoService.addHistoryPltPlan();
}
}
......@@ -2,6 +2,7 @@ package com.foc.dao;
import com.foc.entity.DspReleaseInfo;
import com.foc.entity.Dynamics;
import com.foc.entity.FlightPlan;
import com.foc.entity.StatisticalEntity;
import org.apache.ibatis.annotations.Param;
......@@ -88,6 +89,13 @@ public interface StatisticalDao {
void insertDspReleaseInfo(List<DspReleaseInfo> list);
/**
* 批量新增飞行计划
*
* @param list
*/
void insertFltPlanInfo(List<FlightPlan> list);
/**
* 测试批量新增或修改
*
* @param list
......@@ -146,7 +154,7 @@ public interface StatisticalDao {
* @param acNo
* @return
*/
String selectAcTypeNameByAcNo(@Param(value="acNo") String acNo);
String selectAcTypeNameByAcNo(@Param(value="acNo") String acNo,@Param("year") int year);
/**
* 根据三字码获取四字码
......@@ -154,4 +162,7 @@ public interface StatisticalDao {
* @return
*/
String selectIcaoIdByTataId(@Param(value="iataId")String iataId);
List<DspReleaseInfo> selectReleaseInfoByDate(@Param("startTime") String startTime,@Param("endTime") String endTime);
}
......@@ -12,6 +12,8 @@ import java.util.Date;
@Data
public class DspReleaseInfo {
private Integer id;
private String sendTime;
private String flightNo;
......@@ -71,4 +73,15 @@ public class DspReleaseInfo {
private String arrIcaoId;
private String depIcaoId;
private String extraOilConclusion;
private String extraOilFuelReasonNew;
private String arrAltIataId;
private String flightTime;
//源系统签派放行ID
// private String orgDispatchInfoId;
}
package com.foc.entity;
import lombok.Data;
import java.util.Date;
/**
* @author ls
* @date 2022-02-28 14:37
*/
@Data
public class FlightPlan {
private String flightNo;
private String std;
private String depIataId;
private String arrIataId;
private String cfpFlag;
private Integer takeoffWeight;
private Integer landingWeight;
private Integer payloadWeight;
private Integer zeroFuel;
private Integer kalCargoLoad;
private Integer maximumFuelCapacity;
private Integer total;
private String totalTime;
private Integer trip;
private String tripTime;
private Integer tripDist;
private String arrivalTime;
private Integer alternateFuel;
private String alternateTime;
private Integer alternateDist;
private Integer taxiOut;
private String taxiOutTime;
private Integer hold;
private Integer reserve;
private String reserveTime;
private Integer extra;
private String extraTime;
private Integer limitingTakeoffWeight;
private Integer limitingLandingWeight;
private String customExtraTime;
private Integer etop;
private String etopTime;
private Integer planLeftOver;
private Date createDate;
private Date updateDate;
private Integer dynamicsStaId;
}
package com.foc.entity;
import lombok.Data;
/**
*
* @Author luos
* @Date 2022/2/25 15:22
**/
@Data
public class FltPLanInfo {
//飞行计划XML内容
private String planContentsXml;
//起飞地三字码
private String depIataId;
//目的地三字码
private String arrIataId;
//ODS更新时间
private String updatedTime;
//ODS创建时间
private String createdTime;
private String id;
//签派放行信息ID
private String dispatchInfoId;
//计划起飞时间(北京时间)
private String std;
//航班号
private String flightNo;
//飞行计划XML(国际二放)
private String recPlanContentsXml;
//CFP 标志
private String cfpFlag;
}
package com.foc.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.XmlUtil;
import cn.hutool.json.XML;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.foc.dao.StatisticalDao;
import com.foc.entity.DspReleaseInfo;
import com.foc.entity.FlightPlan;
import com.foc.entity.FltPLanInfo;
import com.foc.entity.ResultMsg;
import com.foc.thirdpart.esb.ApiRequest;
import com.foc.thirdpart.esb.EncodeUtil;
......@@ -15,19 +26,28 @@ import com.foc.util.Empty4JUtil;
import com.foc.util.PropertiesUtils;
import com.foc.util.StringUtils;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.security.GeneralSecurityException;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
/**
......@@ -74,10 +94,9 @@ public class DspReleaseInfoService {
//掉接口
String resultString = nativeHttpCall(map, gatewayUatUrl, key);
//解密
decrypt(resultString, key, dao);
// String sd="39f5ecac8ed14bb4a76fa01292abcb7a338fde227c9200e86e7785bff9abbb5e25af7a08ed0595f2d305c24c9c6c0c0f3a85691620731e43853dd52d101fc84a69a3e408e03ee968512b345dae32e13af0b4d8eaa09ae93f89ea402960fb89c14441133817376da8c235343a5e7c3101ce7c5c3818a7db6d79fc8eaef826080fddac40cdd685de0b24f9fa4e7beb7f6fff132b8b092ad11b6a2042d508a71600fe2a55983c120544e6a2307b7b4d671ab11087c5249d2688eb10f28a1eaf24177592a32b10df8923f4a3212306565050955b488eacbdba2318771887ba1eb52507bb32e17e7a37b7cc9c765a1abd442cbe7441ec5bdf331ec26d8d2ae00bd3dc291dd50c688c17d19292c574d9a358f4f31f2c8f95615cd4f52901985f5bd2bb90105ee17bc2ccbf291dd50c688c17d1c1e4e51cafe3176a96e6cb2b6741689bd106a9acb5f4c82d02cc5457f9153f5ccab37bb4da88dd4cb407a9f6ea2d0d353f659ce9fb11c3fe71d5e8180c7c6837356c075664f555e1d13c1731ac2dce739fb3e3930d19756e035d32b893f6010199a103234824347b053a2af9371c1b2d58e71e04f955fb0010241eaab1a66eb77f2163f40cd348eb6c153b0d2f9d0df8ddd88c479fa4c3704b67c4ab225e580a09ec6290377046d7d429a3647c0f6d0a1ae517e96713689a69c444e64fed346ac73364121dd485d7a4ef3a7dc445a0145b957104bc38a7fb37e6d82055bc17412c5f86be29c7bc8d3e2bdb4077702391821c08ef20b58a7ef9656ece954da05a0a0be325273a2413a48d806ef273d7e3387d728d76fc9bd144384673a36166cd27cf03d70038988e3c087276d90c1f3a467b462eb81b47a63de30557986970863d723b3e34e50ede064e2a971d440253a341259623dbcf8c1be141b38a2d4db4cce9f26b2e608dcb9a5e1b006e2147bd70ebe17934799931afb9211a8e7c7e05a0bb4bf76ad7d55b9a2d1f42a65257532166c978f3dcaadb922a4d78926d1a53c5b6ab20b1d4a91f384609e837390db68cb32735ce906a959f8b3556ab495c73cf098b5185c819fee87b633b5d925b2fed1e23b676ea5400cc22874e9635c7b29253a6d15752d8b1fa128dfd3bc2dbd83ad897c9c4c80971560bdf0ead6d423eed4d592e05d07502211230d43511cd42101d4bad13e14db78895f391af47542fb53667c01ed155b579997a625502905bfeaa46b2f62810b957e02cf39074d8ca37160a1afa05f24b789459cfa502e232bc80784e8f3a70f7f2c63ee5b2fb30a9f9abd7fb832e8344667541e8011263555f1b3c6eab9f137c7cce2009b0eff5a367438fc9a6c75562011dd14892bad6c16f8f29e9f893c66ee681ba2edb638662f9bf8200ab1a68b70af3d50d501deecc718bcc0b2a5a9e684c84cfe51ab2610b12e2b0316f12b5026a74d23fc4cf955ffbaa1ef15820a1fcd76f562b0c4fb829d4580a33381983126046c5d9805afd8bc9a6f61ab82f465c993c13cafebcce2c79a1219b9f7e1859927e3e0db2d32054c8bccdf7ef4a2b5f8ab459c24068fb38db512dee5973c5f23fba469135316ff26b9f8ba3cf81f8e74f8b7bc9b503f566699a1c29ced0e89e6629cd8128535bdf6ed3cb5eb6564460f31824b9c94f062b34e43d595b658a1b65797844b5a2d3d2cc7a424db1718c05b925df9830b1d24969dc5ea45f38c8377b41ad491a2dfa0dba646145d23c2632109bda5c2e5f8ca5669625e63f9da83c64e26ec36bf40c49a320eb5cdf7fb20a1c3ca106f79282cfb8a4b101eb1f5decde7853b0999c3aeac30ebd9aa5398b4fa2a07fe43eb2ccfe845128de5bc94d39c7ddf1fed5d3742e6c622d98928d2ba96933d2a59860e4c0d862f63d21ca9621abde3700e691cd8c372a407de7033dd2f48db3d17af9bf017cd4bb9e904a71a519b20aad0ab468b3024a4bdf53a6683c3fd63de1b1a4b909c7a17d22105c7d1f07722558d1b76a1b96085cef60d1f63c74bd9c3201638fdbe738abd8ef478c8f49a2e5645aeec1a4b552662b5443443d102f961e0cb1d385e8988539cc9be133e0a667ca08b58c98b298423930d0f01d06d4654069888f62b15d80f30dd5faee2f0b0331d787c315c83e48d9df04c2bcf0c50637c3167f8dc1a8e2f521fdaaddf0c50637c3167f8dc1a8e2f521fdaadd7f01f4c0810a192f932ab1a369864dd2ba67ba9e3dc9d7d6e96bc702f692b7f793ff1f4769e7e5f13cc7e46e07be1d9b561cf5f334e9271ce0454363a31478f7955039add7c86ed3ca281f52e2bb189248264d2ad82fe249103e9b138dc1f687eaa042294e098b2fd186cd08ce9153c76cc5bc984e35b55e2587d8d50997b7cf86fef78c19225242f0710fd0834412e7";
decrypt(resultString, key, password, userAccount, gatewayUatUrl, dao);
}
session.commit();
}
}
......@@ -89,8 +108,8 @@ public class DspReleaseInfoService {
ApiRequest apiRequest = new ApiRequest();
apiRequest.getOptions().put("flightNos", flightNo);
apiRequest.getOptions().put("stdTimeStart", date.plusDays(-1).format(DateTimeFormatter.ISO_LOCAL_DATE) + " 00:00:00");
apiRequest.getOptions().put("stdTimeEnd", date.format(DateTimeFormatter.ISO_LOCAL_DATE) + " 00:00:00");
apiRequest.getOptions().put("updatedTimeStart", date.plusDays(-1).format(DateTimeFormatter.ISO_LOCAL_DATE) + " 00:00:00");
apiRequest.getOptions().put("updatedTimeEnd", date.format(DateTimeFormatter.ISO_LOCAL_DATE) + " 00:00:00");
//分页参数
PageParam pageParam = new PageParam();
//从第一页开始
......@@ -132,6 +151,52 @@ public class DspReleaseInfoService {
return requstMap;
}
public static Map<String, String> buildFltPlanGatewayRequestString(String flightNo, String key, String userAccount, String password, String std, String depIataId, String arrIataId) throws UnsupportedEncodingException, GeneralSecurityException {
Gson gson = new Gson();
String currentTimeMillisStr = String.valueOf(System.currentTimeMillis());
/** step1: 参考接口文档 2.4输入参数说明 章节,并组装成json string **/
ApiRequest apiRequest = new ApiRequest();
apiRequest.getOptions().put("flightNo", flightNo);
apiRequest.getOptions().put("std", std);
apiRequest.getOptions().put("depIataId", depIataId);
apiRequest.getOptions().put("arrIataId", arrIataId);
apiRequest.getOptions().put("returnPlanContentsXml", "true");
apiRequest.getOptions().put("returnRecPlanXmlContent", "true");
String apiRequestJson = gson.toJson(apiRequest);
log.info("dubbo interface apiRequestJson=" + apiRequestJson);
/** step2: 构建 gateway 接口 signature 参数**/
String signature = EncodeUtil.generateToken(userAccount, key, apiRequestJson, currentTimeMillisStr);
log.info("signature=" + signature);
/** step3: 构建外网网关接口参数 **/
Map<String, String> gatewayParam = new HashMap<>();
//dubbo 接口参数,json 格式
gatewayParam.put("inParams", apiRequestJson);
//接口文档中的 2.1 包名与类名
gatewayParam.put("packageName", "com.hnair.opcnet.api.ods.dsp.GetDspReleaseApi");
//接口文档中的 2.2 方法名
gatewayParam.put("methodName", "getFltPLan");
//hna-esb-security.xml 文件中的password
gatewayParam.put("password", password);
//step2 的签名串
gatewayParam.put("signature", signature);
//当前时间string 串
gatewayParam.put("time", currentTimeMillisStr);
String gatewayParamStr = gson.toJson(gatewayParam);
log.info("gatewayParamStr=" + gatewayParamStr);
//step3 对gatewayParamStr 进行加密,key 来自hna-esb-security.xml 文件中的key
String requestString = EncodeUtil.encrypt(gatewayParamStr, key);
log.info("requestString encrypt=" + requestString);
Map<String, String> requstMap = new HashMap<>();
requstMap.put("userName", userAccount);
requstMap.put("requestString", requestString);
return requstMap;
}
private static String nativeHttpCall(Map<String, String> params, String gatewayUatUrl, String key) {
log.info("**********************************************");
......@@ -142,8 +207,8 @@ public class DspReleaseInfoService {
result = httpClient.doPost(gatewayUatUrl, params,
HttpClientImpl.DEFAULT_CHARSET, 60000, 60000);
log.info("nativeHttpCall result=" + result);
log.info("nativeHttpCall decrypt result=" + EncodeUtil.decrypt(result, key));
// log.info("nativeHttpCall result=" + result);
// log.info("nativeHttpCall decrypt result=" + EncodeUtil.decrypt(result, key));
} catch (Exception e) {
e.printStackTrace();
}
......@@ -152,9 +217,10 @@ public class DspReleaseInfoService {
}
public static void decrypt(String resultString, String key, StatisticalDao dao) throws GeneralSecurityException, UnsupportedEncodingException {
public static void decrypt(String resultString, String key, String password, String account, String gatewayUatUrl, StatisticalDao dao) throws GeneralSecurityException, UnsupportedEncodingException {
String response = EncodeUtil.decrypt(resultString, key);
System.out.println(response);
String nowDate=LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
//转成jsonObject
JSONObject jsonObject = JSON.parseObject(response);
//取出jsonObject中的data
......@@ -166,20 +232,29 @@ public class DspReleaseInfoService {
//取出jsonObject中的data
String data = jsonObject.getString("data");
List<DspReleaseInfo> dspReleaseInfoList = JSON.parseArray(data, DspReleaseInfo.class);
List<DspReleaseInfo> list = new ArrayList<>();
if (Empty4JUtil.listIsNotEmpty(dspReleaseInfoList)) {
for (DspReleaseInfo ss : dspReleaseInfoList) {
if(ss.getStd().contains(nowDate)){
continue;
}
int year = DateTime.of(ss.getStd(), "yyyy-MM-dd HH:mm:ss").year();
ss.setDepAirPortName(dao.selectAirPortNameByIataId(ss.getDepIataId()));
ss.setArrAirPortName(dao.selectAirPortNameByIataId(ss.getArrIataId()));
ss.setDispatcherAccount(dao.selectUserNameByLoginName(ss.getDispatcherName()));
ss.setAcTypeName((dao.selectAcTypeNameByAcNo(ss.getAcNo())==null)?"":dao.selectAcTypeNameByAcNo(ss.getAcNo()));
ss.setAcTypeName((dao.selectAcTypeNameByAcNo(ss.getAcNo(),year) == null) ? "" : dao.selectAcTypeNameByAcNo(ss.getAcNo(),year));
ss.setArrIcaoId(dao.selectIcaoIdByTataId(ss.getArrIataId()));
ss.setDepIcaoId(dao.selectIcaoIdByTataId(ss.getDepIataId()));
ss.setDelFlag("0");
ss.setCreateDate(DateUtils.getTime("yyyy-MM-dd hh:mm:ss"));
ss.setUpdateDate(DateUtils.getTime("yyyy-MM-dd hh:mm:ss"));
ss.setExtraOilFuelReasonNew(ss.getExtraOilFuelReason());
ss.setExtraOilConclusion("合格");
list.add(ss);
}
//调添加接口
dao.insertDspReleaseInfo(dspReleaseInfoList);
dao.insertDspReleaseInfo(list);
session.commit();
}
} else {
System.out.println("返回值不为0");
......@@ -190,11 +265,178 @@ public class DspReleaseInfoService {
}
public static void main(String[] args) throws GeneralSecurityException, UnsupportedEncodingException {
init();
public static void decryptFlt(Integer staId, String resultString, String key, StatisticalDao dao) throws GeneralSecurityException, UnsupportedEncodingException {
String response = EncodeUtil.decrypt(resultString, key);
// System.out.println(response);
//转成jsonObject
JSONObject jsonObject = JSON.parseObject(response);
//取出jsonObject中的data
String resultJson = jsonObject.getString("result");
JSONObject resultJsonObject = JSON.parseObject(resultJson);
ResultMsg resultMsg = JSONObject.toJavaObject(resultJsonObject, ResultMsg.class);
List<FlightPlan> list = new ArrayList<>();
FlightPlan flightPlan = null;
if (Objects.nonNull(resultMsg)) {
if ("0".equals(resultMsg.getResultCode())) {
//取出jsonObject中的data
List<FltPLanInfo> fltPLans = jsonObject.getJSONArray("data").toJavaList(FltPLanInfo.class);
for (FltPLanInfo fltPLan : fltPLans) {
flightPlan = new FlightPlan();
BeanUtil.copyProperties(fltPLan, flightPlan);
flightPlan.setDynamicsStaId(staId);
cn.hutool.json.JSONObject block = null;
cn.hutool.json.JSONObject aircraft = null;
if (ObjectUtil.equal("0", fltPLan.getCfpFlag()) || ObjectUtil.equal("1", fltPLan.getCfpFlag())) {
block = XML.toJSONObject(fltPLan.getPlanContentsXml()).getJSONObject("FlightPlan").getJSONObject("Block");
aircraft = XML.toJSONObject(fltPLan.getPlanContentsXml()).getJSONObject("FlightPlan").getJSONObject("Aircraft");
flightPlan.setTakeoffWeight(aircraft.getJSONObject("Weights").getInt("takeoff", 0));
flightPlan.setLandingWeight(aircraft.getJSONObject("Weights").getInt("landing", 0));
flightPlan.setPayloadWeight(aircraft.getJSONObject("Weights").getInt("payload", 0));
flightPlan.setKalCargoLoad(aircraft.getJSONObject("Weights").getInt("kalCargoLoad", 0));
flightPlan.setZeroFuel(aircraft.getJSONObject("Weights").getInt("zeroFuel", 0));
flightPlan.setMaximumFuelCapacity(aircraft.getJSONObject("DataBase").getJSONObject("Fuels").getInt("maximumFuelCapacity", 0));
flightPlan.setLimitingTakeoffWeight(aircraft.getJSONObject("CustomerOverrides").getJSONObject("Weights").getInt("limitingTakeoffWeight", 0));
flightPlan.setLimitingLandingWeight(aircraft.getJSONObject("CustomerOverrides").getJSONObject("Weights").getInt("limitingLandingWeight", 0));
flightPlan.setTotal(block.getJSONObject("Total").getInt("fuel", 0));
flightPlan.setTotalTime(block.getJSONObject("Total").getStr("time"));
flightPlan.setTrip(block.getJSONObject("Trip").getInt("fuel", 0));
flightPlan.setTripTime(block.getJSONObject("Trip").getStr("time"));
flightPlan.setTripDist(block.getJSONObject("Trip").getInt("dist", 0));
flightPlan.setArrivalTime(block.getJSONObject("Trip").getStr("arrivalTime"));
flightPlan.setAlternateFuel(block.getJSONObject("Alternate").getInt("fuel", 0));
flightPlan.setAlternateDist(block.getJSONObject("Alternate").getInt("dist", 0));
flightPlan.setAlternateTime(block.getJSONObject("Alternate").getStr("time"));
flightPlan.setTaxiOut(block.getJSONObject("TaxiOut").getInt("fuel", 0));
flightPlan.setTaxiOutTime(block.getJSONObject("TaxiOut").getStr("time"));
flightPlan.setHold(block.getJSONObject("Hold").getInt("fuel", 0));
flightPlan.setReserve(block.getJSONObject("Reserve").getInt("fuel", 0));
flightPlan.setReserveTime(block.getJSONObject("Reserve").getStr("time"));
flightPlan.setExtra(block.getJSONObject("Extra").getInt("fuel", 0));
flightPlan.setExtraTime(block.getJSONObject("Extra").getStr("time"));
flightPlan.setCustomExtraTime(block.getJSONObject("CustomExtra").getStr("time"));
if (ObjectUtil.equal(1, fltPLan.getCfpFlag())) {
flightPlan.setEtop(block.getJSONObject("Etop").getInt("fuel", 0));
flightPlan.setEtopTime(block.getJSONObject("Etop").getStr("time"));
}
} else if (ObjectUtil.equal("2", fltPLan.getCfpFlag()) || ObjectUtil.equal("3", fltPLan.getCfpFlag())) {
block = XML.toJSONObject(fltPLan.getRecPlanContentsXml()).getJSONObject("FlightPlan").getJSONObject("Block");
aircraft = XML.toJSONObject(fltPLan.getRecPlanContentsXml()).getJSONObject("FlightPlan").getJSONObject("Aircraft");
flightPlan.setTakeoffWeight(aircraft.getJSONObject("Weights").getInt("takeoff", 0));
flightPlan.setLandingWeight(aircraft.getJSONObject("Weights").getInt("landing", 0));
flightPlan.setPayloadWeight(aircraft.getJSONObject("Weights").getInt("payload", 0));
flightPlan.setKalCargoLoad(aircraft.getJSONObject("Weights").getInt("kalCargoLoad", 0));
flightPlan.setZeroFuel(aircraft.getJSONObject("Weights").getInt("zeroFuel", 0));
flightPlan.setMaximumFuelCapacity(aircraft.getJSONObject("DataBase").getJSONObject("Fuels").getInt("maximumFuelCapacity", 0));
flightPlan.setLimitingTakeoffWeight(aircraft.getJSONObject("CustomerOverrides").getJSONObject("Weights").getInt("limitingTakeoffWeight", 0));
flightPlan.setLimitingLandingWeight(aircraft.getJSONObject("CustomerOverrides").getJSONObject("Weights").getInt("limitingLandingWeight", 0));
flightPlan.setTotal(block.getJSONObject("Total").getInt("fuel", 0));
flightPlan.setTotalTime(block.getJSONObject("Total").getStr("time"));
flightPlan.setTrip(block.getJSONObject("Trip").getInt("fuel", 0));
flightPlan.setTripTime(block.getJSONObject("Trip").getStr("time"));
flightPlan.setTripDist(block.getJSONObject("Trip").getInt("dist", 0));
flightPlan.setArrivalTime(block.getJSONObject("Trip").getStr("arrivalTime"));
flightPlan.setAlternateFuel(block.getJSONObject("Alternate").getInt("fuel", 0));
flightPlan.setAlternateDist(block.getJSONObject("Alternate").getInt("dist", 0));
flightPlan.setAlternateTime(block.getJSONObject("Alternate").getStr("time"));
flightPlan.setTaxiOut(block.getJSONObject("TaxiOut").getInt("fuel", 0));
flightPlan.setTaxiOutTime(block.getJSONObject("TaxiOut").getStr("time"));
flightPlan.setHold(block.getJSONObject("Hold").getInt("fuel", 0));
flightPlan.setReserve(block.getJSONObject("Reserve").getInt("fuel", 0));
flightPlan.setReserveTime(block.getJSONObject("Reserve").getStr("time"));
flightPlan.setExtra(block.getJSONObject("Extra").getInt("fuel", 0));
flightPlan.setExtraTime(block.getJSONObject("Extra").getStr("time"));
flightPlan.setCustomExtraTime(block.getJSONObject("CustomExtra").getStr("time"));
if (ObjectUtil.equal(3, fltPLan.getCfpFlag())) {
flightPlan.setEtop(block.getJSONObject("Etop").getInt("fuel", 0));
flightPlan.setEtopTime(block.getJSONObject("Etop").getStr("time"));
}
}
flightPlan.setPlanLeftOver(flightPlan.getTotal() - flightPlan.getTrip() - flightPlan.getTaxiOut());
flightPlan.setCreateDate(DateTime.now());
flightPlan.setUpdateDate(DateTime.now());
list.add(flightPlan);
fltPLan = null;
}
dao.insertFltPlanInfo(list);
fltPLans = null;
resultMsg = null;
} else {
System.out.println("返回值不为0");
}
} else {
System.out.println("返回值为空");
}
}
public static void addPltPlan(LocalDate dateTime) throws Exception {
Properties properties = PropertiesUtils.getProperties();
String gatewayUatUrl = properties.getProperty("esb.security.gateway.uat.url");
String key = properties.getProperty("esb.security.key");
String userAccount = properties.getProperty("esb.security.account");
String password = properties.getProperty("esb.security.password");
if (StringUtils.isEmpty(gatewayUatUrl) || StringUtils.isEmpty(key)) {
log.error("获取配置文件中机型的文件");
}
StatisticalDao dao = session.getMapper(StatisticalDao.class);
String s="39f5ecac8ed14bb4a76fa01292abcb7a338fde227c9200e86e7785bff9abbb5e25af7a08ed0595f2d305c24c9c6c0c0f3a85691620731e43853dd52d101fc84a69a3e408e03ee968512b345dae32e13af0b4d8eaa09ae93f89ea402960fb89c14441133817376da8c235343a5e7c3101ce7c5c3818a7db6d79fc8eaef826080fddac40cdd685de0b24f9fa4e7beb7f6fff132b8b092ad11b6a2042d508a71600fe2a55983c120544e6a2307b7b4d671ab11087c5249d2688eb10f28a1eaf24177592a32b10df8923f4a3212306565050955b488eacbdba2318771887ba1eb52507bb32e17e7a37b7cc9c765a1abd442cbe7441ec5bdf331ec26d8d2ae00bd3dc291dd50c688c17d19292c574d9a358f4f31f2c8f95615cd4f52901985f5bd2bb90105ee17bc2ccbf291dd50c688c17d1c1e4e51cafe3176a96e6cb2b6741689bd106a9acb5f4c82d02cc5457f9153f5ccab37bb4da88dd4cb407a9f6ea2d0d353f659ce9fb11c3fe71d5e8180c7c6837356c075664f555e1d13c1731ac2dce739fb3e3930d19756e035d32b893f6010199a103234824347b053a2af9371c1b2d58e71e04f955fb0010241eaab1a66eb77f2163f40cd348eb6c153b0d2f9d0df8ddd88c479fa4c3704b67c4ab225e580a09ec6290377046d7d429a3647c0f6d0a1ae517e96713689a69c444e64fed346ac73364121dd485d7a4ef3a7dc445a0145b957104bc38a7fb37e6d82055bc17412c5f86be29c7bc8d3e2bdb4077702391821c08ef20b58a7ef9656ece954da05a0a0be325273a2413a48d806ef273d7e3387d728d76fc9bd144384673a36166cd27cf03d70038988e3c087276d90c1f3a467b462eb81b47a63de30557986970863d723b3e34e50ede064e2a971d440253a341259623dbcf8c1be141b38a2d4db4cce9f26b2e608dcb9a5e1b006e2147bd70ebe17934799931afb9211a8e7c7e05a0bb4bf76ad7d55b9a2d1f42a65257532166c978f3dcaadb922a4d78926d1a53c5b6ab20b1d4a91f384609e837390db68cb32735ce906a959f8b3556ab495c73cf098b5185c819fee87b633b5d925b2fed1e23b676ea5400cc22874e9635c7b29253a6d15752d8b1fa128dfd3bc2dbd83ad897c9c4c80971560bdf0ead6d423eed4d592e05d07502211230d43511cd42101d4bad13e14db78895f391af47542fb53667c01ed155b579997a625502905bfeaa46b2f62810b957e02cf39074d8ca37160a1afa05f24b789459cfa502e232bc80784e8f3a70f7f2c63ee5b2fb30a9f9abd7fb832e8344667541e8011263555f1b3c6eab9f137c7cce2009b0eff5a367438fc9a6c75562011dd14892bad6c16f8f29e9f893c66ee681ba2edb638662f9bf8200ab1a68b70af3d50d501deecc718bcc0b2a5a9e684c84cfe51ab2610b12e2b0316f12b5026a74d23fc4cf955ffbaa1ef15820a1fcd76f562b0c4fb829d4580a33381983126046c5d9805afd8bc9a6f61ab82f465c993c13cafebcce2c79a1219b9f7e1859927e3e0db2d32054c8bccdf7ef4a2b5f8ab459c24068fb38db512dee5973c5f23fba469135316ff26b9f8ba3cf81f8e74f8b7bc9b503f566699a1c29ced0e89e6629cd8128535bdf6ed3cb5eb6564460f31824b9c94f062b34e43d595b658a1b65797844b5a2d3d2cc7a424db1718c05b925df9830b1d24969dc5ea45f38c8377b41ad491a2dfa0dba646145d23c2632109bda5c2e5f8ca5669625e63f9da83c64e26ec36bf40c49a320eb5cdf7fb20a1c3ca106f79282cfb8a4b101eb1f5decde7853b0999c3aeac30ebd9aa5398b4fa2a07fe43eb2ccfe845128de5bc94d39c7ddf1fed5d3742e6c622d98928d2ba96933d2a59860e4c0d862f63d21ca9621abde3700e691cd8c372a407de7033dd2f48db3d17af9bf017cd4bb9e904a71a519b20aad0ab468b3024a4bdf53a6683c3fd63de1b1a4b909c7a17d22105c7d1f07722558d1b76a1b96085cef60d1f63c74bd9c3201638fdbe738abd8ef478c8f49a2e5645aeec1a4b552662b5443443d102f961e0cb1d385e8988539cc9be133e0a667ca08b58c98b298423930d0f01d06d4654069888f62b15d80f30dd5faee2f0b0331d787c315c83e48d9df04c2bcf0c50637c3167f8dc1a8e2f521fdaaddf0c50637c3167f8dc1a8e2f521fdaadd7f01f4c0810a192f932ab1a369864dd2ba67ba9e3dc9d7d6e96bc702f692b7f793ff1f4769e7e5f13cc7e46e07be1d9b561cf5f334e9271ce0454363a31478f7955039add7c86ed3ca281f52e2bb189248264d2ad82fe249103e9b138dc1f687eaa042294e098b2fd186cd08ce9153c76cc5bc984e35b55e2587d8d50997b7cf86fef78c19225242f0710fd0834412e7";
decrypt(s,"SkRfRk9DSU1DX1VBVA0ODw==",dao);
List<Integer> ids = new ArrayList<>();
List<DspReleaseInfo> dspReleaseInfoList = dao.selectReleaseInfoByDate(dateTime.format(DateTimeFormatter.ISO_LOCAL_DATE) + " 00:00:00", dateTime.format(DateTimeFormatter.ISO_LOCAL_DATE)+" 23:59:59");
for (DspReleaseInfo ss : dspReleaseInfoList) {
//生成requestCode
Map<String, String> fltMap = buildFltPlanGatewayRequestString(ss.getFlightNo(), key, userAccount, password, ss.getStd(), ss.getDepIataId(), ss.getArrIataId());
//掉接口
String fltResultString = nativeHttpCall(fltMap, gatewayUatUrl, key);
decryptFlt(ss.getId(), fltResultString, key, dao);
ids.add(ss.getId());
}
session.commit();
}
public static void addHistoryPltPlan() {
LocalDateTime endTime = LocalDateTimeUtil.parse("2022-03-14", DateTimeFormatter.ofPattern("yyyy-MM-dd"));
System.out.println(endTime);
LocalDateTime startTime = LocalDateTimeUtil.parse("2022-01-01", DateTimeFormatter.ofPattern("yyyy-MM-dd"));
System.out.println(startTime);
long days = LocalDateTimeUtil.between(startTime,endTime, ChronoUnit.DAYS);
System.out.println(days);
for (int i = 0; i <=days; i++) {
String plus = startTime.plusDays(i).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDate parse = LocalDate.parse(plus);
System.out.println(parse);
try {
addPltPlan(parse);
}catch (Exception e){
log.error("std:"+parse+e.getMessage());
}
}
}
public static void main(String[] args) {
LocalDateTime endTime = LocalDateTimeUtil.parse("2022-03-14", DateTimeFormatter.ofPattern("yyyy-MM-dd"));
System.out.println(endTime);
LocalDateTime startTime = LocalDateTimeUtil.parse("2022-01-01", DateTimeFormatter.ofPattern("yyyy-MM-dd"));
System.out.println(startTime);
long days = LocalDateTimeUtil.between(startTime,endTime, ChronoUnit.DAYS);
System.out.println(days);
String format1 = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
for (int i = 0; i <=days; i++) {
LocalDateTime plus = startTime.plusDays(i);
String format = plus.format(DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00"));
if(format.contains(format1)){
continue;
}
String plusStr = startTime.plusDays(i).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
LocalDate parse = LocalDate.parse(plusStr);
System.out.println(parse);
}
}
}
......@@ -71,14 +71,13 @@ public class DynamicFlightService {
return verifyAcTypes;
}
public static void
sta() {
public static void sta() {
StatisticalDao dao = session.getMapper(StatisticalDao.class);
//总机型集合
List<String> verifyAcTypes = getVerifyAcType();
//获取航班动态表中所有航班性质为A,J,G,状态不为CNL,子机型为319/A320,321,320neo,330的航线的最后一班时间
//String date = DateUtils.getLastDate();
//获取航班动态表中所有航班性质为A,J,G,状态不为CNL,子机型为319/A320,321,320neo,330,321neo的航线的最后一班时间
// String date = DateUtils.getLastDate();
String date=DateUtils.getTime("yyyy-MM-dd 23:59:59");
List<StatisticalEntity> list = dao.getFlightList(date);
List<StatisticalEntity> slist = new ArrayList<>();
......@@ -175,4 +174,6 @@ public class DynamicFlightService {
session.close();
}
}
......@@ -26,7 +26,7 @@ toEmail=zangtao@bbdtek.com
#,lisu@bbdtek.com
#lisu@bbdtek.com
fromName=sdhkxxaq
verifyAcType=A319/A320,A321,A320neo,A330
verifyAcType=A319/A320,A320neo,A321,321neo,A330
#uat
#esb.security.account=JD_FOCIMC_UAT
#esb.security.key=SkRfRk9DSU1DX1VBVA0ODw==
......
......@@ -75,8 +75,8 @@
left join foc_airline_verify a on a.id = sc.verif_id
left join foc_aircraft_type b on a.aircraft_type = b.id
where a.verif_type in ('01','02','03','04') AND a.del_flag = 0 AND (a.flight_type='01' or a.flight_type='02' or
a.flight_type='03')
and a.depIata=#{entity.depIata} and a.arrIata=#{entity.arrIata} and b.del_flag=0
a.flight_type='03') and ((a.depIata=#{entity.depIata} and a.arrIata=#{entity.arrIata})
or (a.depIata=#{entity.arrIata } and a.arrIata=#{entity.depIata})) and b.del_flag=0 and 180-TIMESTAMPDIFF(DAY,a.start_time,CURRENT_TIMESTAMP)>0
<choose>
<when test="verifyAcType=='A319/A320'">
and upper(b.type_name) like concat(upper(#{verifyAcType}),'%')
......@@ -85,6 +85,7 @@
and upper(b.type_name) = upper(#{verifyAcType})
</otherwise>
</choose>
order by sc.create_date desc limit 1
</select>
......@@ -125,14 +126,15 @@
ffd.flight_no
</select>
<insert id="insertDspReleaseInfo" parameterType="java.util.List">
INSERT INTO foc_flight_dynamics_sta ( send_time, flight_no, std, ac_no, dep_iata_id, arr_iata_id, total_oil, dispatcher_name, extra_oil_fuel_reason, e_e_t, weight_unit
<insert id="insertDspReleaseInfo" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
INSERT INTO foc_flight_dynamics_sta (id, send_time, flight_no, std, ac_no, dep_iata_id, arr_iata_id, total_oil,
dispatcher_name, extra_oil_fuel_reason, e_e_t, weight_unit
, update_time,create_date,update_date, del_flag
,airline_oil,remark_msg,alt1_fuel,alt1_time,alt1_distance,alt2_fuel,alt2_time,alt2_distance,cruising_altitude,
dep_air_port_name,arr_air_port_name,dispatcher_account,ac_type_name,arr_icao_id,dep_icao_id)
dep_air_port_name,arr_air_port_name,dispatcher_account,ac_type_name,arr_icao_id,dep_icao_id,extra_oil_fuel_reason_new,extra_oil_conclusion,arr_alt_iata_id,flight_time)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
(null,
#{item.sendTime}
, #{item.flightNo}
, #{item.std}
......@@ -163,6 +165,10 @@
, #{item.acTypeName}
, #{item.arrIcaoId}
, #{item.depIcaoId}
, #{item.extraOilFuelReasonNew}
, #{item.extraOilConclusion}
, #{item.arrAltIataId}
, #{item.flightTime}
)
</foreach>
ON DUPLICATE KEY UPDATE
......@@ -175,7 +181,8 @@
</insert>
<insert id="insertDspReleaseInfo1" parameterType="java.util.List">
INSERT INTO foc_flight_dynamics_sta ( send_time, flight_no, std, ac_no, dep_iata_id, arr_iata_id, total_oil, dispatcher_name, extra_oil_fuel_reason, e_e_t, weight_unit, update_time,create_date,update_date, del_flag )
INSERT INTO foc_flight_dynamics_sta ( send_time, flight_no, std, ac_no, dep_iata_id, arr_iata_id, total_oil,
dispatcher_name, extra_oil_fuel_reason, e_e_t, weight_unit, update_time,create_date,update_date, del_flag )
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
......@@ -236,6 +243,59 @@
, stc = values(stc)
</insert>
<insert id="insertFltPlanInfo" parameterType="java.util.List">
INSERT INTO foc_flight_plan ( flight_no, std, dep_iata_id, arr_iata_id, cfp_flag,takeoff_weight,landing_weight,
payload_weight,zero_fuel,kal_cargo_load,
maximum_fuel_capacity,total,total_time,trip,trip_time,trip_dist,arrival_time,alternate_fuel,alternate_time,alternate_dist,
taxi_out,taxi_out_time, `hold`,
etop, etop_time,plan_left_over,reserve,reserve_time,extra,extra_time,custom_extra_time,limiting_takeoff_weight,limiting_landing_weight
, update_date,create_date,dynamics_sta_id)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.flightNo}
, #{item.std}
, #{item.depIataId}
, #{item.arrIataId}
, #{item.cfpFlag}
,#{item.takeoffWeight}
,#{item.landingWeight}
,#{item.payloadWeight}
,#{item.zeroFuel}
,#{item.kalCargoLoad}
,#{item.maximumFuelCapacity}
, #{item.total}
,#{item.totalTime}
, #{item.trip}
,#{item.tripTime}
,#{item.tripDist}
,#{item.arrivalTime}
,#{item.alternateFuel}
,#{item.alternateTime}
,#{item.alternateDist}
, #{item.taxiOut}
, #{item.taxiOutTime}
, #{item.hold}
, #{item.etop}
, #{item.etopTime}
, #{item.planLeftOver}
, #{item.reserve}
, #{item.reserveTime}
, #{item.extra}
, #{item.extraTime}
, #{item.customExtraTime}
, #{item.limitingTakeoffWeight}
, #{item.limitingLandingWeight}
, #{item.updateDate}
, #{item.createDate}
, #{item.dynamicsStaId}
)
</foreach>
</insert>
<select id="getFromBackUp" parameterType="com.foc.entity.StatisticalEntity" resultType="string">
select datop_chn
from foc_flight_dynamics_backup
......@@ -259,10 +319,13 @@
</select>
<select id="selectAcTypeNameByAcNo" resultType="java.lang.String">
select IFNULL(verify_ac_type,'') from foc_ac_type_oil where ac_no=#{acNo}
select IFNULL(verify_ac_type,'') from foc_ac_type_oil where ac_no=#{acNo} and year=#{year}
</select>
<select id="selectIcaoIdByTataId" resultType="java.lang.String">
select airport_icao from foc_airports where airport_iata=#{iataId}
</select>
<select id="selectReleaseInfoByDate" resultType="com.foc.entity.DspReleaseInfo">
select * from foc_flight_dynamics_sta where std BETWEEN #{startTime} and #{endTime}
</select>
</mapper>
\ 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