Commit 6afa9a19 authored by zhaobiyan's avatar zhaobiyan

唯一键传参

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