Commit e8cd74aa authored by zhangfeng's avatar zhangfeng

Merge branch 'refs/heads/feature_member_score' into dev

parents 3481b43f 62f23b58
......@@ -53,10 +53,10 @@ public interface ErrorCodeConstants {
ErrorCode SCORE_OPERATE_IDEMPOTENT_ERROR = new ErrorCode(1004008009, "score.operate.idempotent.error");
ErrorCode SCORE_RULE_NOT_EXISTS = new ErrorCode(1004008010, "score.rule.not.exists");
ErrorCode SCORE_RULE_DELETE_ERROR = new ErrorCode(1004008011, "score.rule.delete.error");
ErrorCode SCORE_RULE_UPDATE_ERROR = new ErrorCode(1004008012, "score.rule.update.error");
ErrorCode SCORE_RULE_DELETE_ERROR = new ErrorCode(1004008011, "score.rule.delete.error:{}");
ErrorCode SCORE_RULE_UPDATE_ERROR = new ErrorCode(1004008012, "score.rule.update.error:{}");
ErrorCode SCORE_RULE_FIELD_ERROR = new ErrorCode(1004008013, "score.rule.field.error:{}");
ErrorCode USER_ADDRESS_NOT_EXISTS = new ErrorCode(1004008014, "user.address.not.exists");
ErrorCode USER_ADDRESS_FIELD_ERROR = new ErrorCode(1004008015, "user.address.field.error");
ErrorCode USER_ADDRESS_FIELD_ERROR = new ErrorCode(1004008015, "user.address.field.error:{}");
}
......@@ -64,11 +64,11 @@ public class UserAddressServiceImpl extends AbstractService<UserAddressMapper, U
// throw exception(USER_NOT_EXISTS);
//}
if (StringUtils.isAnyBlank(reqVO.getAddress(), reqVO.getAreaCode(), reqVO.getName(), reqVO.getPhone())) {
throw exception(USER_ADDRESS_FIELD_ERROR);
throw exception(USER_ADDRESS_FIELD_ERROR,"Address,AreaCode,Name,Phone must not null");
}
// 校验手机号格式
if (!reqVO.getPhone().matches("^1[3-9]\\d{9}$")) {
throw exception(USER_ADDRESS_FIELD_ERROR);
throw exception(USER_ADDRESS_FIELD_ERROR,"phone number error");
}
}
......
......@@ -3,8 +3,7 @@ package cn.iocoder.yudao.module.reward.enums;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
// TODO 待办:请将下面的错误码复制到 yudao-module-reward-api 模块的 ErrorCodeConstants 类中。注意,请给“TODO 补充编号”设置一个错误码编号!!!
// ========== 礼品 TODO 补充编号 ==========
// ========== 礼品错误码 ==========
public interface ErrorCodeConstants {
ErrorCode REWARD_NOT_EXISTS = new ErrorCode(1010011001, "reward.do.not.exist");
ErrorCode REWARD_ENDTIME_ERROR = new ErrorCode(1001011002, "reward.end.time.less.than.now");
......@@ -13,16 +12,15 @@ public interface ErrorCodeConstants {
ErrorCode REWARD_STATUS_CHANGE_ERROR = new ErrorCode(1001011005, "reward.status.change.error");
ErrorCode REWARD_STATUS_NOT_ALLOW_DELAY = new ErrorCode(1001011006, "reward.status.not.allow.delay");
ErrorCode REWARD_STATUS_NOT_ALLOW_CREATE = new ErrorCode(1001011007, "reward.status.not.allow.create");
ErrorCode REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE = new ErrorCode(1001011008, "reward.time.not.allow");
ErrorCode REWARD_PICK_METHOD_NOT_ALLOW_CREATE = new ErrorCode(1001011009, "领取方式不合法");
ErrorCode REWARD_STATUS_NOT_ALLOW_UPDATE = new ErrorCode(1001011010, "礼物状态不允许编辑");
ErrorCode REWARD_STATUS_NOT_ALLOW_ENABLE = new ErrorCode(1001011011, "礼物不能启用");
ErrorCode REWARD_NOT_ENABLE = new ErrorCode(1001011012, "礼物未启用");
ErrorCode REWARD_SCORE_NOT_ENOUGH = new ErrorCode(1001011013, "会员积分不够");
ErrorCode REWARD_COUNT_NOT_ENOUGH = new ErrorCode(1001011014, "礼品数量不够");
ErrorCode REWARD_REDEEM_FAIL = new ErrorCode(1001011015, "批量兑换失败");
ErrorCode REWARD_REDEEM_COUNT_NOT_ALLOW = new ErrorCode(1001011016, "批量兑换每次最多十条");
ErrorCode REWARD_REDEEM_ALLOW_COUNT_ERROR = new ErrorCode(1001011017, "超出允许兑换次数");
ErrorCode REWARD_START_OR_END_TIME_NOT_ALLOW = new ErrorCode(1001011008, "reward.time.not.allow");
ErrorCode REWARD_PICK_METHOD_NOT_ALLOW = new ErrorCode(1001011009, "reward.pick.method.not.allow");
ErrorCode REWARD_STATUS_NOT_ALLOW_UPDATE = new ErrorCode(1001011010, "reward.status.not.allow.update");
ErrorCode REWARD_STATUS_NOT_ALLOW_ENABLE = new ErrorCode(1001011011, "reward.status.not.allow.enable");
ErrorCode REWARD_NOT_ENABLE = new ErrorCode(1001011012, "reward.not.enable");
ErrorCode REWARD_SCORE_NOT_ENOUGH = new ErrorCode(1001011013, "reward.score.not.enough:{}");
ErrorCode REWARD_COUNT_NOT_ENOUGH = new ErrorCode(1001011014, "reward.count.not.enough");
ErrorCode REWARD_REDEEM_COUNT_NOT_ALLOW = new ErrorCode(1001011016, "reward.redeem.count.not.allow");
ErrorCode REWARD_REDEEM_ALLOW_COUNT_ERROR = new ErrorCode(1001011017, "reward.redeem.allow.count.error:{}");
ErrorCode REWARD_REDEEM_NOT_EXIST = new ErrorCode(1001011018, "reward.redeem.not.exist");
ErrorCode REWARD_REDEEM_STATUS_ERROR = new ErrorCode(1001011019, "reward.redeem.status.error");
ErrorCode REWARD_REDEEM_VERIFY_NO_PARAM = new ErrorCode(1001011020, "reward.redeem.verify.no.param");
......
......@@ -161,7 +161,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
String pickMethod = rewardDO.getPickMethod();
String[] split = pickMethod.split(",");
if (!Arrays.asList(split).contains(String.valueOf(redeemRewardReqVO.getRedeemType()))) {
throw exception(REWARD_PICK_METHOD_NOT_ALLOW_CREATE);
throw exception(REWARD_PICK_METHOD_NOT_ALLOW);
}
}
verifyMemberUser(redeemRewardReqVO, rewardDO);
......@@ -187,7 +187,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
redeemReward(rewardDO, redeemRewardReqVO.getRewardCount());
}
} catch (ServiceException e) {
log.error("batch redeem rewards exception", e);
log.error("batch redeem rewards exception:{}", e.getMessage());
throw e;
} catch (InterruptedException e) {
throw exception(GET_LOCK_FAILED);
......@@ -220,7 +220,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
Integer holdScore = memberUser.getHoldScore();
// 会员积分不够
if (holdScore < rewardDO.getPointsRequire() * redeemRewardReqVO.getRewardCount()) {
throw exception(REWARD_SCORE_NOT_ENOUGH);
throw exception(REWARD_SCORE_NOT_ENOUGH, "userId:" + redeemRewardReqVO.getMemberId() + ",holdScore:" + holdScore, "requireScore:" + rewardDO.getPointsRequire() * redeemRewardReqVO.getRewardCount());
}
// 校验兑换次数
LambdaQueryWrapper<RewardRedeemDO> rewardRedeemDOWrapper = new LambdaQueryWrapper<>();
......@@ -228,7 +228,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
.eq(RewardRedeemDO::getMemberId, redeemRewardReqVO.getMemberId());
Long count = rewardRedeemMapper.selectCount(rewardRedeemDOWrapper);
if (count > rewardDO.getAllowCount()) {
throw exception(REWARD_REDEEM_ALLOW_COUNT_ERROR);
throw exception(REWARD_REDEEM_ALLOW_COUNT_ERROR, "userId:" + redeemRewardReqVO.getMemberId() + ",rewardId:" + redeemRewardReqVO.getRewardId());
}
}
}
......@@ -54,11 +54,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
//活动开始时间不能比活动结束时间晚,活动结束时间不能比当前时间早
if (ObjectUtils.allNotNull(createReqVO.getStartTime(), createReqVO.getEndTime())) {
if (createReqVO.getStartTime().after((createReqVO.getEndTime())) || createReqVO.getEndTime().before(Date.from(Instant.now()))) {
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE);
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW);
}
} else if (ObjectUtils.allNull(createReqVO.getStartTime(), createReqVO.getEndTime())) {
} else {
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE);
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW);
}
// 创建的礼品状态只能是启用或未启用
if (createReqVO.getStatus() != RewardStatusEnum.ENABLED.getValue() && createReqVO.getStatus() != RewardStatusEnum.DISABLED.getValue()) {
......@@ -94,11 +94,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
if (rewardDO.getStatus() == RewardStatusEnum.DISABLED.getValue()) {
if (ObjectUtils.allNotNull(updateReqVO.getStartTime(), updateReqVO.getEndTime())) {
if (updateReqVO.getStartTime().after((updateReqVO.getEndTime())) || updateReqVO.getEndTime().before(Date.from(Instant.now()))) {
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE);
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW);
}
} else if (ObjectUtils.allNull(updateReqVO.getStartTime(), updateReqVO.getEndTime())) {
} else {
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW_CREATE);
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW);
}
updateObj = RewardConvert.INSTANCE.convert(updateReqVO);
} else if (rewardDO.getStatus() == RewardStatusEnum.ENABLED.getValue()) { //已启用可编辑剩余数量和备注
......
......@@ -1018,6 +1018,15 @@ reward.redeem.status.error = reward redeem record that is redeeming can edit or
reward.redeem.verify.no.param = Fee/Currency/Express/Express NO/Delivery Date/Sender/Recipient Address must be filled in
reward.redeem.batch.verify.error = reward redeem record verify failed, please check record data : {}
reward.redeem.verify.back.status = record status must be redeemed
reward.pick.method.not.allow = pick method not allow
reward.status.not.allow.update = reward status not allow update
reward.status.not.allow.enable = reward status not allow enable
reward.not.enable = reward is not enable
reward.score.not.enough = user score not enough
reward.count.not.enough = reward count not enough
reward.redeem.count.not.allow = bulk redemption is limited to a maximum of 10 pieces at a time
reward.redeem.allow.count.error = the number of redemptions allowed by the individual has been exceeded
redeem.import.max.count = allow maximum number of imports is {}
dict.unknown.error = Not in dict {0}: {1}
express.not.exist = express not exist
......@@ -1026,4 +1035,12 @@ date.format.error = date format error, for example : 2024-01-01 12:11:11
redeem.cancel.status.error = record status must be redeeming
level.bound.range.error = upper count must greater than lower count
level.bound.range.conflict = score range exist conflict
score.operate.idempotent.error = idempotent key conflict
\ No newline at end of file
score.operate.idempotent.error = idempotent key conflict
score.rule.not.exists = score rule not exists
score.rule.field.error = score rule field error
score.rule.update.error = score rule update error
score.rule.delete.error = score rule delete error
user.address.not.exists = user address not exists
user.address.field.error = user address field error
\ No newline at end of file
......@@ -1014,6 +1014,15 @@ reward.status.change.error=\u793C\u54C1\u72B6\u6001\u64CD\u4F5C\u4E0D\u7B26\u540
reward.status.not.allow.delay=\u53EA\u5141\u8BB8\u5EF6\u671F\u542F\u7528\u72B6\u6001\u793C\u54C1
reward.status.not.allow.create=\u521B\u5EFA\u7684\u793C\u54C1\u72B6\u6001\u53EA\u80FD\u662F\u542F\u7528\u6216\u672A\u542F\u7528
reward.time.not.allow=\u6D3B\u52A8\u65F6\u95F4\u4E0D\u5408\u6CD5
reward.pick.method.not.allow = \u793C\u54C1\u9886\u53D6\u65B9\u5F0F\u4E0D\u652F\u6301
reward.status.not.allow.update = \u793C\u54C1\u72B6\u6001\u64CD\u4F5C\u4E0D\u7B26\u5408\u89C4\u5219
reward.status.not.allow.enable = \u793C\u54C1\u4E0D\u5141\u8BB8\u542F\u7528
reward.not.enable = \u793C\u54C1\u672A\u542F\u7528
reward.score.not.enough = \u79EF\u5206\u4E0D\u8DB3
reward.count.not.enough = \u793C\u54C1\u6570\u91CF\u4E0D\u8DB3
reward.redeem.count.not.allow = \u6279\u91CF\u5151\u6362\u6BCF\u6B21\u6700\u591A\u5341\u6761
reward.redeem.allow.count.error = \u5DF2\u8D85\u51FA\u4E2A\u4EBA\u5141\u8BB8\u5151\u6362\u6B21\u6570
get.lock.failed = \u670D\u52A1\u7E41\u5FD9\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5
reward.redeem.not.exist = \u793C\u54C1\u5151\u6362\u8BB0\u5F55\u4E0D\u5B58\u5728
reward.redeem.status.error = \u53EA\u6709\u5151\u6362\u4E2D\u72B6\u6001\u7684\u8BB0\u5F55\u624D\u5141\u8BB8\u7F16\u8F91\u6216\u6838\u9500
......@@ -1028,4 +1037,12 @@ date.format.error = \u65E5\u671F\u683C\u5F0F\u4E0D\u6B63\u786E, \u6B63\u786E\u68
redeem.cancel.status.error = \u5151\u6362\u4E2D\u72B6\u6001\u7684\u8BB0\u5F55\u624D\u80FD\u64A4\u9500
level.bound.range.error = \u4E0A\u754C\u6570\u503C\u5FC5\u987B\u5927\u4E8E\u4E0B\u754C\u6570\u503C
level.bound.range.conflict = \u79EF\u5206\u8303\u56F4\u5B58\u5728\u51B2\u7A81
score.operate.idempotent.error = \u5E42\u7B49key\u51B2\u7A81
\ No newline at end of file
score.operate.idempotent.error = \u5E42\u7B49key\u51B2\u7A81
score.rule.not.exists = \u79EF\u5206\u89C4\u5219\u4E0D\u5B58\u5728
score.rule.field.error = \u79EF\u5206\u89C4\u5219\u5B57\u6BB5\u9519\u8BEF
score.rule.update.error = \u79EF\u5206\u89C4\u5219\u66F4\u65B0\u5931\u8D25
score.rule.delete.error = \u79EF\u5206\u89C4\u5219\u5220\u9664\u5931\u8D25
user.address.not.exists = \u7528\u6237\u5730\u5740\u4E0D\u5B58\u5728
user.address.field.error = \u7528\u6237\u5730\u5740\u5B57\u6BB5\u9519\u8BEF
\ No newline at end of file
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