Commit e075b4c1 by vincent Lee

航班动态数据 定时任务修改

parent af392fff
......@@ -104,7 +104,7 @@
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.foc.StatisticalTask</mainClass>
<mainClass>com.foc.DbSoundsMonitorTask</mainClass>
</transformer>
</transformers>
</configuration>
......
......@@ -53,17 +53,28 @@ public class DynamicFlightService {
session.commit();
}
public static void sta() {
//从配置文件中获取需要统计的大机型
Properties properties = PropertiesUtils.getProperties();
String verifyAcType = properties.getProperty("verifyAcType");
if (StringUtils.isEmpty(verifyAcType)) {
/**
* 从配置文件中获取需要统计的大机型
* @return
*/
private static List<String> getVerifyAcType(){
List<String> verifyAcTypes = null;
try {
Properties properties = PropertiesUtils.getProperties();
String verifyAcType = properties.getProperty("verifyAcType");
verifyAcTypes = Arrays.asList(verifyAcType.split(","));
} catch (Exception e) {
e.printStackTrace();
log.error("获取配置文件中机型的文件");
return;
}
//总机型集合
List<String> verifyAcTypes = Arrays.asList(verifyAcType.split(","));
return verifyAcTypes;
}
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();
List<StatisticalEntity> list = dao.getFlightList(date);
......@@ -77,7 +88,7 @@ public class DynamicFlightService {
StatisticalEntity entity = dao.getAirlineStatic(e.getArrIata(), e.getDepIata());
//将机型数据放入到map中,机型为key,机型最后飞行时间为value
Map<String, String> map = new HashMap<>();
boolean update = false;
// boolean update = false;
if (Objects.isNull(entity)) {
entity = new StatisticalEntity();
} else {
......@@ -87,16 +98,21 @@ public class DynamicFlightService {
map.put(acType.getType(), acType.getLastTime());
}
}
// if("HGH".equals(e.getDepIata()) && "YVR".equals(e.getArrIata())){
// System.out.println("entity:" + JSON.toJSONString(entity));
// System.out.println("map:" + JSON.toJSONString(map));
// }
entity.setArrIata(e.getArrIata());
entity.setArrIataName(e.getArrIataName());
entity.setDepIata(e.getDepIata());
entity.setDepIataName(e.getDepIataName());
//从备份表中查询是否有该航班,如果有,更新最后执行时间
String backupDate = dao.getFromBackUp(entity);
if (!StringUtils.isEmpty(backupDate)) {
entity.setLastAirlineTime(lastDate);
update = true;
}
// String backupDate = dao.getFromBackUp(entity);
// if (!StringUtils.isEmpty(backupDate)) {
// // entity.setLastAirlineTime(lastDate);
// update = true;
// }
entity.setLastAirlineTime(lastDate);
List<AcType> acTypeList = new ArrayList<>();
//遍历论证机型查询对应小机型
for (String str : verifyAcTypes) {
......@@ -117,9 +133,10 @@ public class DynamicFlightService {
*/
String acTypeLastTime = dao.getFlightByDepAndArr(e, lacTypes, date);
String verifyDate = dao.getSailingCommand(e, str);
if (StringUtils.isEmpty(acTypeLastTime)) {
//判断是否有论证,判断范围在verify_type为(01,02,03,04),flight_type为(01正班,02加班,03包机,对应前边航班动态中航班类型为J,G,A)
String verifyDate = dao.getSailingCommand(e, str);
if (StringUtils.isEmpty(verifyDate)) {
acType.setStatus("3");
} else {
......@@ -127,12 +144,21 @@ public class DynamicFlightService {
}
} else {
//如果机型最后执行时间和航班最后执行时间相等,则说明该机型执行了最后航班,根据update标识决定是否要更新
if (acTypeLastTime.equals(lastDate) && update) {
acType.setLastTime(acTypeLastTime);
} else {
acType.setLastTime(map.get(str));
}
// if (acTypeLastTime.equals(lastDate) && update) {
// acType.setLastTime(acTypeLastTime);
// if("HGH".equals(e.getDepIata()) && "YVR".equals(e.getArrIata())){
// System.out.println("e:" + e);
// System.out.println("LastTime(acTypeLastTime):" + acTypeLastTime);
// }
// } else {
// acType.setLastTime(map.get(str));
// if("HGH".equals(e.getDepIata()) && "YVR".equals(e.getArrIata())){
// System.out.println("e:" + e);
// System.out.println("LastTime(map):" + map.get(str));
// }
// }
acType.setStatus("1");
acType.setLastTime(acTypeLastTime);
}
acTypeList.add(acType);
}
......
......@@ -17,7 +17,7 @@
LEFT JOIN foc_airports a ON d.dep_stn = a.airport_iata
LEFT JOIN foc_airports fa ON d.arr_stn = fa.airport_iata
WHERE
(d.`stc` = 'J' or d.`stc` = 'A' or d.`stc` = 'G')
d.stc IN ('J', 'A', 'G', 'H')
AND d.`status`!='CNL'
AND d.`atd_chn` &lt;= #{date}
GROUP BY
......@@ -30,14 +30,14 @@
DATE_FORMAT(std_chn,'%Y/%m/%d') as lastAirlineTime
from foc_flight_dynamics
where dep_stn=#{entity.depIata} and arr_stn=#{entity.arrIata}
AND (`stc` = 'J' or `stc` = 'A' or `stc` = 'G')
AND stc IN ('J', 'A', 'G', 'H')
AND `status`!='CNL'
AND `atd_chn` &lt;= #{date}
and ac_type in
<foreach item="acType" collection="acTypes" separator="," open="(" close=")" index="">
#{acType}
</foreach>
order by atd desc limit 1;
order by std_chn desc limit 1;
</select>
<select id="getLacTypesByVerifyAcType" resultType="string">
......@@ -160,7 +160,7 @@
select datop_chn,dep_stn,arr_stn,std_chn,sta_chn,flight_no,stc
from foc_flight_dynamics
where datop_chn=#{date}
and (stc='A' or stc='J' or stc='G')
and stc IN ('J', 'A', 'G', 'H')
</select>
<insert id="addDynamicsList" parameterType="com.foc.entity.Dynamics">
......
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