From dc20bf7713654341d994d568bc0b55cfd5c23614 Mon Sep 17 00:00:00 2001 From: yujian <yujian> Date: 星期五, 29 三月 2019 10:56:33 +0800 Subject: [PATCH] 免单券退回时间 改为10分钟 --- fanli/src/main/java/com/yeshi/fanli/controller/client/RecommendController.java | 191 ++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 153 insertions(+), 38 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/RecommendController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/RecommendController.java index 1b07d91..5f52b1f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/RecommendController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/RecommendController.java @@ -38,7 +38,6 @@ import com.yeshi.fanli.entity.bus.recommend.RecommendBannerV2; import com.yeshi.fanli.entity.bus.recommend.RecommendSpecial; import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendBanner; -import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendBannerV2; import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendSpecial; import com.yeshi.fanli.entity.bus.user.Order; import com.yeshi.fanli.entity.bus.user.ShamUser; @@ -117,8 +116,6 @@ @RequestMapping("api/v1/user") public class RecommendController { - @Resource - private RecommendBannerService recommendService; @Resource private BusinessSystemService businessSystemService; @@ -144,8 +141,6 @@ @Resource private UserInfoService userInfoService; - @Resource - private TaoBaoOrderUtil taoBaoOrderUtil; @Resource private TaoBaoCouponService taoBaoCouponService; @@ -158,9 +153,6 @@ @Resource private CollectionGoodsV2Service collectionGoodsV2Service; - - @Resource - private HongBaoManageMapper hongBaoManageMapper; @Resource private TaoBaoGoodsBriefService taoBaoGoodsBriefService; @@ -404,25 +396,28 @@ if (!"1".equals(version) && "android".equalsIgnoreCase(acceptData.getPlatform())) { jumpDetail = jumpDetailService.getlastJumpDetailCache(); } + List<RecommendSpecial> recommendSpecialList = null; + List<SuperRecommendSpecial> superRecommendSpecialList = superRecommendSpecialService .getSuperRecommendSpecialBySystemId(system.getId()); + if (superRecommendSpecialList != null && superRecommendSpecialList.size() > 0) { - List<RecommendSpecial> recommendSpecialList = null; - for (SuperRecommendSpecial superRecommendSpecial : superRecommendSpecialList) { - if (recommendSpecialList == null) { - recommendSpecialList = new ArrayList<RecommendSpecial>(); + recommendSpecialList = new ArrayList<RecommendSpecial>(); + + for (SuperRecommendSpecial superRecommendSpecial : superRecommendSpecialList) { + RecommendSpecial recommendSpecial = superRecommendSpecial.getRecommendSpecial(); + if (jumpDetail != null) { + recommendSpecial.setJumpDetail(jumpDetail); + } + recommendSpecialList.add(recommendSpecial); } - RecommendSpecial recommendSpecial = superRecommendSpecial.getRecommendSpecial(); - if (jumpDetail != null) { - recommendSpecial.setJumpDetail(jumpDetail); - } - recommendSpecialList.add(recommendSpecial); } if (recommendSpecialList == null || recommendSpecialList.size() == 0) { out.print(JsonUtil.loadFalseResult(1, "鏆傛棤鏁版嵁")); return; } + JSONObject data = new JSONObject(); data.put("count", recommendSpecialList.size()); Gson gson = new Gson(); @@ -1307,7 +1302,7 @@ for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) { if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null && goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0 - && goods.getBiz30day() > 1000) + && goods.getBiz30day() > 1000 && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) goodsList.add(goods); } try { @@ -1368,26 +1363,8 @@ } // 棣栭〉Banner - List<RecommendBannerV2> listBanner = null; - - List<SuperRecommendBannerV2> listRecommendBanner = superRecommendBannerV2Service - .getSuperRecommendBannerV2sBySystem(system); - - if (listRecommendBanner != null && listRecommendBanner.size() > 0) { - - listBanner = new ArrayList<RecommendBannerV2>(); - - for (SuperRecommendBannerV2 superRecommendBanner : listRecommendBanner) { - RecommendBannerV2 recommendBanner = superRecommendBanner.getRecommendBanner(); - // 娣樼壒浠锋殏鏃朵慨鏀� - if (system.getId() == 7) { - recommendBanner.getJumpDetail().setActivity(recommendBanner.getJumpDetail().getActivity() - .replace("com.yeshi.ec.rebate.myapplication", "com.yeshi.ec.taospecial")); - } - - listBanner.add(recommendBanner); - } - } + List<RecommendBannerV2> listBanner = superRecommendBannerV2Service + .getSuperRecommendBannerV2sBySystem(system.getId()); JSONObject root = new JSONObject(); root.put("banner", listBanner); @@ -1585,6 +1562,144 @@ } + + /** + * 鏂扮増鎺ㄨ崘涓撻绠$悊(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) * -- Gitblit v1.8.0