注册时 用户信息
只设置 DayNum-几天后过期 不设置 VipTimeRangeJson VIP时间范围
This commit is contained in:
parent
772b88f576
commit
da91b6f4b6
@ -145,16 +145,11 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
sysUserEntity.setAccountType("县级");
|
||||
}
|
||||
if (9 == countyCode.length()) {//街道账号7天后过期
|
||||
//生成新的VIP时间范围Json内容
|
||||
String newVipTimeRangeJson = VipTimeRangeUtils.obtainNewVipTimeRangeJson(null, LocalDateTime.now().plusDays(7L));
|
||||
//更新字段
|
||||
sysUserEntity.setVipTimeRangeJson(newVipTimeRangeJson);
|
||||
sysUserEntity.setDayNum(7L);
|
||||
} else {//省市区县账号5天后过期
|
||||
//生成新的VIP时间范围Json内容
|
||||
String newVipTimeRangeJson = VipTimeRangeUtils.obtainNewVipTimeRangeJson(null, LocalDateTime.now().plusDays(5L));
|
||||
//更新字段
|
||||
sysUserEntity.setVipTimeRangeJson(newVipTimeRangeJson);
|
||||
sysUserEntity.setDayNum(5L);
|
||||
}
|
||||
sysUserEntity.setVipTimeRangeJson("");
|
||||
sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
|
||||
sysUserEntity.setLoginNum(0);
|
||||
sysUserEntity.setCountyCode(countyCode);
|
||||
@ -252,16 +247,11 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
sysUserEntity.setAccountType("县级");
|
||||
}
|
||||
if (9 == countyCode.length()) {//街道账号7天后过期
|
||||
//生成新的VIP时间范围Json内容
|
||||
String newVipTimeRangeJson = VipTimeRangeUtils.obtainNewVipTimeRangeJson(null, LocalDateTime.now().plusDays(7L));
|
||||
//更新字段
|
||||
sysUserEntity.setVipTimeRangeJson(newVipTimeRangeJson);
|
||||
sysUserEntity.setDayNum(7L);
|
||||
} else {//省市区县账号5天后过期
|
||||
//生成新的VIP时间范围Json内容
|
||||
String newVipTimeRangeJson = VipTimeRangeUtils.obtainNewVipTimeRangeJson(null, LocalDateTime.now().plusDays(5L));
|
||||
//更新字段
|
||||
sysUserEntity.setVipTimeRangeJson(newVipTimeRangeJson);
|
||||
sysUserEntity.setDayNum(5L);
|
||||
}
|
||||
sysUserEntity.setVipTimeRangeJson("");
|
||||
sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
|
||||
sysUserEntity.setLoginNum(0);
|
||||
sysUserEntity.setCountyCode(countyCode);
|
||||
|
@ -139,12 +139,11 @@ public class VipTimeRangeUtils {
|
||||
return lastVipTimeRangeItemBean.getEndTime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成一个新的 VipTimeRangeJson
|
||||
*/
|
||||
public static String obtainNewVipTimeRangeJson(String oldVipTimeRangeJson, LocalDateTime newLocalDateTime) {
|
||||
//没有默认VIP时间范围的情况,是新注册用户
|
||||
//没有默认VIP时间范围的情况,是新VIP用户
|
||||
if (TextUtils.isEmpty(oldVipTimeRangeJson)) {
|
||||
LocalDateTime startLocalDateTime = LocalDateTime.now();
|
||||
if (startLocalDateTime.isBefore(newLocalDateTime)) {
|
||||
@ -160,7 +159,7 @@ public class VipTimeRangeUtils {
|
||||
throw new RuntimeException("初始化的过期时间必须晚于当前时间");
|
||||
}
|
||||
}
|
||||
//oldVipTimeRangeJson不为空说明不是新注册用户,解析该用户的VIP时间范围
|
||||
//oldVipTimeRangeJson不为空,解析该用户的VIP时间范围
|
||||
VipTimeRangeBean vipTimeRangeBean = JsonUtils.deserialize(oldVipTimeRangeJson, VipTimeRangeBean.class);
|
||||
if (vipTimeRangeBean == null || vipTimeRangeBean.getList() == null || vipTimeRangeBean.getList().size() == 0) {
|
||||
throw new RuntimeException("已保存的VIP时间范围反序列化失败");
|
||||
|
Loading…
Reference in New Issue
Block a user