Commit 6afa9a19 authored by zhaobiyan's avatar zhaobiyan

唯一键传参

parent 3d427878
......@@ -41,7 +41,7 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
@Slf4j
@Service
public class MemberUserScoreApiImpl implements MemberUserScoreApi{
public class MemberUserScoreApiImpl implements MemberUserScoreApi {
@Resource
private MemberUserScoreLogService logService;
......@@ -71,7 +71,7 @@ public class MemberUserScoreApiImpl implements MemberUserScoreApi{
if (StringUtils.isBlank(req.getUniqueId())) {
throw exception(SCORE_OPERATE_MUST_HAVE_UNIQUE_ID);
}
MemberUserScoreLogDO memberUserScoreLogDO = logService.getByUniqueId(req.getUniqueId());
MemberUserScoreLogDO memberUserScoreLogDO = logService.getByUniqueId(req.getSourceType() + "_" + req.getUniqueId());
if (memberUserScoreLogDO != null) {
throw exception(SCORE_OPERATE_IDEMPOTENT_ERROR);
}
......@@ -86,7 +86,7 @@ public class MemberUserScoreApiImpl implements MemberUserScoreApi{
List<ScoreDetailChangeDto> detailInfos = saveScoreDetail(req, logId);
saveScoreDetailReleation(req, detailInfos);
updateUserScore(req);
publishDetailExpireEvent(req,detailInfos);
publishDetailExpireEvent(req, detailInfos);
} catch (InterruptedException e) {
throw exception(GET_LOCK_FAILED);
} finally {
......@@ -96,7 +96,7 @@ public class MemberUserScoreApiImpl implements MemberUserScoreApi{
}
private void publishDetailExpireEvent(MemberUserScoreOperateReqDTO req, List<ScoreDetailChangeDto> detailInfos) {
if (req.getSourceType().getReverseSource() == null || req.getOperateType() ==ScoreOperateTypeEnum.REDUCE) {
if (req.getSourceType().getReverseSource() == null || req.getOperateType() == ScoreOperateTypeEnum.REDUCE) {
return;
}
//判断回退流程,回退的积分是否过期.如果过期再走正常的过期扣积分流程
......@@ -199,7 +199,7 @@ public class MemberUserScoreApiImpl implements MemberUserScoreApi{
req.getOperateType().getValue() : req.getSourceType().getOperateType().getValue())
.sourceType(req.getSourceType().getValue())
.extParam(req.getExtParam())
.uniqueId(req.getUniqueId())
.uniqueId(req.getSourceType() + "_" + req.getUniqueId())
.build());
}
}
......@@ -64,7 +64,7 @@ public class MemberUserScoreExpireTask implements JobHandler {
.memberId(memberUserScoreDetailDO.getMemberId())
.scoreCount(memberUserScoreDetailDO.getRemainCount())
.sourceType(ScoreSourceTypeEnum.SYSTEM_EXPIRED)
.uniqueId(ScoreSourceTypeEnum.SYSTEM_EXPIRED +"_"+ memberUserScoreDetailDO.getId() + "_" + System.currentTimeMillis())
.uniqueId(memberUserScoreDetailDO.getId() + "_" + System.currentTimeMillis())
.extParam(extParam)
.build());
} catch (Exception e) {
......
......@@ -60,7 +60,7 @@ public class MemberUserScoreController {
.operateType(ScoreOperateTypeEnum.parseByValue(query.getOperateType()))
.sourceType(ScoreSourceTypeEnum.MANUAL_OPERATE)
.extParam(extParam)
.uniqueId(ScoreSourceTypeEnum.MANUAL_OPERATE + "_" + System.currentTimeMillis())
.uniqueId(String.valueOf(System.currentTimeMillis()))
.build());
return success(null);
}
......
......@@ -55,7 +55,7 @@ public class MemberUserScoreDetailExpireListener {
.memberId(detail.getMemberId())
.scoreCount(detail.getRemainCount())
.sourceType(ScoreSourceTypeEnum.SYSTEM_EXPIRED)
.uniqueId(ScoreSourceTypeEnum.SYSTEM_EXPIRED +"_"+ detail.getId() + "_" + System.currentTimeMillis())
.uniqueId(detail.getId() + "_" + System.currentTimeMillis())
.extParam(extParam)
.build());
} catch (Exception e) {
......
......@@ -112,7 +112,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
.sourceType(ScoreSourceTypeEnum.EXCHANGE_REWARD)
.scoreCount(redeemRewardReqVO.getRewardCount() * rewardDO.getPointsRequire())
.releationId(String.valueOf(redeemId))
.uniqueId(ScoreSourceTypeEnum.EXCHANGE_REWARD + "_" + redeemId)
.uniqueId(String.valueOf(redeemId))
.extParam(extParam)
.build());
}
......
......@@ -274,7 +274,7 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
.scoreCount(rewardRedeemDO.getScoreCount())
.extParam(extParam)
.releationId(String.valueOf(req.getId()))
.uniqueId(ScoreSourceTypeEnum.EXCHANGE_REWARD_CANCEL + "_" + req.getId())
.uniqueId(String.valueOf(req.getId()))
.build());
return true;
}
......
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