Commit b51ec9dd authored by shangying's avatar shangying

sonar问题修改13

parent 4b1ededd
...@@ -37,7 +37,7 @@ public interface OneClickDataRespository extends JpaRepository<OneClickData, Lon ...@@ -37,7 +37,7 @@ public interface OneClickDataRespository extends JpaRepository<OneClickData, Lon
OneClickData findByLoanId(String loanId); OneClickData findByLoanId(String loanId);
// 通过授信状态查询,申请类型是非1的 // 通过授信状态查询,申请类型是非1的
@Query(value = "select * from one_click_data where credit_status = ?1 and type not in ?2 order by id", nativeQuery = true) @Query(value = "select * from one_click_data where credit_status = ?1 and type not in (?2) order by id desc", nativeQuery = true)
List<OneClickData> findByCreditStatusAndTypeNotIn(Integer creditStatus,Integer type); List<OneClickData> findByCreditStatusAndTypeNotIn(Integer creditStatus,Integer type);
// 通过id修改 放款loanid // 通过id修改 放款loanid
......
...@@ -55,7 +55,7 @@ public class CreditGrantingServiceImpl implements CreditGrantingService{ ...@@ -55,7 +55,7 @@ public class CreditGrantingServiceImpl implements CreditGrantingService{
}else if(String.valueOf(TypeEnum.CREDITFAIL.getCode()).equals(oneClickModel.getType())){ }else if(String.valueOf(TypeEnum.CREDITFAIL.getCode()).equals(oneClickModel.getType())){
auditResult="false"; auditResult="false";
}else { }else {
log.info("非授信需要的状态,打印一下oneClickModel.getType()={}",oneClickModel.getType()); log.info("非授信需要的状态,打印一下oneClickModel.getType()={},TypeEnum.LOANSUCCESS.getCode()={}",oneClickModel.getType(),TypeEnum.LOANSUCCESS.getCode());
} }
return applyCreditNotify(oneClickModel,auditResult,0); return applyCreditNotify(oneClickModel,auditResult,0);
} }
...@@ -63,7 +63,7 @@ public class CreditGrantingServiceImpl implements CreditGrantingService{ ...@@ -63,7 +63,7 @@ public class CreditGrantingServiceImpl implements CreditGrantingService{
@Override @Override
public Result authAmountAuditNotifyMq(OneClickData oneClickData, QuotaCredit quotaCredit) throws Exception { public Result authAmountAuditNotifyMq(OneClickData oneClickData, QuotaCredit quotaCredit) throws Exception {
String auditResult="true"; String auditResult="true";
if(String.valueOf(TypeEnum.CREDITSUCCESS.getCode()).equals(oneClickData.getType()) || String.valueOf(TypeEnum.LOANSUCCESS.getCode()).equals(oneClickData.getType()) || String.valueOf(TypeEnum.LOANFAIL.getCode()).equals(oneClickData.getType())|| String.valueOf(TypeEnum.LIQUIDATION.getCode()).equals(oneClickData.getType()) || String.valueOf(TypeEnum.CASHWITHDRAWAL.getCode()).equals(oneClickData.getType())){ if(TypeEnum.CREDITSUCCESS.getCode() == oneClickData.getType() || TypeEnum.LOANSUCCESS.getCode() == oneClickData.getType() || TypeEnum.LOANFAIL.getCode() == oneClickData.getType() || TypeEnum.LIQUIDATION.getCode() == oneClickData.getType() || TypeEnum.CASHWITHDRAWAL.getCode() == oneClickData.getType()){
auditResult="true"; auditResult="true";
}else if(String.valueOf(TypeEnum.CREDITFAIL.getCode()).equals(oneClickData.getType())){ }else if(String.valueOf(TypeEnum.CREDITFAIL.getCode()).equals(oneClickData.getType())){
auditResult="false"; auditResult="false";
...@@ -228,7 +228,7 @@ public class CreditGrantingServiceImpl implements CreditGrantingService{ ...@@ -228,7 +228,7 @@ public class CreditGrantingServiceImpl implements CreditGrantingService{
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");
// 通过手机号和渠道code获取token // 通过手机号和渠道code获取token
String getToken=phoneInfoService.getToken(oneClickData.getPhone(), oneClickData.getChannel()); String getToken=phoneInfoService.getToken(oneClickData.getPhone(), oneClickData.getChannelCode());
header.put("x-auth-token", getToken); header.put("x-auth-token", getToken);
log.info("获取paras={},获取header={}",paras,header); log.info("获取paras={},获取header={}",paras,header);
......
...@@ -160,11 +160,12 @@ public class LoanOperationServiceImpl implements LoanOperationService{ ...@@ -160,11 +160,12 @@ public class LoanOperationServiceImpl implements LoanOperationService{
//系统自动打款,无需调用打款操作 //系统自动打款,无需调用打款操作
return payNotify(oneClickData, payStatus); return payNotify(oneClickData, payStatus);
}else{ }else{
oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.DIRECT_INVESTMENT_FAILURE.getCode(), oneClickData.getId()); // 尚未走提现操作进入提现请求操作中
// oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.DIRECT_INVESTMENT_FAILURE.getCode(), oneClickData.getId());
return isFundsPlanLoanApply(oneClickData, payStatus);
} }
return isFundsPlanLoanApply(oneClickData, payStatus);
} }
...@@ -177,8 +178,10 @@ public class LoanOperationServiceImpl implements LoanOperationService{ ...@@ -177,8 +178,10 @@ public class LoanOperationServiceImpl implements LoanOperationService{
String assignPeopleNum=""; String assignPeopleNum="";
BigDecimal AmountMountSumCount=queryLendingRecordAmountMountSumCount(Long.parseLong(oneClickData.getFundCorpId())); BigDecimal AmountMountSumCount=queryLendingRecordAmountMountSumCount(Long.parseLong(oneClickData.getFundCorpId()));
Long sumCount=queryLendingRecordSumCount(Long.parseLong(oneClickData.getFundCorpId())); Long sumCount=queryLendingRecordSumCount(Long.parseLong(oneClickData.getFundCorpId()));
log.info("获取sql金额为AmountMountSumCount={},sumCount={}",AmountMountSumCount,sumCount);
if(Objects.isNull(AmountMountSumCount) || Objects.isNull(sumCount) ){ if(Objects.isNull(AmountMountSumCount) || Objects.isNull(sumCount) ){
log.info("获取sql金额为AmountMountSumCount={},sumCount={}",AmountMountSumCount,sumCount);
// 不需要提现已经进行提现,直接进行放款操作
return payNotify(oneClickData, payStatus); return payNotify(oneClickData, payStatus);
}else { }else {
...@@ -209,6 +212,7 @@ public class LoanOperationServiceImpl implements LoanOperationService{ ...@@ -209,6 +212,7 @@ public class LoanOperationServiceImpl implements LoanOperationService{
//直投打款完毕进行放款操作 //直投打款完毕进行放款操作
return payNotify(oneClickData, payStatus); return payNotify(oneClickData, payStatus);
} else { } else {
log.info("走提现路线了,查询库中放款状态不是21");
oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.DIRECT_INVESTMENT_FAILURE.getCode(), oneClickData.getId()); oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.DIRECT_INVESTMENT_FAILURE.getCode(), oneClickData.getId());
} }
...@@ -216,6 +220,7 @@ public class LoanOperationServiceImpl implements LoanOperationService{ ...@@ -216,6 +220,7 @@ public class LoanOperationServiceImpl implements LoanOperationService{
} }
} else { } else {
// 发起提现失败 // 发起提现失败
log.info("提现失败");
oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.DIRECT_INVESTMENT_FAILURE.getCode(), oneClickData.getId()); oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.DIRECT_INVESTMENT_FAILURE.getCode(), oneClickData.getId());
return result; return result;
} }
......
package cn.quantgroup.cashloanflowboss.api.oneclickdata.service.impl; import cn.quantgroup.cashloanflowboss.api.oneclickdata.entity.OneClickData;import cn.quantgroup.cashloanflowboss.api.oneclickdata.repository.OneClickDataRespository;import cn.quantgroup.cashloanflowboss.api.oneclickdata.service.CreditGrantingService;import cn.quantgroup.cashloanflowboss.api.oneclickdata.service.OneClickDataOperateJobService;import cn.quantgroup.cashloanflowboss.api.oneclickdata.service.PhoneInfoService;import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.QuotaCredit;import lombok.extern.slf4j.Slf4j;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service; import java.util.List;import java.util.Objects; /** * Created by shang on 2019/12/12. */@Slf4j@Servicepublic class OneClickDataOperateJobServiceImpl implements OneClickDataOperateJobService { @Autowired private PhoneInfoService phoneInfoService; @Autowired private OneClickDataRespository oneClickDataRespository; @Autowired private CreditGrantingService creditGrantingService; @Override public void excuteCreditSuccessJob() { } @Override public void excuteCreditFailJob() { } @Override public void excuteSelectCreditStatusJob() { //查找请求类型:2授信成功、4放款成功、5放款失败、6清算的单,并且当前的授信状态是0授信中 List<OneClickData> oneClickDataList=oneClickDataRespository.findByCreditStatusAndTypeNotIn(0, 1); if(oneClickDataList.size()>0 || oneClickDataList !=null) { for (OneClickData oneClickData : oneClickDataList) { // 当前授信中的单在apply_quota 查看状态是apply_status=1 时间倒序,进行授信请求操作 QuotaCredit quotaCredit1 = phoneInfoService.selectUserAuditRecords(Long.parseLong(oneClickData.getUserId()), Long.parseLong(oneClickData.getChannelCode())); if (Objects.isNull(quotaCredit1)) { log.info("不符合授信审核申请的条件"); } else { //如何条件的单进行授信申请请求 log.info("符合授信审核申请的条件oneClickData={},quotaCredit1={}", oneClickData, quotaCredit1); try { creditGrantingService.authAmountAuditNotifyMq(oneClickData, quotaCredit1); } catch (Exception e) { log.info("进入异常e={}", e.getMessage()); } } } }else{ log.info("oneClickDataList为空={}",oneClickDataList); } } @Override public void excuteFundSucessJob() { } @Override public void excuteFundFailJob() { } @Override public void excuteSelectFundStatusJob() { } } package cn.quantgroup.cashloanflowboss.api.oneclickdata.service.impl; import cn.quantgroup.cashloanflowboss.api.oneclickdata.entity.OneClickData;import cn.quantgroup.cashloanflowboss.api.oneclickdata.repository.OneClickDataRespository;import cn.quantgroup.cashloanflowboss.api.oneclickdata.service.CreditGrantingService;import cn.quantgroup.cashloanflowboss.api.oneclickdata.service.OneClickDataOperateJobService;import cn.quantgroup.cashloanflowboss.api.oneclickdata.service.PhoneInfoService;import cn.quantgroup.cashloanflowboss.spi.xyqb.entity.QuotaCredit;import lombok.extern.slf4j.Slf4j;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Service; import java.util.List;import java.util.Objects; /** * Created by shang on 2019/12/12. */@Slf4j@Servicepublic class OneClickDataOperateJobServiceImpl implements OneClickDataOperateJobService { @Autowired private PhoneInfoService phoneInfoService; @Autowired private OneClickDataRespository oneClickDataRespository; @Autowired private CreditGrantingService creditGrantingService; @Override public void excuteCreditSuccessJob() { } @Override public void excuteCreditFailJob() { } @Override public void excuteSelectCreditStatusJob() { //查找请求类型:2授信成功、4放款成功、5放款失败、6清算的单,并且当前的授信状态是0授信中 List<OneClickData> oneClickDataList=oneClickDataRespository.findByCreditStatusAndTypeNotIn(0, 1); if(oneClickDataList.size()>0 || oneClickDataList !=null) { for (OneClickData oneClickData : oneClickDataList) { // 当前授信中的单在apply_quota 查看状态是apply_status=1 时间倒序,进行授信请求操作 log.info("打印一下oneClickData.getUserId()={},oneClickData.getChannelCode()={}",oneClickData.getUserId(),oneClickData.getChannelCode()); QuotaCredit quotaCredit1 = phoneInfoService.selectUserAuditRecords(Long.parseLong(oneClickData.getUserId()), Long.parseLong(oneClickData.getChannelCode())); if (Objects.isNull(quotaCredit1)) { log.info("不符合授信审核申请的条件"); } else { //如何条件的单进行授信申请请求 log.info("符合授信审核申请的条件oneClickData={},quotaCredit1={}", oneClickData, quotaCredit1); try { creditGrantingService.authAmountAuditNotifyMq(oneClickData, quotaCredit1); } catch (Exception e) { log.info("进入异常e={}", e.getMessage()); } } } }else{ log.info("oneClickDataList为空={}",oneClickDataList); } } @Override public void excuteFundSucessJob() { } @Override public void excuteFundFailJob() { } @Override public void excuteSelectFundStatusJob() { } }
\ No newline at end of file \ No newline at end of file
......
...@@ -48,6 +48,11 @@ public class OneClickDataOperateServiceImpl implements OneClickDataOperateServic ...@@ -48,6 +48,11 @@ public class OneClickDataOperateServiceImpl implements OneClickDataOperateServic
@Override @Override
public Result OneKeyCreditSuccessOrFail(OneClickModel oneClickModel) throws Exception { public Result OneKeyCreditSuccessOrFail(OneClickModel oneClickModel) throws Exception {
return applyLoanService.applyLoan(oneClickModel);
}
public Result OneKeyCreditSuccessOrFailOld(OneClickModel oneClickModel) throws Exception {
Result creditResult=applyLoanService.applyLoan(oneClickModel); Result creditResult=applyLoanService.applyLoan(oneClickModel);
if(creditResult.getCode()== ApplicationStatus.SUCCESS.getCode()){ if(creditResult.getCode()== ApplicationStatus.SUCCESS.getCode()){
log.info("申请成功后,进入风控回调环境={}",creditResult); log.info("申请成功后,进入风控回调环境={}",creditResult);
...@@ -57,7 +62,6 @@ public class OneClickDataOperateServiceImpl implements OneClickDataOperateServic ...@@ -57,7 +62,6 @@ public class OneClickDataOperateServiceImpl implements OneClickDataOperateServic
log.info("当前进行进件申请失败oneClickModel={},creditResult={}",oneClickModel,creditResult); log.info("当前进行进件申请失败oneClickModel={},creditResult={}",oneClickModel,creditResult);
return creditResult; return creditResult;
} }
// return applyLoanService.applyLoan(oneClickModel);
} }
......
...@@ -183,31 +183,37 @@ public class OneClickDataQueueOperateServiceImpl implements OneClickDataQueueOpe ...@@ -183,31 +183,37 @@ public class OneClickDataQueueOperateServiceImpl implements OneClickDataQueueOpe
} }
public void applyLendingNotify(OneClickData oneClickData,LoanApplicationHistory loanApplicationHistory1){ public void applyLendingNotify(OneClickData oneClickData,LoanApplicationHistory loanApplicationHistory1){
String payStatus="true"; String payStatus="3";
// 通过申请类型确定是否要放款成功、失败 // 通过申请类型确定是否要放款成功、失败
// 放款成功、清单修改状态成功,放款失败修改状态失败 // 放款成功、清单修改状态成功,放款失败修改状态失败
if(oneClickData.getType() == TypeEnum.LOANFAIL.getCode() ){ if(oneClickData.getType() == TypeEnum.LOANFAIL.getCode() ){
payStatus="false"; payStatus="4";
}else { }else {
payStatus="true"; payStatus="3";
} }
JSONObject result=new JSONObject(); JSONObject result=new JSONObject();
//如果已经体现了:21 ,就不需要在调用体现操作,而是直接通知 //如果已经体现了:21 ,就不需要在调用体现操作,而是直接通知
String progress=loanApplicationHistory1.getProgress().getDescription().trim(); String progress=loanApplicationHistory1.getProgress().getDescription().trim();
log.info("如果已经提现了:21 ,就不需要在调用体现操作,而是直接通知progress={}",progress);
if(LoanProgress.FINAL_SENDED_TO_FUNDING_CORP.getDescription().equals(progress)){ if(LoanProgress.FINAL_SENDED_TO_FUNDING_CORP.getDescription().equals(progress)){
result =loanOperationService.payNotify(oneClickData, payStatus); result =loanOperationService.payNotify(oneClickData, payStatus);
} else { } else {
//查看是否有待放款的人和数量,并且确定放款通知 //查看是否有待放款的人和数量,并且确定放款通知
result = loanOperationService.fundsPlanLoanApply(oneClickData, payStatus); result = loanOperationService.fundsPlanLoanApply(oneClickData, payStatus);
} }
log.info("放款结果result={}",result);
//这边判断有问题需要改?????????????? //这边判断有问题需要改??????????????
// ????????????? // ?????????????
String businessCode=result.get("businessCode").toString().trim(); String businessCode=result.get("businessCode").toString().trim();
String code=result.get("code").toString().trim(); String code=result.get("code").toString().trim();
if (businessCode.equals(ResposeResultEnum.BUSINESSCODE.getDesc()) && code.equals(ResposeResultEnum.BUSINESSCODE.getDesc())) { String statusCode=result.get("statusCode").toString().trim();
String success=result.get("success").toString().trim();
boolean isOk=(businessCode.equals(ResposeResultEnum.BUSINESSCODE.getDesc()) && code.equals(ResposeResultEnum.BUSINESSCODE.getDesc())) || (statusCode.equals(ResposeResultEnum.STATUSCODE.getDesc()) && success.equals(ResposeResultEnum.CONTEXT.getDesc()));
if (isOk) {
log.info("获取当前的isOk={}",isOk);
// 查看当前的放款单的状态是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);
...@@ -221,11 +227,13 @@ public class OneClickDataQueueOperateServiceImpl implements OneClickDataQueueOpe ...@@ -221,11 +227,13 @@ public class OneClickDataQueueOperateServiceImpl implements OneClickDataQueueOpe
oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.CHECK_REPAYMENT_PLAN.getCode(), oneClickData.getId()); oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.CHECK_REPAYMENT_PLAN.getCode(), oneClickData.getId());
} else { } else {
log.info("放款请求成功,但是查询库中的状态不对progress1={}",progress1);
//直投打款成功,但状态不对 //直投打款成功,但状态不对
oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.DIRECT_INVESTMENT_SUCCESS_STATUSNOTRIGHT.getCode(), oneClickData.getId()); oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.DIRECT_INVESTMENT_SUCCESS_STATUSNOTRIGHT.getCode(), oneClickData.getId());
} }
} else { } else {
log.info("返回结果不对isOk");
oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.LOAN_REQUEST_FAILED.getCode(), oneClickData.getId()); oneClickDataRespository.updateLoanStatusById(LoanStatusEnum.LOAN_REQUEST_FAILED.getCode(), oneClickData.getId());
} }
......
...@@ -137,8 +137,14 @@ public class EnvUtil { ...@@ -137,8 +137,14 @@ 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");
String ciEnv="";
if(!StringUtils.isBlank(siteName)){ if(!StringUtils.isBlank(siteName)){
String ciEnv= getEnvBySite(siteName); if(StringUtils.isBlank(getEnvBySite(siteName))){
return env;
}else{
ciEnv= getEnvBySite(siteName);
}
if(!StringUtils.isBlank(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();
...@@ -157,6 +163,7 @@ public class EnvUtil { ...@@ -157,6 +163,7 @@ public class EnvUtil {
} }
} }
}else{ }else{
return env; return env;
} }
......
...@@ -263,7 +263,6 @@ public class HttpService { ...@@ -263,7 +263,6 @@ public class HttpService {
log.info("异常信息e={}",e); log.info("异常信息e={}",e);
} }
log.info("进入doResponse方法之前: ");
if(Objects.isNull(response)){ if(Objects.isNull(response)){
log.info("当前的response对象是空:{}",response); log.info("当前的response对象是空:{}",response);
...@@ -295,7 +294,7 @@ public class HttpService { ...@@ -295,7 +294,7 @@ public class HttpService {
if (null == url || url.isEmpty() || !url.startsWith(httpUrl)) {// 如果urlString为null或者urlString为空,或urlString非http开头,返回src空值 if (null == url || url.isEmpty() || !url.startsWith(httpUrl)) {// 如果urlString为null或者urlString为空,或urlString非http开头,返回src空值
return resultEntity; return resultEntity;
} }
CloseableHttpResponse response = null; CloseableHttpResponse response = null ;
HttpPost httpPost = null; HttpPost httpPost = null;
try { try {
httpPost = new HttpPost(url); httpPost = new HttpPost(url);
...@@ -338,28 +337,34 @@ public class HttpService { ...@@ -338,28 +337,34 @@ public class HttpService {
} catch (Exception e) { } catch (Exception e) {
log.info("异常信息e={}", e); log.info("异常信息e={}", e);
} }
result = doResponse(response, url);
resultEntity.setCookies(cookieStore.getCookies());
if(StringUtils.isNotEmpty(url)){
if(StringUtils.isNotEmpty(response.toString())){
log.info("请求超时,最大超时时间:{},url:{}", CommonConstant.HTTPCLIENT_CONNECT_TIMEOUT, url);
return resultEntity;
}
// 得到响应状态码
if(!Objects.isNull(response.getStatusLine())) {
// 根据状态码进行逻辑处理
int statuCode = response.getStatusLine().getStatusCode();
result=getReslut( statuCode, url, response);
System.out.println("打印获取的result: "+result);
resultEntity.setResponseString(result);
resultEntity.setStatusCode(response.getStatusLine().getStatusCode());
}else{
return resultEntity;
}
if(Objects.isNull(response)){
return resultEntity;
}else{
result = doResponse(response, url);
resultEntity.setCookies(cookieStore.getCookies());
if(StringUtils.isNotEmpty(url)){
if(Objects.isNull(response)){
log.info("请求超时,最大超时时间:{},url:{}", CommonConstant.HTTPCLIENT_CONNECT_TIMEOUT, url);
return resultEntity;
}
// 得到响应状态码
if(!Objects.isNull(response.getStatusLine())) {
// 根据状态码进行逻辑处理
int statuCode = response.getStatusLine().getStatusCode();
result=getReslut( statuCode, url, response);
System.out.println("打印获取的result: "+result);
resultEntity.setResponseString(result);
resultEntity.setStatusCode(response.getStatusLine().getStatusCode());
}else{
return resultEntity;
}
}
} }
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
......
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