From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/GiveVIPApplyInfoServiceImpl.java | 402 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 201 insertions(+), 201 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/GiveVIPApplyInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/GiveVIPApplyInfoServiceImpl.java index 7af15b1..2e0cb59 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/GiveVIPApplyInfoServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/GiveVIPApplyInfoServiceImpl.java @@ -1,201 +1,201 @@ -package com.yeshi.fanli.service.impl.user.vip; - -import java.util.Date; -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.yeshi.fanli.dao.user.vip.GiveVIPApplyInfoDao; -import com.yeshi.fanli.entity.bus.user.UserInfoRegister; -import com.yeshi.fanli.entity.bus.user.vip.GiveVIPApplyInfo; -import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; -import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo; -import com.yeshi.fanli.exception.ParamsException; -import com.yeshi.fanli.exception.user.vip.GiveVIPApplyInfoException; -import com.yeshi.fanli.exception.user.vip.UserVIPPreInfoException; -import com.yeshi.fanli.service.inter.user.UserInfoRegisterService; -import com.yeshi.fanli.service.inter.user.msg.UserAccountMsgNotificationService; -import com.yeshi.fanli.service.inter.user.vip.GiveVIPApplyInfoService; -import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService; -import com.yeshi.fanli.util.StringUtil; -import org.yeshi.utils.TimeUtil; -import com.yeshi.fanli.util.user.UserLevelUtil; - -@Service -public class GiveVIPApplyInfoServiceImpl implements GiveVIPApplyInfoService { - - @Resource - private GiveVIPApplyInfoDao giveVIPApplyInfoDao; - - @Resource - private UserVIPPreInfoService userVIPPreInfoService; - - @Resource - private UserInfoRegisterService userInfoRegisterService; - - @Resource - private UserAccountMsgNotificationService userAccountMsgNotificationService; - - @Async - @Override - public void saveImgs(String id, List<String> imgList) { - giveVIPApplyInfoDao.saveImgs(id, imgList); - } - - @Override - public void updateGiveVIPApplyInfo(GiveVIPApplyInfo info) { - giveVIPApplyInfoDao.updateSelective(info); - } - - @Override - public GiveVIPApplyInfo addGiveVIPApplyInfo(GiveVIPApplyInfo info) - throws ParamsException, GiveVIPApplyInfoException { - - if (info.getTargetUid() == null || info.getSourceUid() == null || info.getLevel() == null) - throw new ParamsException(1, "鍙傛暟涓嶅畬鏁�"); - - info.setId(StringUtil - .Md5(String.format("%s#%s#%s", info.getTargetUid(), info.getSourceUid(), info.getLevel().name()))); - - if (info.getCreateTime() == null) - info.setCreateTime(new Date()); - if (info.getState() == null) - info.setState(GiveVIPApplyInfo.STATE_NO_INFO); - - GiveVIPApplyInfo oldInfo = giveVIPApplyInfoDao.get(info.getId()); - - if (oldInfo != null) { - throw new GiveVIPApplyInfoException(2, "宸茬粡鎻愪氦杩囩敵璇�"); - } - giveVIPApplyInfoDao.save(info); - return info; - } - - @Override - public List<GiveVIPApplyInfo> listByTargetUid(Long uid, int page, int pageSize) { - return giveVIPApplyInfoDao.listByTargetUid(uid, null, (page - 1) * pageSize, pageSize); - } - - @Override - public long countByTargetUid(Long uid) { - return giveVIPApplyInfoDao.countByTargetUid(uid, null); - } - - @Override - public List<GiveVIPApplyInfo> listByStateAndTargetUid(Long targetUid, Integer state, int page, int pageSize) { - return giveVIPApplyInfoDao.listByTargetUid(targetUid, state, (page - 1) * pageSize, pageSize); - } - - @Override - public long countByStateAndTargetUid(Long targetUid, Integer state) { - return giveVIPApplyInfoDao.countByTargetUid(targetUid, state); - } - - @Override - public GiveVIPApplyInfo selectByPrimaryKey(String id) { - return giveVIPApplyInfoDao.get(id); - } - - @Transactional - @Override - public void pass(String id, Long adminId) throws GiveVIPApplyInfoException, UserVIPPreInfoException { - GiveVIPApplyInfo info = selectByPrimaryKey(id); - if (info == null) - throw new GiveVIPApplyInfoException(1, "璁板綍涓嶅瓨鍦�"); - - // if (info.getState() == GiveVIPApplyInfo.STATE_NO_INFO) - // throw new GiveVIPApplyInfoException(2, "鐢ㄦ埛鏈彁浜よ祫鏂�"); - - if (info.getState() == GiveVIPApplyInfo.STATE_REJECT) - throw new GiveVIPApplyInfoException(3, "宸茬粡琚嫆缁�"); - - if (info.getState() == GiveVIPApplyInfo.STATE_SUCCESS) - throw new GiveVIPApplyInfoException(4, "宸茬粡琚�氳繃"); - - Long uid = info.getTargetUid(); - // 鏌ヨ褰撳墠鐨勬潯浠� - UserVIPPreInfo preInfo = userVIPPreInfoService.getLatestProcessInfo(uid); - if (preInfo == null || preInfo.getProcess() < info.getLevel().getLevel()) { - // 浼氬憳鍗囩骇 - UserVIPPreInfo newInfo = new UserVIPPreInfo(); - newInfo.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ARTIFICIAL); - newInfo.setProcess(info.getLevel().getLevel()); - newInfo.setUid(uid); - userVIPPreInfoService.addUserVIPPreInfo(newInfo); - // 鍙戦�佹秷鎭� - - // 璁$畻鐩搁殧澶╂暟 - // 榛樿鍊� - Date lastUpgradeTime = new Date(1577836800000L); - if (preInfo != null) - lastUpgradeTime = preInfo.getCreateTime(); - else { - UserInfoRegister userInfoRegister = userInfoRegisterService.selectByPrimaryKey(uid); - if (userInfoRegister != null && userInfoRegister.getCreateTime() != null) { - lastUpgradeTime = userInfoRegister.getCreateTime(); - } - } - - int days = TimeUtil.getDayDifferenceCount(lastUpgradeTime, new Date()); - - userAccountMsgNotificationService.artificialVipUpgradePass(uid, - preInfo == null ? UserLevelEnum.daRen.getName() - : UserLevelUtil.getByLevel(preInfo.getProcess()).getName(), - info.getLevel().getName(), days); - } - - GiveVIPApplyInfo update = new GiveVIPApplyInfo(); - update.setId(info.getId()); - update.setState(GiveVIPApplyInfo.STATE_SUCCESS); - update.setVerifyTime(new Date()); - update.setAdminUserId(adminId); - giveVIPApplyInfoDao.updateSelective(update); - } - - @Transactional - @Override - public void reject(String id, Long adminId, String reason) throws GiveVIPApplyInfoException { - GiveVIPApplyInfo info = selectByPrimaryKey(id); - if (info == null) - throw new GiveVIPApplyInfoException(1, "璁板綍涓嶅瓨鍦�"); - - if (info.getState() == GiveVIPApplyInfo.STATE_REJECT) - throw new GiveVIPApplyInfoException(3, "宸茬粡琚嫆缁�"); - - if (info.getState() == GiveVIPApplyInfo.STATE_SUCCESS) - throw new GiveVIPApplyInfoException(4, "宸茬粡琚�氳繃"); - - GiveVIPApplyInfo update = new GiveVIPApplyInfo(); - update.setId(info.getId()); - update.setState(GiveVIPApplyInfo.STATE_REJECT); - update.setVerifyTime(new Date()); - update.setRejectReson(reason); - update.setAdminUserId(adminId); - giveVIPApplyInfoDao.updateSelective(update); - - Long uid = info.getTargetUid(); - UserVIPPreInfo preInfo = userVIPPreInfoService.getLatestProcessInfo(uid); - - // 鎷掔粷鐩稿叧娑堟伅 - userAccountMsgNotificationService - .artificialVipUpgradeReject(uid, - preInfo == null ? UserLevelEnum.daRen.getName() - :UserLevelUtil.getShowLevel(UserLevelUtil.getByLevel(preInfo.getProcess())).getName(), - info.getLevel().getName(), reason); - } - - @Override - public List<GiveVIPApplyInfo> listBySourceUid(Long uid, int page, int pageSize) { - return giveVIPApplyInfoDao.listBySourceUid(uid, null, (page - 1) * pageSize, pageSize); - } - - @Override - public long countBySourceUid(Long uid) { - return giveVIPApplyInfoDao.countBySourceUid(uid, null); - } - -} +package com.yeshi.fanli.service.impl.user.vip; + +import java.util.Date; +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.yeshi.fanli.dao.user.vip.GiveVIPApplyInfoDao; +import com.yeshi.fanli.entity.bus.user.UserInfoRegister; +import com.yeshi.fanli.entity.bus.user.vip.GiveVIPApplyInfo; +import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; +import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo; +import com.yeshi.fanli.exception.ParamsException; +import com.yeshi.fanli.exception.user.vip.GiveVIPApplyInfoException; +import com.yeshi.fanli.exception.user.vip.UserVIPPreInfoException; +import com.yeshi.fanli.service.inter.user.UserInfoRegisterService; +import com.yeshi.fanli.service.inter.user.msg.UserAccountMsgNotificationService; +import com.yeshi.fanli.service.inter.user.vip.GiveVIPApplyInfoService; +import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService; +import com.yeshi.fanli.util.StringUtil; +import org.yeshi.utils.TimeUtil; +import com.yeshi.fanli.util.user.UserLevelUtil; + +@Service +public class GiveVIPApplyInfoServiceImpl implements GiveVIPApplyInfoService { + + @Resource + private GiveVIPApplyInfoDao giveVIPApplyInfoDao; + + @Resource + private UserVIPPreInfoService userVIPPreInfoService; + + @Resource + private UserInfoRegisterService userInfoRegisterService; + + @Resource + private UserAccountMsgNotificationService userAccountMsgNotificationService; + + @Async + @Override + public void saveImgs(String id, List<String> imgList) { + giveVIPApplyInfoDao.saveImgs(id, imgList); + } + + @Override + public void updateGiveVIPApplyInfo(GiveVIPApplyInfo info) { + giveVIPApplyInfoDao.updateSelective(info); + } + + @Override + public GiveVIPApplyInfo addGiveVIPApplyInfo(GiveVIPApplyInfo info) + throws ParamsException, GiveVIPApplyInfoException { + + if (info.getTargetUid() == null || info.getSourceUid() == null || info.getLevel() == null) + throw new ParamsException(1, "鍙傛暟涓嶅畬鏁�"); + + info.setId(StringUtil + .Md5(String.format("%s#%s#%s", info.getTargetUid(), info.getSourceUid(), info.getLevel().name()))); + + if (info.getCreateTime() == null) + info.setCreateTime(new Date()); + if (info.getState() == null) + info.setState(GiveVIPApplyInfo.STATE_NO_INFO); + + GiveVIPApplyInfo oldInfo = giveVIPApplyInfoDao.get(info.getId()); + + if (oldInfo != null) { + throw new GiveVIPApplyInfoException(2, "宸茬粡鎻愪氦杩囩敵璇�"); + } + giveVIPApplyInfoDao.save(info); + return info; + } + + @Override + public List<GiveVIPApplyInfo> listByTargetUid(Long uid, int page, int pageSize) { + return giveVIPApplyInfoDao.listByTargetUid(uid, null, (page - 1) * pageSize, pageSize); + } + + @Override + public long countByTargetUid(Long uid) { + return giveVIPApplyInfoDao.countByTargetUid(uid, null); + } + + @Override + public List<GiveVIPApplyInfo> listByStateAndTargetUid(Long targetUid, Integer state, int page, int pageSize) { + return giveVIPApplyInfoDao.listByTargetUid(targetUid, state, (page - 1) * pageSize, pageSize); + } + + @Override + public long countByStateAndTargetUid(Long targetUid, Integer state) { + return giveVIPApplyInfoDao.countByTargetUid(targetUid, state); + } + + @Override + public GiveVIPApplyInfo selectByPrimaryKey(String id) { + return giveVIPApplyInfoDao.get(id); + } + + @Transactional + @Override + public void pass(String id, Long adminId) throws GiveVIPApplyInfoException, UserVIPPreInfoException { + GiveVIPApplyInfo info = selectByPrimaryKey(id); + if (info == null) + throw new GiveVIPApplyInfoException(1, "璁板綍涓嶅瓨鍦�"); + + // if (info.getState() == GiveVIPApplyInfo.STATE_NO_INFO) + // throw new GiveVIPApplyInfoException(2, "鐢ㄦ埛鏈彁浜よ祫鏂�"); + + if (info.getState() == GiveVIPApplyInfo.STATE_REJECT) + throw new GiveVIPApplyInfoException(3, "宸茬粡琚嫆缁�"); + + if (info.getState() == GiveVIPApplyInfo.STATE_SUCCESS) + throw new GiveVIPApplyInfoException(4, "宸茬粡琚�氳繃"); + + Long uid = info.getTargetUid(); + // 鏌ヨ褰撳墠鐨勬潯浠� + UserVIPPreInfo preInfo = userVIPPreInfoService.getLatestProcessInfo(uid); + if (preInfo == null || preInfo.getProcess() < info.getLevel().getLevel()) { + // 浼氬憳鍗囩骇 + UserVIPPreInfo newInfo = new UserVIPPreInfo(); + newInfo.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ARTIFICIAL); + newInfo.setProcess(info.getLevel().getLevel()); + newInfo.setUid(uid); + userVIPPreInfoService.addUserVIPPreInfo(newInfo); + // 鍙戦�佹秷鎭� + + // 璁$畻鐩搁殧澶╂暟 + // 榛樿鍊� + Date lastUpgradeTime = new Date(1577836800000L); + if (preInfo != null) + lastUpgradeTime = preInfo.getCreateTime(); + else { + UserInfoRegister userInfoRegister = userInfoRegisterService.selectByPrimaryKey(uid); + if (userInfoRegister != null && userInfoRegister.getCreateTime() != null) { + lastUpgradeTime = userInfoRegister.getCreateTime(); + } + } + + int days = TimeUtil.getDayDifferenceCount(lastUpgradeTime, new Date()); + + userAccountMsgNotificationService.artificialVipUpgradePass(uid, + preInfo == null ? UserLevelEnum.daRen.getName() + : UserLevelUtil.getByLevel(preInfo.getProcess()).getName(), + info.getLevel().getName(), days); + } + + GiveVIPApplyInfo update = new GiveVIPApplyInfo(); + update.setId(info.getId()); + update.setState(GiveVIPApplyInfo.STATE_SUCCESS); + update.setVerifyTime(new Date()); + update.setAdminUserId(adminId); + giveVIPApplyInfoDao.updateSelective(update); + } + + @Transactional + @Override + public void reject(String id, Long adminId, String reason) throws GiveVIPApplyInfoException { + GiveVIPApplyInfo info = selectByPrimaryKey(id); + if (info == null) + throw new GiveVIPApplyInfoException(1, "璁板綍涓嶅瓨鍦�"); + + if (info.getState() == GiveVIPApplyInfo.STATE_REJECT) + throw new GiveVIPApplyInfoException(3, "宸茬粡琚嫆缁�"); + + if (info.getState() == GiveVIPApplyInfo.STATE_SUCCESS) + throw new GiveVIPApplyInfoException(4, "宸茬粡琚�氳繃"); + + GiveVIPApplyInfo update = new GiveVIPApplyInfo(); + update.setId(info.getId()); + update.setState(GiveVIPApplyInfo.STATE_REJECT); + update.setVerifyTime(new Date()); + update.setRejectReson(reason); + update.setAdminUserId(adminId); + giveVIPApplyInfoDao.updateSelective(update); + + Long uid = info.getTargetUid(); + UserVIPPreInfo preInfo = userVIPPreInfoService.getLatestProcessInfo(uid); + + // 鎷掔粷鐩稿叧娑堟伅 + userAccountMsgNotificationService + .artificialVipUpgradeReject(uid, + preInfo == null ? UserLevelEnum.daRen.getName() + :UserLevelUtil.getShowLevel(UserLevelUtil.getByLevel(preInfo.getProcess())).getName(), + info.getLevel().getName(), reason); + } + + @Override + public List<GiveVIPApplyInfo> listBySourceUid(Long uid, int page, int pageSize) { + return giveVIPApplyInfoDao.listBySourceUid(uid, null, (page - 1) * pageSize, pageSize); + } + + @Override + public long countBySourceUid(Long uid) { + return giveVIPApplyInfoDao.countBySourceUid(uid, null); + } + +} -- Gitblit v1.8.0