Commit 8019337f by java-李谡

Merge branch 'develop' into 'master'

Develop

See merge request java-jdair-foc/foc-api-2.0!5
parents 65fdc2bd a206bc65
......@@ -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
......
......@@ -3,9 +3,9 @@ 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
jdbc.url=jdbc:mysql://106.75.105.96: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
......
......@@ -64,13 +64,13 @@
)
</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="aircraftType != null and aircraftType != ''">
AND a.aircraft_type = #{aircraftType}
......@@ -93,4 +93,70 @@
ORDER BY ata_chn DESC
LIMIT 1
</select>
<select id="getStatisticalArrIataList" resultType="com.ejweb.modules.airport.entity.StatisticalEntity">
SELECT a.verif_no as verifNo,
a.id as verifId,
CASE WHEN a.verif_type='01' OR a.verif_type='02'
OR a.verif_type='03' OR a.verif_type='04' OR a.verif_type='05'
THEN b.flight_no
ELSE a.flight_no
END flightNo,
a.route_no AS routeNo,
a.aircraft_type,
TIMESTAMPDIFF(DAY,a.start_time,CURRENT_TIMESTAMP) AS expiryDate,
roundtrip_type,
IFNULL(b.depIata,a.depIata) AS depIata,
b.arrIata,
DATE_FORMAT(a.start_time, '%Y-%m-%d') AS startTime,
CASE WHEN a.verif_type='01' OR a.verif_type='02'
OR a.verif_type='03' OR a.verif_type='04' OR a.verif_type='05'
THEN p.city_name
ELSE tt.airport_name
END depIataName,
a.verif_type as verifType,
r.city_name AS arrIataName,
a.verifued_count AS verifuedCount,
a.depart_id as departId,
d.file_path as filePath,
c.type_name as typeName,
a.state
from foc_airline_verify a
left JOIN foc_airline_connect b on a.id = b.verif_id AND b.Is_main!='0'
LEFT JOIN foc_aircraft_type c on a.aircraft_type = c.id
LEFT JOIN foc_sailing_file d on a.id = d.verif_id
LEFT JOIN foc_airports p ON p.airport_iata = b.depIata
LEFT JOIN foc_sailing_command cc ON a.id = cc.verif_id
LEFT JOIN foc_airports r ON r.airport_iata = b.arrIata
LEFT JOIN foc_airports tt ON tt.airport_iata = a.depIata
where a.verif_status='02' AND a.del_flag = #{DEL_FLAG_NORMAL}
<if test="routeNo != null and routeNo != ''">
AND a.route_no LIKE
<if test="dbName == 'oracle'">'%'||#{routeNo}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{routeNo}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{routeNo}, '%')</if>
</if>
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE
<if test="dbName == 'oracle'">'%'||#{verifNo}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{verifNo}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{verifNo}, '%')</if>
</if>
<if test="verifType != null and verifType != ''">
AND a.verif_type = #{verifType}
</if>
AND (a.id in (
SELECT id FROM foc_airline_verify where depIata =#{depIata} AND arrIata= #{arrIata} ) OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata =#{depIata} and arrIata =#{arrIata} AND is_main != '0')
)
<if test="aircraftType != null and aircraftType != ''">
AND a.aircraft_type = #{aircraftType}
</if>
GROUP BY verifNo,routeNo,arrIata,depIata
</select>
</mapper>
\ No newline at end of file
......@@ -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
......@@ -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 (
......
......@@ -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
......@@ -25,85 +25,85 @@
<!-- 获取所有的论证条件评估审核列表 -->
<select id="findList" resultType="com.ejweb.modules.verify.entity.VerifyManageEntity">
SELECT
CASE WHEN a.verif_status='00' AND s.verified_status='00' THEN '00'
WHEN a.verif_status='01' OR s.verified_status='03' THEN '02'
WHEN a.verif_status='03' THEN '03'
WHEN a.verif_status='00' AND (s.status = '1') THEN '01'
ELSE '05'
END manageStatus,
a.id AS verifId,
s.id AS conditionId,
q.type_name AS aircraftName,
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 p.airport_name
END depName,
r.city_name AS arrName,
<include refid="VerifyManageColumns"/>
FROM
foc_airline_verify a
CASE WHEN a.verif_status='00' AND s.verified_status='00' THEN '00'
WHEN a.verif_status='01' OR s.verified_status='03' THEN '02'
WHEN a.verif_status='03' THEN '03'
WHEN a.verif_status='00' AND (s.status = '1') THEN '01'
ELSE '05'
END manageStatus,
a.id AS verifId,
s.id AS conditionId,
q.type_name AS aircraftName,
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 p.airport_name
END depName,
r.city_name AS arrName,
<include refid="VerifyManageColumns"/>
FROM
foc_airline_verify a
LEFT JOIN foc_airline_verified s ON a.id=s.verif_id
LEFT JOIN foc_airports p ON p.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 a.verif_status!='02'
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE CONCAT('%', #{verifNo}, '%')
</if>
<if test="verifStatus != null and verifStatus != ''">
AND a.verif_status = #{verifStatus}
</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="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="priority != null and priority != ''">
AND a.priority = #{priority}
</if>
<if test="verifType != null and verifType != ''">
AND a.verif_type = #{verifType}
</if>
<if test="aircraftType != null and aircraftType != ''">
AND a.aircraft_type = #{aircraftType}
</if>
<choose>
WHERE
a.del_flag = #{DEL_FLAG_NORMAL}
AND a.verif_status!='02'
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE CONCAT('%', #{verifNo}, '%')
</if>
<if test="verifStatus != null and verifStatus != ''">
AND a.verif_status = #{verifStatus}
</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="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="priority != null and priority != ''">
AND a.priority = #{priority}
</if>
<if test="verifType != null and verifType != ''">
AND a.verif_type = #{verifType}
</if>
<if test="aircraftType != null and aircraftType != ''">
AND a.aircraft_type = #{aircraftType}
</if>
<choose>
<when test="manageStatus=='00'">
AND a.verif_status = '00'
AND s.verified_status = '00'
AND a.verif_status = '00'
AND s.verified_status = '00'
</when>
<when test="manageStatus=='01'">
AND a.verif_status = '00'
AND s.status = '1'
AND a.verif_status = '00'
AND s.status = '1'
</when>
<when test="manageStatus=='02'">
AND s.verified_status = '03'
AND s.verified_status = '03'
</when>
<when test="manageStatus=='03'">
AND a.verif_status = '03'
<when test="manageStatus=='03'">
AND a.verif_status = '03'
</when>
<when test="manageStatus=='' or manageStatus==null">
AND a.verif_status != '02'
<when test="manageStatus=='' or manageStatus==null">
AND a.verif_status != '02'
</when>
</choose>
AND a.depart_id = (SELECT depart_id FROM sys_user_profiles WHERE user_id = #{userCode})
</choose>
AND a.depart_id = (SELECT depart_id FROM sys_user_profiles WHERE user_id = #{userCode})
</select>
<select id="detail" resultType="com.ejweb.modules.verify.entity.VerifyManageDetailEntity">
SELECT
SELECT
a.id ,
a.limit_condition AS limitCondition,
a.people_count AS peopleCount,
......@@ -121,142 +121,142 @@
a.cargo_demand AS cargoDemand,
a.other_reason AS otherReason,
a.route_connection AS routeConnection,
<include refid="VerifyManageColumns"/>
FROM foc_airline_verify a
<include refid="VerifyManageColumns"/>
FROM foc_airline_verify a
WHERE id = #{id}
</select>
<insert id="insert" parameterType="java.util.List">
<insert id="insert" parameterType="java.util.List">
INSERT INTO foc_verify_change (
id,
edit_from,
edit_to,
file_from,
file_to,
field_value,
field_name,
update_by,
verif_id,
update_date,
del_flag
)
VALUES
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.id},
#{item.editFrom},
#{item.editTo},
#{item.fileFrom},
#{item.fileTo},
#{item.fieldValue},
#{item.fieldName},
#{item.updateBy},
#{item.verifId},
#{item.updateDate},
#{item.delFlag}
)
</foreach>
</insert>
<select id="findAllList" resultType="com.ejweb.modules.verify.entity.VerifyManageEntity">
INSERT INTO foc_verify_change (
id,
edit_from,
edit_to,
file_from,
file_to,
field_value,
field_name,
update_by,
verif_id,
update_date,
del_flag
)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.id},
#{item.editFrom},
#{item.editTo},
#{item.fileFrom},
#{item.fileTo},
#{item.fieldValue},
#{item.fieldName},
#{item.updateBy},
#{item.verifId},
#{item.updateDate},
#{item.delFlag}
)
</foreach>
</insert>
<select id="findAllList" resultType="com.ejweb.modules.verify.entity.VerifyManageEntity">
SELECT
a.priority AS priority,
a.apply_no AS applyNo,
a.verif_no AS verifNo,
a.flight_no AS flightNo,
q.type_name AS aircraftType,
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 p.airport_name
END depIata,
r.city_name AS arrIata,
a.verif_status AS verifStatus,
a.verif_type AS verifType,
DATE(a.sailing_date) AS sailingDate,
DATE(a.create_date) AS createDate
FROM
foc_airline_verify a
LEFT JOIN foc_airline_verified s ON a.id=s.verif_id
a.priority AS priority,
a.apply_no AS applyNo,
a.verif_no AS verifNo,
a.flight_no AS flightNo,
q.type_name AS aircraftType,
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 p.airport_name
END depIata,
r.city_name AS arrIata,
a.verif_status AS verifStatus,
a.verif_type AS verifType,
DATE(a.sailing_date) AS sailingDate,
DATE(a.create_date) AS createDate
FROM
foc_airline_verify a
LEFT JOIN foc_airline_verified s ON a.id=s.verif_id
LEFT JOIN foc_airports p ON p.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 a.verif_status!='02'
<if test="verifNo != null and verifNo != ''">
AND a.verif_no = #{verifNo}
</if>
<if test="arrIata != null and arrIata != ''">
AND a.arrIata LIKE
<if test="dbName == 'oracle'">'%'||#{arrIata}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{arrIata}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{arrIata}, '%')</if>
</if>
<if test="depIata != null and depIata != ''">
AND a.depIata LIKE
<if test="dbName == 'oracle'">'%'||#{depIata}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{depIata}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{depIata}, '%')</if>
</if>
<if test="priority != null and priority != ''">
AND a.priority = #{priority}
</if>
<if test="verifType != null and verifType != ''">
AND a.verif_type = #{verifType}
</if>
<choose>
WHERE
a.del_flag = #{DEL_FLAG_NORMAL}
AND a.verif_status!='02'
<if test="verifNo != null and verifNo != ''">
AND a.verif_no = #{verifNo}
</if>
<if test="arrIata != null and arrIata != ''">
AND a.arrIata LIKE
<if test="dbName == 'oracle'">'%'||#{arrIata}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{arrIata}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{arrIata}, '%')</if>
</if>
<if test="depIata != null and depIata != ''">
AND a.depIata LIKE
<if test="dbName == 'oracle'">'%'||#{depIata}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{depIata}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{depIata}, '%')</if>
</if>
<if test="priority != null and priority != ''">
AND a.priority = #{priority}
</if>
<if test="verifType != null and verifType != ''">
AND a.verif_type = #{verifType}
</if>
<choose>
<when test="manageStatus='00'">
AND a.verif_status = '00'
AND s.verified_status = '00'
AND a.verif_status = '00'
AND s.verified_status = '00'
</when>
<when test="manageStatus='01'">
AND a.verif_status = '00'
AND s.verified_status = '02'
AND a.verif_status = '00'
AND s.verified_status = '02'
</when>
<when test="manageStatus='02'">
AND s.verified_status = '03'
AND s.verified_status = '03'
</when>
<when test="manageStatus='03'">
AND s.verif_status = '03'
</when>
<when test="manageStatus='' or manageStatus=null">
AND s.verif_status != '02'
</when>
</choose>
AND a.depart_id = (SELECT depart_id FROM sys_user_profiles WHERE user_id = #{userCode})
<choose>
<when test="sort == 1">
ORDER BY apply_no ASC,priority DESC
</when>
<when test="sort == 2">
ORDER BY apply_no ASC,priority ASC
</when>
<when test="sort == 3">
ORDER BY apply_no DESC,priority DESC
</when>
<when test="manageStatus='03'">
AND s.verif_status = '03'
<when test="sort == 4">
ORDER BY apply_no DESC,priority ASC
</when>
<when test="manageStatus='' or manageStatus=null">
AND s.verif_status != '02'
<when test="sort == 5">
ORDER BY priority ASC,apply_no DESC
</when>
</choose>
AND a.depart_id = (SELECT depart_id FROM sys_user_profiles WHERE user_id = #{userCode})
<choose>
<when test="sort == 1">
ORDER BY apply_no ASC,priority DESC
</when>
<when test="sort == 2">
ORDER BY apply_no ASC,priority ASC
</when>
<when test="sort == 3">
ORDER BY apply_no DESC,priority DESC
</when>
<when test="sort == 4">
ORDER BY apply_no DESC,priority ASC
</when>
<when test="sort == 5">
ORDER BY priority ASC,apply_no DESC
</when>
<when test="sort == 6">
ORDER BY priority ASC,apply_no ASC
</when>
<when test="sort == 7">
ORDER BY priority DESC,apply_no DESC
</when>
<when test="sort == 8">
ORDER BY priority DESC,apply_no ASC
</when>
<otherwise>
ORDER BY apply_no DESC
</otherwise>
</choose>
<when test="sort == 6">
ORDER BY priority ASC,apply_no ASC
</when>
<when test="sort == 7">
ORDER BY priority DESC,apply_no DESC
</when>
<when test="sort == 8">
ORDER BY priority DESC,apply_no ASC
</when>
<otherwise>
ORDER BY apply_no DESC
</otherwise>
</choose>
</select>
<select id="getConnectList" resultType="Map">
<select id="getConnectList" resultType="Map">
SELECT
flight_no AS flightNo,
depIata,
......@@ -270,218 +270,219 @@
AND Is_main = '2'
</select>
<delete id="delete_change_extend">
DELETE FROM foc_change_extend
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_verify_record">
DELETE FROM foc_verify_record
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_production_feedback">
DELETE FROM foc_production_feedback
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_production_command">
DELETE FROM foc_production_command
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_sailing_file">
DELETE FROM foc_sailing_file
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_sailing_command">
DELETE FROM foc_sailing_command
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_sailingcc_file">
DELETE FROM foc_sailingcc_file
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_sailing_conclusion">
DELETE FROM foc_sailing_conclusion
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_conclusion_file">
DELETE FROM foc_conclusion_file
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_airline_conclusion">
DELETE FROM foc_airline_conclusion
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_condition_feedback">
DELETE FROM foc_condition_feedback
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_verify_condition">
DELETE FROM foc_verify_condition
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="update_risk_assessment">
UPDATE foc_risk_assessment
SET remarks='',
assessment_status='00'
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_verify_file">
DELETE FROM foc_verify_file
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_airline_connect">
DELETE FROM foc_airline_connect
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_airline_verify2type">
DELETE FROM foc_airline_verify2type
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_airline_verified">
DELETE FROM foc_airline_verified
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<update id="update_verify_file">
UPDATE foc_verify_file
SET del_flag =#{delFlagTo}
WHERE verif_id=#{verifId}
<if test="delFlagFrom != null and delFlagFrom != ''">
AND del_flag=#{delFlagFrom}
</if>
</update>
<update id="update_airline_connect">
UPDATE foc_airline_connect
SET del_flag =#{delFlagTo}
WHERE verif_id=#{verifId}
<if test="delFlagFrom != null and delFlagFrom != ''">
AND del_flag=#{delFlagFrom}
</if>
</update>
<update id="update_airline_verify2type">
UPDATE foc_airline_verify2type
SET del_flag =#{delFlagTo}
WHERE verif_id=#{verifId}
<if test="delFlagFrom != null and delFlagFrom != ''">
AND del_flag=#{delFlagFrom}
</if>
</update>
<insert id="insertAirTypes">
INSERT INTO foc_airline_verify2type(
id,
verif_id,
type_id,
create_by,
create_date,
del_flag
)VALUES
<foreach collection="airTypes" item="item" index="index" separator="," >
(#{item.id}, #{id},#{item.typeId}, #{userCode}, CURRENT_TIMESTAMP, #{delFlag})
</foreach>
</insert>
<insert id="insertFiles">
INSERT INTO foc_verify_file(
id,
verif_id,
file_path,
file_name,
file_size,
file_type,
create_by,
create_date,
del_flag
) values
<foreach collection="verifyFile" item="item" index="index" separator="," >
(#{item.id}, #{id},#{item.filePath},#{item.fileName},#{item.fileSize}, '01', #{id}, CURRENT_TIMESTAMP, #{delFlag})
</foreach>
<delete id="delete_change_extend">
DELETE FROM foc_change_extend
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_verify_record">
DELETE FROM foc_verify_record
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_production_feedback">
DELETE FROM foc_production_feedback
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_production_command">
DELETE FROM foc_production_command
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_sailing_file">
DELETE FROM foc_sailing_file
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_sailing_command">
DELETE FROM foc_sailing_command
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_sailingcc_file">
DELETE FROM foc_sailingcc_file
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_sailing_conclusion">
DELETE FROM foc_sailing_conclusion
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_conclusion_file">
DELETE FROM foc_conclusion_file
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_airline_conclusion">
DELETE FROM foc_airline_conclusion
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_condition_feedback">
DELETE FROM foc_condition_feedback
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_verify_condition">
DELETE FROM foc_verify_condition
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="update_risk_assessment">
UPDATE foc_risk_assessment
SET remarks='',
assessment_status='00'
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_verify_file">
DELETE FROM foc_verify_file
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_airline_connect">
DELETE FROM foc_airline_connect
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_airline_verify2type">
DELETE FROM foc_airline_verify2type
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<delete id="delete_airline_verified">
DELETE FROM foc_airline_verified
WHERE verif_id=#{verifId}
<if test="delFlag!= null and delFlag != ''">
AND del_flag=#{delFlag}
</if>
</delete>
<update id="update_verify_file">
UPDATE foc_verify_file
SET del_flag =#{delFlagTo}
WHERE verif_id=#{verifId}
<if test="delFlagFrom != null and delFlagFrom != ''">
AND del_flag=#{delFlagFrom}
</if>
</update>
<update id="update_airline_connect">
UPDATE foc_airline_connect
SET del_flag =#{delFlagTo}
WHERE verif_id=#{verifId}
<if test="delFlagFrom != null and delFlagFrom != ''">
AND del_flag=#{delFlagFrom}
</if>
</update>
<update id="update_airline_verify2type">
UPDATE foc_airline_verify2type
SET del_flag =#{delFlagTo}
WHERE verif_id=#{verifId}
<if test="delFlagFrom != null and delFlagFrom != ''">
AND del_flag=#{delFlagFrom}
</if>
</update>
<insert id="insertAirTypes">
INSERT INTO foc_airline_verify2type(
id,
verif_id,
type_id,
create_by,
create_date,
del_flag
)VALUES
<foreach collection="airTypes" item="item" index="index" separator=",">
(#{item.id}, #{id},#{item.typeId}, #{userCode}, CURRENT_TIMESTAMP, #{delFlag})
</foreach>
</insert>
<insert id="insertFiles">
INSERT INTO foc_verify_file(
id,
verif_id,
file_path,
file_name,
file_size,
file_type,
create_by,
create_date,
del_flag
) values
<foreach collection="verifyFile" item="item" index="index" separator=",">
(#{item.id}, #{id},#{item.filePath},#{item.fileName},#{item.fileSize}, '01', #{id}, CURRENT_TIMESTAMP,
#{delFlag})
</foreach>
</insert>
<insert id="insertConnects">
INSERT INTO foc_airline_connect(
id,
verif_id,
flight_no,
depIata,
arrIata,
del_flag,
Is_main
) values
<foreach collection="connect" item="item" index="index" separator="," >
(#{item.id}, #{id},#{item.flightNo}, #{item.depIata}, #{item.arrIata}, #{delFlag}, #{item.IsMain})
</foreach>
<insert id="insertConnects">
INSERT INTO foc_airline_connect(
id,
verif_id,
flight_no,
depIata,
arrIata,
del_flag,
Is_main
) values
<foreach collection="connect" item="item" index="index" separator=",">
(#{item.id}, #{id},#{item.flightNo}, #{item.depIata}, #{item.arrIata}, #{delFlag}, #{item.IsMain})
</foreach>
</insert>
<update id="updateDelFlag">
<update id="updateDelFlag">
UPDATE foc_airline_verify
SET del_flag='1'
WHERE id=#{verifId}
</update>
<delete id="deleteProcess">
<delete id="deleteProcess">
DELETE FROM foc_verify_process
WHERE verif_id=#{verifId} AND node_sort <![CDATA[>]]> #{nodeSort}
</delete>
<delete id="deleteProcessByNodeSort">
<delete id="deleteProcessByNodeSort">
DELETE FROM foc_verify_process
WHERE verif_id=#{verifId} AND node_sort = #{nodeSort}
</delete>
<update id="updateVerifed">
<update id="updateVerifed">
UPDATE foc_airline_verified
SET material=#{material},
start_time=#{startTime},
......@@ -490,7 +491,7 @@
update_by=#{userCode}
WHERE verif_id=#{verifId}
</update>
<delete id="deleteRiskFile">
<delete id="deleteRiskFile">
DELETE FROM foc_risk_file
WHERE risk_id in (SELECT id FROM foc_risk_assessment WHERE verif_id=#{verifId})
</delete>
......@@ -507,77 +508,211 @@
WHERE verif_id=#{id} AND record_status='00' AND record_type='01'
</update>
<select id="getTypeName" resultType="String">
SELECT GROUP_CONCAT(type_name) FROM foc_aircraft_type WHERE id in
<foreach collection="list" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
SELECT GROUP_CONCAT(type_name) FROM foc_aircraft_type WHERE id in
<foreach collection="list" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</select>
<select id="getConnectName" resultType="String">
SELECT city_name FROM foc_airports WHERE airport_iata= #{Iata}
</select>
<delete id="deleteRouteFile">
<delete id="deleteRouteFile">
DELETE FROM foc_route_file
WHERE route_id in (SELECT id FROM foc_route_verify WHERE verif_id=#{verifId})
</delete>
<select id="getCount" resultType="com.ejweb.modules.verify.entity.VerifyCountEntity">
SELECT
(SELECT COUNT(1) FROM foc_airline_verified aa LEFT JOIN foc_airline_verify ab ON aa.verif_id=ab.id WHERE ab.del_flag='0' AND (aa.status is null or aa.status='0') AND ab.verif_status='00' ) menu2 ,
(SELECT COUNT(1) FROM foc_risk_assessment ba
LEFT JOIN foc_airline_verify bv ON ba.verif_id = bv.id WHERE bv.verif_status = '00' and bv.del_flag!= '1' AND ba.assessment_status='00' AND ba.del_flag!= '1' AND ba.depart_id=(SELECT depart_id FROM sys_user_profiles WHERE user_id=#{userCode})) menu5 ,
(SELECT COUNT(1) FROM foc_airline_verify fav
LEFT JOIN foc_route_verify frv ON fav.id = frv.verif_id
LEFT JOIN foc_airline_conclusion s ON fav.id = s.verif_id
WHERE fav.verif_status='00' AND s.conclusion_status is null AND( frv.status!='1' or frv.verify_status in('00','02','03') ) AND frv.depart_id=(SELECT depart_id FROM sys_user_profiles WHERE user_id=#{userCode})) menu3 ,
(
SELECT COUNT(1) from (select a.id
FROM
foc_airline_verify a
LEFT JOIN foc_verify_condition s ON a.id=s.verif_id
WHERE
a.del_flag = '0' and a.verif_status='00'
AND (s.is_feed='1' OR s.is_feed='2') AND s.complete='0'
AND s.depart_id = (SELECT depart_id FROM sys_user_profiles WHERE user_id = #{userCode})
UNION All
select a.id
FROM
foc_airline_verify a
LEFT JOIN foc_verify_condition t ON a.id=t.verif_id
LEFT JOIN foc_condition_feedback s ON t.id=s.condition_id
WHERE
a.del_flag = '0' and a.verif_status='00'
AND t.complete='0'
AND s.feedback_status='00'
AND t.depart_id!=s.depart_id
AND s.depart_id = (SELECT depart_id FROM sys_user_profiles WHERE user_id = #{userCode})) temp
) menu4,
<select id="getCount" resultType="com.ejweb.modules.verify.entity.VerifyCountEntity">
SELECT
(
SELECT
COUNT( 1 )
FROM
foc_airline_verified a
LEFT JOIN foc_airline_verify b ON a.verif_id = b.id
LEFT JOIN sys_user_profiles u ON u.depart_id = a.depart_id
LEFT JOIN foc_aircraft_type t ON b.aircraft_type = t.id
LEFT JOIN foc_airports d ON d.airport_iata = b.depIata
LEFT JOIN foc_airports r ON r.airport_iata = b.arrIata
WHERE
a.del_flag = '0'
AND b.verif_status = '00'
AND ( a.STATUS IS NULL OR a.STATUS = '0' )
AND u.user_id = #{userCode}
and ISNULL(b.verif_no)
) menu2,
(
SELECT
COUNT( 1 )
FROM
foc_risk_assessment ba
LEFT JOIN foc_airline_verify bv ON ba.verif_id = bv.id
WHERE
bv.verif_status = '00'
AND bv.del_flag != '1'
AND ba.assessment_status = '00'
AND ba.del_flag != '1'
AND ba.depart_id = (
SELECT
depart_id
FROM
sys_user_profiles
WHERE
user_id = #{userCode})) menu5 ,
(
SELECT
COUNT(1)
FROM (SELECT
fav.id
FROM foc_airline_verify fav
LEFT JOIN foc_route_verify frv ON fav.id = frv.verif_id
LEFT JOIN foc_airline_conclusion s ON fav.id = s.verif_id
LEFT JOIN foc_aircraft_type fat ON fav.aircraft_type = fat.id
LEFT JOIN foc_airports p ON p.airport_iata = fav.depIata
LEFT JOIN foc_airports r ON r.airport_iata = fav.arrIata
LEFT JOIN foc_verify_process pro ON pro.verif_id = fav.id
WHERE fav.verif_status='00' AND s.conclusion_status is null
and frv.verify_status ='00'
AND frv.depart_id in (
select depart_id from sys_user_profiles
where user_id =#{userCode})
AND pro.node_name='截止反馈时间'
GROUP BY fav.id) a
) menu3 ,
(
SELECT
COUNT( 1 )
FROM
(
SELECT
a.id
FROM
foc_airline_verify a
LEFT JOIN foc_verify_condition s ON a.id = s.verif_id
WHERE
a.del_flag = '0'
AND a.verif_status = '00'
AND ( s.is_feed = '1' OR s.is_feed = '2' )
AND s.complete = '0'
AND s.depart_id = (
SELECT
depart_id
FROM
sys_user_profiles
WHERE
user_id = #{userCode})
UNION ALL
SELECT
a.id
FROM
foc_airline_verify a
LEFT JOIN foc_verify_condition t ON a.id = t.verif_id
LEFT JOIN foc_condition_feedback s ON t.id = s.condition_id
WHERE
a.del_flag = '0'
AND a.verif_status = '00'
AND t.complete = '0'
AND s.feedback_status = '00'
AND t.depart_id != s.depart_id
AND s.depart_id = ( SELECT depart_id FROM sys_user_profiles WHERE user_id = #{userCode})) temp
) menu4,
(
SELECT
COUNT( 1 )
FROM
foc_airline_conclusion c
LEFT JOIN foc_airline_verify a ON a.id = c.verif_id
WHERE
a.del_flag = '0'
AND ( c.STATUS IS NULL OR c.STATUS = '0' )
AND a.verif_status = '00'
) menu6,
(
SELECT
COUNT( 1 )
FROM
foc_sailing_conclusion s
LEFT JOIN foc_airline_verify t ON s.verif_id = t.id
WHERE
t.del_flag = '0'
AND conclusion_status = '00'
AND t.verif_status = '00'
) menu7,
(
SELECT
COUNT( 1 )
FROM
foc_sailing_command s
LEFT JOIN foc_airline_verify t ON s.verif_id = t.id
WHERE
t.del_flag = '0'
AND s.command_status = '00'
AND t.verif_status = '00'
) menu8,
(
SELECT
COUNT( 1 )
FROM
foc_airline_verify a
LEFT JOIN foc_verify_condition s ON a.id = s.verif_id
LEFT JOIN foc_airports p ON p.airport_iata = a.depIata
LEFT JOIN foc_aircraft_type q ON q.id = a.aircraft_type
WHERE
a.del_flag = '0'
AND s.complete = '0'
AND is_feed = '0'
AND a.verif_status = '00'
) menu9,
(
SELECT
count( 1 )
FROM
foc_airline_verify a
INNER JOIN foc_verify_record r ON a.id = r.verif_id
AND r.del_flag = '0'
WHERE
a.verif_status = '00'
AND record_status = '00'
AND record_type = '01'
AND a.del_flag = '0'
) menu10,
(
SELECT
COUNT( 1 )
FROM
foc_production_feedback ss
LEFT JOIN foc_production_command st ON ss.production_id = st.id
WHERE
ss.del_flag = '0'
AND st.command_status = '00'
AND depart_id = (
SELECT
depart_id
FROM
sys_user_profiles
WHERE
user_id = #{userCode}) ) menu13,
(
SELECT
COUNT( 1 )
FROM
foc_worksheet_feedback ts
LEFT JOIN foc_worksheet_command tt ON ts.command_id = tt.id
WHERE
tt.del_flag = '0'
AND command_status = '00'
AND depart_id = (
SELECT
depart_id
FROM
sys_user_profiles
WHERE
user_id = #{userCode}) ) menu14
(SELECT COUNT(1) FROM foc_airline_conclusion c
LEFT JOIN foc_airline_verify a ON a.id = c.verif_id
WHERE a.del_flag='0' AND (c.status is null or c.status = '0')
AND a.verif_status='00'
) menu6,
(SELECT COUNT(1) FROM foc_sailing_conclusion s LEFT JOIN foc_airline_verify t ON s.verif_id=t.id WHERE t.del_flag='0' AND conclusion_status='00' and t.verif_status='00' ) menu7 ,
(SELECT COUNT(1) FROM foc_sailing_command s LEFT JOIN foc_airline_verify t ON s.verif_id=t.id WHERE t.del_flag='0' AND s.command_status='00' and t.verif_status='00' ) menu8,
(SELECT COUNT(1) FROM
foc_airline_verify a
LEFT JOIN foc_verify_condition s ON a.id=s.verif_id
LEFT JOIN foc_airports p ON p.airport_iata = a.depIata
LEFT JOIN foc_aircraft_type q ON q.id = a.aircraft_type WHERE a.del_flag ='0'
AND s.complete='0'
AND is_feed='0'
AND a.verif_status = '00' ) menu9,
(SELECT count(1) FROM foc_airline_verify a
INNER JOIN foc_verify_record r ON a.id=r.verif_id AND r.del_flag='0' WHERE a.verif_status='00' and record_status='00' AND record_type='01' and a.del_flag='0') menu10,
(SELECT COUNT(1) FROM foc_production_feedback ss LEFT JOIN foc_production_command st ON ss.production_id=st.id WHERE ss.del_flag='0' AND st.command_status='00' AND depart_id=(SELECT depart_id FROM sys_user_profiles WHERE user_id=#{userCode}) ) menu13,
(SELECT COUNT(1) FROM foc_worksheet_feedback ts LEFT JOIN foc_worksheet_command tt ON ts.command_id=tt.id WHERE tt.del_flag='0' AND command_status='00' AND depart_id=(SELECT depart_id FROM sys_user_profiles WHERE user_id=#{userCode}) ) menu14
FROM DUAL
FROM
DUAL
</select>
<update id="updateByPrimaryKey" >
<update id="updateByPrimaryKey">
update foc_airline_verify
set
roundtrip_type = #{roundtripType,jdbcType=VARCHAR},
......@@ -609,5 +744,5 @@ FROM DUAL
where id = #{id,jdbcType=VARCHAR}
</update>
</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.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.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);
}
}
......@@ -79,6 +79,7 @@ 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("fc76fa2b2e10b3d4450d564314a97766", CONF_DESC_KEY));
System.out.println(DES3Utils.decrypt("31a63fac8317458d81c034906825749f7c58c30a773c6927", 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 com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ejweb.core.conf.GConstants;
import com.ejweb.core.security.GlobalUtil;
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.*;
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){
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();
......@@ -78,14 +69,14 @@ public class HttpClientUtil {
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");
......
package com.ejweb.core.filter;
import com.alibaba.fastjson.JSON;
import com.ejweb.core.base.BaseBean;
import com.ejweb.core.base.BaseUserBean;
import com.ejweb.core.conf.GConstants;
import com.ejweb.core.security.GlobalUtil;
import com.ejweb.modules.user.entity.User;
import com.ejweb.modules.user.entity.UserEntity;
import com.ejweb.modules.user.service.UserService;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
......@@ -18,7 +22,6 @@ import java.util.Set;
* 对请求接口进行基本信息验证类 excludedPages * .* .+ 三种均为不验证数据
*/
public class BasicVerifyFilter implements Filter {
private String excludedPages;// 例外列表,支持正则匹配,多个地址以分号“;”分隔
private String[] excludedPageArray;// 例外列表
private boolean isExcludedPage = false;// 是否有例外请求链接
......@@ -36,20 +39,19 @@ public class BasicVerifyFilter implements Filter {
throws IOException, ServletException {
// 由于tomcat漏洞,在不升级的情况下,过滤PUT请求,直接返回
if ("PUT".equals(((HttpServletRequest)request).getMethod())) {
request.getRequestDispatcher("/WEB-INF/views/errors/401.jsp").forward(request, response);// 跳转到验证错误页面
if ("PUT".equals(((HttpServletRequest) request).getMethod())) {
// 跳转到验证错误页面
request.getRequestDispatcher("/WEB-INF/views/errors/401.jsp").forward(request, response);
return;
}
long maxFileSize = Long.valueOf(GConstants.getValue("file.max.upload.size"));
// HttpServletRequest reqs = (HttpServletRequest)request;
long fileSize = ((HttpServletRequest) request).getContentLength();
long fileSize = request.getContentLength();
if (fileSize > maxFileSize) {
request.setAttribute("message", "文件大小超出限制");
request.getRequestDispatcher("/WEB-INF/views/errors/401.jsp").forward(request, response);// 跳转到验证错误页面
// response.getOutputStream().print("file");
// 跳转到验证错误页面
request.getRequestDispatcher("/WEB-INF/views/errors/401.jsp").forward(request, response);
return;
}
......@@ -58,48 +60,43 @@ public class BasicVerifyFilter implements Filter {
rep.setHeader("Access-Control-Allow-Origin", "*");
}
boolean isMultipart = ServletFileUpload.isMultipartContent((HttpServletRequest) request);
if (isMultipart == false) { // 判断enctype属性是否为multipart/form-data
String sign = request.getParameter("sign");// .getAttribute("sign");
// 判断enctype属性是否为multipart/form-data
if (isMultipart == false) {
String sign = request.getParameter("sign");
String content = request.getParameter("content");
if (StringUtils.isBlank(sign)) {
request.setAttribute("message", "参数sign不能为NULL");
request.getRequestDispatcher("/WEB-INF/views/errors/401.jsp").forward(request, response);// 跳转到验证错误页面
return;
} else if (StringUtils.isBlank(content)) {
// if (StringUtils.isBlank(sign)) {
//
// request.setAttribute("message", "参数sign不能为NULL");
// request.getRequestDispatcher("/WEB-INF/views/errors/401.jsp").forward(request, response);// 跳转到验证错误页面
// return;
if (StringUtils.isBlank(content)) {
request.setAttribute("message", "参数content不能为NULL");
request.getRequestDispatcher("/WEB-INF/views/errors/401.jsp").forward(request, response);// 跳转到验证错误页面
// 跳转到验证错误页面
request.getRequestDispatcher("/WEB-INF/views/errors/401.jsp").forward(request, response);
return;
}
/**
* 对有签名的进行DES签名验证,不使用下面的sha验证
*/
/*
* sign = request.getParameter("sign"); if
* (StringUtils.isNotBlank(sign)) { if (!validateSign(sign)) {
* request.setAttribute("message", "签名错误,禁止访问");
* request.getRequestDispatcher("/WEB-INF/views/errors/405.jsp").
* forward(request, response);// 跳转到验证错误页面 return; } }
*/
}
if (isAllowAllPage) {// 所有请求通过, 不做数据验证
// 所有请求通过, 不做数据验证
if (isAllowAllPage) {
filterChain.doFilter(request, response);
return;
}
if (isExcludedPage) { // 有例外请求链接
// 有例外请求链接
if (isExcludedPage) {
HttpServletRequest req = (HttpServletRequest) request;
String uri = req.getServletPath();
if (excludedPageArray != null && uri != null && uri.length() != 0) {
if (excludedPageSet.contains(uri)) {// 直接包含
// 直接包含
if (excludedPageSet.contains(uri)) {
filterChain.doFilter(request, response);
return;
}
for (String page : excludedPageArray) {// 遍历例外url数组
if (uri.matches(page)) {// 在过滤url之外
// 遍历例外url数组
for (String page : excludedPageArray) {
// 在过滤url之外
if (uri.matches(page)) {
filterChain.doFilter(request, response);
return;
}
......@@ -108,23 +105,39 @@ public class BasicVerifyFilter implements Filter {
}
// 对基本数据域进行验证
String content = request.getParameter("content");
String sign = request.getParameter("sign");
// String sign = request.getParameter("sign");
String message = "content及sign不允许为空";
if (content != null && sign != null) { // 基本参数不为NULL
BaseBean baseBean = JSON.parseObject(content, BaseBean.class);
message = "app_code不允许为空";
if (baseBean.getAppCode() != null) { // 基本必要参数验证通过
message = "签名验证不匹配";
if (GConstants.IS_VERIFY_CONTENT_SIGN == false
|| GlobalUtil.verify(content, GConstants.SIGN_PRIVATE_KEY, sign)) {// 签名验证通过
// 基本参数不为NULL
if (content != null) {
message = "无效请求";
BaseUserBean baseUserBean = JSON.parseObject(content, BaseUserBean.class);
String userSign = baseUserBean.getUserSign();
if (userSign != null && !"".equals(userSign) && !"undefind".equals(userSign)) {
ServletContext context = request.getServletContext();
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(context);
UserService userService = ctx.getBean(UserService.class);
UserEntity ue = new UserEntity();
ue.setUsercode(userSign);
User user = userService.getUserByUserCode(ue);
message = "无效请求";
if (user != null) {
filterChain.doFilter(request, response);
return;
// if (baseBean.getAppCode() != null) { // 基本必要参数验证通过
// message = "签名验证不匹配";
// if (GConstants.IS_VERIFY_CONTENT_SIGN == false
// || GlobalUtil.verifySign(content, GConstants.SIGN_PRIVATE_KEY, sign)) {// 签名验证通过
// filterChain.doFilter(request, response);
// return;
// }
// }
}
}
}
}
request.setAttribute("message", message);
request.getRequestDispatcher("/WEB-INF/views/errors/401.jsp").forward(request, response);// 跳转到验证错误页面
// 跳转到验证错误页面
request.getRequestDispatcher("/WEB-INF/views/errors/401.jsp").forward(request, response);
}
@Override
......@@ -132,14 +145,16 @@ public class BasicVerifyFilter implements Filter {
// TODO Auto-generated method stub
excludedPages = filterConfig.getInitParameter("excludedPages");
if (excludedPages != null && excludedPages.length() != 0) {
excludedPages = excludedPages.replaceAll("\\s+|^;+|;+$", "");// 替换前后分号及所有空格
// 替换前后分号及所有空格
excludedPages = excludedPages.replaceAll("\\s+|^;+|;+$", "");
if (excludedPages.length() != 0) {
if (excludedPages.equals("*") || excludedPages.equals(".*") || excludedPages.equals(".+")) {// 全部不验证
// 全部不验证
if (excludedPages.equals("*") || excludedPages.equals(".*") || excludedPages.equals(".+")) {
isAllowAllPage = true;
} else {
excludedPageArray = excludedPages.split(";");
for (int i = 0, len = excludedPageArray.length; i < len; i++) {
excludedPageSet.add(excludedPageArray[0]);
excludedPageSet.add(excludedPageArray[i]);
}
isExcludedPage = true;
}
......
......@@ -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();
try {
properties.load(new InputStreamReader(PropertiesUtils.class.getClassLoader().getResourceAsStream("redis.properties"),"UTF-8"));
} catch (IOException 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
......@@ -53,7 +53,8 @@ public class StatisticalController{
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;
......
......@@ -3,12 +3,12 @@
*/
package com.ejweb.modules.airport.dao;
import java.util.List;
import com.ejweb.core.base.BaseDao;
import com.ejweb.modules.airport.bean.StatisticalBean;
import com.ejweb.modules.airport.entity.StatisticalEntity;
import java.util.List;
/**
*
* @team suzhou
......@@ -19,5 +19,6 @@ import com.ejweb.modules.airport.entity.StatisticalEntity;
public interface StatisticalDao extends BaseDao{
List<StatisticalEntity> getStatisticalList(StatisticalBean bean);
List<StatisticalEntity> getStatisticalArrIataList(StatisticalBean bean);
Integer getDay(StatisticalEntity entity);
}
......@@ -14,9 +14,12 @@ import com.ejweb.modules.verify.dao.AirlineVerifyDao;
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.List;
/**
......@@ -27,6 +30,7 @@ import java.util.List;
*/
@Service
public class StatisticalService extends BaseService<StatisticalDao> {
private final static Logger LOG = Logger.getLogger(StatisticalService.class);
@Autowired
private AirlineVerifiedDao airlineVerifiedDao;
......@@ -41,24 +45,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) {
......
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;
}
}
......@@ -36,7 +36,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);
......@@ -64,7 +64,8 @@ public class ShortMessageService extends BaseService<ShortMessageDao> {
}
builder.append(phones[i].replaceAll("^0+", ""));
}
phone = builder.toString();
//电话号码去除空格,否则导致发送失败
phone = builder.toString().trim();
if (StringUtils.isEmpty(phone)) {
return false;
}
......@@ -79,6 +80,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()));
......
package com.ejweb.modules.route.bean;
import java.util.List;
import java.util.Map;
import com.ejweb.core.base.GenericBean;
import org.hibernate.validator.constraints.NotEmpty;
import com.ejweb.core.base.GenericBean;
import java.util.List;
import java.util.Map;
public class VerifyStatusBean extends GenericBean {
......
package com.ejweb.modules.route.service;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
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.core.base.PageEntity;
import com.ejweb.core.exception.IlleagalRecordException;
import com.ejweb.core.exception.RecordNotExistException;
import com.ejweb.core.util.IdWorker;
import com.ejweb.core.util.PlanUtil;
import com.ejweb.core.util.TimeUtils;
import com.ejweb.core.util.VerifyEmailHandler;
import com.ejweb.modules.depart.dao.DepartDao;
import com.ejweb.modules.depart.entity.DepartEntity;
import com.ejweb.modules.notify.bean.NotifyAddBean;
import com.ejweb.modules.notify.dao.NotifyDao;
import com.ejweb.modules.route.bean.RouteFileBean;
import com.ejweb.modules.route.bean.RouteVerifyBean;
import com.ejweb.modules.route.bean.RouteVerifyDetailBean;
import com.ejweb.modules.route.bean.VerifyCheckBean;
import com.ejweb.modules.route.bean.VerifyStatusBean;
import com.ejweb.modules.route.bean.*;
import com.ejweb.modules.route.dao.RouteVerifyDao;
import com.ejweb.modules.route.entity.FullRouteVerifyEntity;
import com.ejweb.modules.route.entity.RouteVerifyEntity;
import com.ejweb.modules.user.dao.UserDao;
import com.ejweb.modules.user.entity.User;
import com.ejweb.modules.user.entity.UserEntity;
import com.ejweb.modules.verify.bean.AirlineVerifiedAddBean;
import com.ejweb.modules.verify.bean.AirlineVerifyDetailBean;
import com.ejweb.modules.verify.bean.FullAirlineConclusionBean;
import com.ejweb.modules.verify.bean.FullVerifyConditionBean;
import com.ejweb.modules.verify.bean.FullVerifyFormBean;
import com.ejweb.modules.verify.bean.RecordAddBean;
import com.ejweb.modules.verify.bean.VerifyFeedbackDetailBean;
import com.ejweb.modules.verify.bean.VerifyProcessAddBean;
import com.ejweb.modules.verify.dao.AirlineConclusionDao;
import com.ejweb.modules.verify.dao.AirlineVerifiedDao;
import com.ejweb.modules.verify.dao.AirlineVerifyDao;
import com.ejweb.modules.verify.dao.RecordDao;
import com.ejweb.modules.verify.dao.VerifyConditionDao;
import com.ejweb.modules.verify.dao.VerifyFeedbackDao;
import com.ejweb.modules.verify.dao.VerifyFormDao;
import com.ejweb.modules.verify.dao.VerifyProcessDao;
import com.ejweb.modules.verify.bean.*;
import com.ejweb.modules.verify.dao.*;
import com.ejweb.modules.verify.entity.AirlineVerifyEntity;
import com.ejweb.modules.verify.entity.FullVerifyConditionEntity;
import com.ejweb.modules.verify.entity.FullVerifyFormEntity;
import com.ejweb.modules.verify.entity.RouteverifyEntity;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import freemarker.template.TemplateException;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
@Transactional(readOnly = true)
public class RouteVerifyService extends BaseService<RouteVerifyDao> {
@Autowired
private final static Logger LOG = Logger.getLogger(RouteVerifyService.class);
@Autowired
private UserDao userdao;
@Autowired
VerifyConditionDao verifyConditionDao;
......@@ -99,12 +80,14 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
pageInfo = new PageInfo<RouteVerifyEntity>(dao.findlist(bean));
if (pageInfo.getPages() < bean.getPageNo()) {// 页码大于总页数,则返回NULL
// 页码大于总页数,则返回NULL
if (pageInfo.getPages() < bean.getPageNo()) {
return null;
}
List<RouteVerifyEntity> list = pageInfo.getList();
if (list == null || list.size() == 0) {// 如果没有数据则返回NULL
// 如果没有数据则返回NULL
if (list == null || list.size() == 0) {
return null;
}
for (RouteVerifyEntity entity : list) {
......@@ -122,43 +105,42 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
public RouteVerifyEntity detail(RouteVerifyDetailBean bean) {
RouteVerifyEntity entity = dao.detail(bean);
Map<String,String> map=verifyDao.getDetail(bean.getVerifId());
map.put("depName", PlanUtil.GetLine(map.get("depName"),map.get("arrName"),map.get("roundtripType"),map.get("vertype")));
map.put("depIata", PlanUtil.GetLine(map.get("depIata"),map.get("arrIata"),map.get("roundtripType"),map.get("vertype")));
Map<String, String> map = verifyDao.getDetail(bean.getVerifId());
map.put("depName", PlanUtil.GetLine(map.get("depName"), map.get("arrName"), map.get("roundtripType"), map.get("vertype")));
map.put("depIata", PlanUtil.GetLine(map.get("depIata"), map.get("arrIata"), map.get("roundtripType"), map.get("vertype")));
entity.setDepName(map.get("depName"));
entity.setVerifType(map.get("verifType"));
entity.setRouteFile(dao.getRouteFileList(entity));
entity.setHistory(verifyDao.getHistoryList(entity.getId()));
if(StringUtils.isNoneBlank(entity.getConditionId())){
VerifyFeedbackDetailBean bean1=new VerifyFeedbackDetailBean();
bean1.setConditionId(entity.getConditionId());
entity.setDepartIds(feeddao.getDetailList(bean1));
}
if(StringUtils.isBlank(entity.getFormText())){
AirlineVerifyEntity airlineVerifyEntity = airlineVerifyDao
.selectByPrimaryKey(bean.getVerifId());
FullVerifyFormBean fullVerifyFormBean = new FullVerifyFormBean();
fullVerifyFormBean.setCreateBy(bean.getUserCode());
fullVerifyFormBean.setDepartId(bean.getDepartId());
fullVerifyFormBean.setVerifType(airlineVerifyEntity.getVerifType());
fullVerifyFormBean.setFormType("01");
List<FullVerifyFormEntity> fullVerifyFormEntities = verifyFormDao.fullList(fullVerifyFormBean);
if (fullVerifyFormEntities != null) {
if (fullVerifyFormEntities.size() == 1) {
FullVerifyFormEntity fullVerifyFormEntity = fullVerifyFormEntities.get(0);
entity.setFormText(fullVerifyFormEntity.getFormText());
} else if (fullVerifyFormEntities.size() > 1){
FullVerifyFormEntity fullVerifyFormEntity = fullVerifyFormEntities.get(0);
entity.setFormText(fullVerifyFormEntity.getFormText());
//throw new IlleagalRecordException("非法的记录" + FullVerifyFormEntity.class);
}
}
}
return entity;
if (StringUtils.isNoneBlank(entity.getConditionId())) {
VerifyFeedbackDetailBean bean1 = new VerifyFeedbackDetailBean();
bean1.setConditionId(entity.getConditionId());
entity.setDepartIds(feeddao.getDetailList(bean1));
}
if (StringUtils.isBlank(entity.getFormText())) {
AirlineVerifyEntity airlineVerifyEntity = airlineVerifyDao
.selectByPrimaryKey(bean.getVerifId());
FullVerifyFormBean fullVerifyFormBean = new FullVerifyFormBean();
fullVerifyFormBean.setCreateBy(bean.getUserCode());
fullVerifyFormBean.setDepartId(bean.getDepartId());
fullVerifyFormBean.setVerifType(airlineVerifyEntity.getVerifType());
fullVerifyFormBean.setFormType("01");
List<FullVerifyFormEntity> fullVerifyFormEntities = verifyFormDao.fullList(fullVerifyFormBean);
if (fullVerifyFormEntities != null) {
if (fullVerifyFormEntities.size() == 1) {
FullVerifyFormEntity fullVerifyFormEntity = fullVerifyFormEntities.get(0);
entity.setFormText(fullVerifyFormEntity.getFormText());
} else if (fullVerifyFormEntities.size() > 1) {
FullVerifyFormEntity fullVerifyFormEntity = fullVerifyFormEntities.get(0);
entity.setFormText(fullVerifyFormEntity.getFormText());
}
}
}
return entity;
}
@Transactional(readOnly = false)
......@@ -166,133 +148,122 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
final String verifyStatus = bean.getVerifyStatus();
if (dao.checkDepartIdWithUserCodeAndId(bean) <= 0)
if (dao.checkDepartIdWithUserCodeAndId(bean) <= 0) {
return false;
}
FullRouteVerifyEntity fullRouteVerifyEntity = checkRouteVerifyExist(bean.getVerifId(), bean.getUserCode());
if("0".equals(bean.getStatus())&&"1".equals(fullRouteVerifyEntity.getStatus())){
if ("0".equals(bean.getStatus()) && "1".equals(fullRouteVerifyEntity.getStatus())) {
return false;
}
boolean remarkModify = false;
//判断备注是否修改,如果有修改,则添加操作履历
if (StringUtils.isNotEmpty(bean.getRemarks())) {
if (!bean.getRemarks().equals(fullRouteVerifyEntity.getRemarks())) {
remarkModify = true;
}
}
LOG.info("备注修改结果:" + remarkModify + ",请求remarks为:" + bean.getRemarks() + ",数据库remarks为:" + fullRouteVerifyEntity.getRemarks());
RecordAddBean recordAddBean = null;
//记录初始反馈时间
if (fullRouteVerifyEntity.getStartTime() == null) {
LOG.info("初始反馈时间为null;第一次反馈不增加修改记录");
fullRouteVerifyEntity.setStartTime(new Date());
// 完成初始反馈通知置灰
NotifyAddBean addbean=new NotifyAddBean();
NotifyAddBean addbean = new NotifyAddBean();
addbean.setVerifId(bean.getVerifId());
addbean.setType("1");
addbean.setUserCode(bean.getUserCode());
notifyDao.NotifyComplete(addbean);
}else{
} else {
boolean formTextModify = false;
// 增加自定义表单修改操作履历
if(fullRouteVerifyEntity.getFormText()!=null&!fullRouteVerifyEntity.getFormText().equals(bean.getFormText())){
RecordAddBean addbean = new RecordAddBean();
addbean.setId(IdWorker.getNextId());
addbean.setUserCode(bean.getUserCode());
addbean.setRecordType("03");
addbean.setVerifId(bean.getVerifId());
recordDao.insert(addbean);
if (StringUtils.isNotEmpty(fullRouteVerifyEntity.getFormText())) {
if (!bean.getFormText().equals(fullRouteVerifyEntity.getFormText())) {
formTextModify = true;
}
}
LOG.info("是否修改表单:" + formTextModify + ";是否修改备注:" + remarkModify);
//如果修改了自定义表单或者备注,创建修改论证内容操作履历
if (formTextModify || remarkModify) {
recordAddBean = new RecordAddBean();
recordAddBean.setId(IdWorker.getNextId());
recordAddBean.setUserCode(bean.getUserCode());
recordAddBean.setRecordType("03");
recordAddBean.setVerifId(bean.getVerifId());
//判断备注是否修改,如果有修改,操作履历添加备注内容
if (remarkModify) {
recordAddBean.setRemarks(bean.getRemarks());
}
LOG.info("step1中recordAddBean:" + recordAddBean.toString());
}
}
/* // 生成论证文件
if (bean.getFormText() != null && !"".equals(bean.getFormText())) {
UploadFileBean uploadFileBean = Html2File.convertHtml2Word(bean.getFormText());
RouteFileBean routeFileBean = new RouteFileBean();
routeFileBean.setId(IdWorker.getNextId());
routeFileBean.setFileName("论证报告单.doc");
routeFileBean.setExtesion(uploadFileBean.getExtesion());
routeFileBean.setMd5(uploadFileBean.getMd5());
routeFileBean.setFilePath(uploadFileBean.getPath());
routeFileBean.setFileSize(String.valueOf(uploadFileBean.getSize()));
routeFileBean.setRouteId(fullRouteVerifyEntity.getId());
routeFileBean.setCreateBy(bean.getUserCode());
dao.deleteRouteFile(routeFileBean);
dao.insertRouteFile(routeFileBean);
}*/
//结束上一循环
List<FullVerifyConditionEntity> verifyConditionEntities = this
.getFullVerifyConditionByRouteIdAndComplete(fullRouteVerifyEntity.getId());
if(verifyConditionEntities!=null){
for(FullVerifyConditionEntity verifyConditionEntity : verifyConditionEntities ){
if (verifyConditionEntities != null) {
for (FullVerifyConditionEntity verifyConditionEntity : verifyConditionEntities) {
verifyConditionEntity = verifyConditionEntities.get(0);
verifyConditionEntity.setConditionStatus(verifyStatus);
verifyConditionEntity.setComplete("1");
// 完成审核通知置灰
NotifyAddBean addbean=new NotifyAddBean();
NotifyAddBean addbean = new NotifyAddBean();
addbean.setVerifId(verifyConditionEntity.getId());
addbean.setType("7");
notifyDao.NotifyComplete(addbean);
verifyConditionDao.updateByPrimaryKeySelective(verifyConditionEntity);
}
}
// 如果已提交过论证意见,则记录修改
if (fullRouteVerifyEntity.getVerifyStatus()!="00" && !fullRouteVerifyEntity.getVerifyStatus().equals(bean.getVerifyStatus())) {
RecordAddBean addbean = new RecordAddBean();
addbean.setId(IdWorker.getNextId());
addbean.setUserCode(bean.getUserCode());
addbean.setStatusFrom(fullRouteVerifyEntity.getVerifyStatus());
addbean.setStatusTo(bean.getVerifyStatus());
addbean.setRecordType("02");
addbean.setVerifId(bean.getVerifId());
recordDao.insert(addbean);
// 如果已提交过论证意见,则记录修改
if (fullRouteVerifyEntity.getVerifyStatus() != "00" && !fullRouteVerifyEntity.getVerifyStatus().equals(bean.getVerifyStatus())) {
LOG.info("修改论证意见,优先生成类型为02的操作履历");
//判断是否创建修改论证内容操作履历,如果有,优先生成修改论证意见操作履历,论证内容和意见同时修改,只生成修改论证意见操作履历(备注视为论证内容范畴)
if (recordAddBean == null) {
recordAddBean = new RecordAddBean();
}
recordAddBean.setId(IdWorker.getNextId());
recordAddBean.setUserCode(bean.getUserCode());
recordAddBean.setStatusFrom(fullRouteVerifyEntity.getVerifyStatus());
recordAddBean.setStatusTo(bean.getVerifyStatus());
recordAddBean.setRecordType("02");
recordAddBean.setVerifId(bean.getVerifId());
//判断备注是否修改,如果有修改,操作履历添加备注内容
if (remarkModify) {
recordAddBean.setRemarks(bean.getRemarks());
}
}
// 判断是否保存为草稿
if ("0".equals(bean.getStatus())) {
// 如果已经提交,不能变成草稿
/* if ("1".equals(fullRouteVerifyEntity.getStatus()))
if (!"02".equals(fullRouteVerifyEntity.getVerifyStatus())
|| !"03".equals(fullRouteVerifyEntity.getVerifyStatus()))
throw new Exception("提交数据不能修改为草稿");*/
/* // 首次提交论证意见时,记录初次反馈时间
if (verifyStatus == null || "04".equals(verifyStatus) || "".equals(verifyStatus)) {
if (fullRouteVerifyEntity.getStartTime() == null) {
fullRouteVerifyEntity.setStartTime(new Date());
}
}*/
// 提交时
} else if ("1".equals(bean.getStatus())) {
if (recordAddBean != null) {
LOG.info("记录为:" + recordAddBean.toString());
recordDao.insert(recordAddBean);
}
if ("1".equals(bean.getStatus())) {
fullRouteVerifyEntity.setEndTime(new Date());
// 完成截止反馈通知置灰
NotifyAddBean addbean1=new NotifyAddBean();
NotifyAddBean addbean1 = new NotifyAddBean();
addbean1.setVerifId(bean.getVerifId());
addbean1.setType("2");
addbean1.setUserCode(bean.getUserCode());
notifyDao.NotifyComplete(addbean1);
// 完成截止反馈通知置灰
NotifyAddBean addbean2=new NotifyAddBean();
NotifyAddBean addbean2 = new NotifyAddBean();
addbean2.setVerifId(bean.getVerifId());
addbean2.setType("4");
addbean2.setUserCode(bean.getUserCode());
notifyDao.NotifyComplete(addbean2);
// 论证意见为条件可行或不可行
if ("02".equals(verifyStatus) || "03".equals(verifyStatus)) {
/* List<FullVerifyConditionEntity> verifyConditionEntities = this
.getFullVerifyConditionByRouteIdAndComplete(fullRouteVerifyEntity.getId());
FullVerifyConditionEntity verifyConditionEntity = null;
if (this.verifyConditionEntityExist(verifyConditionEntities)) {
verifyConditionEntity = verifyConditionEntities.get(0);
verifyConditionEntity.setComplete("1");
verifyConditionDao.updateByPrimaryKeySelective(verifyConditionEntity);
this.insertVerifyConditionChild(verifyStatus, fullRouteVerifyEntity.getVerifId(),
verifyConditionEntity.getId(), bean.getUserCode(), fullRouteVerifyEntity.getId());
} else {*/
String cid=IdWorker.getNextId();
this.insertVerifyConditionChild(cid,verifyStatus, fullRouteVerifyEntity.getVerifId(), null,
bean.getUserCode(), fullRouteVerifyEntity.getId(),null);
// }
String cid = IdWorker.getNextId();
this.insertVerifyConditionChild(cid, verifyStatus, fullRouteVerifyEntity.getVerifId(), null,
bean.getUserCode(), fullRouteVerifyEntity.getId(), null);
NotifyAddBean addbean = new NotifyAddBean();
StringBuffer sb = new StringBuffer();
// 给运控部发通知,进行条件审核
// AirlineVerifyDetailBean verifybean = new AirlineVerifyDetailBean();
Map<String, String> map=verifyDao.getDetail(bean.getVerifId());
map.put("depName", PlanUtil.GetLine(map.get("depName"),map.get("arrName"),map.get("roundtripType"),map.get("vertype")));
map.put("depIata", PlanUtil.GetLine(map.get("depIata"),map.get("arrIata"),map.get("roundtripType"),map.get("vertype")));
Map<String, String> map = verifyDao.getDetail(bean.getVerifId());
map.put("depName", PlanUtil.GetLine(map.get("depName"), map.get("arrName"), map.get("roundtripType"), map.get("vertype")));
map.put("depIata", PlanUtil.GetLine(map.get("depIata"), map.get("arrIata"), map.get("roundtripType"), map.get("vertype")));
sb.append("论证单号为").append(map.get("verifNo"))
.append(map.get("verifType")).append(map.get("depName")).append("的航线产生一条论证条件,请尽快审核。");
StringBuffer url=new StringBuffer();
.append(map.get("verifType")).append(map.get("depName")).append("的航线产生一条论证条件,请尽快审核。");
StringBuffer url = new StringBuffer();
url.append("<<<a href='argument-condition-estimate-check-details.htm?verifId=").append(bean.getVerifId());
url.append("&verifNo=").append(map.get("verifNo"));
url.append("&cid=").append(cid);
......@@ -310,66 +281,30 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
addbean.setVerifId(cid);
addbean.setConId(bean.getVerifId());
notifyDao.saveNotify(addbean);
// 论证意见为可行或条件满足
} else if ("01".equals(verifyStatus)||"04".equals(verifyStatus)) {
/* List<FullVerifyConditionEntity> verifyConditionEntities = this
.getFullVerifyConditionByRouteIdAndComplete(fullRouteVerifyEntity.getId());
FullVerifyConditionEntity verifyConditionEntity = null;
// 判断是否已经全部提交论证意见
if (this.verifyConditionEntityExist(verifyConditionEntities)) {
// 结束论证评估循环
verifyConditionEntity = verifyConditionEntities.get(0);
verifyConditionEntity.setConditionStatus(verifyStatus);
verifyConditionEntity.setComplete("1");
verifyConditionDao.updateByPrimaryKeySelective(verifyConditionEntity);
}*/
/*
* RouteVerifyBean routeVerifyBean = new RouteVerifyBean();
* routeVerifyBean.setVerifId(fullRouteVerifyEntity.getVerifId()
* ); // 判断是否进入论证总结阶段
* this.insertAirlineConclusion(routeVerifyBean,
* bean.getUserCode());
*/
// 最终不可行,结束论证
} else if ("05".equals(verifyStatus)) {
/* List<FullVerifyConditionEntity> verifyConditionEntities = this
.getFullVerifyConditionByRouteIdAndComplete(fullRouteVerifyEntity.getId());
if (this.verifyConditionEntityExist(verifyConditionEntities)) {
FullVerifyConditionEntity verifyConditionEntity = verifyConditionEntities.get(0);
verifyConditionEntity.setConditionStatus(verifyStatus);
verifyConditionDao.updateByPrimaryKeySelective(verifyConditionEntity);
}*/
}
}
List<Map<String,String>> list = bean.getRouteFile();
if(list!=null){
RouteFileBean routeFileBean1=new RouteFileBean();
List<Map<String, String>> list = bean.getRouteFile();
if (list != null) {
RouteFileBean routeFileBean1 = new RouteFileBean();
routeFileBean1.setRouteId(fullRouteVerifyEntity.getId());
dao.deleteRouteFile(routeFileBean1);
for (Map<String,String> m : list) {
RouteFileBean routeFileBean=new RouteFileBean();
for (Map<String, String> m : list) {
RouteFileBean routeFileBean = new RouteFileBean();
routeFileBean.setId(IdWorker.getNextId());
routeFileBean.setFileName(m.get("fileName"));
routeFileBean.setFilePath(m.get("filePath"));
routeFileBean.setFileSize(String.valueOf(m.get("fileSize")) );
routeFileBean.setFileSize(String.valueOf(m.get("fileSize")));
routeFileBean.setRouteId(fullRouteVerifyEntity.getId());
routeFileBean.setCreateBy(bean.getUserCode());
// dao.deleteRouteFile(routeFileBean);
dao.insertRouteFile(routeFileBean);
}
}
updateRouteVerify(fullRouteVerifyEntity, bean);
if ("01".equals(verifyStatus)||"04".equals(verifyStatus)) {
if ("01".equals(verifyStatus) || "04".equals(verifyStatus)) {
RouteVerifyBean routeVerifyBean = new RouteVerifyBean();
routeVerifyBean.setVerifId(fullRouteVerifyEntity.getVerifId());
// 判断是否进入论证总结阶段
......@@ -377,25 +312,31 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
}
return true;
}
@Transactional(readOnly = false)
public void updateReport(VerifyStatusBean bean) throws Exception {
dao.updateRouteVerifyReport(bean);
dao.updateRouteVerifyReport(bean);
}
private FullRouteVerifyEntity checkRouteVerifyExist(String verifId, String userCode) {
if (StringUtils.isBlank(verifId))
if (StringUtils.isBlank(verifId)) {
throw new IllegalArgumentException("verifId 不能为空");
if (StringUtils.isBlank(userCode))
}
if (StringUtils.isBlank(userCode)) {
throw new IllegalArgumentException("userCode 不能为空");
}
VerifyStatusBean bean = new VerifyStatusBean();
bean.setVerifId(verifId);
bean.setUserCode(userCode);
List<FullRouteVerifyEntity> fullRouteVerifyEntities = dao.findByVerifIdUserCode(bean);
if (fullRouteVerifyEntities.size() == 0)
if (fullRouteVerifyEntities.size() == 0) {
throw new RecordNotExistException("FullRouteVerifyEntity 记录不存在");
if (fullRouteVerifyEntities.size() > 1)
}
if (fullRouteVerifyEntities.size() > 1) {
throw new IlleagalRecordException("FullRouteVerifyEntity 非法的记录");
}
return fullRouteVerifyEntities.get(0);
}
......@@ -439,7 +380,6 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
// 记录论证节点
VerifyProcessAddBean bean1 = new VerifyProcessAddBean();
bean1.setId(IdWorker.getNextId());
// bean1.setUserCode(routeVerifyBean.getUserCode());
bean1.setProcessValue("route_verify");
bean1.setVerifId(bean.getId());
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
......@@ -456,13 +396,13 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
NotifyAddBean addbean = new NotifyAddBean();
StringBuffer sb = new StringBuffer();
Map<String, String> map=verifyDao.getDetail(bean.getVerifId());
map.put("depName", PlanUtil.GetLine(map.get("depName"),map.get("arrName"),map.get("roundtripType"),map.get("vertype")));
map.put("depIata", PlanUtil.GetLine(map.get("depIata"),map.get("arrIata"),map.get("roundtripType"),map.get("vertype")));
Map<String, String> map = verifyDao.getDetail(bean.getVerifId());
map.put("depName", PlanUtil.GetLine(map.get("depName"), map.get("arrName"), map.get("roundtripType"), map.get("vertype")));
map.put("depIata", PlanUtil.GetLine(map.get("depIata"), map.get("arrIata"), map.get("roundtripType"), map.get("vertype")));
sb.append("论证单号为").append(map.get("verifNo"))
.append(map.get("verifType")).append(map.get("depName"))
.append("的航线进入到论证总结阶段,请尽快审核。");
StringBuffer url=new StringBuffer();
.append(map.get("verifType")).append(map.get("depName"))
.append("的航线进入到论证总结阶段,请尽快审核。");
StringBuffer url = new StringBuffer();
url.append("<<<a href='wait-argument-sum-details.htm?verifId=").append(bean.getVerifId());
url.append("&verifNo=").append(map.get("verifNo"));
url.append("'>点击查看</a>");
......@@ -479,25 +419,15 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
addbean.setVerifId(bean.getVerifId());
addbean.setConId(bean.getVerifId());
notifyDao.saveNotify(addbean);
}
}
// private boolean checkVerifyStatus(List<FullRouteVerifyEntity>
// fullRouteVerifyEntities, final String verifyStatus) {
//
// for(FullRouteVerifyEntity fullRouteVerifyEntity :
// fullRouteVerifyEntities){
// if(!verifyStatus.equals(fullRouteVerifyEntity.getVerifyStatus()))
// return false;
// }
// return true;
// }
private void insertVerifyConditionChild(String id,String verifyStatus, String verifId, String verifyConditionId,
String userCode, String routeId,String remarks) {
private void insertVerifyConditionChild(String id, String verifyStatus, String verifId, String verifyConditionId,
String userCode, String routeId, String remarks) {
FullVerifyConditionEntity verifyConditionEntityNew = new FullVerifyConditionEntity();
verifyConditionEntityNew.setId(id);
verifyConditionEntityNew.setConditionStatus(verifyStatus);
verifyConditionEntityNew.setVerifId(verifId);
......@@ -514,22 +444,13 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
verifyConditionDao.insert(verifyConditionEntityNew);
}
/* private boolean verifyConditionEntityExist(List<FullVerifyConditionEntity> verifyConditionEntities) {
if (verifyConditionEntities != null) {
if (verifyConditionEntities.size() == 0)
return false;
else if (verifyConditionEntities.size() != 1)
throw new IlleagalRecordException("非法的记录" + FullVerifyConditionEntity.class);
return true;
}
return false;
}*/
/**
* 条件评估提出部门修改可行性意见
* @author zhanglg
* @time 2016年10月6日
*
* @param bean
* @author zhanglg
* @time 2016年10月6日
*/
@Transactional(readOnly = false)
public void updateCheckStatus(VerifyCheckBean bean) {
......@@ -537,146 +458,118 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
FullRouteVerifyEntity fullRouteVerifyEntity = checkRouteVerifyExist(bean.getVerifId(), bean.getUserCode());
// 修改截至反馈时间
fullRouteVerifyEntity.setEndTime(new Date());
// 记录修改
RecordAddBean addbean = new RecordAddBean();
addbean.setId(IdWorker.getNextId());
addbean.setUserCode(bean.getUserCode());
addbean.setStatusFrom(fullRouteVerifyEntity.getVerifyStatus());
addbean.setStatusTo(bean.getVerifyStatus());
addbean.setRecordType("02");
addbean.setVerifId(bean.getVerifId());
recordDao.insert(addbean);
//结束上一循环
List<FullVerifyConditionEntity> verifyConditionEntities = this
.getFullVerifyConditionByRouteIdAndComplete(fullRouteVerifyEntity.getId());
if(verifyConditionEntities!=null){
for(FullVerifyConditionEntity verifyConditionEntity : verifyConditionEntities ){
verifyConditionEntity = verifyConditionEntities.get(0);
verifyConditionEntity.setConditionStatus(verifyStatus);
verifyConditionEntity.setComplete("1");
// 条件可行或满足
if ("01".equals(verifyStatus)||"04".equals(verifyStatus)) {
verifyConditionEntity.setRemarks(bean.getCondition());
}
// 完成审核通知置灰
NotifyAddBean addbean1=new NotifyAddBean();
addbean1.setVerifId(verifyConditionEntity.getId());
addbean1.setType("7");
notifyDao.NotifyComplete(addbean1);
verifyConditionDao.updateByPrimaryKeySelective(verifyConditionEntity);
}
}
// 条件可行或满足
/* if ("01".equals(verifyStatus)||"04".equals(verifyStatus)) {
List<FullVerifyConditionEntity> verifyConditionEntities = this
.getFullVerifyConditionByRouteIdAndComplete(fullRouteVerifyEntity.getId());
FullVerifyConditionEntity verifyConditionEntity = null;
// 判断是否已经全部提交论证意见
if (this.verifyConditionEntityExist(verifyConditionEntities)) {
// 结束论证评估循环
verifyConditionEntity = verifyConditionEntities.get(0);
verifyConditionEntity.setConditionStatus(verifyStatus);
verifyConditionEntity.setComplete("1");
verifyConditionDao.updateByPrimaryKeySelective(verifyConditionEntity);
// 记录修改
RecordAddBean addbean = new RecordAddBean();
addbean.setId(IdWorker.getNextId());
addbean.setUserCode(bean.getUserCode());
addbean.setStatusFrom(fullRouteVerifyEntity.getVerifyStatus());
addbean.setStatusTo(bean.getVerifyStatus());
addbean.setRecordType("02");
addbean.setVerifId(bean.getVerifId());
recordDao.insert(addbean);
//结束上一循环
List<FullVerifyConditionEntity> verifyConditionEntities = this
.getFullVerifyConditionByRouteIdAndComplete(fullRouteVerifyEntity.getId());
if (verifyConditionEntities != null) {
for (FullVerifyConditionEntity verifyConditionEntity : verifyConditionEntities) {
verifyConditionEntity = verifyConditionEntities.get(0);
verifyConditionEntity.setConditionStatus(verifyStatus);
verifyConditionEntity.setComplete("1");
// 条件可行或满足
if ("01".equals(verifyStatus) || "04".equals(verifyStatus)) {
verifyConditionEntity.setRemarks(bean.getCondition());
}
}*/
// 论证意见为条件可行或不可行
if ("02".equals(verifyStatus) || "03".equals(verifyStatus)) {
/* List<FullVerifyConditionEntity> verifyConditionEntities = this
.getFullVerifyConditionByRouteIdAndComplete(fullRouteVerifyEntity.getId());
FullVerifyConditionEntity verifyConditionEntity = null;
// 结束上一论证循环,开始新的论证循环
if (this.verifyConditionEntityExist(verifyConditionEntities)) {
verifyConditionEntity = verifyConditionEntities.get(0);
verifyConditionEntity.setComplete("1");
verifyConditionDao.updateByPrimaryKeySelective(verifyConditionEntity);
this.insertVerifyConditionChild(verifyStatus, fullRouteVerifyEntity.getVerifId(),
verifyConditionEntity.getId(), bean.getUserCode(), fullRouteVerifyEntity.getId());
} else {*/
String cid=IdWorker.getNextId();
this.insertVerifyConditionChild(cid,verifyStatus, fullRouteVerifyEntity.getVerifId(), null,
bean.getUserCode(), fullRouteVerifyEntity.getId(),null);
// }
// 给运控部发通知,进行条件审核
// 完成审核通知置灰
NotifyAddBean addbean1 = new NotifyAddBean();
StringBuffer sb = new StringBuffer();
AirlineVerifyDetailBean verifybean = new AirlineVerifyDetailBean();
verifybean.setVerifId(bean.getVerifId());
// AirlineVerifyDetailEntity VerifyDetailEntity = verifyDao.get(verifybean);
Map<String, String> map=verifyDao.getDetail(bean.getVerifId());
map.put("depName", PlanUtil.GetLine(map.get("depName"),map.get("arrName"),map.get("roundtripType"),map.get("vertype")));
map.put("depIata", PlanUtil.GetLine(map.get("depIata"),map.get("arrIata"),map.get("roundtripType"),map.get("vertype")));
sb.append("论证单号为").append(map.get("verifNo"))
.append(map.get("verifType")).append(map.get("depName")).append("的航线产生一条论证条件,请尽快审核。");
StringBuffer url=new StringBuffer();
url.append("<<<a href='argument-condition-estimate-check-details.htm?verifId=").append(bean.getVerifId());
url.append("&verifNo=").append(map.get("verifNo"));
url.append("&cid=").append(cid);
url.append("'>点击查看</a>");
addbean1.setUrl(url.toString());
addbean1.setType("6");
addbean1.setContent(sb.toString());
addbean1.setTitle("条件审核提醒");
addbean1.setCreateBy(bean.getUserCode());
addbean1.setUpdateBy(bean.getUserCode());
addbean1.setCreateDate(new Date());
addbean1.setUpdateDate(new Date());
addbean1.setId(IdWorker.getNextId());
addbean1.setDepartId("e4q231wdfdfkukjqe53457dgfdhdfhd");
addbean1.setVerifId(cid);
addbean1.setConId(bean.getVerifId());
notifyDao.saveNotify(addbean1);
addbean1.setVerifId(verifyConditionEntity.getId());
addbean1.setType("7");
notifyDao.NotifyComplete(addbean1);
verifyConditionDao.updateByPrimaryKeySelective(verifyConditionEntity);
}
// 更新论证意见
fullRouteVerifyEntity.setVerifyStatus(bean.getVerifyStatus());
if (!"01".equals(verifyStatus)&&!"04".equals(verifyStatus)) {
}
// 论证意见为条件可行或不可行
if ("02".equals(verifyStatus) || "03".equals(verifyStatus)) {
String cid = IdWorker.getNextId();
this.insertVerifyConditionChild(cid, verifyStatus, fullRouteVerifyEntity.getVerifId(), null,
bean.getUserCode(), fullRouteVerifyEntity.getId(), null);
// 给运控部发通知,进行条件审核
NotifyAddBean addbean1 = new NotifyAddBean();
StringBuffer sb = new StringBuffer();
AirlineVerifyDetailBean verifybean = new AirlineVerifyDetailBean();
verifybean.setVerifId(bean.getVerifId());
// AirlineVerifyDetailEntity VerifyDetailEntity = verifyDao.get(verifybean);
Map<String, String> map = verifyDao.getDetail(bean.getVerifId());
map.put("depName", PlanUtil.GetLine(map.get("depName"), map.get("arrName"), map.get("roundtripType"), map.get("vertype")));
map.put("depIata", PlanUtil.GetLine(map.get("depIata"), map.get("arrIata"), map.get("roundtripType"), map.get("vertype")));
sb.append("论证单号为").append(map.get("verifNo"))
.append(map.get("verifType")).append(map.get("depName")).append("的航线产生一条论证条件,请尽快审核。");
StringBuffer url = new StringBuffer();
url.append("<<<a href='argument-condition-estimate-check-details.htm?verifId=").append(bean.getVerifId());
url.append("&verifNo=").append(map.get("verifNo"));
url.append("&cid=").append(cid);
url.append("'>点击查看</a>");
addbean1.setUrl(url.toString());
addbean1.setType("6");
addbean1.setContent(sb.toString());
addbean1.setTitle("条件审核提醒");
addbean1.setCreateBy(bean.getUserCode());
addbean1.setUpdateBy(bean.getUserCode());
addbean1.setCreateDate(new Date());
addbean1.setUpdateDate(new Date());
addbean1.setId(IdWorker.getNextId());
addbean1.setDepartId("e4q231wdfdfkukjqe53457dgfdhdfhd");
addbean1.setVerifId(cid);
addbean1.setConId(bean.getVerifId());
notifyDao.saveNotify(addbean1);
}
// 更新论证意见
fullRouteVerifyEntity.setVerifyStatus(bean.getVerifyStatus());
if (!"01".equals(verifyStatus) && !"04".equals(verifyStatus)) {
fullRouteVerifyEntity.setCondition(bean.getCondition());
}
fullRouteVerifyEntity.setUpdateDate(new Date());
fullRouteVerifyEntity.setUpdateBy(bean.getUserCode());
dao.updateByPrimaryKeySelective(fullRouteVerifyEntity);
if ("01".equals(verifyStatus)||"04".equals(verifyStatus)) {
RouteVerifyBean routeVerifyBean = new RouteVerifyBean();
routeVerifyBean.setVerifId(fullRouteVerifyEntity.getVerifId());
// 判断是否进入论证总结阶段
this.insertAirlineConclusion(routeVerifyBean, bean.getUserCode());
}
}
fullRouteVerifyEntity.setUpdateDate(new Date());
fullRouteVerifyEntity.setUpdateBy(bean.getUserCode());
dao.updateByPrimaryKeySelective(fullRouteVerifyEntity);
if ("01".equals(verifyStatus) || "04".equals(verifyStatus)) {
RouteVerifyBean routeVerifyBean = new RouteVerifyBean();
routeVerifyBean.setVerifId(fullRouteVerifyEntity.getVerifId());
// 判断是否进入论证总结阶段
this.insertAirlineConclusion(routeVerifyBean, bean.getUserCode());
}
}
public void sendmail(VerifyStatusBean bean) {
List<String> mails= verifyDao.getmail("6");
if(mails==null||mails.size()==0)return;
List<String> mails = verifyDao.getmail("6");
if (mails == null || mails.size() == 0) {
return;
}
String templateName = "template_6.ftl";
Map<String, String> map=verifyDao.getDetail(bean.getVerifId());
Map<String, String> map = verifyDao.getDetail(bean.getVerifId());
map.put("url", "https://ifos.jdair.net/im/login");
map.put("depName", PlanUtil.GetLine(map.get("depName"),map.get("arrName"),map.get("roundtripType"),map.get("vertype")));
map.put("depIata", PlanUtil.GetLine(map.get("depIata"),map.get("arrIata"),map.get("roundtripType"),map.get("vertype")));
map.put("depName", PlanUtil.GetLine(map.get("depName"), map.get("arrName"), map.get("roundtripType"), map.get("vertype")));
map.put("depIata", PlanUtil.GetLine(map.get("depIata"), map.get("arrIata"), map.get("roundtripType"), map.get("vertype")));
try {
String flight =PlanUtil.flightContent(map);
String line =PlanUtil.lineContent(map);
String flight = PlanUtil.flightContent(map);
String line = PlanUtil.lineContent(map);
map.put("line", line);
if("02".equals(bean.getVerifyStatus())){
map.put("feedback","不可行");
}else if("03".equals(bean.getVerifyStatus())){
map.put("feedback","条件可行");
}else{
if ("02".equals(bean.getVerifyStatus())) {
map.put("feedback", "不可行");
} else if ("03".equals(bean.getVerifyStatus())) {
map.put("feedback", "条件可行");
} else {
return;
}
map.put("condition",bean.getCondition());
map.put("condition", bean.getCondition());
DepartEntity entity= departDao.getByUserCode(bean.getUserCode());
DepartEntity entity = departDao.getByUserCode(bean.getUserCode());
map.put("backName", entity.getDepartName());
String title="首都航空关于"+flight;
VerifyEmailHandler.getInstance().sendEmail(title+"的论证条件流转的提示(智能首航论证系统提示)", com.ejweb.core.util.TemplateFactory.generateHtmlFromFtl(templateName, map), mails,null);
String title = "首都航空关于" + flight;
VerifyEmailHandler.getInstance().sendEmail(title + "的论证条件流转的提示(智能首航论证系统提示)", com.ejweb.core.util.TemplateFactory.generateHtmlFromFtl(templateName, map), mails, null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
......@@ -684,53 +577,90 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void updateDeport(AirlineVerifiedAddBean bean) {
RouteVerifyBean routeVerifyBean = new RouteVerifyBean();
AirlineVerifyEntity airlineVerifyEntity = new AirlineVerifyEntity();
routeVerifyBean.setVerifId(bean.getVerifId());
List<RouteVerifyEntity> list = dao.findlist(routeVerifyBean);//查询之前的部门
List<AirlineVerifiedAddBean.Deport> verifyDeparts = bean.getVerifyDepartIds();
AirlineVerifyDetailBean airlineVerifyDetailBean = new AirlineVerifyDetailBean();
public void updateDeport(AirlineVerifiedAddBean bean) {
RouteVerifyBean routeVerifyBean = new RouteVerifyBean();
AirlineVerifyEntity airlineVerifyEntity = new AirlineVerifyEntity();
routeVerifyBean.setVerifId(bean.getVerifId());
//查询之前的部门
List<RouteVerifyEntity> list = dao.findlist(routeVerifyBean);
List<AirlineVerifiedAddBean.Deport> verifyDeparts = bean.getVerifyDepartIds();
AirlineVerifyDetailBean airlineVerifyDetailBean = new AirlineVerifyDetailBean();
airlineVerifyDetailBean.setUserCode(bean.getVerifId());
airlineVerifyEntity = airlineVerifyDao.getEntityByVerify(airlineVerifyDetailBean);
RouteverifyEntity routeverifyEntity = new RouteverifyEntity();
UserEntity entity = new UserEntity();
entity.setUsercode(bean.getUserCode());
User user = userdao.getUserByUserCode(entity);
if(airlineVerifyEntity != null){
int isExist = 0; //如果isExist为1说明部门已经存在,不需要添加,如果为-1说明已经删除,需要删除
//生成两个字符串构建变量,用于生成操作记录使用
StringBuilder departAdd = new StringBuilder();
StringBuilder departRemove = new StringBuilder();
if (airlineVerifyEntity != null) {
//如果isExist为1说明部门已经存在,不需要添加,如果为-1说明已经删除,需要删除
int isExist = 0;
for (int i = 0; i < verifyDeparts.size(); i++) {
isExist = 0;
for (int j = 0; j < list.size(); j++) {
if(verifyDeparts.get(i).getDepartId().equals(list.get(j).getDepartId())){//已经存在的部门
isExist=1;
list.remove(j);
break;
}
}
if(isExist==0){//如果是新加的部门,就执行新增
routeverifyEntity.setDeportId(verifyDeparts.get(i).getDepartId());
routeverifyEntity.setVerifStatus("00");
routeverifyEntity.setId(IdWorker.getNextId());
routeverifyEntity.setVerifyId(bean.getVerifId());
routeverifyEntity.setCreateDate(new Date());
routeverifyEntity.setUpdateDate(new Date());
routeverifyEntity.setCreateBy(user.getName());
routeverifyEntity.setUpdateBy(user.getName());
airlineVerifiedDao.insertRouteverify(routeverifyEntity);
}
isExist = 0;
for (int j = 0; j < list.size(); j++) {
//已经存在的部门
if (verifyDeparts.get(i).getDepartId().equals(list.get(j).getDepartId())) {
isExist = 1;
list.remove(j);
break;
}
}
//如果是新加的部门,就执行新增
if (isExist == 0) {
departAdd.append(verifyDeparts.get(i).getDepartName() + ",");
routeverifyEntity.setDeportId(verifyDeparts.get(i).getDepartId());
routeverifyEntity.setVerifStatus("00");
routeverifyEntity.setId(IdWorker.getNextId());
routeverifyEntity.setVerifyId(bean.getVerifId());
routeverifyEntity.setCreateDate(new Date());
routeverifyEntity.setUpdateDate(new Date());
routeverifyEntity.setCreateBy(user.getName());
routeverifyEntity.setUpdateBy(user.getName());
airlineVerifiedDao.insertRouteverify(routeverifyEntity);
}
}
for (int j = 0; j < list.size(); j++) {
routeverifyEntity.setVerifyId(bean.getVerifId());
routeverifyEntity.setDeportId(list.get(j).getDepartId());
dao.deleteRouteverify(routeverifyEntity);
departRemove.append(list.get(j).getDepartName() + ",");
routeverifyEntity.setVerifyId(bean.getVerifId());
routeverifyEntity.setDeportId(list.get(j).getDepartId());
dao.deleteRouteverify(routeverifyEntity);
}
boolean add = StringUtils.isNotEmpty(departAdd);
boolean remove = StringUtils.isNotEmpty(departRemove);
//如果有添加或者删除部门,生成操作记录
if (add || remove) {
StringBuilder remark = new StringBuilder();
remark.append(TimeUtils.getTime("yyyy-MM-dd HH:mm:ss")).append("调整了论证部门 <br/>");
if (add) {
departAdd.insert(0, "【");
departAdd.deleteCharAt(departAdd.length() - 1).append("】");
remark.append("新增了").append(departAdd).append("<br/>");
}
if (remove) {
departRemove.insert(0, "【");
departRemove.deleteCharAt(departRemove.length() - 1).append("】");
remark.append("删除了").append(departRemove).append("<br/>");
}
RecordAddBean recordAddBean = new RecordAddBean();
recordAddBean.setId(IdWorker.getNextId());
recordAddBean.setUserCode(bean.getUserCode());
recordAddBean.setRecordType("05");
recordAddBean.setVerifId(bean.getVerifId());
recordAddBean.setRemarks(remark.toString());
recordDao.insert(recordAddBean);
}
RouteVerifyBean routeVerifyBean1 = new RouteVerifyBean();
routeVerifyBean1.setVerifId(bean.getVerifId());
// 判断是否进入论证总结阶段
insertAirlineConclusion(routeVerifyBean1, bean.getUserCode());
}
}
}
}
......@@ -39,6 +39,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import freemarker.template.TemplateException;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -63,6 +64,8 @@ import java.util.regex.Pattern;
*/
@Service
public class SailingCommandService extends CurdService<SailingCommandDao, SailingCommandEntity> {
private final static Logger LOG = Logger.getLogger(SailingCommandService.class);
@Autowired
private AirlineVerifyDao verifyDao;
@Autowired
......@@ -370,11 +373,7 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin
if ("01".equals(CommandStatus) && "01".equals(bean.getCommandStatus())) {
return false;
}
if ("01".equals(bean.getCommandStatus()) || "02".equals(bean.getCommandStatus())) {
//commandStatus为’01’时,以verifId找到foc_airline_verify对应数据中的verif_status设置为02
bean.setVerifStatus("02");
dao.updateVerifStatys(bean);
}
if (!"00".equals(bean.getCommandStatus())) {
// 该input标签不一定以 / 结尾
Pattern pattern = Pattern.compile("(?<=routeNo\" value=\")(.+?)(?=\"/?>)");
......@@ -394,7 +393,6 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin
bean.setRouteNo(routeNo);
// if(bean.getFormText()!=null&&!"".equals(bean.getFormText())){
try {
// 完成审核通知置灰
NotifyAddBean addbean = new NotifyAddBean();
addbean.setVerifId(bean.getVerifId());
......@@ -540,7 +538,7 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin
sb.append(bean.getConRemarks().replaceAll("<table", "<table width=\"80%\" "));
// sb.append(bean.getConRemarks());
/* sb.append("<br/><h2>开航指令:</h2>");
sb.append(bean.getFormText());*/
sb.append("<br/><h2>各部门论证单:</h2>");
......@@ -595,42 +593,46 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin
sailingFileBean.setCreateBy(bean.getUserCode());
//dao.deleteSailingFile(sailingFileBean);
dao.insertSailingFile(sailingFileBean);
} catch (Exception e) {
// TODO: handle exception
}
LOG.info("添加开航指令文件完成");
dao.updateAirlineverify(bean);
LOG.info("更新开航指令绑定完成");
// 获取论证全部参与部门
List<String> lst = dao.getVerifDeparts(bean.getVerifId());
for (String departId : lst) {
NotifyAddBean addbean = new NotifyAddBean();
StringBuffer sb = new StringBuffer();
NotifyAddBean addbean1 = new NotifyAddBean();
StringBuffer sbContent = new StringBuffer();
sb.append("论证单号为").append(map1.get("verifNo"))
sbContent.append("论证单号为").append(map1.get("verifNo"))
.append(map1.get("verifType")).append(map1.get("depName")).append("的航线已生成开航指令。");
StringBuffer url = new StringBuffer();
url.append("<<<a href='airway-argument-details.htm?verifId=").append(bean.getVerifId());
url.append("&verifNo=").append(map1.get("verifNo"));
url.append("&sailingDate=").append(map1.get("startTime"));
url.append("'>点击查看</a>");
addbean.setUrl(url.toString());
addbean.setType("14");
addbean.setContent(sb.toString());
addbean.setTitle("开航指令下发完成提醒");
addbean.setCreateBy(bean.getUserCode());
addbean.setUpdateBy(bean.getUserCode());
addbean.setCreateDate(new Date());
addbean.setUpdateDate(new Date());
addbean.setId(IdWorker.getNextId());
addbean.setDepartId(departId);
addbean.setVerifId(bean.getVerifId());
addbean.setConId(bean.getVerifId());
notifyDao.saveNotify(addbean);
addbean1.setUrl(url.toString());
addbean1.setType("14");
addbean1.setContent(sbContent.toString());
addbean1.setTitle("开航指令下发完成提醒");
addbean1.setCreateBy(bean.getUserCode());
addbean1.setUpdateBy(bean.getUserCode());
addbean1.setCreateDate(new Date());
addbean1.setUpdateDate(new Date());
addbean1.setId(IdWorker.getNextId());
addbean1.setDepartId(departId);
addbean1.setVerifId(bean.getVerifId());
addbean1.setConId(bean.getVerifId());
notifyDao.saveNotify(addbean1);
}
}
dao.updateSailingCommand(bean);
LOG.info("更新开航指令状态完成,已完成开航指令,开航指令状态:" + bean.getCommandStatus());
if ("01".equals(bean.getCommandStatus()) || "02".equals(bean.getCommandStatus())) {
//commandStatus为’01’时,以verifId找到foc_airline_verify对应数据中的verif_status设置为02
bean.setVerifStatus("02");
dao.updateVerifStatys(bean);
LOG.info("更新论证状态为论证成功");
}
return true;
}
......
......@@ -38,11 +38,10 @@ import java.util.List;
import java.util.Map;
/**
* @team IT Team
* @author renmb
* @version 1.0
* @team IT Team
* @time 2016-03-22
*
*/
@Controller
@RequestMapping(value = "/api/upload")
......@@ -54,12 +53,12 @@ public class UploadController {
/**
* 使用BASE64上传文件
*
* @author renmb
* @time 2016年11月1日
*
* @param request
* @param requestBean
* @return
* @author renmb
* @time 2016年11月1日
*/
@ResponseBody
@RequestMapping("/base64")
......@@ -135,7 +134,7 @@ public class UploadController {
@ResponseBody
@RequestMapping("/files")
public ResponseBean files(HttpServletRequest request, @RequestParam("file") CommonsMultipartFile[] files,
RequestBean requestBean) {
RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean();
List<UploadFileBean> uploadFiles = null;
......@@ -279,12 +278,16 @@ public class UploadController {
@RequestMapping("download")
public void download(RequestBean requestBean, HttpServletResponse response, HttpServletRequest request) throws JsonParseException, JsonMappingException, IOException {
FileBean bean = requestBean.getObjectBean(FileBean.class);
FileBean bean = requestBean.getObjectBean(FileBean.class);
// File baseUploadDir = new File(GConstants.FILE_UPLOAD_DIR, filepath);
InputStream in = null;
OutputStream out = null;
try {
if (bean.getPath() != null) {
if (bean.getPath().indexOf("../") != -1) {
return;
}
}
// 设置文件MIME类型
response.setContentType("application/form-data;charset=utf-8");
// String downloadFileName=Encodes.urlEncode(bean.getName());
......@@ -294,16 +297,16 @@ public class UploadController {
downloadFileName = "=?UTF-8?B?" + (new String(Base64.encodeBase64(bean.getName().getBytes("UTF-8"))))
+ "?=";
} /*
* else{ downloadFileName = URLDecoder.decode(bean.getName(),
* "UTF-8"); }
*/
* else{ downloadFileName = URLDecoder.decode(bean.getName(),
* "UTF-8"); }
*/
// 设置Content-Disposition
response.setHeader("Content-Disposition", "attachment; filename=\"" + downloadFileName + "\"");
// 获取目标文件的绝对路径
// String fullFileName = GConstants.FILE_UPLOAD_DIR + bean.getPath();
File downloadFile = new File(GConstants.FILE_UPLOAD_DIR, bean.getPath());
LOG.error("文件下载地址:"+downloadFile.getAbsolutePath());
System.out.println("文件下载地址:"+downloadFile.getAbsolutePath());
LOG.error("文件下载地址:" + downloadFile.getAbsolutePath());
System.out.println("文件下载地址:" + downloadFile.getAbsolutePath());
// 读取文件
in = new FileInputStream(downloadFile);
out = response.getOutputStream();
......@@ -323,8 +326,8 @@ public class UploadController {
IOUtils.closeQuietly(out);
}
}
// public static String GetImageStr(String imgFile)
// public static String GetImageStr(String imgFile)
// {//将图片文件转化为字节数组字符串,并对其进行Base64编码处理
//// String imgFile = "d://test.jpg";//待处理的图片
// InputStream in = null;
......@@ -400,12 +403,12 @@ public class UploadController {
@RequestMapping("/verifFile")
public ResponseBean verifFile(HttpServletRequest request, RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean();
String stream=request.getParameter("fileStream");
String filePath=request.getParameter("filePath");
String fileDir=request.getParameter("fileDir");
String stream = request.getParameter("fileStream");
String filePath = request.getParameter("filePath");
String fileDir = request.getParameter("fileDir");
ByteArrayInputStream bais = null;
FileOutputStream ostream = null;
try{
try {
byte buf[] = stream.getBytes("utf-8");
bais = new ByteArrayInputStream(buf);
POIFSFileSystem poifs = new POIFSFileSystem();
......@@ -413,12 +416,11 @@ public class UploadController {
directory.createDocument("WordDocument", bais);
// 文件保存地址
File uploadFilePath = new File(GConstants.FILE_UPLOAD_DIR,filePath);
if(uploadFilePath.exists())
{
File uploadFilePath = new File(GConstants.FILE_UPLOAD_DIR, filePath);
if (uploadFilePath.exists()) {
return responseBean;
}
File baseUploadDir = new File(GConstants.FILE_UPLOAD_DIR,fileDir);
File baseUploadDir = new File(GConstants.FILE_UPLOAD_DIR, fileDir);
if (!baseUploadDir.exists()) {// 如果文件夹不存在则创建
baseUploadDir.mkdirs();
}
......@@ -434,6 +436,6 @@ public class UploadController {
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
responseBean.setMessage(GConstants.OK);
return responseBean;
}
}
......@@ -9,8 +9,8 @@ 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.RedisUtils;
import com.ejweb.core.util.Util;
import com.ejweb.modules.im.service.HuaweiInterfaseService;
import com.ejweb.modules.mobile.verify.entity.MobileVerifyEntity;
import com.ejweb.modules.mobile.verify.service.MobileVerifyService;
import com.ejweb.modules.role.bean.UserRolesBean;
......@@ -23,7 +23,9 @@ import com.ejweb.modules.user.service.UserService;
import com.jdair.util.http.client.HTTPClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.BindingResult;
......@@ -31,7 +33,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.*;
......@@ -40,24 +45,32 @@ import java.util.*;
public class UserController {
private final static Logger LOG = Logger.getLogger(UserController.class);
@Autowired
private UserService userService;
// @Autowired
// private OfficedService officedService;
@Autowired
private MobileVerifyService mobileVerifyService;
@Value("${redis.dbIndex}")
private int indexDb;
@Value("${redis.ipWithinSeconds}")
private int ipWithinSeconds;
@Value("${redis.ipLimitTimes}")
private int ipLimitTimes;
@Value("${redis.usernameWithinSeconds}")
private int usernameWithinSeconds;
@Value("${redis.usernameLimitTimes}")
private int usernameLimitTimes;
@Value("${redis.blackUsernameTime}")
private int blackUsernameTime;
@Autowired
private UserRolesService userRolesService;
private RedisUtils redisUtils;
@Autowired
private HuaweiInterfaseService huaweiInterfaseService;
private UserRolesService userRolesService;
/**
* 根据用户CODE查询用户信息
*
*
* @param requestBean
* @param errors
* @return
......@@ -88,7 +101,7 @@ public class UserController {
/**
* 注册用户信息
*
*
* @param requestBean
* @param errors
* @return
......@@ -127,199 +140,231 @@ public class UserController {
@ResponseBody
@RequestMapping("/login")
public ResponseBean login(HttpServletRequest request, RequestBean requestBean) {
long startTime = System.nanoTime();
ResponseBean responseBean = new ResponseBean();
String message = userService.validate(requestBean);
LoginBean loginBean = requestBean.getObjectBean(LoginBean.class);
message = userService.validate(loginBean);
String message = userService.validate(loginBean);
String userIp = StringUtils.isEmpty(loginBean.getClientip()) ? Util.getOnlineIP(request) : loginBean.getClientip();
System.out.println("[UserController login IP]" + userIp);
if (message == null) {
LoginUserEntity userEntity = userService.findUserByLoginName(loginBean);
if(userEntity == null){// 查询不到用户信息
LoginIpInfo loginIpInfo = userService.findByIp(userIp);
String redisUsername = redisUtils.get(loginBean.getLoginName(), indexDb);
if (loginIpInfo != null) {
responseBean.setStatus(ErrorCode.STATUS_CODE_4102);
responseBean.setMessage("用户名不存在");
System.out.println("IP地址已被锁定");
responseBean.setMessage("IP地址已被锁定");
long endTime = System.nanoTime();
long duration = endTime - startTime;
LOG.debug("[UserController login][STATUS_CODE_4102]总共用时:"+Util.getDurationTime(duration));
System.out.println("[UserController login][STATUS_CODE_4102]总共用时:" + Util.getDurationTime(duration));
return responseBean;
} else if (GConstants.NO.equals(userEntity.getLoginFlag())) {// 用户被查封
}
String blackUsername = redisUtils.get("black_username:" + loginBean.getLoginName(), indexDb);
boolean sealup = false;
if (null != redisUsername && Integer.parseInt(redisUsername) >= usernameLimitTimes && StringUtils.isEmpty(blackUsername)) {
System.out.println("加入黑名单");
redisUtils.set("black_username:" + loginBean.getLoginName(), 1, indexDb);
redisUtils.expire("black_username:" + loginBean.getLoginName(), blackUsernameTime, indexDb);
sealup = true;
} else if (blackUsername != null) {
sealup = true;
}
if (sealup) {
System.out.println("账号已被锁定");
responseBean.setStatus(ErrorCode.STATUS_CODE_4101);
responseBean.setMessage("该帐号已禁止登录");
responseBean.setMessage("账号已被锁定");
checkIpLimit(userIp);
return responseBean;
}
LoginUserEntity userEntity = userService.findUserByLoginName(loginBean);
// 查询不到用户信息
if (userEntity == null) {
// 用户信息redis初始时间 增加value值
if (StringUtils.isEmpty(redisUsername)) {
redisUtils.set(loginBean.getLoginName(), 1, indexDb);
redisUtils.expire(loginBean.getLoginName(), usernameWithinSeconds, indexDb);
} else {
redisUtils.incrNotResetExpireTime(loginBean.getLoginName(), indexDb);
}
checkIpLimit(userIp);
responseBean.setStatus(ErrorCode.STATUS_CODE_4102);
responseBean.setMessage("账户或密码错误");
long endTime = System.nanoTime();
long duration = endTime - startTime;
LOG.info("[UserController login][STATUS_CODE_4102]总共用时:" + Util.getDurationTime(duration));
return responseBean;
// 用户被查封
} else if (GConstants.NO.equals(userEntity.getLoginFlag())) {
responseBean.setStatus(ErrorCode.STATUS_CODE_4101);
responseBean.setMessage("该帐号已禁止登录");
//判断ip限制
checkIpLimit(userIp);
long endTime = System.nanoTime();
long duration = endTime - startTime;
LOG.debug("[UserController login][STATUS_CODE_4101]总共用时:"+Util.getDurationTime(duration));
LOG.info("[UserController login][STATUS_CODE_4101]总共用时:" + Util.getDurationTime(duration));
return responseBean;
} else if (!"2".equals(userEntity.getUserType()) && !"4".equals(userEntity.getUserType()) && !"6".equals(userEntity.getUserType())) { //不是内部联系人 通讯录联系人不允许登陆
//不是内部联系人 通讯录联系人不允许登陆
} else if (!"2".equals(userEntity.getUserType()) && !"4".equals(userEntity.getUserType()) && !"6".equals(userEntity.getUserType())) {
responseBean.setStatus(ErrorCode.STATUS_CODE_4101);
responseBean.setMessage("当前用户类型不允许登陆,请联系系统管理员");
//判断ip限制
checkIpLimit(userIp);
long endTime = System.nanoTime();
long duration = endTime - startTime;
LOG.debug("[UserController login][STATUS_CODE_4101]总共用时:"+Util.getDurationTime(duration));
LOG.info("[UserController login][STATUS_CODE_4101]总共用时:" + Util.getDurationTime(duration));
return responseBean;
}
boolean passwordError = false;
//只开放几个测试账号密码验证走数据库,其他的通过首航接口去验证
// if((loginBean.getLoginName().equals("hwss1") || loginBean.getLoginName().equals("hwss2") || loginBean.getLoginName().equals("tianyz") || loginBean.getLoginName().equals("wangzl") || loginBean.getLoginName().equals("wtfk1") || loginBean.getLoginName().equals("test001") || loginBean.getLoginName().equals("test002"))){
if("6".equals(userEntity.getUserType())){
if(!Util.validatePassword(loginBean.getPassword(), userEntity.getPassword())){
if ("6".equals(userEntity.getUserType())) {
if (!Util.validatePassword(loginBean.getPassword(), userEntity.getPassword())) {
passwordError = true;
}
}else{
if (!userService.validateServerPassword(loginBean)){
} else {
if (!userService.validateServerPassword(loginBean)) {
passwordError = true;
}
}
if (passwordError){
if (passwordError) {
responseBean.setStatus(ErrorCode.STATUS_CODE_4103);
responseBean.setMessage("用户名密码不匹配!");
System.out.println("账户或密码错误");
responseBean.setMessage("账户或密码错误");
// 用户信息redis初始时间 增加value值
if (StringUtils.isEmpty(redisUsername)) {
System.out.println("账户错误初始化");
redisUtils.set(loginBean.getLoginName(), 1, indexDb);
redisUtils.expire(loginBean.getLoginName(), usernameWithinSeconds, indexDb);
} else {
System.out.println("账户错误加1");
redisUtils.incrNotResetExpireTime(loginBean.getLoginName(), indexDb);
}
checkIpLimit(userIp);
long endTime = System.nanoTime();
long duration = endTime - startTime;
LOG.debug("[UserController login][STATUS_CODE_4103]总共用时:"+Util.getDurationTime(duration));
LOG.info("[UserController login][STATUS_CODE_4103]总共用时:" + Util.getDurationTime(duration));
return responseBean;
} else {
if(StringUtils.isNotBlank(loginBean.getVerifyCode())){// 校验码登录
// 校验码登录
if (StringUtils.isNotBlank(loginBean.getVerifyCode())) {
MobileVerifyEntity entity = mobileVerifyService.getVerifyCode(loginBean.getLoginName(), loginBean.getVerifyCode());
if(entity == null){// 校验码不存在
// 校验码不存在
if (entity == null) {
responseBean.setStatus(ErrorCode.STATUS_CODE_4104);
responseBean.setMessage("校验码错误");
//判断ip限制
checkIpLimit(userIp);
long endTime = System.nanoTime();
long duration = endTime - startTime;
LOG.debug("[UserController login][STATUS_CODE_4104]总共用时:"+Util.getDurationTime(duration));
LOG.info("[UserController login][STATUS_CODE_4104]总共用时:" + Util.getDurationTime(duration));
return responseBean;
} else if(entity.getExpireTime().getTime()>System.currentTimeMillis()){// 校验码已经失效
// 校验码已经失效
} else if (entity.getExpireTime().getTime() > System.currentTimeMillis()) {
redisUtils.del(loginBean.getLoginName(), indexDb);
responseBean.setStatus(ErrorCode.STATUS_CODE_4105);
responseBean.setMessage("校验码已失效");
//判断ip限制
checkIpLimit(userIp);
long endTime = System.nanoTime();
long duration = endTime - startTime;
LOG.debug("[UserController login][STATUS_CODE_4105]总共用时:"+Util.getDurationTime(duration));
LOG.info("[UserController login][STATUS_CODE_4105]总共用时:" + Util.getDurationTime(duration));
return responseBean;
}
mobileVerifyService.updateVerifyCodeStatus(loginBean.getLoginName(), loginBean.getVerifyCode(), 1);// 修改验证码使用状态
// 修改验证码使用状态
mobileVerifyService.updateVerifyCodeStatus(loginBean.getLoginName(), loginBean.getVerifyCode(), 1);
}
String clientip = StringUtils.isEmpty(loginBean.getClientip()) ? Util.getOnlineIP(request) : loginBean.getClientip();
// UserLoginInfoEntity loginInfo = new UserLoginInfoEntity();
// loginInfo.setUserId(userEntity.getId());
// loginInfo.setLoginDate(new Date());
// loginInfo.setLoginIp(clientip);
redisUtils.del(loginBean.getLoginName(), indexDb);
redisUtils.del(userIp, indexDb);
UserLoginLogEntity deviceInfoEntity = new UserLoginLogEntity();
deviceInfoEntity.setUserId(userEntity.getId());
deviceInfoEntity.setLoginDate(new Date());
deviceInfoEntity.setLoginIp(clientip);
// deviceInfoEntity.setUserId(userEntity.getId());
deviceInfoEntity.setLoginIp(userIp);
deviceInfoEntity.setAppCode(loginBean.getAppCode());
deviceInfoEntity.setAppkey(loginBean.getAppkey());
deviceInfoEntity.setClientip(clientip);
deviceInfoEntity.setClientip(userIp);
deviceInfoEntity.setDeviceToken(loginBean.getDeviceToken());
deviceInfoEntity.setPlatform(loginBean.getPlatform());
deviceInfoEntity.setVersion(loginBean.getVersionName());
deviceInfoEntity.setDeviceName(loginBean.getDeviceName());
userService.updateUserLoginInfo(deviceInfoEntity);// 记录用户最新登录信息
userService.updateUserDeviceInfo(deviceInfoEntity);// 保存登录的设备信息,用于推送
userService.addLoginLog(deviceInfoEntity);// 添加登录日志
// 记录用户最新登录信息
userService.updateUserLoginInfo(deviceInfoEntity);
// 保存登录的设备信息,用于推送
userService.updateUserDeviceInfo(deviceInfoEntity);
// 添加登录日志
userService.addLoginLog(deviceInfoEntity);
SeatLoginBean seatloginBean = new SeatLoginBean();
seatloginBean.setUserId(userEntity.getId());
userService.updateUserSeatLoginEmpty(seatloginBean);// 先退出之前的席位登录状态
// 先退出之前的席位登录状态
userService.updateUserSeatLoginEmpty(seatloginBean);
List<String> seatIds = new ArrayList<>();
List<UserSeatEntity> userSeatList = userService.getUserSeatByUserCode(userEntity);
if(userSeatList != null && userSeatList.size()>0){// 用户拥有席位信息
for (int i = 0; i < userSeatList.size(); i ++) {
// 用户拥有席位信息
if (userSeatList != null && userSeatList.size() > 0) {
for (int i = 0; i < userSeatList.size(); i++) {
UserSeatEntity seat = userSeatList.get(i);
seatIds.add(seat.getSeatId());
if(StringUtils.isEmpty(seat.getPhoto())){
seat.setPhoto(GConstants.DEFAULT_SEAT_PHOTO);// 设置默认头像
if (StringUtils.isEmpty(seat.getPhoto())) {
// 设置默认头像
seat.setPhoto(GConstants.DEFAULT_SEAT_PHOTO);
}
seat.setPhoto(Util.getAbsoluteUrl(seat.getPhoto()));
seat.setHuaweiUCAccount(Util.getUcAccount(seat.getSeatId()));
seat.setHuaweiUCPassword(seat.getSeatId().length() > 1 ? seat.getSeatId().substring(0,2) + "@foc2016" : String.format("%02d", seat.getSeatId()) + "@foc2016");
seat.setHuaweiUCPassword(seat.getSeatId().length() > 1 ? seat.getSeatId().substring(0, 2) + "@foc2016" : String.format("%02d", seat.getSeatId()) + "@foc2016");
}
long queryStartTime = System.nanoTime();
// List<UserState> seatStates = huaweiInterfaseService.queryUserStateList(seatIds);
// long queryEndTime = System.nanoTime();
// long duration = queryEndTime - queryStartTime;
// LOG.debug("[UserService login][queryUserStateList]总共用时:" + Util.getDurationTime(duration));
// if (seatStates != null && seatStates.size()>0) {
// for (UserSeatEntity entityTmp : userSeatList) {
// for (UserState stateTmp : seatStates) {
// if (entityTmp.getSeatId().equals(stateTmp.getOrigin())) {
// entityTmp.setCurState(String.valueOf(stateTmp.getNewState()));
// break;
// }
// }
// if(Util.isInValue(entityTmp.getCurState(), "1", "3", "4") == false){// 用户不在线
//
// entityTmp.setPhoto(Util.getAbsoluteUrl(GConstants.DEFAULT_SEAT_PHOTO));
// }
// }
// }
userEntity.setUserSeatList(userSeatList);
}
// String officeFullName = officedService.findFullName("b67a017f66a24a3986a9ebd00714b17c");
// if(StringUtils.isNotBlank(userEntity.getOfficeId())){// 设置用户部门全程
// String officeFullName = officedService.findFullName(userEntity.getOfficeId());
// if(officeFullName != null){
// String[] species = officeFullName.split("-");
// if(species.length>0){
// userEntity.setOfficeName(species[species.length - 1]);
// }
// userEntity.setOfficeFullName(officeFullName);
// }
// }
userEntity.setPhoto(Util.getAbsoluteUrl(userEntity.getPhoto()));// 设置用户头像
if(userEntity.getHuaweiStatus() == 1 &&
StringUtils.isNotBlank(userEntity.getHuaweiNum())){// 该用户用于华为账号
// 设置用户头像
userEntity.setPhoto(Util.getAbsoluteUrl(userEntity.getPhoto()));
// 该用户用于华为账号
if (userEntity.getHuaweiStatus() == 1 &&
StringUtils.isNotBlank(userEntity.getHuaweiNum())) {
userEntity.setHuaweiUCAccount(Util.getUcAccount(userEntity.getId()));
userEntity.setHuaweiUCPassword(userEntity.getId().length() > 1 ? userEntity.getId().substring(0,2) + "@foc2016" : String.format("%02d", userEntity.getId()) + "@foc2016");
} else{
userEntity.setHuaweiUCPassword(userEntity.getId().length() > 1 ? userEntity.getId().substring(0, 2) + "@foc2016" : String.format("%02d", userEntity.getId()) + "@foc2016");
} else {
userEntity.setHuaweiStatus(0);
}
List<JSONObject> permissionList =new ArrayList<JSONObject>();
if("FOCJZZD".equals(loginBean.getPermission())){// 机组转单权限设置,树形格式
permissionList = userRolesService.getList(userEntity.getId(),loginBean.getPermission());// 获取用户权限列表信息
} else{// 一期权限格式,MAP格式
List<JSONObject> permissionList = new ArrayList<JSONObject>();
// 机组转单权限设置,树形格式
if ("FOCJZZD".equals(loginBean.getPermission())) {
permissionList = userRolesService.getList(userEntity.getId(), loginBean.getPermission());// 获取用户权限列表信息
} else {
// 一期权限格式,MAP格式
List<UserRolesEntity> permiss = userRolesService.getUserPermissionList(userEntity.getId());
for(UserRolesEntity role:permiss){
JSONObject json=new JSONObject();
for (UserRolesEntity role : permiss) {
JSONObject json = new JSONObject();
json.put("permission", role.getPermission());
json.put("menuName", role.getMenuName());
permissionList.add(json);
}
}
userEntity.setPermissionList(permissionList);
UserRolesBean bean =new UserRolesBean();
UserRolesBean bean = new UserRolesBean();
bean.setUserCode(userEntity.getId());
userEntity.setVerify("0");// 默认有航线论证权限(0表示有航线论证权限,1是没有)
List<InformationEntity> informationEntity= userRolesService.getInformation( bean);
if(informationEntity==null || informationEntity.size()==0){// 获取航线论证的部门信息
userEntity.setVerify("1");// 无航向论证权限
// 默认有航线论证权限(0表示有航线论证权限,1是没有)
userEntity.setVerify("0");
List<InformationEntity> informationEntity = userRolesService.getInformation(bean);
// 获取航线论证的部门信息
if (informationEntity == null || informationEntity.size() == 0) {
// 无航向论证权限
userEntity.setVerify("1");
}
userEntity.setShowPhone(userEntity.getPhone());
userEntity.setPhone(Util.formatedWorkPhone(userEntity.getPhone()));
responseBean.setData(userEntity);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
long endTime = System.nanoTime();
long duration = endTime - startTime;
LOG.debug("[UserController login][STATUS_CODE_2000]总共用时:"+Util.getDurationTime(duration));
LOG.debug("[UserController login][STATUS_CODE_2000]总共用时:" + Util.getDurationTime(duration));
return responseBean;
}
}
......@@ -327,19 +372,20 @@ public class UserController {
responseBean.setMessage(message);
return responseBean;
}
public boolean sendVerifyCode(String telephone, String verifyCode) {
try {
HCFetcher fetcher = HCFetcher.getInstance();
String message = "[首都航空]您的验证码为"+verifyCode+"[foc智能管控系统]";
String message = "[首都航空]您的验证码为" + verifyCode + "[foc智能管控系统]";
// message = URLDecoder.decode(message, "UTF-8");
FetchEntity entity = fetcher.post(GConstants.JDAIR_BASE_API+"/flightinterface/uss/json/mobile/messSend.json?"+GConstants.JDAIR_BASE_PARAM+"&mobile="+telephone+"&msg="+URLDecoder.decode(message, "UTF-8"), null);
if(entity.isSuccess()){
FetchEntity entity = fetcher.post(GConstants.JDAIR_BASE_API + "/flightinterface/uss/json/mobile/messSend.json?" + GConstants.JDAIR_BASE_PARAM + "&mobile=" + telephone + "&msg=" + URLDecoder.decode(message, "UTF-8"), null);
if (entity.isSuccess()) {
String resultStr = entity.getContent("utf-8");
if (resultStr != null) {// 成功获取数据
JSONObject result = JSON.parseObject(resultStr);// 解析JSON数据
String resultCode = result.getJSONObject("result").getString("resultCode");
if ("1000".equals(resultCode)) {// 判断 调用接口是否成功
return true;
}
}
......@@ -349,10 +395,10 @@ public class UserController {
}
return false;
}
/**
* 获取验证码
*
*
* @param request
* @param requestBean
* @return
......@@ -369,20 +415,20 @@ public class UserController {
// 生成4位验证码
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 4; i++) {
buf.append(String.valueOf(Util.getRandom(0, 9)));
}
// buf.setLength(0);
// buf.append("1234");// 测试的时候使用
if(this.sendVerifyCode(codeBean.getTelephone(), buf.toString())){// 成功发送添加校验码
if (this.sendVerifyCode(codeBean.getTelephone(), buf.toString())) {// 成功发送添加校验码
String clientip = StringUtils.isEmpty(codeBean.getClientip()) ? Util.getOnlineIP(request) : codeBean.getClientip();
MobileVerifyEntity entity = new MobileVerifyEntity();
entity.setAppCode(codeBean.getAppCode());
entity.setCreateTime(new Date());
entity.setExpireTime(new Date(entity.getCreateTime().getTime()+30*60*1000));
entity.setExpireTime(new Date(entity.getCreateTime().getTime() + 30 * 60 * 1000));
entity.setId(IdWorker.getNextId());
entity.setPlatform(codeBean.getPlatform());
entity.setStatus(0);
......@@ -390,9 +436,9 @@ public class UserController {
entity.setVerifyCode(buf.toString());
entity.setVersion(codeBean.getVersionName());
entity.setClientip(clientip);
mobileVerifyService.addVerifyCode(entity);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
return responseBean;
......@@ -406,7 +452,7 @@ public class UserController {
/**
* 席位登录 更新
*
*
* @param request
* @param requestBean
* @return
......@@ -419,7 +465,7 @@ public class UserController {
SeatLoginBean seatloginBean = requestBean.getObjectBean(SeatLoginBean.class);
message = userService.validate(seatloginBean);
if (message == null) {
// 一下代码只能在一端,席位还处于WEB端登录状态,不允许在APP上登录
/*
List<String> seatIds = new ArrayList<String>();
......@@ -497,11 +543,11 @@ public class UserController {
deviceInfoEntity.setPlatform(seatloginBean.getPlatform());
deviceInfoEntity.setVersion(seatloginBean.getVersionName());
deviceInfoEntity.setDeviceName(seatloginBean.getDeviceName());
// userService.updateUserLoginInfo(deviceInfoEntity);// 记录用户最新登录信息
// userService.updateUserDeviceInfo(deviceInfoEntity);// 保存登录的设备信息,用于推送
userService.addLoginLog(deviceInfoEntity);// 添加登录日志
// 更新登录数据,记录席位的最后登录用户ID
boolean isSuccess = userService.updateUserSeat(seatloginBean);
if (isSuccess) {
......@@ -516,13 +562,14 @@ public class UserController {
responseBean.setMessage(message);
return responseBean;
}
/**
* 修改用户头像
*
* @author renmb
* @time 2016年9月7日
*
* @param requestBean
* @return
* @author renmb
* @time 2016年9月7日
*/
@ResponseBody
@RequestMapping("/edit/photo")
......@@ -544,6 +591,7 @@ public class UserController {
responseBean.setMessage(message);
return responseBean;
}
@ResponseBody
@RequestMapping("/logout")
public ResponseBean logout(HttpServletRequest request, RequestBean requestBean) {
......@@ -552,8 +600,8 @@ public class UserController {
UserLogoutBean bean = requestBean.getObjectBean(UserLogoutBean.class);
message = userService.validate(bean);
if (message == null) {
if(StringUtils.isNotBlank(bean.getSeatId())){
if (StringUtils.isNotBlank(bean.getSeatId())) {
SeatLoginBean seatLoginBean = new SeatLoginBean();
seatLoginBean.setUserId(bean.getUserId());
......@@ -572,8 +620,8 @@ public class UserController {
userEntity.setUsercode(bean.getUserId());
User user = userService.getUserByUserCode(userEntity);
if(StringUtils.isNotEmpty(user.getMobile()) && StringUtils.isNotEmpty(seatMobileBean.getSeatMobile())){
if(!user.getMobile().equals(seatMobileBean.getSeatMobile())){
if (StringUtils.isNotEmpty(user.getMobile()) && StringUtils.isNotEmpty(seatMobileBean.getSeatMobile())) {
if (!user.getMobile().equals(seatMobileBean.getSeatMobile())) {
seatMobileBean.setSeatMobile(user.getMobile());
seatMobileBean.setSeatMobileNumber(Util.formatedMobile(user.getMobile()));
userService.updateUserSeatMobile(seatMobileBean);
......@@ -599,9 +647,9 @@ public class UserController {
// userService.updateUserLoginInfo(deviceInfoEntity);// 记录用户最新登录信息
// userService.updateUserDeviceInfo(deviceInfoEntity);// 保存登录的设备信息,用于推送
userService.addLoginLog(logoutDeviceInfoEntity);// 添加登录日志
// 退出后清空用户的设备信息
if(GConstants.getBoolean("is.clean.on.logout", false)){
if (GConstants.getBoolean("is.clean.on.logout", false)) {
// String clientip = Util.getOnlineIP(request);
// String clientip = StringUtils.isEmpty(bean.getClientip()) ? Util.getOnlineIP(request) : bean.getClientip();
UserLoginLogEntity deviceInfoEntity = new UserLoginLogEntity();
......@@ -612,7 +660,7 @@ public class UserController {
deviceInfoEntity.setDeviceToken("");
deviceInfoEntity.setPlatform("");
deviceInfoEntity.setVersion("");
userService.updateUserDeviceInfo(deviceInfoEntity);// 保存登录的设备信息,用于推送
}
responseBean.setMessage(GConstants.OK);
......@@ -676,14 +724,15 @@ public class UserController {
responseBean.setMessage(message);
return responseBean;
}
/**
* 获取用户最新信息
*
* @author renmb
* @time 2016年12月11日
*
* @param request
* @param requestBean
* @return
* @author renmb
* @time 2016年12月11日
*/
@ResponseBody
@RequestMapping("/refresh")
......@@ -693,15 +742,15 @@ public class UserController {
UserRefreshBean loginBean = requestBean.getObjectBean(UserRefreshBean.class);
message = userService.validate(loginBean);
if (message == null) {
LoginUserEntity userEntity = userService.findUserById(loginBean.getUserId());
if(userEntity == null){// 查询不到用户信息
if (userEntity == null) {// 查询不到用户信息
responseBean.setStatus(ErrorCode.STATUS_CODE_4102);
responseBean.setMessage("用户不存在");
return responseBean;
} else if (GConstants.NO.equals(userEntity.getLoginFlag())) {// 用户被查封
responseBean.setStatus(ErrorCode.STATUS_CODE_4101);
responseBean.setMessage("该已帐号禁止登录");
return responseBean;
......@@ -720,7 +769,7 @@ public class UserController {
// deviceInfoEntity.setDeviceToken(loginBean.getDeviceToken());
// deviceInfoEntity.setPlatform(loginBean.getPlatform());
// deviceInfoEntity.setVersion(loginBean.getVersionName());
UserLoginLogEntity deviceInfoEntity = new UserLoginLogEntity();
deviceInfoEntity.setUserId(userEntity.getId());
deviceInfoEntity.setLoginDate(new Date());
......@@ -733,28 +782,28 @@ public class UserController {
deviceInfoEntity.setPlatform(loginBean.getPlatform());
deviceInfoEntity.setVersion(loginBean.getVersionName());
deviceInfoEntity.setDeviceName(loginBean.getDeviceName());
userService.updateUserDeviceInfo(deviceInfoEntity);// 保存登录的设备信息,用于推送
boolean hashSeat = false;
List<String> seatIds = new ArrayList<>();
List<UserSeatEntity> userSeatList = userService.getUserSeatByUserCode(userEntity);
if(userSeatList != null && userSeatList.size()>0){// 用户拥有席位信息
for (int i = 0; i < userSeatList.size(); i ++) {
if (userSeatList != null && userSeatList.size() > 0) {// 用户拥有席位信息
for (int i = 0; i < userSeatList.size(); i++) {
UserSeatEntity seat = userSeatList.get(i);
if(!hashSeat && seat.getSeatId().equals(loginBean.getSeatId())){
if (!hashSeat && seat.getSeatId().equals(loginBean.getSeatId())) {
hashSeat = true;
}
seatIds.add(seat.getSeatId());
if(StringUtils.isEmpty(seat.getPhoto())){
if (StringUtils.isEmpty(seat.getPhoto())) {
seat.setPhoto(GConstants.DEFAULT_SEAT_PHOTO);// 设置默认头像
}
seat.setPhoto(Util.getAbsoluteUrl(seat.getPhoto()));
seat.setHuaweiUCAccount(Util.getUcAccount(seat.getSeatId()));
seat.setHuaweiUCPassword(seat.getSeatId().length() > 1 ? seat.getSeatId().substring(0,2) + "@foc2016" : String.format("%02d", seat.getSeatId()) + "@foc2016");
seat.setHuaweiUCPassword(seat.getSeatId().length() > 1 ? seat.getSeatId().substring(0, 2) + "@foc2016" : String.format("%02d", seat.getSeatId()) + "@foc2016");
}
// List<UserState> seatStates = huaweiInterfaseService.queryUserStateList(seatIds);
// if (seatStates != null && seatStates.size()>0) {
......@@ -773,13 +822,13 @@ public class UserController {
// }
userEntity.setUserSeatList(userSeatList);
}
if("SEAT".equals(loginBean.getLoginChannel())){// 当前用户是席位登录
if(hashSeat){// 有席位信息
if ("SEAT".equals(loginBean.getLoginChannel())) {// 当前用户是席位登录
if (hashSeat) {// 有席位信息
SeatLoginBean seatLoginBean = new SeatLoginBean();
seatLoginBean.setUserId(loginBean.getUserId());
seatLoginBean.setSeatId(loginBean.getSeatId());
userService.updateUserSeat(seatLoginBean);
} else {// 席位已经被删除或者禁止登陆
responseBean.setStatus(ErrorCode.STATUS_CODE_4301);
......@@ -787,37 +836,37 @@ public class UserController {
return responseBean;
}
}
userEntity.setPhoto(Util.getAbsoluteUrl(userEntity.getPhoto()));// 设置用户头像
if(userEntity.getHuaweiStatus() == 1 &&
StringUtils.isNotBlank(userEntity.getHuaweiNum())){// 该用户用于华为账号
if (userEntity.getHuaweiStatus() == 1 &&
StringUtils.isNotBlank(userEntity.getHuaweiNum())) {// 该用户用于华为账号
userEntity.setHuaweiUCAccount(Util.getUcAccount(userEntity.getId()));
userEntity.setHuaweiUCPassword(userEntity.getId().length() > 1 ? userEntity.getId().substring(0,2) + "@foc2016" : String.format("%02d", userEntity.getId()) + "@foc2016");
} else{
userEntity.setHuaweiUCPassword(userEntity.getId().length() > 1 ? userEntity.getId().substring(0, 2) + "@foc2016" : String.format("%02d", userEntity.getId()) + "@foc2016");
} else {
userEntity.setHuaweiStatus(0);
}
List<JSONObject> permissionList =new ArrayList<JSONObject>();
if("FOCJZZD".equals(loginBean.getPermission())){// 机组转单权限设置,树形格式
List<JSONObject> permissionList = new ArrayList<JSONObject>();
if ("FOCJZZD".equals(loginBean.getPermission())) {// 机组转单权限设置,树形格式
permissionList = userRolesService.getList(userEntity.getId(), loginBean.getPermission());// 获取用户权限列表信息
} else{// 一期权限格式,MAP格式
} else {// 一期权限格式,MAP格式
List<UserRolesEntity> permiss = userRolesService.getUserPermissionList(userEntity.getId());
for(UserRolesEntity role:permiss){
JSONObject json=new JSONObject();
for (UserRolesEntity role : permiss) {
JSONObject json = new JSONObject();
json.put("permission", role.getPermission());
json.put("menuName", role.getMenuName());
permissionList.add(json);
}
}
userEntity.setPermissionList(permissionList);
UserRolesBean bean =new UserRolesBean();
UserRolesBean bean = new UserRolesBean();
bean.setUserCode(userEntity.getId());
userEntity.setVerify("0");// 默认有航线论证权限(0表示有航线论证权限,1是没有)
List<InformationEntity> informationEntity= userRolesService.getInformation( bean);
if(informationEntity==null || informationEntity.size()==0){// 获取航线论证的部门信息
List<InformationEntity> informationEntity = userRolesService.getInformation(bean);
if (informationEntity == null || informationEntity.size() == 0) {// 获取航线论证的部门信息
userEntity.setVerify("1");// 无航向论证权限
}
userEntity.setShowPhone(userEntity.getPhone());
......@@ -831,14 +880,15 @@ public class UserController {
responseBean.setMessage(message);
return responseBean;
}
/**
* 新版本登录测试(仅限于测试使用不用于生成使用)
*
* @author renmb
* @time 2017年1月6日
*
* @param request
* @param requestBean
* @return
* @author renmb
* @time 2017年1月6日
*/
@ResponseBody
@RequestMapping("/newLogin")
......@@ -849,17 +899,17 @@ public class UserController {
LoginBean loginBean = requestBean.getObjectBean(LoginBean.class);
message = userService.validate(loginBean);
if (message == null) {
boolean status = HTTPClientUtil.callLogin(loginBean.getLoginName(), loginBean.getPassword());
if(status){
if (status) {
LoginUserEntity userEntity = userService.findUserByLoginName(loginBean);
responseBean.setData(userEntity);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
return responseBean;
} else{
} else {
responseBean.setData(status);
responseBean.setMessage("登录失败");
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
......@@ -870,14 +920,15 @@ public class UserController {
responseBean.setMessage(message);
return responseBean;
}
/**
* 验证海航员工密码接口
*
* @author renmb
* @time 2017年1月6日
*
* @param request
* @param requestBean
* @return
* @author renmb
* @time 2017年1月6日
*/
@ResponseBody
@RequestMapping("/haihangLogin")
......@@ -888,17 +939,17 @@ public class UserController {
LoginBean loginBean = requestBean.getObjectBean(LoginBean.class);
message = userService.validate(loginBean);
if (message == null) {
boolean status = userService.validateServerPassword(loginBean);
if(status){
if (status) {
LoginUserEntity userEntity = userService.findUserByLoginName(loginBean);
responseBean.setData(userEntity);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
return responseBean;
} else{
} else {
responseBean.setData(status);
responseBean.setMessage("登录失败");
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
......@@ -909,14 +960,15 @@ public class UserController {
responseBean.setMessage(message);
return responseBean;
}
/**
* 修改用户的席位电话
*
* @author renmb
* @time 2017年1月18日
*
* @param request
* @param requestBean
* @return
* @author renmb
* @time 2017年1月18日
*/
@ResponseBody
@RequestMapping("/edit/seat/mobile")
......@@ -929,13 +981,13 @@ public class UserController {
if (message == null) {
String seatMobilePhone = "";
//修改允许席位手机号为空,如果为空,则修改席位手机号为用户手机号
if(StringUtils.isEmpty(loginBean.getSeatMobile())){
if (StringUtils.isEmpty(loginBean.getSeatMobile())) {
UserEntity userEntity = new UserEntity();
userEntity.setUsercode(loginBean.getUserId());
User user = userService.getUserByUserCode(userEntity);
seatMobilePhone = user.getMobile();
}
if(StringUtils.isNotEmpty(seatMobilePhone)){
if (StringUtils.isNotEmpty(seatMobilePhone)) {
loginBean.setSeatMobile(seatMobilePhone);
loginBean.setSeatMobileNumber(Util.formatedMobile(seatMobilePhone));
userService.updateUserSeatMobile(loginBean);
......@@ -950,49 +1002,121 @@ public class UserController {
responseBean.setMessage(message);
return responseBean;
}
/**
* 更新外部联系人手机号、座机号
*
* @author zhanglg
* @time 2017年2月22日
*
* @param requestBean
* @return
* @author zhanglg
* @time 2017年2月22日
*/
@ResponseBody
@RequestMapping(value = "/edit/outerUser")
public ResponseBean updateOuterUser(RequestBean requestBean){
public ResponseBean updateOuterUser(RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean();
OuterUserBean bean = requestBean.getObjectBean(OuterUserBean.class);
String message = userService.validate(bean);
if(message == null){// 校验通过
if (message == null) {// 校验通过
LoginUserEntity entity = userService.findUserById(bean.getUserCode());
if(entity==null){
responseBean.setMessage("用户不存在");
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}else{
if(!"3".equals(entity.getUserType())){
responseBean.setMessage("非外部用不允许修改");
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
}
if(StringUtils.isBlank(bean.getPhone())){
bean.setPhone(entity.getPhone());
}
if(StringUtils.isBlank(bean.getMobile())){
bean.setMobile(entity.getMobile());
}
userService.updateOuterUser(bean);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
return responseBean;
if (entity == null) {
responseBean.setMessage("用户不存在");
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
} else {
if (!"3".equals(entity.getUserType())) {
responseBean.setMessage("非外部用不允许修改");
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
}
if (StringUtils.isBlank(bean.getPhone())) {
bean.setPhone(entity.getPhone());
}
if (StringUtils.isBlank(bean.getMobile())) {
bean.setMobile(entity.getMobile());
}
userService.updateOuterUser(bean);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
return responseBean;
}
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
private void checkIpLimit(String userIp) {
//如果redis没有key
if (redisUtils.get(userIp, indexDb) == null) {
System.out.println("ip错误初始化");
redisUtils.set(userIp, 1, indexDb);
//设置过期时间
redisUtils.expire(userIp, ipWithinSeconds, indexDb);
} else {
System.out.println("ip错误自增");
//如果存在key
redisUtils.incrNotResetExpireTime(userIp, indexDb);
if (Integer.valueOf(redisUtils.get(userIp, indexDb)) >= ipLimitTimes) {
redisUtils.del(userIp, indexDb);
userService.insertInfoByIp(userIp);
}
}
}
@RequestMapping(value = "/edit/export")
public void exportFile(HttpServletRequest request, HttpServletResponse response) throws IOException {
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("信息表");
List<UserExport> classmateList = userService.findListUser();
// 设置要导出的文件的名字
String fileName = "users" + new Date() + ".xls";
// 新增数据行,并且设置单元格数据
int rowNum = 1;
// headers表示excel表中第一行的表头 在excel表中添加表头
String[] headers = {"归属公司", "归属部门", "登录名", "姓名", "邮箱", "电话", "手机"};
HSSFRow row = sheet.createRow(0);
for (int i = 0; i < headers.length; i++) {
HSSFCell cell = row.createCell(i);
HSSFRichTextString text = new HSSFRichTextString(headers[i]);
cell.setCellValue(text);
}
//在表中存放查询到的数据放入对应的列
for (UserExport item : classmateList) {
HSSFRow row1 = sheet.createRow(rowNum);
row1.createCell(0).setCellValue(item.getCompany());
row1.createCell(1).setCellValue(item.getOffice());
row1.createCell(2).setCellValue(item.getLoginName());
row1.createCell(3).setCellValue(item.getName());
row1.createCell(4).setCellValue(item.getEmail());
row1.createCell(5).setCellValue(item.getPhone());
row1.createCell(6).setCellValue(item.getMobile());
rowNum++;
}
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
workbook.write(os);
byte[] bytes = os.toByteArray();
response.reset();
response.setContentType("application/msexcel;charset=utf-8");
response.setHeader("Content-disposition", "attachment;filename= " + fileName);
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "*");
response.addHeader("Access-Control-Allow-Headers", "*");
response.getOutputStream().write(bytes);
response.getOutputStream().flush();
//response.getOutputStream().close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
......@@ -17,6 +17,7 @@ public class LoginBean extends GenericBean {
private String verifyCode;
private String permission;
private String clientip;
private String userIp;
public String getPermission() {
return permission;
......@@ -58,4 +59,11 @@ public class LoginBean extends GenericBean {
this.clientip = clientip;
}
public String getUserIp() {
return userIp;
}
public void setUserIp(String userIp) {
this.userIp = userIp;
}
}
package com.ejweb.modules.user.bean;
import java.util.Date;
/**
* 登录Ip信息
*
* @author zangtao
* @create 2019 - 09 -24 10:06
*/
public class LoginIpInfo {
private Integer id;
private String blackIp;
private Date createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getBlackIp() {
return blackIp;
}
public void setBlackIp(String blackIp) {
this.blackIp = blackIp;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
......@@ -10,6 +10,7 @@ import com.ejweb.modules.user.bean.*;
import com.ejweb.modules.user.entity.*;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -101,4 +102,9 @@ public interface UserDao extends CurdDao<UserEntity> {
public void updateOuterUser(OuterUserBean bean);
List<UserLoginLogEntity> findUserLoginLogList(UserLoginLogEntity userLoginLogEntity);
LoginIpInfo findByIp(@Param("userIp") String userIp);
void insertInfoByIp(@Param("userIp") String userIp ,@Param("date") Date date);
List<UserExport> findListUser();
}
/**
* Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.ejweb.modules.user.entity;
import com.ejweb.core.base.BaseEntity;
import java.util.Date;
/**
* 用户Entity
* @author ThinkGem
* @version 2013-12-05
*/
public class UserExport extends BaseEntity {
private static final long serialVersionUID = 1L;
private String company; // 归属公司
private String office; // 归属部门
private String loginName;// 登录名
private String password;// 密码
private String no; // 工号
private String name; // 姓名
private String email; // 邮箱
private String phone; // 电话
private String mobile; // 手机
private String mobileNubmer; // 手机
private String userType;// 用户类型
private String loginIp; // 最后登陆IP
private String loginDate; // 最后登陆日期
private String loginFlag; // 是否允许登陆
private String photo; // 头像
private String oldLoginName;// 原登录名
private String newPassword; // 新密码
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getOffice() {
return office;
}
public void setOffice(String office) {
this.office = office;
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getMobileNubmer() {
return mobileNubmer;
}
public void setMobileNubmer(String mobileNubmer) {
this.mobileNubmer = mobileNubmer;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
public String getLoginDate() {
return loginDate;
}
public void setLoginDate(String loginDate) {
this.loginDate = loginDate;
}
public String getLoginFlag() {
return loginFlag;
}
public void setLoginFlag(String loginFlag) {
this.loginFlag = loginFlag;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getOldLoginName() {
return oldLoginName;
}
public void setOldLoginName(String oldLoginName) {
this.oldLoginName = oldLoginName;
}
public String getNewPassword() {
return newPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
}
\ No newline at end of file
package com.ejweb.modules.user.entity;
import java.util.Date;
import com.ejweb.core.base.BaseEntity;
import com.ejweb.core.conf.GConstants;
import java.util.Date;
/**
* 用户详情扩展表 对应联系人列表功能
* @author lyw
......@@ -59,7 +59,7 @@ public class UserProfileEntity extends BaseEntity {
public void setLoginFlag(String loginFlag) {
this.loginFlag = loginFlag;
}
public String getId() {
return id;
}
......
......@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -658,4 +659,23 @@ public class UserService extends CurdService<UserDao, UserEntity> {
public List<UserLoginLogEntity> findUserLoginLogList(UserLoginLogEntity userLoginLogEntity) {
return dao.findUserLoginLogList(userLoginLogEntity);
}
/**
* 查找IP
*
* @param userIp
* @return
*/
public LoginIpInfo findByIp(String userIp) {
return dao.findByIp(userIp);
}
public void insertInfoByIp(String userIp) {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// String date = simpleDateFormat.format(new Date());
dao.insertInfoByIp(userIp,new Date());
}
public List<UserExport> findListUser() {
return dao.findListUser();
}
}
......@@ -206,6 +206,7 @@ public class AirlineVerifiedAddBean extends GenericBean {
public class Deport {
private String departId;
private String departName;
public String getDepartId() {
return departId;
......@@ -215,7 +216,13 @@ public class AirlineVerifiedAddBean extends GenericBean {
this.departId = departId;
}
public String getDepartName() {
return departName;
}
public void setDepartName(String departName) {
this.departName = departName;
}
}
public String getVerifNo() {
......
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