Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
manager
Project
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
reyun
manager
Commits
79033d40
Commit
79033d40
authored
Jan 12, 2022
by
lzxry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cas主账号校验
parent
01f68897
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
0 deletions
+69
-0
pom.xml
pom.xml
+3
-0
ContractController.java
src/main/java/common/controller/ContractController.java
+6
-0
ContractService.java
src/main/java/common/service/ContractService.java
+3
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+21
-0
Constant.java
src/main/java/util/Constant.java
+1
-0
HttpClientUtil.java
src/main/java/util/HttpClientUtil.java
+34
-0
common.properties
src/main/resources/common.properties
+1
-0
No files found.
pom.xml
View file @
79033d40
...
...
@@ -90,6 +90,7 @@
<report.url>
http://10.3.20.41:9010
</report.url>
<import.temp.url>
http://10.3.20.41:9001
</import.temp.url>
<adi.url>
http://39.104.94.46:8080,http://129.226.187.229:8080
</adi.url>
<adi.account.check>
http://39.99.50.131
</adi.account.check>
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
...
...
@@ -164,6 +165,7 @@
<report.url>
http://10.2.20.41:9010
</report.url>
<import.temp.url>
http://10.2.20.41:9001
</import.temp.url>
<adi.url>
http://39.104.94.46:8080,http://129.226.187.229:8080
</adi.url>
<adi.account.check>
http://39.99.50.131
</adi.account.check>
<contract.uppath></contract.uppath>
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
...
...
@@ -273,6 +275,7 @@
<report.url>
http://internal-report-api-976419027.cn-north-1.elb.amazonaws.com.cn
</report.url>
<import.temp.url>
http://172.31.25.137:9001
</import.temp.url>
<adi.url>
http://39.104.94.46:8080,http://129.226.187.229:8080
</adi.url>
<adi.account.check>
http://39.104.65.219
</adi.account.check>
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
<redis.ip.requesttimes>
5
</redis.ip.requesttimes>
...
...
src/main/java/common/controller/ContractController.java
View file @
79033d40
...
...
@@ -277,6 +277,12 @@ public class ContractController {
return
ResultModel
.
OK
(
service
.
checkAccount
(
email
,
platform
));
}
@RequestMapping
(
value
=
"checkCasAccount"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
checkCasAccount
(
@RequestParam
String
email
)
{
return
service
.
checkCasAccount
(
email
);
}
@RequestMapping
(
value
=
"checkTime"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResultModel
checkTime
(
@RequestParam
String
type
,
@RequestParam
String
email
,
...
...
src/main/java/common/service/ContractService.java
View file @
79033d40
...
...
@@ -78,4 +78,6 @@ public interface ContractService {
ResultModel
uploadBatchInfo
(
MultipartFile
file
,
String
platform
,
User
loginAccount
);
Object
getBarrioCities
();
Object
checkCasAccount
(
String
email
);
}
\ No newline at end of file
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
79033d40
...
...
@@ -9,6 +9,8 @@ import dic.ContractStatusEnum;
import
dic.ContractTypeEnum
;
import
dic.RoleEnum
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.apache.commons.collections.map.HashedMap
;
import
org.apache.poi.ss.usermodel.*
;
import
org.joda.time.DateTime
;
import
org.joda.time.Days
;
...
...
@@ -38,10 +40,13 @@ import java.beans.Introspector;
import
java.beans.PropertyDescriptor
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.net.URLDecoder
;
import
java.net.URLEncoder
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -2593,6 +2598,22 @@ public class ContractServiceImpl implements ContractService {
return
objects
;
}
@Override
public
Object
checkCasAccount
(
String
email
)
{
String
url
=
Constant
.
adiAccountCheck
+
"/adi/api/user/bigBackstage/getUserInfo"
;
JSONObject
conditions
=
new
JSONObject
();
conditions
.
put
(
"email"
,
"liyibin@reyun.com"
);
conditions
.
put
(
"userKey"
,
"CAS"
);
conditions
.
put
(
"userSecret"
,
"90175b3c3d6370a3df874483caf5bc2c"
);
String
responseJson
=
HttpClientUtil
.
doPostBody
(
url
,
conditions
);
/* adHelper:渠道
SAAS:国内
oversea:海外
*/
return
responseJson
;
}
public
ResultModel
saveDataBySheet
(
Sheet
sheet
,
int
row_length
,
String
platformexcl
,
User
loginAccount
)
{
String
sheetName
=
sheet
.
getSheetName
();
...
...
src/main/java/util/Constant.java
View file @
79033d40
...
...
@@ -25,6 +25,7 @@ public class Constant {
public
static
String
reportUrl
=
commonBundle
.
getString
(
"report.url"
);
public
static
String
importTempUrl
=
commonBundle
.
getString
(
"import.temp.url"
);
public
static
String
adiUrl
=
commonBundle
.
getString
(
"adi.url"
);
public
static
String
adiAccountCheck
=
commonBundle
.
getString
(
"adi.account.check"
);
public
static
ResourceBundle
redis
=
ResourceBundle
.
getBundle
(
"redis"
);
public
static
String
REDIS_KEY_VALID_TIME
=
redis
.
getString
(
"redis.key.validtime"
);
...
...
src/main/java/util/HttpClientUtil.java
View file @
79033d40
package
util
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
net.sf.json.JSONObject
;
import
org.apache.commons.httpclient.*
;
import
org.apache.commons.httpclient.methods.GetMethod
;
import
org.apache.commons.httpclient.methods.PostMethod
;
import
org.apache.commons.httpclient.methods.RequestEntity
;
import
org.apache.commons.httpclient.methods.StringRequestEntity
;
import
org.apache.commons.httpclient.params.HttpConnectionManagerParams
;
import
org.apache.commons.httpclient.params.HttpMethodParams
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClientBuilder
;
import
org.apache.http.util.EntityUtils
;
import
java.io.*
;
import
java.util.ArrayList
;
...
...
@@ -388,4 +397,29 @@ public class HttpClientUtil {
}
return
response
;
}
/**
* Http post请求,获取结果.
*
* @param url
* @return
*/
public
static
String
doPostBody
(
String
url
,
JSONObject
json
)
{
CloseableHttpClient
httpclient
=
HttpClientBuilder
.
create
().
build
();
HttpPost
post
=
new
HttpPost
(
url
);
String
response
=
null
;
try
{
StringEntity
s
=
new
StringEntity
(
json
.
toString
(),
"UTF-8"
);
s
.
setContentType
(
"application/json"
);
//发送json数据需要设置contentType
post
.
setEntity
(
s
);
HttpResponse
res
=
httpclient
.
execute
(
post
);
if
(
res
.
getStatusLine
().
getStatusCode
()
==
HttpStatus
.
SC_OK
){
response
=
EntityUtils
.
toString
(
res
.
getEntity
(),
"UTF-8"
);
// 返回json格式:
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
return
response
;
}
}
src/main/resources/common.properties
View file @
79033d40
...
...
@@ -6,3 +6,4 @@ event.table=${event.table}
usergroup.table
=
${usergroup.table}
iscache
=
${iscache}
adi.url
=
${adi.url}
adi.account.check
=
${adi.account.check}
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