Commit 3ea7703e authored by zhangfeng's avatar zhangfeng

feat(reward): 更新礼品修改

parent 2c185f93
......@@ -135,6 +135,13 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
throw exception(REWARD_NOT_EXISTS);
}
RewardDO updateObj = new RewardDO();
// 此处为了兼容前端传值
List<RewardCreateReqVO.NodeAndPoints> nodeIds = updateReqVO.getNodeIds();
if (CollectionUtil.isEmpty(nodeIds)) {
throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR);
}
RewardCreateReqVO.NodeAndPoints nodeAndPoints = nodeIds.get(0);
//未启用可编辑所有内容
if (rewardDO.getStatus() == RewardStatusEnum.DISABLED.getValue()) {
// 校验领取方式
......@@ -150,19 +157,15 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
} else {
throw exception(REWARD_START_OR_END_TIME_NOT_ALLOW);
}
List<RewardUpdateReqVO.NodeAndPoints> nodeIds = updateReqVO.getNodeIds();
if (CollectionUtil.isEmpty(nodeIds)) {
throw exception(REWARD_NODE_AND_POINTS_LIST_ERROR);
}
RewardUpdateReqVO.NodeAndPoints nodeAndPoints = nodeIds.get(0);
updateObj = RewardConvert.INSTANCE.convert(updateReqVO);
updateObj.setPointsRequire(nodeAndPoints.getPoints());
updateObj.setNodeId(nodeAndPoints.getNodeId());
updateObj.setNodeId(nodeAndPoints.getWareHouses().get(0));
updateObj.setQuantityRemain(nodeAndPoints.getQuantityRemain());
//已启用可编辑剩余数量和备注
} else if (rewardDO.getStatus() == RewardStatusEnum.ENABLED.getValue()) {
updateObj.setId(updateReqVO.getId());
updateObj.setQuantityRemain(updateReqVO.getQuantityRemain());
updateObj.setQuantityRemain(nodeAndPoints.getQuantityRemain());
updateObj.setRemarkEn(updateReqVO.getRemarkEn());
updateObj.setRemarkFr(updateReqVO.getRemarkFr());
updateObj.setRemarkZh(updateReqVO.getRemarkZh());
......
......@@ -44,19 +44,9 @@ public class RewardUpdateReqVO {
@ApiModelProperty(value = "法文礼品图片")
private String imgFr;
//@ApiModelProperty(value = "兑换所需积分")
//@Min(value = 0)
//private Integer pointsRequire;
//@ApiModelProperty(value = "兑换网点")
//private Integer nodeId;
@ApiModelProperty(value = "兑换网点和积分列表", required = true)
@NotNull(message = "兑换网点列表不能为空")
private List<RewardUpdateReqVO.NodeAndPoints> nodeIds;
@ApiModelProperty(value = "剩余数量")
@Min(value = 0)
private Integer quantityRemain;
private List<RewardCreateReqVO.NodeAndPoints> nodeIds;
@ApiModelProperty(value = "活动开始时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
......@@ -84,12 +74,4 @@ public class RewardUpdateReqVO {
@ApiModelProperty(value = "法文备注")
@Size(max = 500, message = "法文备注长度不能超过500")
private String remarkFr;
@Data
public static class NodeAndPoints {
@ApiModelProperty(value = "兑换网点")
private Integer nodeId;
@ApiModelProperty(value = "兑换网点对应积分")
private Integer points;
}
}
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