| | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.CharsetUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.crypto.asymmetric.KeyType; |
| | | import cn.hutool.crypto.asymmetric.RSA; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.jline.utils.Log; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.security.KeyPair; |
| | | import java.text.DecimalFormat; |
| | | import java.text.Format; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | private DappWalletService dappWalletService; |
| | | @Test |
| | | public void testProfitSharing(){ |
| | | IgtOnHookPlanOrder igtOnHookPlanOrder = igtOnHookPlanOrderDao.selectById(125L); |
| | | IgtOnHookPlanOrder igtOnHookPlanOrder = igtOnHookPlanOrderDao.selectById(129L); |
| | | Long orderId = igtOnHookPlanOrder.getId(); |
| | | Long memberId = igtOnHookPlanOrder.getMemberId(); |
| | | BigDecimal planAmount = igtOnHookPlanOrder.getPlanAmount(); |
| | |
| | | String refererIds = dappMemberEntity.getRefererIds(); |
| | | List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true); |
| | | //生成流水佣金和盈利分成和流水记录,返回剩余盈利 |
| | | totalProfit = dappWalletService.updateLSYJYLFC(refererIdList, totalProfit); |
| | | System.out.println("流水佣金和盈利分成"+totalProfit); |
| | | BigDecimal profitSharingTotal = dappWalletService.updateLSYJYLFC(refererIdList, totalProfit); |
| | | System.out.println("流水佣金和盈利分成"+profitSharingTotal); |
| | | //平台分成,返回剩余盈利 |
| | | totalProfit = dappWalletService.updatePTFC(memberId,totalProfit); |
| | | System.out.println("平台分成"+totalProfit); |
| | | BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,totalProfit); |
| | | System.out.println("平台分成"+systemTotal); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Test |
| | | public void createAwardInfo(){ |
| | | Log.info("挂机开奖记录"); |
| | | /** |
| | | * 每天跑一次,直接生成全部的记录 |
| | | * 产生中奖记录 |
| | | */ |
| | | //每天开奖次数 288次 |
| | | DateTime date = DateUtil.date(); |
| | | |
| | | String aWardTime = DateUtil.format(date, "yyyy-MM-dd"); |
| | | DateTime aWardTimeStart = DateUtil.parseDateTime(aWardTime + " 00:00:00"); |
| | | // DateTime dateTime = DateUtil.offsetMinute(aWardTimeStart, 5); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | String yyyyMMdd = sdf.format(date); |
| | | QueryWrapper<DappOnHookAward> dappOnHookAwardQueryWrapper = new QueryWrapper(); |
| | | dappOnHookAwardQueryWrapper.like("record_num",yyyyMMdd); |
| | | Integer selectCount = dappOnHookAwardDao.selectCount(dappOnHookAwardQueryWrapper); |
| | | if(0 == selectCount){ |
| | | Format formatCount = new DecimalFormat("000"); |
| | | //一般都是将累加的数字当做一些单号的一部分,format要求string |
| | | int dayMillise = (24 * 60) / 5; |
| | | for(int i= 1;i <= dayMillise;i++){ |
| | | DappOnHookAward dappOnHookAward = new DappOnHookAward(); |
| | | int randomInt = RandomUtil.randomInt(10000, 99999); |
| | | dappOnHookAward.setAwardNum(Integer.toString(randomInt)); |
| | | dappOnHookAward.setState(2); |
| | | String str = formatCount.format(i); |
| | | dappOnHookAward.setRecordNum(yyyyMMdd+str); |
| | | dappOnHookAward.setAwardTime(aWardTimeStart); |
| | | dappOnHookAwardDao.insert(dappOnHookAward); |
| | | aWardTimeStart = DateUtil.offsetMinute(aWardTimeStart, 5); |
| | | } |
| | | } |
| | | |
| | | DateTime tomorrow = DateUtil.tomorrow(); |
| | | String tomorrowTime = DateUtil.format(tomorrow, "yyyy-MM-dd"); |
| | | DateTime tomorrowTimeStart = DateUtil.parseDateTime(tomorrowTime + " 00:00:00"); |
| | | // DateTime dateTime = DateUtil.offsetMinute(aWardTimeStart, 5); |
| | | String tomorrowYyyyMMdd = sdf.format(tomorrow); |
| | | QueryWrapper<DappOnHookAward> tomorrowYyyyMMddWrapper = new QueryWrapper(); |
| | | tomorrowYyyyMMddWrapper.like("record_num",tomorrowYyyyMMdd); |
| | | Integer tomorrowSelectCount = dappOnHookAwardDao.selectCount(tomorrowYyyyMMddWrapper); |
| | | if(0 == tomorrowSelectCount){ |
| | | Format formatCount = new DecimalFormat("000"); |
| | | //一般都是将累加的数字当做一些单号的一部分,format要求string |
| | | int dayMilliseT = (24 * 60) / 5; |
| | | for(int i= 1;i <= dayMilliseT;i++){ |
| | | DappOnHookAward dappOnHookAward = new DappOnHookAward(); |
| | | int randomInt = RandomUtil.randomInt(10000, 99999); |
| | | dappOnHookAward.setAwardNum(Integer.toString(randomInt)); |
| | | dappOnHookAward.setState(2); |
| | | String str = formatCount.format(i); |
| | | dappOnHookAward.setRecordNum(tomorrowYyyyMMdd+str); |
| | | dappOnHookAward.setAwardTime(tomorrowTimeStart); |
| | | dappOnHookAwardDao.insert(dappOnHookAward); |
| | | tomorrowTimeStart = DateUtil.offsetMinute(tomorrowTimeStart, 5); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | } |