Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
task3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
首航-临时账号
task3.0
Commits
e075b4c1
Commit
e075b4c1
authored
Oct 19, 2021
by
vincent Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
航班动态数据 定时任务修改
parent
af392fff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
25 deletions
+51
-25
pom.xml
pom.xml
+1
-1
DynamicFlightService.java
src/main/java/com/foc/service/DynamicFlightService.java
+46
-20
StatisticalMapper.xml
src/main/resources/mapper/StatisticalMapper.xml
+4
-4
No files found.
pom.xml
View file @
e075b4c1
...
...
@@ -104,7 +104,7 @@
<transformers>
<transformer
implementation=
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"
>
<mainClass>
com.foc.
Statistical
Task
</mainClass>
<mainClass>
com.foc.
DbSoundsMonitor
Task
</mainClass>
</transformer>
</transformers>
</configuration>
...
...
src/main/java/com/foc/service/DynamicFlightService.java
View file @
e075b4c1
...
...
@@ -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
);
}
...
...
src/main/resources/mapper/StatisticalMapper.xml
View file @
e075b4c1
...
...
@@ -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`
<
= #{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`
<
= #{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"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment