Commit 659736db by java-李谡

Merge remote-tracking branch 'origin/dev-ls'

# Conflicts:
#	src/com/ejweb/core/util/Util.java
parents 65fdc2bd 677aac65
......@@ -57,7 +57,7 @@
<filter-class>com.ejweb.core.filter.BasicVerifyFilter</filter-class>
<init-param>
<param-name>excludedPages</param-name>
<param-value>*</param-value>
<param-value>/api/user/login;/api/call/findPhoneInfo</param-value>
</init-param>
</filter>
<filter-mapping>
......
......@@ -67,7 +67,7 @@ seat.default.photo=images/user/avatar/seat_avatar.png
# Sign Private Key(Default FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn)
content.sign.private.key=FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn
# Verify Post Content Sign(Default true)
is.verify.content.sign=false
is.verify.content.sign=true
# \u9996\u822A\u63A5\u53E3\u57FA\u672C\u5730\u5740
jdair.api.base.url=https://dsp.jdair.net
jdair.api.base.param=ai.cc=7&ai.cp=10.68.26.52
......
#MySQL Database Config(The All Config Is Must)
db.table.prefix=foc_
jdbc.type=mysql
jdbc.driver.class=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://106.75.97.50:3306/jd_foc?useUnicode=true&characterEncoding=utf-8&useSSL=true
jdbc.username=focuser
jdbc.password=FOC@2016
#\u521d\u59cb\u5316\u8fde\u63a5
jdbc.url=jdbc:mysql://81.69.44.115:5508/jd_foc?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
jdbc.username=sms_develop
jdbc.password=Develop2018!@#
#\u521d\u59cb\u5316\u8fde\u63a5
jdbc.initialSize=0
#\u8fde\u63a5\u6c60\u7684\u6700\u5927\u6d3b\u52a8\u4e2a\u6570
jdbc.maxActive=20
......
......@@ -39,21 +39,33 @@
<if test="verifNo != null and verifNo != ''">
AND b.verif_no LIKE CONCAT('%', #{verifNo}, '%')
</if>
<if test="depIata != null and depIata != ''">
<if test="depIataList != null ">
AND (b.id in (
SELECT id FROM foc_airline_verify where depIata = #{depIata} )
OR b.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata = #{depIata} AND is_main != '0')
)
SELECT id FROM foc_airline_verify where depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR b.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="arrIata != null and arrIata != ''">
<if test="arrIataList != null">
AND (b.id in (
SELECT id FROM foc_airline_verify where arrIata = #{arrIata} )
OR b.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata = #{arrIata} AND is_main != '0')
)
SELECT id FROM foc_airline_verify where arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR b.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="priority != null and priority != ''">
AND b.priority = #{priority}
......
......@@ -21,7 +21,7 @@
SELECT
<include refid="airportColumns"/>
FROM foc_airports a
WHERE a.status=1
WHERE 1=1
<if test="keywords != null">
AND (a.airport_name LIKE #{keywords} OR a.airport_iata LIKE #{keywords} OR a.airport_name_pinyin LIKE #{keywords})
</if>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ejweb.modules.airport.dao.OilAnalysisDao">
<select id="getOilAnalysisData" resultType="com.ejweb.modules.airport.entity.OilAnalysisEntity">
select DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i')as std,
DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i:%s')as stdExcel,
sta.flight_no,
sta.ac_no,
sta.dispatcher_name,
IFNULL(u.name,'') as dispatcherAccount,
sta.total_oil,
sta.dep_iata_id,
sta.arr_iata_id,
sta.extra_oil_fuel_reason,
DATE_FORMAT(sta.update_date, '%Y/%m/%d')as updateDate,
DATE_FORMAT(sta.update_time, '%Y/%m/%d %H:%i:%s')as updateTime,
airArr.city_name as arrAirPortName,
airdep.city_name as depAirPortName,
IFNULL(acType.type_name,'') as acTypeName
from foc_flight_dynamics_sta sta
left join foc_airports airArr on airArr.airport_iata = sta.arr_iata_id
left join foc_airports airdep on airdep.airport_iata = sta.dep_iata_id
left join foc_ac_type acType on acType.flight_no = sta.ac_no
left join sys_user u on u.login_name = sta.dispatcher_name
where 1=1
<if test="arrIata!=null and arrIata!='' ">
and sta.arr_iata_id = #{arrIata}
</if>
<if test="depIata!=null and depIata!='' ">
and sta.dep_iata_id = #{depIata}
</if>
<if test="flightNo!=null and flightNo!='' ">
and sta.flight_no = #{flightNo}
</if>
<if test="dispatcherZH!=null and dispatcherZH!=''">
and u.name LIKE CONCAT('%',#{dispatcherZH}, '%')
</if>
<if test="dispatcherENG!=null and dispatcherENG!=''">
and sta.dispatcher_name LIKE CONCAT('%',#{dispatcherENG}, '%')
</if>
<if test="minDepTime !=null and minDepTime!=''">
and sta.std <![CDATA[>=]]> date_format(#{minDepTime},'%Y-%c-%d %H:%i')
</if>
<if test="maxDepTime !=null and maxDepTime!=''">
and sta.std <![CDATA[<]]> date_format(#{maxDepTime},'%Y-%c-%d %H:%i')
</if>
<if test="mintotalOil !=null and mintotalOil!=''">
and substring_index(sta.total_oil,'KGS',1) >= #{mintotalOil}
</if>
<if test="maxtotalOil !=null and maxtotalOil!=''">
and substring_index(sta.total_oil,'KGS',1) <![CDATA[<]]> #{maxtotalOil}
</if>
order by std desc
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ejweb.modules.airport.dao.StatisticalDao">
<select id="getStatisticalList" resultType="com.ejweb.modules.airport.entity.StatisticalEntity">
<select id="getStatisticalList" 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'
......@@ -56,22 +56,36 @@
<if test="verifType != null and verifType != ''">
AND a.verif_type = #{verifType}
</if>
<if test="depIata != null and depIata != ''">
<if test="depIataList != null ">
AND (a.id in (
SELECT id FROM foc_airline_verify where depIata = #{depIata} ) OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata = #{depIata} AND is_main != '0')
)
</if>
<if test="arrIata != null and arrIata != ''">
AND (a.id in (
SELECT id FROM foc_airline_verify where arrIata = #{arrIata} ) OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata = #{arrIata} AND is_main != '0')
)
SELECT id FROM foc_airline_verify where depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="arrIataList != null ">
AND (a.id in (
SELECT id FROM foc_airline_verify where arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="aircraftType != null and aircraftType != ''">
AND a.aircraft_type = #{aircraftType}
</if>
......@@ -93,4 +107,123 @@
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 CONCAT('%', #{routeNo}, '%')
</if>
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE CONCAT('%', #{verifNo}, '%')
</if>
<if test="verifType != null and verifType != ''">
AND a.verif_type = #{verifType}
</if>
AND ((b.depIata=#{depIata} and b.arrIata= #{arrIata}) or (b.arrIata=#{depIata} and b.depIata= #{arrIata}))
<if test="aircraftType != null and aircraftType != ''">
AND a.aircraft_type = #{aircraftType}
</if>
GROUP BY verifNo,routeNo
</select>
<select id="getList" resultType="com.ejweb.modules.airport.entity.StatisticalListEntity">
SELECT
favt.arr_iata AS arrIata,
favt.arr_iata_name AS arrIataName,
favt.dep_iata AS depIata,
favt.dep_iata_name AS depIataName,
DATE_FORMAT(favt.last_airline_time,'%Y/%m/%d') AS lastAirlineTime,
CASE
WHEN
DATE_SUB( #{bean.benchmarkingTime}, INTERVAL 180 DAY ) <![CDATA[<=]]> favt.last_airline_time
AND
favt.last_airline_time <![CDATA[<=]]> DATE_SUB( #{bean.benchmarkingTime}, INTERVAL - 180 DAY )
THEN
1
ELSE
0
END AS airlineStatus,
favt.airline_json AS airlineJson,
favt.update_date as updateTime
FROM
foc_airline_sta favt
WHERE
favt.del_flag = #{bean.DEL_FLAG_NORMAL}
<!--当出发地不为空,目的地为空 -->
<if test="(bean.depIata != null and bean.depIata != '') ">
AND ( favt.dep_iata LIKE CONCAT('%', #{bean.depIata}, '%')
or favt.arr_iata LIKE CONCAT('%', #{bean.depIata}, '%')
)
</if>
<!--当出发地为空,目的地不为空 -->
<if test=" (bean.arrIata != null and bean.arrIata != '')">
and ( favt.dep_iata LIKE CONCAT('%', #{bean.arrIata}, '%')
or favt.arr_iata LIKE CONCAT('%', #{bean.arrIata}, '%')
)
</if>
<if test="bean.beginTime != null and bean.beginTime != '' and bean.endTime !=null and bean.endTime != ''">
and #{bean.beginTime} <![CDATA[<=]]> favt.last_airline_time
and
<foreach collection="list" item="item" index="index" separator="or" open="(" close=")">
(favt.dep_iata = #{item.depStn}
and favt.arr_iata = #{item.arrStn})
</foreach>
</if>
ORDER BY favt.last_airline_time DESC
</select>
<select id="getAirporStnList" resultType="com.ejweb.modules.airport.entity.AirportInfoEntity">
SELECT
dep_stn,
arr_stn
FROM
foc_flight_dynamics
WHERE
atd_chn BETWEEN #{beginTime}
AND #{endTime}
GROUP BY
dep_stn,
arr_stn;
</select>
</mapper>
\ No newline at end of file
......@@ -48,22 +48,34 @@
<if test="verifNo != null and verifNo != ''">
AND v.verif_no like concat ('%',#{verifNo},'%')
</if>
<if test="depIata!=null and depIata!=''">
AND (v.id in (
SELECT id FROM foc_airline_verify where depIata = #{depIata} )
OR v.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata = #{depIata} AND is_main != '0')
)
</if>
<if test="arrIata!=null and arrIata!=''">
AND (v.id in (
SELECT id FROM foc_airline_verify where arrIata = #{arrIata} )
OR v.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata = #{arrIata} AND is_main != '0')
)
<if test="depIataList!=null ">
AND (v.id in (
SELECT id FROM foc_airline_verify where depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR v.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="arrIataList!=null ">
AND (v.id in (
SELECT id FROM foc_airline_verify where arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR v.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="priority!=null and priority!=''">
AND v.priority = #{priority}
</if>
......
......@@ -46,5 +46,27 @@
AND verif_id=#{verifId}
</if>
</select>
<select id="findDepartByList" resultType="com.ejweb.modules.depart.entity.DepartEntity">
SELECT
fu.id,
fu.depart_name,
fu.is_verif,
fu.is_risk,
f.depart_id
FROM `foc_user_depart_type` f
INNER JOIN foc_user_depart fu on f.depart_id = fu.id AND fu.del_flag='0'
WHERE f.del_flag = '0'
<if test="type != null and type !=''">
AND f.type=#{type}
</if>
</select>
<select id="findDepartAllList" resultType="com.ejweb.modules.depart.entity.DepartTypeEntity">
SELECT
a.id,
a.is_verif,
a.is_risk,
a.depart_name
FROM foc_user_depart a
WHERE a.del_flag = '0'
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ejweb.modules.flight.dao.AirCarrierDao" >
<mapper namespace="com.ejweb.modules.flight.dao.AirCarrierDao">
<!-- 获取当天的飞机号列表 -->
<select id="findAirCarrierList" resultType="com.ejweb.modules.flight.entity.AirCarrierListEntity">
<!--
......@@ -13,25 +13,25 @@
)
-->
SELECT s.id,
s.satellite_phone,
a.ac_long_no AS satellite_name
s.satellite_phone,
a.ac_long_no AS satellite_name
FROM (
SELECT DISTINCT d.ac_long_no
FROM foc_flight_dynamics d
WHERE d.ac_long_no != ''
<if test="queryDate != null and queryDate != ''">
AND d.datop_chn=#{queryDate}
</if>
ORDER BY d.etd_chn DESC
SELECT DISTINCT d.ac_long_no
FROM foc_flight_dynamics d
WHERE d.ac_long_no != ''
<if test="queryDate != null and queryDate != ''">
AND d.datop_chn=#{queryDate}
</if>
ORDER BY d.etd_chn DESC
) a
LEFT JOIN foc_satellite_phone s
ON a.ac_long_no = s.satellite_name
AND s.status=1
ON a.ac_long_no = s.satellite_name
AND s.status=1
<if test="airCarrierNo != null and airCarrierNo != ''">
WHERE a.ac_long_no LIKE
<if test="dbName == 'oracle'">'%'||#{airCarrierNo}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{airCarrierNo}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{airCarrierNo}, '%')</if>
WHERE a.ac_long_no LIKE
<if test="dbName == 'oracle'">'%'||#{airCarrierNo}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{airCarrierNo}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{airCarrierNo}, '%')</if>
</if>
</select>
<!-- 查询航班列表 -->
......@@ -59,7 +59,22 @@
d.status,
d.flight_no,
d.ac_long_no,
d.datop_chn AS flightDate
d.datop_chn AS flightDate,
case d.stc when 'A' then '货运包机'
when 'C' then '旅客包机'
when 'D' then '补班'
when 'E' then '专机'
when 'F' then '货机'
when 'G' then '加班'
when 'H' then '货物加班'
when 'J' then '正班'
when 'K' then '训练/本场训练'
when 'L' then '急救'
when 'O' then '公务飞行'
when 'P' then '调机'
when 'T' then '试飞'
when 'X' then '技术经停'
else '其他' end `stc`
FROM foc_flight_dynamics d
INNER JOIN foc_airports dp
ON d.dep_stn=dp.airport_iata
......
......@@ -33,8 +33,8 @@
status,
s.create_by,
s.create_date,
update_by,
update_date,
s.update_by,
s.update_date,
s.remarks,
url,
is_complete,
......@@ -43,9 +43,11 @@
foc_notify s
LEFT JOIN foc_verify_record r
ON s.verif_id=r.verif_id AND ((r.record_type='01' AND r.record_status='00') or r.verif_id is null)
LEFT JOIN foc_airline_verify a ON s.verif_id=a.id
WHERE
s.del_flag =#{DEL_FLAG_NORMAL}
AND a.verif_status!= '01'
AND a.verif_status!= '02'
AND s.depart_id = #{departId}
AND (s.type
IN (
......
......@@ -51,15 +51,27 @@
WHERE s.id=#{userCode} AND m.name like CONCAT('航线论证Web','%')
</select>
<select id="getParentRoles" resultType="com.ejweb.modules.role.entity.UserRolesEntity">
SELECT DISTINCT(p.id), p.permission,p.name AS menuName
<select id="getOilRole" resultType="java.lang.Integer">
SELECT
count( * )
FROM
sys_user2role ur
LEFT JOIN sys_role r ON r.id = ur.role_id
WHERE
r.enname = 'oil-analysis'
AND r.del_flag = 0
AND ur.user_id = #{userCode}
</select>
<select id="getParentRoles" resultType="com.ejweb.modules.role.entity.UserRolesEntity">
SELECT DISTINCT(p.id), p.permission,p.name AS menuName
FROM sys_user2role a
left JOIN sys_role s ON a.role_id=s.id
LEFT JOIN sys_menu2role t on s.id=t.role_id
LEFT JOIN sys_menu2role t on s.id=t.role_id
LEFT JOIN sys_menu p on p.id=t.menu_id
WHERE user_id = #{userCode}
<choose>
<choose>
<when test="permission != null and permission != ''">
AND p.permission=#{permission}
</when>
......
......@@ -24,12 +24,13 @@
<result column="back_status" property="backStatus" jdbcType="CHAR" />
<result column="back_time" property="backTime" jdbcType="TIMESTAMP" />
<result column="back_remarks" property="backRemarks" jdbcType="VARCHAR" />
<result column="back_by" property="backBy" jdbcType="VARCHAR" />
<result column="back_by" property="backBy" jdbcType="VARCHAR" />
<result column="summary" property="summary" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List" >
id, verif_id, verify_status, report, form_id, form_text, depart_id, `condition`, create_by,
create_date, update_by, update_date, remarks, del_flag, is_verify, status, start_time,back_status,
back_time,back_remarks,back_by
create_date, update_by, update_date, remarks, del_flag, is_verify, status, start_time,end_time,back_status,
back_time,back_remarks,back_by,summary
</sql>
<select id="fullList" resultMap="BaseResultMap">
......@@ -83,21 +84,16 @@
AND frv.verif_id = #{verifId}
</select>
<!-- 获取论证表详情 -->
<select id="detail" resultType="com.ejweb.modules.route.entity.RouteVerifyEntity">
<select id="detail" resultType="com.ejweb.modules.route.entity.RouteVerifyEntity">
SELECT
(t.id) conditionId,
s.id,
verify_status,
s.`condition`,
s.remarks,
s.summary as conditionRemarks,
s.depart_id,
s.form_text,
t.remarks AS conditionRemarks,
case WHEN t.is_feed!='0' THEN DATE_FORMAT(t.update_date, '%Y-%m-%d')
else '' end conditionDate,
s.status
s.form_text,
s.status
FROM foc_route_verify s
LEFT JOIN foc_verify_condition t ON s.id = t.route_id
WHERE 1 = 1
<if test="verifId != null and verifId != ''" >
AND s.verif_id = #{verifId}
......@@ -110,23 +106,21 @@
<if test="departId != null and departId != ''">
AND s.depart_id =#{departId}
</if>
ORDER BY t.create_date desc
LIMIT 1
</select>
<select id="findByVerifIdUserCode" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM foc_route_verify frv
<select id="findByVerifIdUserCode" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM foc_route_verify frv
WHERE 1 = 1
<if test="verifId != null and verifId != ''" >
AND frv.verif_id = #{verifId}
</if>
AND frv.depart_id in (
select depart_id from sys_user_profiles
where user_id = #{userCode})
</select>
<if test="verifId != null and verifId != ''">
AND frv.verif_id = #{verifId}
</if>
AND frv.depart_id in (
select depart_id from sys_user_profiles
where user_id = #{userCode})
</select>
<!-- 根据id获取foc_route_verify数据,userCode获取depart_id与本数据的depart_id比较 -->
<select id="checkDepartIdWithUserCodeAndId" resultType="Long">
SELECT
......@@ -308,6 +302,9 @@
<if test="isVerify != null" >
is_verify = #{isVerify,jdbcType=CHAR},
</if>
<if test="summary != null">
summary = #{summary,jdbcType=CHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
......@@ -331,7 +328,8 @@
back_status = #{backStatus},
back_time = #{backTime},
back_by = #{backBy},
back_remarks= #{backRemarks}
back_remarks= #{backRemarks},
summary=#{summary}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="insertRouteFile">
......@@ -393,4 +391,12 @@ LEFT JOIN foc_route_verify m on s.route_id=m.id
<select id="getDepartId" resultType="String">
SELECT depart_id FROM sys_user_profiles a WHERE a.user_id = #{userCode}
</select>
<select id="getAllDepart" resultType="com.ejweb.modules.verify.bean.DepartConditionBean">
select d.id as departId,d.depart_name,v.verify_status
from foc_route_verify v
left join foc_user_depart d on v.depart_id=d.id
where v.verif_id=#{verifId} and v.del_flag=0 and v.status=1
and (v.verify_status='02' or v.verify_status='03' or v.verify_status='04')
</select>
</mapper>
\ No newline at end of file
......@@ -25,31 +25,43 @@
LEFT JOIN foc_airline_verify b on a.verif_id =b.id
LEFT JOIN foc_airports p ON p.airport_iata = b.depIata
LEFT JOIN foc_airports r ON r.airport_iata = b.arrIata
LEFT JOIN foc_aircraft_type q ON q.id = b.aircraft_type
where 1=1
LEFT JOIN foc_aircraft_type q ON q.id = b.aircraft_type
where 1=1
<if test="verifStatus != null and verifStatus != ''">
AND b.verif_status =#{verifStatus}
</if>
AND a.command_status ='00'
AND b.verif_status ='00'
AND b.verif_status =#{verifStatus}
</if>
AND a.command_status ='00'
AND b.verif_status ='00'
<if test="verifNo != null and verifNo != ''">
AND b.verif_no LIKE CONCAT('%', #{verifNo}, '%')
</if>
<if test="depIata != null and depIata != ''">
<if test="depIataList != null ">
AND (b.id in (
SELECT id FROM foc_airline_verify where depIata = #{depIata} )
OR b.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata = #{depIata} AND is_main != '0')
)
SELECT id FROM foc_airline_verify where depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR b.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="arrIata != null and arrIata != ''">
<if test="arrIataList != null">
AND (b.id in (
SELECT id FROM foc_airline_verify where arrIata = #{arrIata} )
OR b.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata = #{arrIata} AND is_main != '0')
)
SELECT id FROM foc_airline_verify where arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR b.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="priority != null and priority != ''">
AND b.priority = #{priority}
......
......@@ -23,49 +23,62 @@
DATE_FORMAT(a.create_date, '%Y-%m-%d') AS createDate
FROM
foc_airline_verify a
LEFT JOIN foc_sailing_conclusion c ON a.id = c.verif_id
LEFT JOIN foc_airports d ON d.airport_iata = a.depIata
LEFT JOIN foc_airports r ON r.airport_iata = a.arrIata
LEFT JOIN foc_aircraft_type q ON q.id = a.aircraft_type
WHERE
a.del_flag = #{DEL_FLAG_NORMAL}
AND c.del_flag = #{DEL_FLAG_NORMAL}
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE CONCAT('%', #{verifNo}, '%')
</if>
<if test="depIata != null and depIata != ''">
AND (a.id in (
SELECT id FROM foc_airline_verify where depIata = #{depIata} )
OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata = #{depIata} AND is_main != '0')
)
</if>
<if test="arrIata != null and arrIata != ''">
AND (a.id in (
SELECT id FROM foc_airline_verify where arrIata = #{arrIata} ) OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata = #{arrIata} AND is_main != '0')
)
</if>
<if test="priority != null and priority != ''">
AND a.priority = #{priority}
</if>
<if test="aircraftType != null and aircraftType != ''">
AND a.aircraft_type = #{aircraftType}
</if>
<if test="verifType != null and verifType != ''">
AND a.verif_type = #{verifType}
</if>
<if test="verifStatus != null and verifStatus != ''">
AND a.verif_status = #{verifStatus}
</if>
AND a.verif_status ='00'
<choose>
<when test="conclusionStatus != null and conclusionStatus != ''">
LEFT JOIN foc_sailing_conclusion c ON a.id = c.verif_id
LEFT JOIN foc_airports d ON d.airport_iata = a.depIata
LEFT JOIN foc_airports r ON r.airport_iata = a.arrIata
LEFT JOIN foc_aircraft_type q ON q.id = a.aircraft_type
WHERE
a.del_flag = #{DEL_FLAG_NORMAL}
AND c.del_flag = #{DEL_FLAG_NORMAL}
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE CONCAT('%', #{verifNo}, '%')
</if>
<if test="depIataList != null ">
AND (a.id in (
SELECT id FROM foc_airline_verify where depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="arrIataList != null ">
AND (a.id in (
SELECT id FROM foc_airline_verify where arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="priority != null and priority != ''">
AND a.priority = #{priority}
</if>
<if test="aircraftType != null and aircraftType != ''">
AND a.aircraft_type = #{aircraftType}
</if>
<if test="verifType != null and verifType != ''">
AND a.verif_type = #{verifType}
</if>
<if test="verifStatus != null and verifStatus != ''">
AND a.verif_status = #{verifStatus}
</if>
AND a.verif_status ='00'
<choose>
<when test="conclusionStatus != null and conclusionStatus != ''">
AND c.conclusion_status = #{conclusionStatus}
</when>
<otherwise>
</when>
<otherwise>
AND c.conclusion_status ='00'
</otherwise>
</choose>
......
......@@ -904,4 +904,36 @@
</if>
ORDER BY r.login_date DESC
</select>
<select id="findByIp" resultType="com.ejweb.modules.user.bean.LoginIpInfo">
select black_ip from sys_login_blacklist where black_ip = #{userIp}
</select>
<insert id="insertInfoByIp">
insert into sys_login_blacklist(black_ip,create_time) values (#{userIp},#{date})
</insert>
<select id="findListUser" resultType="com.ejweb.modules.user.entity.UserExport">
SELECT /*a.id,*/
a.login_name,
a.no,
a.name,
a.email,
a.phone,
a.mobile,
c.name AS company,
o.name AS office,
a.huawei_num,
a.user_type,
a.login_ip,
a.login_date,
a.login_flag,
a.photo
FROM sys_user a
LEFT JOIN sys_office c
ON c.id = a.company_id
LEFT JOIN sys_office o
ON o.id = a.office_id
WHERE a.del_flag='0'
/* AND user_type=6*/
</select>
</mapper>
\ No newline at end of file
......@@ -24,30 +24,44 @@
FROM
foc_airline_conclusion c
LEFT JOIN foc_airline_verify a ON a.id = c.verif_id
LEFT JOIN foc_aircraft_type t ON a.aircraft_type = t.id
LEFT JOIN foc_airports d ON d.airport_iata = a.depIata
LEFT JOIN foc_airports r ON r.airport_iata = a.arrIata
WHERE
a.del_flag = #{DEL_FLAG_NORMAL}
AND c.del_flag = #{DEL_FLAG_NORMAL}
<!-- AND t.del_flag = #{DEL_FLAG_NORMAL} -->
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE CONCAT('%', #{verifNo}, '%')
</if>
<if test="depIata != null and depIata != ''">
AND (a.id in (
SELECT id FROM foc_airline_verify where depIata = #{depIata} ) OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata = #{depIata} AND is_main != '0')
)
</if>
<if test="arrIata != null and arrIata != ''">
AND (a.id in (
SELECT id FROM foc_airline_verify where arrIata = #{arrIata} ) OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata = #{arrIata} AND is_main != '0')
)
</if>
LEFT JOIN foc_aircraft_type t ON a.aircraft_type = t.id
LEFT JOIN foc_airports d ON d.airport_iata = a.depIata
LEFT JOIN foc_airports r ON r.airport_iata = a.arrIata
WHERE
a.del_flag = #{DEL_FLAG_NORMAL}
AND c.del_flag = #{DEL_FLAG_NORMAL}
<!-- AND t.del_flag = #{DEL_FLAG_NORMAL} -->
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE CONCAT('%', #{verifNo}, '%')
</if>
<if test="depIataList != null ">
AND (a.id in (
SELECT id FROM foc_airline_verify where depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="arrIataList != null ">
AND (a.id in (
SELECT id FROM foc_airline_verify where arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="priority != null and priority != ''">
AND a.priority = #{priority}
</if>
......
......@@ -26,30 +26,44 @@
foc_airline_verify a
INNER JOIN foc_verify_record r ON a.id=r.verif_id AND r.del_flag=#{DEL_FLAG_NORMAL}
LEFT JOIN foc_airports d ON d.airport_iata = a.depIata
LEFT JOIN foc_airports p ON p.airport_iata = a.arrIata
LEFT JOIN foc_aircraft_type q ON q.id = a.aircraft_type
<!-- LEFT JOIN foc_aircraft_type f ON f.id=a.aircraft_type -->
WHERE
a.del_flag=#{DEL_FLAG_NORMAL}
AND r.record_type=#{recordType}
AND r.record_status='00' AND a.verif_status='00'
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE CONCAT('%', #{verifNo}, '%')
</if>
<if test="depIata != null and depIata != ''">
AND (a.id in (
SELECT id FROM foc_airline_verify where depIata = #{depIata} ) OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata = #{depIata} AND is_main != '0')
)
</if>
<if test="arrIata != null and arrIata != ''">
AND (a.id in (
SELECT id FROM foc_airline_verify where arrIata = #{arrIata} ) OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata = #{arrIata} AND is_main != '0')
)
</if>
LEFT JOIN foc_airports p ON p.airport_iata = a.arrIata
LEFT JOIN foc_aircraft_type q ON q.id = a.aircraft_type
<!-- LEFT JOIN foc_aircraft_type f ON f.id=a.aircraft_type -->
WHERE
a.del_flag=#{DEL_FLAG_NORMAL}
AND r.record_type=#{recordType}
AND r.record_status='00' AND a.verif_status='00'
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE CONCAT('%', #{verifNo}, '%')
</if>
<if test="depIataList != null ">
AND (a.id in (
SELECT id FROM foc_airline_verify where depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata in
<foreach collection="depIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="arrIataList != null ">
AND (a.id in (
SELECT id FROM foc_airline_verify where arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>)
OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata in
<foreach collection="arrIataList" item="iata" index="index" open="(" close=")" separator=",">
#{iata}
</foreach>
AND is_main != '0')
)
</if>
<if test="priority != null and priority != ''">
AND a.priority=#{priority}
</if>
......
......@@ -39,12 +39,12 @@
<insert id="insert" parameterType="com.ejweb.modules.verify.entity.FullVerifyConditionEntity" >
insert into foc_verify_condition (id, parent_id, route_id,
verif_id, depart_id, condition_status,
verif_id, depart_id, condition_status, `condition`,
create_by, create_date, update_by,
update_date, remarks, complete,
is_feed)
values (#{id,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR}, #{routeId,jdbcType=VARCHAR},
#{verifId,jdbcType=VARCHAR}, #{departId,jdbcType=VARCHAR}, #{conditionStatus,jdbcType=VARCHAR},
#{verifId,jdbcType=VARCHAR}, #{departId,jdbcType=VARCHAR}, #{conditionStatus,jdbcType=VARCHAR}, #{condition,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
#{updateDate,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{complete,jdbcType=CHAR},
#{isFeed,jdbcType=CHAR})
......@@ -196,5 +196,5 @@
<delete id="deleteConditionByVerifyId">
delete from foc_verify_condition where verif_id=#{verifyId}
</delete>
</mapper>
\ No newline at end of file
......@@ -36,5 +36,7 @@
<!-- 设置但JDBC类型为空时,某些驱动程序 要指定值,default:OTHER,插入空值时不需要指定类型 -->
<setting name="jdbcTypeForNull" value="NULL"/>
<!--打印sql-->
<setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>
</configuration>
#
#redis.host=106.75.105.96
#
redis.host=81.69.44.115
redis.port=7211
redis.auth=bbdtek!@#2018
redis.timeout=10000
redis.maxTotal=100
redis.maxIdle=20
redis.maxWaitMillis=10000
redis.testOnBorrow=true
redis.testOnReturn=true
redis.dbIndex=3
redis.ipWithinSeconds=60
redis.ipLimitTimes=10
redis.usernameWithinSeconds=60
redis.usernameLimitTimes=6
redis.blackUsernameTime=60
\ No newline at end of file
......@@ -32,6 +32,7 @@
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:ejweb.properties</value>
<value>classpath:redis.properties</value>
</list>
</property>
</bean>
......@@ -141,4 +142,20 @@
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="providerClass" value="org.hibernate.validator.HibernateValidator"/>
</bean>
<!--设置jedisPool链接池的配置-->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="${redis.maxTotal}"/>
<property name="maxIdle" value="${redis.maxIdle}"/>
<property name="maxWaitMillis" value="${redis.maxWaitMillis}"/>
<property name="testOnBorrow" value="${redis.testOnBorrow}"/>
<property name="testOnReturn" value="${redis.testOnReturn}"/>
</bean>
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<constructor-arg name="poolConfig" ref="jedisPoolConfig"/>
<constructor-arg name="host" value="${redis.host}"/>
<constructor-arg name="port" value="${redis.port}"/>
<constructor-arg name="timeout" value="${redis.timeout}"/>
<constructor-arg name="password" value="${redis.auth}"/>
</bean>
</beans>
\ No newline at end of file
......@@ -25,6 +25,7 @@
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:ejweb.properties</value>
<value>classpath:redis.properties</value>
</list>
</property>
</bean>
......
package com.ejweb.core.api;
import com.alibaba.fastjson.JSON;
import org.apache.poi.util.SystemOutLogger;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.validation.BindingResult;
import org.springframework.validation.ObjectError;
......@@ -54,7 +55,9 @@ public class RequestBean {
try {
return JSON.parseObject(content, clazz);
} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}
return null;
}
......
package com.ejweb.core.base;
import java.util.List;
/**
* @author LEGION
*/
public class AirportQueryBean {
List arrIataList;
List depIataList;
public List getArrIataList() {
return arrIataList;
}
public void setArrIataList(List arrIataList) {
this.arrIataList = arrIataList;
}
public List getDepIataList() {
return depIataList;
}
public void setDepIataList(List depIataList) {
this.depIataList = depIataList;
}
}
package com.ejweb.core.base;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.ejweb.core.conf.GConstants;
import org.hibernate.validator.constraints.NotEmpty;
/**
*
* 请求接口基本数据
*
* @team IT Team
* @author renmb
* @version 1.0
* @time 2016-03-10
*
*/
public class BaseUserBean {
@JSONField(deserialize = false, serialize = false)
public static final String DEL_FLAG_NORMAL = "0";
// @JSONField(deserialize=false, serialize=false)
// protected String dbprefix=GConstants.getValue("db.table.prefix", "");//
// 数据库表前缀
@JSONField(serialize=false)
@NotEmpty(message = "appCode不允许为空")
// @JSONField(name="app_code")
protected String userSign;
@JSONField(deserialize = false, serialize = false)
public String getDbprefix() {
return GConstants.getValue("db.table.prefix", "");// 数据库表前缀;
}
// public void setDbprefix(String dbprefix) {
// this.dbprefix = dbprefix;
// }
@JSONField(deserialize = false, serialize = false)
public String getDbName() {
return GConstants.getValue("jdbc.type");
}
public String getUserSign() {
return userSign;
}
public void setUserSign(String userSign) {
this.userSign = userSign;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
......@@ -4,6 +4,7 @@
package com.ejweb.core.conf;
import com.ejweb.core.security.DES3Utils;
import com.ejweb.core.util.Util;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
......@@ -78,7 +79,6 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo
}
public static void main(String[] args) {
System.out.println(DES3Utils.encrypt("foctest", CONF_DESC_KEY));
System.out.println(DES3Utils.decrypt("69872b2310ba9b30470ce46682151021e825c3909c394aa5f4387123bdbfa67e", CONF_DESC_KEY));
System.out.println(DES3Utils.decrypt("f5c9d35c1df1eb31c0f15d23ee5af33d15ee14d1133b16ae580893ec603fc77c0057d3cccb34407d0505fc99a849cd7ee060d2c605d68b21ea7fea2a325dd4026e7f13e65e216d967bc7696f608fe56ef11ae4801b727c51d09bc4beb44b24f0", CONF_DESC_KEY));
}
}
......@@ -54,17 +54,12 @@ public class ErrorHandler {
valueStr = (i == values.length - 1) ? valueStr + values[i]
: valueStr + values[i] + ",";
}
//乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化
// valueStr = new String(valueStr.getBytes("ISO-8859-1"), "UTF-8");
buf.append(" "+name+":"+valueStr+"\n");
}
String clientip = Util.getOnlineIP(request);
String uri = request.getRequestURI();
EmailStackTraceHandler.getInstance().sendEmail("系统异常", "Request IP: "+clientip+"\nRequest URI: "+uri+"\nParameter Map: \n"+buf.toString()+"\nStack Trace: \n"+error);
}
// if(StringUtils.isNotBlank(uri) && uri.contains("/api/")){// 接口
//
// }
} catch (Exception e2) {
// TODO: handle exception
}
......
package com.ejweb.core.fetcher;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ejweb.core.conf.ErrorCode;
import com.ejweb.core.conf.GConstants;
import com.ejweb.core.security.GlobalUtil;
import com.ejweb.modules.im.entity.GroupEntity;
/*
* 利用HttpClient进行post请求的工具类
*/
public class HttpClientUtil {
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
* 利用HttpClient进行post请求的工具类
*/
public class HttpClientUtil {
@SuppressWarnings("deprecation")
public static String doPost(String url,Map<String,String> map,String charset){
CloseableHttpClient httpClient = null;
HttpPost httpPost = null;
String result = null;
try{
public static String doPost(String url, Map<String, String> map, String charset) {
CloseableHttpClient httpClient = null;
HttpPost httpPost = null;
String result = null;
try {
// httpClient = new DefaultHttpClient();
httpClient = HttpClients.createDefault();
httpPost = new HttpPost(url);
httpPost.addHeader("ACCESS_TOKEN", "VEs0MjI5Nzc3Mzk3NzM4MDYyNDgyMDUy");
//设置参数
List<NameValuePair> list = new ArrayList<NameValuePair>();
Iterator iterator = map.entrySet().iterator();
while(iterator.hasNext()){
Entry<String,String> elem = (Entry<String, String>) iterator.next();
list.add(new BasicNameValuePair(elem.getKey(),elem.getValue()));
}
if(list.size() > 0){
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list,charset);
httpPost.setEntity(entity);
}
HttpResponse response = httpClient.execute(httpPost);
if(response != null){
HttpEntity resEntity = response.getEntity();
if(resEntity != null){
result = EntityUtils.toString(resEntity,charset);
}
}
}catch(Exception ex){
ex.printStackTrace();
}
return result;
}
public static void main(String[] args){
try {
// StringBuilder url = new StringBuilder("https://ewatch.okayapps.com/faq/api/user/login");
StringBuilder url = new StringBuilder("https://ewatch.okayapps.com/faq/api/ask/detail");
String loginName = "root";
String password = "1";
JSONObject content = new JSONObject();
content.put("appCode", "10001");
content.put("versionName", "1.0");
content.put("platform", "Android");
content.put("language", "zh_CN");
content.put("appCode", "10001");
content.put("loginName", "root");
content.put("password", "admin");
content.put("userCode", "userId");
content.put("id", "93648376039909180225");
Map<String, String> params = new HashMap<String, String>();
params.put("content", JSON.toJSONString(content));
String sign = GlobalUtil.getParamsSignStr(GConstants.SIGN_PRIVATE_KEY, params.get("content"));
params.put("sign", sign);
String res = HttpClientUtil.doPost(url.toString(), params, "UTF-8");
// JSONObject object = JSON.parseObject(res);
System.out.println(res);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
List<NameValuePair> list = new ArrayList<NameValuePair>();
Iterator iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, String> elem = (Entry<String, String>) iterator.next();
list.add(new BasicNameValuePair(elem.getKey(), elem.getValue()));
}
if (list.size() > 0) {
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, charset);
httpPost.setEntity(entity);
}
HttpResponse response = httpClient.execute(httpPost);
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, charset);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
}
\ No newline at end of file
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class GlobalUtil {
......@@ -16,7 +18,20 @@ public class GlobalUtil {
public static boolean verify(String data, String privateKey, String sign) {
try {
String mSign = getParamsSignStr(privateKey, data);
if(mSign == null || sign == null)
if (mSign == null || sign == null)
return true;
mSign = URLDecoder.decode(mSign, "UTF-8");
return mSign.equals(sign);
} catch (Exception e) {
// TODO: handle exception
}
return false;
}
public static boolean verifySign(String data, String privateKey, String sign) {
try {
String mSign = getParamsSign(privateKey, data);
if (mSign == null || sign == null)
return true;
mSign = URLDecoder.decode(mSign, "UTF-8");
return mSign.equals(sign);
......@@ -35,7 +50,24 @@ public class GlobalUtil {
/**
* 获取加密后的字符串
*
*/
public static String getParamsSign(String key, String paramsStr) {
if (key == null || paramsStr == null) {
return "";
}
// String signedString = JSON.toJSONString(paramsStr);
String signedStr = getSHA256(paramsStr + key);
// String signedStr1 = base64(signedStr.getBytes("UTF-8"));
return signedStr;
// try {
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
// return "";
}
/**
* 获取加密后的字符串
*/
public static String getParamsSignStr(String key, String paramsStr) {
if (key == null || paramsStr == null) {
......@@ -53,11 +85,9 @@ public class GlobalUtil {
/**
* HMACSHA1加密
*
* @param key
* 加密使用的key
* @param strByte
* 待加密的数据
*
* @param key 加密使用的key
* @param strByte 待加密的数据
* @return 生成MD5编码的字符串
*/
......@@ -80,15 +110,56 @@ public class GlobalUtil {
* base64加密
*/
public static String base64(byte[] val) {
if (val == null)
if (val == null) {
return null;
else
} else {
return Base64.encode(val);
}
}
/**
*     * 利用java原生的类实现SHA256加密
*     * @param str 加密后的报文
*     * @return
*     
*/
public static String getSHA256(String str) {
MessageDigest messageDigest;
String encodeStr = "";
try {
messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(str.getBytes("UTF-8"));
encodeStr = byte2Hex(messageDigest.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return encodeStr;
}
/**
*     * 将byte转为16进制
*     * @param bytes
*     * @return
*     
*/
private static String byte2Hex(byte[] bytes) {
StringBuffer stringBuffer = new StringBuffer();
String temp = null;
for (int i = 0; i < bytes.length; i++) {
temp = Integer.toHexString(bytes[i] & 0xFF);
if (temp.length() == 1) {
//1得到一位的进行补0操作
stringBuffer.append("0");
}
stringBuffer.append(temp);
}
return stringBuffer.toString();
}
public static void main(String[] args) {
//{"shop_code":"ringpu","user_code":"","role_code":"","user_channel":"1002","sub_channel":"AGENCY","version_name":"0.9","password":"111111","telephone":"13752653287"}
//{"shop_code":"ringpu","user_code":"","role_code":"","user_channel":"1002","sub_channel":"AGENCY","version_name":"0.9","password":"111111","telephone":"13752653287"}
String param = "{\"appCode\":\"30007\",\"appkey\":\"\",\"versionName\":\"6.0.0\",\"platform\":\"Android\",\"deviceToken\":\"deviceToken\",\"language\":\"zh_CN\",email : '123@qwe.com',name : 'name', keywords : '天津', staffAccounts : ['794089036222300160', 'seat791537198252023808']}";
String sign = GlobalUtil.getParamsSignStr("FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn", param);
String check = getParamsSignStr("FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn", param);
......
package com.ejweb.core.util;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;
/**
* @author zangtao
*/
public class PropertiesUtils {
private static Properties properties;
/**
* 获取配置文件中配置信息
*/
static {
}
public static Properties getProperties() {
if (properties == null) {
properties = new Properties();
InputStreamReader in = null;
try {
in = new InputStreamReader(PropertiesUtils.class.getClassLoader().getResourceAsStream("redis.properties"), "UTF-8");
properties.load(in);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
return properties;
}
}
package com.ejweb.core.util;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
/**
* @author lisu
*/
@Component
public class RedisUtils {
private final Logger log = LoggerFactory.getLogger(this.getClass());
@Autowired
private JedisPool jedisPool;
/**
* 通过key获取储存在redis中的value
* 并释放连接
*
* @param key
* @param indexDb 选择redis库 0-15
* @return 成功返回value 失败返回null
*/
public String get(String key, int indexDb) {
Jedis jedis = null;
String value = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
value = jedis.get(key);
log.info(value);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return value;
}
public Long del(String key, int indexDb) {
Jedis jedis = null;
Long value = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
value = jedis.del(key);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return value;
}
/**
* 通过key 对value进行加值+1操作,当value不是int类型时会返回错误,当key不存在是则value为1
*
* @param key
* @return 加值后的结果
*/
public Long incr(String key, int indexDb) {
Jedis jedis = null;
Long res = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
res = jedis.incr(key);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return res;
}
/**
* 通过key 对value进行加值+1操作,当value不是int类型时会返回错误,当key不存在是则value为1
* 自增不取消过期时间
*
* @param key
* @return 加值后的结果
*/
public Long incrNotResetExpireTime(String key, int indexDb) {
Jedis jedis = null;
Long res = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
Integer expireTime = jedis.ttl(key).intValue();
res = jedis.incr(key);
// jedis.expireAt(key, expireTime);
res = jedis.expire(key, expireTime);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return res;
}
public String set(String key, Object value, int indexDb) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
JSON.toJSONString(value);
return jedis.set(key, JSON.toJSONString(value));
} catch (Exception e) {
log.error(e.getMessage());
return "0";
} finally {
returnResource(jedisPool, jedis);
}
}
/**
* 设置过期时间
*
* @param key
* @param unixTime 过期时间的时间戳(秒)
* @return
*/
public Long expireAt(String key, long unixTime, int indexDb) {
Jedis jedis = null;
Long res = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
res = jedis.expireAt(key, unixTime);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return res;
}
/**
* 设置过期时间
*
* @param key
* @param seconds 过期时间(秒)
* @return
*/
public Long expire(String key, int seconds, int indexDb) {
Jedis jedis = null;
Long res = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
res = jedis.expire(key, seconds);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return res;
}
/**
* 返还到连接池
*
* @param jedisPool
* @param jedis
*/
public static void returnResource(JedisPool jedisPool, Jedis jedis) {
if (jedis != null) {
jedisPool.returnResource(jedis);
}
}
}
\ No newline at end of file
......@@ -3,17 +3,17 @@
*/
package com.ejweb.core.util;
import org.apache.commons.lang3.time.DateFormatUtils;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils;
/**
* 时间计算工具类
*
*
* @author ThinkGem
* @version 2013-11-03
*/
......@@ -64,12 +64,12 @@ public class TimeUtils {
/**
* 各常量允许的最大值
*/
private final int[] maxFields = { 59, 59, 23, Integer.MAX_VALUE - 1 };
private final int[] maxFields = {59, 59, 23, Integer.MAX_VALUE - 1};
/**
* 各常量允许的最小值
*/
private final int[] minFields = { 0, 0, 0, Integer.MIN_VALUE };
private final int[] minFields = {0, 0, 0, Integer.MIN_VALUE};
/**
* 默认的字符串格式时间分隔符
......@@ -90,11 +90,9 @@ public class TimeUtils {
/**
* 使用时、分构造一个时间
*
* @param hour
* 小时
* @param minute
* 分钟
*
* @param hour 小时
* @param minute 分钟
*/
public TimeUtils(int hour, int minute) {
this(0, hour, minute, 0);
......@@ -102,13 +100,10 @@ public class TimeUtils {
/**
* 使用时、分、秒构造一个时间
*
* @param hour
* 小时
* @param minute
* 分钟
* @param second
* 秒
*
* @param hour 小时
* @param minute 分钟
* @param second 秒
*/
public TimeUtils(int hour, int minute, int second) {
this(0, hour, minute, second);
......@@ -117,9 +112,8 @@ public class TimeUtils {
/**
* 使用一个字符串构造时间<br/>
* Time time = new Time("14:22:23");
*
* @param time
* 字符串格式的时间,默认采用“:”作为分隔符
*
* @param time 字符串格式的时间,默认采用“:”作为分隔符
*/
public TimeUtils(String time) {
this(time, null);
......@@ -128,7 +122,7 @@ public class TimeUtils {
/**
* 使用时间毫秒构建时间
*
*
* @param time
*/
public TimeUtils(long time) {
......@@ -137,7 +131,7 @@ public class TimeUtils {
/**
* 使用日期对象构造时间
*
*
* @param date
*/
public TimeUtils(Date date) {
......@@ -146,15 +140,11 @@ public class TimeUtils {
/**
* 使用天、时、分、秒构造时间,进行全字符的构造
*
* @param day
* 天
* @param hour
* 时
* @param minute
* 分
* @param second
* 秒
*
* @param day 天
* @param hour 时
* @param minute 分
* @param second 秒
*/
public TimeUtils(int day, int hour, int minute, int second) {
initialize(day, hour, minute, second);
......@@ -163,9 +153,8 @@ public class TimeUtils {
/**
* 使用一个字符串构造时间,指定分隔符<br/>
* Time time = new Time("14-22-23", "-");
*
* @param time
* 字符串格式的时间
*
* @param time 字符串格式的时间
*/
public TimeUtils(String time, String timeSeparator) {
if (timeSeparator != null) {
......@@ -176,11 +165,9 @@ public class TimeUtils {
/**
* 设置时间字段的值
*
* @param field
* 时间字段常量
* @param value
* 时间字段的值
*
* @param field 时间字段常量
* @param value 时间字段的值
*/
public void set(int field, int value) {
if (value < minFields[field]) {
......@@ -197,9 +184,8 @@ public class TimeUtils {
/**
* 获得时间字段的值
*
* @param field
* 时间字段常量
*
* @param field 时间字段常量
* @return 该时间字段的值
*/
public int get(int field) {
......@@ -211,9 +197,8 @@ public class TimeUtils {
/**
* 将时间进行“加”运算,即加上一个时间
*
* @param time
* 需要加的时间
*
* @param time 需要加的时间
* @return 运算后的时间
*/
public TimeUtils addTime(TimeUtils time) {
......@@ -229,9 +214,8 @@ public class TimeUtils {
/**
* 将时间进行“减”运算,即减去一个时间
*
* @param time
* 需要减的时间
*
* @param time 需要减的时间
* @return 运算后的时间
*/
public TimeUtils subtractTime(TimeUtils time) {
......@@ -254,7 +238,7 @@ public class TimeUtils {
/**
* 获得时间字段的分隔符
*
*
* @return
*/
public String getTimeSeparator() {
......@@ -263,9 +247,8 @@ public class TimeUtils {
/**
* 设置时间字段的分隔符(用于字符串格式的时间)
*
* @param timeSeparator
* 分隔符字符串
*
* @param timeSeparator 分隔符字符串
*/
public void setTimeSeparator(String timeSeparator) {
this.timeSeparator = timeSeparator;
......@@ -318,15 +301,16 @@ public class TimeUtils {
time + ", time format error, HH" + this.timeSeparator + "mm" + this.timeSeparator + "ss");
}
/**
* 获取今天是星期几
* @author huhy
* @time 2016年11月24日
* @param dt
* @return
*/
/**
* 获取今天是星期几
*
* @param dt
* @return
* @author huhy
* @time 2016年11月24日
*/
public static String getWeekOfDate(Date dt) {
String[] weekDays = {"星期日","星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
Calendar cal = Calendar.getInstance();
cal.setTime(dt);
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
......@@ -337,11 +321,11 @@ public class TimeUtils {
/**
* 获取前后日期 i为正数 向后推迟i天,负数时向前提前i天
*
* @author huhy
* @time 2016年11月24日
*
* @param i
* @return
* @author huhy
* @time 2016年11月24日
*/
public static Date getdate(int i) {
Date dat = null;
......@@ -390,4 +374,14 @@ public class TimeUtils {
return true;
}
/**
* 获取当前时间
*
* @param formatType 转换格式,如:yyyy-MM-dd HH:mm:ss
* @return
*/
public static String getTime(String formatType) {
SimpleDateFormat format = new SimpleDateFormat(formatType);
return format.format(System.currentTimeMillis());
}
}
\ No newline at end of file
......@@ -3,36 +3,26 @@
*/
package com.ejweb.core.utils.excel;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import com.ejweb.core.utils.excel.annotation.ExcelField;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.multipart.MultipartFile;
import com.ejweb.core.utils.excel.annotation.ExcelField;
import com.google.common.collect.Lists;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 导入Excel文件(支持“XLS”和“XLSX”格式)
......@@ -59,17 +49,6 @@ public class ImportExcel {
*/
private int headerNum;
/**
* 构造函数
*
* @param path 导入文件,读取第一个工作表
* @param headerNum 标题行号,数据行号=标题行号+1
* @throws InvalidFormatException
* @throws IOException
*/
public ImportExcel(String fileName, int headerNum) throws InvalidFormatException, IOException {
this(new File(fileName), headerNum);
}
/**
* 构造函数
......@@ -83,18 +62,6 @@ public class ImportExcel {
this(file, headerNum, 0);
}
/**
* 构造函数
*
* @param path 导入文件
* @param headerNum 标题行号,数据行号=标题行号+1
* @param sheetIndex 工作表编号
* @throws InvalidFormatException
* @throws IOException
*/
public ImportExcel(String fileName, int headerNum, int sheetIndex) throws InvalidFormatException, IOException {
this(new File(fileName), headerNum, sheetIndex);
}
/**
* 构造函数
......@@ -136,9 +103,9 @@ public class ImportExcel {
throws InvalidFormatException, IOException {
if (StringUtils.isBlank(fileName)) {
throw new RuntimeException("导入文档为空!");
} else if (fileName.toLowerCase().endsWith("xls")) {
} else if (fileName.toLowerCase(Locale.ENGLISH).endsWith("xls")) {
this.wb = new HSSFWorkbook(is);
} else if (fileName.toLowerCase().endsWith("xlsx")) {
} else if (fileName.toLowerCase(Locale.ENGLISH).endsWith("xlsx")) {
this.wb = new XSSFWorkbook(is);
} else {
throw new RuntimeException("文档格式不正确!");
......@@ -203,11 +170,7 @@ public class ImportExcel {
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
// 处理日期格式、时间格式
if (HSSFDateUtil.isCellDateFormatted(cell)) {
SimpleDateFormat sdf = null;
if (cell.getCellStyle().getDataFormat() == HSSFDataFormat
.getBuiltinFormat("h:mm")) {
sdf = new SimpleDateFormat("HH:mm");
}
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
Date date = cell.getDateCellValue();
val = sdf.format(date);
} else {
......@@ -379,19 +342,4 @@ public class ImportExcel {
}
return dataList;
}
/**
* 导入测试
*/
public static void main(String[] args) throws Throwable {
ImportExcel ei = new ImportExcel("C:\\Users\\yiping\\Desktop\\任务跟踪表-车库网2016-8-24.xlsx", 1);
for (int i = ei.getDataRowNum(); i < ei.getLastDataRowNum(); i++) {
Row row = ei.getRow(i);
for (int j = 0; j < ei.getLastCellNum(); j++) {
Object val = ei.getCellValue(row, j);
System.out.print(val + ", ");
}
System.out.print("\n");
}
}
}
......@@ -26,7 +26,7 @@ import java.util.Map;
/**
* 三字码列表接口
*
*
* @team IT Team
* @author renmb
* @version 1.0
......@@ -49,6 +49,10 @@ public class AirportController {
PageEntity<AirportListEntity> list = null;
ResponseBean responseBean = new ResponseBean();
AirportListBean bean = requestBean.getObjectBean(AirportListBean.class);
String message = airportService.validate(bean);
if(message == null){// 通过参数校验
......
package com.ejweb.modules.airport.api;
import com.ejweb.core.api.RequestBean;
import com.ejweb.core.api.ResponseBean;
import com.ejweb.core.base.PageEntity;
import com.ejweb.core.conf.ErrorCode;
import com.ejweb.core.conf.GConstants;
import com.ejweb.core.utils.excel.ExportExcel;
import com.ejweb.modules.airport.bean.OilAnalysisBean;
import com.ejweb.modules.airport.bean.StatisticalBean;
import com.ejweb.modules.airport.dao.OilAnalysisDao;
import com.ejweb.modules.airport.entity.AirportListEntity;
import com.ejweb.modules.airport.entity.OilAnalysisEntity;
import com.ejweb.modules.airport.service.OilAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@Controller
@RequestMapping(value = "/api/oil")
public class OilAnalysisController {
@Autowired
private OilAnalysisService oilAnalysisService;
@ResponseBody
@RequestMapping(value = "/oilAnalysis")
public ResponseBean getOilAnalysisData(RequestBean requestBean)
{
PageEntity<OilAnalysisEntity> list = null;
ResponseBean responseBean = new ResponseBean();
OilAnalysisBean bean = requestBean.getObjectBean(OilAnalysisBean.class);
list = oilAnalysisService.getAnalysisData(bean,true);
if (list == null)// 查询结果为空
{
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
}else {
responseBean.setData(list);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
}
return responseBean;
}
@RequestMapping(value = "/oilAnalysisExport")
public ResponseBean newExport(RequestBean requestBean, HttpServletResponse response) {
ResponseBean responseBean = new ResponseBean();
OilAnalysisBean bean = requestBean.getObjectBean(OilAnalysisBean.class);
PageEntity<OilAnalysisEntity> page = oilAnalysisService.getAnalysisData(bean,false);
List<OilAnalysisEntity> list = new ArrayList<OilAnalysisEntity>();
if (page != null)
{
list = page.getList();
//自定义导出序号
String fileName = "油量分析统计(油量单位:KGS).xlsx";
try {
new ExportExcel("油量分析统计(油量单位:KGS)", OilAnalysisEntity.class).setDataList(list).write(response, fileName).dispose();
} catch (IOException e) {
responseBean.setMessage("导出数据失败" + e.getMessage());
return responseBean;
}
return null;
}
return responseBean;
}
}
/**
*
*
*/
package com.ejweb.modules.airport.api;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON;
import com.ejweb.core.api.RequestBean;
import com.ejweb.core.api.ResponseBean;
import com.ejweb.core.base.PageEntity;
......@@ -21,39 +11,53 @@ import com.ejweb.core.conf.ErrorCode;
import com.ejweb.core.conf.GConstants;
import com.ejweb.core.utils.excel.ExportExcel;
import com.ejweb.modules.airport.bean.StatisticalBean;
import com.ejweb.modules.airport.bean.StatisticalListBean;
import com.ejweb.modules.airport.bean.TypeBean;
import com.ejweb.modules.airport.entity.StatisticalEntity;
import com.ejweb.modules.airport.entity.StatisticalListEntity;
import com.ejweb.modules.airport.service.StatisticalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* 数据统计
* @team suzhou
*
* @author huhy
* @version 1.0
* @time 2016年9月7日
* @team suzhou
* @time 2016年9月7日
*/
@Controller
@RequestMapping(value = "/api/airline/statistical")
public class StatisticalController{
public class StatisticalController {
@Autowired
private StatisticalService statisticalService;
@ResponseBody
@RequestMapping(value = "/list")
public ResponseBean getStatisticalList(RequestBean requestBean){
public ResponseBean getStatisticalList(RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean();
StatisticalBean bean = requestBean.getObjectBean(StatisticalBean.class);
String sort=bean.getSort();
if(sort!=null && !"".equals(sort)){
if(",".equals(sort.substring(0, 1))){
sort=sort.substring(1,sort.length());
String sort = bean.getSort();
if (sort != null && !"".equals(sort)) {
if (",".equals(sort.substring(0, 1))) {
sort = sort.substring(1, sort.length());
}
}
String message = statisticalService.validate(bean);
if(message == null){
if (message == null) {
// 参数校验为通过
PageEntity<StatisticalEntity> list = statisticalService.getStatisticalList(bean);
if(list == null){// 查询结果为空
// 查询结果为空
if (list == null) {
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
......@@ -67,25 +71,26 @@ public class StatisticalController{
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
@RequestMapping(value = "export")
public ResponseBean exportExcel(RequestBean requestBean,HttpServletResponse response){
public ResponseBean exportExcel(RequestBean requestBean, HttpServletResponse response) {
ResponseBean responseBean = new ResponseBean();
StatisticalBean bean = requestBean.getObjectBean(StatisticalBean.class);
String message = statisticalService.validate(bean);
if(message == null){
if (message == null) {
bean.setPageSize(1000);
// 参数校验为通过
PageEntity<StatisticalEntity> page = statisticalService.getStatisticalList(bean);
List<StatisticalEntity> list=new ArrayList<StatisticalEntity>();
if(page != null){// 查询结果为空
list=page.getList();
List<StatisticalEntity> list = new ArrayList<StatisticalEntity>();
// 查询结果为空
if (page != null) {
list = page.getList();
}
String fileName = "航线论证数据统计.xlsx";
try {
new ExportExcel("航线论证数据统计", StatisticalEntity.class).setDataList(list).write(response, fileName).dispose();
} catch (IOException e) {
responseBean.setMessage("导出数据失败"+e.getMessage());
responseBean.setMessage("导出数据失败" + e.getMessage());
return responseBean;
}
return null;
......@@ -94,4 +99,103 @@ public class StatisticalController{
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
@ResponseBody
@RequestMapping(value = "/getList")
public ResponseBean getList(RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean();
StatisticalListBean bean = requestBean.getObjectBean(StatisticalListBean.class);
String message = statisticalService.validate(bean);
if (message == null) {
// 参数校验为通过
PageEntity<StatisticalListEntity> list = statisticalService.getList(bean);
// 查询结果为空
if (list == null) {
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
}
responseBean.setData(list);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
return responseBean;
}
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
@RequestMapping(value = "newExport")
public ResponseBean newExport(RequestBean requestBean, HttpServletResponse response) {
ResponseBean responseBean = new ResponseBean();
StatisticalListBean bean = requestBean.getObjectBean(StatisticalListBean.class);
String message = statisticalService.validate(bean);
if (message == null) {
bean.setPageNo(1);
bean.setPageSize(9999999);
// 参数校验为通过
PageEntity<StatisticalListEntity> page = statisticalService.getList(bean);
List<StatisticalListEntity> list = new ArrayList<StatisticalListEntity>();
if (page != null) {// 查询结果为空
list = page.getList();
//自定义导出序号
int no = 1;
for (StatisticalListEntity s:list
) {
//自定义导出格式
s.setDepIataLabel(s.getDepIataName()+s.getDepIata()+"-"+s.getArrIataName()+s.getArrIata());
s.setNo(no);
no++;
//航线状态自定义
if (s.getAirlineStatus() == 0){
s.setStatus("失效");
}
if (s.getAirlineStatus() == 1){
s.setStatus("有效");
}
//机型状态自定义
List<TypeBean> typeBeans = JSON.parseArray(s.getAirlineJson(),TypeBean.class);
s.setTypeOne(typeInfo(typeBeans.get(0),s.getAirlineStatus()));
s.setTypeTwo(typeInfo(typeBeans.get(typeBeans.size()-3),s.getAirlineStatus()));
s.setTypeThree(typeInfo(typeBeans.get(typeBeans.size()-2),s.getAirlineStatus()));
s.setTypeFour(typeInfo(typeBeans.get(typeBeans.size()-1),s.getAirlineStatus()));
}
String fileName = "航线执行期监控统计.xlsx";
try {
new ExportExcel("航线执行期监控统计---"+bean.getBenchmarkingTime(), StatisticalListEntity.class).setDataList(list).write(response, fileName).dispose();
} catch (IOException e) {
responseBean.setMessage("导出数据失败" + e.getMessage());
return responseBean;
}
return null;
}
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
private String typeInfo(TypeBean s,Integer status){
if (status == 0){
if (s.getStatus() == 3){
return "不可用";
}
return "论证失效";
}else{
if (s.getStatus() == 1){
return s.getLastTime();
}
if (s.getStatus() == 2){
return "可用";
}
if (s.getStatus() == 3){
return "不可用";
}
}
return null;
}
}
package com.ejweb.modules.airport.bean;
import com.alibaba.fastjson.annotation.JSONField;
import com.ejweb.core.base.GenericBean;
import com.ejweb.core.conf.GConstants;
import javax.validation.constraints.Min;
/**
* 油量分析
*
* @author luoh
* @version 1.0
* @team suzhou
* @time 2020年12月10日
*/
public class OilAnalysisBean extends GenericBean {
//最低起飞时间
private String minDepTime;
//最大起飞时间
private String maxDepTime;
//航班号
private String flightNo;
//起飞机场三字码
private String depIata;
//目的机场三字码
private String arrIata;
//签派员
private String dispatcher;
//签派员英文名
private String dispatcherENG;
//签派员中文名
private String dispatcherZH;
//最低总油量
private Integer mintotalOil;
//最高总油量
private Integer maxtotalOil;
@Min(value=1, message="pageNo必须大于等于1")
private int pageNo=1;//第几页
@Min(value=1, message="pageSize必须大于等于1")
private int pageSize= GConstants.PAGE_SIZE;//每页条数
public String getMinDepTime() {
return minDepTime;
}
public void setMinDepTime(String minDepTime) {
this.minDepTime = minDepTime;
}
public String getMaxDepTime() {
return maxDepTime;
}
public void setMaxDepTime(String maxDepTime) {
this.maxDepTime = maxDepTime;
}
public String getFlightNo() {
return flightNo;
}
public void setFlightNo(String flightNo) {
this.flightNo = flightNo;
}
public String getDepIata() {
return depIata;
}
public void setDepIata(String depIata) {
this.depIata = depIata;
}
public String getArrIata() {
return arrIata;
}
public void setArrIata(String arrIata) {
this.arrIata = arrIata;
}
public String getDispatcher() {
return dispatcher;
}
public void setDispatcher(String dispatcher) {
this.dispatcher = dispatcher;
}
public Integer getMintotalOil() {
return mintotalOil;
}
public void setMintotalOil(Integer mintotalOil) {
this.mintotalOil = mintotalOil;
}
public Integer getMaxtotalOil() {
return maxtotalOil;
}
public void setMaxtotalOil(Integer maxtotalOil) {
this.maxtotalOil = maxtotalOil;
}
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public String getDispatcherENG() {
return dispatcherENG;
}
public void setDispatcherENG(String dispatcherENG) {
this.dispatcherENG = dispatcherENG;
}
public String getDispatcherZH() {
return dispatcherZH;
}
public void setDispatcherZH(String dispatcherZH) {
this.dispatcherZH = dispatcherZH;
}
}
......@@ -11,35 +11,57 @@ import com.ejweb.core.base.GenericBean;
import com.ejweb.core.conf.GConstants;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.List;
/**
*
* @team suzhou
* @author huhy
* @version 1.0
* @time 2016年9月7日
* @team suzhou
* @time 2016年9月7日
*/
public class StatisticalBean extends GenericBean{
public class StatisticalBean extends GenericBean {
private String routeNo;
private String verifNo;
private String depIata;
private String arrIata;
private String sort;
private String verifType;
@NotEmpty(message="userCode不能为空")
@NotEmpty(message = "userCode不能为空")
private String userCode;
@Min(value=1, message="pageNo必须大于等于1")
private int pageNo=1;//第几页
@Min(value=1, message="pageSize必须大于等于1")
private int pageSize=GConstants.PAGE_SIZE;//每页条数
@Min(value = 1, message = "pageNo必须大于等于1")
private int pageNo = 1;//第几页
@Min(value = 1, message = "pageSize必须大于等于1")
private int pageSize = GConstants.PAGE_SIZE;//每页条数
private String verifStatus = "02";
private String aircraftType;
List arrIataList;
List depIataList;
public List getArrIataList() {
return arrIataList;
}
public void setArrIataList(List arrIataList) {
this.arrIataList = arrIataList;
}
public List getDepIataList() {
return depIataList;
}
public void setDepIataList(List depIataList) {
this.depIataList = depIataList;
}
public String getAircraftType() {
return aircraftType;
}
public void setAircraftType(String aircraftType) {
this.aircraftType = aircraftType;
}
/**
* @return the routeNo
*/
......
package com.ejweb.modules.airport.bean;
import com.ejweb.core.base.GenericBean;
import com.ejweb.core.conf.GConstants;
import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.Min;
public class StatisticalListBean extends GenericBean {
private String depIata;
private String arrIata;
@NotEmpty(message = "userCode不能为空")
private String userCode;
@Min(value = 1, message = "pageNo必须大于等于1")
private int pageNo = 1;//第几页
@Min(value = 1, message = "pageSize必须大于等于1")
private int pageSize = GConstants.PAGE_SIZE;//每页条数
private String benchmarkingTime;
private Integer airlineStatus;
private String beginTime;
private String endTime;
public String getDepIata() {
return depIata;
}
public void setDepIata(String depIata) {
this.depIata = depIata;
}
public String getArrIata() {
return arrIata;
}
public void setArrIata(String arrIata) {
this.arrIata = arrIata;
}
public String getUserCode() {
return userCode;
}
public void setUserCode(String userCode) {
this.userCode = userCode;
}
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public String getBenchmarkingTime() {
return benchmarkingTime;
}
public void setBenchmarkingTime(String benchmarkingTime) {
this.benchmarkingTime = benchmarkingTime;
}
public Integer getAirlineStatus() {
return airlineStatus;
}
public void setAirlineStatus(Integer airlineStatus) {
this.airlineStatus = airlineStatus;
}
public String getBeginTime() {
return beginTime;
}
public void setBeginTime(String beginTime) {
this.beginTime = beginTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}
package com.ejweb.modules.airport.bean;
import com.ejweb.core.base.BaseEntity;
public class TypeBean extends BaseEntity {
private static final long serialVersionUID = -4211749532324022040L;
private String type;
private Integer status;
private String lastTime;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getLastTime() {
return lastTime;
}
public void setLastTime(String lastTime) {
this.lastTime = lastTime;
}
}
package com.ejweb.modules.airport.dao;
import com.ejweb.core.base.BaseDao;
import com.ejweb.modules.airport.bean.AirportListBean;
import com.ejweb.modules.airport.bean.OilAnalysisBean;
import com.ejweb.modules.airport.entity.AirportListEntity;
import com.ejweb.modules.airport.entity.OilAnalysisEntity;
import java.util.List;
public interface OilAnalysisDao extends BaseDao {
// 查询油量分析数据
List<OilAnalysisEntity> getOilAnalysisData(OilAnalysisBean bean);
}
......@@ -3,21 +3,31 @@
*/
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.bean.StatisticalListBean;
import com.ejweb.modules.airport.entity.AirportInfoEntity;
import com.ejweb.modules.airport.entity.StatisticalEntity;
import com.ejweb.modules.airport.entity.StatisticalListEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
* @team suzhou
* @author huhy
* @version 1.0
* @time 2016年9月8日
* @team suzhou
* @time 2016年9月8日
*/
public interface StatisticalDao extends BaseDao{
public interface StatisticalDao extends BaseDao {
List<StatisticalEntity> getStatisticalList(StatisticalBean bean);
List<StatisticalEntity> getStatisticalArrIataList(StatisticalBean bean);
Integer getDay(StatisticalEntity entity);
List<StatisticalListEntity> getList(@Param("bean") StatisticalListBean statisticalListBean,@Param("list") List<AirportInfoEntity> airportInfoEntities);
List<AirportInfoEntity> getAirporStnList(@Param("beginTime") String beginTime, @Param("endTime") String endTime);
}
package com.ejweb.modules.airport.entity;
import com.ejweb.core.base.BaseEntity;
public class AirPlaneEntity extends BaseEntity {
private static final long serialVersionUID = -4211749532324022040L;
private String type;
private int status;
private String lastTime;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getLastTime() {
return lastTime;
}
public void setLastTime(String lastTime) {
this.lastTime = lastTime;
}
}
package com.ejweb.modules.airport.entity;
import com.ejweb.core.base.BaseEntity;
public class AirportInfoEntity extends BaseEntity {
private static final long serialVersionUID = -4211749532324022040L;
private String arrStn;
private String depStn;
public String getArrStn() {
return arrStn;
}
public void setArrStn(String arrStn) {
this.arrStn = arrStn;
}
public String getDepStn() {
return depStn;
}
public void setDepStn(String depStn) {
this.depStn = depStn;
}
}
......@@ -28,7 +28,7 @@ public class AirportListEntity extends BaseEntity implements Comparable<AirportL
private Integer landingTime; // 着地时间
private String airportNamePinyin; //航站名称(拼音)
private String airportNameLetter; //航站名称(首字母)
@JSONField(serialize=false)
// @JSONField(serialize=false)
private Short status = 2; // 状态: 1 显示 2 屏蔽 3 删除,默认为2
public String getAirportNamePinyin() {
......
package com.ejweb.modules.airport.entity;
import com.ejweb.core.base.BaseEntity;
import com.ejweb.core.utils.excel.annotation.ExcelField;
/**
* 油量分析
*
* @author luoh
* @version 1.0
* @team suzhou
* @time 2020年12月10日
*/
public class OilAnalysisEntity {
@ExcelField(title="序号", type=0, align=1, sort=27 )
private int no;
@ExcelField(title="计划起飞时间", type=0, align=1, sort=28 )
private String stdExcel; // 计划起飞时间(导出用)
@ExcelField(title="航班号", type=0, align=1, sort=29 )
private String flightNo; // 航班号
@ExcelField(title="飞机号", type=0, align=1, sort=30 )
private String acNo; // 飞机号
@ExcelField(title="机型", type=0, align=1, sort=31 )
private String acTypeName; // 机型
@ExcelField(title="起飞机场", type=0, align=1, sort=32 )
private String depAirPortName; // 起飞机场中文名称
@ExcelField(title="起飞机场三字码", type=0, align=1, sort=33 )
private String depIataId; // 起飞机场三字码
@ExcelField(title="目的机场", type=0, align=1, sort=34 )
private String arrAirPortName; // 落地机场中文名称
@ExcelField(title="目的机场三字码", type=0, align=1, sort=35 )
private String arrIataId; // 落地机场三字码
@ExcelField(title="签派人姓名", type=0, align=1, sort=36 )
private String dispatcherAccount; // 签派人账号
@ExcelField(title="签派人账号", type=0, align=1, sort=37 )
private String dispatcherName; // 签派人
@ExcelField(title="总油量(KGS)", type=0, align=1, sort=38 )
private Integer totalOilKGS; // 总油量
@ExcelField(title="总油量(LBS)", type=0, align=1, sort=39 )
private Integer totalOilLBS; // 总油量
@ExcelField(title="起飞额外油量", type=0, align=1, sort=40 )
private Integer extraOilFuelTakeoff; // 起飞额外油量
@ExcelField(title="起飞额外油量原因", type=0, align=1, sort=41 )
private String extraOilFuelTakeoffReason; // 起飞额外油量原因
@ExcelField(title="到达额外油量", type=0, align=1, sort=42 )
private Integer extraOilFuelArr; // 到达额外油量
@ExcelField(title="到达额外油量原因", type=0, align=1, sort=43 )
private String extraOilFuelArrReason; // 到达额外油量原因
@ExcelField(title="航路额外油量", type=0, align=1, sort=44 )
private Integer extraOilFuelFlight; // 航路额外油量
@ExcelField(title="航路额外油量原因", type=0, align=1, sort=45)
private String extraOilFuelFlightReason; // 航路额外油量原因
@ExcelField(title="其他额外油量", type=0, align=1, sort=46 )
private Integer extraOilFuelOther; // 其他额外油量
@ExcelField(title="其他额外油量原因", type=0, align=1, sort=47 )
private String extraOilFuelOtherReason; // 起飞额外油量原因
@ExcelField(title="数据更新时间", type=0, align=1, sort=48 )
private String updateTime; // 数据更新时间
private String updateDate; // 数据更新时间
private String extraOilFuelReason; // 额外油加注原因
private String totalOil; // 总油量
private String std; // 计划起飞时间
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getDispatcherAccount() {
return dispatcherAccount;
}
public void setDispatcherAccount(String dispatcherAccount) {
this.dispatcherAccount = dispatcherAccount;
}
public String getExtraOilFuelTakeoffReason() {
return extraOilFuelTakeoffReason;
}
public void setExtraOilFuelTakeoffReason(String extraOilFuelTakeoffReason) {
this.extraOilFuelTakeoffReason = extraOilFuelTakeoffReason;
}
public String getExtraOilFuelArrReason() {
return extraOilFuelArrReason;
}
public void setExtraOilFuelArrReason(String extraOilFuelArrReason) {
this.extraOilFuelArrReason = extraOilFuelArrReason;
}
public String getExtraOilFuelFlightReason() {
return extraOilFuelFlightReason;
}
public void setExtraOilFuelFlightReason(String extraOilFuelFlightReason) {
this.extraOilFuelFlightReason = extraOilFuelFlightReason;
}
public String getExtraOilFuelOtherReason() {
return extraOilFuelOtherReason;
}
public void setExtraOilFuelOtherReason(String extraOilFuelOtherReason) {
this.extraOilFuelOtherReason = extraOilFuelOtherReason;
}
public String getStdExcel() {
return stdExcel;
}
public void setStdExcel(String stdExcel) {
this.stdExcel = stdExcel;
}
public int getNo() {
return no;
}
public void setNo(int no) {
this.no = no;
}
public String getAcTypeName() {
return acTypeName;
}
public void setAcTypeName(String acTypeName) {
this.acTypeName = acTypeName;
}
public String getStd() {
return std;
}
public void setStd(String std) {
this.std = std;
}
public String getFlightNo() {
return flightNo;
}
public void setFlightNo(String flightNo) {
this.flightNo = flightNo;
}
public String getAcNo() {
return acNo;
}
public void setAcNo(String acNo) {
this.acNo = acNo;
}
public String getDepIataId() {
return depIataId;
}
public void setDepIataId(String depIataId) {
this.depIataId = depIataId;
}
public String getArrIataId() {
return arrIataId;
}
public void setArrIataId(String arrIataId) {
this.arrIataId = arrIataId;
}
public String getDispatcherName() {
return dispatcherName;
}
public void setDispatcherName(String dispatcherName) {
this.dispatcherName = dispatcherName;
}
public String getTotalOil() {
return totalOil;
}
public void setTotalOil(String totalOil) {
this.totalOil = totalOil;
}
public String getExtraOilFuelReason() {
return extraOilFuelReason;
}
public void setExtraOilFuelReason(String extraOilFuelReason) {
this.extraOilFuelReason = extraOilFuelReason;
}
public Integer getExtraOilFuelTakeoff() {
return extraOilFuelTakeoff;
}
public void setExtraOilFuelTakeoff(Integer extraOilFuelTakeoff) {
this.extraOilFuelTakeoff = extraOilFuelTakeoff;
}
public Integer getExtraOilFuelArr() {
return extraOilFuelArr;
}
public void setExtraOilFuelArr(Integer extraOilFuelArr) {
this.extraOilFuelArr = extraOilFuelArr;
}
public Integer getExtraOilFuelFlight() {
return extraOilFuelFlight;
}
public void setExtraOilFuelFlight(Integer extraOilFuelFlight) {
this.extraOilFuelFlight = extraOilFuelFlight;
}
public Integer getExtraOilFuelOther() {
return extraOilFuelOther;
}
public void setExtraOilFuelOther(Integer extraOilFuelOther) {
this.extraOilFuelOther = extraOilFuelOther;
}
public String getDepAirPortName() {
return depAirPortName;
}
public void setDepAirPortName(String depAirPortName) {
this.depAirPortName = depAirPortName;
}
public String getArrAirPortName() {
return arrAirPortName;
}
public void setArrAirPortName(String arrAirPortName) {
this.arrAirPortName = arrAirPortName;
}
public String getUpdateDate() {
return updateDate;
}
public void setUpdateDate(String updateDate) {
this.updateDate = updateDate;
}
public Integer getTotalOilKGS() {
return totalOilKGS;
}
public void setTotalOilKGS(Integer totalOilKGS) {
this.totalOilKGS = totalOilKGS;
}
public Integer getTotalOilLBS() {
return totalOilLBS;
}
public void setTotalOilLBS(Integer totalOilLBS) {
this.totalOilLBS = totalOilLBS;
}
}
package com.ejweb.modules.airport.entity;
import com.ejweb.core.base.BaseEntity;
import com.ejweb.core.utils.excel.annotation.ExcelField;
public class StatisticalListEntity extends BaseEntity {
private static final long serialVersionUID = -4211749532324022040L;
private String arrIata;
private String arrIataName;
private String depIata;
private String depIataName;
@ExcelField(title="最后一班航班时间", type=0, align=1, sort=25 )
private String lastAirlineTime;
private String updateTime;
private int airlineStatus;
private String airlineJson;
@ExcelField(title="航线状态", type=0, align=1, sort=26 )
private String status;
@ExcelField(title="A319/A320", type=0, align=1, sort=21 )
private String typeOne;
@ExcelField(title="A321", type=0, align=1, sort=22 )
private String typeTwo;
@ExcelField(title="A320neo", type=0, align=1, sort=23 )
private String typeThree;
@ExcelField(title="A330", type=0, align=1, sort=24 )
private String typeFour;
@ExcelField(title="航线", type=0, align=1, sort=20 )
private String depIataLabel;
@ExcelField(title="序号", type=0, align=1, sort=19 )
private int no;
public String getArrIata() {
return arrIata;
}
public void setArrIata(String arrIata) {
this.arrIata = arrIata;
}
public String getArrIataName() {
return arrIataName;
}
public void setArrIataName(String arrIataName) {
this.arrIataName = arrIataName;
}
public String getDepIata() {
return depIata;
}
public void setDepIata(String depIata) {
this.depIata = depIata;
}
public String getDepIataName() {
return depIataName;
}
public void setDepIataName(String depIataName) {
this.depIataName = depIataName;
}
public String getLastAirlineTime() {
return lastAirlineTime;
}
public void setLastAirlineTime(String lastAirlineTime) {
this.lastAirlineTime = lastAirlineTime;
}
public int getAirlineStatus() {
return airlineStatus;
}
public void setAirlineStatus(int airlineStatus) {
this.airlineStatus = airlineStatus;
}
public String getAirlineJson() {
return airlineJson;
}
public void setAirlineJson(String airlineJson) {
this.airlineJson = airlineJson;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getTypeOne() {
return typeOne;
}
public void setTypeOne(String typeOne) {
this.typeOne = typeOne;
}
public String getTypeTwo() {
return typeTwo;
}
public void setTypeTwo(String typeTwo) {
this.typeTwo = typeTwo;
}
public String getTypeThree() {
return typeThree;
}
public void setTypeThree(String typeThree) {
this.typeThree = typeThree;
}
public String getTypeFour() {
return typeFour;
}
public void setTypeFour(String typeFour) {
this.typeFour = typeFour;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDepIataLabel() {
return depIataLabel;
}
public void setDepIataLabel(String depIataLabel) {
this.depIataLabel = depIataLabel;
}
public int getNo() {
return no;
}
public void setNo(int no) {
this.no = no;
}
}
package com.ejweb.modules.airport.service;
import java.util.Collections;
import java.util.List;
import org.springframework.stereotype.Service;
import com.ejweb.core.base.BaseService;
import com.ejweb.core.base.FindEntity;
import com.ejweb.core.base.PageEntity;
......@@ -12,69 +7,57 @@ import com.ejweb.modules.airport.bean.AirportListBean;
import com.ejweb.modules.airport.dao.AirportDao;
import com.ejweb.modules.airport.entity.AirportEntity;
import com.ejweb.modules.airport.entity.AirportListEntity;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
* 三字码
*
* @team IT Team
*
* @author renmb
* @version 1.0
* @time 2016年8月27日
* @team IT Team
* @time 2016年8月27日
*/
@Service
public class AirportService extends BaseService<AirportDao> {
/**
* 获取指定三字码的详情
*
* @author renmb
* @time 2016年8月30日
*
* @param iata
* @return
* @author renmb
* @time 2016年8月30日
*/
public AirportEntity getAirportByIata(String iata){
public AirportEntity getAirportByIata(String iata) {
FindEntity entity = new FindEntity(iata);
return dao.getAirportByIata(entity);
}
/**
* 获取所有的三字码列表,次接口不需要分页
*
* @author renmb
* @time 2016年8月30日
*
* @param bean
* @return
* @author renmb
* @time 2016年8月30日
*/
public PageEntity<AirportListEntity> getAirportList(AirportListBean bean){
// PageInfo<AirportListEntity> pageInfo = null;
// 必须紧贴dao的查询方法
// PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
// pageInfo = new PageInfo<AirportListEntity>(dao.getAirportList(bean));
// if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL
//
// return null;
// }
List<AirportListEntity> list = dao.getAirportList(bean);//pageInfo.getList();
public PageEntity<AirportListEntity> getAirportList(AirportListBean bean) {
List<AirportListEntity> list = dao.getAirportList(bean);
Collections.sort(list);
if (list == null || list.size() == 0) {// 如果没有数据则返回NULL
// 如果没有数据则返回NULL
if (list == null || list.size() == 0) {
return null;
}
// PageEntity<AirportListEntity> page = new PageEntity<AirportListEntity>();
// page.setPageNo(pageInfo.getPageNum());
// page.setPageSize(pageInfo.getPageSize());
// page.setCount(pageInfo.getTotal());
// page.setTotalPage(pageInfo.getPages());
// page.setList(pageInfo.getList());
PageEntity<AirportListEntity> page = new PageEntity<AirportListEntity>();
page.setPageNo(1);
page.setPageSize(list.size());
page.setCount(list.size());
page.setTotalPage(1);
page.setList(list);
return page;
}
......
package com.ejweb.modules.airport.service;
import com.ejweb.core.base.BaseService;
import com.ejweb.core.base.PageEntity;
import com.ejweb.modules.airport.bean.OilAnalysisBean;
import com.ejweb.modules.airport.dao.OilAnalysisDao;
import com.ejweb.modules.airport.entity.OilAnalysisEntity;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
@Service
public class OilAnalysisService extends BaseService<OilAnalysisDao> {
@Autowired
protected OilAnalysisDao oilAnalysisDao;
public PageEntity<OilAnalysisEntity> getAnalysisData(OilAnalysisBean bean, Boolean isPage) {
if (isPage == true) {
PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
}
//派遣员条件为账号和名字
if (!StringUtils.isEmpty(bean.getDispatcher())) {
if (bean.getDispatcher().matches("[\u4E00-\u9FA5]+")) {
//内容是中文
bean.setDispatcherZH(bean.getDispatcher());
} else {
//内容包含非中文
bean.setDispatcherENG(bean.getDispatcher());
}
}
PageInfo<OilAnalysisEntity> pageInfo = null;
List<OilAnalysisEntity> oilAnalysisEntityList = oilAnalysisDao.getOilAnalysisData(bean);
for (OilAnalysisEntity oilAnalysisEntity : oilAnalysisEntityList) {
int index = oilAnalysisEntityList.indexOf(oilAnalysisEntity);
oilAnalysisEntity.setNo(index + 1);
String totalOil = oilAnalysisEntity.getTotalOil();
String[] oilArr = totalOil.split("/");
if (oilArr != null && oilArr.length == 2) {
String strKGS = oilArr[0];
String strLBS = oilArr[1];
if (strKGS.length() == 0) {
strKGS = "0";
}
if (strLBS.length() == 0) {
strKGS = "0";
}
oilAnalysisEntity.setTotalOilKGS(Integer.valueOf(strKGS.replaceAll("KGS", "")));
oilAnalysisEntity.setTotalOilLBS(Integer.valueOf(strLBS.replaceAll("LBS", "")));
}
String oilFuelReason = oilAnalysisEntity.getExtraOilFuelReason();
if (!StringUtils.isEmpty(oilFuelReason)) {
String[] arr = oilFuelReason.split("\\|");
for (int i = 0; i < arr.length; i++) {
String arrTemp = arr[i];
String oilNum = "";
String oilReason = "";
String[] reasonArr = arrTemp.split(":");
if (arrTemp.indexOf(":") > 1) {
if (reasonArr.length == 1) {
//只有前面
oilNum = reasonArr[0];
oilReason = "";
} else if (reasonArr.length == 2) {
//前后都有
oilNum = reasonArr[0];
oilReason = reasonArr[1];
}
} else {
if (reasonArr.length == 1) {
//只有后面
oilNum = "";
oilReason = reasonArr[1];
}
}
if (oilNum.length() == 0) {
oilNum = "0";
}
switch (i) {
case 0:
//起飞油量及原因
oilAnalysisEntity.setExtraOilFuelTakeoff(Integer.valueOf(oilNum));
oilAnalysisEntity.setExtraOilFuelTakeoffReason(oilReason);
break;
case 1:
//到达额外油量及原因
oilAnalysisEntity.setExtraOilFuelArr(Integer.valueOf(oilNum));
oilAnalysisEntity.setExtraOilFuelArrReason(oilReason);
break;
case 2:
//航路额外油量及原因
oilAnalysisEntity.setExtraOilFuelFlight(Integer.valueOf(oilNum));
oilAnalysisEntity.setExtraOilFuelFlightReason(oilReason);
break;
case 3:
//其他额外油量及原因
oilAnalysisEntity.setExtraOilFuelOther(Integer.valueOf(oilNum));
oilAnalysisEntity.setExtraOilFuelOtherReason(oilReason);
break;
default:
}
}
}
}
if (oilAnalysisEntityList == null || oilAnalysisEntityList.size() == 0) {
return null;
}
pageInfo = new PageInfo<OilAnalysisEntity>(oilAnalysisEntityList);
if (pageInfo.getPages() < bean.getPageNo()) {// 页码大于总页数,则返回NULL
return null;
}
PageEntity<OilAnalysisEntity> page = new PageEntity<OilAnalysisEntity>();
page.setPageNo(pageInfo.getPageNum());
page.setPageSize(pageInfo.getPageSize());
page.setCount(pageInfo.getTotal());
page.setTotalPage(pageInfo.getPages());
page.setList(pageInfo.getList());
return page;
}
}
......@@ -6,18 +6,27 @@ package com.ejweb.modules.airport.service;
import com.ejweb.core.base.BaseService;
import com.ejweb.core.base.PageEntity;
import com.ejweb.modules.airport.bean.StatisticalBean;
import com.ejweb.modules.airport.bean.StatisticalListBean;
import com.ejweb.modules.airport.dao.StatisticalDao;
import com.ejweb.modules.airport.entity.AirportInfoEntity;
import com.ejweb.modules.airport.entity.StatisticalEntity;
import com.ejweb.modules.airport.entity.StatisticalListEntity;
import com.ejweb.modules.verify.bean.AirlineVerifiedAddBean;
import com.ejweb.modules.verify.dao.AirlineVerifiedDao;
import com.ejweb.modules.verify.dao.AirlineVerifyDao;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
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.Iterator;
import java.util.List;
import java.util.Objects;
/**
* @author huhy
......@@ -27,13 +36,23 @@ import java.util.List;
*/
@Service
public class StatisticalService extends BaseService<StatisticalDao> {
private final static Logger LOG = Logger.getLogger(StatisticalService.class);
@Autowired
private AirlineVerifiedDao airlineVerifiedDao;
@Autowired
private AirlineVerifyDao verifdao;
@Autowired
private StatisticalDao statisticalDao;
public PageEntity<StatisticalEntity> getStatisticalList(StatisticalBean bean) {
//查询同一机场被屏蔽三字码数据(历史数据关联)
if (StringUtils.isNotEmpty(bean.getArrIata())) {
bean.setArrIataList(verifdao.getIataStr(bean.getArrIata()));
}
if (StringUtils.isNotEmpty(bean.getDepIata())) {
bean.setDepIataList(verifdao.getIataStr(bean.getDepIata()));
}
PageInfo<StatisticalEntity> pageInfo = null;
// 必须紧贴dao的查询方法
PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
......@@ -41,24 +60,49 @@ public class StatisticalService extends BaseService<StatisticalDao> {
abean.setUserCode(bean.getUserCode());
if (StringUtils.isEmpty(bean.getSort())) {
PageHelper.orderBy("source,routeNo DESC");
} else
} 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) {
String typelist = verifdao.getTypeList1(e.getVerifId());
if (StringUtils.isNoneBlank(typelist))
if (StringUtils.isNoneBlank(typelist)) {
e.setTypeName(e.getTypeName() + ":" + typelist);
}
e.setTypeList(verifdao.getTypeList(e.getVerifId()));
if (departId.equals(e.getDepartId()))
if (departId.equals(e.getDepartId())) {
e.setReStart(true);
else
} 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())) {
//调机类型,如果当天为开航时间,有效期为1天,否则设置为负数,前端判断有效期为负数,显示--
if (null != startTime && format.equals(startTime)) {
e.setExpiryDate(1 + "");
} 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) {
......@@ -100,4 +144,44 @@ public class StatisticalService extends BaseService<StatisticalDao> {
return page;
}
public PageEntity<StatisticalListEntity> getList(StatisticalListBean statisticalListBean) {
//通过开始时间和结束时间查询航班
List<AirportInfoEntity> airportInfoEntities = null;
if (!(statisticalListBean.getBeginTime().equals(' ') && statisticalListBean.getEndTime().equals(" "))) {
airportInfoEntities = statisticalDao.getAirporStnList(statisticalListBean.getBeginTime(), statisticalListBean.getEndTime());
}
List<StatisticalListEntity> lists = null;
lists = statisticalDao.getList(statisticalListBean, airportInfoEntities);
if (Objects.nonNull(statisticalListBean.getAirlineStatus())) {
//使用迭代器进行筛选
Iterator<StatisticalListEntity> iter = lists.iterator();
while (iter.hasNext()) {
//当此对象状态与传入状态不一致时remove对象
if (iter.next().getAirlineStatus() != statisticalListBean.getAirlineStatus()) {
iter.remove();
}
}
}
//创建Page类
Page page = new Page(statisticalListBean.getPageNo(), statisticalListBean.getPageSize());
//为Page类中的total属性赋值
int total = lists.size();
page.setTotal(total);
//计算当前需要显示的数据下标起始值
int startIndex = (statisticalListBean.getPageNo() - 1) * statisticalListBean.getPageSize();
int endIndex = Math.min(startIndex + statisticalListBean.getPageSize(), total);
//从链表中截取需要显示的子链表,并加入到Page
page.addAll(lists.subList(startIndex, endIndex));
//以Page创建PageInfo
PageEntity<StatisticalListEntity> pageEntity = new PageEntity<>();
pageEntity.setPageNo(page.getPageNum());
pageEntity.setPageSize(page.getPageSize());
pageEntity.setCount(page.getTotal());
pageEntity.setTotalPage(page.getPages());
pageEntity.setList(page.getResult());
return pageEntity;
}
}
......@@ -5,6 +5,7 @@ import com.ejweb.core.conf.GConstants;
import org.hibernate.validator.constraints.NotEmpty;
import javax.validation.constraints.Min;
import java.util.List;
/**
* 未评估
......@@ -33,14 +34,33 @@ public class AssessmentListBean extends GenericBean {
@Min(value=1, message="pageSize必须大于等于1")
private int pageSize = GConstants.PAGE_SIZE; // 每页条数
@Min(value=1, message="pageNo必须大于等于1")
@Min(value = 1, message = "pageNo必须大于等于1")
private int pageNo = 1; // 当前页码
@NotEmpty(message="assessmentStatus字段不能为空")
@NotEmpty(message = "assessmentStatus字段不能为空")
private String assessmentStatus = "00"; // 值为"00"
private String sort; // 排序用
List arrIataList;
List depIataList;
public List getArrIataList() {
return arrIataList;
}
public void setArrIataList(List arrIataList) {
this.arrIataList = arrIataList;
}
public List getDepIataList() {
return depIataList;
}
public void setDepIataList(List depIataList) {
this.depIataList = depIataList;
}
public String getVerifId() {
return verifId;
}
......
......@@ -52,32 +52,40 @@ public class AssessmentService extends BaseService<AssessmentDao> {
* @return
*/
public PageEntity<AssessmentListEntity> getAssessmentList(AssessmentListBean bean){
//查询同一机场被屏蔽三字码数据(历史数据关联)
if (StringUtils.isNotEmpty(bean.getArrIata())) {
bean.setArrIataList(verifyDao.getIataStr(bean.getArrIata()));
}
if (StringUtils.isNotEmpty(bean.getDepIata())) {
bean.setDepIataList(verifyDao.getIataStr(bean.getDepIata()));
}
PageInfo<AssessmentListEntity> pageInfo = null;
// 必须紧贴dao的查询方法
bean.setAssessmentStatus("00"); // 查询本部门assessmentStatus为"00"的数据
// 查询本部门assessmentStatus为"00"的数据
bean.setAssessmentStatus("00");
PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
if(StringUtils.isEmpty(bean.getSort())){
if (StringUtils.isEmpty(bean.getSort())) {
PageHelper.orderBy(" verifNo DESC");
} else {
PageHelper.orderBy(bean.getSort());
}
else
PageHelper.orderBy(bean.getSort());
pageInfo = new PageInfo<AssessmentListEntity>(dao.getAssessmentList(bean));
if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL
// 页码大于总页数,则返回NULL
if (pageInfo.getPages() < bean.getPageNo()) {
return null;
}
List<AssessmentListEntity> products = pageInfo.getList();
if (products == null || products.size() == 0) {// 如果没有数据则返回NULL
// 如果没有数据则返回NULL
if (products == null || products.size() == 0) {
return null;
}
for(AssessmentListEntity entity: products){
List<Map<String, String>> list1= verifyDao.getConnectList(entity.getVerifId());
List<Map<String, String>> list2=new ArrayList<Map<String, String>>();
for(Map<String, String> map:list1){
Map<String, String> map2=new HashMap<String, String>();
for (AssessmentListEntity entity : products) {
List<Map<String, String>> list1 = verifyDao.getConnectList(entity.getVerifId());
List<Map<String, String>> list2 = new ArrayList<Map<String, String>>();
for (Map<String, String> map : list1) {
Map<String, String> map2 = new HashMap<String, String>();
map2.put("flightNo", map.get("flightNo"));
map2.put("depIata", map.get("depIata"));
map2.put("arrIata", map.get("arrIata"));
......@@ -86,8 +94,6 @@ public class AssessmentService extends BaseService<AssessmentDao> {
}
entity.setConnect(list2);
entity.setTypeList(verifyDao.getTypeList(entity.getVerifId()));
// entity.setConnect(verifyDao.getConnectList(entity.getVerifId()));
}
PageEntity<AssessmentListEntity> page = new PageEntity<AssessmentListEntity>();
page.setPageNo(pageInfo.getPageNum());
......@@ -98,13 +104,14 @@ public class AssessmentService extends BaseService<AssessmentDao> {
return page;
}
public List<AssessmentListEntity> getAssessmentList2(AssessmentListBean bean){
bean.setAssessmentStatus("00"); // 查询本部门assessmentStatus为"00"的数据
public List<AssessmentListEntity> getAssessmentList2(AssessmentListBean bean) {
// 查询本部门assessmentStatus为"00"的数据
bean.setAssessmentStatus("00");
List<AssessmentListEntity> list = dao.getAssessmentList(bean);
for(AssessmentListEntity entity: list){
String typelist=verifyDao.getTypeList1(entity.getVerifId());
if(StringUtils.isNoneBlank(typelist))
entity.setAircraftName(entity.getAircraftName()+":"+typelist);
for (AssessmentListEntity entity : list) {
String typelist = verifyDao.getTypeList1(entity.getVerifId());
if (StringUtils.isNoneBlank(typelist))
entity.setAircraftName(entity.getAircraftName() + ":" + typelist);
}
return list;
}
......
......@@ -6,6 +6,7 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
......@@ -117,7 +118,7 @@ public class MainController{
}
return responseBean;
}
@ResponseBody
@RequestMapping(value = "upload")
public ResponseBean upload(HttpServletRequest request,
......@@ -145,10 +146,10 @@ public class MainController{
int length = 0;
try {
if(originalFilename.toLowerCase().endsWith("xls")){
if (originalFilename.toLowerCase(Locale.ENGLISH).endsWith("xls")) {
HSSFWorkbook hwb = new HSSFWorkbook(file.getInputStream());
length = hwb.getNumberOfSheets();//判断有几张活动的sheet表
}else if(originalFilename.toLowerCase().endsWith("xlsx")){
} else if (originalFilename.toLowerCase(Locale.ENGLISH).endsWith("xlsx")) {
XSSFWorkbook hwb = new XSSFWorkbook(file.getInputStream());
length = hwb.getNumberOfSheets();//判断有几张活动的sheet表
}
......
package com.ejweb.modules.depart.api;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ejweb.core.api.RequestBean;
import com.ejweb.core.api.ResponseBean;
import com.ejweb.core.conf.ErrorCode;
import com.ejweb.core.conf.GConstants;
import com.ejweb.modules.depart.bean.DepartBean;
import com.ejweb.modules.depart.bean.DepartTypeBean;
import com.ejweb.modules.depart.entity.DepartEntity;
import com.ejweb.modules.depart.entity.DepartTypeEntity;
import com.ejweb.modules.depart.service.DepartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* Airport Controller
*
* @author zhanglg
* @version 2016-8-23
*/
@Controller
@RequestMapping(value = "/api/depart")
public class DepartController{
public class DepartController {
@Autowired
private DepartService departService;
@ResponseBody
@RequestMapping(value = "list")
public ResponseBean list(RequestBean requestBean,BindingResult errors) {
public ResponseBean list(RequestBean requestBean, BindingResult errors) {
ResponseBean responseBean = new ResponseBean();
DepartBean bean = requestBean.getObjectBean(DepartBean.class);
String message = departService.validate(bean,errors);
if(message == null){// 通过参数校验
List<DepartEntity> list = departService.findAllList(bean.getIsVerif());
if(list == null){// 数据为空
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
String message = departService.validate(bean, errors);
if (message == null) {// 通过参数校验
List<DepartEntity> list = departService.findAllList(bean.getIsVerif());
if (list == null) {// 数据为空
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
}
responseBean.setData(list);
return responseBean;
}
responseBean.setData(list);
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
@ResponseBody
@RequestMapping(value = "risklist")
public ResponseBean risklist(RequestBean requestBean,BindingResult errors) {
public ResponseBean risklist(RequestBean requestBean, BindingResult errors) {
ResponseBean responseBean = new ResponseBean();
DepartBean bean = requestBean.getObjectBean(DepartBean.class);
String message = departService.validate(bean,errors);
if(message == null){// 通过参数校验
List<DepartEntity> list = departService.findRiskList(bean);
if(list == null){// 数据为空
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
String message = departService.validate(bean, errors);
if (message == null) {// 通过参数校验
List<DepartEntity> list = departService.findRiskList(bean);
if (list == null) {// 数据为空
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
}
responseBean.setData(list);
return responseBean;
}
responseBean.setData(list);
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
@ResponseBody
@RequestMapping(value = "getByuserCode")
public ResponseBean getByUserCode(RequestBean requestBean,BindingResult errors){
public ResponseBean getByUserCode(RequestBean requestBean, BindingResult errors) {
ResponseBean responseBean = new ResponseBean();
DepartBean bean = requestBean.getObjectBean(DepartBean.class);
String message = departService.validate(bean,errors);
if(message == null){// 通过参数校验
DepartEntity entity= departService.getByUserCode(bean.getUserCode());
if(entity == null){// 查询结果为空
String message = departService.validate(bean, errors);
if (message == null) {// 通过参数校验
DepartEntity entity = departService.getByUserCode(bean.getUserCode());
if (entity == null) {// 查询结果为空
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
}else{
} else {
responseBean.setData(entity);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
......@@ -96,4 +100,28 @@ public class DepartController{
return responseBean;
}
@ResponseBody
@RequestMapping(value = "departList")
public ResponseBean departList(RequestBean requestBean, BindingResult errors) {
ResponseBean responseBean = new ResponseBean();
DepartTypeBean bean = requestBean.getObjectBean(DepartTypeBean.class);
String message = departService.validate(bean, errors);
// 通过参数校验
if (message == null) {
List<DepartTypeEntity> list = departService.findDepartList(bean);
// 数据为空
if (list == null) {
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
}
responseBean.setData(list);
return responseBean;
}
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
}
/**
*
*/
package com.ejweb.modules.depart.bean;
import com.ejweb.core.base.GenericBean;
import org.hibernate.validator.constraints.NotEmpty;
/**
*
* @team IT Team
* @author zhanglg
* @version 1.0
* @time 2016年9月9日
*/
public class DepartTypeBean extends GenericBean {
@NotEmpty(message = "type不能为空")
String type;
String verifId;
String isVerif;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getVerifId() {
return verifId;
}
public void setVerifId(String verifId) {
this.verifId = verifId;
}
public String getIsVerif() {
return isVerif;
}
public void setIsVerif(String isVerif) {
this.isVerif = isVerif;
}
}
package com.ejweb.modules.depart.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ejweb.core.base.BaseDao;
import com.ejweb.modules.depart.bean.DepartBean;
import com.ejweb.modules.depart.entity.DepartEntity;
import com.ejweb.modules.depart.entity.DepartTypeEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
......@@ -19,4 +19,6 @@ public interface DepartDao extends BaseDao{
public List<DepartEntity> findAllList(DepartEntity departEntity);
public DepartEntity getByUserCode(@Param(value="userCode") String userCode);
public List<DepartEntity> findRiskList(DepartBean bean);
public List<DepartEntity> findDepartByList(@Param(value="type") String type, @Param(value = "isVerif") String isVerif);
public List<DepartTypeEntity> findDepartAllList();
}
\ No newline at end of file
package com.ejweb.modules.depart.entity;
import com.ejweb.core.base.BaseEntity;
/**
*
* 论证部门Entity
* @author zhanglg
* @version 2016-08-24
*/
public class DepartTypeEntity extends BaseEntity{
private static final long serialVersionUID = 1L;
private String id;
private String departName;
private String isVerif;
private String isRisk;
private Boolean check=false;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Boolean getCheck() {
return check;
}
public void setCheck(Boolean check) {
this.check = check;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getDepartName() {
return departName;
}
public void setDepartName(String departName) {
this.departName = departName;
}
public String getIsVerif() {
return isVerif;
}
public void setIsVerif(String isVerif) {
this.isVerif = isVerif;
}
public String getIsRisk() {
return isRisk;
}
public void setIsRisk(String isRisk) {
this.isRisk = isRisk;
}
}
\ No newline at end of file
package com.ejweb.modules.depart.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ejweb.core.base.BaseService;
import com.ejweb.modules.depart.bean.DepartBean;
import com.ejweb.modules.depart.bean.DepartTypeBean;
import com.ejweb.modules.depart.dao.DepartDao;
import com.ejweb.modules.depart.entity.DepartEntity;
import com.ejweb.modules.depart.entity.DepartTypeEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* Depart Service
......@@ -39,5 +40,22 @@ public class DepartService extends BaseService<DepartDao> {
return departDao.findRiskList(bean);
}
public List<DepartTypeEntity> findDepartList(DepartTypeBean departTypeBean){
//查询所有的部门
List<DepartTypeEntity> allList = departDao.findDepartAllList();
// 根据类型type值查询对应的部门信息
String type = departTypeBean.getType();
List<DepartEntity> byList = departDao.findDepartByList(type,departTypeBean.getIsVerif());
if (byList != null) {
for (DepartTypeEntity udAll : allList) {
for (DepartEntity udBy : byList) {
if (udAll.getId() == udBy.getId() || udAll.getId().equals(udBy.getId())) {
udAll.setCheck(true);
}
}
}
}
return allList;
}
}
......@@ -87,6 +87,7 @@ public class AirCarrierFlightListEntity extends BaseEntity {
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date latestModifyTime;
private String stc;
public Date getEta() {
return eta;
}
......@@ -242,4 +243,12 @@ public class AirCarrierFlightListEntity extends BaseEntity {
public void setLatestModifyTime(Date latestModifyTime) {
this.latestModifyTime = latestModifyTime;
}
public String getStc() {
return stc;
}
public void setStc(String stc) {
this.stc = stc;
}
}
......@@ -36,6 +36,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
/**
* app端搜索
......@@ -266,8 +267,8 @@ public class ImSearchController {
if (message == null) { // 通过参数校验
bean.setKeyWords(bean.getKeyWords().trim());
ImBigSearchEntityV2 bigSearchEntity = new ImBigSearchEntityV2();
if (StringUtils.isBlank(bean.getType()) || "USER".equals(bean.getType().toUpperCase())) {// 类型为空或者人员,查询人员相关信息
if (StringUtils.isBlank(bean.getType()) || "USER".equals(bean.getType().toUpperCase(Locale.ENGLISH))) {// 类型为空或者人员,查询人员相关信息
//人员信息
UserSeatListBean userSeatListBean = new UserSeatListBean();
userSeatListBean.setKeywords(bean.getKeyWords());
......@@ -342,7 +343,7 @@ public class ImSearchController {
bigSearchEntity.setUserList(userSeatEntityPage);
}
if (StringUtils.isBlank(bean.getType()) || "FLIGHT".equals(bean.getType().toUpperCase())) {// 航班信息
if (StringUtils.isBlank(bean.getType()) || "FLIGHT".equals(bean.getType().toUpperCase(Locale.ENGLISH))) {// 航班信息
FlightListBean flightListBean = new FlightListBean();
flightListBean.setKeywords(bean.getKeyWords());
flightListBean.setPageNo(bean.getFlightPageNo());
......
......@@ -11,23 +11,23 @@ import com.ejweb.core.base.BaseEntity;
*/
public class UcAccountEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
private String bindId; //绑定ID 用户ID或者席位ID
private String bindType = "USER"; //类型 USER 个人账号 SEAT 席位账号
private String bindStatus = "FAILD"; //绑定状态 FAILD 绑定失败 SUCCESS 绑定成功 UNBIND 已解绑
private String huaweiNum; //华为SIP号
private String huaweiId; //华为UC账号ID
private static final long serialVersionUID = 1L;
private String bindId; //绑定ID 用户ID或者席位ID
private String bindType = "USER"; //类型 USER 个人账号 SEAT 席位账号
private String bindStatus = "FAILD"; //绑定状态 FAILD 绑定失败 SUCCESS 绑定成功 UNBIND 已解绑
private String huaweiNum; //华为SIP号
private String huaweiId; //华为UC账号ID
private String huaweiPassword; //登录华为密码
private String updateBy; //最后一次者
private Date updateDate; //最后一次时间
private String syncMessage; //同步过程描述
private Date updateDate; //最后一次时间
private String syncMessage; //同步过程描述
//同步到录音系统的状态
private String recordingStatus = "FAILD";
//同步到录音系统的状态
private String recordingStatus = "FAILD";
//同步到录音系统的URL
private String recordingUrl;
//同步到录音系统的URL
private String recordingUrl;
public UcAccountEntity() {
}
......
......@@ -94,8 +94,8 @@ public class HuaweiUCSyncService {
@Transactional(readOnly = false)
public String sync(HuaweiUCSyncBean bean) {
StringBuffer sb = new StringBuffer();
List<UserProfileEntity> userProfileEntities = null;
List<SeatEntity> seatEntities = null;
List<UserProfileEntity> userProfileEntities = new ArrayList<>();
List<SeatEntity> seatEntities = new ArrayList<>();
if (bean.isAll()) {
userProfileEntities = huaweiUCSyncDao.findAllUserList(bean);
seatEntities = huaweiUCSyncDao.findAllSeatList(bean);
......@@ -957,7 +957,7 @@ public class HuaweiUCSyncService {
numberInfo.getSip().getSipAuth().setPassword(maxSipNum + "@foc2016");
//调用userProfileServiceEx服务中的addNumber方法,返回错误码
Integer res = userProfileServiceEx.addNumber(numberInfo);
System.out.println("华为添加号码返回结果为:" + res);
if (0 == res) {
return true;
} else {
......@@ -1534,11 +1534,11 @@ public class HuaweiUCSyncService {
*/
public String addAccountToUc(HuaweiUCAddAccountBean bean) {
StringBuffer sb = new StringBuffer();
List<UserProfileEntity> userProfileEntities = null;
List<SeatEntity> seatEntities = null;
List<UserProfileEntity> userProfileEntities = new ArrayList<>();
List<SeatEntity> seatEntities = new ArrayList<>();
if (bean.isAll()) {
userProfileEntities = huaweiUCSyncDao.findUserListAll(bean);
seatEntities = huaweiUCSyncDao.findAllSeatList(bean);
seatEntities = huaweiUCSyncDao.findAllSeatList(bean);
} else {
if (isNotEmptyList(bean.getUserIds())) {
userProfileEntities = huaweiUCSyncDao.findUserList(bean);
......
......@@ -18,7 +18,7 @@ public class MailEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
private String mailAddress;
private String password;
private transient String password;
public String getMailAddress() {
return mailAddress;
}
......
......@@ -11,6 +11,7 @@ import com.ejweb.core.conf.GConstants;
import com.ejweb.core.fetcher.FetchEntity;
import com.ejweb.core.fetcher.HCFetcher;
import com.ejweb.core.util.IdWorker;
import com.ejweb.core.util.Util;
import com.ejweb.modules.message.bean.ShortMsgBean;
import com.ejweb.modules.message.bean.ShortMsgListBean;
import com.ejweb.modules.message.bean.ShortMsgUserListBean;
......@@ -36,7 +37,7 @@ import java.util.List;
* @time 2016年9月23日
*/
@Service
@Transactional(readOnly = true, rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class)
public class ShortMessageService extends BaseService<ShortMessageDao> {
private final static Logger logger = Logger.getLogger(ShortMessageService.class);
......@@ -57,19 +58,34 @@ public class ShortMessageService extends BaseService<ShortMessageDao> {
}
StringBuilder builder = new StringBuilder();
String[] phones = phone.split(",|,");
boolean abroadPhone = false;
for (int i = 0, len = phones.length; i < len; i++) {
if (i > 0) {
builder.append(",");
}
builder.append(phones[i].replaceAll("^0+", ""));
//判断号码去掉开头的0之后是否是国内号码
String phone1 = phones[i].replaceAll("^0+", "");
if (Util.phoneReg(phone1)) {
builder.append(phone1);
} else {
builder.append(phones[i]);
abroadPhone = true;
}
}
phone = builder.toString();
//电话号码去除空格,否则导致发送失败
phone = builder.toString().trim();
if (StringUtils.isEmpty(phone)) {
return false;
}
String url = "";
if (abroadPhone) {
url = GConstants.JDAIR_SMS_API + "&mobile=" + phone + "&msg=" + URLEncoder.encode(bean.getMessage(), "UTF-8") + "&isInternetPhone=1";
} else {
url = GConstants.JDAIR_SMS_API + "&mobile=" + phone + "&msg=" + URLEncoder.encode(bean.getMessage(), "UTF-8");
}
logger.info("短信地址:" + url);
HCFetcher fetcher = HCFetcher.getInstance();
FetchEntity entity = fetcher.post(GConstants.JDAIR_SMS_API + "&mobile=" + phone + "&msg=" + URLEncoder.encode(bean.getMessage(), "UTF-8"), null);
FetchEntity entity = fetcher.post(url, null);
if (entity != null && entity.isSuccess()) {
String resultStr = entity.getContent("utf-8");
// 成功获取数据
......@@ -79,6 +95,7 @@ public class ShortMessageService extends BaseService<ShortMessageDao> {
String resultCode = result.getJSONObject("result").getString("resultCode");
// 判断 调用接口是否成功
if ("1000".equals(resultCode)) {
logger.info("短信发送成功:" + result.toJSONString());
SmsRecordEntity record = new SmsRecordEntity();
record.setClientip(bean.getClientip());
record.setCreateTime(new Date());
......
......@@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -33,6 +34,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@Service
public class NotifyService extends BaseService<NotifyDao> {
private final static Logger LOG = Logger.getLogger(NotifyService.class);
@Autowired
AirlineVerifyDao verifyDao;
@Autowired
......@@ -44,7 +46,6 @@ public class NotifyService extends BaseService<NotifyDao> {
*
* @author renmb
* @time 2016年8月27日
* @param bean
* @return
*/
public Integer addNotifyRecord(String notifyId, String userId, String readFlag){
......@@ -63,7 +64,7 @@ public class NotifyService extends BaseService<NotifyDao> {
PageEntity<NotifyListEntity> page = new PageEntity<NotifyListEntity>();
page.setPageNo(bean.getPageNo());
page.setPageSize(bean.getPageSize());
LOG.info("用户userCode:" + bean.getUserCode());
bean.setDepartId(departDao.getByUserCode(bean.getUserCode()).getId());
bean.setPermissionList(dao.permissionList(bean.getUserCode()));
......
......@@ -23,14 +23,15 @@ public interface UserRolesDao extends BaseDao {
List<UserRolesEntity> getRootRoles(UserRolesBean bean);
List<InformationEntity> getInformation(UserRolesBean bean);
Integer getOilRole(UserRolesBean bean);
/**
*
* @author zhanglg
* @time 2016年10月3日
* @param bean
* @return
* @author zhanglg
* @time 2016年10月3日
*/
List<UserRolesEntity> getParentRoles(UserRolesBean bean);
// 获取用户权限列表
......
......@@ -6,15 +6,15 @@ import com.ejweb.modules.role.bean.UserRolesBean;
import com.ejweb.modules.role.dao.UserRolesDao;
import com.ejweb.modules.role.entity.InformationEntity;
import com.ejweb.modules.role.entity.UserRolesEntity;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author yuxg
* @author yuxg
* @version 1.0
* @time 2016-09-02
*/
......@@ -25,48 +25,60 @@ public class UserRolesService extends BaseService<UserRolesDao> {
return dao.getUserRoles(bean);
}
public List<UserRolesEntity> getRootRoles(UserRolesBean bean) {
return dao.getRootRoles( bean);
return dao.getRootRoles(bean);
}
public List<UserRolesEntity> getUserPermissionList(String userCode) {
UserRolesBean bean = new UserRolesBean();
bean.setUserCode(userCode);
return dao.getUserPermissionList( bean);
return dao.getUserPermissionList(bean);
}
public List<InformationEntity> getInformation(UserRolesBean bean){
return dao.getInformation( bean);
public List<InformationEntity> getInformation(UserRolesBean bean) {
return dao.getInformation(bean);
}
public List<JSONObject> getList(String userCode,String p){
UserRolesBean bean=new UserRolesBean();
List<JSONObject> jsonlist=new ArrayList<JSONObject>();
public boolean getOilRole(UserRolesBean bean) {
Integer roleCount = dao.getOilRole(bean);
if (Objects.nonNull(roleCount) && roleCount != 0) {
return true;
}
return false;
}
public List<JSONObject> getList(String userCode, String p) {
UserRolesBean bean = new UserRolesBean();
List<JSONObject> jsonlist = new ArrayList<JSONObject>();
bean.setUserCode(userCode);
if(StringUtils.isNoneBlank(p)){
if (StringUtils.isNoneBlank(p)) {
bean.setPermission(p);
}
List<UserRolesEntity> list1= getParentRoles(bean);
for(UserRolesEntity entity1 :list1 ){
JSONObject json=new JSONObject();
json.put("name", entity1.getMenuName());
json.put("permission", entity1.getPermission());
getChildList(bean,json,entity1.getId());
jsonlist.add(json);
}
return jsonlist;
List<UserRolesEntity> list1 = getParentRoles(bean);
for (UserRolesEntity entity1 : list1) {
JSONObject json = new JSONObject();
json.put("name", entity1.getMenuName());
json.put("permission", entity1.getPermission());
getChildList(bean, json, entity1.getId());
jsonlist.add(json);
}
private JSONObject getChildList(UserRolesBean bean,JSONObject data,String id){
return jsonlist;
}
private JSONObject getChildList(UserRolesBean bean, JSONObject data, String id) {
bean.setId(id);
List<UserRolesEntity> list1= getUserRoles(bean);
if(list1.size()!=0){
List<JSONObject> jsonlist1=new ArrayList<JSONObject>();
for(UserRolesEntity entity1 :list1 ){
JSONObject json=new JSONObject();
List<UserRolesEntity> list1 = getUserRoles(bean);
if (list1.size() != 0) {
List<JSONObject> jsonlist1 = new ArrayList<JSONObject>();
for (UserRolesEntity entity1 : list1) {
JSONObject json = new JSONObject();
json.put("name", entity1.getMenuName());
json.put("permission", entity1.getPermission());
getChildList(bean,json,entity1.getId());
getChildList(bean, json, entity1.getId());
jsonlist1.add(json);
}
data.put("children", jsonlist1);
......@@ -75,13 +87,12 @@ public class UserRolesService extends BaseService<UserRolesDao> {
}
/**
*
* @author zhanglg
* @time 2016年10月3日
* @param bean
* @return
* @author zhanglg
* @time 2016年10月3日
*/
public List<UserRolesEntity> getParentRoles(UserRolesBean bean) {
// TODO Auto-generated method stub
return dao.getParentRoles(bean);
......
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