Commit 46c7e814 authored by libin's avatar libin

Merge remote-tracking branch 'origin/dev' into dev

parents 5d3dc2bd a43a44d7
......@@ -79,7 +79,7 @@ public class AppUserDTO {
private Integer buyCount;
private Integer lockDays;
private Integer discount;
private Integer memberLevel;
private Integer memberLevel = 0;
private String memberName;
//图标
private String icon;
......
......@@ -30,6 +30,7 @@ import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.im.feign.ImFeign;
import com.xxfc.platform.universal.dto.RegionDTO;
import com.xxfc.platform.universal.dto.SmsTemplateDTO;
import com.xxfc.platform.universal.feign.MQSenderFeign;
import com.xxfc.platform.universal.feign.RegionFeign;
import com.xxfc.platform.universal.feign.ThirdFeign;
......@@ -37,6 +38,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
......@@ -105,6 +107,9 @@ public class AppPermissionService {
@Autowired
private BaseUserMemberBiz baseUserMemberBiz;
@Value("${admin.smallName}")
private String smallName;
public AppUserInfo validate(String username, String password) {
AppUserInfo info = new AppUserInfo();
......@@ -955,7 +960,15 @@ public class AppPermissionService {
//上线绑定
relationBiz.bindByUserId(userid, small_id);
//发送短信通知用户
thirdFeign.sendCode(username, password, SystemConfig.TEMPLATECODE);
List<String> smsParams = new ArrayList<String>();
smsParams.add(smallName);
smsParams.add(username);
smsParams.add(password);
thirdFeign.sendTemplate(new SmsTemplateDTO(){{
setPhoneNumbers(username);
setType(SmsTemplateDTO.PWD);
setParams(smsParams.toArray(new String[smsParams.size()]));
}});
//参加新人活动
jionActivity(userid);
// 登录结果要做做统一处理
......
......@@ -157,12 +157,11 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
orpv.setRealAmount(orderPageVO.getRealAmount());
orpv.setRefundAmount(totalRefundAmount);
if(orderPageVO.getStatus().equals(OrderStatusEnum.ORDER_UNPAY.getCode())
|| orderPageVO.getStatus().equals(OrderStatusEnum.ORDER_CRT.getCode())) {
|| orderPageVO.getStatus().equals(OrderStatusEnum.ORDER_CRT.getCode())
|| totalDeductAmount.compareTo(BigDecimal.ZERO) <= 0) {
orpv.setRefundDesc("是否确定取消订单");
}else if(totalDeductAmount.compareTo(BigDecimal.ZERO) > 0) {
orpv.setRefundDesc(StrUtil.format("本次取消操作需要扣除{}元违约金,实际退款金额为{}元,您确定要取消订单吗?", totalDeductAmount, totalRefundAmount));
}else {
orpv.setRefundDesc("取消操作可能会产生额外费用,是否确定取消订单");
orpv.setRefundDesc(StrUtil.format("本次取消操作需要扣除{}元违约金,实际退款金额为{}元,您确定要取消订单吗?", totalDeductAmount, totalRefundAmount));
}
return ObjectRestResponse.succ(orpv);
}
......
......@@ -91,7 +91,7 @@ public abstract class AbstractOrderHandle<Biz extends BaseBiz, Detail extends Or
}
public void initDetail(Detail detail) {
Integer appUserId = (null == detail.getAppUserDTO())? Integer.valueOf(BaseContextHandler.getUserID()): detail.getAppUserDTO().getId();
Integer appUserId = (null == detail.getAppUserDTO())? Integer.valueOf(BaseContextHandler.getUserID()): detail.getAppUserDTO().getUserid();
BaseOrder order = createBaseOrder(detail.getOrderOrigin(), appUserId);
detail.setOrder(order);
}
......
......@@ -261,11 +261,15 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//计算车辆费用
//如果用户存在,并且为会员,并且车辆有优惠价
//默认折扣默认100
detail.setRebate(100);
if(null != dto && SYS_TRUE.equals(dto.getIsMember()) && !NONE.getCode().equals(dto.getMemberLevel()) && !DISCOUNT_STATUS_NONE.equals(vehicleModel.getRentDiscountStatus())) {
String[] prices = StrUtil.isBlank(vehicleModel.getRentDiscountPrice())
?new String[]{vehicleModel.getPrice().toString(),vehicleModel.getPrice().toString(),vehicleModel.getPrice().toString()}
:vehicleModel.getRentDiscountPrice().split(",");
HandleDiscountDTO handleDiscountDTO = new HandleDiscountDTO();
handleDiscountDTO.setRebate(100);
handleDiscountDTO.setModelAmount(vehicleModel.getPrice());
switch (MemberEnum.getByCode(dto.getMemberLevel())) {
case NORMAL:
handleDiscountDTO = handleDiscount(dto, vehicleModel, prices, NORMAL);
......@@ -279,6 +283,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
handleDiscountDTO = handleDiscount(dto, vehicleModel, prices, DIAMOND);
detail.getOrder().setHasMemberRight(SYS_TRUE);
break;
default:
break;
}
detail.setRebate(handleDiscountDTO.getRebate());
vehicleOrderItem.setUnitPrice(handleDiscountDTO.getModelAmount());
......
......@@ -83,6 +83,12 @@
<artifactId>jiguang-common</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>compile</scope>
</dependency>
</dependencies>
......
package com.xxfc.platform.universal.api;
import com.xxfc.platform.universal.api.pojo.Authentication;
import com.xxfc.platform.universal.entity.IdInformation;
/**
* 调用外部接口实现类。调用不同的外部接口,需要编写不同了类实现该类
*/
public interface BaseAuthentication {
Authentication getAuthentication(IdInformation idInformation);
}
package com.xxfc.platform.universal.api.impl;
import com.xxfc.platform.universal.api.BaseAuthentication;
import com.xxfc.platform.universal.api.pojo.Authentication;
import com.xxfc.platform.universal.entity.IdInformation;
public class FQAuthentication implements BaseAuthentication {
@Override
public Authentication getAuthentication(IdInformation idInformation) {
return null;
}
}
package com.xxfc.platform.universal.api.pojo;
public class Authentication {
}
......@@ -71,6 +71,8 @@ public class SmsTemplateDTO {
public static final int PAY_I= 26;
//旅游(上车通知)27
public static final int PAY_J= 27;
//小程序密码通知
public static final int PWD= 28;
......
package com.xxfc.platform.universal.utils;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
public class HttpUtils {
/**
* get
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doGet(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpGet request = new HttpGet(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
/**
* post form
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param bodys
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
Map<String, String> bodys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (bodys != null) {
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
for (String key : bodys.keySet()) {
nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
}
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
request.setEntity(formEntity);
}
return httpClient.execute(request);
}
/**
* Post String
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (StringUtils.isNotBlank(body)) {
request.setEntity(new StringEntity(body, "utf-8"));
}
return httpClient.execute(request);
}
/**
* Post stream
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPost(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPost request = new HttpPost(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (body != null) {
request.setEntity(new ByteArrayEntity(body));
}
return httpClient.execute(request);
}
/**
* Put String
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
String body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (StringUtils.isNotBlank(body)) {
request.setEntity(new StringEntity(body, "utf-8"));
}
return httpClient.execute(request);
}
/**
* Put stream
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public static HttpResponse doPut(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys,
byte[] body)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpPut request = new HttpPut(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
if (body != null) {
request.setEntity(new ByteArrayEntity(body));
}
return httpClient.execute(request);
}
/**
* Delete
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public static HttpResponse doDelete(String host, String path, String method,
Map<String, String> headers,
Map<String, String> querys)
throws Exception {
HttpClient httpClient = wrapClient(host);
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
return httpClient.execute(request);
}
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
StringBuilder sbUrl = new StringBuilder();
sbUrl.append(host);
if (!StringUtils.isBlank(path)) {
sbUrl.append(path);
}
if (null != querys) {
StringBuilder sbQuery = new StringBuilder();
for (Map.Entry<String, String> query : querys.entrySet()) {
if (0 < sbQuery.length()) {
sbQuery.append("&");
}
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
sbQuery.append(query.getValue());
}
if (!StringUtils.isBlank(query.getKey())) {
sbQuery.append(query.getKey());
if (!StringUtils.isBlank(query.getValue())) {
sbQuery.append("=");
sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
}
}
}
if (0 < sbQuery.length()) {
sbUrl.append("?").append(sbQuery);
}
}
return sbUrl.toString();
}
private static HttpClient wrapClient(String host) {
HttpClient httpClient = new DefaultHttpClient();
if (host.startsWith("https://")) {
sslClient(httpClient);
}
return httpClient;
}
private static void sslClient(HttpClient httpClient) {
try {
SSLContext ctx = SSLContext.getInstance("TLS");
X509TrustManager tm = new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] xcs, String str) {
}
public void checkServerTrusted(X509Certificate[] xcs, String str) {
}
};
ctx.init(null, new TrustManager[] { tm }, null);
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
ClientConnectionManager ccm = httpClient.getConnectionManager();
SchemeRegistry registry = ccm.getSchemeRegistry();
registry.register(new Scheme("https", 443, ssf));
} catch (KeyManagementException ex) {
throw new RuntimeException(ex);
} catch (NoSuchAlgorithmException ex) {
throw new RuntimeException(ex);
}
}
}
\ No newline at end of file
......@@ -82,6 +82,9 @@ public class AliYunSmsBiz {
//旅游(上车通知)27
public static final String TEMPLATE_ID_PAY_J= "SMS_173345606";
//旅游(上车通知)27
public static final String PWD= "SMS_174990497";
//发送模板消息
......@@ -166,6 +169,9 @@ public class AliYunSmsBiz {
case 27 :
SmsService.sendTemplateToJson(phoneNumbers,params,TEMPLATE_ID_PAY_J);
break;
case 28 :
SmsService.sendTemplateToJson(phoneNumbers,params,PWD);
break;
}
......
package com.xxfc.platform.universal.biz;
import lombok.Data;
/**
* 用户信息类
* @author Administrator
*/
@Data
public class UserMessage {
private String name;
private String idNumber;
}
......@@ -7,8 +7,10 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.exception.BaseException;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.universal.biz.UserMessage;
import com.xxfc.platform.universal.entity.IdInformation;
import com.xxfc.platform.universal.mapper.IdInformationMapper;
import com.xxfc.platform.universal.service.authenticationInterface.UserAuthentication;
import com.xxfc.platform.universal.utils.CertifHttpUtils;
import com.xxfc.platform.universal.utils.Validation;
import lombok.extern.slf4j.Slf4j;
......@@ -21,6 +23,7 @@ import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
......@@ -31,9 +34,16 @@ import java.text.SimpleDateFormat;
import java.util.*;
/**
* 认证业务
* @author Administrator
*/
@Service
@Slf4j
public class CertificationService {
@Autowired
private UserAuthentication authentication;
/**
* 认证相关的数据
*/
......@@ -209,17 +219,20 @@ public class CertificationService {
}
//map携带身份证和姓名进行认证
Map<String, String> authMap = new HashMap<>();
authMap.put(idCardName, (String) frontData.get(numberName));
authMap.put(cName, (String) frontData.get(cName));
//3.调用接口进行认证
String result = certificate(authMap);
// Map<String, String> authMap = new HashMap<>();
// authMap.put(idCardName, (String) frontData.get(numberName));
// authMap.put(cName, (String) frontData.get(cName));
// //3.调用接口进行认证
//
// boolean result = certificate(authMap);
boolean result = authentication.certificate(new UserMessage(){{
setIdNumber(number);
setName(name);
}} );
log.info("----认证结果result=========" + result);
//认证返回的参数是否为空
if (!StringUtils.isBlank(result)) {
Map<String, Object> map = (Map<String, Object>) JSONObject.parse(result);
log.info("----certifRet=========" + certifRet);
if (MapUtil.isNotEmpty(map) || certifResultCode.equals(map.get(certifRet))) {
if (result) {
//认证成功后存入保存到数据库
//获得身份证正面记录的身份证号和真实姓名
//设置姓名
......@@ -257,9 +270,6 @@ public class CertificationService {
// return ObjectRestResponse.succ(objRR.getData());
// }
}
}
return ObjectRestResponse.createFailedResult(ResultCode.INCOMPLETE_DATA,"网络异常,请稍后再试");
......@@ -267,7 +277,8 @@ public class CertificationService {
//认证
public String certificate(Map<String, String> querys) {
//认证
public boolean certificate(Map<String, String> querys) {
Map<String, String> headers = new HashMap<String, String>();
headers.put("Authorization", "APPCODE " + cAppcode);
try {
......@@ -280,15 +291,27 @@ public class CertificationService {
*/
//获取response的body
if (statusCode == 200) {
return EntityUtils.toString(response.getEntity());
String result = EntityUtils.toString(response.getEntity());
log.info("----认证结果result=========" + result);
//认证返回的参数是否为空
if (!StringUtils.isBlank(result)) {
Map<String, Object> map = (Map<String, Object>) JSONObject.parse(result);
log.info("----certifRet=========" + certifRet);
if (MapUtil.isNotEmpty(map) || certifResultCode.equals(map.get(certifRet))) {
return true;
}
}
}
return false;
} catch (Exception e) {
e.printStackTrace();
return false;
}
return null;
}
//身份证照片解析
public String imageParse(String imageUrl, String type) {
Map<String, String> headers = new HashMap<String, String>();
......@@ -317,10 +340,7 @@ public class CertificationService {
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
......
package com.xxfc.platform.universal.service.authenticationInterface;
import com.xxfc.platform.universal.biz.UserMessage;
import java.util.Map;
/**
* 用户认证类
* @author Administrator
*/
public interface UserAuthentication {
/**
* 用户认证方法
* @param message
* @return
*/
boolean certificate(UserMessage message) ;
}
package com.xxfc.platform.universal.service.authenticationInterface.impl;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONObject;
import com.xxfc.platform.universal.biz.UserMessage;
import com.xxfc.platform.universal.service.authenticationInterface.UserAuthentication;
import com.xxfc.platform.universal.utils.CertifHttpUtils;
import com.xxfc.platform.universal.utils.HttpUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.util.EntityUtils;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* 调用北京畅游互联科技有限公司接口
*
* @author Administrator
*/
@Service
@Slf4j
@Primary
public class BJCYAuthentication implements UserAuthentication {
private final String host = "http://aliyunverifyidcard.haoservice.com";
private final String path = "/idcard/VerifyIdcardv2";
private final String method = "GET";
private final String appcode = "ee7710ce92054cae9f6c040f6864e6a7";
private final String tokenHead = "Authorization";
private final String token="APPCODE " + appcode;
private final String cardNo ="cardNo";
private final String realName ="realName";
private final Integer resultCode=0;
private final String ret="error_code";
@Override
public boolean certificate(UserMessage message) {
Map<String, String> headers = new HashMap<String, String>();
headers.put(tokenHead, token);
Map<String, String> querys = new HashMap<String, String>();
querys.put(cardNo, message.getIdNumber());
querys.put(realName, message.getName());
try {
HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
StatusLine statusLine = response.getStatusLine();
log.error(response.toString());
int statusCode = statusLine.getStatusCode();
log.error(statusCode+"");
//获取response的body
if (statusCode == 200) {
String result = EntityUtils.toString(response.getEntity());
log.info("----认证结果result=========" + result);
//认证返回的参数是否为空
if (!StringUtils.isBlank(result)) {
Map<String, Object> map = (Map<String, Object>) JSONObject.parse(result);
log.info("----certifRet=========" + map);
if (MapUtil.isNotEmpty(map) || resultCode.equals(map.get(ret))) {
return true;
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}
package com.xxfc.platform.universal.service.authenticationInterface.impl;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSONObject;
import com.xxfc.platform.universal.biz.UserMessage;
import com.xxfc.platform.universal.service.authenticationInterface.UserAuthentication;
import com.xxfc.platform.universal.utils.CertifHttpUtils;
import com.xxfc.platform.universal.utils.HttpUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* 调用四川涪擎认证接口
*
* @author Administrator
*/
@Service
@Slf4j
public class XCFQAuthentication implements UserAuthentication {
private String cAppcode="acea1c8811f748b3a65815f11db357c4";
/**
* 认证相关的数据
*/
private String cHost = "https://idcert.market.alicloudapi.com";
private String cPath = "/idcard";
private String cMethod = "GET";
//响应:认证错误码字段名
private String certifRet = "status";
//响应:认证通过码
private String certifResultCode = "01";
//请求:身份证号字段名
private String idCardName = "idCard";
//请求:用户姓名字段名
private String cName = "name";
@Override
public boolean certificate(UserMessage message) {
//map携带身份证和姓名进行认证
Map<String, String> querys = new HashMap<>();
querys.put(idCardName, message.getIdNumber());
querys.put(cName, message.getName());
Map<String, String> headers = new HashMap<String, String>();
headers.put("Authorization", "APPCODE " + cAppcode);
try {
log.info("----querys=========" + querys);
HttpResponse response = HttpUtils.doGet(cHost, cPath, cMethod, headers, querys);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
/**
* 状态码: 200 正常;400 URL无效;401 appCode错误; 403 次数用完; 500 API网管错误
*/
//获取response的body
if (statusCode == 200) {
String result = EntityUtils.toString(response.getEntity());
log.info("----认证结果result=========" + result);
//认证返回的参数是否为空
if (!StringUtils.isBlank(result)) {
Map<String, Object> map = (Map<String, Object>) JSONObject.parse(result);
log.info("----certifRet=========" + certifRet);
if (MapUtil.isNotEmpty(map) || certifResultCode.equals(map.get(certifRet))) {
return true;
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}
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