Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
首航-临时账号
api
Commits
f70d1a53
Commit
f70d1a53
authored
Nov 02, 2023
by
罗胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2023-11-12 罗胜
1.新增航线论证类型
parent
9a6ebd6b
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
1035 additions
and
151 deletions
+1035
-151
hutool-all-5.8.11.jar
WebContent/WEB-INF/lib/hutool-all-5.8.11.jar
+0
-0
jdbc.properties
resources/jdbc.properties
+1
-1
TypeDao.xml
resources/mapper/modules/aircraft/TypeDao.xml
+3
-0
OilAnalysisDao.xml
resources/mapper/modules/airport/OilAnalysisDao.xml
+21
-1
StatisticalDao.xml
resources/mapper/modules/airport/StatisticalDao.xml
+37
-0
DepartDao.xml
resources/mapper/modules/depart/DepartDao.xml
+3
-0
AirlineVerifyDao.xml
resources/mapper/modules/verify/AirlineVerifyDao.xml
+1
-1
RequestBean.java
src/com/ejweb/core/api/RequestBean.java
+25
-9
ErrorHandler.java
src/com/ejweb/core/exception/ErrorHandler.java
+18
-4
HCFetcher.java
src/com/ejweb/core/fetcher/HCFetcher.java
+2
-1
Util.java
src/com/ejweb/core/util/Util.java
+7
-5
ExportExcel.java
src/com/ejweb/core/utils/excel/ExportExcel.java
+71
-12
ImportExcel.java
src/com/ejweb/core/utils/excel/ImportExcel.java
+163
-6
TypeDao.java
src/com/ejweb/modules/aircraft/dao/TypeDao.java
+3
-0
OilAnalysisController.java
src/com/ejweb/modules/airport/api/OilAnalysisController.java
+34
-12
StatisticalController.java
src/com/ejweb/modules/airport/api/StatisticalController.java
+93
-20
OilBatchUpdateBean.java
src/com/ejweb/modules/airport/bean/OilBatchUpdateBean.java
+73
-0
StatisticalImportBean.java
src/com/ejweb/modules/airport/bean/StatisticalImportBean.java
+19
-0
OilAnalysisDao.java
src/com/ejweb/modules/airport/dao/OilAnalysisDao.java
+2
-0
StatisticalDao.java
src/com/ejweb/modules/airport/dao/StatisticalDao.java
+17
-0
OilAnalysisEntity.java
src/com/ejweb/modules/airport/entity/OilAnalysisEntity.java
+33
-31
StatisticalImportEntity.java
src/com/ejweb/modules/airport/entity/StatisticalImportEntity.java
+114
-0
OilAnalysisService.java
src/com/ejweb/modules/airport/service/OilAnalysisService.java
+9
-3
StatisticalService.java
src/com/ejweb/modules/airport/service/StatisticalService.java
+101
-1
PhoneAreaUtil.java
src/com/ejweb/modules/call/util/PhoneAreaUtil.java
+52
-28
DepartDao.java
src/com/ejweb/modules/depart/dao/DepartDao.java
+2
-1
FlightCrewListEntity.java
src/com/ejweb/modules/flight/entity/FlightCrewListEntity.java
+22
-1
AirCarrierService.java
src/com/ejweb/modules/flight/service/AirCarrierService.java
+60
-0
FlightService.java
src/com/ejweb/modules/flight/service/FlightService.java
+9
-6
UserController.java
src/com/ejweb/modules/user/api/UserController.java
+2
-0
UserService.java
src/com/ejweb/modules/user/service/UserService.java
+35
-6
RecordChangeVerifyController.java
src/com/ejweb/modules/verify/api/RecordChangeVerifyController.java
+1
-1
AirlineVerifyService.java
src/com/ejweb/modules/verify/service/AirlineVerifyService.java
+2
-1
No files found.
WebContent/WEB-INF/lib/hutool-all-5.8.11.jar
0 → 100644
View file @
f70d1a53
File added
resources/jdbc.properties
View file @
f70d1a53
...
...
@@ -13,7 +13,7 @@ jdbc.maxActive=20
jdbc.maxIdle
=
100
#\u6ca1\u6709\u4eba\u7528\u8fde\u63a5\u7684\u65f6\u5019\uff0c\u6700\u5c0f\u95f2\u7f6e\u7684\u8fde\u63a5\u4e2a\u6570\u3002
jdbc.minIdle
=
0
#\u8d85\u65f6\u7b49\u5f85\u65f6\u95f4\u4ee5\u6beb
\u79d2\u4e3a\u5355\u4f4d
#\u8d85\u65f6\u7b49\u5f85\u65f6\u95f4\u4ee5\u6beb
/api/ac\u79d2\u4e3a\u5355\u4f4d
jdbc.maxWait
=
10000
#\u662f\u5426\u81ea\u52a8\u56de\u6536\u8d85\u65f6\u8fde\u63a5
jdbc.removeAbandoned
=
true
...
...
resources/mapper/modules/aircraft/TypeDao.xml
View file @
f70d1a53
...
...
@@ -33,4 +33,6 @@
WHERE a.del_flag = '0'
AND a.parent_id != '1' AND a.parent_id != '0'
</select>
</mapper>
\ No newline at end of file
resources/mapper/modules/airport/OilAnalysisDao.xml
View file @
f70d1a53
...
...
@@ -13,6 +13,24 @@
</if>
where id=#{id}
</update>
<update
id=
"updateRemarkAndConclusion"
>
update foc_flight_dynamics_sta sta
set sta.extra_oil_conclusion=#{conclusion} ,
sta.remark=#{bean.remark}
where sta.total_oil !=''
and sta.std
<![CDATA[>=]]>
date_format(#{bean.minDepTime}, '%Y-%c-%d %H:%i')
and sta.std
<![CDATA[<]]>
date_format(#{bean.maxDepTime}, '%Y-%c-%d %H:%i')
<choose>
<when
test=
"bean.conclusion == '暂无原因'"
>
and ( substring_index( sta.extra_oil_fuel_reason_new, ':',- 1 ) is null or substring_index( sta.extra_oil_fuel_reason_new, ':',- 1 ) = '')
</when>
<otherwise>
and substring_index( sta.extra_oil_fuel_reason_new, ':',- 1 ) like CONCAT('%',#{bean.extraOilReason},'%')
</otherwise>
</choose>
</update>
<select
id=
"getExcelOilAnalysisData1"
resultType=
"com.ejweb.modules.airport.entity.OilAnalysisEntity"
>
select DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i')as std,
DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i:%s')as stdExcel,
...
...
@@ -432,7 +450,7 @@
select temp.ac_type_name,
TRUNCATE(avg(IFNULL(rate, 0)), 2) as rate,
TRUNCATE(AVG(IFNULL(temp.plan_left_over, 0)), 2) as plan_left_over,
TRUNCATE(AVG(IFNULL(temp.
left_over_oil_target
, 0)), 2)
TRUNCATE(AVG(IFNULL(temp.
extra
, 0)), 2)
as avg_left_over_oil
from (SELECT DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i') AS std,
sta.id,
...
...
@@ -444,6 +462,7 @@
TRUNCATE(((2 - ifnull(plan.plan_left_over, 0) / ifnull(loo.left_over_oil_target, 0))) * 100,
2) as rate,
loo.left_over_oil_target,
plan.extra,
loo.ac_type
FROM foc_flight_dynamics_sta sta
LEFT JOIN foc_flight_plan plan ON sta.id = plan.dynamics_sta_id
...
...
@@ -531,6 +550,7 @@
select ac_type,left_over_oil_target from foc_left_over_oil_target where year=YEAR(now()) group by ac_type,month
</select>
<!--已不用-->
<!--
<select id="getOilAnalysisData" resultType="com.ejweb.modules.airport.entity.OilAnalysisEntity">
...
...
resources/mapper/modules/airport/StatisticalDao.xml
View file @
f70d1a53
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ejweb.modules.airport.dao.StatisticalDao"
>
<insert
id=
"insertAirlineVerify"
>
insert into foc_airline_verify
(id,verif_no,verif_type,verif_status,create_by,create_date,del_flag,route_no,depIata,arrIata,state,source,create_time
,aircraft_type,depart_id,update_by,update_date)
values
(#{id},#{verifNo},#{verifType},'02',#{userCode},now(),0,#{routeNo},#{depIata},#{arrIata},#{state},'1',now(),#{acTypeId},#{departId},#{userCode},now())
</insert>
<insert
id=
"insertAirlineConnect"
>
insert into foc_airline_connect
(id,verif_id,del_flag,depIata,arrIata,Is_main,create_date)
values
(#{id1},#{verifyId},0,#{depIata},#{arrIata},'1',now())
</insert>
<insert
id=
"insertAirlineVerifyType"
>
insert into foc_airline_verify2type
(id,verif_id,type_id,create_by,create_date,del_flag)
values
(#{id},#{verifyId},#{acTypeId},#{userCode},now(),0)
</insert>
<select
id=
"getStatisticalList"
resultType=
"com.ejweb.modules.airport.entity.StatisticalEntity"
>
SELECT a.verif_no as verifNo,
a.id as verifId,
...
...
@@ -233,4 +257,16 @@
FROM
foc_check_iata
</select>
<select
id=
"findIdByAcType"
resultType=
"java.lang.String"
>
select id from foc_aircraft_type where type_name=#{acType}
</select>
<select
id=
"getDepartIdByUserId"
resultType=
"java.lang.String"
>
select depart_id from sys_user_profiles where user_id = #{userId}
</select>
<select
id=
"findVerifyByVerifyNoAndRouteNo"
resultType=
"java.lang.Integer"
>
select count(1) from foc_airline_verify where verif_no=#{verifNo} and route_no=#{routeNo} and del_flag=0
</select>
</mapper>
\ No newline at end of file
resources/mapper/modules/depart/DepartDao.xml
View file @
f70d1a53
...
...
@@ -73,4 +73,6 @@
<select
id=
"getDepartIdByUserId"
resultType=
"java.lang.String"
>
select depart_id from sys_user_profiles where user_id = #{userId}
</select>
</mapper>
\ No newline at end of file
resources/mapper/modules/verify/AirlineVerifyDao.xml
View file @
f70d1a53
...
...
@@ -237,7 +237,7 @@ union (SELECT apply_no,create_time AS create_date
AND del_flag = '0')
) a
order by
create_date
desc
order by
apply_no
desc
LIMIT 1
</select>
<update
id=
"updateNo"
>
...
...
src/com/ejweb/core/api/RequestBean.java
View file @
f70d1a53
package
com
.
ejweb
.
core
.
api
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.ClassUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ejweb.core.exception.CommonException
;
...
...
@@ -15,6 +17,7 @@ import java.util.List;
import
java.util.Set
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
/**
* 所有的接口请求实体类
...
...
@@ -56,21 +59,30 @@ public class RequestBean {
* @param clazz
* @return
*/
public
<
T
>
T
getObjectBean
(
Type
clazz
){
public
<
T
>
T
getObjectBean
(
Class
<
T
>
clazz
){
if
(
content
==
null
)
return
null
;
try
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
content
);
Set
<
String
>
keySet
=
jsonObject
.
keySet
();
if
(
keySet
.
contains
(
"sort"
))
{
String
sort
=
jsonObject
.
getString
(
"sort"
);
if
(
StringUtils
.
isNotBlank
(
sort
))
{
if
(
containsSqlInjection
(
sort
))
{
throw
new
CommonException
(
"sort参数有sql注入风险"
);
for
(
String
key
:
keySet
)
{
if
(
StringUtils
.
equalsIgnoreCase
(
key
,
"sort"
)){
String
sort
=
jsonObject
.
getString
(
key
);
if
(
StringUtils
.
isNotBlank
(
sort
))
{
if
(
containsSqlInjection
(
sort
))
{
throw
new
CommonException
(
"sort参数有sql注入风险"
);
}
}
}
}
return
JSON
.
parseObject
(
content
,
clazz
);
Class
<
Type
>
aClass
=
ClassUtil
.
getClass
(
clazz
);
System
.
out
.
println
(
"aClass = "
+
aClass
);
Class
<?>
aClass1
=
ClassUtil
.
getClassLoader
().
loadClass
(
clazz
.
getTypeName
());
System
.
out
.
println
(
"clazz.getTypeName() = "
+
clazz
.
getTypeName
());
String
str
=
JSONObject
.
toJSONString
(
jsonObject
);
return
BeanUtil
.
toBean
(
jsonObject
,
clazz
);
}
catch
(
CommonException
e
){
throw
new
CommonException
(
"sort参数有sql注入风险"
);
}
catch
(
Exception
e
)
{
...
...
@@ -87,8 +99,12 @@ public class RequestBean {
* @return
*/
public
static
boolean
containsSqlInjection
(
Object
obj
){
Pattern
pattern
=
Pattern
.
compile
(
"\\b(and|exec|insert|select|drop|grant|alter|delete|update|count|chr|mid|master|truncate|char|declare|or)\\b|(\\*|;|\\+|'|%)"
);
Matcher
matcher
=
pattern
.
matcher
(
obj
.
toString
().
toLowerCase
());
String
str
=
obj
.
toString
().
toLowerCase
();
if
(
StringUtils
.
contains
(
str
,
"Extractvalue(1,CONCAT(0x7e,Version()))"
)){
return
true
;
}
Pattern
pattern
=
Pattern
.
compile
(
"\\b(and|exec|insert|select|drop|grant|alter|delete|update|count|chr|mid|master|truncate|char|declare|or)\\b|(\\*|\\)|'|\"|--|;|\\+|\'|%)"
);
Matcher
matcher
=
pattern
.
matcher
(
str
);
return
matcher
.
find
();
}
...
...
src/com/ejweb/core/exception/ErrorHandler.java
View file @
f70d1a53
package
com
.
ejweb
.
core
.
exception
;
import
java.util.Date
;
import
java.util.Iterator
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ejweb.core.util.Util
;
import
com.ejweb.modules.user.service.UserService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.client.utils.DateUtils
;
import
org.apache.log4j.Logger
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
...
...
@@ -15,7 +22,6 @@ import com.ejweb.core.api.ResponseBean;
import
com.ejweb.core.conf.ErrorCode
;
import
com.ejweb.core.conf.GConstants
;
import
com.ejweb.core.util.EmailStackTraceHandler
;
import
com.ejweb.core.util.Util
;
/**
* 错误处理,抛出的异常会被这里截取,返回message
...
...
@@ -27,8 +33,10 @@ import com.ejweb.core.util.Util;
*/
@ControllerAdvice
(
annotations
={
Controller
.
class
,
RestController
.
class
})
public
class
ErrorHandler
{
@ExceptionHandler
Logger
logger
=
Logger
.
getLogger
(
ErrorHandler
.
class
);
private
final
static
Logger
LOG
=
Logger
.
getLogger
(
ErrorHandler
.
class
);
@ExceptionHandler
(
Exception
.
class
)
@ResponseBody
public
ResponseBean
handleException
(
HttpServletRequest
request
,
Exception
e
)
{
...
...
@@ -37,12 +45,18 @@ public class ErrorHandler {
try
{
e
.
printStackTrace
();
String
error
=
Util
.
getStackTrace
(
e
);
bean
.
setData
(
error
);
// bean.setData(error);
logger
.
error
(
"异常信息:{}"
,
e
);
System
.
out
.
println
(
"异常:"
+
JSONObject
.
toJSON
(
e
));
if
(
e
instanceof
RuntimeException
)
{
bean
.
setMessage
(
e
.
getMessage
());
}
else
{
bean
.
setMessage
(
e
.
toString
());
}
if
(
StringUtils
.
isBlank
(
bean
.
getMessage
())){
bean
.
setMessage
(
"系统异常"
);
}
LOG
.
error
(
DateUtils
.
formatDate
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
)+
"系统报错,发送的请求失败!报错"
+
error
);
if
(
GConstants
.
getBoolean
(
"is.send.error.mail"
,
false
)){
StringBuffer
buf
=
new
StringBuffer
();
Map
<?,?>
requestParams
=
request
.
getParameterMap
();
...
...
src/com/ejweb/core/fetcher/HCFetcher.java
View file @
f70d1a53
...
...
@@ -250,9 +250,11 @@ public class HCFetcher {
EntityUtils
.
consume
(
httpEntity
);
}
}
catch
(
IOException
e
)
{
LOG
.
error
(
"请求地址:"
+
url
+
"调用报错!信息返回:"
+
entity
.
getMessage
()+
",状态码:"
+
entity
.
getStatus
()+
",异常问题:"
+
e
.
getCause
());
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
LOG
.
error
(
"请求地址:"
+
url
+
"调用报错!信息返回:"
+
entity
.
getMessage
()+
",状态码:"
+
entity
.
getStatus
()+
",异常问题:"
+
e
.
getMessage
());
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
finally
{
...
...
@@ -273,7 +275,6 @@ public class HCFetcher {
}
}
public
FetchEntity
post
(
final
String
url
,
List
<
BasicNameValuePair
>
params
,
final
byte
[]
data
)
{
synchronized
(
mutex
)
{
long
currentTimeMillis
=
System
.
currentTimeMillis
();
...
...
src/com/ejweb/core/util/Util.java
View file @
f70d1a53
...
...
@@ -11,6 +11,7 @@ import com.ejweb.core.security.GlobalUtil;
import
com.ejweb.modules.call.util.PhoneAreaEntity
;
import
com.ejweb.modules.call.util.PhoneAreaUtil
;
import
com.ejweb.modules.im.entity.GroupEntity
;
import
com.huawei.esdk.uc.professional.local.constant.ResultCode
;
import
org.apache.commons.lang3.StringUtils
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -564,6 +565,8 @@ public class Util {
String
plain
=
Encodes
.
unescapeHtml
(
plainPassword
);
byte
[]
salt
=
Encodes
.
decodeHex
(
password
.
substring
(
0
,
16
));
byte
[]
hashPassword
=
Digests
.
sha1
(
plain
.
getBytes
(),
salt
,
GConstants
.
HASH_INTERATIONS
);
System
.
out
.
println
();
System
.
out
.
println
(
Encodes
.
encodeHex
(
hashPassword
));
return
password
.
equals
(
Encodes
.
encodeHex
(
salt
)
+
Encodes
.
encodeHex
(
hashPassword
));
}
catch
(
Exception
e
)
{
// TODO: handle exception
...
...
@@ -571,6 +574,9 @@ public class Util {
return
false
;
}
public
static
String
getGenericCode
()
{
try
{
return
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
).
toLowerCase
();
...
...
@@ -741,10 +747,6 @@ public class Util {
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
Util
.
validatePassword
(
"Hjwx#1234"
,
"247fd14c5d908a8312dc23e175e86c4f2e011fb76e08827cd65c962b"
));
System
.
out
.
println
(
phoneReg
(
"18501501226"
));
System
.
out
.
println
(
phoneReg
(
"018501501226"
));
System
.
out
.
println
(
phoneReg
(
"0018501501226"
));
System
.
out
.
println
(
phoneReg
(
"51018501501226"
));
System
.
out
.
println
(
Util
.
validatePassword
(
"1qaz@WSX"
,
"247fd14c5d908a8312dc23e175e86c4f2e011fb76e08827cd65c962b"
));
}
}
src/com/ejweb/core/utils/excel/ExportExcel.java
View file @
f70d1a53
...
...
@@ -9,15 +9,14 @@ import java.io.IOException;
import
java.io.OutputStream
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletResponse
;
import
cn.hutool.core.collection.CollUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ejweb.modules.airport.entity.StatisticalEntity
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.CellStyle
;
...
...
@@ -92,8 +91,10 @@ public class ExportExcel {
public
ExportExcel
(
String
title
,
Class
<?>
cls
,
int
type
,
int
...
groups
){
// Get annotation field
Field
[]
fs
=
cls
.
getDeclaredFields
();
for
(
Field
f
:
fs
){
ExcelField
ef
=
f
.
getAnnotation
(
ExcelField
.
class
);
System
.
out
.
println
(
"ef = "
+
ef
);
if
(
ef
!=
null
&&
(
ef
.
type
()==
0
||
ef
.
type
()==
type
)){
if
(
groups
!=
null
&&
groups
.
length
>
0
){
boolean
inGroup
=
false
;
...
...
@@ -118,6 +119,7 @@ public class ExportExcel {
Method
[]
ms
=
cls
.
getDeclaredMethods
();
for
(
Method
m
:
ms
){
ExcelField
ef
=
m
.
getAnnotation
(
ExcelField
.
class
);
System
.
out
.
println
(
"ef = "
+
ef
);
if
(
ef
!=
null
&&
(
ef
.
type
()==
0
||
ef
.
type
()==
type
)){
if
(
groups
!=
null
&&
groups
.
length
>
0
){
boolean
inGroup
=
false
;
...
...
@@ -138,15 +140,14 @@ public class ExportExcel {
}
}
}
System
.
out
.
println
(
111
);
// Field sorting
Collections
.
sort
(
annotationList
,
new
Comparator
<
Object
[]>()
{
public
int
compare
(
Object
[]
o1
,
Object
[]
o2
)
{
return
new
Integer
(((
ExcelField
)
o1
[
0
]).
sort
()).
compareTo
(
new
Integer
(((
ExcelField
)
o2
[
0
]).
sort
()));
};
});
annotationList
=
annotationList
.
stream
().
sorted
((
s1
,
s2
)->{
return
((
ExcelField
)
s1
[
0
]).
sort
()-((
ExcelField
)
s2
[
0
]).
sort
();}).
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
222
);
// Initialize
List
<
String
>
headerList
=
Lists
.
newArrayList
();
System
.
out
.
println
(
"headerList = "
+
headerList
);
for
(
Object
[]
os
:
annotationList
){
String
t
=
((
ExcelField
)
os
[
0
]).
title
();
// 如果是导出,则去掉注释
...
...
@@ -572,4 +573,62 @@ public class ExportExcel {
//
// }
public
static
void
main
(
String
[]
args
)
{
Field
[]
fs
=
StatisticalEntity
.
class
.
getDeclaredFields
();
List
<
Object
[]>
annotationList
=
new
ArrayList
<>();
int
[]
groups
={};
Integer
type
=
1
;
for
(
Field
f
:
fs
){
ExcelField
ef
=
f
.
getAnnotation
(
ExcelField
.
class
);
System
.
out
.
println
(
"ef = "
+
ef
);
if
(
ef
!=
null
&&
(
ef
.
type
()==
0
||
ef
.
type
()==
type
)){
if
(
groups
!=
null
&&
groups
.
length
>
0
){
boolean
inGroup
=
false
;
for
(
int
g
:
groups
){
if
(
inGroup
){
break
;
}
for
(
int
efg
:
ef
.
groups
()){
if
(
g
==
efg
){
inGroup
=
true
;
annotationList
.
add
(
new
Object
[]{
ef
,
f
});
break
;
}
}
}
}
else
{
annotationList
.
add
(
new
Object
[]{
ef
,
f
});
}
}
}
// Get annotation method
Method
[]
ms
=
StatisticalEntity
.
class
.
getDeclaredMethods
();
for
(
Method
m
:
ms
){
ExcelField
ef
=
m
.
getAnnotation
(
ExcelField
.
class
);
System
.
out
.
println
(
"ef = "
+
ef
);
if
(
ef
!=
null
&&
(
ef
.
type
()==
0
||
ef
.
type
()==
type
)){
if
(
groups
!=
null
&&
groups
.
length
>
0
){
boolean
inGroup
=
false
;
for
(
int
g
:
groups
){
if
(
inGroup
){
break
;
}
for
(
int
efg
:
ef
.
groups
()){
if
(
g
==
efg
){
inGroup
=
true
;
annotationList
.
add
(
new
Object
[]{
ef
,
m
});
break
;
}
}
}
}
else
{
annotationList
.
add
(
new
Object
[]{
ef
,
m
});
}
}
}
annotationList
=
annotationList
.
stream
().
sorted
((
s1
,
s2
)->{
return
((
ExcelField
)
s1
[
0
]).
sort
()-((
ExcelField
)
s2
[
0
]).
sort
();}).
collect
(
Collectors
.
toList
());
for
(
Object
[]
objects
:
annotationList
)
{
System
.
out
.
println
(
JSONObject
.
toJSONString
(
objects
));
}
}
}
src/com/ejweb/core/utils/excel/ImportExcel.java
View file @
f70d1a53
...
...
@@ -3,6 +3,8 @@
*/
package
com
.
ejweb
.
core
.
utils
.
excel
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.convert.Convert
;
import
com.ejweb.core.utils.excel.annotation.ExcelField
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -23,6 +25,7 @@ import java.lang.reflect.Field;
import
java.lang.reflect.Method
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 导入Excel文件(支持“XLS”和“XLSX”格式)
...
...
@@ -253,13 +256,15 @@ public class ImportExcel {
}
}
// Field sorting
Collections
.
sort
(
annotationList
,
new
Comparator
<
Object
[]>()
{
public
int
compare
(
Object
[]
o1
,
Object
[]
o2
)
{
return
new
Integer
(((
ExcelField
)
o1
[
0
]).
sort
()).
compareTo
(
new
Integer
(((
ExcelField
)
o2
[
0
]).
sort
()));
}
// Collections.sort(annotationList, new Comparator<Object[]>() {
// public int compare(Object[] o1, Object[] o2) {
// return new Integer(((ExcelField) o1[0]).sort()).compareTo(new Integer(((ExcelField) o2[0]).sort()));
// }
//
// ;
// });
;
});
annotationList
=
annotationList
.
stream
().
sorted
((
s1
,
s2
)->{
return
((
ExcelField
)
s1
[
0
]).
sort
()-((
ExcelField
)
s2
[
0
]).
sort
();}).
collect
(
Collectors
.
toList
());
// log.debug("Import column count:"+annotationList.size());
// Get excel data
List
<
E
>
dataList
=
Lists
.
newArrayList
();
...
...
@@ -342,4 +347,156 @@ public class ImportExcel {
}
return
dataList
;
}
/**
* 获取单行标题导入数据列表
*
* @param cls 导入对象类型
* @param groups 导入分组
*/
public
<
E
>
List
<
E
>
getDataList1
(
Class
<
E
>
cls
,
int
...
groups
)
throws
InstantiationException
,
IllegalAccessException
{
List
<
Object
[]>
annotationList
=
Lists
.
newArrayList
();
// Get annotation field
Field
[]
fs
=
cls
.
getDeclaredFields
();
for
(
Field
f
:
fs
)
{
ExcelField
ef
=
f
.
getAnnotation
(
ExcelField
.
class
);
if
(
ef
!=
null
&&
(
ef
.
type
()
==
0
||
ef
.
type
()
==
2
))
{
if
(
groups
!=
null
&&
groups
.
length
>
0
)
{
boolean
inGroup
=
false
;
for
(
int
g
:
groups
)
{
if
(
inGroup
)
{
break
;
}
for
(
int
efg
:
ef
.
groups
())
{
if
(
g
==
efg
)
{
inGroup
=
true
;
annotationList
.
add
(
new
Object
[]{
ef
,
f
});
break
;
}
}
}
}
else
{
annotationList
.
add
(
new
Object
[]{
ef
,
f
});
}
}
}
// Get annotation method
Method
[]
ms
=
cls
.
getDeclaredMethods
();
for
(
Method
m
:
ms
)
{
ExcelField
ef
=
m
.
getAnnotation
(
ExcelField
.
class
);
if
(
ef
!=
null
&&
(
ef
.
type
()
==
0
||
ef
.
type
()
==
2
))
{
if
(
groups
!=
null
&&
groups
.
length
>
0
)
{
boolean
inGroup
=
false
;
for
(
int
g
:
groups
)
{
if
(
inGroup
)
{
break
;
}
for
(
int
efg
:
ef
.
groups
())
{
if
(
g
==
efg
)
{
inGroup
=
true
;
annotationList
.
add
(
new
Object
[]{
ef
,
m
});
break
;
}
}
}
}
else
{
annotationList
.
add
(
new
Object
[]{
ef
,
m
});
}
}
}
// Field sorting
// CollUtil.sort(annotationList, new Comparator<Object[]>() {
// public int compare(Object[] o1, Object[] o2) {
// return Integer.compare(((ExcelField) o1[0]).sort(), ((ExcelField) o2[0]).sort());
// }
// ;
// });
List
<
Object
[]>
fields
=
new
ArrayList
<>();
for
(
Object
[]
objects
:
annotationList
)
{
ExcelField
field
=
(
ExcelField
)
objects
[
0
];
fields
.
add
(
field
.
sort
()-
11
,
objects
);
}
annotationList
=
fields
;
// log.debug("Import column count:"+annotationList.size());
// Get excel data
List
<
E
>
dataList
=
Lists
.
newArrayList
();
for
(
int
i
=
this
.
getDataRowNum
()-
1
;
i
<
this
.
getLastDataRowNum
();
i
++)
{
E
e
=
(
E
)
cls
.
newInstance
();
int
column
=
0
;
Row
row
=
this
.
getRow
(
i
);
StringBuilder
sb
=
new
StringBuilder
();
for
(
Object
[]
os
:
annotationList
)
{
Object
val
=
this
.
getCellValue
(
row
,
column
++);
if
(
val
!=
null
)
{
ExcelField
ef
=
(
ExcelField
)
os
[
0
];
// If is dict type, get dict value
/* if (StringUtils.isNotBlank(ef.dictType())) {
val = DictUtils.getDictValue(val.toString(), ef.dictType(), "");
// log.debug("Dictionary type value: ["+i+","+colunm+"]
// " + val);
}
*/
// Get param type and type cast
Class
<?>
valType
=
Class
.
class
;
if
(
os
[
1
]
instanceof
Field
)
{
valType
=
((
Field
)
os
[
1
]).
getType
();
}
else
if
(
os
[
1
]
instanceof
Method
)
{
Method
method
=
((
Method
)
os
[
1
]);
if
(
"get"
.
equals
(
method
.
getName
().
substring
(
0
,
3
)))
{
valType
=
method
.
getReturnType
();
}
else
if
(
"set"
.
equals
(
method
.
getName
().
substring
(
0
,
3
)))
{
valType
=
((
Method
)
os
[
1
]).
getParameterTypes
()[
0
];
}
}
// log.debug("Import value type: ["+i+","+column+"] " +
// valType);
try
{
if
(
valType
==
String
.
class
)
{
String
s
=
String
.
valueOf
(
val
.
toString
());
if
(
StringUtils
.
endsWith
(
s
,
".0"
))
{
val
=
StringUtils
.
substringBefore
(
s
,
".0"
);
}
else
{
val
=
String
.
valueOf
(
val
.
toString
());
}
}
else
if
(
valType
==
Integer
.
class
)
{
val
=
Double
.
valueOf
(
val
.
toString
()).
intValue
();
}
else
if
(
valType
==
Long
.
class
)
{
val
=
Double
.
valueOf
(
val
.
toString
()).
longValue
();
}
else
if
(
valType
==
Double
.
class
)
{
val
=
Double
.
valueOf
(
val
.
toString
());
}
else
if
(
valType
==
Float
.
class
)
{
val
=
Float
.
valueOf
(
val
.
toString
());
}
else
if
(
valType
==
Date
.
class
)
{
val
=
DateUtil
.
getJavaDate
((
Double
)
val
);
}
else
{
if
(
ef
.
fieldType
()
!=
Class
.
class
)
{
val
=
ef
.
fieldType
().
getMethod
(
"getValue"
,
String
.
class
).
invoke
(
null
,
val
.
toString
());
}
else
{
val
=
Class
.
forName
(
this
.
getClass
().
getName
().
replaceAll
(
this
.
getClass
().
getSimpleName
(),
"fieldtype."
+
valType
.
getSimpleName
()
+
"Type"
))
.
getMethod
(
"getValue"
,
String
.
class
).
invoke
(
null
,
val
.
toString
());
}
}
}
catch
(
Exception
ex
)
{
log
.
info
(
"Get cell value ["
+
i
+
","
+
column
+
"] error: "
+
ex
.
toString
());
val
=
null
;
}
// set entity value
if
(
os
[
1
]
instanceof
Field
)
{
Reflections
.
invokeSetter
(
e
,
((
Field
)
os
[
1
]).
getName
(),
val
);
}
else
if
(
os
[
1
]
instanceof
Method
)
{
String
mthodName
=
((
Method
)
os
[
1
]).
getName
();
if
(
"get"
.
equals
(
mthodName
.
substring
(
0
,
3
)))
{
mthodName
=
"set"
+
StringUtils
.
substringAfter
(
mthodName
,
"get"
);
}
Reflections
.
invokeMethod
(
e
,
mthodName
,
new
Class
[]{
valType
},
new
Object
[]{
val
});
}
}
sb
.
append
(
val
+
", "
);
}
dataList
.
add
(
e
);
log
.
debug
(
"Read success: ["
+
i
+
"] "
+
sb
.
toString
());
}
return
dataList
;
}
}
src/com/ejweb/modules/aircraft/dao/TypeDao.java
View file @
f70d1a53
...
...
@@ -7,6 +7,7 @@ import java.util.List;
import
com.ejweb.core.base.BaseDao
;
import
com.ejweb.modules.aircraft.entity.TypeEntity
;
import
org.apache.ibatis.annotations.Param
;
/**
*
...
...
@@ -22,4 +23,6 @@ public interface TypeDao extends BaseDao {
public
List
<
TypeEntity
>
findParentlist
();
public
List
<
TypeEntity
>
findChildlist
();
}
src/com/ejweb/modules/airport/api/OilAnalysisController.java
View file @
f70d1a53
...
...
@@ -7,14 +7,13 @@ import com.ejweb.core.base.PageEntity;
import
com.ejweb.core.conf.ErrorCode
;
import
com.ejweb.core.conf.GConstants
;
import
com.ejweb.core.utils.excel.ExportExcel
;
import
com.ejweb.modules.airport.bean.ExtraOilReasonBean
;
import
com.ejweb.modules.airport.bean.OilAnalysisBean
;
import
com.ejweb.modules.airport.bean.OilAnalysisIdBean
;
import
com.ejweb.modules.airport.bean.OilAnalysisUpdateBean
;
import
com.ejweb.modules.airport.bean.*
;
import
com.ejweb.modules.airport.entity.OilAnalysisEntity
;
import
com.ejweb.modules.airport.entity.OilTargetEntity
;
import
com.ejweb.modules.airport.entity.ResidualOilSummaryEntity
;
import
com.ejweb.modules.airport.service.OilAnalysisService
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -111,7 +110,7 @@ public class OilAnalysisController {
public
ResponseBean
getOilReason
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
ExtraOilReasonBean
bean
=
requestBean
.
getObjectBean
(
ExtraOilReasonBean
.
class
);
List
<
String
>
reasons
=
oilAnalysisService
.
getOilReason
(
bean
);
List
<
String
>
reasons
=
oilAnalysisService
.
getOilReason
(
bean
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
responseBean
.
setData
(
reasons
);
...
...
@@ -121,10 +120,10 @@ public class OilAnalysisController {
@RequestMapping
(
value
=
"/acTypeResidualOil"
)
@ResponseBody
public
ResponseBean
acTypeResidualOil
(
RequestBean
requestBean
){
public
ResponseBean
acTypeResidualOil
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
OilAnalysisBean
bean
=
requestBean
.
getObjectBean
(
OilAnalysisBean
.
class
);
List
<
ResidualOilSummaryEntity
>
list
=
oilAnalysisService
.
getAcTypeResidualOil
(
bean
);
List
<
ResidualOilSummaryEntity
>
list
=
oilAnalysisService
.
getAcTypeResidualOil
(
bean
);
if
(
list
==
null
)
{
responseBean
.
setMessage
(
GConstants
.
EMPTY
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2001
);
...
...
@@ -139,10 +138,10 @@ public class OilAnalysisController {
@RequestMapping
(
value
=
"/acTypeResidualOilExcel"
)
@ResponseBody
public
ResponseBean
acTypeResidualOilExcel
(
RequestBean
requestBean
,
HttpServletResponse
response
)
{
public
ResponseBean
acTypeResidualOilExcel
(
RequestBean
requestBean
,
HttpServletResponse
response
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
OilAnalysisBean
bean
=
requestBean
.
getObjectBean
(
OilAnalysisBean
.
class
);
List
<
ResidualOilSummaryEntity
>
list
=
oilAnalysisService
.
getAcTypeResidualOil
(
bean
);
List
<
ResidualOilSummaryEntity
>
list
=
oilAnalysisService
.
getAcTypeResidualOil
(
bean
);
//自定义导出序号
String
fileName
=
"机型剩油汇总.xlsx"
;
try
{
...
...
@@ -157,10 +156,10 @@ public class OilAnalysisController {
@RequestMapping
(
value
=
"/getNowYearTarget"
)
@ResponseBody
public
ResponseBean
getNowYearTarget
(
RequestBean
requestBean
){
public
ResponseBean
getNowYearTarget
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
List
<
OilTargetEntity
>
list
=
oilAnalysisService
.
findNowYearTarget
();
if
(
list
==
null
||
list
.
size
()==
0
)
{
List
<
OilTargetEntity
>
list
=
oilAnalysisService
.
findNowYearTarget
();
if
(
list
==
null
||
list
.
size
()
==
0
)
{
responseBean
.
setMessage
(
GConstants
.
EMPTY
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2001
);
return
responseBean
;
...
...
@@ -172,4 +171,27 @@ public class OilAnalysisController {
return
responseBean
;
}
@RequestMapping
(
value
=
"/updateRemarkAndConclusion"
)
@ResponseBody
public
ResponseBean
updateRemarkAndConclusion
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
OilBatchUpdateBean
bean
=
requestBean
.
getObjectBean
(
OilBatchUpdateBean
.
class
);
if
(
StringUtils
.
isBlank
(
bean
.
getExtraOilReason
())){
responseBean
.
setMessage
(
"额外油原因不能为空!"
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
else
if
(
StringUtils
.
isBlank
(
bean
.
getExtraOilReason
())||
StringUtils
.
isBlank
(
bean
.
getExtraOilReason
())){
responseBean
.
setMessage
(
"计划起飞时间开始和结束不能为空!"
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
else
if
(
StringUtils
.
isBlank
(
bean
.
getConclusion
())){
responseBean
.
setMessage
(
"计划起飞时间开始和结束不能为空!"
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
oilAnalysisService
.
updateRemarkAndConclusion
(
bean
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
}
src/com/ejweb/modules/airport/api/StatisticalController.java
View file @
f70d1a53
...
...
@@ -9,22 +9,37 @@ import com.ejweb.core.api.ResponseBean;
import
com.ejweb.core.base.PageEntity
;
import
com.ejweb.core.conf.ErrorCode
;
import
com.ejweb.core.conf.GConstants
;
import
com.ejweb.core.exception.CommonException
;
import
com.ejweb.core.utils.excel.ExportExcel
;
import
com.ejweb.core.utils.excel.ImportExcel
;
import
com.ejweb.modules.airport.bean.StatisticalBean
;
import
com.ejweb.modules.airport.bean.StatisticalImportBean
;
import
com.ejweb.modules.airport.bean.StatisticalListBean
;
import
com.ejweb.modules.airport.bean.TypeBean
;
import
com.ejweb.modules.airport.entity.StatisticalEntity
;
import
com.ejweb.modules.airport.entity.StatisticalImportEntity
;
import
com.ejweb.modules.airport.entity.StatisticalListEntity
;
import
com.ejweb.modules.airport.service.StatisticalService
;
import
com.ejweb.modules.crew.scores.bean.MainBean
;
import
com.ejweb.modules.crew.scores.entity.MainEntity
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.openxml4j.exceptions.InvalidFormatException
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
/**
* 数据统计
...
...
@@ -78,7 +93,7 @@ public class StatisticalController {
StatisticalBean
bean
=
requestBean
.
getObjectBean
(
StatisticalBean
.
class
);
String
message
=
statisticalService
.
validate
(
bean
);
if
(
message
==
null
)
{
bean
.
setPageSize
(
1000
);
bean
.
setPageSize
(
1000
0
);
// 参数校验为通过
PageEntity
<
StatisticalEntity
>
page
=
statisticalService
.
getStatisticalList
(
bean
);
List
<
StatisticalEntity
>
list
=
new
ArrayList
<
StatisticalEntity
>();
...
...
@@ -140,31 +155,31 @@ public class StatisticalController {
list
=
page
.
getList
();
//自定义导出序号
int
no
=
1
;
for
(
StatisticalListEntity
s
:
list
)
{
for
(
StatisticalListEntity
s
:
list
)
{
//自定义导出格式
s
.
setDepIataLabel
(
s
.
getDepIataName
()
+
s
.
getDepIata
()+
"-"
+
s
.
getArrIataName
()+
s
.
getArrIata
());
s
.
setDepIataLabel
(
s
.
getDepIataName
()
+
s
.
getDepIata
()
+
"-"
+
s
.
getArrIataName
()
+
s
.
getArrIata
());
s
.
setNo
(
no
);
no
++;
//航线状态自定义
if
(
s
.
getAirlineStatus
()
==
0
){
if
(
s
.
getAirlineStatus
()
==
0
)
{
s
.
setStatus
(
"失效"
);
}
if
(
s
.
getAirlineStatus
()
==
1
){
if
(
s
.
getAirlineStatus
()
==
1
)
{
s
.
setStatus
(
"有效"
);
}
//机型状态自定义
List
<
TypeBean
>
typeBeans
=
JSON
.
parseArray
(
s
.
getAirlineJson
(),
TypeBean
.
class
);
s
.
setTypeOne
(
typeInfo
(
typeBeans
.
get
(
0
),
s
.
getAirlineStatus
()));
s
.
setTypeTwo
(
typeInfo
(
typeBeans
.
get
(
typeBeans
.
size
()
-
4
),
s
.
getAirlineStatus
()));
s
.
setTypeThree
(
typeInfo
(
typeBeans
.
get
(
typeBeans
.
size
()
-
3
),
s
.
getAirlineStatus
()));
s
.
setTypeFour
(
typeInfo
(
typeBeans
.
get
(
typeBeans
.
size
()
-
2
),
s
.
getAirlineStatus
()));
s
.
setTypeFive
(
typeInfo
(
typeBeans
.
get
(
typeBeans
.
size
()
-
1
),
s
.
getAirlineStatus
()));
List
<
TypeBean
>
typeBeans
=
JSON
.
parseArray
(
s
.
getAirlineJson
(),
TypeBean
.
class
);
s
.
setTypeOne
(
typeInfo
(
typeBeans
.
get
(
0
),
s
.
getAirlineStatus
()));
s
.
setTypeTwo
(
typeInfo
(
typeBeans
.
get
(
typeBeans
.
size
()
-
4
),
s
.
getAirlineStatus
()));
s
.
setTypeThree
(
typeInfo
(
typeBeans
.
get
(
typeBeans
.
size
()
-
3
),
s
.
getAirlineStatus
()));
s
.
setTypeFour
(
typeInfo
(
typeBeans
.
get
(
typeBeans
.
size
()
-
2
),
s
.
getAirlineStatus
()));
s
.
setTypeFive
(
typeInfo
(
typeBeans
.
get
(
typeBeans
.
size
()
-
1
),
s
.
getAirlineStatus
()));
}
String
fileName
=
"航线执行期监控统计.xlsx"
;
try
{
new
ExportExcel
(
"航线执行期监控统计---"
+
bean
.
getBenchmarkingTime
(),
StatisticalListEntity
.
class
).
setDataList
(
list
).
write
(
response
,
fileName
).
dispose
();
new
ExportExcel
(
"航线执行期监控统计---"
+
bean
.
getBenchmarkingTime
(),
StatisticalListEntity
.
class
).
setDataList
(
list
).
write
(
response
,
fileName
).
dispose
();
}
catch
(
IOException
e
)
{
responseBean
.
setMessage
(
"导出数据失败"
+
e
.
getMessage
());
return
responseBean
;
...
...
@@ -180,23 +195,81 @@ public class StatisticalController {
return
responseBean
;
}
private
String
typeInfo
(
TypeBean
s
,
Integer
status
)
{
if
(
status
==
0
){
if
(
s
.
getStatus
()
==
3
){
private
String
typeInfo
(
TypeBean
s
,
Integer
status
)
{
if
(
status
==
0
)
{
if
(
s
.
getStatus
()
==
3
)
{
return
"不可用"
;
}
return
"论证失效"
;
}
else
{
if
(
s
.
getStatus
()
==
1
){
}
else
{
if
(
s
.
getStatus
()
==
1
)
{
return
s
.
getLastTime
();
}
if
(
s
.
getStatus
()
==
2
){
if
(
s
.
getStatus
()
==
2
)
{
return
"可用"
;
}
if
(
s
.
getStatus
()
==
3
){
if
(
s
.
getStatus
()
==
3
)
{
return
"不可用"
;
}
}
return
null
;
}
/**
* 开航指令集导入
*
* @param request
* @param file
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"upload"
)
public
ResponseBean
upload
(
HttpServletRequest
request
,
@RequestParam
(
"file"
)
CommonsMultipartFile
file
,
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
StatisticalImportBean
bean
=
requestBean
.
getObjectBean
(
StatisticalImportBean
.
class
);
String
message
=
statisticalService
.
validate
(
bean
);
if
(
message
!=
null
)
{
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
String
originalFilename
=
file
.
getOriginalFilename
();
if
(
StringUtils
.
isNotBlank
(
originalFilename
))
{
// 文件扩展名称不能为NULL
if
(
originalFilename
.
contains
(
"%"
)
||
originalFilename
.
contains
(
";"
))
{
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
responseBean
.
setMessage
(
"上传文件不允许含有非法字符,请改正!"
);
return
responseBean
;
}
}
int
length
=
0
;
try
{
if
(
originalFilename
.
toLowerCase
(
Locale
.
ENGLISH
).
endsWith
(
"xls"
))
{
HSSFWorkbook
hwb
=
new
HSSFWorkbook
(
file
.
getInputStream
());
length
=
hwb
.
getNumberOfSheets
();
//判断有几张活动的sheet表
}
else
if
(
originalFilename
.
toLowerCase
(
Locale
.
ENGLISH
).
endsWith
(
"xlsx"
))
{
XSSFWorkbook
hwb
=
new
XSSFWorkbook
(
file
.
getInputStream
());
length
=
hwb
.
getNumberOfSheets
();
//判断有几张活动的sheet表
}
try
{
ImportExcel
ei
=
new
ImportExcel
(
file
,
1
,
0
);
List
<
StatisticalImportEntity
>
list
=
ei
.
getDataList1
(
StatisticalImportEntity
.
class
);
statisticalService
.
saveData
(
list
,
bean
.
getUserCode
());
}
catch
(
InvalidFormatException
|
InstantiationException
|
IllegalAccessException
|
CommonException
e
)
{
// TODO Auto-generated catch block
throw
new
CommonException
(
e
.
getMessage
());
}
return
responseBean
;
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
responseBean
.
setMessage
(
e
.
getMessage
());
return
responseBean
;
}
}
}
src/com/ejweb/modules/airport/bean/OilBatchUpdateBean.java
0 → 100644
View file @
f70d1a53
package
com
.
ejweb
.
modules
.
airport
.
bean
;
import
com.ejweb.core.base.GenericBean
;
import
java.io.Serializable
;
/**
* 油量分析两个
*
* @author luos
* @version 1.0
* @team suzhou
* @time 2022年3月1日
*/
public
class
OilBatchUpdateBean
extends
GenericBean
implements
Serializable
{
//最低起飞时间
private
String
minDepTime
;
//最大起飞时间
private
String
maxDepTime
;
//额外油原因
private
String
extraOilReason
;
//额外油结论
private
String
conclusion
;
//备注
private
String
remark
;
public
OilBatchUpdateBean
()
{
}
public
String
getConclusion
()
{
return
conclusion
;
}
public
void
setConclusion
(
String
conclusion
)
{
this
.
conclusion
=
conclusion
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
String
getMinDepTime
()
{
return
minDepTime
;
}
public
void
setMinDepTime
(
String
minDepTime
)
{
this
.
minDepTime
=
minDepTime
;
}
public
String
getMaxDepTime
()
{
return
maxDepTime
;
}
public
void
setMaxDepTime
(
String
maxDepTime
)
{
this
.
maxDepTime
=
maxDepTime
;
}
public
String
getExtraOilReason
()
{
return
extraOilReason
;
}
public
void
setExtraOilReason
(
String
extraOilReason
)
{
this
.
extraOilReason
=
extraOilReason
;
}
}
src/com/ejweb/modules/airport/bean/StatisticalImportBean.java
0 → 100644
View file @
f70d1a53
package
com
.
ejweb
.
modules
.
airport
.
bean
;
import
com.ejweb.core.base.GenericBean
;
import
org.hibernate.validator.constraints.NotEmpty
;
public
class
StatisticalImportBean
extends
GenericBean
{
@NotEmpty
(
message
=
"userCode不能为空"
)
private
String
userCode
;
public
String
getUserCode
()
{
return
userCode
;
}
public
void
setUserCode
(
String
userCode
)
{
this
.
userCode
=
userCode
;
}
}
src/com/ejweb/modules/airport/dao/OilAnalysisDao.java
View file @
f70d1a53
...
...
@@ -3,6 +3,7 @@ package com.ejweb.modules.airport.dao;
import
com.ejweb.core.base.BaseDao
;
import
com.ejweb.modules.airport.bean.OilAnalysisBean
;
import
com.ejweb.modules.airport.bean.OilAnalysisUpdateBean
;
import
com.ejweb.modules.airport.bean.OilBatchUpdateBean
;
import
com.ejweb.modules.airport.entity.OilAnalysisEntity
;
import
com.ejweb.modules.airport.entity.OilTargetEntity
;
import
com.ejweb.modules.airport.entity.ResidualOilSummaryEntity
;
...
...
@@ -30,4 +31,5 @@ public interface OilAnalysisDao extends BaseDao {
List
<
OilTargetEntity
>
selectNowYearTarget
();
void
updateRemarkAndConclusion
(
@Param
(
"bean"
)
OilBatchUpdateBean
bean
,
@Param
(
"conclusion"
)
String
conclusion
);
}
src/com/ejweb/modules/airport/dao/StatisticalDao.java
View file @
f70d1a53
...
...
@@ -38,4 +38,21 @@ public interface StatisticalDao extends BaseDao {
* @return luoh
*/
List
<
StatiscalCheckBean
>
getCheckList
();
public
String
findIdByAcType
(
@Param
(
"acType"
)
String
acType
);
public
String
getDepartIdByUserId
(
@Param
(
"userId"
)
String
userId
);
void
insertAirlineVerify
(
@Param
(
"id"
)
String
verifyId
,
@Param
(
"verifNo"
)
String
verifNo
,
@Param
(
"verifType"
)
String
verifType
,
@Param
(
"departId"
)
String
departId
,
@Param
(
"acTypeId"
)
String
acTypeId
,
@Param
(
"userCode"
)
String
userCode
,
@Param
(
"depIata"
)
String
depIata
,
@Param
(
"arrIata"
)
String
arrIata
,
@Param
(
"routeNo"
)
String
routeNo
,
@Param
(
"state"
)
String
state
);
void
insertAirlineConnect
(
@Param
(
"id1"
)
String
id1
,
@Param
(
"id2"
)
String
id2
,
@Param
(
"verifyId"
)
String
verifyId
,
@Param
(
"depIata"
)
String
depIata
,
@Param
(
"arrIata"
)
String
arrIata
);
void
insertAirlineVerifyType
(
@Param
(
"id"
)
String
id
,
@Param
(
"verifyId"
)
String
verifyId
,
@Param
(
"acTypeId"
)
String
acTypeId
,
@Param
(
"userCode"
)
String
userCode
);
Integer
findVerifyByVerifyNoAndRouteNo
(
@Param
(
"verifNo"
)
String
verifNo
,
@Param
(
"routeNo"
)
String
routeNo
);
}
src/com/ejweb/modules/airport/entity/OilAnalysisEntity.java
View file @
f70d1a53
...
...
@@ -125,66 +125,68 @@ public class OilAnalysisEntity {
private
String
planLeftOver
;
//计划落地剩油
@ExcelField
(
title
=
"计划落地剩油增减量"
,
type
=
0
,
align
=
1
,
sort
=
65
)
private
Integer
increaseOrDecrease
;
//计划落地剩油增减量
@ExcelField
(
title
=
"CFP标志"
,
type
=
0
,
align
=
1
,
sort
=
66
)
@ExcelField
(
title
=
"计划落地剩油完成率"
,
type
=
0
,
align
=
1
,
sort
=
66
)
private
String
rate
;
//计划落地剩油完成率
@ExcelField
(
title
=
"CFP标志"
,
type
=
0
,
align
=
1
,
sort
=
67
)
private
String
cfpFlag
;
//
@ExcelField
(
title
=
"计算起飞重量"
,
type
=
0
,
align
=
1
,
sort
=
6
7
)
@ExcelField
(
title
=
"计算起飞重量"
,
type
=
0
,
align
=
1
,
sort
=
6
8
)
private
String
takeoffWeight
;
//
@ExcelField
(
title
=
"计算落地重量"
,
type
=
0
,
align
=
1
,
sort
=
6
8
)
@ExcelField
(
title
=
"计算落地重量"
,
type
=
0
,
align
=
1
,
sort
=
6
9
)
private
String
landingWeight
;
//
@ExcelField
(
title
=
"计算业载"
,
type
=
0
,
align
=
1
,
sort
=
69
)
@ExcelField
(
title
=
"计算业载"
,
type
=
0
,
align
=
1
,
sort
=
70
)
private
String
payloadWeight
;
//
@ExcelField
(
title
=
"计算零油量重量"
,
type
=
0
,
align
=
1
,
sort
=
70
)
@ExcelField
(
title
=
"计算零油量重量"
,
type
=
0
,
align
=
1
,
sort
=
71
)
private
String
zeroFuel
;
//
@ExcelField
(
title
=
"计算货物重量"
,
type
=
0
,
align
=
1
,
sort
=
7
1
)
@ExcelField
(
title
=
"计算货物重量"
,
type
=
0
,
align
=
1
,
sort
=
7
2
)
private
String
kalCargoLoad
;
//
@ExcelField
(
title
=
"油箱最大容积"
,
type
=
0
,
align
=
1
,
sort
=
7
2
)
@ExcelField
(
title
=
"油箱最大容积"
,
type
=
0
,
align
=
1
,
sort
=
7
3
)
private
String
maximumFuelCapacity
;
//
@ExcelField
(
title
=
"总油"
,
type
=
0
,
align
=
1
,
sort
=
7
3
)
@ExcelField
(
title
=
"总油"
,
type
=
0
,
align
=
1
,
sort
=
7
4
)
private
String
total
;
//
@ExcelField
(
title
=
"总时间"
,
type
=
0
,
align
=
1
,
sort
=
7
4
)
@ExcelField
(
title
=
"总时间"
,
type
=
0
,
align
=
1
,
sort
=
7
5
)
private
String
totalTime
;
//
@ExcelField
(
title
=
"航线耗油"
,
type
=
0
,
align
=
1
,
sort
=
7
5
)
@ExcelField
(
title
=
"航线耗油"
,
type
=
0
,
align
=
1
,
sort
=
7
6
)
private
String
trip
;
//
@ExcelField
(
title
=
"航线时间"
,
type
=
0
,
align
=
1
,
sort
=
7
6
)
@ExcelField
(
title
=
"航线时间"
,
type
=
0
,
align
=
1
,
sort
=
7
7
)
private
String
tripTime
;
//
@ExcelField
(
title
=
"航线距离"
,
type
=
0
,
align
=
1
,
sort
=
7
7
)
@ExcelField
(
title
=
"航线距离"
,
type
=
0
,
align
=
1
,
sort
=
7
8
)
private
String
tripDist
;
//
@ExcelField
(
title
=
"预计到达时刻"
,
type
=
0
,
align
=
1
,
sort
=
7
8
)
@ExcelField
(
title
=
"预计到达时刻"
,
type
=
0
,
align
=
1
,
sort
=
7
9
)
private
String
arrivalTime
;
//
@ExcelField
(
title
=
"备降耗油"
,
type
=
0
,
align
=
1
,
sort
=
79
)
@ExcelField
(
title
=
"备降耗油"
,
type
=
0
,
align
=
1
,
sort
=
80
)
private
String
alternateFuel
;
//
@ExcelField
(
title
=
"备降时间"
,
type
=
0
,
align
=
1
,
sort
=
8
0
)
@ExcelField
(
title
=
"备降时间"
,
type
=
0
,
align
=
1
,
sort
=
8
1
)
private
String
alternateTime
;
//
@ExcelField
(
title
=
"备降距离"
,
type
=
0
,
align
=
1
,
sort
=
8
1
)
@ExcelField
(
title
=
"备降距离"
,
type
=
0
,
align
=
1
,
sort
=
8
2
)
private
String
alternateDist
;
//
@ExcelField
(
title
=
"滑出油"
,
type
=
0
,
align
=
1
,
sort
=
8
2
)
@ExcelField
(
title
=
"滑出油"
,
type
=
0
,
align
=
1
,
sort
=
8
3
)
private
String
taxiOut
;
//
@ExcelField
(
title
=
"滑出时间"
,
type
=
0
,
align
=
1
,
sort
=
8
3
)
@ExcelField
(
title
=
"滑出时间"
,
type
=
0
,
align
=
1
,
sort
=
8
4
)
private
String
taxiOutTime
;
//
@ExcelField
(
title
=
"最后储备油"
,
type
=
0
,
align
=
1
,
sort
=
8
4
)
@ExcelField
(
title
=
"最后储备油"
,
type
=
0
,
align
=
1
,
sort
=
8
5
)
private
String
hold
;
//最后储存油
@ExcelField
(
title
=
"不可预期燃油"
,
type
=
0
,
align
=
1
,
sort
=
8
5
)
@ExcelField
(
title
=
"不可预期燃油"
,
type
=
0
,
align
=
1
,
sort
=
8
6
)
private
String
reserve
;
//不可预期燃油
@ExcelField
(
title
=
"不可预期时间"
,
type
=
0
,
align
=
1
,
sort
=
8
6
)
@ExcelField
(
title
=
"不可预期时间"
,
type
=
0
,
align
=
1
,
sort
=
8
7
)
private
String
reserveTime
;
//不可预期燃油
@ExcelField
(
title
=
"计算额外油"
,
type
=
0
,
align
=
1
,
sort
=
8
7
)
@ExcelField
(
title
=
"计算额外油"
,
type
=
0
,
align
=
1
,
sort
=
8
8
)
private
String
extra
;
//
@ExcelField
(
title
=
"计算额外时间"
,
type
=
0
,
align
=
1
,
sort
=
8
8
)
@ExcelField
(
title
=
"计算额外时间"
,
type
=
0
,
align
=
1
,
sort
=
8
9
)
private
String
extraTime
;
//
@ExcelField
(
title
=
"录入额外时间"
,
type
=
0
,
align
=
1
,
sort
=
89
)
@ExcelField
(
title
=
"录入额外时间"
,
type
=
0
,
align
=
1
,
sort
=
90
)
private
String
customExtraTime
;
//
@ExcelField
(
title
=
"性能限制起飞重量"
,
type
=
0
,
align
=
1
,
sort
=
9
0
)
@ExcelField
(
title
=
"性能限制起飞重量"
,
type
=
0
,
align
=
1
,
sort
=
9
1
)
private
String
limitingTakeoffWeight
;
//
@ExcelField
(
title
=
"性能限制落地重量"
,
type
=
0
,
align
=
1
,
sort
=
9
1
)
@ExcelField
(
title
=
"性能限制落地重量"
,
type
=
0
,
align
=
1
,
sort
=
9
2
)
private
String
limitingLandingWeight
;
//
@ExcelField
(
title
=
"Etop油量"
,
type
=
0
,
align
=
1
,
sort
=
9
2
)
@ExcelField
(
title
=
"Etop油量"
,
type
=
0
,
align
=
1
,
sort
=
9
3
)
private
String
etop
;
//
@ExcelField
(
title
=
"Etop时间"
,
type
=
0
,
align
=
1
,
sort
=
9
3
)
@ExcelField
(
title
=
"Etop时间"
,
type
=
0
,
align
=
1
,
sort
=
9
4
)
private
String
etopTime
;
//
@ExcelField
(
title
=
"备注"
,
type
=
0
,
align
=
1
,
sort
=
9
4
)
@ExcelField
(
title
=
"备注"
,
type
=
0
,
align
=
1
,
sort
=
9
5
)
private
String
remark
;
//备注
@ExcelField
(
title
=
"完成率"
,
type
=
0
,
align
=
1
,
sort
=
95
)
private
String
rate
;
//完成率
...
...
src/com/ejweb/modules/airport/entity/StatisticalImportEntity.java
0 → 100644
View file @
f70d1a53
package
com
.
ejweb
.
modules
.
airport
.
entity
;
import
com.ejweb.core.base.BaseEntity
;
import
com.ejweb.core.utils.excel.annotation.ExcelField
;
public
class
StatisticalImportEntity
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@ExcelField
(
title
=
"航班号"
,
type
=
0
,
align
=
1
,
sort
=
11
)
private
String
flightNo
;
@ExcelField
(
title
=
"论证单号"
,
type
=
0
,
align
=
1
,
sort
=
12
)
private
String
verifNo
;
@ExcelField
(
title
=
"论证机型"
,
type
=
0
,
align
=
1
,
sort
=
13
)
private
String
acType
;
@ExcelField
(
title
=
"起飞地三字码"
,
type
=
0
,
align
=
1
,
sort
=
14
)
private
String
depIata
;
@ExcelField
(
title
=
"到达地三字码"
,
type
=
0
,
align
=
1
,
sort
=
15
)
private
String
arrIata
;
@ExcelField
(
title
=
"失效状态"
,
type
=
0
,
align
=
1
,
sort
=
16
)
private
String
stateStr
;
private
String
state
;
@ExcelField
(
title
=
"论证类型"
,
type
=
0
,
align
=
1
,
sort
=
17
)
private
String
verifTypeStr
;
private
String
verifType
;
@ExcelField
(
title
=
"开航指令编号"
,
type
=
0
,
align
=
1
,
sort
=
18
)
private
String
routeNo
;
public
String
getFlightNo
()
{
return
flightNo
;
}
public
void
setFlightNo
(
String
flightNo
)
{
this
.
flightNo
=
flightNo
;
}
public
String
getVerifNo
()
{
return
verifNo
;
}
public
void
setVerifNo
(
String
verifNo
)
{
this
.
verifNo
=
verifNo
;
}
public
String
getAcType
()
{
return
acType
;
}
public
void
setAcType
(
String
acType
)
{
this
.
acType
=
acType
;
}
public
String
getDepIata
()
{
return
depIata
;
}
public
void
setDepIata
(
String
depIata
)
{
this
.
depIata
=
depIata
;
}
public
String
getArrIata
()
{
return
arrIata
;
}
public
void
setArrIata
(
String
arrIata
)
{
this
.
arrIata
=
arrIata
;
}
public
String
getStateStr
()
{
return
stateStr
;
}
public
void
setStateStr
(
String
stateStr
)
{
this
.
stateStr
=
stateStr
;
}
public
String
getState
()
{
return
state
;
}
public
void
setState
(
String
state
)
{
this
.
state
=
state
;
}
public
String
getVerifTypeStr
()
{
return
verifTypeStr
;
}
public
void
setVerifTypeStr
(
String
verifTypeStr
)
{
this
.
verifTypeStr
=
verifTypeStr
;
}
public
String
getVerifType
()
{
return
verifType
;
}
public
void
setVerifType
(
String
verifType
)
{
this
.
verifType
=
verifType
;
}
public
String
getRouteNo
()
{
return
routeNo
;
}
public
void
setRouteNo
(
String
routeNo
)
{
this
.
routeNo
=
routeNo
;
}
}
src/com/ejweb/modules/airport/service/OilAnalysisService.java
View file @
f70d1a53
...
...
@@ -5,6 +5,7 @@ import com.ejweb.core.base.PageEntity;
import
com.ejweb.modules.airport.bean.ExtraOilReasonBean
;
import
com.ejweb.modules.airport.bean.OilAnalysisBean
;
import
com.ejweb.modules.airport.bean.OilAnalysisUpdateBean
;
import
com.ejweb.modules.airport.bean.OilBatchUpdateBean
;
import
com.ejweb.modules.airport.dao.LeftOverOilDao
;
import
com.ejweb.modules.airport.dao.OilAnalysisDao
;
import
com.ejweb.modules.airport.entity.OilAnalysisEntity
;
...
...
@@ -109,9 +110,9 @@ public class OilAnalysisService extends BaseService<OilAnalysisDao> {
}
}
oilAnalysisEntity
.
setPlanLeftOver
(
oilAnalysisEntity
.
getPlanLeftOver
());
System
.
out
.
println
(
oilAnalysisEntity
.
getAcTypeName
());
System
.
out
.
println
(
planLeftOver
);
System
.
out
.
println
(
leftOverOil
);
//
System.out.println(oilAnalysisEntity.getAcTypeName());
//
System.out.println(planLeftOver);
//
System.out.println(leftOverOil);
oilAnalysisEntity
.
setIncreaseOrDecrease
(
Integer
.
valueOf
(
planLeftOver
)
-
leftOverOil
.
intValue
());
}
else
{
oilAnalysisEntity
.
setPlanLeftOver
(
""
);
...
...
@@ -286,4 +287,9 @@ public class OilAnalysisService extends BaseService<OilAnalysisDao> {
public
List
<
OilTargetEntity
>
findNowYearTarget
()
{
return
oilAnalysisDao
.
selectNowYearTarget
();
}
public
void
updateRemarkAndConclusion
(
OilBatchUpdateBean
bean
)
{
oilAnalysisDao
.
updateRemarkAndConclusion
(
bean
,
bean
.
getConclusion
());
}
}
src/com/ejweb/modules/airport/service/StatisticalService.java
View file @
f70d1a53
...
...
@@ -3,18 +3,24 @@
*/
package
com
.
ejweb
.
modules
.
airport
.
service
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ejweb.core.api.ResponseBean
;
import
com.ejweb.core.base.BaseService
;
import
com.ejweb.core.base.PageEntity
;
import
com.ejweb.core.exception.CommonException
;
import
com.ejweb.core.util.IdWorker
;
import
com.ejweb.modules.aircraft.dao.TypeDao
;
import
com.ejweb.modules.airport.bean.StatiscalCheckBean
;
import
com.ejweb.modules.airport.bean.StatisticalBean
;
import
com.ejweb.modules.airport.bean.StatisticalListBean
;
import
com.ejweb.modules.airport.dao.StatisticalDao
;
import
com.ejweb.modules.airport.entity.AirportInfoEntity
;
import
com.ejweb.modules.airport.entity.StatisticalEntity
;
import
com.ejweb.modules.airport.entity.StatisticalImportEntity
;
import
com.ejweb.modules.airport.entity.StatisticalListEntity
;
import
com.ejweb.modules.depart.dao.DepartDao
;
import
com.ejweb.modules.verify.bean.AirlineVerifiedAddBean
;
import
com.ejweb.modules.verify.dao.AirlineVerifiedDao
;
import
com.ejweb.modules.verify.dao.AirlineVerifyDao
;
...
...
@@ -27,6 +33,7 @@ import org.apache.commons.lang3.time.DateUtils;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.text.ParseException
;
...
...
@@ -50,6 +57,11 @@ public class StatisticalService extends BaseService<StatisticalDao> {
@Autowired
private
StatisticalDao
statisticalDao
;
@Autowired
private
TypeDao
typeDao
;
@Autowired
private
DepartDao
departDao
;
public
PageEntity
<
StatisticalEntity
>
getStatisticalList
(
StatisticalBean
bean
)
{
//查询同一机场被屏蔽三字码数据(历史数据关联)
if
(
StringUtils
.
isNotEmpty
(
bean
.
getArrIata
()))
{
...
...
@@ -96,7 +108,7 @@ public class StatisticalService extends BaseService<StatisticalDao> {
if
(
StringUtils
.
isNotBlank
(
lastTime
))
{
try
{
Date
date
=
DateUtils
.
addDays
(
DateUtils
.
parseDate
(
lastTime
,
"yyyy-MM-dd"
),
180
);
if
(
DateUtils
.
truncatedCompareTo
(
date
,
new
Date
(),
Calendar
.
DATE
)>
0
)
{
if
(
DateUtils
.
truncatedCompareTo
(
date
,
new
Date
(),
Calendar
.
DATE
)
>
0
)
{
e
.
setRecentFlyStatus
(
true
);
}
}
catch
(
ParseException
parseException
)
{
...
...
@@ -232,4 +244,92 @@ public class StatisticalService extends BaseService<StatisticalDao> {
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveData
(
List
<
StatisticalImportEntity
>
list
,
String
userCode
)
{
String
departId
=
statisticalDao
.
getDepartIdByUserId
(
userCode
);
StringBuilder
errorMsg
=
new
StringBuilder
();
for
(
StatisticalImportEntity
entity
:
list
)
{
try
{
if
(
StringUtils
.
isBlank
(
entity
.
getVerifNo
()))
{
errorMsg
.
append
(
entity
.
getFlightNo
()).
append
(
"论证单号不能为空"
);
throw
new
CommonException
(
errorMsg
.
toString
());
}
if
(
StringUtils
.
isBlank
(
entity
.
getAcType
()))
{
errorMsg
.
append
(
entity
.
getFlightNo
()).
append
(
"论证机型不能为空"
);
throw
new
CommonException
(
errorMsg
.
toString
());
}
if
(
StringUtils
.
isBlank
(
entity
.
getDepIata
()))
{
errorMsg
.
append
(
entity
.
getFlightNo
()).
append
(
"起飞地三字码不能为空"
);
throw
new
CommonException
(
errorMsg
.
toString
());
}
if
(
StringUtils
.
isBlank
(
entity
.
getArrIata
()))
{
errorMsg
.
append
(
entity
.
getFlightNo
()).
append
(
"到达地三字码不能为空"
);
throw
new
CommonException
(
errorMsg
.
toString
());
}
String
state
=
""
;
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getStateStr
(),
"正常"
))
{
state
=
"0"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getStateStr
(),
"失效"
))
{
state
=
"1"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getStateStr
(),
"重开"
))
{
state
=
"2"
;
}
if
(
StringUtils
.
isBlank
(
state
))
{
errorMsg
.
append
(
entity
.
getFlightNo
()).
append
(
"失效状态不正确"
);
throw
new
CommonException
(
errorMsg
.
toString
());
}
else
{
entity
.
setState
(
state
);
}
String
verifType
=
""
;
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getVerifTypeStr
().
trim
(),
"新开-国内"
))
{
verifType
=
"01"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getVerifTypeStr
().
trim
(),
"新开-国际"
))
{
verifType
=
"02"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getVerifTypeStr
().
trim
(),
"重开-国内"
))
{
verifType
=
"03"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getVerifTypeStr
().
trim
(),
"重开-国际"
))
{
verifType
=
"04"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getVerifTypeStr
().
trim
(),
" 调机"
))
{
verifType
=
"05"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getVerifTypeStr
().
trim
(),
"备降场"
))
{
verifType
=
"06"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getVerifTypeStr
().
trim
(),
"过夜"
))
{
verifType
=
"07"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getVerifTypeStr
().
trim
(),
"训练场"
))
{
verifType
=
"08"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getVerifTypeStr
().
trim
(),
"计划变更"
))
{
verifType
=
"09"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getVerifTypeStr
().
trim
(),
"新开-国内货运"
))
{
verifType
=
"10"
;
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
entity
.
getVerifTypeStr
().
trim
(),
"新开-国际货运"
))
{
verifType
=
"11"
;
}
if
(
StringUtils
.
isBlank
(
verifType
))
{
errorMsg
.
append
(
entity
.
getFlightNo
()).
append
(
"论证类型不正确"
);
throw
new
CommonException
(
errorMsg
.
toString
());
}
else
{
entity
.
setVerifType
(
verifType
);
}
String
acTypeId
=
statisticalDao
.
findIdByAcType
(
entity
.
getAcType
());
if
(
StringUtils
.
isBlank
(
acTypeId
)){
errorMsg
.
append
(
entity
.
getFlightNo
()).
append
(
"论证机型不正确"
);
throw
new
CommonException
(
errorMsg
.
toString
());
}
String
verifyId
=
IdWorker
.
getNextId
();
Integer
count
=
statisticalDao
.
findVerifyByVerifyNoAndRouteNo
(
entity
.
getVerifNo
(),
entity
.
getRouteNo
());
if
(
count
>
0
)
{
errorMsg
.
append
(
entity
.
getFlightNo
()).
append
(
"论证单号:"
).
append
(
entity
.
getVerifNo
()).
append
(
"或"
)
.
append
(
"开航指令号:"
).
append
(
entity
.
getRouteNo
()).
append
(
"已存在!"
);
throw
new
CommonException
(
errorMsg
.
toString
());
}
statisticalDao
.
insertAirlineVerify
(
verifyId
,
entity
.
getVerifNo
(),
entity
.
getVerifType
(),
departId
,
acTypeId
,
userCode
,
entity
.
getDepIata
(),
entity
.
getArrIata
(),
entity
.
getRouteNo
(),
entity
.
getState
());
statisticalDao
.
insertAirlineConnect
(
IdWorker
.
getNextId
(),
IdWorker
.
getNextId
(),
verifyId
,
entity
.
getDepIata
(),
entity
.
getArrIata
());
statisticalDao
.
insertAirlineVerifyType
(
IdWorker
.
getNextId
(),
verifyId
,
acTypeId
,
userCode
);
}
catch
(
Exception
e
)
{
throw
new
CommonException
(
e
.
getMessage
());
}
}
}
}
src/com/ejweb/modules/call/util/PhoneAreaUtil.java
View file @
f70d1a53
...
...
@@ -3,6 +3,10 @@
*/
package
com
.
ejweb
.
modules
.
call
.
util
;
import
cn.hutool.core.util.ObjUtil
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -13,41 +17,52 @@ import com.ejweb.core.fetcher.FetchEntity;
import
com.ejweb.core.fetcher.HCFetcher
;
/**
*
* @team IT Team
* @author renmb
* @version 1.0
* @time 2016年10月30日
* @team IT Team
* @time 2016年10月30日
*/
public
class
PhoneAreaUtil
{
/**
* 360安全卫士提供的手机号归属地查询接口
*
* @author renmb
* @time 2016年10月30日
* @param phone
* @return
* @author renmb
* @time 2016年10月30日
*/
public
static
PhoneAreaEntity
get360PhoneArea
(
String
mobile
){
public
static
PhoneAreaEntity
get360PhoneArea
(
String
mobile
)
{
try
{
if
(
StringUtils
.
isBlank
(
mobile
))
if
(
StringUtils
.
isBlank
(
mobile
))
return
null
;
HCFetcher
fetcher
=
HCFetcher
.
getInstance
();
FetchEntity
entity
=
fetcher
.
get
(
GConstants
.
getValue
(
"cx.shouji.360.cn"
,
"http://cx.shouji.360.cn/phonearea.php"
)+
"?number="
+
mobile
);
if
(
entity
!=
null
&&
entity
.
isSuccess
()){
String
txt
=
entity
.
getContent
(
"UTF-8"
);
JSONObject
object
=
JSON
.
parseObject
(
txt
);
JSONObject
data
=
object
.
getJSONObject
(
"data"
);
if
(
StringUtils
.
isNotBlank
(
data
.
getString
(
"province"
))){
// HCFetcher fetcher = HCFetcher.getInstance();
// FetchEntity entity = fetcher.get(GConstants.getValue("cx.shouji.360.cn", "http://cx.shouji.360.cn/phonearea.php") + "?number=" + mobile);
// JSONObject jsonObject = JSONObject.parseObject(s);
// JSONObject data = jsonObject.getJSONObject("data");
// System.out.println(data.getString("province"));
// if(entity != null && entity.isSuccess()){
//
// String txt = entity.getContent("UTF-8");
// JSONObject object = JSON.parseObject(txt);
// JSONObject data = object.getJSONObject("data");
//
//
// }
String
url
=
GConstants
.
getValue
(
"cx.shouji.360.cn"
,
"http://cx.shouji.360.cn/phonearea.php"
)
+
"?number="
+
mobile
;
url
=
"http://cx.shouji.360.cn/phonearea.php?number="
+
mobile
;
HttpRequest
request
=
HttpUtil
.
createGet
(
url
);
request
.
setConnectionTimeout
(
20
);
HttpResponse
execute
=
request
.
execute
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
execute
.
body
());
JSONObject
data
=
jsonObject
.
getJSONObject
(
"data"
);
if
(
ObjUtil
.
isNotNull
(
data
))
{
String
province
=
data
.
getString
(
"province"
);
if
(
StringUtils
.
isNotBlank
(
province
))
{
PhoneAreaEntity
area
=
new
PhoneAreaEntity
();
area
.
setProvince
(
data
.
getString
(
"province"
)
);
area
.
setProvince
(
province
);
area
.
setCity
(
data
.
getString
(
"city"
));
area
.
setSp
(
data
.
getString
(
"sp"
));
return
area
;
}
}
...
...
@@ -57,23 +72,31 @@ public class PhoneAreaUtil {
return
null
;
}
public
static
void
main
(
String
[]
args
)
{
String
url
=
"http://cx.shouji.360.cn/phonearea.php?number=15995791570"
;
String
s
=
HttpUtil
.
get
(
url
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
s
);
JSONObject
data
=
jsonObject
.
getJSONObject
(
"data"
);
PhoneAreaEntity
phoneArea
=
PhoneAreaUtil
.
get360PhoneArea
(
"15995791570"
);
}
/**
* 百度号码认证平台提供
*
*
<p>
* http://haoma.baidu.com/
*
* @author renmb
* @time 2017年3月3日
* @param mobile
* @return
* @author renmb
* @time 2017年3月3日
*/
public
static
PhoneAreaEntity
getBaiduPhoneArea
(
String
mobile
){
public
static
PhoneAreaEntity
getBaiduPhoneArea
(
String
mobile
)
{
try
{
if
(
StringUtils
.
isBlank
(
mobile
))
if
(
StringUtils
.
isBlank
(
mobile
))
return
null
;
HCFetcher
fetcher
=
HCFetcher
.
getInstance
();
FetchEntity
entity
=
fetcher
.
get
(
GConstants
.
getValue
(
"sp0.baidu.com"
,
"https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv"
)
+
"/api.php?query="
+
mobile
+
"&co=&resource_id=6004&t="
+
System
.
currentTimeMillis
()+
"&ie=utf8&oe=gbk&cb=&format=json&tn=baidu&cb=&_="
+
System
.
currentTimeMillis
());
if
(
entity
!=
null
&&
entity
.
isSuccess
())
{
FetchEntity
entity
=
fetcher
.
get
(
GConstants
.
getValue
(
"sp0.baidu.com"
,
"https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv"
)
+
"/api.php?query="
+
mobile
+
"&co=&resource_id=6004&t="
+
System
.
currentTimeMillis
()
+
"&ie=utf8&oe=gbk&cb=&format=json&tn=baidu&cb=&_="
+
System
.
currentTimeMillis
());
if
(
entity
!=
null
&&
entity
.
isSuccess
())
{
String
txt
=
entity
.
getContent
(
"gbk"
);
// if(GConstants.DEBUG){
...
...
@@ -83,9 +106,9 @@ public class PhoneAreaUtil {
// }
JSONObject
object
=
JSON
.
parseObject
(
txt
);
JSONArray
data
=
object
.
getJSONArray
(
"data"
);
if
(
data
!=
null
&&
data
.
size
()>
0
)
{
if
(
data
!=
null
&&
data
.
size
()
>
0
)
{
JSONObject
row
=
data
.
getJSONObject
(
0
);
if
(
StringUtils
.
isNotEmpty
(
row
.
getString
(
"prov"
)))
{
if
(
StringUtils
.
isNotEmpty
(
row
.
getString
(
"prov"
)))
{
PhoneAreaEntity
area
=
new
PhoneAreaEntity
();
area
.
setProvince
(
row
.
getString
(
"prov"
));
...
...
@@ -103,6 +126,7 @@ public class PhoneAreaUtil {
}
// public static void main(String[] args){
// String mobile = "13357826763";
// String s = "https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv" + "/api.php?query=" + mobile + "&co=&resource_id=6004&t=" + System.currentTimeMillis() + "&ie=utf8&oe=gbk&cb=&format=json&tn=baidu&cb=&_=" + System.currentTimeMillis();
// PhoneAreaEntity area = PhoneAreaUtil.getBaiduPhoneArea(mobile);
// System.out.println(JSON.toJSONString(area));
// PhoneAreaEntity area360 = PhoneAreaUtil.get360PhoneArea(mobile);
...
...
src/com/ejweb/modules/depart/dao/DepartDao.java
View file @
f70d1a53
...
...
@@ -22,5 +22,5 @@ public interface DepartDao extends BaseDao{
public
List
<
DepartEntity
>
findDepartByList
(
@Param
(
value
=
"type"
)
String
type
,
@Param
(
value
=
"isVerif"
)
String
isVerif
);
public
List
<
DepartTypeEntity
>
findDepartAllList
();
public
String
getDepartIdByUserId
(
@Param
(
"userId"
)
String
userId
);
String
getDepartIdByUserId
(
@Param
(
"userId"
)
String
userCode
);
}
\ No newline at end of file
src/com/ejweb/modules/flight/entity/FlightCrewListEntity.java
View file @
f70d1a53
...
...
@@ -37,7 +37,28 @@ public class FlightCrewListEntity extends BaseEntity {
private
String
sectorNick
;
// 航线缩写
private
int
huaweiStatus
;
// 华为绑定状态: 0 位绑定 1 已绑定
private
Integer
state
=
0
;
// 用户UC在线状态
public
FlightCrewListEntity
()
{
}
public
FlightCrewListEntity
(
String
rankSd
,
String
crewTypeId
,
String
staffId
,
String
staffName
,
String
photo
,
String
phone
,
String
mobile
,
String
companyName
,
String
officeName
,
String
sector
,
String
sectorNick
,
int
huaweiStatus
,
Integer
state
)
{
this
.
rankSd
=
rankSd
;
this
.
crewTypeId
=
crewTypeId
;
this
.
staffId
=
staffId
;
this
.
staffName
=
staffName
;
this
.
photo
=
photo
;
this
.
phone
=
phone
;
this
.
mobile
=
mobile
;
this
.
companyName
=
companyName
;
this
.
officeName
=
officeName
;
this
.
sector
=
sector
;
this
.
sectorNick
=
sectorNick
;
this
.
huaweiStatus
=
huaweiStatus
;
this
.
state
=
state
;
}
public
String
getRankSd
()
{
return
rankSd
;
}
...
...
src/com/ejweb/modules/flight/service/AirCarrierService.java
View file @
f70d1a53
...
...
@@ -145,4 +145,64 @@ public class AirCarrierService extends BaseService<AirCarrierDao> {
}
return
null
;
}
public
static
void
main
(
String
[]
args
)
{
List
<
FlightCrewListEntity
>
crewList
=
new
ArrayList
<>();
crewList
.
add
(
new
FlightCrewListEntity
(
"乘务员"
,
"2"
,
"1000067632"
,
"彭琼斯"
,
"images/user/avatar/female_avatar.png"
,
"01064506313"
,
"18675877423"
,
"北京首都航空有限公司"
,
"海口乘务二中队"
,
"LYI-KWL"
,
"沂-桂"
,
0
,
0
));
// 乘务员 1000067632 彭琼斯 2 LYI-KWL 沂-桂 images/user/avatar/female_avatar.png 01064506313 18675877423 北京首都航空有限公司 海口乘务二中队 0
// 机长 1000074230 周鹏 1 LYI-KWL 沂-桂 images/user/avatar/male_avatar.png 18689972723 北京首都航空有限公司 海口一中队 0
// 乘务长 1000126503 李姗珊 2 LYI-KWL 沂-桂 images/user/avatar/female_avatar.png 13639330824 北京首都航空有限公司 海口乘务一中队 0
// 一副 1000141665 黄万林 1 LYI-KWL 沂-桂 images/user/avatar/male_avatar.png 18671707572 北京首都航空有限公司 海口一中队 0
// 两舱乘务员 1000801882 马明月 2 LYI-KWL 沂-桂 images/user/avatar/female_avatar.png 01069615030 18308903665 北京首都航空有限公司 海口乘务三中队 0
// 见习乘务员 1000942813 于沛 2 LYI-KWL 沂-桂 images/user/avatar/female_avatar.png 18661962106 北京首都航空有限公司 青岛乘务三中队 0
// 安全员 1000954218 王浩宇6 2 LYI-KWL 沂-桂 images/user/avatar/male_avatar.png 18742145675 北京首都航空有限公司 安全员海口中队 0
// 二副 1001006416 娄元昊 1 LYI-KWL 沂-桂 images/user/avatar/male_avatar.png 17709096291 北京首都航空有限公司 海口一中队 0
if
(
crewList
!=
null
&&
crewList
.
size
()
!=
0
){
Map
<
String
,
List
<
FlightCrewListEntity
>>
items
=
new
HashMap
<
String
,
List
<
FlightCrewListEntity
>>();
List
<
String
>
names
=
new
ArrayList
<
String
>();
names
.
add
(
"飞行员"
);
names
.
add
(
"乘务员"
);
names
.
add
(
"安全员"
);
// 1飞行员,2乘务员,3安全员,4空警
Map
<
String
,
String
>
crews
=
new
HashMap
<
String
,
String
>();
crews
.
put
(
"1"
,
"飞行员"
);
crews
.
put
(
"2"
,
"乘务员"
);
crews
.
put
(
"3"
,
"安全员"
);
crews
.
put
(
"4"
,
"安全员"
);
// crews.put("其他人员", "其他人员");
for
(
FlightCrewListEntity
crewListEntity:
crewList
){
String
key
=
crews
.
get
(
crewListEntity
.
getCrewTypeId
());
if
(
StringUtils
.
isBlank
(
key
)){
// 人员分组判断
continue
;
// key = "其他人员";
}
// System.out.println(key+"=>"+crewListEntity.getCrewTypeId());
crewListEntity
.
setPhoto
(
Util
.
getAbsoluteUrl
(
crewListEntity
.
getPhoto
()));
// 设置用户头像
List
<
FlightCrewListEntity
>
item
=
items
.
get
(
key
);
if
(
item
==
null
){
// 如果还不存在则添加一个分组列表
item
=
new
ArrayList
<
FlightCrewListEntity
>();
item
.
add
(
crewListEntity
);
items
.
put
(
key
,
item
);
}
else
{
item
.
add
(
crewListEntity
);
}
}
// 组装用户分组
List
<
FlightCrewGroupEntity
>
crewGroupList
=
new
ArrayList
<
FlightCrewGroupEntity
>();
for
(
String
key:
names
){
FlightCrewGroupEntity
crewGroup
=
new
FlightCrewGroupEntity
();
crewGroup
.
setName
(
key
);
crewGroup
.
setList
(
items
.
get
(
crewGroup
.
getName
()));
crewGroupList
.
add
(
crewGroup
);
}
System
.
out
.
println
(
crewGroupList
);
}
}
}
src/com/ejweb/modules/flight/service/FlightService.java
View file @
f70d1a53
...
...
@@ -146,19 +146,22 @@ public class FlightService extends BaseService<FlightDao> {
HuaweiUserStatInfoBean
huaweiUserStatInfoBean
=
new
HuaweiUserStatInfoBean
();
huaweiUserStatInfoBean
.
setQueryUsers
(
userIds
);
List
<
HuaweiUserStatEntity
>
huaweiUserStatEntities
=
huaweiInterfaseService
.
presence
(
huaweiUserStatInfoBean
);
if
(
huaweiUserStatEntities
!=
null
&&
huaweiUserStatEntities
.
size
()
>
0
)
{
for
(
HuaweiUserStatEntity
statEntityTmp
:
huaweiUserStatEntities
)
{
//
if (huaweiUserStatEntities != null && huaweiUserStatEntities.size() > 0) {
//
for (HuaweiUserStatEntity statEntityTmp : huaweiUserStatEntities) {
for
(
FlightCrewListEntity
crewListEntity
:
crewList
)
{
crewListEntity
.
setState
(
Util
.
parseInt
(
statEntityTmp
.
getNewState
(),
0
));
crewListEntity
.
setState
(
0
);
}
}
}
//
}
//
}
}
}
return
dao
.
getFlightCrewList
(
bean
);
}
public
static
void
main
(
String
[]
args
)
{
}
/**
* 处理航班的机组人员,对机组人员进行分组展示
*
...
...
src/com/ejweb/modules/user/api/UserController.java
View file @
f70d1a53
...
...
@@ -6,6 +6,7 @@ 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.core.exception.CommonException
;
import
com.ejweb.core.fetcher.FetchEntity
;
import
com.ejweb.core.fetcher.HCFetcher
;
import
com.ejweb.core.util.IdWorker
;
...
...
@@ -33,6 +34,7 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.subethamail.smtp.server.CommandException
;
import
sun.misc.BASE64Decoder
;
import
javax.crypto.Cipher
;
...
...
src/com/ejweb/modules/user/service/UserService.java
View file @
f70d1a53
...
...
@@ -10,6 +10,7 @@ import com.ejweb.core.fetcher.FetchEntity;
import
com.ejweb.core.fetcher.HCFetcher
;
import
com.ejweb.core.util.IdWorker
;
import
com.ejweb.core.util.Util
;
import
com.ejweb.core.util.VerifyEmailHandler
;
import
com.ejweb.modules.im.bean.ImUserListBean
;
import
com.ejweb.modules.im.bean.OfficeBean
;
import
com.ejweb.modules.im.bean.SearchUserBean
;
...
...
@@ -17,17 +18,20 @@ import com.ejweb.modules.im.entity.UserSeatListEntity;
import
com.ejweb.modules.user.bean.*
;
import
com.ejweb.modules.user.dao.UserDao
;
import
com.ejweb.modules.user.entity.*
;
import
com.ejweb.modules.verify.dao.AirlineVerifyDao
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.jdair.util.http.client.HTTPClientUtil
;
import
com.jdair.util.security.DESPlus
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.net.URLEncoder
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -40,6 +44,9 @@ public class UserService extends CurdService<UserDao, UserEntity> {
public
static
final
int
HASH_INTERATIONS
=
1024
;
public
static
final
int
SALT_SIZE
=
8
;
@Autowired
AirlineVerifyDao
verifyDao
;
/**
* 通过CODE获取用户ID
*
...
...
@@ -324,7 +331,7 @@ public class UserService extends CurdService<UserDao, UserEntity> {
}
@Transactional
(
readOnly
=
false
)
public
boolean
validateServerPassword
(
LoginBean
loginBean
)
{
public
boolean
validateServerPassword
(
LoginBean
loginBean
)
{
long
startTime
=
System
.
nanoTime
();
try
{
// 使用新的登录地址,默认使用旧地址
...
...
@@ -355,11 +362,33 @@ public class UserService extends CurdService<UserDao, UserEntity> {
LOG
.
info
(
"[UserService login][validateServerPassword][URL]:"
+
buf
.
toString
());
HCFetcher
fetcher
=
HCFetcher
.
getInstance
();
FetchEntity
entity
=
fetcher
.
get
(
buf
.
toString
());
// 再次重新尝试获取内容
if
(
entity
==
null
)
{
entity
=
fetcher
.
get
(
buf
.
toString
());
FetchEntity
entity
=
null
;
try
{
LOG
.
info
(
"第一次调用开始"
);
entity
=
fetcher
.
get
(
buf
.
toString
());
// 再次重新尝试获取内容
if
(
entity
==
null
||
entity
.
getStatus
()!=
200
)
{
LOG
.
error
(
"第一次调用失败!"
);
throw
new
Exception
();
}
}
catch
(
Exception
ex
){
try
{
String
replace
=
StringUtils
.
replace
(
buf
.
toString
(),
"https://dsp.jdair.net"
,
"https://dsp2.jdair.net"
);
LOG
.
info
(
"第二次调用开始,地址:"
+
replace
);
entity
=
fetcher
.
get
(
replace
);
if
(
entity
==
null
||
entity
.
getStatus
()!=
200
)
{
LOG
.
error
(
"第二次调用失败!"
);
throw
new
Exception
();
}
}
catch
(
Exception
ex1
){
try
{
LOG
.
info
(
"调用登录2次都失败!发送邮件!"
);
VerifyEmailHandler
instance
=
VerifyEmailHandler
.
getInstance
();
instance
.
sendEmail
(
"登录异常"
,
"首航系统2次调用登录失败!"
,
null
,
Arrays
.
asList
(
"chl.zhou@hnair.com"
,
"695220370@qq.com"
));
}
catch
(
Exception
ex2
){
ex
.
printStackTrace
();
}
}
}
if
(
entity
!=
null
)
{
String
text
=
entity
.
getContent
(
"UTF-8"
);
...
...
src/com/ejweb/modules/verify/api/RecordChangeVerifyController.java
View file @
f70d1a53
...
...
@@ -231,6 +231,6 @@ public class RecordChangeVerifyController {
}
}
}
src/com/ejweb/modules/verify/service/AirlineVerifyService.java
View file @
f70d1a53
...
...
@@ -300,7 +300,8 @@ public class AirlineVerifyService extends BaseService<AirlineVerifyDao> {
case
"02"
:
case
"03"
:
case
"04"
:
case
"09"
:
{
case
"09"
:
case
"11"
:{
List
<
Connect
>
connects
=
new
ArrayList
<>();
Connect
connect
=
new
Connect
();
connect
.
setId
(
IdWorker
.
getNextId
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment