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

Commit 633e0966 authored by wangyifan's avatar wangyifan

草莓护照v1.1- 整体重构获取home页汇总数据;优化查询效率

parent 9607bee7
...@@ -27,7 +27,7 @@ public class AdamCaomeiPassportBadgeShelfItemVo { ...@@ -27,7 +27,7 @@ public class AdamCaomeiPassportBadgeShelfItemVo {
@ApiModelProperty("分享文案") @ApiModelProperty("分享文案")
private String shareText; private String shareText;
@ApiModelProperty("类型 1护照 2演出 3特殊(不含 4 签证页,签证页见签证卡片接口)") @ApiModelProperty("类型 1护照 2演出 3特殊(不含 4 签证页,签证页见 home.visaBadges)")
private Integer type; private Integer type;
@ApiModelProperty("关联演出ID(演出纪念徽章、签证页)") @ApiModelProperty("关联演出ID(演出纪念徽章、签证页)")
......
...@@ -13,9 +13,12 @@ public class AdamCaomeiPassportHomeVo { ...@@ -13,9 +13,12 @@ public class AdamCaomeiPassportHomeVo {
@ApiModelProperty("个人信息卡片") @ApiModelProperty("个人信息卡片")
private AdamCaomeiPassportUserCardVo userCard; private AdamCaomeiPassportUserCardVo userCard;
@ApiModelProperty("已认领徽章(用于网格墙;不含 type=4 签证页,签证页见签证卡片列表接口)") @ApiModelProperty("已认领徽章(用于网格墙;不含 type=4 签证页)")
private List<AdamCaomeiPassportUserClaimedBadgeVo> claimedBadges; private List<AdamCaomeiPassportUserClaimedBadgeVo> claimedBadges;
@ApiModelProperty("签证页卡片(type=4;home 内静默发放后返回,含 performanceName)")
private List<AdamCaomeiPassportUserClaimedBadgeVo> visaBadges;
@ApiModelProperty("全部上架徽章货架(不含 type=4 签证页;演出类含 performanceName)") @ApiModelProperty("全部上架徽章货架(不含 type=4 签证页;演出类含 performanceName)")
private List<AdamCaomeiPassportBadgeShelfItemVo> allBadges; private List<AdamCaomeiPassportBadgeShelfItemVo> allBadges;
} }
...@@ -17,16 +17,11 @@ public interface IAdamCaomeiPassportUserService { ...@@ -17,16 +17,11 @@ public interface IAdamCaomeiPassportUserService {
ResponseDto<List<AdamCaomeiPassportUserClaimedBadgeVo>> bindPassport(String passportNo); ResponseDto<List<AdamCaomeiPassportUserClaimedBadgeVo>> bindPassport(String passportNo);
/** /**
* 护照首页:个人信息、实名状态、已认领墙、上架徽章货架;末尾自动发放满足条件的 type=4 签证页(响应中不含签证页) * 护照首页:个人信息、实名状态、已认领墙、签证页(type=4)、上架徽章货架;
* 末尾自动发放满足条件的 type=4 签证页,并在 {@link AdamCaomeiPassportHomeVo#getVisaBadges()} 返回。
*/ */
ResponseDto<AdamCaomeiPassportHomeVo> getPassportHome(); ResponseDto<AdamCaomeiPassportHomeVo> getPassportHome();
/**
* 签证页卡片列表(type=4):仅从用户已获徽章缓存/库中筛选 type=4。
* 需用户先访问护照首页 {@link #getPassportHome()} 触发静默发放后,本接口才有数据。
*/
ResponseDto<List<AdamCaomeiPassportUserClaimedBadgeVo>> listVisaCards();
/** /**
* 校验当前登录用户是否已绑定护照 * 校验当前登录用户是否已绑定护照
*/ */
......
...@@ -36,20 +36,13 @@ public class AdamCaomeiPassportUserController { ...@@ -36,20 +36,13 @@ public class AdamCaomeiPassportUserController {
} }
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@ApiOperation("护照首页聚合数据") @ApiOperation("护照首页聚合数据(含签证页 type=4 字段 visaBadges,访问时自动静默发放)")
@GetMapping("home") @GetMapping("home")
public ResponseDto<AdamCaomeiPassportHomeVo> home() { public ResponseDto<AdamCaomeiPassportHomeVo> home() {
return adamCaomeiPassportUserService.getPassportHome(); return adamCaomeiPassportUserService.getPassportHome();
} }
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
@ApiOperation("签证页卡片列表:仅从用户已获徽章中筛选 type=4;须先访问护照首页 home 完成静默发放后再查看")
@GetMapping("visa/list")
public ResponseDto<List<AdamCaomeiPassportUserClaimedBadgeVo>> visaList() {
return adamCaomeiPassportUserService.listVisaCards();
}
@ApiOperationSupport(order = 4)
@ApiOperation("校验当前用户是否已绑定护照") @ApiOperation("校验当前用户是否已绑定护照")
@GetMapping("/check") @GetMapping("/check")
public ResponseDto<Boolean> checkBound() { public ResponseDto<Boolean> checkBound() {
......
package com.liquidnet.service.adam.service.caomei;
import java.util.Collections;
import java.util.Set;
/**
* 用户补签审核状态快照(按「徽章 ID」与「场次 performanceId」两个维度聚合)。
* <p>
* 由 {@link CaomeiBadgeEligibilityService#loadApplyBadgeStatus} 从 DB 补签表加载,
* 供护照首页货架({@code claimable} / {@code applyPending})与演出徽章认领前置判断共用,
* 避免 home 展示与 POST claim 规则不一致。
*/
public final class CaomeiBadgeApplyStatus {
/** 审核已通过(auditStatus=1)的补签申请对应的 badgeId */
private final Set<String> passedApplyBadgeIds;
/** 待审核(auditStatus=0)的补签申请对应的 badgeId */
private final Set<String> pendingApplyBadgeIds;
/** 审核已通过补签所关联的场次 ID(含从 badge 配置兜底解析的 performanceId) */
private final Set<String> passedApplyPerformanceIds;
/** 待审核补签所关联的场次 ID */
private final Set<String> pendingApplyPerformanceIds;
/**
* @param passedApplyBadgeIds 已通过补签的徽章 ID 集合,可为 null(视为空集)
* @param pendingApplyBadgeIds 待审核补签的徽章 ID 集合,可为 null
* @param passedApplyPerformanceIds 已通过补签的场次 ID 集合,可为 null
* @param pendingApplyPerformanceIds 待审核补签的场次 ID 集合,可为 null
*/
public CaomeiBadgeApplyStatus(Set<String> passedApplyBadgeIds,
Set<String> pendingApplyBadgeIds,
Set<String> passedApplyPerformanceIds,
Set<String> pendingApplyPerformanceIds) {
this.passedApplyBadgeIds = passedApplyBadgeIds == null ? Collections.emptySet() : passedApplyBadgeIds;
this.pendingApplyBadgeIds = pendingApplyBadgeIds == null ? Collections.emptySet() : pendingApplyBadgeIds;
this.passedApplyPerformanceIds = passedApplyPerformanceIds == null ? Collections.emptySet() : passedApplyPerformanceIds;
this.pendingApplyPerformanceIds = pendingApplyPerformanceIds == null ? Collections.emptySet() : pendingApplyPerformanceIds;
}
public Set<String> getPassedApplyBadgeIds() {
return passedApplyBadgeIds;
}
public Set<String> getPendingApplyBadgeIds() {
return pendingApplyBadgeIds;
}
public Set<String> getPassedApplyPerformanceIds() {
return passedApplyPerformanceIds;
}
public Set<String> getPendingApplyPerformanceIds() {
return pendingApplyPerformanceIds;
}
}
package com.liquidnet.service.adam.service.caomei;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.adam.dto.AdamCaomeiPassportUserBadgeDto;
import com.liquidnet.service.adam.entity.AdamCaomeiBadge;
import com.liquidnet.service.adam.service.AdamRdmService;
import com.liquidnet.service.adam.util.QueueUtils;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 草莓徽章「发放」统一入口:写入用户徽章 Redis({@code INFO_CAOMEI_BADGE_USER + uid}),
* 并通过 MQ 异步 INSERT {@code adam_caomei_user_badge}。
* <p>
* 调用方:绑护照发 type=1、用户 claim、home 静默发 type=4 签证页。
* <p>
* {@code source} 与库表一致:1-绑定护照,2-购票自动,3-补签通过,4-现场管理员(本服务未使用 4)。
*/
@Slf4j
@Service
public class CaomeiBadgeGrantService {
@Autowired
private AdamRdmService adamRdmService;
@Autowired
private QueueUtils queueUtils;
/**
* 将运营配置的徽章实体转为用户已获列表中的缓存 DTO(尚未写 Redis)。
*
* @param badge 上架徽章配置(含 badgeId、名称、type、performanceId 等)
* @param source 获得途径,见类说明
* @param claimedAt 获得时间,null 时使用当前时间
*/
public AdamCaomeiPassportUserBadgeDto toUserBadgeDto(AdamCaomeiBadge badge, int source, Date claimedAt) {
AdamCaomeiPassportUserBadgeDto dto = new AdamCaomeiPassportUserBadgeDto();
dto.setBadgeId(badge.getBadgeId());
dto.setBadgeName(StringUtils.defaultString(badge.getName()));
dto.setSubTitle(StringUtils.defaultString(badge.getSubTitle()));
dto.setIcon(StringUtils.defaultString(badge.getIcon()));
dto.setShareText(StringUtils.defaultString(badge.getShareText()));
dto.setType(badge.getType());
dto.setPerformanceId(StringUtils.trimToEmpty(badge.getPerformanceId()));
dto.setClaimedAt(claimedAt != null ? claimedAt : DateUtil.now());
dto.setSource(source);
return dto;
}
/**
* 批量发放:对比用户当前已拥有 badgeId,仅对「尚未拥有」的徽章追加缓存并落库。
* <p>
* 适用于:绑护照一次性发多个 type=1、home 末尾静默发多个 type=4。
*
* @param uid 当前用户 ID
* @param badges 待发放的配置列表(通常来自 published 缓存筛选)
* @param source 获得途径
* @param grantAt 统一获得时间(批量场景 bind/签证 使用同一时间戳),null 则取当前时间
* @return 本次实际写入 Redis 的 DTO;空列表表示全部已拥有、未发生发放
*/
public List<AdamCaomeiPassportUserBadgeDto> grantBadgesIfAbsent(String uid,
List<AdamCaomeiBadge> badges,
int source,
Date grantAt) {
if (StringUtils.isBlank(uid) || CollectionUtils.isEmpty(badges)) {
return new ArrayList<>();
}
Date at = grantAt != null ? grantAt : DateUtil.now();
List<AdamCaomeiPassportUserBadgeDto> cacheList = copyUserBadgeCache(uid);
Set<String> existedBadgeIds = cacheList.stream()
.map(AdamCaomeiPassportUserBadgeDto::getBadgeId)
.filter(StringUtils::isNotBlank)
.collect(Collectors.toSet());
List<AdamCaomeiPassportUserBadgeDto> appendVos = badges.stream()
.filter(b -> b != null && StringUtils.isNotBlank(b.getBadgeId()))
.filter(b -> !existedBadgeIds.contains(b.getBadgeId()))
.map(b -> toUserBadgeDto(b, source, at))
.collect(Collectors.toList());
if (appendVos.isEmpty()) {
return appendVos;
}
adamRdmService.addUserCaomeiBadgeDtosByUid(uid, cacheList, appendVos);
sendUserBadgeInsertMq(uid, appendVos, source, at);
return appendVos;
}
/**
* 单条发放:用于 POST claim 循环内逐枚写入。
* <p>
* 调用方须已做「未领取」校验;本方法不再查重。
*
* @param uid 用户 ID
* @param badge 单枚上架徽章配置
* @param source 获得途径(type=2 时由 Eligibility 解析为 2 或 3)
* @param mutableCacheList 当前请求内持有的用户徽章列表副本,发放后会 append 并写回 Redis
*/
public void grantOne(String uid,
AdamCaomeiBadge badge,
int source,
List<AdamCaomeiPassportUserBadgeDto> mutableCacheList) {
if (badge == null || StringUtils.isBlank(badge.getBadgeId())) {
return;
}
Date now = new Date();
AdamCaomeiPassportUserBadgeDto dto = toUserBadgeDto(badge, source, now);
adamRdmService.addUserCaomeiBadgeDtoByUid(uid, mutableCacheList, dto);
queueUtils.sendMsgByRedis(
MQConst.AdamQueue.SQL_UCENTER.getKey(),
SqlMapping.get("adam_caomei_user_badge.add", uid, badge.getBadgeId(), source, now)
);
}
/** 读取用户徽章 Redis,返回可修改副本(miss 时可能为空列表) */
private List<AdamCaomeiPassportUserBadgeDto> copyUserBadgeCache(String uid) {
List<AdamCaomeiPassportUserBadgeDto> cache = adamRdmService.getUserCaomeiBadgesByUid(uid);
if (cache == null) {
return new ArrayList<>();
}
return new ArrayList<>(cache);
}
/** 批量 MQ:仅对 appendVos 中的 badgeId 发送 INSERT,与 Redis 追加范围一致 */
private void sendUserBadgeInsertMq(String uid,
List<AdamCaomeiPassportUserBadgeDto> appendVos,
int source,
Date grantAt) {
LinkedList<Object[]> paramsList = new LinkedList<>();
for (AdamCaomeiPassportUserBadgeDto dto : appendVos) {
if (dto == null || StringUtils.isBlank(dto.getBadgeId())) {
continue;
}
paramsList.add(new Object[]{uid, dto.getBadgeId(), source, grantAt});
}
if (paramsList.isEmpty()) {
return;
}
queueUtils.sendMsgByRedis(
MQConst.AdamQueue.SQL_UCENTER.getKey(),
SqlMapping.get("adam_caomei_user_badge.add", paramsList)
);
}
}
...@@ -7,7 +7,6 @@ import com.liquidnet.service.adam.dto.AdamCaomeiPassportUserBadgeDto; ...@@ -7,7 +7,6 @@ import com.liquidnet.service.adam.dto.AdamCaomeiPassportUserBadgeDto;
import com.liquidnet.service.adam.dto.param.AdamCaomeiBadgeApplyParam; import com.liquidnet.service.adam.dto.param.AdamCaomeiBadgeApplyParam;
import com.liquidnet.service.adam.dto.AdamCaomeiBadgeApplyRecordUserDto; import com.liquidnet.service.adam.dto.AdamCaomeiBadgeApplyRecordUserDto;
import com.liquidnet.service.adam.dto.vo.AdamCaomeiBadgeApplyRecordUserVo; import com.liquidnet.service.adam.dto.vo.AdamCaomeiBadgeApplyRecordUserVo;
import com.liquidnet.service.adam.dto.vo.AdamRealInfoVo;
import com.liquidnet.service.adam.entity.AdamCaomeiBadgeApplyRecord; import com.liquidnet.service.adam.entity.AdamCaomeiBadgeApplyRecord;
import com.liquidnet.service.adam.entity.AdamCaomeiBadge; import com.liquidnet.service.adam.entity.AdamCaomeiBadge;
import com.liquidnet.service.adam.entity.AdamCaomeiPassport; import com.liquidnet.service.adam.entity.AdamCaomeiPassport;
...@@ -16,6 +15,8 @@ import com.liquidnet.service.adam.mapper.AdamCaomeiBadgeMapper; ...@@ -16,6 +15,8 @@ import com.liquidnet.service.adam.mapper.AdamCaomeiBadgeMapper;
import com.liquidnet.service.adam.mapper.AdamCaomeiPassportMapper; import com.liquidnet.service.adam.mapper.AdamCaomeiPassportMapper;
import com.liquidnet.service.adam.service.AdamRdmService; import com.liquidnet.service.adam.service.AdamRdmService;
import com.liquidnet.service.adam.service.IAdamCaomeiBadgeUserService; import com.liquidnet.service.adam.service.IAdamCaomeiBadgeUserService;
import com.liquidnet.service.adam.service.caomei.CaomeiBadgeEligibilityService;
import com.liquidnet.service.adam.service.caomei.CaomeiBadgeGrantService;
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.ResponseDto;
...@@ -29,12 +30,10 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -29,12 +30,10 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.HashSet;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
...@@ -50,6 +49,10 @@ public class AdamCaomeiBadgeUserServiceImpl implements IAdamCaomeiBadgeUserServi ...@@ -50,6 +49,10 @@ public class AdamCaomeiBadgeUserServiceImpl implements IAdamCaomeiBadgeUserServi
@Autowired @Autowired
private AdamRdmService adamRdmService; private AdamRdmService adamRdmService;
@Autowired @Autowired
private CaomeiBadgeGrantService caomeiBadgeGrantService;
@Autowired
private CaomeiBadgeEligibilityService caomeiBadgeEligibilityService;
@Autowired
private QueueUtils queueUtils; private QueueUtils queueUtils;
@Override @Override
...@@ -133,56 +136,13 @@ public class AdamCaomeiBadgeUserServiceImpl implements IAdamCaomeiBadgeUserServi ...@@ -133,56 +136,13 @@ public class AdamCaomeiBadgeUserServiceImpl implements IAdamCaomeiBadgeUserServi
} }
} }
Set<String> paidPerformanceSet = Collections.emptySet(); CaomeiBadgeEligibilityService.Type2ClaimContext type2Ctx = null;
Set<String> passedApplyBadgeIds = Collections.emptySet();
Set<String> passedApplyPerformanceIds = Collections.emptySet();
Map<String, Set<String>> perfAllBadgeIds = Collections.emptyMap();
if (hasType2) { if (hasType2) {
AdamRealInfoVo real = adamRdmService.getRealInfoVoByUidPlain(uid); type2Ctx = caomeiBadgeEligibilityService.buildType2ClaimContext(uid, orderedBadges);
if (real == null || real.getState() == null || real.getState() != 1 || StringUtils.isBlank(real.getIdCard())) { if (!type2Ctx.isRealNameOk()) {
log.error("[claimBadges] 认领演出徽章需先实名, uid: {}, badgeIds: {}", uid, requestBadgeIds); log.error("[claimBadges] 认领演出徽章需先实名, uid: {}, badgeIds: {}", uid, requestBadgeIds);
return ResponseDto.failure(ErrorMapping.get("10610")); return ResponseDto.failure(ErrorMapping.get("10610"));
} }
List<String> paidPerformanceIds = adamRdmService.getPaidPerformanceIdsByIdCard(real.getIdCard());
paidPerformanceSet = paidPerformanceIds == null ? Collections.emptySet() : new HashSet<>(paidPerformanceIds);
List<AdamCaomeiBadgeApplyRecord> passedApplyRecords = badgeApplyRecordMapper.selectList(
Wrappers.lambdaQuery(AdamCaomeiBadgeApplyRecord.class)
.eq(AdamCaomeiBadgeApplyRecord::getUserId, uid)
.eq(AdamCaomeiBadgeApplyRecord::getAuditStatus, 1)
);
passedApplyBadgeIds = new HashSet<>();
passedApplyPerformanceIds = new HashSet<>();
if (passedApplyRecords != null) {
for (AdamCaomeiBadgeApplyRecord r : passedApplyRecords) {
if (r == null) {
continue;
}
if (StringUtils.isNotBlank(r.getBadgeId())) {
passedApplyBadgeIds.add(r.getBadgeId());
}
if (StringUtils.isNotBlank(r.getPerformanceId())) {
passedApplyPerformanceIds.add(r.getPerformanceId());
}
}
}
Set<String> targetPerfIds = orderedBadges.stream()
.filter(b -> b.getType() != null && b.getType() == 2)
.map(AdamCaomeiBadge::getPerformanceId)
.filter(StringUtils::isNotBlank)
.collect(Collectors.toSet());
if (!targetPerfIds.isEmpty()) {
List<AdamCaomeiBadge> perfBadges = adamCaomeiBadgeMapper.selectList(
Wrappers.lambdaQuery(AdamCaomeiBadge.class)
.eq(AdamCaomeiBadge::getType, 2)
.in(AdamCaomeiBadge::getPerformanceId, targetPerfIds)
);
perfAllBadgeIds = perfBadges.stream()
.filter(b -> StringUtils.isNotBlank(b.getPerformanceId()) && StringUtils.isNotBlank(b.getBadgeId()))
.collect(Collectors.groupingBy(AdamCaomeiBadge::getPerformanceId,
Collectors.mapping(AdamCaomeiBadge::getBadgeId, Collectors.toSet())));
}
} }
List<String> claimedBadgeIds = new ArrayList<>(); List<String> claimedBadgeIds = new ArrayList<>();
...@@ -190,25 +150,14 @@ public class AdamCaomeiBadgeUserServiceImpl implements IAdamCaomeiBadgeUserServi ...@@ -190,25 +150,14 @@ public class AdamCaomeiBadgeUserServiceImpl implements IAdamCaomeiBadgeUserServi
int type = badge.getType() == null ? 0 : badge.getType(); int type = badge.getType() == null ? 0 : badge.getType();
int source = 1; int source = 1;
if (type == 2) { if (type == 2) {
String perfId = StringUtils.trimToEmpty(badge.getPerformanceId()); if (!caomeiBadgeEligibilityService.canClaimPerformanceBadge(badge, type2Ctx)) {
boolean hasPaidRecord = StringUtils.isNotBlank(perfId) && paidPerformanceSet.contains(perfId);
boolean hasPassedApply = false;
if (StringUtils.isNotBlank(perfId)) {
if (passedApplyPerformanceIds.contains(perfId)) {
hasPassedApply = true;
} else {
Set<String> badgeIdSet = perfAllBadgeIds.getOrDefault(perfId, Collections.emptySet());
hasPassedApply = badgeIdSet.stream().anyMatch(passedApplyBadgeIds::contains);
}
}
if (!hasPaidRecord && !hasPassedApply) {
log.error("[claimBadges] 无购票记录且无通过补签,无法认领, uid: {}, badgeId: {}", uid, badge.getBadgeId()); log.error("[claimBadges] 无购票记录且无通过补签,无法认领, uid: {}, badgeId: {}", uid, badge.getBadgeId());
return ResponseDto.failure(ErrorMapping.get("10611")); return ResponseDto.failure(ErrorMapping.get("10611"));
} }
source = hasPaidRecord ? 2 : 3; source = caomeiBadgeEligibilityService.resolveClaimSourceForType2(badge, type2Ctx);
} }
grantUserBadgeRedisThenMq(uid, badge, source, badgeVos); caomeiBadgeGrantService.grantOne(uid, badge, source, badgeVos);
claimedBadgeIds.add(badge.getBadgeId()); claimedBadgeIds.add(badge.getBadgeId());
} }
...@@ -216,33 +165,6 @@ public class AdamCaomeiBadgeUserServiceImpl implements IAdamCaomeiBadgeUserServi ...@@ -216,33 +165,6 @@ public class AdamCaomeiBadgeUserServiceImpl implements IAdamCaomeiBadgeUserServi
return ResponseDto.success(claimedBadgeIds); return ResponseDto.success(claimedBadgeIds);
} }
/**
* Redis 追加用户徽章展示 DTO,再发 MQ 异步执行 sqlmap 中的 INSERT。
*/
private void grantUserBadgeRedisThenMq(String uid, AdamCaomeiBadge badge, int source,
List<AdamCaomeiPassportUserBadgeDto> badgeVos) {
Date now = new Date();
AdamCaomeiPassportUserBadgeDto dto = new AdamCaomeiPassportUserBadgeDto();
dto.setBadgeId(badge.getBadgeId());
dto.setBadgeName(StringUtils.defaultString(badge.getName()));
dto.setIcon(StringUtils.defaultString(badge.getIcon()));
dto.setShareText(StringUtils.defaultString(badge.getShareText()));
dto.setType(badge.getType());
dto.setClaimedAt(now);
dto.setSource(source);
dto.setSubTitle(badge.getSubTitle());
dto.setPerformanceId(StringUtils.defaultString(badge.getPerformanceId()));
adamRdmService.addUserCaomeiBadgeDtoByUid(uid, badgeVos, dto);
long t = System.currentTimeMillis();
queueUtils.sendMsgByRedis(
MQConst.AdamQueue.SQL_UCENTER.getKey(),
SqlMapping.get("adam_caomei_user_badge.add", uid, badge.getBadgeId(), source, now)
);
log.debug("[claimBadge] MQ耗时:{}ms, uid: {}, badgeId: {}", System.currentTimeMillis() - t, uid, badge.getBadgeId());
}
@Override @Override
public ResponseDto<List<AdamCaomeiBadgeApplyRecordUserVo>> getApplyRecords(String uid) { public ResponseDto<List<AdamCaomeiBadgeApplyRecordUserVo>> getApplyRecords(String uid) {
if (StringUtils.isBlank(uid)) { if (StringUtils.isBlank(uid)) {
......
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