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");
}
}
......
......@@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleOrderVExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleRegisterExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRuleShareExtraVO;
import cn.iocoder.yudao.module.member.vo.scoreRule.extra.ScoreRulerRecommendExtraVO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
......@@ -50,12 +51,14 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
private ScoreRuleRedisDao scoreRuleRedisDao;
@Resource
private WarehouseService warehouseService;
@Resource
private AdminUserApi adminUserApi;
@Override
public Long createScoreRule(ScoreRuleCreateReqVO createReqVO) {
ScoreRuleDO scoreRule = ScoreRuleConvert.INSTANCE.convert(createReqVO);
if (scoreRule.getStatus() != ScoreRuleStatusEnum.DISABLED.getValue() && scoreRule.getStatus() != ScoreRuleStatusEnum.ENABLED.getValue()) {
throw exception(SCORE_RULE_FIELD_ERROR, "状态只能是启用或未启用");
throw exception(SCORE_RULE_FIELD_ERROR, "status must be 1 or 2");
}
verifyCommon(createReqVO);
Integer scoreRuleType = scoreRule.getType();
......@@ -69,16 +72,16 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
private void verifyCommon(ScoreRuleBaseVO scoreRuleIn) {
//校验公共入参
if (scoreRuleIn.getType() != ScoreRuleTypeEnum.ORDER_V.getValue() && scoreRuleIn.getGetScoreOnce() <= 0) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "getScoreOnce must > 0");
}
if (scoreRuleIn.getType() != ScoreRuleTypeEnum.RECOMMEND.getValue() && scoreRuleIn.getMaxScoreTotal() <= 0) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "maxScoreTotal must > 0");
}
if (scoreRuleIn.getStartTime().after((scoreRuleIn.getEndTime())) || scoreRuleIn.getEndTime().before(Date.from(Instant.now()))) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "startTime must before endTime and endTime must after now");
}
if (scoreRuleIn.getScorePeriod() <= 0) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "scorePeriod must > 0");
}
//如果是启用,校验同一个规则下,有效期内有没有重复的规则设置,分享不校验。海运空运分开算
if (scoreRuleIn.getStatus() == ScoreRuleStatusEnum.ENABLED.getValue() && scoreRuleIn.getType() != ScoreRuleTypeEnum.SHARE.getValue()) {
......@@ -88,25 +91,25 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
if (scoreRuleIn.getType() == ScoreRuleTypeEnum.ORDER_V.getValue()) {
ScoreRuleOrderVExtraVO extraOrderV = scoreRuleIn.getExtraOrderV();
if (extraOrderV == null) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "extraOrderV must not null");
}
Integer transportType = extraOrderV.getTransportType();
if (transportType != TransportTypeEnum.OCEAN_LCL.getValue() && transportType != TransportTypeEnum.SPECIAL_LINE_AIR_FREIGHT.getValue()) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "transportType must 1 or 3");
}
List<ScoreRuleDO> scoreRuleDOS = scoreRuleMapper.selectList(scoreRuleDOLambdaQuery);
if (scoreRuleDOS != null && !scoreRuleDOS.isEmpty()) {
for (ScoreRuleDO scoreRuleDO : scoreRuleDOS) {
ScoreRuleOrderVExtraVO bean = JSONUtil.toBean(scoreRuleDO.getExtra(), ScoreRuleOrderVExtraVO.class);
if (Objects.equals(bean.getTransportType(), transportType)) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "such rule is already enabled");
}
}
}
} else {
Long count = scoreRuleMapper.selectCount(scoreRuleDOLambdaQuery);
if (count > 0) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "such rule is already enabled");
}
}
}
......@@ -120,7 +123,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
throw exception(SCORE_RULE_NOT_EXISTS);
}
if (scoreRuleDO.getStatus() != ScoreRuleStatusEnum.DISABLED.getValue()) {
throw exception(SCORE_RULE_UPDATE_ERROR);
throw exception(SCORE_RULE_UPDATE_ERROR, "only disabled rule can update");
}
ScoreRuleDO scoreRule = ScoreRuleConvert.INSTANCE.convert(updateReqVO);
verifyCommon(updateReqVO);
......@@ -141,18 +144,18 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
if (scoreRuleType == ScoreRuleTypeEnum.ORDER_V.getValue()) {
ScoreRuleOrderVExtraVO extraOrderV = reqVO.getExtraOrderV();
if (extraOrderV == null) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "extraOrderV must not null");
}
if (extraOrderV.getFirstOrder() != YesOrNoTypeEnum.YES.ordinal() && extraOrderV.getFirstOrder() != YesOrNoTypeEnum.NO.ordinal()) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "firstOrder must 0 or 1");
}
if (extraOrderV.getTransportType() != TransportTypeEnum.OCEAN_LCL.getValue() && extraOrderV.getTransportType() != TransportTypeEnum.SPECIAL_LINE_AIR_FREIGHT.getValue()) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "transportType must 1 or 3");
}
// 国家,城市,仓库id从receiveAddrList中获取
List<List<Long>> receiveAddrList = extraOrderV.getReceiveAddrList();
if (receiveAddrList == null || extraOrderV.getReceiveAddrList().isEmpty()) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "receiveAddrList must not null");
}
StringBuilder targetCountry = new StringBuilder();
StringBuilder targetCity = new StringBuilder();
......@@ -163,7 +166,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
targetCity.append(integers.get(1)).append(",");
receiveAddr.append(integers.get(2)).append(",");
} catch (Exception e) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "receiveAddrList format error");
}
}
extraOrderV.setTargetCountry(targetCountry.toString());
......@@ -171,55 +174,55 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
extraOrderV.setReceiveAddr(receiveAddr.toString());
extraOrderV.setReceiveAddrList(null);
if (StringUtils.isBlank(extraOrderV.getOrderEntry())) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "orderEntry must not null");
}
verifyOrderVRule(extraOrderV.getOrderVRule());
scoreRule.setExtra(JSONUtil.toJsonStr(extraOrderV));
} else if (scoreRuleType == ScoreRuleTypeEnum.REGISTER.getValue()) {
if (reqVO.getExtraRegister() == null) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "extraRegister must not null");
}
if (StringUtils.isBlank(reqVO.getExtraRegister().getRegisterPlatform())) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "registerPlatform must not null");
}
scoreRule.setExtra(JSONUtil.toJsonStr(reqVO.getExtraRegister()));
} else if (scoreRuleType == ScoreRuleTypeEnum.RECOMMEND.getValue()) {
ScoreRulerRecommendExtraVO extraRecommend = reqVO.getExtraRecommend();
if (extraRecommend == null) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "extraRecommend must not null");
}
if (extraRecommend.getShareStatus() != YesOrNoTypeEnum.YES.ordinal() && extraRecommend.getShareStatus() != YesOrNoTypeEnum.NO.ordinal()) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "shareStatus must 0 or 1");
}
if (StringUtils.isAnyBlank(extraRecommend.getShareContentEn(), extraRecommend.getShareContentZh())) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "shareContentEn and shareContentZh must not null");
}
scoreRule.setExtra(JSONUtil.toJsonStr(extraRecommend));
} else if (scoreRuleType == ScoreRuleTypeEnum.SHARE.getValue()) {
ScoreRuleShareExtraVO extraShare = reqVO.getExtraShare();
if (extraShare == null) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "extraShare must not null");
}
if (StringUtils.isAnyBlank(extraShare.getActivityDescZh(), extraShare.getActivityDescEn(), extraShare.getActivityUrl())) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "activityDescZh,activityDescEn,activityUrl must not null");
}
if (extraShare.getShareStatus() != YesOrNoTypeEnum.YES.ordinal() && extraShare.getShareStatus() != YesOrNoTypeEnum.NO.ordinal()) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "shareStatus must 0 or 1");
}
scoreRule.setExtra(JSONUtil.toJsonStr(extraShare));
} else {
throw exception(SCORE_RULE_NOT_EXISTS);
throw exception(SCORE_RULE_NOT_EXISTS, "scoreRuleType error");
}
}
private void verifyOrderVRule(List<ScoreRuleOrderVExtraVO.OrderVRule> extraOrderVRule) {
if (extraOrderVRule == null || extraOrderVRule.isEmpty()) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "orderVRule must not null");
}
int low = 0;
for (ScoreRuleOrderVExtraVO.OrderVRule orderVRule : extraOrderVRule) {
if (orderVRule.getLow() < low || orderVRule.getHigh() <= orderVRule.getLow() || orderVRule.getScore() <= 0) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "ordervrule does not conform to the rules");
}
low = orderVRule.getHigh();
}
......@@ -232,7 +235,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
throw exception(SCORE_RULE_NOT_EXISTS);
}
if (scoreRuleDO.getStatus() != ScoreRuleStatusEnum.DISABLED.getValue()) {
throw exception(SCORE_RULE_DELETE_ERROR);
throw exception(SCORE_RULE_DELETE_ERROR, "only disabled rule can update");
}
// 删除
scoreRuleMapper.deleteById(id);
......@@ -266,6 +269,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
@Override
public PageResult<ScoreRuleBackVO> getScoreRulePage(ScoreRuleQueryVO query, PageVO page) {
PageResult<ScoreRuleDO> pageResult = scoreRuleMapper.selectPage(page, query);
pageResult.getList().forEach(scoreRuleDO -> {
String creator = adminUserApi.getUserName(scoreRuleDO.getCreator());
scoreRuleDO.setCreator(creator);
String updater = adminUserApi.getUserName(scoreRuleDO.getUpdater());
scoreRuleDO.setUpdater(updater);
});
return ScoreRuleConvert.INSTANCE.convertPage(pageResult);
}
......@@ -331,12 +340,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
.eq(ScoreRuleDO::getStatus, ScoreRuleStatusEnum.ENABLED.getValue());
Long count = scoreRuleMapper.selectCount(scoreRuleDOLambdaQuery);
if (count > 0) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "such rule is already enabled");
}
}
upScoreRuleDO.setStatus(scoreRuleStatusReqVO.getStatus());
} else {
throw exception(SCORE_RULE_UPDATE_ERROR);
throw exception(SCORE_RULE_UPDATE_ERROR, "status not allow");
}
scoreRuleMapper.updateById(upScoreRuleDO);
scoreRuleRedisDao.deleteEnableScoreRule(scoreRuleDO.getType());
......@@ -364,12 +373,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
throw exception(SCORE_RULE_NOT_EXISTS);
}
if (scoreRuleDO.getStatus() != ScoreRuleStatusEnum.ENABLED.getValue()) {
throw exception(SCORE_RULE_UPDATE_ERROR);
throw exception(SCORE_RULE_UPDATE_ERROR, "only enabled rule can delay");
}
Instant now = Instant.now();
//结束时间不能小于当前时间
if (!delayReqVO.getEndTime().toInstant().isAfter(now) || !delayReqVO.getEndTime().toInstant().isAfter(scoreRuleDO.getStartTime().toInstant())) {
throw exception(SCORE_RULE_UPDATE_ERROR);
throw exception(SCORE_RULE_UPDATE_ERROR, "end time must after now and start time");
}
ScoreRuleDO upScoreRuleDO = new ScoreRuleDO();
upScoreRuleDO.setId(delayReqVO.getId());
......@@ -380,7 +389,7 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
@Override
public ScoreRuleDO getEnabledOrderVScoreRuleByTransportType(Integer transportType) {
if (transportType != TransportTypeEnum.OCEAN_LCL.getValue() && transportType != TransportTypeEnum.SPECIAL_LINE_AIR_FREIGHT.getValue()) {
throw exception(SCORE_RULE_FIELD_ERROR);
throw exception(SCORE_RULE_FIELD_ERROR, "transportType must 1 or 3");
}
LambdaQuery<ScoreRuleDO> lambdaQuery = new LambdaQuery<>();
lambdaQuery.eq(ScoreRuleDO::getStatus, ScoreRuleStatusEnum.ENABLED.getValue())
......
......@@ -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