Commit a7da26ee by zhangyu

修改

parent c2757cd8
......@@ -93,4 +93,70 @@
ORDER BY ata_chn DESC
LIMIT 1
</select>
<select id="getStatisticalArrIataList" resultType="com.ejweb.modules.airport.entity.StatisticalEntity">
SELECT a.verif_no as verifNo,
a.id as verifId,
CASE WHEN a.verif_type='01' OR a.verif_type='02'
OR a.verif_type='03' OR a.verif_type='04' OR a.verif_type='05'
THEN b.flight_no
ELSE a.flight_no
END flightNo,
a.route_no AS routeNo,
a.aircraft_type,
TIMESTAMPDIFF(DAY,a.start_time,CURRENT_TIMESTAMP) AS expiryDate,
roundtrip_type,
IFNULL(b.depIata,a.depIata) AS depIata,
b.arrIata,
DATE_FORMAT(a.start_time, '%Y-%m-%d') AS startTime,
CASE WHEN a.verif_type='01' OR a.verif_type='02'
OR a.verif_type='03' OR a.verif_type='04' OR a.verif_type='05'
THEN p.city_name
ELSE tt.airport_name
END depIataName,
a.verif_type as verifType,
r.city_name AS arrIataName,
a.verifued_count AS verifuedCount,
a.depart_id as departId,
d.file_path as filePath,
c.type_name as typeName,
a.state
from foc_airline_verify a
left JOIN foc_airline_connect b on a.id = b.verif_id AND b.Is_main!='0'
LEFT JOIN foc_aircraft_type c on a.aircraft_type = c.id
LEFT JOIN foc_sailing_file d on a.id = d.verif_id
LEFT JOIN foc_airports p ON p.airport_iata = b.depIata
LEFT JOIN foc_sailing_command cc ON a.id = cc.verif_id
LEFT JOIN foc_airports r ON r.airport_iata = b.arrIata
LEFT JOIN foc_airports tt ON tt.airport_iata = a.depIata
where a.verif_status='02' AND a.del_flag = #{DEL_FLAG_NORMAL}
<if test="routeNo != null and routeNo != ''">
AND a.route_no LIKE
<if test="dbName == 'oracle'">'%'||#{routeNo}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{routeNo}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{routeNo}, '%')</if>
</if>
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE
<if test="dbName == 'oracle'">'%'||#{verifNo}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{verifNo}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{verifNo}, '%')</if>
</if>
<if test="verifType != null and verifType != ''">
AND a.verif_type = #{verifType}
</if>
AND (a.id in (
SELECT id FROM foc_airline_verify where depIata =#{depIata} AND arrIata= #{arrIata} ) OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata =#{depIata} and arrIata =#{arrIata} AND is_main != '0')
)
<if test="aircraftType != null and aircraftType != ''">
AND a.aircraft_type = #{aircraftType}
</if>
GROUP BY verifNo,routeNo,arrIata,depIata
</select>
</mapper>
\ No newline at end of file
......@@ -3,12 +3,12 @@
*/
package com.ejweb.modules.airport.dao;
import java.util.List;
import com.ejweb.core.base.BaseDao;
import com.ejweb.modules.airport.bean.StatisticalBean;
import com.ejweb.modules.airport.entity.StatisticalEntity;
import java.util.List;
/**
*
* @team suzhou
......@@ -19,5 +19,6 @@ import com.ejweb.modules.airport.entity.StatisticalEntity;
public interface StatisticalDao extends BaseDao{
List<StatisticalEntity> getStatisticalList(StatisticalBean bean);
List<StatisticalEntity> getStatisticalArrIataList(StatisticalBean bean);
Integer getDay(StatisticalEntity entity);
}
......@@ -18,6 +18,8 @@ import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
......@@ -46,7 +48,15 @@ public class StatisticalService extends BaseService<StatisticalDao> {
} else {
PageHelper.orderBy("source," + bean.getSort());
}
List<StatisticalEntity> lists = dao.getStatisticalList(bean);
// 双向查询目的地修正
String depIata = bean.getDepIata();
String arrIata = bean.getArrIata();
List<StatisticalEntity> lists = null;
if (depIata.length() != 0 && arrIata.length() != 0) {
lists = dao.getStatisticalArrIataList(bean);
} else {
lists = dao.getStatisticalList(bean);
}
LOG.info("用户userCode:" + bean.getUserCode());
String departId = airlineVerifiedDao.findDepartId(abean);
for (StatisticalEntity e : lists) {
......@@ -60,11 +70,23 @@ public class StatisticalService extends BaseService<StatisticalDao> {
} else {
e.setReStart(false);
}
// 根据调机进行状态修改
String startTime = e.getStartTime();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String format = sdf.format(date);
if ("05".equals(e.getVerifType())) {
if (null != startTime && format == startTime) {
e.setExpiryDate(10 + "");
} else {
e.setExpiryDate(-10 + "");
}
}
if ("06".equals(e.getVerifType()) || "07".equals(e.getVerifType())
|| "08".equals(e.getVerifType())) {
e.setExpiryDate("长期有效");
} else {
} else if (!"05".equals(e.getVerifType())) {
Integer day = dao.getDay(e);
if (day != null) {
if (day > 180 && Integer.parseInt(e.getExpiryDate()) > 180) {
......
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