| | |
| | | @RequestMapping("api/v1/user")
|
| | | public class RecommendController {
|
| | |
|
| | | @Resource
|
| | | private RecommendBannerService recommendService;
|
| | |
|
| | | @Resource
|
| | | private BusinessSystemService businessSystemService;
|
| | |
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoOrderUtil taoBaoOrderUtil;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoCouponService taoBaoCouponService;
|
| | |
| | |
|
| | | @Resource
|
| | | private CollectionGoodsV2Service collectionGoodsV2Service;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageMapper hongBaoManageMapper;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 新版推荐专题管理(1.5.3)
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRecommendIndex")
|
| | | public void getRecommendIndex(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 轮播图
|
| | | List<SwiperPicture> swiperList = null;
|
| | | try {
|
| | | swiperList = swiperPictureService.getByBannerCard("weex_index");
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (swiperList == null) {
|
| | | swiperList = new ArrayList<SwiperPicture>();
|
| | | }
|
| | | |
| | | |
| | | Special miaoShaSpecial = null;
|
| | | // 两行圆形专题
|
| | | List<Special> arcList = new ArrayList<Special>();
|
| | | |
| | | // 活动列表
|
| | | List<Special> activityList = new ArrayList<Special>();
|
| | | |
| | | // 方块部分
|
| | | List<Special> blockList = new ArrayList<Special>();
|
| | | |
| | | |
| | | try {
|
| | | List<Special> listSpecial = specialService.listBySystemAndCard("index", system.getId());
|
| | |
|
| | | if (listSpecial != null && listSpecial.size() > 0) {
|
| | | for (Special special : listSpecial) {
|
| | |
|
| | | if ("限时秒杀".equals(special.getName())) {
|
| | | miaoShaSpecial = special;
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (Special.SHOWTYPE_ARC.equals(special.getShowType())) {
|
| | | // 两行圆形专题
|
| | | arcList.add(special);
|
| | | } else if (Special.SHOWTYPE_BLOCK.equals(special.getShowType())) {
|
| | | // 方块部分
|
| | | blockList.add(special);
|
| | | } else if (Special.SHOWTYPE_ACTIVITY.equals(special.getShowType())) {
|
| | | // 动态
|
| | | activityList.add(special);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | |
|
| | | /* 限时秒杀 - 时间处理 */
|
| | | JSONObject msJSON = JSONObject.fromObject(new Gson().toJson(miaoShaSpecial));
|
| | | if (miaoShaSpecial != null) {
|
| | | // 获取秒杀
|
| | | int[] hours = new int[] { 0, 9, 12, 14, 16, 20, 22 };
|
| | | int hour = -1;
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(Long.parseLong(acceptData.getTime()));
|
| | | int nowHour = calendar.get(Calendar.HOUR_OF_DAY);
|
| | | for (int i = 0; i < hours.length - 1; i++) {
|
| | | if (nowHour >= hours[i] && nowHour < hours[i + 1]) {
|
| | | hour = hours[i + 1];
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (hour < 0)
|
| | | hour = 24;
|
| | | long time = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(calendar.getTimeInMillis(), "yyyy-MM-dd"),
|
| | | "yyyy-MM-dd") + 1000 * 60 * 60 * hour;
|
| | | msJSON.put("time", time);
|
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("swiperList", JsonUtil.getApiCommonGson().toJson(swiperList));
|
| | | root.put("arcList", JsonUtil.getApiCommonGson().toJson(arcList));
|
| | | root.put("activityList", JsonUtil.getApiCommonGson().toJson(activityList));
|
| | | root.put("blockList", JsonUtil.getApiCommonGson().toJson(blockList));
|
| | | root.put("miaoSha", msJSON);
|
| | |
|
| | | // 增加邀请有奖
|
| | | JSONObject invite = new JSONObject();
|
| | | JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("invite");
|
| | | invite.put("jumpDetail", jumpDetail);
|
| | | invite.put("picture", configService.get("home_invite_banner"));
|
| | |
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
|
| | | // 如果IOS当前版本处于审核状态就不返回
|
| | | } else {
|
| | |
|
| | | // 按照版本返回,版本覆盖足够后可删除
|
| | | if (("android".equalsIgnoreCase(acceptData.getPlatform()) && Integer.parseInt(acceptData.getVersion()) > 30)
|
| | | || ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && Integer.parseInt(acceptData.getVersion()) > 37)) {
|
| | | if (uid != null) {
|
| | | try {
|
| | | UserSettingsVO vo = userCustomSettingsService.getMySettings(uid);
|
| | | if (vo == null || vo.getNoInvitationBonus() == null || vo.getNoInvitationBonus() == 0)// 没有关闭邀请
|
| | | root.put("invite", invite);
|
| | | } catch (UserCustomSettingsException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | } else
|
| | | root.put("invite", invite);
|
| | | }
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | |
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 商品基本详情 (1.4.0)
|
| | | *
|