火点重构-完善防火季订阅
This commit is contained in:
parent
b58d06d680
commit
2632d73c42
@ -109,6 +109,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
sysUserEntity.setActiveFlag(0);
|
||||
sysUserEntity.setAccountType("街道级");
|
||||
sysUserEntity.setDayNum(7L);
|
||||
} else if ("0000".equals(countyCode.substring(2))) {
|
||||
List<StreetEntity> proCodeList = streetDao.findByProCode(countyCode);
|
||||
if (proCodeList == null || proCodeList.size() == 0) {
|
||||
@ -120,6 +121,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
sysUserEntity.setActiveFlag(1);
|
||||
sysUserEntity.setAccountType("省级");
|
||||
sysUserEntity.setDayNum(5L);
|
||||
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||
List<StreetEntity> cityCodeList = streetDao.findByCityCode(countyCode);
|
||||
if (cityCodeList == null || cityCodeList.size() == 0) {
|
||||
@ -131,6 +133,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
sysUserEntity.setActiveFlag(1);
|
||||
sysUserEntity.setAccountType("市级");
|
||||
sysUserEntity.setDayNum(5L);
|
||||
} else {
|
||||
List<StreetEntity> countyCodeList = streetDao.findByCountyCode(countyCode);
|
||||
if (countyCodeList == null || countyCodeList.isEmpty()) {
|
||||
@ -142,11 +145,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
sysUserEntity.setActiveFlag(0);
|
||||
sysUserEntity.setAccountType("县级");
|
||||
}
|
||||
if (9 == countyCode.length()) {//街道账号7天后过期
|
||||
sysUserEntity.setDayNum(7L);
|
||||
} else {//省市区县账号5天后过期
|
||||
sysUserEntity.setDayNum(5L);
|
||||
}
|
||||
sysUserEntity.setVipTimeRangeJson("");
|
||||
sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
|
||||
@ -211,6 +210,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
sysUserEntity.setActiveFlag(0);
|
||||
sysUserEntity.setAccountType("街道级");
|
||||
sysUserEntity.setDayNum(7L);
|
||||
} else if ("0000".equals(countyCode.substring(2))) {
|
||||
List<StreetEntity> proCodeList = streetDao.findByProCode(countyCode);
|
||||
if (proCodeList == null || proCodeList.size() == 0) {
|
||||
@ -222,6 +222,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
sysUserEntity.setActiveFlag(1);
|
||||
sysUserEntity.setAccountType("省级");
|
||||
sysUserEntity.setDayNum(5L);
|
||||
} else if ("00".equals(countyCode.substring(4)) && !"0000".equals(countyCode.substring(2))) {
|
||||
List<StreetEntity> cityCodeList = streetDao.findByCityCode(countyCode);
|
||||
if (cityCodeList == null || cityCodeList.size() == 0) {
|
||||
@ -233,6 +234,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
sysUserEntity.setActiveFlag(1);
|
||||
sysUserEntity.setAccountType("市级");
|
||||
sysUserEntity.setDayNum(5L);
|
||||
} else {
|
||||
List<StreetEntity> countyCodeList = streetDao.findByCountyCode(countyCode);
|
||||
if (countyCodeList == null || countyCodeList.isEmpty()) {
|
||||
@ -244,11 +246,7 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
sysUserEntity.setActiveFlag(0);
|
||||
sysUserEntity.setAccountType("县级");
|
||||
}
|
||||
if (9 == countyCode.length()) {//街道账号7天后过期
|
||||
sysUserEntity.setDayNum(7L);
|
||||
} else {//省市区县账号5天后过期
|
||||
sysUserEntity.setDayNum(5L);
|
||||
}
|
||||
sysUserEntity.setVipTimeRangeJson("");
|
||||
sysUserEntity.setAddTime(dateTimeToString(LocalDateTime.now()));
|
||||
|
83
src/main/java/com/xkrs/utilsnew/TimeRangeUtils.java
Normal file
83
src/main/java/com/xkrs/utilsnew/TimeRangeUtils.java
Normal file
@ -0,0 +1,83 @@
|
||||
package com.xkrs.utilsnew;
|
||||
|
||||
import com.xkrs.model.bean.DataWrapper2;
|
||||
import com.xkrs.model.bean.VipTimeRangeBean;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TimeRangeUtils {
|
||||
|
||||
private TimeRangeUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查VIP是否有效
|
||||
*/
|
||||
public static boolean checkIfVipValid(String vipTimeRangeJson) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
List<DataWrapper2<LocalDateTime, LocalDateTime>> vipRangeList = getVipRangeList(vipTimeRangeJson);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查VIP是否过期(OK)
|
||||
*/
|
||||
public static boolean checkIfVipExpired(String vipTimeRangeJson) {
|
||||
return !checkIfVipValid(vipTimeRangeJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取VIP范围列表(OK)
|
||||
*/
|
||||
public static List<DataWrapper2<LocalDateTime, LocalDateTime>> getVipRangeList(String vipTimeRangeJson) {
|
||||
List<DataWrapper2<LocalDateTime, LocalDateTime>> vipRangeList = new ArrayList<>();//VIP范围结果列表
|
||||
List<VipTimeRangeBean.VipTimeRangeItemBean> list = new ArrayList<>();//Json解析的VIP范围列表
|
||||
try {
|
||||
VipTimeRangeBean vipTimeRangeBean = JsonUtils.deserialize(vipTimeRangeJson, VipTimeRangeBean.class);
|
||||
if (vipTimeRangeBean.getList() == null || vipTimeRangeBean.getList().size() == 0) {
|
||||
throw new RuntimeException("VipTimeRangeJson Error");
|
||||
}
|
||||
list.addAll(vipTimeRangeBean.getList());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
for (VipTimeRangeBean.VipTimeRangeItemBean item : list) {
|
||||
DateTimeUtils.checkDateTimeFormat(item.getStartTime());
|
||||
DateTimeUtils.checkDateTimeFormat(item.getEndTime());
|
||||
LocalDateTime start = DateTimeUtils.formatToLocalDateTime(item.getStartTime());
|
||||
LocalDateTime end = DateTimeUtils.formatToLocalDateTime(item.getEndTime());
|
||||
vipRangeList.add(new DataWrapper2<>(start, end));
|
||||
}
|
||||
return vipRangeList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查试用期是否有效
|
||||
*/
|
||||
public static boolean checkIfProbationValid(String addTime, Long dayNum) {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DataWrapper2<LocalDateTime, LocalDateTime> probationRange = getProbationRange(addTime, dayNum);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查试用期是否过期(OK)
|
||||
*/
|
||||
public static boolean checkIfProbationExpired(String addTime, Long dayNum) {
|
||||
return !checkIfProbationValid(addTime, dayNum);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取试用期范围(OK)
|
||||
*/
|
||||
public static DataWrapper2<LocalDateTime, LocalDateTime> getProbationRange(String addTime, Long dayNum) {
|
||||
DateTimeUtils.checkDateTimeFormat(addTime);
|
||||
LocalDateTime start = DateTimeUtils.formatToLocalDateTime(addTime);
|
||||
LocalDateTime end = start.plusDays(dayNum);
|
||||
return new DataWrapper2<>(start, end);
|
||||
}
|
||||
|
||||
}
|
@ -43,7 +43,7 @@ public class VipTimeRangeUtils {
|
||||
}
|
||||
|
||||
private static LocalDateTime obtainLastOverTime(String oldVipTimeRangeJson) {
|
||||
//oldVipTimeRangeJson不为空说明不是新注册用户,解析该用户的VIP时间范围
|
||||
//只有付费签约的用户VipTimeRangeJson字段才不为空,注册试用的用户由DayNum字段设置的天数决定试用时长
|
||||
if (TextUtils.isEmpty(oldVipTimeRangeJson)) {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user