diff --git a/hai-service/src/main/java/com/hai/service/HighUserService.java b/hai-service/src/main/java/com/hai/service/HighUserService.java index 42901a8c..c4a09552 100644 --- a/hai-service/src/main/java/com/hai/service/HighUserService.java +++ b/hai-service/src/main/java/com/hai/service/HighUserService.java @@ -166,7 +166,7 @@ public interface HighUserService { void editLevelUp(HighUserLevel highUserLevel); - HighUserLevel findUserLevel(Long userId); + HighUserLevel findUserLevel(Long userId) throws Exception; diff --git a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java index 9f150669..9233b2da 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java @@ -30,6 +30,8 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.text.DateFormat; +import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -435,7 +437,14 @@ public class HighUserServiceImpl implements HighUserService { } @Override - public HighUserLevel findUserLevel(Long userId) { + public HighUserLevel findUserLevel(Long userId) throws Exception { + + HighUser user = highUserMapper.selectByPrimaryKey(userId); + + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date targetTime = dateFormat.parse("2023-11-08 00:00:00"); + + HighUserLevelExample example = new HighUserLevelExample(); HighUserLevelExample.Criteria criteria = example.createCriteria(); @@ -447,6 +456,18 @@ public class HighUserServiceImpl implements HighUserService { return list.get(0); } + if (user != null && user.getRegTime().compareTo(targetTime) < 0) { + HighUserLevel highUserLevel = new HighUserLevel(); + highUserLevel.setCreateTime(new Date()); + highUserLevel.setUpdateTime(new Date()); + highUserLevel.setLevel("1"); + highUserLevel.setStatus(1); + highUserLevel.setUserId(userId); + insertLevelUp(highUserLevel); + return highUserLevel; + } + + return null; } }