Commit ccbaf42a authored by shangying's avatar shangying

sonar问题修改4

parent 9d0d2ddb
...@@ -10,8 +10,9 @@ public enum ResposeResultEnum { ...@@ -10,8 +10,9 @@ public enum ResposeResultEnum {
CODE(1, "0"), CODE(1, "0"),
BUSINESSCODE(2, "0000"), BUSINESSCODE(2, "0000"),
STATUSCODE(3, "200"), STATUSCODE(3, "200"),
CONTEXT(4, "success"); CONTEXT(4, "success"),
FUAD_ASSIFN_SUCC(5,"FUAD_ASSIFN_SUCC"),
FUND_SUCC(6,"FUND_SUCC");
private int code; private int code;
private String desc; private String desc;
......
...@@ -6,6 +6,7 @@ import cn.quantgroup.cashloanflowboss.spi.gyxd.entity.LoanApplicationManifestHis ...@@ -6,6 +6,7 @@ import cn.quantgroup.cashloanflowboss.spi.gyxd.entity.LoanApplicationManifestHis
import cn.quantgroup.cashloanflowboss.spi.gyxd.repository.ILoanApplicationManifestHistoryRepository; import cn.quantgroup.cashloanflowboss.spi.gyxd.repository.ILoanApplicationManifestHistoryRepository;
import cn.quantgroup.cashloanflowboss.utils.http.HttpRequest; import cn.quantgroup.cashloanflowboss.utils.http.HttpRequest;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert; import org.testng.Assert;
...@@ -46,7 +47,8 @@ public class GuangDaXiaoDaiServiceImpl implements GuangDaXiaoDaiService { ...@@ -46,7 +47,8 @@ public class GuangDaXiaoDaiServiceImpl implements GuangDaXiaoDaiService {
Map<String, String> header =new HashMap<String, String>(); Map<String, String> header =new HashMap<String, String>();
header.put("Content-Type", "application/x-www-form-urlencoded"); header.put("Content-Type", "application/x-www-form-urlencoded");
JSONObject result= HttpRequest.doPostReturnResponseJson(url, paras, header); JSONObject result= HttpRequest.doPostReturnResponseJson(url, paras, header);
if(!result.get("data").toString().trim().isEmpty()) { String data=result.get("data").toString().trim();
if(!StringUtils.isBlank(data)) {
JSONObject resultData = (JSONObject) result.get("data"); JSONObject resultData = (JSONObject) result.get("data");
String businessCode=result.get("businessCode").toString().trim(); String businessCode=result.get("businessCode").toString().trim();
......
...@@ -48,9 +48,9 @@ public class OneClickDataQueueOperateServiceImpl implements OneClickDataQueueOpe ...@@ -48,9 +48,9 @@ public class OneClickDataQueueOperateServiceImpl implements OneClickDataQueueOpe
log.info("获取oneClickData:{},获取noticeType:{}",oneClickData,noticeType); log.info("获取oneClickData:{},获取noticeType:{}",oneClickData,noticeType);
if(Objects.isNull(oneClickData)){ if(Objects.isNull(oneClickData)){
}else{ }else{
if("FUAD_ASSIFN_SUCC".equals(noticeType)){ if(ResposeResultEnum.FUAD_ASSIFN_SUCC.getDesc().equals(noticeType)){
getFundAssifnSucc(oneClickData); getFundAssifnSucc(oneClickData);
} else if("FUND_SUCC".equals(noticeType)){ } else if(ResposeResultEnum.FUND_SUCC.getDesc().equals(noticeType)){
// 提现成功了,收到放款成功消息,修改oneClickData的放款状态 // 提现成功了,收到放款成功消息,修改oneClickData的放款状态
oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.CHECK_REPAYMENT_PLAN.getCode(), oneClickData.getId()); oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.CHECK_REPAYMENT_PLAN.getCode(), oneClickData.getId());
...@@ -205,7 +205,7 @@ public class OneClickDataQueueOperateServiceImpl implements OneClickDataQueueOpe ...@@ -205,7 +205,7 @@ public class OneClickDataQueueOperateServiceImpl implements OneClickDataQueueOpe
//这边判断有问题需要改?????????????? //这边判断有问题需要改??????????????
// ????????????? // ?????????????
if (result.get("businessCode").toString().trim().equals(ResposeResultEnum.BUSINESSCODE.getCode()) && result.get("code").toString().trim().equals(ResposeResultEnum.BUSINESSCODE.getCode())) { if (result.get("businessCode").toString().trim().equals(ResposeResultEnum.BUSINESSCODE.getDesc()) && result.get("code").toString().trim().equals(ResposeResultEnum.BUSINESSCODE.getDesc())) {
// 查看当前的放款单的状态是21 // 查看当前的放款单的状态是21
LoanApplicationHistory loanApplicationHistory = loanOperationService.selectLoanId(Long.valueOf(oneClickData.getUserId().trim()), oneClickData.getBizType()); LoanApplicationHistory loanApplicationHistory = loanOperationService.selectLoanId(Long.valueOf(oneClickData.getUserId().trim()), oneClickData.getBizType());
log.info("放款请求成功后的loanApplicationHistory={}", loanApplicationHistory); log.info("放款请求成功后的loanApplicationHistory={}", loanApplicationHistory);
......
package cn.quantgroup.cashloanflowboss.utils; package cn.quantgroup.cashloanflowboss.utils;
import java.security.SecureRandom;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -16,7 +17,7 @@ public class RandomlyGeneratedParameters { ...@@ -16,7 +17,7 @@ public class RandomlyGeneratedParameters {
private static final String[] email_suffix="@gmail.com,@yahoo.com,@msn.com,@hotmail.com,@aol.com,@ask.com,@live.com,@qq.com,@0355.net,@163.com,@163.net,@263.net,@3721.net,@yeah.net,@googlemail.com,@126.com,@sina.com,@sohu.com,@yahoo.com.cn".split(","); private static final String[] email_suffix="@gmail.com,@yahoo.com,@msn.com,@hotmail.com,@aol.com,@ask.com,@live.com,@qq.com,@0355.net,@163.com,@163.net,@263.net,@3721.net,@yeah.net,@googlemail.com,@126.com,@sina.com,@sohu.com,@yahoo.com.cn".split(",");
public static int getNum(int start,int end) { public static int getNum(int start,int end) {
return (int)(Math.random()*(end-start+1)+start); return (int)(new SecureRandom().nextDouble()*(end-start+1)+start);
} }
/** /**
...@@ -29,10 +30,10 @@ public class RandomlyGeneratedParameters { ...@@ -29,10 +30,10 @@ public class RandomlyGeneratedParameters {
int length=getNum(lMin,lMax); int length=getNum(lMin,lMax);
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
int number = (int)(Math.random()*base.length()); int number = (int)(new SecureRandom().nextDouble()*base.length());
sb.append(base.charAt(number)); sb.append(base.charAt(number));
} }
sb.append(email_suffix[(int)(Math.random()*email_suffix.length)]); sb.append(email_suffix[(int)(new SecureRandom().nextDouble()*email_suffix.length)]);
return sb.toString(); return sb.toString();
} }
......
...@@ -127,9 +127,9 @@ public class EnvUtil { ...@@ -127,9 +127,9 @@ public class EnvUtil {
public static String getHttpEnvBySite(String siteName){ public static String getHttpEnvBySite(String siteName){
String env = System.getProperty("Http.ENV"); String env = System.getProperty("Http.ENV");
if(StringUtils.isNotEmpty(siteName)){ if(!StringUtils.isBlank(siteName)){
String ciEnv= getEnvBySite(siteName); String ciEnv= getEnvBySite(siteName);
if(StringUtils.isNotEmpty(ciEnv)){ if(!StringUtils.isBlank(ciEnv)){
Properties propertys = System.getProperties(); Properties propertys = System.getProperties();
Set<Map.Entry<Object, Object>> propertySet = propertys.entrySet(); Set<Map.Entry<Object, Object>> propertySet = propertys.entrySet();
for (Map.Entry<Object, Object> property : propertySet) { for (Map.Entry<Object, Object> property : propertySet) {
......
...@@ -207,9 +207,12 @@ public class HttpService { ...@@ -207,9 +207,12 @@ public class HttpService {
e.printStackTrace(); e.printStackTrace();
} }
} }
if(!Objects.isNull(httpGet)){
httpGet.abort(); httpGet.abort();
} }
}
return resultEntity; return resultEntity;
} }
...@@ -472,7 +475,8 @@ public class HttpService { ...@@ -472,7 +475,8 @@ public class HttpService {
// 执行请求 // 执行请求
try { try {
if (url.startsWith("https")) { final String httpurl="https";
if (url.startsWith(httpurl)) {
System.setProperty("jsse.enableSNIExtension", "false"); System.setProperty("jsse.enableSNIExtension", "false");
if (filePath == null){ if (filePath == null){
response = createSSLClientDefault().execute(httpPost,localContext); response = createSSLClientDefault().execute(httpPost,localContext);
...@@ -523,8 +527,10 @@ public class HttpService { ...@@ -523,8 +527,10 @@ public class HttpService {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
try { try {
if (!Objects.isNull(instream)) if (!Objects.isNull(instream)){
instream.close(); instream.close();
}
} catch (Exception ignore) { } catch (Exception ignore) {
} }
} }
...@@ -597,8 +603,11 @@ public class HttpService { ...@@ -597,8 +603,11 @@ public class HttpService {
private void setHttpHeaderInfo(HttpRequestBase method, private void setHttpHeaderInfo(HttpRequestBase method,
Map<String, String> header) { Map<String, String> header) {
if (header == null) if (header == null) {
header = defaultHeaderInfo; header = defaultHeaderInfo;
}
// 设置Header 信息 // 设置Header 信息
if (header != null && header.size() > 0) { if (header != null && header.size() > 0) {
Set<String> key = header.keySet(); Set<String> key = header.keySet();
......
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