src/main/java/com/xcong/excoin/modules/member/dao/AgentReturnDao.java | ●●●●● patch | view | raw | blame | history | |
src/main/resources/application.yml | ●●●●● patch | view | raw | blame | history | |
src/main/resources/mapper/member/AgentReturnDao.xml | ●●●●● patch | view | raw | blame | history | |
src/test/java/com/xcong/excoin/ReturnMoneyTest.java | ●●●●● patch | view | raw | blame | history |
src/main/java/com/xcong/excoin/modules/member/dao/AgentReturnDao.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xcong.excoin.modules.member.entity.AgentReturnEntity; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -12,4 +13,5 @@ List<AgentReturnEntity> selectAllNeedMoneyReturn(); int updateAgentReturnStatusByRefererId(@Param("isReturn") int isReturn, @Param("refererId") Long refererId); } src/main/resources/application.yml
@@ -7,9 +7,9 @@ profiles: active: dev datasource: url: jdbc:mysql://120.27.238.55:3306/kss_framework?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8 username: ct_test password: 123456 url: jdbc:mysql://rm-bp151tw8er79ig9kb5o.mysql.rds.aliyuncs.com:3306/db_biue?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8 username: ctcoin_data password: ctcoin_123 driver-class-name: com.mysql.jdbc.Driver type: com.alibaba.druid.pool.DruidDataSource druid: src/main/resources/mapper/member/AgentReturnDao.xml
@@ -3,7 +3,16 @@ <mapper namespace="com.xcong.excoin.modules.member.dao.AgentReturnDao"> <select id="selectAllNeedMoneyReturn" resultType="com.xcong.excoin.modules.member.entity.AgentReturnEntity"> select * from agent_return where is_return=0 select referer_id, sum(return_amount) return_amount from agent_return where is_return=0 group by referer_id </select> <update id="updateAgentReturnStatusByRefererId"> update agent_return set is_return=#{isReturn} where referer_id=#{refererId} </update> </mapper> src/test/java/com/xcong/excoin/ReturnMoneyTest.java
@@ -56,30 +56,29 @@ if (CollUtil.isNotEmpty(list)) { for (AgentReturnEntity agentReturn : list) { BigDecimal needReturn = agentReturn.getReturnAmount(); Long memberId = agentReturn.getMemberId(); MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(memberId, "USDT"); Long refererId = agentReturn.getRefererId(); MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(refererId, "USDT"); if (walletAgent == null) { continue; } log.info("用户ID:{}, 当前余额:{},总金额:{}, 返佣金额:{}", memberId, walletAgent.getAvailableBalance().toPlainString(), walletAgent.getTotalBalance().toPlainString(), needReturn); log.info("用户ID:{}, 当前余额:{},总金额:{}, 返佣金额:{}", refererId, walletAgent.getAvailableBalance().toPlainString(), walletAgent.getTotalBalance().toPlainString(), needReturn); walletAgent.setAvailableBalance(walletAgent.getAvailableBalance().add(needReturn)); walletAgent.setTotalBalance(walletAgent.getTotalBalance().add(needReturn)); agentReturn.setIsReturn(AgentReturnEntity.IS_RETURN_Y); MemberAccountMoneyChange moneyChange = new MemberAccountMoneyChange(); moneyChange.setAmount(needReturn); moneyChange.setContent("佣金到账"); moneyChange.setType(MemberAccountMoneyChange.TYPE_WALLET_AGENT); moneyChange.setStatus(MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER); moneyChange.setMemberId(memberId); moneyChange.setMemberId(refererId); moneyChange.setSymbol("USDT"); // // 更新代理钱包金额 // memberWalletAgentDao.updateById(walletAgent); // // 更新返佣明细中状态 // agentReturnDao.updateById(agentReturn); // agentReturnDao.updateAgentReturnStatusByRefererId(AgentReturnEntity.IS_RETURN_Y, refererId); // // 插入财务流水记录 // memberAccountMoneyChangeDao.insert(moneyChange); }