Commit 79033d40 by lzxry

cas主账号校验

parent 01f68897
......@@ -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>
......
......@@ -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,
......
......@@ -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
......@@ -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();
......
......@@ -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");
......
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;
}
}
......@@ -6,3 +6,4 @@ event.table=${event.table}
usergroup.table=${usergroup.table}
iscache=${iscache}
adi.url=${adi.url}
adi.account.check=${adi.account.check}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment