记得上下班打卡 | git大法好,push需谨慎

Commit 5d320b1e authored by 张国柄's avatar 张国柄

会员标记:新老会员;

parent 6de56f71
......@@ -33,6 +33,9 @@ public class AdamMemberOrderParam implements Serializable {
@Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "生日格式有误")
@NotBlank(message = "生日不能为空")
private String birthday;
@ApiModelProperty(position = 16, required = true, value = "常住地/区域[100]", example = "北京 北京市 朝阳区")
@NotBlank(message = "常住地不能为空")
private String area;
@ApiModelProperty(position = 16, required = true, value = "收获地址")
@Size(min = 1, max = 64, message = "收获地址长度限制1-64位字符")
@NotBlank(message = "收获地址不能为空")
......
......@@ -54,11 +54,11 @@ public class AdamMemberVo implements java.io.Serializable, Cloneable {
@ApiModelProperty(position = 16, value = "限购数量[0-不限购]", example = "0")
private Integer limitation;
@ApiModelProperty(position = 17, value = "限购开始时间", example = "2021-08-02 00:00:00")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime limitStart;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime limitbAt;
@ApiModelProperty(position = 18, value = "限购结束时间", example = "2021-09-02 00:00:00")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime limitEnd;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime limiteAt;
@ApiModelProperty(position = 20, value = "会员卡价格信息")
private List<AdamMemberPriceVo> priceVoList;
......@@ -66,15 +66,36 @@ public class AdamMemberVo implements java.io.Serializable, Cloneable {
private List<AdamMemberRightsVo> rightsVoList;
@ApiModelProperty(position = 22, value = "用户会员信息")
private AdamUserMemberVo userMemberVo;
@ApiModelProperty(position = 23, value = "购买会员限购[0-名额已满|1-允许购买]")
private Integer buySwitch;
@ApiModelProperty(position = 24, value = "标记[0-普通用户|1-会员|2-过期会员]")
@ApiModelProperty(position = 23, value = "购买会员限购[0-名额已满|1-允许购买|2-限购未开始]")
private Integer limitMarker;
@ApiModelProperty(position = 24, value = "标记[0-普通用户|2-过期会员|10-老会员|11-新会员]")
private Integer stageMarker;
public Integer getOnsale() {
return null == onsale ? 1 : onsale;
}
/**
* 购买会员限购[0-名额已满|1-允许购买|2-限购未开始]
*
* @param maxMemberLimitation 当前系统限购已购数量
* @return [0-名额已满|1-允许购买]
*/
public Integer calculateLimitMarker(int maxMemberLimitation) {
if (null != this.limitation && this.limitation > 0) {// 限购
if (maxMemberLimitation >= limitation) {// 名额已满
this.setLimitMarker(0);
} else {// 限购未开始
LocalDateTime now = LocalDateTime.now();
boolean isBetweenLimitTime = now.isAfter(this.limitbAt) && now.isBefore(this.limiteAt);
this.setLimitMarker(isBetweenLimitTime ? 1 : 2);
}
} else {// 不限购
this.setLimitMarker(1);
}
return this.limitMarker;
}
private static final AdamMemberVo obj = new AdamMemberVo();
public static AdamMemberVo getNew() {
......@@ -107,8 +128,8 @@ public class AdamMemberVo implements java.io.Serializable, Cloneable {
this.setIntegralRate(source.getIntegralRate());
this.setOnsale(source.getOnsale());
this.setLimitation(source.getLimitation());
this.setLimitStart(source.getLimitStart());
this.setLimitEnd(source.getLimitEnd());
this.setLimitbAt(source.getLimitbAt());
this.setLimiteAt(source.getLimiteAt());
return this;
}
}
......@@ -77,8 +77,8 @@ public class AdamMemberAdminController extends BaseController {
AdamMember::getAvatar,
AdamMember::getIcon,
AdamMember::getLimitation,
AdamMember::getLimitStart,
AdamMember::getLimitEnd,
AdamMember::getLimitbAt,
AdamMember::getLimiteAt,
AdamMember::getInterestsDetail,
AdamMember::getNotes,
AdamMember::getType,
......
......@@ -114,12 +114,12 @@ public class AdamMember implements Serializable {
/**
* 限购开始时间
*/
private LocalDateTime limitStart;
private LocalDateTime limitbAt;
/**
* 限购结束时间
*/
private LocalDateTime limitEnd;
private LocalDateTime limiteAt;
/**
* 是否开售:1-开售|2-停售
......
......@@ -345,8 +345,8 @@ alter table adam_member add integral_rate decimal(8, 2) default 0 null comment '
# 添加`是否开售`开关,新增开售开关字段
alter table adam_member add onsale tinyint default 0 null comment '是否开售:1-开售|2-停售' after integral_rate;
# 添加限购逻辑,新增限购开始、结束时间字段
alter table adam_member add limit_start datetime(3) null comment '限购开始时间' after limitation;
alter table adam_member add limit_end datetime(3) null comment '限购结束时间' after limit_start;
alter table adam_member add limitb_at datetime(3) null comment '限购开始时间' after limitation;
alter table adam_member add limite_at datetime(3) null comment '限购结束时间' after limit_start;
# 添加会员价格字段
......
......@@ -3,7 +3,6 @@ package com.liquidnet.service.adam.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.adam.constant.AdamRedisConst;
import com.liquidnet.service.adam.dto.vo.*;
import com.liquidnet.service.adam.service.AdamRdmService;
import com.liquidnet.service.adam.service.IAdamUserMemberService;
......@@ -20,7 +19,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotBlank;
import java.util.List;
@ApiSupport(order = 10030)
@Api(tags = "会员信息")
......@@ -42,13 +40,7 @@ public class AdamMemberController {
AdamMemberVo memberVo = null;
if (null != memberSimpleVo && null != (memberVo = adamRdmService.getMemberVoByMemberId(memberSimpleVo.getMemberId()))) {
// memberVo.setBuySwitch(adamRdmService.getSwitch(AdamRedisConst.SWITCH_BUY_MEMBER));
Integer limitation = memberVo.getLimitation();
if (null != limitation && limitation > 0) {// 限购
int maxMemberLimitation = adamRdmService.getMaxMemberLimitation();
memberVo.setBuySwitch(maxMemberLimitation >= limitation ? 0 : 1);
} else {// 不限购
memberVo.setBuySwitch(1);
}
memberVo.calculateLimitMarker(adamRdmService.getMaxMemberLimitation());
memberVo.setPriceVoList(adamRdmService.getMemberPriceVoByMemberId(memberVo.getMemberId()));
......@@ -62,7 +54,7 @@ public class AdamMemberController {
memberVo.setStageMarker(0);
memberVo.setRightsVoList(adamRdmService.getMemberRightsVoByMemberId(memberVo.getMemberId(), 0));
} else if (userMemberVo.isActive()) {
memberVo.setStageMarker(1);
memberVo.setStageMarker(userMemberVo.isOldMember() ? 10 : 11);
memberVo.setRightsVoList(
userMemberVo.isOldMember() ? adamRdmService.getMemberRightsVoByMemberId(memberVo.getMemberId(), 1)
......
......@@ -8,7 +8,6 @@ import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.ServletUtils;
import com.liquidnet.service.adam.constant.AdamRedisConst;
import com.liquidnet.service.adam.dto.AdamMemberOrderCallbackParam;
import com.liquidnet.service.adam.dto.AdamMemberOrderCodeParam;
import com.liquidnet.service.adam.dto.AdamMemberOrderParam;
......@@ -87,9 +86,21 @@ public class AdamMemberOrderController {
}
AdamUserMemberVo userMemberVo = adamRdmService.getUserMemberVoByUid(currentUid);
if (null == userMemberVo || !userMemberVo.isActive()) {
// 当前用户非会员或会员已过期时,购买会员时会受系统配置[开放/限制购买会员]限制
if (1 != adamRdmService.getSwitch(AdamRedisConst.SWITCH_BUY_MEMBER)) {
// if (null == userMemberVo || !userMemberVo.isActive()) {
// // 当前用户非会员或会员已过期时,购买会员时会受系统配置[开放/限制购买会员]限制
// if (1 != adamRdmService.getSwitch(AdamRedisConst.SWITCH_BUY_MEMBER)) {
// return ResponseDto.failure(ErrorMapping.get("10215"));
// }
// }
if (null == userMemberVo) {// 普通用户购买会员时会受系统配置[是否开售、限购]限制
AdamMemberVo memberVo = adamRdmService.getMemberVoByMemberId(param.getMemberId());
if (1 != memberVo.getOnsale()) {// 是否开售:1-开售|2-停售
return ResponseDto.failure(ErrorMapping.get("10216"));
}
if (0 == memberVo.calculateLimitMarker(adamRdmService.getMaxMemberLimitation())) {
// 购买会员限购[0-名额已满|1-允许购买|2-限购未开始]
return ResponseDto.failure(ErrorMapping.get("10215"));
}
}
......
......@@ -51,11 +51,10 @@
10210=创建订单失败,请联系客服
10211=订单不存在
10212=订单状态查询失败
10213=感谢您选择登登登。距您上一次离开不足一年,登登登还没准备好再次邀您加入。不如我们给彼此多一些时间,有缘再相见。
10213=暂时无法购买会员
10214=兑换失败
10215=本次摩登天空会员购买名额已满
10216=
10216=暂未开售
......
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