From 64db0aaa8d834262a416321050770d44eaf34e0d Mon Sep 17 00:00:00 2001 From: KKSU <15274802129@163.com> Date: Wed, 07 Aug 2024 10:34:31 +0800 Subject: [PATCH] 后台 --- /dev/null | 370 --------------------- src/test/java/cc/mrbird/febs/AgentTest.java | 606 ----------------------------------- src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java | 1 src/main/resources/application-dev.yml | 12 4 files changed, 5 insertions(+), 984 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java index 7fb3294..d217c24 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java @@ -1963,6 +1963,7 @@ QueryWrapper<MallProductBuy> query = new QueryWrapper<>(); query.eq("state",ProductEnum.PRODUCT_BUY_SUCCESS.getValue()); query.eq("mate_state",ProductEnum.PRODUCT_BUY_MATE_STATE_FAIL.getValue()); + query.orderByAsc("CREATED_TIME"); List<MallProductBuy> mallProductBuys = mallProductBuyMapper.selectList(query); if(CollUtil.isEmpty(mallProductBuys)){ return; diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 16649fc..cf27e8f 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -2,7 +2,7 @@ datasource: dynamic: # 是否开启 SQL日志输出,生产环境建议关闭,有性能损耗 - p6spy: false + p6spy: true hikari: connection-timeout: 30000 max-lifetime: 1800000 @@ -15,14 +15,10 @@ datasource: # 数据源-1,名称为 base base: - # username: ct_test - # password: 123456 - # driver-class-name: com.mysql.cj.jdbc.Driver - # url: jdbc:mysql://120.27.238.55:3406/db_hongloumeng?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 - username: db_wdf - password: db_wdf123!@#123 + username: ct_test + password: 123456 driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://103.234.75.48:3306/db_wdf?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 + url: jdbc:mysql://120.27.238.55:3406/db_hongloumeng?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&allowMultiQueries=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 redis: # Redis数据库索引(默认为 0) diff --git a/src/test/java/cc/mrbird/febs/AgentTest.java b/src/test/java/cc/mrbird/febs/AgentTest.java index 44e7804..8ecf0c1 100644 --- a/src/test/java/cc/mrbird/febs/AgentTest.java +++ b/src/test/java/cc/mrbird/febs/AgentTest.java @@ -1,35 +1,11 @@ package cc.mrbird.febs; -import cc.mrbird.febs.common.enumerates.AgentLevelEnum; -import cc.mrbird.febs.common.enumerates.DataDictionaryEnum; -import cc.mrbird.febs.common.exception.FebsException; -import cc.mrbird.febs.common.utils.LoginUserUtil; -import cc.mrbird.febs.mall.dto.AgentLevelUpdateDto; -import cc.mrbird.febs.mall.dto.ApiMallActWinDetailsDto; -import cc.mrbird.febs.mall.entity.*; -import cc.mrbird.febs.mall.mapper.*; -import cc.mrbird.febs.mall.quartz.ProfitJob; import cc.mrbird.febs.mall.service.IAgentService; -import cc.mrbird.febs.mall.vo.ApiMallActWinDetailsVo; -import cc.mrbird.febs.mall.vo.ApiMallAwardDetailsVo; -import cc.mrbird.febs.rabbit.consumer.AgentConsumer; -import cc.mrbird.febs.rabbit.producter.AgentProducer; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.RandomUtil; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; -import org.aspectj.weaver.loadtime.Agent; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.List; /** * @author wzy @@ -39,593 +15,11 @@ @SpringBootTest public class AgentTest { -// @Autowired -// private AgentProducer agentProducer; -// -// @Autowired -// private DataDictionaryCustomMapper dataDictionaryCustomMapper; -// @Autowired private IAgentService agentService; -// -// @Autowired -// private MallGoodsStyleMapper mallGoodsStyleMapper; -// -// @Autowired -// private MallActAwardSetMapper mallActAwardSetMapper; -// @Autowired -// private MallMemberMapper mallMemberMapper; -// @Autowired -// private MallActWinRecordMapper mallActWinRecordMapper; -// @Autowired -// private MallActLuckdrawRecordMapper mallActLuckdrawRecordMapper; -// @Autowired -// private MallMemberWalletMapper mallMemberWalletMapper; -// @Autowired -// private MallActSetMapper mallActSetMapper; @Test public void memberLevelUp() { agentService.memberLevelUp(); } -// public void skusTest() { -// ApiMallAwardDetailsVo apiMallAwardDetailsVo = new ApiMallAwardDetailsVo(); -// Long memberId = 4L; -// Long actId = 1L; -// MallMember mallMember = mallMemberMapper.selectById(memberId); -// if(ObjectUtil.isEmpty(mallMember)){ -// throw new FebsException("用户不存在"); -// } // -// MallActSet mallActSet = mallActSetMapper.selectById(actId); -// if(ObjectUtil.isEmpty(mallActSet)){ -// throw new FebsException("活动不存在"); -// } -// Integer actStatus = mallActSet.getActStatus(); -// if(MallActSet.ACT_STATUS_DISABLED == actStatus){ -// throw new FebsException("活动还没开始"); -// } -// /** -// * 获取用户积分数,判断能不能抽奖 -// * 减少对应的积分数量 -// * 较少奖品的已抽奖 -// * 生成一条抽奖记录 -// */ -// -// MallMemberWallet wallet = mallMemberWalletMapper.selectWalletByMemberId(memberId); -// if(ObjectUtil.isEmpty(wallet)){ -// throw new FebsException("账户不存在"); -// } -// BigDecimal commission = wallet.getCommission(); -// BigDecimal prizeScore = wallet.getPrizeScore(); -// Integer actScoreCnt = mallActSet.getActScoreCnt(); -// if(prizeScore.compareTo(new BigDecimal(actScoreCnt))<0){ -// throw new FebsException("竞猜积分不足"); -// } -// /** -// * 中奖概率 20% -// * 每次抽奖产生一个随机数要大于8,则中奖 -// * 历史10条抽奖记录有中奖过,中奖记录少于两条,则中奖 -// */ -// //获取中奖概率 -// DataDictionaryCustom scoreDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( -// DataDictionaryEnum.WIN_SCORE.getType(), -// DataDictionaryEnum.WIN_SCORE.getCode()); -// DataDictionaryCustom cashDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( -// DataDictionaryEnum.WIN_CASH.getType(), -// DataDictionaryEnum.WIN_CASH.getCode()); -// String scoreDicValue = scoreDic.getValue(); -// String cashDicValue = cashDic.getValue(); -// BigDecimal totalProbability = new BigDecimal(scoreDicValue).add(new BigDecimal(cashDicValue)); -// //获取那个更大一点的几率 -// BigDecimal maxProbability = BigDecimal.ZERO; -// BigDecimal minProbability = BigDecimal.ZERO; -// Integer maxAwardType = 0; -// Integer minAwardType = 0; -// if(new BigDecimal(scoreDicValue).compareTo(new BigDecimal(cashDicValue)) < 0){ -// maxProbability = new BigDecimal(cashDicValue); -// minProbability = new BigDecimal(scoreDicValue); -// maxAwardType = MallActAwardSet.AWARD_TYPE_YJ; -// minAwardType = MallActAwardSet.AWARD_TYPE_JF; -// }else{ -// maxProbability = new BigDecimal(scoreDicValue); -// minProbability = new BigDecimal(cashDicValue); -// maxAwardType = MallActAwardSet.AWARD_TYPE_JF; -// minAwardType = MallActAwardSet.AWARD_TYPE_YJ; -// } -// -// BigDecimal multiply = totalProbability.multiply(new BigDecimal(100)); -// BigDecimal failureScope = new BigDecimal(100).subtract(multiply); -// int randomInt = 90; -// //小于failureScope这个数字,则没中奖 -// if(new BigDecimal(randomInt).compareTo(failureScope) <= 0){ -// //抽奖记录 -// MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); -// mallActLuckdrawRecord.setActId(actId); -// mallActLuckdrawRecord.setActName(mallActSet.getActName()); -// mallActLuckdrawRecord.setMemberId(memberId); -// mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); -// mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); -// mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); -// -// List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); -// if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ -// apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); -// apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); -// }else{ -// apiMallAwardDetailsVo.setAwardName("未中奖"); -// } -// }else if(new BigDecimal(randomInt).compareTo(failureScope) > 0 -// && new BigDecimal(randomInt).compareTo(failureScope.add(maxProbability.multiply(new BigDecimal(100)))) <= 0){ -// //大于failureScope.add(maxProbability.multiply(new BigDecimal(100)))这个数字,则中奖 -// //获取最新的十条抽奖记录 -// List<MallActLuckdrawRecord> records = mallActLuckdrawRecordMapper.selectRecordByMemberIdAndActId(memberId,actId); -// if(CollUtil.isNotEmpty(records)){ -// //中奖次数 -// Integer count = 0; -// for(MallActLuckdrawRecord mallActLuckdrawRecord : records){ -// Integer status = mallActLuckdrawRecord.getStatus(); -// if(MallActLuckdrawRecord.STATUS_ENABLE == status){ -// count = count + 1; -// } -// } -// if(new BigDecimal(count).compareTo(maxProbability.multiply(new BigDecimal(10))) < 0){ -// //获取活动下该类别的奖品 -// List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,maxAwardType); -// if(CollUtil.isEmpty(mallActAwardSets)){ -// //抽奖记录 -// MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); -// mallActLuckdrawRecord.setActId(actId); -// mallActLuckdrawRecord.setActName(mallActSet.getActName()); -// mallActLuckdrawRecord.setMemberId(memberId); -// mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); -// mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); -// mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); -// -// List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); -// if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ -// apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); -// apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); -// }else{ -// apiMallAwardDetailsVo.setAwardName("未中奖"); -// } -// }else{ -// List<MallActAwardSet> idList = new ArrayList(); -// for(MallActAwardSet mallActAwardSet : mallActAwardSets){ -// Integer awardTotal = mallActAwardSet.getAwardTotal(); -// Integer awardCnt = mallActAwardSet.getAwardCnt(); -// if(awardCnt < awardTotal){ -// idList.add(mallActAwardSet); -// } -// } -// MallActAwardSet mallActAwardSet = new MallActAwardSet(); -// if(idList.size() <= 1){ -// mallActAwardSet = idList.get(0); -// }else{ -// int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); -// mallActAwardSet = idList.get(randomIdIndex); -// } -// mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); -// mallActAwardSetMapper.updateById(mallActAwardSet); -// -// MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); -// mallActLuckdrawRecord.setActId(actId); -// mallActLuckdrawRecord.setActName(mallActSet.getActName()); -// mallActLuckdrawRecord.setMemberId(memberId); -// mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); -// mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); -// mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); -// -// MallActWinRecord mallActWinRecord = new MallActWinRecord(); -// mallActWinRecord.setMemberId(memberId); -// mallActWinRecord.setActId(actId); -// mallActWinRecord.setActName(mallActSet.getActName()); -// mallActWinRecord.setAwardId(mallActAwardSet.getId()); -// mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); -// mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); -// mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); -// mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); -// mallActWinRecordMapper.insert(mallActWinRecord); -// -// apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); -// apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); -// apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); -// apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); -// -// if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ -// prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); -// }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ -// commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); -// } -// } -// }else{ -// //抽奖记录 -// MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); -// mallActLuckdrawRecord.setActId(actId); -// mallActLuckdrawRecord.setActName(mallActSet.getActName()); -// mallActLuckdrawRecord.setMemberId(memberId); -// mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); -// mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); -// mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); -// -// List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); -// if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ -// apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); -// apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); -// }else{ -// apiMallAwardDetailsVo.setAwardName("未中奖"); -// } -// } -// }else{ -// //获取活动下该类别的奖品 -// List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,maxAwardType); -// if(CollUtil.isEmpty(mallActAwardSets)){ -// //抽奖记录 -// MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); -// mallActLuckdrawRecord.setActId(actId); -// mallActLuckdrawRecord.setActName(mallActSet.getActName()); -// mallActLuckdrawRecord.setMemberId(memberId); -// mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); -// mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); -// mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); -// -// List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); -// if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ -// apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); -// apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); -// }else{ -// apiMallAwardDetailsVo.setAwardName("未中奖"); -// } -// }else{ -// List<MallActAwardSet> idList = new ArrayList(); -// for(MallActAwardSet mallActAwardSet : mallActAwardSets){ -// Integer awardTotal = mallActAwardSet.getAwardTotal(); -// Integer awardCnt = mallActAwardSet.getAwardCnt(); -// if(awardCnt < awardTotal){ -// idList.add(mallActAwardSet); -// } -// } -// MallActAwardSet mallActAwardSet = new MallActAwardSet(); -// if(idList.size() <= 1){ -// mallActAwardSet = idList.get(0); -// }else{ -// int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); -// mallActAwardSet = idList.get(randomIdIndex); -// } -// mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); -// mallActAwardSetMapper.updateById(mallActAwardSet); -// -// MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); -// mallActLuckdrawRecord.setActId(actId); -// mallActLuckdrawRecord.setActName(mallActSet.getActName()); -// mallActLuckdrawRecord.setMemberId(memberId); -// mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); -// mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); -// mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); -// -// MallActWinRecord mallActWinRecord = new MallActWinRecord(); -// mallActWinRecord.setMemberId(memberId); -// mallActWinRecord.setActId(actId); -// mallActWinRecord.setActName(mallActSet.getActName()); -// mallActWinRecord.setAwardId(mallActAwardSet.getId()); -// mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); -// mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); -// mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); -// mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); -// mallActWinRecordMapper.insert(mallActWinRecord); -// -// apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); -// apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); -// apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); -// apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); -// -// if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ -// prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); -// }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ -// commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); -// } -// } -// } -// }else{ -// //中奖 -// //获取最新的十条抽奖记录 -// List<MallActLuckdrawRecord> records = mallActLuckdrawRecordMapper.selectRecordByMemberIdAndActId(memberId,actId); -// if(CollUtil.isNotEmpty(records)){ -// //中奖次数 -// Integer count = 0; -// for(MallActLuckdrawRecord mallActLuckdrawRecord : records){ -// Integer status = mallActLuckdrawRecord.getStatus(); -// if(MallActLuckdrawRecord.STATUS_ENABLE == status){ -// count = count + 1; -// } -// } -// if(new BigDecimal(count).compareTo(minProbability.multiply(new BigDecimal(10))) < 0){ -// //获取活动下该类别的奖品 -// List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,minAwardType); -// if(CollUtil.isEmpty(mallActAwardSets)){ -// //抽奖记录 -// MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); -// mallActLuckdrawRecord.setActId(actId); -// mallActLuckdrawRecord.setActName(mallActSet.getActName()); -// mallActLuckdrawRecord.setMemberId(memberId); -// mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); -// mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); -// mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); -// -// List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); -// if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ -// apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); -// apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); -// }else{ -// apiMallAwardDetailsVo.setAwardName("未中奖"); -// } -// }else{ -// List<MallActAwardSet> idList = new ArrayList(); -// for(MallActAwardSet mallActAwardSet : mallActAwardSets){ -// Integer awardTotal = mallActAwardSet.getAwardTotal(); -// Integer awardCnt = mallActAwardSet.getAwardCnt(); -// if(awardCnt < awardTotal){ -// idList.add(mallActAwardSet); -// } -// } -// MallActAwardSet mallActAwardSet = new MallActAwardSet(); -// if(idList.size() <= 1){ -// mallActAwardSet = idList.get(0); -// }else{ -// int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); -// mallActAwardSet = idList.get(randomIdIndex); -// } -// mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); -// mallActAwardSetMapper.updateById(mallActAwardSet); -// -// MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); -// mallActLuckdrawRecord.setActId(actId); -// mallActLuckdrawRecord.setActName(mallActSet.getActName()); -// mallActLuckdrawRecord.setMemberId(memberId); -// mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); -// mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); -// mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); -// -// MallActWinRecord mallActWinRecord = new MallActWinRecord(); -// mallActWinRecord.setMemberId(memberId); -// mallActWinRecord.setActId(actId); -// mallActWinRecord.setActName(mallActSet.getActName()); -// mallActWinRecord.setAwardId(mallActAwardSet.getId()); -// mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); -// mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); -// mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); -// mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); -// mallActWinRecordMapper.insert(mallActWinRecord); -// -// apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); -// apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); -// apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); -// apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); -// -// if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ -// prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); -// }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ -// commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); -// } -// } -// }else{ -// //抽奖记录 -// MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); -// mallActLuckdrawRecord.setActId(actId); -// mallActLuckdrawRecord.setActName(mallActSet.getActName()); -// mallActLuckdrawRecord.setMemberId(memberId); -// mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); -// mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); -// mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); -// -// List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); -// if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ -// apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); -// apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); -// }else{ -// apiMallAwardDetailsVo.setAwardName("未中奖"); -// } -// } -// }else{ -// //获取活动下该类别的奖品 -// List<MallActAwardSet> mallActAwardSets = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId,minAwardType); -// if(CollUtil.isEmpty(mallActAwardSets)){ -// //抽奖记录 -// MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); -// mallActLuckdrawRecord.setActId(actId); -// mallActLuckdrawRecord.setActName(mallActSet.getActName()); -// mallActLuckdrawRecord.setMemberId(memberId); -// mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); -// mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_DISABLED); -// mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); -// -// List<MallActAwardSet> mallActAwardSetXXCY = mallActAwardSetMapper.selectMallActAwardByActIdAndAwardType(actId, MallActAwardSet.AWARD_TYPE_XXCY); -// if(CollUtil.isNotEmpty(mallActAwardSetXXCY)){ -// apiMallAwardDetailsVo.setAwardImage(mallActAwardSetXXCY.get(0).getAwardImage()); -// apiMallAwardDetailsVo.setAwardName(mallActAwardSetXXCY.get(0).getAwardName()); -// }else{ -// apiMallAwardDetailsVo.setAwardName("未中奖"); -// } -// }else{ -// List<MallActAwardSet> idList = new ArrayList(); -// for(MallActAwardSet mallActAwardSet : mallActAwardSets){ -// Integer awardTotal = mallActAwardSet.getAwardTotal(); -// Integer awardCnt = mallActAwardSet.getAwardCnt(); -// if(awardCnt < awardTotal){ -// idList.add(mallActAwardSet); -// } -// } -// MallActAwardSet mallActAwardSet = new MallActAwardSet(); -// if(idList.size() <= 1){ -// mallActAwardSet = idList.get(0); -// }else{ -// int randomIdIndex = RandomUtil.randomInt(0, idList.size()-1); -// mallActAwardSet = idList.get(randomIdIndex); -// } -// mallActAwardSet.setAwardCnt(mallActAwardSet.getAwardCnt() + 1); -// mallActAwardSetMapper.updateById(mallActAwardSet); -// -// MallActLuckdrawRecord mallActLuckdrawRecord = new MallActLuckdrawRecord(); -// mallActLuckdrawRecord.setActId(actId); -// mallActLuckdrawRecord.setActName(mallActSet.getActName()); -// mallActLuckdrawRecord.setMemberId(memberId); -// mallActLuckdrawRecord.setActScoreCnt(actScoreCnt); -// mallActLuckdrawRecord.setStatus(MallActLuckdrawRecord.STATUS_ENABLE); -// mallActLuckdrawRecordMapper.insert(mallActLuckdrawRecord); -// -// MallActWinRecord mallActWinRecord = new MallActWinRecord(); -// mallActWinRecord.setMemberId(memberId); -// mallActWinRecord.setActId(actId); -// mallActWinRecord.setActName(mallActSet.getActName()); -// mallActWinRecord.setAwardId(mallActAwardSet.getId()); -// mallActWinRecord.setAwardName(mallActAwardSet.getAwardName()); -// mallActWinRecord.setAwardType(mallActAwardSet.getAwardType()); -// mallActWinRecord.setAwardValue(mallActAwardSet.getAwardValue()); -// mallActWinRecord.setRecordId(mallActLuckdrawRecord.getId()); -// mallActWinRecordMapper.insert(mallActWinRecord); -// -// apiMallAwardDetailsVo.setAwardName(mallActAwardSet.getAwardName()); -// apiMallAwardDetailsVo.setAwardType(mallActAwardSet.getAwardType()); -// apiMallAwardDetailsVo.setAwardValue(mallActAwardSet.getAwardValue()); -// apiMallAwardDetailsVo.setAwardImage(mallActAwardSet.getAwardImage()); -// -// if(MallActAwardSet.AWARD_TYPE_JF == mallActAwardSet.getAwardType()){ -// prizeScore = prizeScore.add(new BigDecimal(mallActAwardSet.getAwardValue())); -// }else if(MallActAwardSet.AWARD_TYPE_YJ == mallActAwardSet.getAwardType()){ -// commission = commission.add(new BigDecimal(mallActAwardSet.getAwardValue())); -// } -// } -// } -// } -// -// //扣竞猜积分 -// prizeScore = prizeScore.subtract(new BigDecimal(actScoreCnt)); -// wallet.setPrizeScore(prizeScore); -// wallet.setCommission(commission); -// mallMemberWalletMapper.updateAmountWithVersion(wallet); -// -// System.out.println(apiMallAwardDetailsVo); -// } -// -// @Test -// public void agentTest() { -//// agentProducer.sendDelayMsg(1L, 10000L); -// -// ApiMallActWinDetailsDto apiMallActWinDetailsDto = new ApiMallActWinDetailsDto(); -// apiMallActWinDetailsDto.setActId(1L); -// apiMallActWinDetailsDto.setPageNow(1); -// apiMallActWinDetailsDto.setPageSize(10); -// Long memberId = 4L; -// MallMember mallMember = mallMemberMapper.selectById(memberId); -// if(ObjectUtil.isEmpty(mallMember)){ -// throw new FebsException("用户不存在"); -// } -// apiMallActWinDetailsDto.setMemberId(memberId); -// -// Long actId = apiMallActWinDetailsDto.getActId(); -// MallActSet mallActSet = mallActSetMapper.selectById(actId); -// if(ObjectUtil.isEmpty(mallActSet)){ -// throw new FebsException("活动不存在"); -// } -// Page<ApiMallActWinDetailsVo> page = new Page<>(apiMallActWinDetailsDto.getPageNow(), apiMallActWinDetailsDto.getPageSize()); -// IPage<ApiMallActWinDetailsVo> apiMallActWinDetailsVoIPage = mallActWinRecordMapper.selectApiMallActWinDetailsListInPage(apiMallActWinDetailsDto, page); -// System.out.println(apiMallActWinDetailsVoIPage); -// } -// -// @Test -// public void insertAgentTest() { -//// AgentInfo agentInfo = new AgentInfo(); -//// agentInfo.setOrderType(2); -//// agentInfo.setOrderCnt(2000); -//// agentInfo.setLastCnt(3); -//// agentInfo.setDirectIncome(BigDecimal.valueOf(50)); -//// agentInfo.setTeamIncome(BigDecimal.valueOf(15)); -//// agentInfo.setTeamIncomeType(2); -//// -//// DataDictionaryCustom data = new DataDictionaryCustom(); -//// data.setType("AGENT_LEVEL_REQUIRE"); -//// data.setCode(AgentLevelEnum.FOUR_LEVEL.name()); -//// data.setValue(JSONObject.toJSONString(agentInfo)); -//// dataDictionaryCustomMapper.insert(data); -// } -// -// @Test -// public void insertData() { -// int i = 1; -// for (AgentLevelEnum value : AgentLevelEnum.values()) { -// DataDictionaryCustom data = new DataDictionaryCustom(); -// data.setType("AGENT_LEVEL"); -// data.setDescription(value.getName()); -// data.setCode(value.name()); -// data.setValue(String.valueOf(i)); -// dataDictionaryCustomMapper.insert(data); -// } -// -// } -// -// public static void main(String[] args) { -// getJson(); -// } -// -// public static void getJson(){ -// AgentLevelUpdateDto adminAgentLevelUpdateInfoVo = new AgentLevelUpdateDto(); -// String jsonStr = "{\"directIncome\":50,\"lastCnt\":3,\"orderCnt\":2000,\"orderType\":2,\"teamIncome\":15,\"teamIncomeType\":2}"; -// JSONObject jsonObject = JSONObject.parseObject(jsonStr); -// adminAgentLevelUpdateInfoVo.setDirectIncome(new BigDecimal((jsonObject.get("directIncome")==null?0:jsonObject.get("directIncome")).toString())); -// adminAgentLevelUpdateInfoVo.setLastCnt(Integer.parseInt((jsonObject.get("lastCnt")==null?0:jsonObject.get("lastCnt")).toString())); -// adminAgentLevelUpdateInfoVo.setOrderCnt(Integer.parseInt((jsonObject.get("orderCnt")==null?0:jsonObject.get("orderCnt")).toString())); -// adminAgentLevelUpdateInfoVo.setOrderType(Integer.parseInt(jsonObject.get("orderType").toString())); -// adminAgentLevelUpdateInfoVo.setTeamIncome(new BigDecimal((jsonObject.get("teamIncome")==null?0:jsonObject.get("teamIncome")).toString())); -// adminAgentLevelUpdateInfoVo.setTeamIncomeType(Integer.parseInt(jsonObject.get("orderType").toString())); -// adminAgentLevelUpdateInfoVo.setId(14L); -// AgentLevelUpdateDto agentLevelUpdateDtoJson = new AgentLevelUpdateDto(); -// agentLevelUpdateDtoJson.setDirectIncome(adminAgentLevelUpdateInfoVo.getDirectIncome()); -// agentLevelUpdateDtoJson.setLastCnt(adminAgentLevelUpdateInfoVo.getLastCnt()); -// agentLevelUpdateDtoJson.setOrderCnt(adminAgentLevelUpdateInfoVo.getOrderCnt()); -// agentLevelUpdateDtoJson.setTeamIncome(adminAgentLevelUpdateInfoVo.getTeamIncome()); -// agentLevelUpdateDtoJson.setOrderType(adminAgentLevelUpdateInfoVo.getOrderType()); -// agentLevelUpdateDtoJson.setTeamIncomeType(adminAgentLevelUpdateInfoVo.getTeamIncomeType()); -// JSONObject jsonObjectA = (JSONObject)JSONObject.toJSON(agentLevelUpdateDtoJson); -// System.out.println(jsonObjectA.toJSONString()); -// } -// -// @Test -// public void autoLevelUp() { -// // agentService.autoUpAgentLevel(3L); -//// agentProducer.sendAutoLevelUpMsg(5L); -// -// agentProducer.sendReturnMoneyMsg(2L); -// } -// -// @Test -// public void returnMoney() { -// // agentService.autoUpAgentLevel(3L); -//// agentProducer.sendAutoLevelUpMsg(5L); -//// agentProducer.sendReturnMoneyMsg(52L); -// agentService.returnMoneyToAgent(52L); -// } -// -// @Test -// public void bigdecimalTest() { -// BigDecimal aa = new BigDecimal("1.345"); -// -// System.out.println(aa.setScale(2, RoundingMode.DOWN)); -// System.out.println(aa.setScale(2, RoundingMode.UP)); -// } -// -// @Autowired -// private ProfitJob profitJob; -// -// @Test -// public void profitJobTest() { -//// profitJob.profitJob(); -// } -// -// -// @Autowired -// private AgentConsumer agentConsumer; -// -// @Test -// public void orderReturnTest() { -//// agentConsumer.orderReturnMoney("7"); -// } } diff --git a/src/test/java/cc/mrbird/febs/PayTest.java b/src/test/java/cc/mrbird/febs/PayTest.java deleted file mode 100644 index 8820dad..0000000 --- a/src/test/java/cc/mrbird/febs/PayTest.java +++ /dev/null @@ -1,69 +0,0 @@ -package cc.mrbird.febs; - -import cc.mrbird.febs.pay.properties.WxPayProperties; -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.lang.UUID; -import cn.hutool.core.util.RandomUtil; -import com.alibaba.fastjson.JSONObject; -import com.alipay.api.AlipayApiException; -import com.alipay.api.domain.AlipayTradeAppPayModel; -import com.alipay.api.response.AlipayTradeAppPayResponse; -import com.github.binarywang.wxpay.bean.order.WxPayAppOrderResult; -import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; -import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult; -import com.github.binarywang.wxpay.exception.WxPayException; -import com.github.binarywang.wxpay.service.WxPayService; -import com.ijpay.alipay.AliPayApi; -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; - -/** - * @author wzy - * @date 2021-09-27 - **/ -@Slf4j -@SpringBootTest -public class PayTest { - -// @Test -// public void aliPay() throws AlipayApiException { -// AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); -// model.setBody("这是测试用"); -// model.setSubject("支付测试用的"); -// model.setOutTradeNo("2021092712215802974"); -// model.setTimeoutExpress("15m"); -// model.setTotalAmount("0.01"); -// model.setPassbackParams("callback params"); -// model.setProductCode("QUICK_MSECURITY_PAY"); -// AlipayTradeAppPayResponse resp = AliPayApi.appPayToResponse(model, ""); -// log.info("=====>>>{}", JSONObject.toJSONString(resp)); -// } -// -// @Autowired -// private WxPayService wxPayService; -// -// @Autowired -// private WxPayProperties wxPayProperties; -// -// @Test -// public void wxPayTest() { -// WxPayUnifiedOrderRequest request = new WxPayUnifiedOrderRequest(); -// request.setAppid(wxPayProperties.getAppId()); -// request.setMchId(wxPayProperties.getMchId()); -// request.setNotifyUrl(wxPayProperties.getNoticeUrl()); -// request.setBody("这是body"); -// request.setOutTradeNo(RandomUtil.randomString(32)); -// request.setTimeExpire("20230407114500"); -// request.setSpbillCreateIp("127.0.0.1"); -// request.setTradeType("APP"); -// request.setTotalFee(1); -// try { -// WxPayAppOrderResult result = wxPayService.createOrder(request); -// System.out.println(1111); -// } catch (WxPayException e) { -// e.printStackTrace(); -// } -// } -} diff --git a/src/test/java/cc/mrbird/febs/ProfitTest.java b/src/test/java/cc/mrbird/febs/ProfitTest.java deleted file mode 100644 index 9b6aaaa..0000000 --- a/src/test/java/cc/mrbird/febs/ProfitTest.java +++ /dev/null @@ -1,370 +0,0 @@ -package cc.mrbird.febs; - -import cc.mrbird.febs.common.entity.FebsResponse; -import cc.mrbird.febs.common.enumerates.MemberLevelNewEnum; -import cc.mrbird.febs.common.enumerates.ProductEnum; -import cc.mrbird.febs.common.utils.MallUtils; -import cc.mrbird.febs.mall.dto.TeamPerkDto; -import cc.mrbird.febs.mall.entity.*; -import cc.mrbird.febs.mall.mapper.*; -import cc.mrbird.febs.mall.quartz.OrderSettlementJob; -import cc.mrbird.febs.mall.service.*; -import cc.mrbird.febs.pay.model.*; -import cc.mrbird.febs.pay.service.LaKaLaService; -import cc.mrbird.febs.pay.service.NBYHService; -import cc.mrbird.febs.pay.service.UnipayService; -import cc.mrbird.febs.rabbit.producter.AgentProducer; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.date.DateTime; -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.ResourceLoader; - -import java.io.IOException; -import java.math.BigDecimal; -import java.text.DecimalFormat; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author wzy - * @date 2022-06-02 - **/ -@SpringBootTest -public class ProfitTest { - - @Autowired - private IAgentService agentService; - @Autowired - private MallMemberMapper memberMapper; - @Autowired - private DataDictionaryCustomMapper dataDictionaryCustomMapper; - @Autowired - private MallProductBuyMapper mallProductBuyMapper; -// @Test -// public void dynamicProfit(){ -// -// QueryWrapper<MallProductBuy> query = new QueryWrapper<>(); -// query.eq("state", ProductEnum.PRODUCT_BUY_SUCCESS.getValue()); -// query.eq("mate_state",ProductEnum.PRODUCT_BUY_MATE_STATE_FAIL.getValue()); -// List<MallProductBuy> mallProductBuys = mallProductBuyMapper.selectList(query); -// if(CollUtil.isEmpty(mallProductBuys)){ -// return; -// } -// -// Set<Long> collect = mallProductBuys.stream().map(MallProductBuy::getMemberId).collect(Collectors.toSet()); -// if(CollUtil.isEmpty(collect)){ -// return; -// } -// for(Long memberId : collect){ -// MallMember mallMember = memberMapper.selectById(memberId); -// if(ObjectUtil.isEmpty(mallMember)){ -// continue; -// } -// //上级 -// String referrerId = mallMember.getReferrerId(); -// MallMember mallMemberRef = memberMapper.selectInfoByInviteId(referrerId); -// if(ObjectUtil.isEmpty(mallMemberRef)){ -// continue; -// } -// List<MallMember> mallMembersAll = memberMapper.selectAllChildAgentListByInviteId(referrerId); -// -// List<MallMember> mallMembers = memberMapper.selectByRefererId(referrerId); -// Set<Long> mallMembersSet = mallMembers.stream().map(MallMember::getId).collect(Collectors.toSet()); -// mallMembersSet.retainAll(collect); -// List<Long> intersection = new ArrayList<>(mallMembersSet);//上级直推有效人数 -// if(CollUtil.isEmpty(intersection)){ -// mallMemberRef.setLevel(MemberLevelNewEnum.ZERO_LEVEL.getType()); -// memberMapper.updateById(mallMemberRef); -// continue; -// } -// /** -// * 从会员等级最低到最高,比较intersection与会员设置的直推人数directCntLevel比较 -// * directCntLevel >= intersection.size(),则满足升级会员等级条件,跳出循环 -// * teamCnt >= mallMembersAll.size(),则满足升级会员等级条件,跳出循环 -// * 达到最高级别后,升级会员等级,跳出循环 -// */ -// String level = MemberLevelNewEnum.ZERO_LEVEL.getType(); -// boolean flag = false; -// while (!flag){ -// DataDictionaryCustom levelDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( -// level, level -// ); -// TeamPerkDto teamPerkDto = JSONObject.parseObject(levelDic.getValue(), TeamPerkDto.class); -// Integer directCntLevel = teamPerkDto.getDirectCnt(); -// Integer teamCnt = teamPerkDto.getTeamCnt(); -// if(directCntLevel <= intersection.size()){ -// if(teamCnt <= mallMembersAll.size()){ -// mallMemberRef.setLevel(level); -// memberMapper.updateById(mallMemberRef); -// -// String nextLevel = MemberLevelNewEnum.ZERO_LEVEL.getNextLevel(level); -// level = nextLevel; -// if(level.equals(MemberLevelNewEnum.WU_LEVEL.getType()) && -// nextLevel.equals(MemberLevelNewEnum.WU_LEVEL.getType()) ){ -// mallMemberRef.setLevel(level); -// memberMapper.updateById(mallMemberRef); -// flag = true; -// } -// }else{ -// flag = true; -// } -// }else{ -// flag = true; -// } -// } -// } -// } -// @Autowired -// private AgentConsumer agentConsumer; -// -// @Autowired -// private IAgentService agentService; -// -// @Autowired -// private IMemberProfitService memberProfitService; -// -// @Autowired -// private IApiMallOrderInfoService iApiMallOrderInfoService; -// -// @Autowired -// private MallMemberMapper memberMapper; -// -// @Autowired -// private AgentProducer agentProducer; -// -// @Test -// public void dynamicProfit() { -// agentService.perkMoneyConsumer(Long.parseLong("796")); -//// memberProfitService.dynamicProfit(Long.parseLong("709")); -//// memberProfitService.scoreRecordReleaseJob(); -//// memberProfitService.achieveReleaseJob(); -//// agentProducer.sendPerkMoneyMsg(679L); -//// agentService.perkMoneyConsumer(665L); -//// memberProfitService.teamEqualsPerkJob(null); -//// List<MallMember> mallMemberTeamPerk = new ArrayList<>(); -//// MallMember mallMember = memberMapper.selectById(233L); -//// List<String> ids = StrUtil.split(mallMember.getReferrerIds(), ','); -//// List<MallMember> mallMembers = memberMapper.selectByInviteIds(ids); -//// Map<String, List<MallMember>> collect = mallMembers.stream().collect(Collectors.groupingBy(MallMember::getLevel)); -//// Set<String> set = collect.keySet(); // 得到所有key的集合 -//// for (String key : set) { -//// List<MallMember> value = collect.get(key); -//// System.out.println(key + " " + value); -//// mallMemberTeamPerk.add(value.get(0)); -//// -//// System.out.println(value.get(0).getName()); -//// -//// } -//// List<Long> mallMemberStarIds = mallMemberTeamPerk.stream().map(MallMember::getId).collect(Collectors.toList()); -//// -//// System.out.println(mallMemberStarIds); -// } - - - @Autowired - private LaKaLaService laKaLaService; - @Autowired - ResourceLoader resourceLoader; - @Autowired - private NBYHService nbyhService; - @Autowired - private IAdminMallMemberService mallMemberService; - @Autowired - private MallProductNftMapper mallProductNftMapper; - - @Test - public void agentProfitTrade() { - boolean flag = true; - Integer i = 0; -// while (flag){ -//// agentService.BuyToSellV2(); -// DateTime dateTime = DateUtil.offsetDay(new DateTime(), i); -// agentService.BuyToSellV3(dateTime); -// i = i+1; -// List<MallProductBuy> mallProductBuys = mallProductBuyMapper.selectListByStateAndMateState( -// ProductEnum.PRODUCT_BUY_SUCCESS.getValue(), -// ProductEnum.PRODUCT_BUY_MATE_STATE_FAIL.getValue()); -// if(CollUtil.isEmpty(mallProductBuys)){ -// flag = false; -// } -// } - System.out.println(i); - } - @Test - public void agentProfit() { -// try { -// System.out.println(resourceLoader.getResource("classpath:lkl/api_private_key.pem").getInputStream()); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// LaKaLaCreateOrderReqDate laKaLaCreateOrderReqDate = new LaKaLaCreateOrderReqDate(); -// //订单编号 -// laKaLaCreateOrderReqDate.setOut_order_no("2023041918302032901"); -// //订单金额,分计 -// laKaLaCreateOrderReqDate.setTotal_amount(new BigDecimal(1).longValue()); -// laKaLaCreateOrderReqDate.setOrder_info("礼品一"); -// laKaLaService.verifyCreateOrder(laKaLaCreateOrderReqDate); - } -// -// -//// @Test -//// public void staticProfit() { -//// memberProfitService.staticProfit(new Date()); -//// } -// -// @Test -// public void thankfulProfit() { -// memberProfitService.mqPerkRetryJob(); -// } -// -// @Test -// public void rankProfit() { -// memberProfitService.rankProfit(); -// } -// -// @Autowired -// private MallOrderInfoMapper mallOrderInfoMapper; -// -// @Test -// public void directorProfitTest() { -// memberProfitService.storeAndDirectorProfit(new Date()); -// } -// -// @Autowired -// private MallOrderItemMapper mallOrderItemMapper; -// -// @Autowired -// private IMallAchieveService mallAchieveService; -// -// @Test -// public void achieveTest() { -// List<MallOrderItem> items = mallOrderItemMapper.selectList(null); -// for (MallOrderItem item : items) { -// mallAchieveService.add(item.getId()); -// } -// } -// -// @Test -// public void paramTest() { -// Map<String, Integer> map = new HashMap<>(); -// BigDecimal amount = new BigDecimal("100"); -// map.put("amount", 1); -// changeAmount(map); -// System.out.println(map.get("amount")); -// } -// -// public void changeAmount(Map<String, Integer> amount) { -// amount.put("amount", 2); -// } -// -// @Test -// public void scorePool(){ -// memberProfitService.scorePool(); -// } -// -// @Test -// public void staticProfit(){ -// memberProfitService.staticProfit(null); -// } -// -// @Autowired -// private OrderSettlementJob orderSettlementJob; -// -// @Test -// public void orderSettlementJobTest() { -//// orderSettlementJob.normalGoodsSettlementJob(); -// -// mallAchieveService.add(83L); -// } -// -// -// @Autowired -// private UnipayService unipayService; -// @Test -// public void unipay(){ -// UnipayDto unipayDto = new UnipayDto(); -// unipayDto.setAmount(new BigDecimal("0.01")); -// unipayDto.setFrpCode("ALIPAY_H5"); -// unipayDto.setTradeMerchantNo("777180800385820"); -//// unipayDto.setFrpCode("WEIXIN_APP3"); -// unipayDto.setOrderNo("2022082316415386395"); -// unipayDto.setProductName("洗护套装"); -// unipayService.unipay(unipayDto); -// } -// @Test -// public void getAgreeMentPaySms(){ -// AgreeMentPaySmsDto agreeMentPaySmsDto = new AgreeMentPaySmsDto(); -// agreeMentPaySmsDto.setOrderNo("2022082617305930328"); -// -// BigDecimal value = new BigDecimal("0.1").setScale(2, BigDecimal.ROUND_DOWN); -// DecimalFormat decimalFormat = new DecimalFormat("0.00#"); -// String strVal = decimalFormat.format(value); -// agreeMentPaySmsDto.setOrderAmount(new BigDecimal(strVal)); -// agreeMentPaySmsDto.setName("肖永"); -// agreeMentPaySmsDto.setCreatedTime(DateUtil.now()); -// agreeMentPaySmsDto.setIdType("1"); -// agreeMentPaySmsDto.setIdCardNum("430321199310113713"); -// agreeMentPaySmsDto.setBankNo("6222031901002389639"); -// agreeMentPaySmsDto.setPhone("15274802129"); -// String agreeMentPaySms = unipayService.getAgreeMentPaySms(agreeMentPaySmsDto); -// if("JS000000".equals(agreeMentPaySms)){ -// System.out.println("获取成功"); -// }else{ -// System.out.println(agreeMentPaySms); -// } -// } -// -// @Test -// public void agreementSign(){ -// AgreementSignDto agreementSignDto = new AgreementSignDto(); -// agreementSignDto.setOrderNo("2022082614465345250"); -// agreementSignDto.setSmsCode("841243"); -// unipayService.agreementSign(agreementSignDto); -// } -// -// @Test -// public void agreementPay(){ -// AgreementPayDto agreementPayDto = new AgreementPayDto(); -// agreementPayDto.setOrderNo("2022082614465345250"); -// -// BigDecimal value = new BigDecimal("0.1").setScale(2, BigDecimal.ROUND_DOWN); -// DecimalFormat decimalFormat = new DecimalFormat("0.00#"); -// String strVal = decimalFormat.format(value); -// agreementPayDto.setOrderAmount(new BigDecimal(strVal)); -// agreementPayDto.setOrderTime(DateUtil.now()); -// agreementPayDto.setOrderDesc("测试"); -// agreementPayDto.setBankNo("6222031901002389639"); -// unipayService.agreementPay(agreementPayDto); -// } -// -// @Test -// public void singlePay(){ -// /** -// * 调用汇聚代付 -// */ -// String orderNo = MallUtils.getOrderNum("W"); -// SinglePayDto singlePayDto = new SinglePayDto(); -// singlePayDto.setMerchantOrderNo(orderNo); -// singlePayDto.setReceiverAccountNoEncBankNo("6222031903210023839639"); -// singlePayDto.setReceiverAccountNoEncName("肖永"); -// singlePayDto.setReceiverAccountType("201"); -// BigDecimal paidAmount = new BigDecimal(1.00); -// singlePayDto.setPaidAmount(paidAmount); -// singlePayDto.setCurrency("201"); -// singlePayDto.setIsChecked("202"); -// singlePayDto.setPaidDesc("用户提现"); -// singlePayDto.setPaidUse("202"); -// String singlePayRep = unipayService.singlePay(singlePayDto); -// -// System.out.println(singlePayRep); -// } -} -- Gitblit v1.9.1