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

Commit 025b1c30 authored by 张国柄's avatar 张国柄

Merge branch 'dev' into test

parents 1eeae5a6 645912bd
...@@ -3,6 +3,7 @@ package com.liquidnet.service.adam.service; ...@@ -3,6 +3,7 @@ package com.liquidnet.service.adam.service;
import com.liquidnet.service.adam.dto.AdamThirdPartParam; import com.liquidnet.service.adam.dto.AdamThirdPartParam;
import com.liquidnet.service.adam.dto.vo.AdamRealInfoVo; import com.liquidnet.service.adam.dto.vo.AdamRealInfoVo;
import com.liquidnet.service.adam.dto.vo.AdamUserInfoVo; import com.liquidnet.service.adam.dto.vo.AdamUserInfoVo;
import com.liquidnet.service.base.ResponseDto;
/** /**
* <p> * <p>
...@@ -26,9 +27,9 @@ public interface IAdamUserService { ...@@ -26,9 +27,9 @@ public interface IAdamUserService {
* 第三方账号注册 * 第三方账号注册
* *
* @param param * @param param
* @return AdamUserInfoVo * @return ResponseDto<AdamUserInfoVo>
*/ */
AdamUserInfoVo register(AdamThirdPartParam param); ResponseDto<AdamUserInfoVo> register(AdamThirdPartParam param);
/** /**
* 第三方账号绑定(不存在已绑定账号) * 第三方账号绑定(不存在已绑定账号)
......
...@@ -69,7 +69,7 @@ spring: ...@@ -69,7 +69,7 @@ spring:
profiles: profiles:
include: common-service #这里加载management相关公共配置 include: common-service #这里加载management相关公共配置
redis: redis:
database: 9 database: 15
port: ${liquidnet.redis.port} port: ${liquidnet.redis.port}
host: ${liquidnet.redis.host} host: ${liquidnet.redis.host}
password: ${liquidnet.redis.password} password: ${liquidnet.redis.password}
......
...@@ -281,14 +281,16 @@ public class AdamLoginController { ...@@ -281,14 +281,16 @@ public class AdamLoginController {
if (!checkSmsCodeDto.isSuccess()) { if (!checkSmsCodeDto.isSuccess()) {
return checkSmsCodeDto; return checkSmsCodeDto;
} }
AdamUserInfoVo registerUserInfo = adamUserService.register(parameter); ResponseDto<AdamUserInfoVo> registerRespDto = adamUserService.register(parameter);
if (null == registerUserInfo) { if (!registerRespDto.isSuccess()) {
return ResponseDto.failure(ErrorMapping.get("10000")); 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; toRegister = true;
loginInfoVo.setUserInfo(registerUserInfo);
loginInfoVo.setThirdPartInfo(adamRdmService.getThirdPartVoListByUid(registerUserInfo.getUid()));
// loginInfoVo.setMemberVo(adamRdmService.getMemberSimpleVo());
} }
loginInfoVo.setToken(this.ssoProcess(loginInfoVo.getUserInfo())); loginInfoVo.setToken(this.ssoProcess(loginInfoVo.getUserInfo()));
loginInfoVo.getUserInfo().setMobile(SensitizeUtil.custom(loginInfoVo.getUserInfo().getMobile(), 3, 4)); loginInfoVo.getUserInfo().setMobile(SensitizeUtil.custom(loginInfoVo.getUserInfo().getMobile(), 3, 4));
......
...@@ -197,6 +197,24 @@ public class AdamRdmService { ...@@ -197,6 +197,24 @@ public class AdamRdmService {
return redisUtil.set(AdamRedisConst.INFO_THIRD_PARTY + uid, vos); 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) { public AdamThirdPartInfoVo getThirdPartVoByUidPlatform(String uid, String platform) {
List<AdamThirdPartInfoVo> vos = this.getThirdPartVoListByUid(uid); List<AdamThirdPartInfoVo> vos = this.getThirdPartVoListByUid(uid);
if (!CollectionUtils.isEmpty(vos)) { if (!CollectionUtils.isEmpty(vos)) {
......
...@@ -15,6 +15,7 @@ import com.liquidnet.service.adam.service.IAdamUserService; ...@@ -15,6 +15,7 @@ import com.liquidnet.service.adam.service.IAdamUserService;
import com.liquidnet.service.adam.util.NknameUtil; import com.liquidnet.service.adam.util.NknameUtil;
import com.liquidnet.service.adam.util.QueueUtils; import com.liquidnet.service.adam.util.QueueUtils;
import com.liquidnet.service.base.ErrorMapping; import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping; import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -110,13 +111,10 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -110,13 +111,10 @@ public class AdamUserServiceImpl implements IAdamUserService {
@Override @Override
// @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) // @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public AdamUserInfoVo register(AdamThirdPartParam param) { public ResponseDto<AdamUserInfoVo> register(AdamThirdPartParam param) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
AdamUserInfoVo userInfoVo = null; AdamUserInfoVo userInfoVo = null;
// if (RedisLockUtil.tryLock(LOCK_KEY_UREGISTER + param.getOpenId() + param.getPlatform(), 1, 5)) {
// String uid = adamRdmService.getUidByPlatformOpenId(param.getPlatform(), param.getOpenId());
// if (StringUtils.isEmpty(uid)) {
long s = System.currentTimeMillis(); long s = System.currentTimeMillis();
String uid = adamRdmService.getUidByMobile(param.getMobile()); String uid = adamRdmService.getUidByMobile(param.getMobile());
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s); log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
...@@ -148,42 +146,43 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -148,42 +146,43 @@ public class AdamUserServiceImpl implements IAdamUserService {
initUserObjs.add(new Object[]{userInfoVo.getUid(), userInfoVo.getMobile(), userInfoVo.getState(), now}); initUserObjs.add(new Object[]{userInfoVo.getUid(), userInfoVo.getMobile(), userInfoVo.getState(), now});
toMqSqls.add(SqlMapping.get("adam_user_info.add")); toMqSqls.add(SqlMapping.get("adam_user_info.add"));
initUserInfoObjs.add(new Object[]{userInfoVo.getUid(), userInfoVo.getNickname(), userInfoVo.getAvatar(), userInfoVo.getQrCode()}); initUserInfoObjs.add(new Object[]{userInfoVo.getUid(), userInfoVo.getNickname(), userInfoVo.getAvatar(), userInfoVo.getQrCode()});
// } else {
// s = System.currentTimeMillis();
// userInfoVo = adamRdmService.getUserInfoVoByUid(uid);
// log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
// toMqSqls.add(SqlMapping.get("adam_user.add"));
// toMqSqls.add(SqlMapping.get("adam_user_info.add"));
// }
AdamThirdPartInfoVo thirdPartInfoVo = AdamThirdPartInfoVo.getNew();
BeanUtils.copyProperties(param, thirdPartInfoVo);
thirdPartInfoVo.setCreatedAt(now);
thirdPartInfoVo.setUid(userInfoVo.getUid());
thirdPartInfoVo.setState(1);// 1-绑定
// s = System.currentTimeMillis();
// mongoTemplate.insert(thirdPartInfoVo, AdamThirdPartInfoVo.class.getSimpleName());
// log.debug("#MDB耗时:{}ms", System.currentTimeMillis() - s);
toMqSqls.add(SqlMapping.get("adam_third_party.add")); AdamThirdPartInfoVo thirdPartInfoVo = AdamThirdPartInfoVo.getNew();
initThirdPartObjs.add(new Object[]{thirdPartInfoVo.getUid(), thirdPartInfoVo.getOpenId(), thirdPartInfoVo.getAvatar(), thirdPartInfoVo.getNickname(), thirdPartInfoVo.getPlatform(), thirdPartInfoVo.getState(), thirdPartInfoVo.getCreatedAt()}); BeanUtils.copyProperties(param, thirdPartInfoVo);
thirdPartInfoVo.setCreatedAt(now);
thirdPartInfoVo.setUid(userInfoVo.getUid());
thirdPartInfoVo.setState(1);// 1-绑定
s = System.currentTimeMillis(); // s = System.currentTimeMillis();
adamRdmService.setUidByPlatformOpenId(param.getPlatform(), param.getOpenId(), uid); // mongoTemplate.insert(thirdPartInfoVo, AdamThirdPartInfoVo.class.getSimpleName());
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s); // log.debug("#MDB耗时:{}ms", System.currentTimeMillis() - s);
s = System.currentTimeMillis(); toMqSqls.add(SqlMapping.get("adam_third_party.add"));
queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UREGISTER.getKey(), initThirdPartObjs.add(new Object[]{thirdPartInfoVo.getUid(), thirdPartInfoVo.getOpenId(), thirdPartInfoVo.getAvatar(), thirdPartInfoVo.getNickname(), thirdPartInfoVo.getPlatform(), thirdPartInfoVo.getState(), thirdPartInfoVo.getCreatedAt()});
SqlMapping.gets(toMqSqls, initUserObjs, initUserInfoObjs, initThirdPartObjs)
); s = System.currentTimeMillis();
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s); adamRdmService.setUidByPlatformOpenId(param.getPlatform(), param.getOpenId(), uid);
} else { log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
userInfoVo = adamRdmService.getUserInfoVoByUid(uid);
} s = System.currentTimeMillis();
// RedisLockUtil.unlock(LOCK_KEY_UREGISTER + param.getOpenId() + param.getPlatform()); queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UREGISTER.getKey(),
// } SqlMapping.gets(toMqSqls, initUserObjs, initUserInfoObjs, initThirdPartObjs)
return userInfoVo; );
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
} else {// 手机号已注册
// 判断已注册用户是否绑定同平台的第三方账号
AdamThirdPartInfoVo thirdPartVo = adamRdmService.getThirdPartVoByUidPlatform(uid, param.getPlatform());
if (null == thirdPartVo) {// 未绑定
this.bindTpa(uid, param);
userInfoVo = adamRdmService.getUserInfoVoByUid(uid);
} else if (thirdPartVo.getOpenId().equals(param.getOpenId())) {
userInfoVo = adamRdmService.getUserInfoVoByUid(uid);
} else {
return ResponseDto.failure(ErrorMapping.get("10007"));
}
}
return ResponseDto.success(userInfoVo);
} }
@Override @Override
...@@ -206,7 +205,8 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -206,7 +205,8 @@ public class AdamUserServiceImpl implements IAdamUserService {
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s); log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
s = System.currentTimeMillis(); s = System.currentTimeMillis();
adamRdmService.delThirdPartVoListByUid(uid); // adamRdmService.delThirdPartVoListByUid(uid);
adamRdmService.addThirdPartVoListByUid(uid, adamRdmService.getThirdPartVoListByUid(uid), thirdPartInfoVo);
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s); log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
s = System.currentTimeMillis(); s = System.currentTimeMillis();
...@@ -226,22 +226,24 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -226,22 +226,24 @@ public class AdamUserServiceImpl implements IAdamUserService {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
AdamThirdPartInfoVo thirdPartInfoVo = AdamThirdPartInfoVo.getNew(); AdamThirdPartInfoVo bindThirdPartVo = AdamThirdPartInfoVo.getNew();
BeanUtils.copyProperties(param, thirdPartInfoVo); BeanUtils.copyProperties(param, bindThirdPartVo);
thirdPartInfoVo.setCreatedAt(now); bindThirdPartVo.setCreatedAt(now);
thirdPartInfoVo.setUid(bindUid); bindThirdPartVo.setUid(bindUid);
thirdPartInfoVo.setState(1);// 1-绑定 bindThirdPartVo.setState(1);// 1-绑定
// mongoTemplate.insert(thirdPartInfoVo, AdamThirdPartInfoVo.class.getSimpleName()); // mongoTemplate.insert(bindThirdPartVo, AdamThirdPartInfoVo.class.getSimpleName());
adamRdmService.setUidByPlatformOpenId(param.getPlatform(), param.getOpenId(), bindUid); adamRdmService.setUidByPlatformOpenId(param.getPlatform(), param.getOpenId(), bindUid);
adamRdmService.delThirdPartVoListByUid(bindUid); // adamRdmService.delThirdPartVoListByUid(bindUid);
adamRdmService.rmvThirdPartVoListByUid(unBindUid, adamRdmService.getThirdPartVoListByUid(unBindUid), param.getPlatform());
adamRdmService.addThirdPartVoListByUid(bindUid, adamRdmService.getThirdPartVoListByUid(bindUid), bindThirdPartVo);
queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UCENTER.getKey(), queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UCENTER.getKey(),
SqlMapping.get( SqlMapping.get(
"adam_third_party.add", "adam_third_party.add",
thirdPartInfoVo.getUid(), thirdPartInfoVo.getOpenId(), thirdPartInfoVo.getAvatar(), thirdPartInfoVo.getNickname(), thirdPartInfoVo.getPlatform(), thirdPartInfoVo.getState(), thirdPartInfoVo.getCreatedAt() bindThirdPartVo.getUid(), bindThirdPartVo.getOpenId(), bindThirdPartVo.getAvatar(), bindThirdPartVo.getNickname(), bindThirdPartVo.getPlatform(), bindThirdPartVo.getState(), bindThirdPartVo.getCreatedAt()
) )
); );
} }
...@@ -272,18 +274,22 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -272,18 +274,22 @@ public class AdamUserServiceImpl implements IAdamUserService {
// adamRdmService.delUidByPlatformOpenId(platform, doc.getString("openId")); // adamRdmService.delUidByPlatformOpenId(platform, doc.getString("openId"));
// } // }
long s = System.currentTimeMillis(); long s = System.currentTimeMillis();
AdamThirdPartInfoVo unBindTpaVo = adamRdmService.getThirdPartVoByUidPlatform(uid, platform); List<AdamThirdPartInfoVo> vos = adamRdmService.getThirdPartVoListByUid(uid);
if (null != unBindTpaVo) { if (!CollectionUtils.isEmpty(vos)) {
adamRdmService.delUidByPlatformOpenId(platform, unBindTpaVo.getOpenId()); AdamThirdPartInfoVo unBindTpaVo = adamRdmService.getThirdPartVoByUidPlatform(vos, platform);
if (null != unBindTpaVo) {
adamRdmService.delUidByPlatformOpenId(platform, unBindTpaVo.getOpenId());
adamRdmService.rmvThirdPartVoListByUid(uid, vos, platform);
s = System.currentTimeMillis();
queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UCENTER.getKey(),
SqlMapping.get("adam_third_party.unbind", now, uid, platform)
);
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
}
} }
adamRdmService.delThirdPartVoListByUid(uid);
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s); log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
s = System.currentTimeMillis();
queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UCENTER.getKey(),
SqlMapping.get("adam_third_party.unbind", now, uid, platform)
);
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
} }
@Override @Override
......
...@@ -33,7 +33,7 @@ public class SweetAppletController { ...@@ -33,7 +33,7 @@ public class SweetAppletController {
}) })
public ResponseDto<List<SweetManualAppletDto>> timeSelect(@RequestParam String name) { public ResponseDto<List<SweetManualAppletDto>> timeSelect(@RequestParam String name) {
List<SweetManualAppletDto> dto = redisDataUtils.getPushList(); List<SweetManualAppletDto> dto = redisDataUtils.getPushList();
List<SweetManualAppletDto> vo = redisDataUtils.getPushList(); List<SweetManualAppletDto> vo = new ArrayList<>();
for (SweetManualAppletDto item : dto) { for (SweetManualAppletDto item : dto) {
if (item.getTitle().contains(name)) { if (item.getTitle().contains(name)) {
vo.add(item); vo.add(item);
......
...@@ -25,6 +25,15 @@ ...@@ -25,6 +25,15 @@
<result column="time_end" property="timeEnd"/> <result column="time_end" property="timeEnd"/>
</resultMap> </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 id="getManualList" parameterType="java.util.Map" resultMap="partnerPerformanceListResult">
SELECT SELECT
...@@ -113,4 +122,37 @@ ...@@ -113,4 +122,37 @@
where sw.`status` = 1 where sw.`status` = 1
and sw.is_release = 1 and sw.is_release = 1
</select> </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> </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