| | |
| | | package com.yeshi.fanli.service.impl.taobao.dataoke;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | |
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods() {
|
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int page) {
|
| | | Map<Long, DaTaoKeDetailV2> map = new HashMap<>();
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Dao.listPreShareHotGoods(20, "monthSales");
|
| | | List<DaTaoKeDetailV2> list = daTaoKeGoodsDetailV2Dao.listPreShareHotGoods((page - 1) * Constant.PAGE_SIZE,
|
| | | Constant.PAGE_SIZE, "monthSales");
|
| | | System.out.println(list);
|
| | | list.addAll(daTaoKeGoodsDetailV2Dao.listPreShareHotGoods(20, "twoHoursSales"));
|
| | | list.addAll(daTaoKeGoodsDetailV2Dao.listPreShareHotGoods(20, "dailySales"));
|
| | | for (DaTaoKeDetailV2 v2 : list) {
|
| | | map.put(v2.getId(), v2);
|
| | | }
|
| | |
|
| | | List<DaTaoKeDetailV2> finalList = new ArrayList<>();
|
| | | for (Iterator<Long> its = map.keySet().iterator(); its.hasNext();) {
|
| | | finalList.add(map.get(its.next()));
|
| | | DaTaoKeDetailV2 v2 = map.get(its.next());
|
| | | Date time = new Date(TimeUtil.convertToTimeTemp(v2.getCouponEndTime(), "yyyy-MM-dd HH:mm:ss"));
|
| | | Date targetTime = new Date(TimeUtil.convertToTimeTemp(
|
| | | TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 2L, "yyyy-MM-dd"),
|
| | | "yyyy-MM-dd") - 1000L);
|
| | | if (time.getTime() >= targetTime.getTime())
|
| | | finalList.add(v2);
|
| | | }
|
| | |
|
| | | Comparator<DaTaoKeDetailV2> cm = new Comparator<DaTaoKeDetailV2>() {
|
| | |
| | | return finalList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> listPreTLJBuyGoods(int page) {
|
| | | if (page == 1) {
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_DAY, null);
|
| | | List<DaTaoKeDetailV2> goodsList = new ArrayList<>();
|
| | | for (DaTaoKeDetailV2 v2 : result.getGoodsList()) {
|
| | | BigDecimal commision = MoneyBigDecimalUtil
|
| | | .div(MoneyBigDecimalUtil.mul(v2.getActualPrice(), v2.getCommissionRate()), new BigDecimal(100));
|
| | | if (commision.multiply(new BigDecimal("0.7")).compareTo(new BigDecimal("1.01")) >= 0)
|
| | | goodsList.add(v2);
|
| | | }
|
| | | return goodsList;
|
| | | } else
|
| | | return new ArrayList<>();
|
| | | }
|
| | |
|
| | | }
|