@Test public void testRaffle() throws Exception { }
@Async public static LotteryInfo raffle(NotificationPrizeMapper npMapper,CommodityMapper commMapper, CommoditysMapper commsMapper, OrdersMapper ordersMapper, LuckCodeTemplateMapper codesTemplateMapper, LuckCodesMapper luckCodesMapper, LotteryInfoMapper lotteryInfoMapper, UserMapper userMapper, Commoditys commodity) { Calendar calendar = Calendar.getInstance(); List<Orders> orderses = ordersMapper.selectByBuyDateDesc(); LotteryInfo lotteryInfo = new LotteryInfo(); long sumDate = 0; String subTime; JSONArray array = new JSONArray(); for (Orders orders : orderses) { Long buyDate = orders.getSubmitDate(); calendar.setTimeInMillis(buyDate); User user = userMapper.selectById(orders.getUserAccountId()); String date = formatDate(buyDate); subTime = substringTime(date); sumDate += Integer.valueOf(subTime); array.add(date + " " + subTime + " : " + user.getNickname()); } lotteryInfo.setCommodityId(commodity.getId()); lotteryInfo.setBuyNum(commodity.getBuyTotalNumber()); lotteryInfo.setLotteryInfo(array.toString()); lotteryInfo.setSumDate(sumDate); long lotteryId = (sumDate % commodity.getBuyTotalNumber()) + 10000001; lotteryInfo.setLotteryId(lotteryId); LuckCodeTemplate template = codesTemplateMapper.selectByCode(lotteryId + ""); LuckCodes codes = luckCodesMapper.selectBytemplate(template.getId(), commodity.getId()); lotteryInfo.setUserAccountId(codes.getUserAccountId()); UpdateTiming update = new UpdateTiming(npMapper,userMapper,commMapper, commsMapper, codesTemplateMapper, luckCodesMapper, lotteryInfoMapper, lotteryInfo); long endTime = commodity.getSellOutTime() + Settings.LOTTERY_ANNOUNCE_TIME_INTERVAL; endTime = endTime - System.currentTimeMillis(); endTime = endTime / 1000; System.out.println("延时--------------------->" + endTime+"秒开奖！"); DelayTask.execute(update, (int) endTime); return lotteryInfo; }
LotteryUtils { @Async public static LotteryInfo raffle(NotificationPrizeMapper npMapper,CommodityMapper commMapper, CommoditysMapper commsMapper, OrdersMapper ordersMapper, LuckCodeTemplateMapper codesTemplateMapper, LuckCodesMapper luckCodesMapper, LotteryInfoMapper lotteryInfoMapper, UserMapper userMapper, Commoditys commodity) { Calendar calendar = Calendar.getInstance(); List<Orders> orderses = ordersMapper.selectByBuyDateDesc(); LotteryInfo lotteryInfo = new LotteryInfo(); long sumDate = 0; String subTime; JSONArray array = new JSONArray(); for (Orders orders : orderses) { Long buyDate = orders.getSubmitDate(); calendar.setTimeInMillis(buyDate); User user = userMapper.selectById(orders.getUserAccountId()); String date = formatDate(buyDate); subTime = substringTime(date); sumDate += Integer.valueOf(subTime); array.add(date + " " + subTime + " : " + user.getNickname()); } lotteryInfo.setCommodityId(commodity.getId()); lotteryInfo.setBuyNum(commodity.getBuyTotalNumber()); lotteryInfo.setLotteryInfo(array.toString()); lotteryInfo.setSumDate(sumDate); long lotteryId = (sumDate % commodity.getBuyTotalNumber()) + 10000001; lotteryInfo.setLotteryId(lotteryId); LuckCodeTemplate template = codesTemplateMapper.selectByCode(lotteryId + ""); LuckCodes codes = luckCodesMapper.selectBytemplate(template.getId(), commodity.getId()); lotteryInfo.setUserAccountId(codes.getUserAccountId()); UpdateTiming update = new UpdateTiming(npMapper,userMapper,commMapper, commsMapper, codesTemplateMapper, luckCodesMapper, lotteryInfoMapper, lotteryInfo); long endTime = commodity.getSellOutTime() + Settings.LOTTERY_ANNOUNCE_TIME_INTERVAL; endTime = endTime - System.currentTimeMillis(); endTime = endTime / 1000; System.out.println("延时--------------------->" + endTime+"秒开奖！"); DelayTask.execute(update, (int) endTime); return lotteryInfo; } }
LotteryUtils { @Async public static LotteryInfo raffle(NotificationPrizeMapper npMapper,CommodityMapper commMapper, CommoditysMapper commsMapper, OrdersMapper ordersMapper, LuckCodeTemplateMapper codesTemplateMapper, LuckCodesMapper luckCodesMapper, LotteryInfoMapper lotteryInfoMapper, UserMapper userMapper, Commoditys commodity) { Calendar calendar = Calendar.getInstance(); List<Orders> orderses = ordersMapper.selectByBuyDateDesc(); LotteryInfo lotteryInfo = new LotteryInfo(); long sumDate = 0; String subTime; JSONArray array = new JSONArray(); for (Orders orders : orderses) { Long buyDate = orders.getSubmitDate(); calendar.setTimeInMillis(buyDate); User user = userMapper.selectById(orders.getUserAccountId()); String date = formatDate(buyDate); subTime = substringTime(date); sumDate += Integer.valueOf(subTime); array.add(date + " " + subTime + " : " + user.getNickname()); } lotteryInfo.setCommodityId(commodity.getId()); lotteryInfo.setBuyNum(commodity.getBuyTotalNumber()); lotteryInfo.setLotteryInfo(array.toString()); lotteryInfo.setSumDate(sumDate); long lotteryId = (sumDate % commodity.getBuyTotalNumber()) + 10000001; lotteryInfo.setLotteryId(lotteryId); LuckCodeTemplate template = codesTemplateMapper.selectByCode(lotteryId + ""); LuckCodes codes = luckCodesMapper.selectBytemplate(template.getId(), commodity.getId()); lotteryInfo.setUserAccountId(codes.getUserAccountId()); UpdateTiming update = new UpdateTiming(npMapper,userMapper,commMapper, commsMapper, codesTemplateMapper, luckCodesMapper, lotteryInfoMapper, lotteryInfo); long endTime = commodity.getSellOutTime() + Settings.LOTTERY_ANNOUNCE_TIME_INTERVAL; endTime = endTime - System.currentTimeMillis(); endTime = endTime / 1000; System.out.println("延时--------------------->" + endTime+"秒开奖！"); DelayTask.execute(update, (int) endTime); return lotteryInfo; }  }
LotteryUtils { @Async public static LotteryInfo raffle(NotificationPrizeMapper npMapper,CommodityMapper commMapper, CommoditysMapper commsMapper, OrdersMapper ordersMapper, LuckCodeTemplateMapper codesTemplateMapper, LuckCodesMapper luckCodesMapper, LotteryInfoMapper lotteryInfoMapper, UserMapper userMapper, Commoditys commodity) { Calendar calendar = Calendar.getInstance(); List<Orders> orderses = ordersMapper.selectByBuyDateDesc(); LotteryInfo lotteryInfo = new LotteryInfo(); long sumDate = 0; String subTime; JSONArray array = new JSONArray(); for (Orders orders : orderses) { Long buyDate = orders.getSubmitDate(); calendar.setTimeInMillis(buyDate); User user = userMapper.selectById(orders.getUserAccountId()); String date = formatDate(buyDate); subTime = substringTime(date); sumDate += Integer.valueOf(subTime); array.add(date + " " + subTime + " : " + user.getNickname()); } lotteryInfo.setCommodityId(commodity.getId()); lotteryInfo.setBuyNum(commodity.getBuyTotalNumber()); lotteryInfo.setLotteryInfo(array.toString()); lotteryInfo.setSumDate(sumDate); long lotteryId = (sumDate % commodity.getBuyTotalNumber()) + 10000001; lotteryInfo.setLotteryId(lotteryId); LuckCodeTemplate template = codesTemplateMapper.selectByCode(lotteryId + ""); LuckCodes codes = luckCodesMapper.selectBytemplate(template.getId(), commodity.getId()); lotteryInfo.setUserAccountId(codes.getUserAccountId()); UpdateTiming update = new UpdateTiming(npMapper,userMapper,commMapper, commsMapper, codesTemplateMapper, luckCodesMapper, lotteryInfoMapper, lotteryInfo); long endTime = commodity.getSellOutTime() + Settings.LOTTERY_ANNOUNCE_TIME_INTERVAL; endTime = endTime - System.currentTimeMillis(); endTime = endTime / 1000; System.out.println("延时--------------------->" + endTime+"秒开奖！"); DelayTask.execute(update, (int) endTime); return lotteryInfo; }  @Async static LotteryInfo raffle(NotificationPrizeMapper npMapper,CommodityMapper commMapper, CommoditysMapper commsMapper, OrdersMapper ordersMapper, LuckCodeTemplateMapper codesTemplateMapper, LuckCodesMapper luckCodesMapper, LotteryInfoMapper lotteryInfoMapper, UserMapper userMapper, Commoditys commodity); }
LotteryUtils { @Async public static LotteryInfo raffle(NotificationPrizeMapper npMapper,CommodityMapper commMapper, CommoditysMapper commsMapper, OrdersMapper ordersMapper, LuckCodeTemplateMapper codesTemplateMapper, LuckCodesMapper luckCodesMapper, LotteryInfoMapper lotteryInfoMapper, UserMapper userMapper, Commoditys commodity) { Calendar calendar = Calendar.getInstance(); List<Orders> orderses = ordersMapper.selectByBuyDateDesc(); LotteryInfo lotteryInfo = new LotteryInfo(); long sumDate = 0; String subTime; JSONArray array = new JSONArray(); for (Orders orders : orderses) { Long buyDate = orders.getSubmitDate(); calendar.setTimeInMillis(buyDate); User user = userMapper.selectById(orders.getUserAccountId()); String date = formatDate(buyDate); subTime = substringTime(date); sumDate += Integer.valueOf(subTime); array.add(date + " " + subTime + " : " + user.getNickname()); } lotteryInfo.setCommodityId(commodity.getId()); lotteryInfo.setBuyNum(commodity.getBuyTotalNumber()); lotteryInfo.setLotteryInfo(array.toString()); lotteryInfo.setSumDate(sumDate); long lotteryId = (sumDate % commodity.getBuyTotalNumber()) + 10000001; lotteryInfo.setLotteryId(lotteryId); LuckCodeTemplate template = codesTemplateMapper.selectByCode(lotteryId + ""); LuckCodes codes = luckCodesMapper.selectBytemplate(template.getId(), commodity.getId()); lotteryInfo.setUserAccountId(codes.getUserAccountId()); UpdateTiming update = new UpdateTiming(npMapper,userMapper,commMapper, commsMapper, codesTemplateMapper, luckCodesMapper, lotteryInfoMapper, lotteryInfo); long endTime = commodity.getSellOutTime() + Settings.LOTTERY_ANNOUNCE_TIME_INTERVAL; endTime = endTime - System.currentTimeMillis(); endTime = endTime / 1000; System.out.println("延时--------------------->" + endTime+"秒开奖！"); DelayTask.execute(update, (int) endTime); return lotteryInfo; }  @Async static LotteryInfo raffle(NotificationPrizeMapper npMapper,CommodityMapper commMapper, CommoditysMapper commsMapper, OrdersMapper ordersMapper, LuckCodeTemplateMapper codesTemplateMapper, LuckCodesMapper luckCodesMapper, LotteryInfoMapper lotteryInfoMapper, UserMapper userMapper, Commoditys commodity);  }