From da91b6f4b6b33b7827caf4d2a37361dc8a19c1b2 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Sat, 25 Mar 2023 20:05:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=97=B6=20=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AF=20=E5=8F=AA=E8=AE=BE=E7=BD=AE=20Day?= =?UTF-8?q?Num-=E5=87=A0=E5=A4=A9=E5=90=8E=E8=BF=87=E6=9C=9F=20=E4=B8=8D?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=20VipTimeRangeJson=20VIP=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/service/impl/SysUserServiceImpl.java | 22 +++++-------------- .../com/xkrs/utilsnew/VipTimeRangeUtils.java | 5 ++--- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java index 27fd6db..673e8db 100644 --- a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java @@ -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); diff --git a/src/main/java/com/xkrs/utilsnew/VipTimeRangeUtils.java b/src/main/java/com/xkrs/utilsnew/VipTimeRangeUtils.java index e5b45c3..9904f2a 100644 --- a/src/main/java/com/xkrs/utilsnew/VipTimeRangeUtils.java +++ b/src/main/java/com/xkrs/utilsnew/VipTimeRangeUtils.java @@ -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时间范围反序列化失败");