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
8ed37a7e
Commit
8ed37a7e
authored
May 23, 2019
by
java-李谡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改操作履历,在两个地方添加空指针的日志,处理一个过期的无效引用
parent
76595e10
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
81 deletions
+86
-81
HttpClientUtil.java
src/com/ejweb/core/fetcher/HttpClientUtil.java
+49
-58
StatisticalService.java
src/com/ejweb/modules/airport/service/StatisticalService.java
+10
-4
NotifyService.java
src/com/ejweb/modules/notify/service/NotifyService.java
+3
-2
RouteVerifyService.java
src/com/ejweb/modules/route/service/RouteVerifyService.java
+24
-17
No files found.
src/com/ejweb/core/fetcher/HttpClientUtil.java
View file @
8ed37a7e
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"
);
...
...
src/com/ejweb/modules/airport/service/StatisticalService.java
View file @
8ed37a7e
...
...
@@ -14,6 +14,7 @@ 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
;
...
...
@@ -27,6 +28,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,19 +43,23 @@ 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
);
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
);
}
if
(
"06"
.
equals
(
e
.
getVerifType
())
||
"07"
.
equals
(
e
.
getVerifType
())
||
"08"
.
equals
(
e
.
getVerifType
()))
{
e
.
setExpiryDate
(
"长期有效"
);
...
...
src/com/ejweb/modules/notify/service/NotifyService.java
View file @
8ed37a7e
...
...
@@ -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
()));
...
...
src/com/ejweb/modules/route/service/RouteVerifyService.java
View file @
8ed37a7e
...
...
@@ -28,6 +28,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.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -41,7 +42,7 @@ import java.util.Map;
@Service
@Transactional
(
readOnly
=
true
)
public
class
RouteVerifyService
extends
BaseService
<
RouteVerifyDao
>
{
private
final
static
Logger
LOG
=
Logger
.
getLogger
(
RouteVerifyService
.
class
);
@Autowired
private
UserDao
userdao
;
...
...
@@ -155,6 +156,7 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
}
//判断备注是否修改,如果有修改,则添加操作履历
boolean
remarkModify
=
bean
.
getRemarks
()
!=
null
&&
!
bean
.
getRemarks
().
equals
(
fullRouteVerifyEntity
.
getRemarks
());
RecordAddBean
recordAddBean
=
null
;
//记录初始反馈时间
if
(
fullRouteVerifyEntity
.
getStartTime
()
==
null
)
{
fullRouteVerifyEntity
.
setStartTime
(
new
Date
());
...
...
@@ -167,17 +169,18 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
}
else
{
// 增加自定义表单修改操作履历
boolean
formTextModify
=
fullRouteVerifyEntity
.
getFormText
()
!=
null
&&
!
bean
.
getFormText
().
equals
(
fullRouteVerifyEntity
.
getFormText
());
LOG
.
info
(
"是否修改表单:"
+
formTextModify
+
";是否修改备注:"
+
remarkModify
);
//如果修改了自定义表单或者备注,创建修改论证内容操作履历
if
(
formTextModify
||
remarkModify
)
{
RecordAddBean
addb
ean
=
new
RecordAddBean
();
addb
ean
.
setId
(
IdWorker
.
getNextId
());
addb
ean
.
setUserCode
(
bean
.
getUserCode
());
addb
ean
.
setRecordType
(
"03"
);
addb
ean
.
setVerifId
(
bean
.
getVerifId
());
recordAddB
ean
=
new
RecordAddBean
();
recordAddB
ean
.
setId
(
IdWorker
.
getNextId
());
recordAddB
ean
.
setUserCode
(
bean
.
getUserCode
());
recordAddB
ean
.
setRecordType
(
"03"
);
recordAddB
ean
.
setVerifId
(
bean
.
getVerifId
());
//判断备注是否修改,如果有修改,操作履历添加备注内容
if
(
remarkModify
)
{
addb
ean
.
setRemarks
(
bean
.
getRemarks
());
recordAddB
ean
.
setRemarks
(
bean
.
getRemarks
());
}
recordDao
.
insert
(
addbean
);
}
}
//结束上一循环
...
...
@@ -198,19 +201,23 @@ public class RouteVerifyService extends BaseService<RouteVerifyDao> {
}
// 如果已提交过论证意见,则记录修改
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
());
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
)
{
addb
ean
.
setRemarks
(
bean
.
getRemarks
());
recordAddB
ean
.
setRemarks
(
bean
.
getRemarks
());
}
recordDao
.
insert
(
addbean
);
}
recordDao
.
insert
(
recordAddBean
);
if
(
"1"
.
equals
(
bean
.
getStatus
()))
{
fullRouteVerifyEntity
.
setEndTime
(
new
Date
());
// 完成截止反馈通知置灰
...
...
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