| | |
| | | package com.yeshi.fanli.controller.client.v2;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.dto.ConfigParamsDTO;
|
| | | import com.yeshi.fanli.dto.dataoke.DingDongTime;
|
| | | import com.yeshi.goods.facade.dto.taobao.dataoke.DingDongTime;
|
| | | import com.yeshi.fanli.dto.jd.JDSearchResult;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.Special;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.goods.facade.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.pdd.PDDGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.goods.facade.service.DaTaoKeGoodsDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisKeyEnum;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.common.entity.PageEntity;
|
| | | import com.yeshi.fanli.util.*;
|
| | | import com.yeshi.fanli.util.factory.MonitorFactory;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
|
| | |
| | | import com.yeshi.fanli.vo.goods.OtherInfo;
|
| | | import com.yeshi.fanli.vo.goods.SpikeTimeVO;
|
| | | import com.yeshi.fanli.vo.homemodule.BannerVO;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.common.vo.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.search.SearchKeyTOPVO;
|
| | | import com.yeshi.fanli.vo.search.SearchKeyVO;
|
| | | import com.yeshi.fanli.vo.tlj.ReduceHongBao;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.TimeUtil;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("api/v2/recommend")
|
| | |
| | | public void getRecommendIndex(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | try {
|
| | | // 获取设备定义性别
|
| | | int deviceSex = deviceSexService.getDeviceSex(acceptData.getDevice());
|
| | | int deviceSex = deviceSexService.getDeviceSex(acceptData.getDevice(),acceptData.getSystem());
|
| | |
|
| | | // 1、专题模块
|
| | | JSONObject root = specialService.listCacheSpecialToIndex(acceptData, deviceSex);
|
| | | JSONObject root = specialService.listCacheSpecialToIndex(acceptData, deviceSex,acceptData.getSystem());
|
| | |
|
| | | // 2、顶部轮播图
|
| | | List<BannerVO> oldtopPicList = swiperPictureService.getByBannerCardAndVersion("index_top",
|
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
|
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
|
| | |
|
| | | List<BannerVO> topPicList = new ArrayList<>();
|
| | | if (oldtopPicList != null && oldtopPicList.size() > 0)
|
| | |
| | | // 3、邀请有奖
|
| | | List<BannerVO> invitePicList = null;
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()))) {
|
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) {
|
| | | // 如果IOS当前版本处于审核状态就不返回
|
| | | } else {
|
| | | invitePicList = swiperPictureService.getByBannerCardAndVersion("index_invite", acceptData.getPlatform(),
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | | Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
|
| | | }
|
| | |
|
| | | if (invitePicList == null) {
|
| | |
| | | // 4、IOS的底部网页链接
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("ios".equalsIgnoreCase(platform)) {
|
| | | root.put("htmlLink", configService.get(ConfigKeyEnum.indexHtmlLinkIos.getKey()));
|
| | | root.put("htmlLink", configService.getValue(ConfigKeyEnum.indexHtmlLinkIos.getKey(),acceptData.getSystem()));
|
| | | }
|
| | |
|
| | | root.put("spikeGoods", getSpikeGoodsContent(acceptData));
|
| | |
| | | /* 遍历列表数据 */
|
| | |
|
| | | ConfigParamsDTO configParamsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | acceptData.getVersion(),acceptData.getSystem());
|
| | |
|
| | | for (DaTaoKeDetailV2 detail : listGoods) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = TaoBaoUtil.convert(detail);
|
| | |
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, configParamsDTO);
|
| | |
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", configService.get(ConfigKeyEnum.spikeGoodsLink.getKey()) + "?id=" + taoBaoGoodsBrief.getAuctionId());
|
| | | params.put("url", configService.getValue(ConfigKeyEnum.spikeGoodsLink.getKey(),acceptData.getSystem()) + "?id=" + taoBaoGoodsBrief.getAuctionId());
|
| | |
|
| | | JSONObject goods = new JSONObject();
|
| | | goods.put("goods", gson.toJson(detailVO));
|
| | |
| | | }
|
| | | root.put("imgList", imgArray);
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", configService.get(ConfigKeyEnum.spikeGoodsLink.getKey()));
|
| | | params.put("url", configService.getValue(ConfigKeyEnum.spikeGoodsLink.getKey(),acceptData.getSystem()));
|
| | | root.put("params", params);
|
| | | root.put("jumpDetail", jumpDetail);
|
| | | root.put("name", "限时秒杀");
|
| | |
| | | root.put("endTime", endTime > 0 ? endTime : 0);
|
| | | root.put("listgoods", array);
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", configService.get(ConfigKeyEnum.spikeGoodsLink.getKey()));
|
| | | params.put("url", configService.getValue(ConfigKeyEnum.spikeGoodsLink.getKey(),acceptData.getSystem()));
|
| | | root.put("params", params);
|
| | | root.put("jumpDetail", jumpDetail);
|
| | | }
|
| | |
| | | * 限时秒杀列表
|
| | | *
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param auctionId
|
| | | * @param time
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping("getSpikTime")
|
| | |
| | | *
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param auctionId
|
| | | * @param time
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping("getSpikeGoodsList")
|
| | |
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | if (detailList != null) {
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | acceptData.getVersion(),acceptData.getSystem());
|
| | |
|
| | | for (DaTaoKeDetailV2 detail : detailList) {
|
| | | array.add(gson.toJson(GoodsDetailVOFactory.convertTaoBao(TaoBaoUtil.convert(detail), paramsDTO)));
|
| | |
| | | */
|
| | | private JSONObject getSearchDiscoveryInfo(AcceptData acceptData) {
|
| | | JSONArray array = new JSONArray();
|
| | | String keys = configService.getSearchDiscoveryKeys();
|
| | | String keys = configService.getSearchDiscoveryKeys(acceptData.getSystem());
|
| | | if (!StringUtil.isNullOrEmpty(keys)) {
|
| | | JSONArray arrayKeys = JSONArray.fromObject(keys);
|
| | | for (int i = 0; i < arrayKeys.size(); i++) {
|
| | |
| | | }
|
| | |
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("url", configService.get(ConfigKeyEnum.searchDiscoveryH5Link.getKey()));
|
| | | params.put("url", configService.getValue(ConfigKeyEnum.searchDiscoveryH5Link.getKey(),acceptData.getSystem()));
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("picture", "http://img.flqapp.com/resource/home_search_found.png");
|
| | |
| | |
|
| | | /**
|
| | | * 根据设备信息获取猜你喜欢的内容
|
| | | * |
| | | * @param acceptData
|
| | | * @param imei
|
| | | * -Android的IMEI信息
|
| | | * @param idfa
|
| | | * -IOS的idfa广告标识信息
|
| | | * @param page
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | public void taoBaoGuessUserLikeByDevice(AcceptData acceptData, int page, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | |
| | | }
|
| | |
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | acceptData.getVersion(),acceptData.getSystem());
|
| | |
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO);
|
| | |
| | | if (list != null && list.size() > 0) {
|
| | | BigDecimal rateBuy = TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE;
|
| | | ConfigParamsDTO paramsBuy = new ConfigParamsDTO(rateBuy, rateBuy, Constant.MAX_REWARD_RATE,
|
| | | hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP));
|
| | | hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP,acceptData.getSystem()));
|
| | | for (int i = list.size() - 1; i >= 0; i--) {
|
| | | TLJBuyGoods goods = list.get(i);
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(goods.getGoods(), paramsBuy);
|
| | |
|
| | | String hongBao = TaoBaoUtil.getGoodsHongBaoInfo(goods.getGoods(),
|
| | | TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
|
| | | TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE,false);
|
| | |
|
| | | ReduceHongBao reduceHongBao = new ReduceHongBao();
|
| | | reduceHongBao.setLeft(goods.getLeftHongBaoCount());
|
| | |
| | | // 设备推荐
|
| | | if (gList != null) {
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | acceptData.getVersion(),acceptData.getSystem());
|
| | | for (TaoBaoGoodsBrief goods : gList) {
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
|
| | | && goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | JSONArray localArray = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize,acceptData.getPlatform(),acceptData.getVersion());
|
| | | JSONArray localArray = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize,acceptData.getPlatform(),acceptData.getVersion(),acceptData.getSystem());
|
| | | array.addAll(localArray);
|
| | | } else {// 从精选库来
|
| | | array = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize,acceptData.getPlatform(),acceptData.getVersion());
|
| | | array = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize,acceptData.getPlatform(),acceptData.getVersion(),acceptData.getSystem());
|
| | | if (array == null) {
|
| | | out.print(JsonUtil.loadFalseResult("没有更多了"));
|
| | | return;
|
| | |
| | | * @param out
|
| | | */
|
| | | private void getIndexJDGoods(AcceptData acceptData, int page, PrintWriter out) {
|
| | | JDSearchResult result = jdGoodsService.getIndexJDGoods(page);
|
| | | JDSearchResult result = jdGoodsService.getIndexJDGoods(page,acceptData.getSystem());
|
| | | long count = 0;
|
| | | JSONObject data = new JSONObject();
|
| | | JSONArray array = new JSONArray();
|
| | |
| | | List<JDGoods> goodsList = result.getGoodsList();
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | acceptData.getVersion(),acceptData.getSystem());
|
| | |
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
| | | List<PDDGoodsDetail> goodsList = result.getGoodsList();
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | acceptData.getVersion(),acceptData.getSystem());
|
| | |
|
| | | for (PDDGoodsDetail goods : goodsList) {
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO);
|
| | |
| | | int count = 0;
|
| | | List<SearchKeyTOPVO> list = new ArrayList<SearchKeyTOPVO>();
|
| | |
|
| | | String keys = configService.getSearchDiscoveryKeys();
|
| | | String keys = configService.getSearchDiscoveryKeys(acceptData.getSystem());
|
| | | if (!StringUtil.isNullOrEmpty(keys)) {
|
| | | JSONArray arrayKeys = JSONArray.fromObject(keys);
|
| | | if (arrayKeys != null && arrayKeys.size() > 0) {
|
| | | count = arrayKeys.size();
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | | acceptData.getVersion(),acceptData.getSystem());
|
| | |
|
| | | int j = 1;
|
| | | for (int i = (page - 1) * 3; i < arrayKeys.size(); i++) {
|
| | |
| | | int platformCode = Constant.getPlatformCode(acceptData.getPlatform());
|
| | |
|
| | | List<Special> list = specialService.listByPlaceKey("special_channel_activity", platformCode,
|
| | | Integer.parseInt(acceptData.getVersion()));
|
| | | Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
|
| | |
|
| | | long time = System.currentTimeMillis();
|
| | | // 删除尚未启用的过期的
|
| | |
| | | *
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param callback
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getGuide")
|
| | | public void getGuide(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | String tips = null;
|
| | | if (uid == null || uid <= 0) {
|
| | | tips = configService.get(ConfigKeyEnum.tipGuideNewUser.getKey());
|
| | | tips = configService.getValue(ConfigKeyEnum.tipGuideNewUser.getKey(),acceptData.getSystem());
|
| | | } else {
|
| | | long rebateOrder = hongBaoV2CountService.countRebateOrder(uid);
|
| | | long shareOrInviteOrder = hongBaoV2CountService.countShareOrInviteOrder(uid);
|
| | |
| | | // 熟客版
|
| | | } else if (rebateOrder <= 0 && shareOrInviteOrder <= 0) {
|
| | | // 新人版
|
| | | tips = configService.get(ConfigKeyEnum.tipGuideNewUser.getKey());
|
| | | tips = configService.getValue(ConfigKeyEnum.tipGuideNewUser.getKey(),acceptData.getSystem());
|
| | | } else if (rebateOrder > 0 && shareOrInviteOrder <= 0) {
|
| | | // 省钱版
|
| | | tips = configService.get(ConfigKeyEnum.tipGuideSaveMoney.getKey());
|
| | | tips = configService.getValue(ConfigKeyEnum.tipGuideSaveMoney.getKey(),acceptData.getSystem());
|
| | | } else {
|
| | | // 赚钱版
|
| | | tips = configService.get(ConfigKeyEnum.tipGuideShareInvite.getKey());
|
| | | tips = configService.getValue(ConfigKeyEnum.tipGuideShareInvite.getKey(),acceptData.getSystem());
|
| | | }
|
| | | }
|
| | |
|