Commit b018cc44 by java-李谡

变更航班动态统计逻辑

parent 464ea9d1
...@@ -47,9 +47,10 @@ public interface StatisticalDao { ...@@ -47,9 +47,10 @@ public interface StatisticalDao {
* 查询航线论证 * 查询航线论证
* *
* @param entity * @param entity
* @param strs
* @return * @return
*/ */
int getVerify(@Param(value = "entity") StatisticalEntity entity); int getVerify(@Param(value = "entity") StatisticalEntity entity, @Param(value = "list") List<String> strs);
/** /**
* 查询开航指令 * 查询开航指令
......
...@@ -53,6 +53,7 @@ public class DynamicFlightService { ...@@ -53,6 +53,7 @@ public class DynamicFlightService {
log.error("获取配置文件中机型的文件"); log.error("获取配置文件中机型的文件");
return; return;
} }
//总机型集合
List<String> verifyAcTypes = Arrays.asList(verifyAcType.split(",")); List<String> verifyAcTypes = Arrays.asList(verifyAcType.split(","));
StatisticalDao dao = session.getMapper(StatisticalDao.class); StatisticalDao dao = session.getMapper(StatisticalDao.class);
//获取航班动态表中所有航班性质为J,状态为ATA,机型为319/A320,321,320neo,330的航线的最后一班时间 //获取航班动态表中所有航班性质为J,状态为ATA,机型为319/A320,321,320neo,330的航线的最后一班时间
...@@ -74,6 +75,7 @@ public class DynamicFlightService { ...@@ -74,6 +75,7 @@ public class DynamicFlightService {
for (String str : verifyAcTypes) { for (String str : verifyAcTypes) {
AcType acType = new AcType(); AcType acType = new AcType();
acType.setType(str); acType.setType(str);
//获取总机型下的子机型集合
List<String> lacTypes = dao.getLacTypesByVerifyAcType(str); List<String> lacTypes = dao.getLacTypesByVerifyAcType(str);
if (CollectionUtils.isEmpty(lacTypes)) { if (CollectionUtils.isEmpty(lacTypes)) {
continue; continue;
...@@ -82,7 +84,7 @@ public class DynamicFlightService { ...@@ -82,7 +84,7 @@ public class DynamicFlightService {
1.如果有航班动态时间(实际起飞时间): 1.如果有航班动态时间(实际起飞时间):
状态显示动态日期(status=1) 状态显示动态日期(status=1)
2. 如果没有航班动态时间: 2. 如果没有航班动态时间:
(1)有论证记录(论证中或论证成功 (1)有论证记录(查询开航指令集中的航班性质为正班,且申请单类型为:新开重开国内国际
状态可用(status=2) 状态可用(status=2)
(2)没有论证,状态不可用(status=3) (2)没有论证,状态不可用(status=3)
...@@ -90,8 +92,8 @@ public class DynamicFlightService { ...@@ -90,8 +92,8 @@ public class DynamicFlightService {
String acTypeLastTime = dao.getFlightByDepAndArr(e, lacTypes, date); String acTypeLastTime = dao.getFlightByDepAndArr(e, lacTypes, date);
if (StringUtils.isEmpty(acTypeLastTime)) { if (StringUtils.isEmpty(acTypeLastTime)) {
//判断是否有论证 //判断是否有论证
int count = dao.getVerify(e); String verifyDate = dao.getSailingCommand(e, str);
if (count == 0) { if (StringUtils.isEmpty(verifyDate)) {
acType.setStatus("3"); acType.setStatus("3");
} else { } else {
acType.setStatus("2"); acType.setStatus("2");
......
...@@ -28,7 +28,6 @@ public class DateUtils { ...@@ -28,7 +28,6 @@ public class DateUtils {
public static String getLastDate() { public static String getLastDate() {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
Date d = cal.getTime(); Date d = cal.getTime();
SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
String time = sp.format(d); String time = sp.format(d);
......
...@@ -13,9 +13,8 @@ ...@@ -13,9 +13,8 @@
LEFT JOIN foc_airports a ON d.dep_stn = a.airport_iata LEFT JOIN foc_airports a ON d.dep_stn = a.airport_iata
LEFT JOIN foc_airports fa ON d.arr_stn = fa.airport_iata LEFT JOIN foc_airports fa ON d.arr_stn = fa.airport_iata
WHERE WHERE
d.`status` = 'ATA' d.`stc` = 'J'
AND d.`stc` = 'J' AND d.`atd_chn` &lt;= #{date}
AND d.`atd` &lt;= #{date}
GROUP BY GROUP BY
d.dep_stn, d.dep_stn,
d.arr_stn d.arr_stn
...@@ -26,9 +25,8 @@ ...@@ -26,9 +25,8 @@
DATE_FORMAT(atd,'%Y/%m/%d') as lastAirlineTime DATE_FORMAT(atd,'%Y/%m/%d') as lastAirlineTime
from foc_flight_dynamics from foc_flight_dynamics
where dep_stn=#{entity.depIata} and arr_stn=#{entity.arrIata} where dep_stn=#{entity.depIata} and arr_stn=#{entity.arrIata}
and `status` = 'ATA' AND `stc` = 'J'
AND `stc` = 'J' AND `atd_chn` &lt;= #{date}
AND `atd` &lt;= #{date}
and ac_type in and ac_type in
<foreach item="acType" collection="acTypes" separator="," open="(" close=")" index=""> <foreach item="acType" collection="acTypes" separator="," open="(" close=")" index="">
#{acType} #{acType}
...@@ -44,57 +42,66 @@ ...@@ -44,57 +42,66 @@
verify_ac_type=#{verifyAcType} verify_ac_type=#{verifyAcType}
</select> </select>
<select id="getLacTypesByVerifyAcTypes" resultType="string"> <select id="getLacTypesByVerifyAcTypes" resultType="string">
SELECT SELECT
ac_type ac_type
from foc_ac_type_compare from foc_ac_type_compare
where where
verify_ac_type in verify_ac_type in
<foreach collection="list" item="item" index="index" separator="," open="(" close=")"> <foreach collection="list" item="item" index="index" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="getVerify" resultType="int"> <select id="getVerify" resultType="int">
select count(1) select count(1)
from foc_airline_verify a from foc_airline_verify a
left join foc_aircraft_type t on a.aircraft_type=t.id
left join foc_aircraft_type d on t.parent_id=d.id
where a.del_flag = 0 and a.verif_type in ('01','02','03','04') where a.del_flag = 0 and a.verif_type in ('01','02','03','04')
and a.depIata=#{entity.depIata} and a.arrIata=#{entity.arrIata} and a.depIata=#{entity.depIata} and a.arrIata=#{entity.arrIata}
</select> </select>
<select id="getSailingCommand" resultType="string"> <select id="getSailingCommand" resultType="string">
SELECT SELECT
sc.create_date sc.create_date
from foc_sailing_command sc from foc_sailing_command sc
left join foc_airline_verify a on a.id = sc.verif_id left join foc_airline_verify a on a.id = sc.verif_id
left join foc_aircraft_type b on a.aircraft_type = b.id left join foc_aircraft_type b on a.aircraft_type = b.id
where a.verif_status='02' AND a.del_flag = 0 where a.verif_type in ('01','02','03','04') AND a.del_flag = 0 AND a.flight_type='01'
and a.depIata=#{entity.depIata} and a.arrIata=#{entity.arrIata} and a.depIata=#{entity.depIata} and a.arrIata=#{entity.arrIata} and b.del_flag=0
and b.id=#{verifyAcType} <choose>
order by sc.create_date desc limit 1 <when test="verifyAcType=='A319/A320'">
</select> and upper(b.type_name) like concat(upper(#{verifyAcType}),'%')
</when>
<otherwise>
and upper(b.type_name) = upper(#{verifyAcType})
</otherwise>
</choose>
order by sc.create_date desc limit 1
</select>
<insert id="insertOrUpdateBatch" parameterType="java.util.List"> <insert id="insertOrUpdateBatch" parameterType="java.util.List">
INSERT INTO foc_airline_sta INSERT INTO foc_airline_sta
(arr_iata, arr_iata_name, dep_iata, dep_iata_name, last_airline_time, airline_json, update_date, del_flag) (arr_iata, arr_iata_name, dep_iata, dep_iata_name, last_airline_time, airline_json, update_date, del_flag)
VALUES VALUES
<foreach collection="list" item="item" index="index" separator="," > <foreach collection="list" item="item" index="index" separator=",">
( (
#{item.arrIata} #{item.arrIata}
, #{item.arrIataName} , #{item.arrIataName}
, #{item.depIata} , #{item.depIata}
, #{item.depIataName} , #{item.depIataName}
, #{item.lastAirlineTime} , #{item.lastAirlineTime}
, #{item.airlineJson} , #{item.airlineJson}
, #{item.updateTime} , #{item.updateTime}
, #{item.delFlag} , #{item.delFlag}
) )
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
last_airline_time = values(last_airline_time) last_airline_time = values(last_airline_time)
, airline_json = values(airline_json) , airline_json = values(airline_json)
, update_date = values(update_date) , update_date = values(update_date)
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<setting name="logImpl" value="STDOUT_LOGGING"/> <setting name="logImpl" value="STDOUT_LOGGING"/>
</settings> </settings>
<environments default="dev"> <environments default="pro">
<environment id="dev"> <environment id="dev">
<transactionManager type="JDBC"/> <transactionManager type="JDBC"/>
...@@ -48,12 +48,23 @@ ...@@ -48,12 +48,23 @@
<property name="driver" value="com.mysql.cj.jdbc.Driver"/> <property name="driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="url" <property name="url"
value="jdbc:mysql://81.69.44.115:5508/jd_foc?serverTimezone=CTT&amp;useUnicode=true&amp;characterEncoding=utf-8"/> value="jdbc:mysql://81.69.44.115:5508/jd_foc?serverTimezone=CTT&amp;useUnicode=true&amp;characterEncoding=utf-8"/>
<!-- <property name="url" value="jdbc:mysql://mysql_server:3306/foc?serverTimezone=CTT&amp;useUnicode=true&amp;characterEncoding=utf-8"/>-->
<property name="username" value="sms_develop"/> <property name="username" value="sms_develop"/>
<property name="password" value="Develop2018!@#"/> <property name="password" value="Develop2018!@#"/>
</dataSource> </dataSource>
</environment> </environment>
<environment id="pro">
<transactionManager type="JDBC"/>
<!-- 配置数据库连接信息 -->
<dataSource type="POOLED">
<property name="driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="url"
value="jdbc:mysql://mysql_server:3306/foc?serverTimezone=CTT&amp;useUnicode=true&amp;characterEncoding=utf-8"/>
<property name="username" value="focuser"/>
<property name="password" value="FOC@2016"/>
</dataSource>
</environment>
</environments> </environments>
......
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