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/manger/money/TeamEincomeManager.java | 332 ++++++++++++++++++++++++++++-------------------------- 1 files changed, 173 insertions(+), 159 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/manger/money/TeamEincomeManager.java b/fanli/src/main/java/com/yeshi/fanli/service/manger/money/TeamEincomeManager.java index fa2c2cd..bf496ba 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/manger/money/TeamEincomeManager.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/manger/money/TeamEincomeManager.java @@ -1,159 +1,173 @@ -package com.yeshi.fanli.service.manger.money; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -import com.yeshi.fanli.entity.money.TeamEincomeRecord; -import com.yeshi.fanli.entity.money.UserMoneyDetail; -import com.yeshi.fanli.exception.ParamsException; -import com.yeshi.fanli.exception.money.TeamEincomeRecordException; -import com.yeshi.fanli.exception.money.UserMoneyDetailException; -import com.yeshi.fanli.service.inter.money.TeamEincomeRecordService; -import com.yeshi.fanli.service.inter.money.UserMoneyService; -import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService; -import org.yeshi.utils.TimeUtil; -import com.yeshi.fanli.util.factory.UserMoneyDetailFactory; -import com.yeshi.fanli.util.factory.money.TeamEincomeRecordFactory; - -/** - * 鍥㈤槦鏀剁泭绠$悊 - * @author Administrator - * - */ -@Component -public class TeamEincomeManager { - - @Resource - private TeamEincomeRecordService teamEincomeRecordService; - - @Resource - private UserMoneyService userMoneyService; - - @Resource - private UserMoneyMsgNotificationService userMoneyMsgNotificationService; - - /** - * @throws ParamsException - * @throws TeamEincomeRecordException - * 娣诲姞鍥㈤槦濂栭噾 - * @Title: addTeamReward - * @Description: - * @param hongBaoList - * @param uid - * void 杩斿洖绫诲瀷 - * @throws - */ - @Transactional(rollbackFor = Exception.class) - public void addTeamReward(Long uid, Date preSendTime, BigDecimal money, int sourceType) - throws TeamEincomeRecordException, ParamsException { - String day = TimeUtil.getGernalTime(preSendTime.getTime(), "yyyy-MM-dd"); - TeamEincomeRecord record = TeamEincomeRecordFactory.createTeamReward(day, uid, money, sourceType, null); - teamEincomeRecordService.addTeamEincomeRecord(record); - } - - /** - * 娣诲姞鍥㈤槦琛ヨ创 - * @Title: addTeamSubsidy - * @Description: - * @param uid - * @param taskKey - * void 杩斿洖绫诲瀷 - * @throws - */ - @Transactional(rollbackFor = Exception.class) - public void addTeamSubsidy(Long uid, Date preSendTime, BigDecimal money, int sourceType) - throws TeamEincomeRecordException, ParamsException { - String day = TimeUtil.getGernalTime(preSendTime.getTime(), "yyyy-MM-dd"); - TeamEincomeRecord record = TeamEincomeRecordFactory.createTeamSubsidy(day, uid, money, sourceType, null); - teamEincomeRecordService.addTeamEincomeRecord(record); - } - - /** - * 娣诲姞鍥㈤槦鍒嗙孩 - * @Title: addTeamDividents - * @Description: - * @param uid - * @param preSendTime - * void 杩斿洖绫诲瀷 - * @throws - */ - @Transactional(rollbackFor = Exception.class) - public void addTeamDividents(Long uid, Date preSendTime, BigDecimal money,int type) - throws TeamEincomeRecordException, ParamsException { - String day = TimeUtil.getGernalTime(preSendTime.getTime(), "yyyy-MM-dd"); - TeamEincomeRecord record = TeamEincomeRecordFactory.createTeamDividents(day, uid, money,type, null); - teamEincomeRecordService.addTeamEincomeRecord(record); - } - - /** - * @throws UserMoneyDetailException - * 鍥㈤槦濂栭噾 鍒拌处鍒扮敤鎴蜂綑棰� - * @Title: addTOUserAccount - * @Description: - * @param day - * @param uid - * void 杩斿洖绫诲瀷 - * @throws - */ - @Transactional(rollbackFor = Exception.class) - public void addTeamRewardTOUserAccount(Date preSendTime, Long uid) throws UserMoneyDetailException { - List<Integer> typeList = new ArrayList<>(); - typeList.add(TeamEincomeRecord.TYPE_TEAM_REWARD); - - Date now = new Date(); - List<TeamEincomeRecord> list = teamEincomeRecordService.listCanRecieveRecord(preSendTime, uid, typeList); - BigDecimal money = new BigDecimal(0); - for (TeamEincomeRecord record : list) { - record = teamEincomeRecordService.selectByPrimaryKeyForUpdate(record.getId()); - money = money.add(record.getMoney()); - teamEincomeRecordService.setRecieved(record.getId()); - } - - UserMoneyDetail detail = UserMoneyDetailFactory.createTeamReward(uid, money, preSendTime); - - userMoneyService.addUserMoney(uid, money, detail); - // 鍙戦�佹秷鎭� - BigDecimal balance = userMoneyService.getBalance(uid); - userMoneyMsgNotificationService.teamRewardReceive(uid, money, balance, now); - } - - /** - * 鍥㈤槦鍒嗙孩鍒拌处 - * @Title: addTeamDividentsTOUserAccount - * @Description: - * @param preSendTime - * @param uid - * @throws UserMoneyDetailException - * void 杩斿洖绫诲瀷 - * @throws - */ - @Transactional(rollbackFor = Exception.class) - public void addTeamDividentsTOUserAccount(Date preSendTime, Long uid) throws UserMoneyDetailException { - List<Integer> typeList = new ArrayList<>(); - typeList.add(TeamEincomeRecord.TYPE_TEAM_DIVIDENTS); - typeList.add(TeamEincomeRecord.TYPE_TEAM_SUBSIDY); - Date now = new Date(); - List<TeamEincomeRecord> list = teamEincomeRecordService.listCanRecieveRecord(preSendTime, uid, typeList); - BigDecimal money = new BigDecimal(0); - for (TeamEincomeRecord record : list) { - record = teamEincomeRecordService.selectByPrimaryKeyForUpdate(record.getId()); - money = money.add(record.getMoney()); - teamEincomeRecordService.setRecieved(record.getId()); - } - - UserMoneyDetail detail = UserMoneyDetailFactory.createTeamDividents(uid, money, preSendTime); - - userMoneyService.addUserMoney(uid, money, detail); - // 鍙戦�佹秷鎭� - BigDecimal balance = userMoneyService.getBalance(uid); - userMoneyMsgNotificationService.teamDividend(uid, money, balance, now); - } - -} +package com.yeshi.fanli.service.manger.money; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.annotation.Resource; + +import com.yeshi.fanli.entity.bus.user.HongBaoV2; +import com.yeshi.fanli.service.inter.order.HongBaoV2Service; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import com.yeshi.fanli.entity.money.TeamEincomeRecord; +import com.yeshi.fanli.entity.money.UserMoneyDetail; +import com.yeshi.fanli.exception.ParamsException; +import com.yeshi.fanli.exception.money.TeamEincomeRecordException; +import com.yeshi.fanli.exception.money.UserMoneyDetailException; +import com.yeshi.fanli.service.inter.money.TeamEincomeRecordService; +import com.yeshi.fanli.service.inter.money.UserMoneyService; +import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService; +import org.yeshi.utils.TimeUtil; +import com.yeshi.fanli.util.factory.UserMoneyDetailFactory; +import com.yeshi.fanli.util.factory.money.TeamEincomeRecordFactory; + +/** + * 鍥㈤槦鏀剁泭绠$悊 + * @author Administrator + * + */ +@Component +public class TeamEincomeManager { + + @Resource + private TeamEincomeRecordService teamEincomeRecordService; + + @Resource + private UserMoneyService userMoneyService; + + @Resource + private UserMoneyMsgNotificationService userMoneyMsgNotificationService; + + @Resource + private HongBaoV2Service hongBaoV2Service; + + /** + * @throws ParamsException + * @throws TeamEincomeRecordException + * 娣诲姞鍥㈤槦濂栭噾 + * @Title: addTeamReward + * @Description: + * @param hongBaoList + * @param uid + * void 杩斿洖绫诲瀷 + * @throws + */ + @Transactional(rollbackFor = Exception.class) + public void addTeamReward(Long uid, Date preSendTime, BigDecimal money, int sourceType) + throws TeamEincomeRecordException, ParamsException { + String day = TimeUtil.getGernalTime(preSendTime.getTime(), "yyyy-MM-dd"); + TeamEincomeRecord record = TeamEincomeRecordFactory.createTeamReward(day, uid, money, sourceType, null); + teamEincomeRecordService.addTeamEincomeRecord(record); + } + + /** + * 娣诲姞鍥㈤槦琛ヨ创 + * @Title: addTeamSubsidy + * @Description: + * @param uid + * @param taskKey + * void 杩斿洖绫诲瀷 + * @throws + */ + @Transactional(rollbackFor = Exception.class) + public void addTeamSubsidy(Long uid, Date preSendTime, BigDecimal money, int sourceType) + throws TeamEincomeRecordException, ParamsException { + String day = TimeUtil.getGernalTime(preSendTime.getTime(), "yyyy-MM-dd"); + TeamEincomeRecord record = TeamEincomeRecordFactory.createTeamSubsidy(day, uid, money, sourceType, null); + teamEincomeRecordService.addTeamEincomeRecord(record); + } + + /** + * 娣诲姞鍥㈤槦鍒嗙孩 + * @Title: addTeamDividents + * @Description: + * @param uid + * @param preSendTime + * void 杩斿洖绫诲瀷 + * @throws + */ + @Transactional(rollbackFor = Exception.class) + public void addTeamDividents(Long uid, Date preSendTime, BigDecimal money,int type) + throws TeamEincomeRecordException, ParamsException { + String day = TimeUtil.getGernalTime(preSendTime.getTime(), "yyyy-MM-dd"); + TeamEincomeRecord record = TeamEincomeRecordFactory.createTeamDividents(day, uid, money,type, null); + teamEincomeRecordService.addTeamEincomeRecord(record); + } + + /** + * @throws UserMoneyDetailException + * 鍥㈤槦濂栭噾 鍒拌处鍒扮敤鎴蜂綑棰� + * @Title: addTOUserAccount + * @Description: + * @param day + * @param uid + * void 杩斿洖绫诲瀷 + * @throws + */ + @Transactional(rollbackFor = Exception.class) + public void addTeamRewardTOUserAccount(Date preSendTime, Long uid) throws UserMoneyDetailException { + List<Integer> typeList = new ArrayList<>(); + typeList.add(TeamEincomeRecord.TYPE_TEAM_REWARD); + + Date now = new Date(); + List<TeamEincomeRecord> list = teamEincomeRecordService.listCanRecieveRecord(preSendTime, uid, typeList); + BigDecimal money = new BigDecimal(0); + for (TeamEincomeRecord record : list) { + record = teamEincomeRecordService.selectByPrimaryKeyForUpdate(record.getId()); + money = money.add(record.getMoney()); + teamEincomeRecordService.setRecieved(record.getId()); + } + + UserMoneyDetail detail = UserMoneyDetailFactory.createTeamReward(uid, money, preSendTime); + + userMoneyService.addUserMoney(uid, money, detail); + // 鍙戦�佹秷鎭� + BigDecimal balance = userMoneyService.getBalance(uid); + userMoneyMsgNotificationService.teamRewardReceive(uid, money, balance, now); + + //鏇存敼鐘舵�� + List<Integer> hongBaoTypeList=new ArrayList<>(); + hongBaoTypeList.add(HongBaoV2.TYPE_YIJI); + hongBaoTypeList.add(HongBaoV2.TYPE_ERJI); + hongBaoTypeList.add(HongBaoV2.TYPE_SHARE_YIJI); + hongBaoTypeList.add(HongBaoV2.TYPE_SHARE_ERJI); + hongBaoV2Service.setHongBaoRecieved(uid,hongBaoTypeList,preSendTime); + + } + + /** + * 鍥㈤槦鍒嗙孩鍒拌处 + * @Title: addTeamDividentsTOUserAccount + * @Description: + * @param preSendTime + * @param uid + * @throws UserMoneyDetailException + * void 杩斿洖绫诲瀷 + * @throws + */ + @Transactional(rollbackFor = Exception.class) + public void addTeamDividentsTOUserAccount(Date preSendTime, Long uid) throws UserMoneyDetailException { + List<Integer> typeList = new ArrayList<>(); + typeList.add(TeamEincomeRecord.TYPE_TEAM_DIVIDENTS); + typeList.add(TeamEincomeRecord.TYPE_TEAM_SUBSIDY); + Date now = new Date(); + List<TeamEincomeRecord> list = teamEincomeRecordService.listCanRecieveRecord(preSendTime, uid, typeList); + BigDecimal money = new BigDecimal(0); + for (TeamEincomeRecord record : list) { + record = teamEincomeRecordService.selectByPrimaryKeyForUpdate(record.getId()); + money = money.add(record.getMoney()); + teamEincomeRecordService.setRecieved(record.getId()); + } + + UserMoneyDetail detail = UserMoneyDetailFactory.createTeamDividents(uid, money, preSendTime); + + userMoneyService.addUserMoney(uid, money, detail); + // 鍙戦�佹秷鎭� + BigDecimal balance = userMoneyService.getBalance(uid); + userMoneyMsgNotificationService.teamDividend(uid, money, balance, now); + } + +} -- Gitblit v1.8.0