Commit ff156b33 authored by shihuajun's avatar shihuajun

基础方法

parent 6bd29b52
...@@ -60,12 +60,15 @@ public class HttpClientConfig { ...@@ -60,12 +60,15 @@ public class HttpClientConfig {
* 创建TrustManager * 创建TrustManager
*/ */
X509TrustManager xtm = new X509TrustManager() { X509TrustManager xtm = new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
} }
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
} }
@Override
public X509Certificate[] getAcceptedIssuers() { public X509Certificate[] getAcceptedIssuers() {
return null; return null;
} }
...@@ -86,16 +89,17 @@ public class HttpClientConfig { ...@@ -86,16 +89,17 @@ public class HttpClientConfig {
HttpRequestRetryHandler retryHandler = new HttpRequestRetryHandler() { HttpRequestRetryHandler retryHandler = new HttpRequestRetryHandler() {
@Override @Override
public boolean retryRequest(IOException arg0, int retryTimes, HttpContext arg2) { public boolean retryRequest(IOException arg0, int retryTimes, HttpContext arg2) {
if (retryTimes >= 2) if (retryTimes >= 2) {
return false; return false;
}
if (arg0 instanceof UnknownHostException || arg0 instanceof ConnectTimeoutException if (arg0 instanceof UnknownHostException || arg0 instanceof ConnectTimeoutException
|| !(arg0 instanceof SSLException) || arg0 instanceof SocketTimeoutException) || !(arg0 instanceof SSLException) || arg0 instanceof SocketTimeoutException) {
return true; return true;
}
HttpClientContext clientContext = HttpClientContext.adapt(arg2); HttpClientContext clientContext = HttpClientContext.adapt(arg2);
HttpRequest request = clientContext.getRequest(); HttpRequest request = clientContext.getRequest();
if (!(request instanceof HttpEntityEnclosingRequest)) // 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的 // 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的
return true; return !(request instanceof HttpEntityEnclosingRequest);
return false;
} }
}; };
// keep alive strategy // keep alive strategy
...@@ -153,16 +157,17 @@ public class HttpClientConfig { ...@@ -153,16 +157,17 @@ public class HttpClientConfig {
HttpRequestRetryHandler retryHandler = new HttpRequestRetryHandler() { HttpRequestRetryHandler retryHandler = new HttpRequestRetryHandler() {
@Override @Override
public boolean retryRequest(IOException arg0, int retryTimes, HttpContext arg2) { public boolean retryRequest(IOException arg0, int retryTimes, HttpContext arg2) {
if (retryTimes >= 2) if (retryTimes >= 2) {
return false; return false;
}
if (arg0 instanceof UnknownHostException || arg0 instanceof ConnectTimeoutException if (arg0 instanceof UnknownHostException || arg0 instanceof ConnectTimeoutException
|| !(arg0 instanceof SSLException) || arg0 instanceof SocketTimeoutException) || !(arg0 instanceof SSLException) || arg0 instanceof SocketTimeoutException) {
return true; return true;
}
HttpClientContext clientContext = HttpClientContext.adapt(arg2); HttpClientContext clientContext = HttpClientContext.adapt(arg2);
HttpRequest request = clientContext.getRequest(); HttpRequest request = clientContext.getRequest();
if (!(request instanceof HttpEntityEnclosingRequest)) // 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的 // 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的
return true; return !(request instanceof HttpEntityEnclosingRequest);
return false;
} }
}; };
// keep alive strategy // keep alive strategy
......
...@@ -27,6 +27,7 @@ public class ChannelRuleEntity { ...@@ -27,6 +27,7 @@ public class ChannelRuleEntity {
private String userLevel; private String userLevel;
private int priority; private int priority;
private Byte enable; private Byte enable;
private Byte routeWait;
private Timestamp createdAt; private Timestamp createdAt;
private Timestamp updatedAt; private Timestamp updatedAt;
...@@ -180,6 +181,16 @@ public class ChannelRuleEntity { ...@@ -180,6 +181,16 @@ public class ChannelRuleEntity {
this.enable = enable; this.enable = enable;
} }
@Basic
@Column(name = "route_wait", nullable = true)
public Byte getRouteWait() {
return routeWait;
}
public void setRouteWait(Byte routeWait) {
this.routeWait = routeWait;
}
@Basic @Basic
@Column(name = "created_at", nullable = false) @Column(name = "created_at", nullable = false)
public Timestamp getCreatedAt() { public Timestamp getCreatedAt() {
......
...@@ -14,7 +14,7 @@ import java.util.Objects; ...@@ -14,7 +14,7 @@ import java.util.Objects;
public class FundProductEntity { public class FundProductEntity {
private long id; private long id;
private long fundId; private long fundId;
private long fundCorpId; private Long fundProId;
private String fundName; private String fundName;
private String fundType; private String fundType;
private String orgType; private String orgType;
...@@ -48,13 +48,13 @@ public class FundProductEntity { ...@@ -48,13 +48,13 @@ public class FundProductEntity {
} }
@Basic @Basic
@Column(name = "fund_corp_id", nullable = false) @Column(name = "fund_pro_id", nullable = false)
public long getFundCorpId() { public Long getFundProId() {
return fundCorpId; return fundProId;
} }
public void setFundCorpId(long fundCorpId) { public void setFundProId(Long fundProId) {
this.fundCorpId = fundCorpId; this.fundProId = fundProId;
} }
@Basic @Basic
...@@ -117,16 +117,6 @@ public class FundProductEntity { ...@@ -117,16 +117,6 @@ public class FundProductEntity {
this.basicRule = basicRule; this.basicRule = basicRule;
} }
@Basic
@Column(name = "other_rule", nullable = false, length = 500)
public String getOtherRule() {
return otherRule;
}
public void setOtherRule(String otherRule) {
this.otherRule = otherRule;
}
@Basic @Basic
@Column(name = "rule_list", nullable = false, length = 500) @Column(name = "rule_list", nullable = false, length = 500)
public String getRuleList() { public String getRuleList() {
...@@ -169,14 +159,18 @@ public class FundProductEntity { ...@@ -169,14 +159,18 @@ public class FundProductEntity {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FundProductEntity that = (FundProductEntity) o; FundProductEntity that = (FundProductEntity) o;
return id == that.id && fundId == that.fundId && fundCorpId == that.fundCorpId && Objects.equals(fundName, that.fundName) && Objects.equals(fundType, that.fundType) && Objects.equals(orgType, that.orgType) && Objects.equals(businessType, that.businessType) && Objects.equals(systermType, that.systermType) && Objects.equals(basicRule, that.basicRule) && Objects.equals(otherRule, that.otherRule) && Objects.equals(ruleList, that.ruleList) && Objects.equals(enable, that.enable) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); return id == that.id && fundId == that.fundId && Objects.equals(fundProId,that.fundProId) && Objects.equals(fundName, that.fundName) && Objects.equals(fundType, that.fundType) && Objects.equals(orgType, that.orgType) && Objects.equals(businessType, that.businessType) && Objects.equals(systermType, that.systermType) && Objects.equals(basicRule, that.basicRule) && Objects.equals(otherRule, that.otherRule) && Objects.equals(ruleList, that.ruleList) && Objects.equals(enable, that.enable) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(id, fundId, fundCorpId, fundName, fundType, orgType, businessType, systermType, basicRule, otherRule, ruleList, enable, createdAt, updatedAt); return Objects.hash(id, fundId, fundProId, fundName, fundType, orgType, businessType, systermType, basicRule, otherRule, ruleList, enable, createdAt, updatedAt);
} }
} }
...@@ -92,8 +92,12 @@ public class ProductRuleEntity { ...@@ -92,8 +92,12 @@ public class ProductRuleEntity {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) {
if (o == null || getClass() != o.getClass()) return false; return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ProductRuleEntity that = (ProductRuleEntity) o; ProductRuleEntity that = (ProductRuleEntity) o;
return id == that.id && Objects.equals(ruleName, that.ruleName) && Objects.equals(ruleEnglish, that.ruleEnglish) && Objects.equals(ruleChinese, that.ruleChinese) && Objects.equals(enable, that.enable) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); return id == that.id && Objects.equals(ruleName, that.ruleName) && Objects.equals(ruleEnglish, that.ruleEnglish) && Objects.equals(ruleChinese, that.ruleChinese) && Objects.equals(enable, that.enable) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt);
} }
......
...@@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
public interface IChannelRuleRepository extends JpaRepository<ChannelRuleEntity, Long>{ public interface IChannelRuleRepository extends JpaRepository<ChannelRuleEntity, Long>{
ChannelRuleEntity getByFundProductIdEquals(long fundProductId);
} }
...@@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
public interface IProductRuleRepository extends JpaRepository<ProductRuleEntity, Long>{ public interface IProductRuleRepository extends JpaRepository<ProductRuleEntity, Long>{
ProductRuleEntity getByRuleNameEquals(String ruleName);
} }
...@@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -5,5 +5,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
public interface IWhiteListRepository extends JpaRepository<WhiteListEntity, Long>{ public interface IWhiteListRepository extends JpaRepository<WhiteListEntity, Long>{
WhiteListEntity getByPhoneEquals(String phone);
} }
/**
* @date 2021/8/26 19:23
* @author shihuajun
* @ describing
*/
package com.quantgroup.asset.distribution.service.newrule;
\ No newline at end of file
package com.quantgroup.asset.distribution.service.user; package com.quantgroup.asset.distribution.service.user;
import cn.quantgroup.motan.bean.UserAssociationBean;
import cn.quantgroup.motan.bean.UserInfo; import cn.quantgroup.motan.bean.UserInfo;
import cn.quantgroup.motan.retbean.XUserExtInfo;
import com.quantgroup.asset.distribution.model.entity.user.SDKUserInfo; import com.quantgroup.asset.distribution.model.entity.user.SDKUserInfo;
/** /**
...@@ -25,4 +25,11 @@ public interface IUserCenterService { ...@@ -25,4 +25,11 @@ public interface IUserCenterService {
* @return * @return
*/ */
SDKUserInfo getSDKUserExtInfo(String phoneNo, String uuid); SDKUserInfo getSDKUserExtInfo(String phoneNo, String uuid);
/**
* 根据uuid查询带有联系人的信息
* @param uuid 入参
* @return 结果
*/
UserAssociationBean getUserAssociationBean(String uuid);
} }
package com.quantgroup.asset.distribution.service.user.impl; package com.quantgroup.asset.distribution.service.user.impl;
import cn.quantgroup.motan.bean.UserAssociationBean;
import cn.quantgroup.motan.bean.UserInfo; import cn.quantgroup.motan.bean.UserInfo;
import cn.quantgroup.motan.retbean.XUserExtInfo; import cn.quantgroup.motan.retbean.XUserExtInfo;
import cn.quantgroup.motan.vo.UserSysResult; import cn.quantgroup.motan.vo.UserSysResult;
...@@ -14,6 +15,7 @@ import com.quantgroup.asset.distribution.service.httpclient.IHttpService; ...@@ -14,6 +15,7 @@ import com.quantgroup.asset.distribution.service.httpclient.IHttpService;
import com.quantgroup.asset.distribution.service.redis.IRedisService; import com.quantgroup.asset.distribution.service.redis.IRedisService;
import com.quantgroup.asset.distribution.service.user.IUserCenterService; import com.quantgroup.asset.distribution.service.user.IUserCenterService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.CloseableHttpClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
...@@ -93,6 +95,25 @@ public class UserCenterServiceImpl implements IUserCenterService { ...@@ -93,6 +95,25 @@ public class UserCenterServiceImpl implements IUserCenterService {
return sdkUserInfo; return sdkUserInfo;
} }
@Override
public UserAssociationBean getUserAssociationBean(String uuid) {
UserSysResult<UserInfo> result = userSdkService.findUserInfoByUuid(uuid);
UserInfo userInfo = new UserInfo();
if (result.isSuccess() && result.getData() != null && result.getData().getId() == null) {
userInfo = result.getData();
} else {
log.error("调用用户中心接口findUserInfoByUuid异常 {}",JSON.toJSONString(userInfo));
throw new RuntimeException("调用用户中心接口findUserInfoByUuid异常");
}
UserSysResult<UserAssociationBean> association = userSdkService.findUserAssociationByUid(userInfo.getId().toString());
if (association == null || !association.isSuccess() || association.getData() == null
|| CollectionUtils.isEmpty(association.getData().getContractResults())){
log.error("调用用户中心接口findUserAssociationByUid异常 {}",JSON.toJSONString(association));
throw new RuntimeException("调用用户中心接口findUserAssociationByUid异常");
}
return association.getData();
}
/** /**
* 从用户中心获取SDKUserInfo * 从用户中心获取SDKUserInfo
* @param uuid * @param uuid
......
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