|
@@ -1649,67 +1649,6 @@ public class ClubServiceImpl implements ClubService {
|
|
|
// 6.优惠券可用数量
|
|
|
Integer couponNum = clubMapper.getUserCouponCount(userId);
|
|
|
result.put("couponNum", couponNum);
|
|
|
- // 7.今日推荐
|
|
|
- int floorId = 6;
|
|
|
- int index = 1;
|
|
|
- String homeAdvertiseKey = "user_advertise_" + floorId;
|
|
|
- if (!redisService.exists(homeAdvertiseKey)) {
|
|
|
- AdvertiseVo homePageAdvertise = new AdvertiseVo();
|
|
|
- homePageAdvertise.setAdvertiseTypeId(1001);
|
|
|
- homePageAdvertise.setTypeId(floorId);
|
|
|
- homePageAdvertise.setValidFlag("1");
|
|
|
- List<AdvertiseVo> list = clubMapper.getUserAdvertiseList(homePageAdvertise);
|
|
|
- for (AdvertiseVo advertise : list) {
|
|
|
- advertise.setImage(ImageUtils.getImageURL("homePageImages", advertise.getImage(), 0, wwwDomain));
|
|
|
- }
|
|
|
- redisService.setList(homeAdvertiseKey, list);
|
|
|
- }
|
|
|
- int pageSize = 4;
|
|
|
- int totalRecord = (int) redisService.listSize(homeAdvertiseKey);
|
|
|
- int total = totalRecord % pageSize == 0 ? totalRecord / pageSize : totalRecord / pageSize + 1;
|
|
|
- if (index > total) {
|
|
|
- index = index % total;
|
|
|
- }
|
|
|
- int begin = (index - 1) * pageSize;
|
|
|
- int end = index * pageSize - 1;
|
|
|
- //避免unchecked cast warning
|
|
|
- List<AdvertiseVo> list = new ArrayList<>();
|
|
|
- Object advertiseObj = redisService.getList(homeAdvertiseKey, begin, end);
|
|
|
- if (advertiseObj instanceof ArrayList<?>) {
|
|
|
- for (Object o : (List<?>) advertiseObj) {
|
|
|
- list.add((AdvertiseVo) o);
|
|
|
- }
|
|
|
- }
|
|
|
- result.put("homePageAdvertiseList", list);
|
|
|
- // 8.最新动态
|
|
|
- String informationKey = "home_info_" + floorId;
|
|
|
- redisService.remove(informationKey);
|
|
|
- if (!redisService.exists(informationKey)) {
|
|
|
- InformationVo info = new InformationVo();
|
|
|
- info.setInfoTypeId(1);
|
|
|
- info.setValidFlag("1");
|
|
|
- List<InformationVo> infoList = clubMapper.getInformationList(info);
|
|
|
- infoList.forEach(information -> information.setLink("/info/detail-" + information.getInformationId() + "-1.html"));
|
|
|
- redisService.setList(informationKey, infoList);
|
|
|
- }
|
|
|
- int infoIndex = 1;
|
|
|
- int infoPageSize = 5;
|
|
|
- int totalInfoRecord = (int) redisService.listSize(informationKey);
|
|
|
- int totalInfo = totalInfoRecord % infoPageSize == 0 ? totalInfoRecord / infoPageSize : totalInfoRecord / infoPageSize + 1;
|
|
|
- if (infoIndex > totalInfo) {
|
|
|
- infoIndex = infoIndex % totalInfo;
|
|
|
- }
|
|
|
- int infoBegin = (infoIndex - 1) * infoPageSize;
|
|
|
- int infoEnd = infoIndex * infoPageSize - 1;
|
|
|
- List<InformationVo> infoList = new ArrayList<>();
|
|
|
- Object infoObj = redisService.getList(informationKey, infoBegin, infoEnd);
|
|
|
- if (infoObj instanceof ArrayList<?>) {
|
|
|
- for (Object o : (List<?>) infoObj) {
|
|
|
- infoList.add((InformationVo) o);
|
|
|
- }
|
|
|
- }
|
|
|
- result.put("homePageInfoList", infoList);
|
|
|
-
|
|
|
return ResponseJson.success(result);
|
|
|
}
|
|
|
|