Commit 2fabfe1d authored by zhangfeng's avatar zhangfeng

Merge branch 'refs/heads/feature_member_score_zhangfeng' into feature_member_score

parents 5ff85533 77525aef
......@@ -53,8 +53,8 @@ public class RecommendStrategy extends AbstractScoreRuleStrategy {
try {
HashMap<String, Object> map = new HashMap<>();
map.put("userId", userId);
map.put("userNameZh", message.getUserNameZh());
map.put("userNameEn", message.getUserNameEn());
map.put("userNameZh", memberUserDO.getNickname());
map.put("userNameEn", memberUserDO.getEnglishName());
String desensitizedPhoneNumber = memberUserDO.getMobile().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
map.put("phone", desensitizedPhoneNumber);
......
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.reward.service.reward;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
......@@ -16,6 +17,7 @@ import cn.iocoder.yudao.module.reward.convert.reward.RewardConvert;
import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO;
import cn.iocoder.yudao.module.reward.dal.mysql.reward.RewardMapper;
import cn.iocoder.yudao.module.reward.enums.QuantitativeRelationSymbolEnum;
import cn.iocoder.yudao.module.reward.enums.RewardPickMethedEnum;
import cn.iocoder.yudao.module.reward.enums.RewardStatusEnum;
import cn.iocoder.yudao.module.reward.vo.reward.*;
import org.apache.commons.lang3.ObjectUtils;
......@@ -78,7 +80,12 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
}
private void verifyCreateVO(RewardCreateReqVO createReqVO) {
//活动开始时间不能比活动结束时间晚,活动结束时间不能比当前时间早
// 校验领取方式
List<String> pickMethodList = Arrays.asList(createReqVO.getPickMethod().split(","));
if (!pickMethodList.contains(String.valueOf(RewardPickMethedEnum.SELF_PICKUP.getValue())) && !pickMethodList.contains(String.valueOf(RewardPickMethedEnum.SEND_HOME_FREE.getValue())) && !pickMethodList.contains(String.valueOf(RewardPickMethedEnum.SEND_HOME_PAY.getValue()))) {
throw exception(REWARD_PICK_METHOD_NOT_ALLOW);
}
// 活动开始时间不能比活动结束时间晚,活动结束时间不能比当前时间早
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);
......@@ -117,6 +124,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
RewardDO updateObj = new RewardDO();
//未启用可编辑所有内容
if (rewardDO.getStatus() == RewardStatusEnum.DISABLED.getValue()) {
// 校验领取方式
List<String> pickMethodList = Arrays.asList(updateReqVO.getPickMethod().split(","));
if (StringUtils.isNotBlank(updateReqVO.getPickMethod()) && !pickMethodList.contains(String.valueOf(RewardPickMethedEnum.SELF_PICKUP.getValue())) && !pickMethodList.contains(String.valueOf(RewardPickMethedEnum.SEND_HOME_FREE.getValue())) && !pickMethodList.contains(String.valueOf(RewardPickMethedEnum.SEND_HOME_PAY.getValue()))) {
throw exception(REWARD_PICK_METHOD_NOT_ALLOW);
}
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);
......@@ -125,11 +137,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
} else {
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW);
}
List<RewardCreateReqVO.NodeAndPoints> nodeIds = updateReqVO.getNodeIds();
List<RewardUpdateReqVO.NodeAndPoints> nodeIds = updateReqVO.getNodeIds();
if (CollectionUtil.isEmpty(nodeIds)) {
throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR);
}
RewardCreateReqVO.NodeAndPoints nodeAndPoints = nodeIds.get(0);
RewardUpdateReqVO.NodeAndPoints nodeAndPoints = nodeIds.get(0);
updateObj = RewardConvert.INSTANCE.convert(updateReqVO);
updateObj.setPointsRequire(nodeAndPoints.getPoints());
updateObj.setNodeId(nodeAndPoints.getNodeId());
......@@ -360,11 +372,15 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
}
private void setPickMethod(AppRewardBackVO appRewardBackVO) {
for (String pickMethod : appRewardBackVO.getPickMethod().split(",")) {
String[] splitPickMethod = appRewardBackVO.getPickMethod().split(",");
for (String pickMethod : splitPickMethod) {
AppRewardBackVO.PickMethod pickMethodDict = new AppRewardBackVO.PickMethod();
pickMethodDict.setValue(pickMethod);
pickMethodDict.setLabelZh(DictFrameworkUtils.getDictDataFromCache("way_of_receiving", pickMethod).getLabel());
pickMethodDict.setLabelEn(DictFrameworkUtils.getDictDataFromCache("way_of_receiving", pickMethod).getLabelEn());
DictDataRespDTO wayOfReceiving = DictFrameworkUtils.getDictDataFromCache("way_of_receiving", pickMethod);
if (wayOfReceiving != null) {
pickMethodDict.setLabelZh(wayOfReceiving.getLabel());
pickMethodDict.setLabelEn(wayOfReceiving.getLabelEn());
}
appRewardBackVO.getPickMethodList().add(pickMethodDict);
}
}
......
......@@ -52,7 +52,7 @@ public class RewardUpdateReqVO {
@ApiModelProperty(value = "兑换网点和积分列表", required = true)
@NotNull(message = "兑换网点列表不能为空")
private List<RewardCreateReqVO.NodeAndPoints> nodeIds;
private List<RewardUpdateReqVO.NodeAndPoints> nodeIds;
@ApiModelProperty(value = "剩余数量")
@Min(value = 0)
......
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