| | |
| | | daTaoKeGoodsDetailV2Dao.save(v2);
|
| | | }
|
| | |
|
| | | private List<DaTaoKeDetailV2> getDefaultDingDongQiang() {
|
| | | // 按更新时间加
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_TIME, null);
|
| | | if (result != null && result.getGoodsList().size() > 0) {
|
| | | List<DaTaoKeDetailV2> finalList = new ArrayList<>();
|
| | | Collections.shuffle(result.getGoodsList());
|
| | | finalList.addAll(result.getGoodsList().subList(0,
|
| | | result.getGoodsList().size() > 8 ? 8 : result.getGoodsList().size()));
|
| | | for (DaTaoKeDetailV2 detail : finalList) {
|
| | | detail.setCouponReceiveNum(detail.getCouponTotalNum() - (int) (200 + Math.random() * 1000));
|
| | | if (detail.getCouponTotalNum() - detail.getCouponReceiveNum() <= 0)
|
| | | detail.setCouponReceiveNum(detail.getCouponTotalNum());
|
| | | }
|
| | | return finalList;
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "daTaoKeGoodsCache", key = "'getDingDongQiangData-'+#time")
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> getDingDongQiangData(String time) {
|
| | | List<DingDongQiangDTO> list = getDingDongQiangData();
|
| | | if (list == null)
|
| | | return null;
|
| | | if (list == null || list.size() == 0) {
|
| | | return getDefaultDingDongQiang();
|
| | | }
|
| | |
|
| | | Map<String, DingDongQiangDTO> map = new HashMap<>();
|
| | | for (DingDongQiangDTO dto : list)
|
| | | map.put(dto.getTime(), dto);
|
| | |
| | | detail.setCouponReceiveNum(detail.getCouponTotalNum());
|
| | | }
|
| | | return finalList;
|
| | | } else {
|
| | | return getDefaultDingDongQiang();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|