| | |
| | | import com.yeshi.fanli.entity.bus.recommend.Honest;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendBanner;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendBannerV2;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSection;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | | 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.SuperRecommendSection;
|
| | | 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;
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendBannerService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendBannerService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendBannerV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendSectionService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendSpecialService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.factory.MonitorFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoCouponUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | |
| | | private SuperRecommendBannerService superRecommendBannerService;
|
| | |
|
| | | @Resource
|
| | | private SuperRecommendSectionService superRecommendSectionService;
|
| | |
|
| | | @Resource
|
| | | private SuperRecommendSpecialService superRecommendSpecialService;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionGoodsService recommendSectionGoodsService;
|
| | |
|
| | | @Resource
|
| | | private OrderService orderService;
|
| | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @RequestMapping(value = "getrecommendsection")
|
| | | public void getRecommendSection(AcceptData acceptData, int index, PrintWriter out) {
|
| | |
|
| | | if (index < 0) {
|
| | | index = 0;
|
| | | }
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | | List<SuperRecommendSection> superRecommendSectionList = superRecommendSectionService
|
| | | .getSuperRecommendSectionBySystemId(system.getId());
|
| | | List<RecommendSection> recommendSectionList = null;
|
| | | for (SuperRecommendSection superRecommendSection : superRecommendSectionList) {
|
| | | if (recommendSectionList == null) {
|
| | | recommendSectionList = new ArrayList<RecommendSection>();
|
| | | }
|
| | | RecommendSection recommendSection = superRecommendSection.getRecommendSection();
|
| | |
|
| | | // 暂时改变淘特价的跳转地址
|
| | | if (system.getId() == 7) {
|
| | | recommendSection.setJumpUrl(recommendSection.getJumpUrl().replace("column.html", "column_ttj.html"));
|
| | | }
|
| | |
|
| | | recommendSectionList.add(recommendSection);
|
| | | }
|
| | | if (recommendSectionList == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "暂无数据"));
|
| | | return;
|
| | | }
|
| | | Utils.sort(recommendSectionList);
|
| | | int size = recommendSectionList.size();
|
| | |
|
| | | List<RecommendSectionGoods> recommendSectionGoodsList = null;
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", size);
|
| | | JSONArray dataArr = new JSONArray();
|
| | | JSONObject validData = null;
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | Map<Long, List<RecommendSectionGoods>> map = recommendSectionGoodsService.getAllSectionGoodsMap();
|
| | | for (int i = 0; i < size; i++) {
|
| | | validData = new JSONObject();
|
| | | RecommendSection recommendSection = recommendSectionList.get(i);
|
| | | recommendSectionGoodsList = map.get(recommendSection.getId());
|
| | | if (recommendSectionGoodsList == null) {
|
| | | continue;
|
| | | }
|
| | | Utils.sort(recommendSectionGoodsList);
|
| | | if (recommendSection.getCounts() < recommendSectionGoodsList.size()) {
|
| | | recommendSectionGoodsList = recommendSectionGoodsList.subList(0, recommendSection.getCounts());
|
| | | }
|
| | | validData.put("count", recommendSectionGoodsList.size());
|
| | | validData.put("recommendSection", gson.toJson(recommendSection));
|
| | |
|
| | | // 替换TaoBaoGoodsBrief
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson2 = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
|
| | | for (RecommendSectionGoods rss : recommendSectionGoodsList) {
|
| | | JSONObject obj = JSONObject.fromObject(gson2.toJson(rss));
|
| | | String json = gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(
|
| | | gson2.fromJson(obj.optJSONObject("taoBaoGoodsBrief").toString(), TaoBaoGoodsBrief.class),
|
| | | proportion.toString(), ""));
|
| | | obj.put("taoBaoGoodsBrief", json);
|
| | | array.add(obj);
|
| | | }
|
| | |
|
| | | validData.put("recommendSectionGoodsList", array);
|
| | | dataArr.add(validData);
|
| | | }
|
| | | data.put("data", dataArr);
|
| | |
|
| | | String result = JsonUtil.loadTrueResult(data);
|
| | | if (Constant.IS_OUTNET)
|
| | | redisManager.cacheCommonString("client-api-getRecommendSection", result, 3 * 60);
|
| | |
|
| | | out.print(result);
|
| | | return;
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getHonestList")
|
| | | public void getHonestList(AcceptData acceptData, PrintWriter out) {
|
| | |
| | |
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | recommendSectionGoodsService.deleteRecommendSectionGoodsByTbAuctionId(Long.parseLong(id));
|
| | | }
|
| | | });
|
| | | }
|
| | | long end = java.lang.System.currentTimeMillis();
|
| | | java.lang.System.out.println("耗时:" + (end - begin));
|
| | |
| | | goodsList.add(gds);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 需要另做推荐
|
| | | if (goodsList.size() < 6) {
|
| | | List<RecommendSectionGoods> list = recommendSectionGoodsService.getSectionGoods(10);
|
| | | if (list != null)
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (goodsList.size() < 6)
|
| | | goodsList.add(list.get(i).getTaoBaoGoodsBrief());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|