From 81da61b828e29b7745e1382dfbbaeb685dc083ef Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 23 一月 2024 17:17:55 +0800 Subject: [PATCH] 抖音转链修改 --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserLevelUpgradedNotifyServiceImpl.java | 189 ++++++++++++++++++++++++---------------------- 1 files changed, 98 insertions(+), 91 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserLevelUpgradedNotifyServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserLevelUpgradedNotifyServiceImpl.java index 2580f16..6d49919 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserLevelUpgradedNotifyServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/UserLevelUpgradedNotifyServiceImpl.java @@ -1,91 +1,98 @@ -package com.yeshi.fanli.service.impl.user.vip; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Service; - -import com.yeshi.fanli.dao.user.vip.UserLevelUpgradedNotifyDao; -import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; -import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify; -import com.yeshi.fanli.service.inter.user.vip.UserLevelUpgradedNotifyService; - -@Service -public class UserLevelUpgradedNotifyServiceImpl implements UserLevelUpgradedNotifyService { - - @Resource - private UserLevelUpgradedNotifyDao userLevelUpgradedNotifyDao; - - @Override - public void addUserLevelUpgradedNotify(UserLevelUpgradedNotify notify) { - if (notify == null || notify.getUid() == null || notify.getToLevel() == null || notify.getFromLevel() == null) { - return; - } - - // 鏌ヨ鏄惁鏈夊綋鍓嶆彁閱� - List<UserLevelEnum> levels = new ArrayList<>(); - levels.add(notify.getToLevel()); - List<UserLevelUpgradedNotify> list = userLevelUpgradedNotifyDao.listToLevelsByUid(notify.getUid(), levels); - if (list != null) - for (int i = 0; i < list.size(); i++) { - if (list.get(i).getValid() == false) - list.remove(i--); - } - - if (list != null && list.size() > 0) - return; - - if (notify.getNotified() == null) - notify.setNotified(false); - - if (notify.getValid() == null) - notify.setValid(true); - - if (notify.getCreateTime() == null) - notify.setCreateTime(new Date()); - - if (notify.getId() == null) - notify.setId(UUID.randomUUID().toString()); - - userLevelUpgradedNotifyDao.save(notify); - } - - @Override - public void setNotified(String id) { - UserLevelUpgradedNotify notify = userLevelUpgradedNotifyDao.get(id); - if (notify == null) - return; - // 鏌ヨ浣庣瓑绾х殑鏄惁宸茶,濡傝嫢鏈鍒欒涓哄凡璇� - if (notify.getToLevel() == UserLevelEnum.highVIP || notify.getToLevel() == UserLevelEnum.superVIP) { - List<UserLevelEnum> levels = new ArrayList<>(); - if (notify.getToLevel() == UserLevelEnum.superVIP) { - levels.add(UserLevelEnum.highVIP); - } - - List<UserLevelUpgradedNotify> list = userLevelUpgradedNotifyDao.listToLevelsByUid(notify.getUid(), levels); - if (list != null) - for (UserLevelUpgradedNotify item : list) { - item.setValid(false); - item.setUpdateTime(new Date()); - userLevelUpgradedNotifyDao.save(item); - } - } - notify.setUpdateTime(new Date()); - notify.setNotified(true); - notify.setReadTime(new Date()); - userLevelUpgradedNotifyDao.save(notify); - } - - @Override - public UserLevelUpgradedNotify getNeedNotifyByUid(Long uid) { - List<UserLevelUpgradedNotify> uidList = userLevelUpgradedNotifyDao.listNotNotifiedByUid(uid); - if (uidList != null && uidList.size() > 0) - return uidList.get(0); - return null; - } - -} +package com.yeshi.fanli.service.impl.user.vip; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import com.yeshi.fanli.dao.user.vip.UserLevelUpgradedNotifyDao; +import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; +import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify; +import com.yeshi.fanli.service.inter.user.vip.UserLevelUpgradedNotifyService; + +@Service +public class UserLevelUpgradedNotifyServiceImpl implements UserLevelUpgradedNotifyService { + + @Resource + private UserLevelUpgradedNotifyDao userLevelUpgradedNotifyDao; + + @Override + public void addUserLevelUpgradedNotify(UserLevelUpgradedNotify notify) { + if (notify == null || notify.getUid() == null || notify.getToLevel() == null || notify.getFromLevel() == null) { + return; + } + + // 鏌ヨ鏄惁鏈夊綋鍓嶆彁閱� + List<UserLevelEnum> levels = new ArrayList<>(); + levels.add(notify.getToLevel()); + List<UserLevelUpgradedNotify> list = userLevelUpgradedNotifyDao.listToLevelsByUid(notify.getUid(), levels); + if (list != null) + for (int i = 0; i < list.size(); i++) { + if (list.get(i).getValid() == false) + list.remove(i--); + } + + if (list != null && list.size() > 0) + return; + + if (notify.getNotified() == null) + notify.setNotified(false); + + if (notify.getValid() == null) + notify.setValid(true); + + if (notify.getCreateTime() == null) + notify.setCreateTime(new Date()); + + if (notify.getId() == null) + notify.setId(UUID.randomUUID().toString()); + + userLevelUpgradedNotifyDao.save(notify); + } + + @Override + public void setNotified(String id) { + UserLevelUpgradedNotify notify = userLevelUpgradedNotifyDao.get(id); + if (notify == null) + return; + // 鏌ヨ浣庣瓑绾х殑鏄惁宸茶,濡傝嫢鏈鍒欒涓哄凡璇� + if (notify.getToLevel() == UserLevelEnum.superVIP || notify.getToLevel() == UserLevelEnum.tearcher) { + List<UserLevelEnum> levels = new ArrayList<>(); + if (notify.getToLevel() == UserLevelEnum.tearcher) { + levels.add(UserLevelEnum.highVIP); + levels.add(UserLevelEnum.superVIP); + } else if (notify.getToLevel() == UserLevelEnum.superVIP) { + levels.add(UserLevelEnum.highVIP); + } + + if (levels.size() > 0) { + + List<UserLevelUpgradedNotify> list = userLevelUpgradedNotifyDao.listToLevelsByUid(notify.getUid(), + levels); + if (list != null) + for (UserLevelUpgradedNotify item : list) { + item.setValid(false); + item.setUpdateTime(new Date()); + userLevelUpgradedNotifyDao.save(item); + } + } + } + notify.setUpdateTime(new Date()); + notify.setNotified(true); + notify.setReadTime(new Date()); + userLevelUpgradedNotifyDao.save(notify); + } + + @Override + public UserLevelUpgradedNotify getNeedNotifyByUid(Long uid) { + List<UserLevelUpgradedNotify> uidList = userLevelUpgradedNotifyDao.listNotNotifiedByUid(uid); + if (uidList != null && uidList.size() > 0) + return uidList.get(0); + return null; + } + +} -- Gitblit v1.8.0