| | |
| | | package com.yeshi.fanli.controller.client.v2;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.dto.ConfigParamsDTO;
|
| | | import com.yeshi.fanli.dto.dataoke.DaTaoKeGoodsResult;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.goods.facade.entity.taobao.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | | * 热销榜
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Controller
|
| | | @RequestMapping("api/v2/hotsell")
|
| | | public class HotSellControllerV2 {
|
| | |
|
| | | @Resource
|
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsService daTaoKeGoodsService;
|
| | |
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 获取动态列表
|
| | | * |
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param cid
|
| | | * 主分类(实时-2 今日-3 热销-1)
|
| | | * @param subId
|
| | | * 子分类id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getList", method = RequestMethod.POST)
|
| | | public void getList(AcceptData acceptData, Integer page, Integer cid, Integer subId, PrintWriter out) {
|
| | | try {
|
| | | // 全部
|
| | | if (subId != null && subId == 0)
|
| | | subId = null;
|
| | |
|
| | | List<DaTaoKeDetailV2> detailList = null;
|
| | | if (cid == 1) {
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_HOT, null);
|
| | | if (result != null)
|
| | | detailList = result.getGoodsList();
|
| | |
|
| | | } else if (cid == 2) {
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_TIME, subId);
|
| | | if (result != null)
|
| | | detailList = result.getGoodsList();
|
| | | } else {
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_DAY, subId);
|
| | | if (result != null)
|
| | | detailList = result.getGoodsList();
|
| | | }
|
| | |
|
| | | if (detailList == null)
|
| | | detailList = new ArrayList<>();
|
| | |
|
| | | LogHelper.test("大淘客商品数据:" + detailList.size());
|
| | |
|
| | | List<GoodsDetailVO> list = new ArrayList<GoodsDetailVO>();
|
| | | if (detailList != null) {
|
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion(),acceptData.getSystem());
|
| | |
|
| | | for (DaTaoKeDetailV2 detail : detailList) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = TaoBaoUtil.convert(detail);
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
|
| | | if (cid == 2)
|
| | | detailVO.setSalesType(2);
|
| | | else if (cid == 3)
|
| | | detailVO.setSalesType(3);
|
| | | else
|
| | | detailVO.setSalesType(1);
|
| | | list.add(detailVO);
|
| | | }
|
| | | }
|
| | | LogHelper.test("最终商品数据:" + list.size());
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", detailList.size());
|
| | | data.put("list", JsonUtil.getApiCommonGson().toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.controller.client.v2; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.yeshi.utils.JsonUtil; |
| | | |
| | | import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO; |
| | | import com.yeshi.goods.facade.dto.taobao.dataoke.DaTaoKeGoodsResult; |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | 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.goods.TaoBaoGoodsBriefService; |
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; |
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService; |
| | | import com.yeshi.goods.facade.utils.taobao.DaTaoKeApiUtil; |
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | | /** |
| | | * 热销榜 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Controller |
| | | @RequestMapping("api/v2/hotsell") |
| | | public class HotSellControllerV2 { |
| | | |
| | | @Resource |
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; |
| | | |
| | | @Resource |
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService; |
| | | |
| | | @Resource |
| | | private JumpDetailV2Service jumpDetailV2Service; |
| | | |
| | | @Resource |
| | | private DaTaoKeGoodsService daTaoKeGoodsService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取动态列表 |
| | | * |
| | | * @param acceptData |
| | | * @param page |
| | | * @param cid |
| | | * 主分类(实时-2 今日-3 热销-1) |
| | | * @param subId |
| | | * 子分类id |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getList", method = RequestMethod.POST) |
| | | public void getList(AcceptData acceptData, Integer page, Integer cid, Integer subId, PrintWriter out) { |
| | | try { |
| | | // 全部 |
| | | if (subId != null && subId == 0) |
| | | subId = null; |
| | | |
| | | List<DaTaoKeDetailV2> detailList = null; |
| | | if (cid == 1) { |
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_HOT, null); |
| | | if (result != null) |
| | | detailList = result.getGoodsList(); |
| | | |
| | | } else if (cid == 2) { |
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_TIME, subId); |
| | | if (result != null) |
| | | detailList = result.getGoodsList(); |
| | | } else { |
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_DAY, subId); |
| | | if (result != null) |
| | | detailList = result.getGoodsList(); |
| | | } |
| | | |
| | | if (detailList == null) |
| | | detailList = new ArrayList<>(); |
| | | |
| | | LogHelper.test("大淘客商品数据:" + detailList.size()); |
| | | |
| | | List<GoodsDetailVO> list = new ArrayList<GoodsDetailVO>(); |
| | | if (detailList != null) { |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion(),acceptData.getSystem()); |
| | | |
| | | for (DaTaoKeDetailV2 detail : detailList) { |
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = TaoBaoUtil.convert(detail); |
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO); |
| | | if (cid == 2) |
| | | detailVO.setSalesType(2); |
| | | else if (cid == 3) |
| | | detailVO.setSalesType(3); |
| | | else |
| | | detailVO.setSalesType(1); |
| | | list.add(detailVO); |
| | | } |
| | | } |
| | | LogHelper.test("最终商品数据:" + list.size()); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", detailList.size()); |
| | | data.put("list", JsonUtil.getApiCommonGson().toJson(list)); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult("查询失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |