记得上下班打卡 | git大法好,push需谨慎

Commit ca33f56e authored by jiangxiulong's avatar jiangxiulong

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

parents 09b2eb12 41116eaf
......@@ -3,6 +3,7 @@ package com.liquidnet.service.adam.service;
import com.liquidnet.service.adam.dto.AdamThirdPartParam;
import com.liquidnet.service.adam.dto.vo.AdamRealInfoVo;
import com.liquidnet.service.adam.dto.vo.AdamUserInfoVo;
import com.liquidnet.service.base.ResponseDto;
/**
* <p>
......@@ -26,9 +27,9 @@ public interface IAdamUserService {
* 第三方账号注册
*
* @param param
* @return AdamUserInfoVo
* @return ResponseDto<AdamUserInfoVo>
*/
AdamUserInfoVo register(AdamThirdPartParam param);
ResponseDto<AdamUserInfoVo> register(AdamThirdPartParam param);
/**
* 第三方账号绑定(不存在已绑定账号)
......
......@@ -69,7 +69,7 @@ spring:
profiles:
include: common-service #这里加载management相关公共配置
redis:
database: 9
database: 15
port: ${liquidnet.redis.port}
host: ${liquidnet.redis.host}
password: ${liquidnet.redis.password}
......
......@@ -281,14 +281,16 @@ public class AdamLoginController {
if (!checkSmsCodeDto.isSuccess()) {
return checkSmsCodeDto;
}
AdamUserInfoVo registerUserInfo = adamUserService.register(parameter);
if (null == registerUserInfo) {
return ResponseDto.failure(ErrorMapping.get("10000"));
ResponseDto<AdamUserInfoVo> registerRespDto = adamUserService.register(parameter);
if (!registerRespDto.isSuccess()) {
return ResponseDto.failure(registerRespDto.getCode(), registerRespDto.getMessage());
} else {
AdamUserInfoVo registerUserInfo = registerRespDto.getData();
loginInfoVo.setUserInfo(registerUserInfo);
loginInfoVo.setThirdPartInfo(adamRdmService.getThirdPartVoListByUid(registerUserInfo.getUid()));
// loginInfoVo.setMemberVo(adamRdmService.getMemberSimpleVo());
}
toRegister = true;
loginInfoVo.setUserInfo(registerUserInfo);
loginInfoVo.setThirdPartInfo(adamRdmService.getThirdPartVoListByUid(registerUserInfo.getUid()));
// loginInfoVo.setMemberVo(adamRdmService.getMemberSimpleVo());
}
loginInfoVo.setToken(this.ssoProcess(loginInfoVo.getUserInfo()));
loginInfoVo.getUserInfo().setMobile(SensitizeUtil.custom(loginInfoVo.getUserInfo().getMobile(), 3, 4));
......
......@@ -197,6 +197,24 @@ public class AdamRdmService {
return redisUtil.set(AdamRedisConst.INFO_THIRD_PARTY + uid, vos);
}
public boolean rmvThirdPartVoListByUid(String uid, List<AdamThirdPartInfoVo> vos, String platform) {
if (CollectionUtils.isEmpty(vos)) {
return true;
}
vos.removeIf(r -> r.getPlatform().equals(platform));
return redisUtil.set(AdamRedisConst.INFO_THIRD_PARTY + uid, vos);
}
public AdamThirdPartInfoVo getThirdPartVoByUidPlatform(List<AdamThirdPartInfoVo> vos, String platform) {
if (!CollectionUtils.isEmpty(vos)) {
Optional<AdamThirdPartInfoVo> any = vos.stream().filter(r -> r.getPlatform().equals(platform)).findAny();
if (any.isPresent()) {
return any.get();
}
}
return null;
}
public AdamThirdPartInfoVo getThirdPartVoByUidPlatform(String uid, String platform) {
List<AdamThirdPartInfoVo> vos = this.getThirdPartVoListByUid(uid);
if (!CollectionUtils.isEmpty(vos)) {
......
......@@ -34,8 +34,8 @@ public class QueueUtils {
* @param jsonMsg Json字符串
*/
public void sendMsgByRedis(String streamKey, String jsonMsg) {
// HashMap<String, String> map = CollectionUtil.mapStringString();
// map.put("message", jsonMsg);
// stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(streamKey));
HashMap<String, String> map = CollectionUtil.mapStringString();
map.put("message", jsonMsg);
stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(streamKey));
}
}
......@@ -2,9 +2,16 @@ package com.liquidnet.service.dragon.utils;
import com.alipay.api.internal.util.file.IOUtils;
import com.liquidnet.commons.lang.util.MD5Utils;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.ssl.SSLContexts;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.dom4j.Document;
......@@ -24,6 +31,9 @@ public class PayWepayUtils {
private CloseableHttpClient httpClient;
private static PayWepayUtils instance = new PayWepayUtils();
// 池化管理
private static PoolingHttpClientConnectionManager poolConnManager =null;
private final String merchantId = "1551961491";
private final String partnerKey = "itIuO65O9yKmemOu3S8g1S4orqvCGwXK";
......@@ -65,9 +75,41 @@ public class PayWepayUtils {
return merchantId;
}
// public CloseableHttpClient getHttpClient() {
// try {
// if (httpClient == null) {
// InputStream certStream = PayWepayUtils.class.getClassLoader().getResourceAsStream("payCert/wepay/wepay_apiclient_cert.p12");
// byte[] certData = IOUtils.toByteArray(certStream);
// certStream.read(certData);
// certStream.close();
//
// KeyStore keyStore = KeyStore.getInstance("PKCS12");
// ByteArrayInputStream inputStream = new ByteArrayInputStream(certData);
// try {
// keyStore.load(inputStream, merchantId.toCharArray());
// } finally {
// inputStream.close();
// }
// SSLContext sslcontext = SSLContexts.custom()
// .loadKeyMaterial(keyStore, merchantId.toCharArray())
// .build();
// SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
// sslcontext,
// SSLConnectionSocketFactory.getDefaultHostnameVerifier());
// httpClient = HttpClients.custom()
// .setSSLSocketFactory(sslsf)
// .build();
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return httpClient;
// }
public CloseableHttpClient getHttpClient() {
try {
if (httpClient == null) {
InputStream certStream = PayWepayUtils.class.getClassLoader().getResourceAsStream("payCert/wepay/wepay_apiclient_cert.p12");
byte[] certData = IOUtils.toByteArray(certStream);
certStream.read(certData);
......@@ -86,9 +128,17 @@ public class PayWepayUtils {
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
sslcontext,
SSLConnectionSocketFactory.getDefaultHostnameVerifier());
httpClient = HttpClients.custom()
.setSSLSocketFactory(sslsf)
.build();
// 配置同时支持 HTTP 和 HTPPS
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory>create().register("http", PlainConnectionSocketFactory.getSocketFactory()).register("https", sslsf).build();
// 初始化连接管理器
poolConnManager =new PoolingHttpClientConnectionManager(socketFactoryRegistry);
poolConnManager.setMaxTotal(4000);// 同时最多连接数
// 设置最大路由
poolConnManager.setDefaultMaxPerRoute(2000);
// 初始化httpClient
httpClient = getConnection();
}
} catch (Exception e) {
e.printStackTrace();
......@@ -96,6 +146,17 @@ public class PayWepayUtils {
return httpClient;
}
public static CloseableHttpClient getConnection() {
RequestConfig config = RequestConfig.custom().setConnectTimeout(5000).setConnectionRequestTimeout(5000).setSocketTimeout(5000).build();
CloseableHttpClient httpClient = HttpClients.custom()
// 设置连接池管理
.setConnectionManager(poolConnManager)
.setDefaultRequestConfig(config)
// 设置重试次数
.setRetryHandler(new DefaultHttpRequestRetryHandler(2,false)).build();
return httpClient;
}
//生成随机字符串nonce_str
public String getNonceStr() {
String base = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
......
......@@ -28,8 +28,18 @@ public class SweetAppletController {
@GetMapping("timeSelect")
@ApiOperation("场次选择")
public ResponseDto<List<SweetManualAppletDto>> timeSelect() {
return ResponseDto.success(redisDataUtils.getPushList());
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "name", value = "名称", required = true),
})
public ResponseDto<List<SweetManualAppletDto>> timeSelect(@RequestParam String name) {
List<SweetManualAppletDto> dto = redisDataUtils.getPushList();
List<SweetManualAppletDto> vo = new ArrayList<>();
for (SweetManualAppletDto item : dto) {
if (item.getTitle().contains(name)) {
vo.add(item);
}
}
return ResponseDto.success(vo);
}
@GetMapping("details")
......
......@@ -25,6 +25,15 @@
<result column="time_end" property="timeEnd"/>
</resultMap>
<resultMap id="getManualAppletDtoResult" type="com.liquidnet.service.sweet.dto.SweetManualAppletDto">
<result column="manual_id" property="manualId"/>
<result column="performances_id" property="performancesId"/>
<result column="title" property="title"/>
<result column="field_id" property="fieldId"/>
<result column="time_start" property="timeStart"/>
<result column="time_end" property="timeEnd"/>
</resultMap>
<!-- 电子手册列表 -->
<select id="getManualList" parameterType="java.util.Map" resultMap="partnerPerformanceListResult">
SELECT
......@@ -113,4 +122,37 @@
where sw.`status` = 1
and sw.is_release = 1
</select>
<select id="getManualAppletDto" resultMap="getManualAppletDtoResult">
SELECT
IFNULL(sm.manual_id , 0) AS 'manual_id' ,
p.performances_id ,
p.title ,
pr.field_id ,
p.time_start ,
p.time_end
FROM
kylin_performances AS p
LEFT JOIN kylin_performance_status AS ps ON p.performances_id = ps.performance_id
LEFT JOIN kylin_performance_relations AS pr ON p.performances_id = pr.performance_id
LEFT JOIN sweet_manual AS sm ON p.performances_id = sm.performance_id
LEFT JOIN(
SELECT
ttr.performance_id ,
MIN(
DATE_SUB(
t.time_start ,
INTERVAL pay_countdown_minute MINUTE
)
) AS 'time_sell' ,
MAX(t.time_end) AS 'time_stop'
FROM
kylin_ticket_status AS ts
LEFT JOIN kylin_ticket_relations AS tr ON tr.ticket_id = ts.ticket_id
LEFT JOIN kylin_tickets AS t ON t.tickets_id = ts.ticket_id
LEFT JOIN kylin_ticket_time_relation AS ttr ON tr.times_id = ttr.times_id
GROUP BY
ttr.performance_id
) AS t ON p.performances_id = t.performance_id where sm.`status` = 1 and sm.is_release = 1
</select>
</mapper>
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