Commit b018cc44 by java-李谡

变更航班动态统计逻辑

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