| | |
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | 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.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
|
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.vo.dynamic.DynamicClassVO;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | | * 热销榜
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsService daTaoKeGoodsService;
|
| | |
|
| | | /**
|
| | | * 查询分类
|
| | | * |
| | | * @param acceptData
|
| | | * @param cid 2实时 3今日 1热销 |
| | | * @param cid
|
| | | * 2实时 3今日 1热销
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getClass", method = RequestMethod.POST)
|
| | | public void getClass(AcceptData acceptData, Integer cid, PrintWriter out) {
|
| | | try {
|
| | | List<DynamicClassVO> list = new ArrayList<DynamicClassVO>();
|
| | | |
| | | DynamicClassVO c0 = new DynamicClassVO();
|
| | | c0.setId(0L);
|
| | | c0.setName("全部");
|
| | | |
| | | DynamicClassVO c1 = new DynamicClassVO();
|
| | | c1.setId(1L);
|
| | | c1.setName("男装");
|
| | | |
| | | DynamicClassVO c2 = new DynamicClassVO();
|
| | | c2.setId(2L);
|
| | | c2.setName("居家日用");
|
| | | |
| | | DynamicClassVO c3 = new DynamicClassVO();
|
| | | c3.setId(3L);
|
| | | c3.setName("美食");
|
| | | |
| | | DynamicClassVO c4 = new DynamicClassVO();
|
| | | c4.setId(4L);
|
| | | c4.setName("母婴");
|
| | | |
| | | DynamicClassVO c5= new DynamicClassVO();
|
| | | c5.setId(5L);
|
| | | c5.setName("数码");
|
| | | |
| | | list.add(c0);
|
| | | list.add(c1);
|
| | | list.add(c2);
|
| | | list.add(c3);
|
| | | list.add(c4);
|
| | | list.add(c5);
|
| | | List<GoodsClass> list = new ArrayList<GoodsClass>();
|
| | | if (cid == 2 || cid == 3) {
|
| | | GoodsClass c0 = new GoodsClass();
|
| | | c0.setId(0L);
|
| | | c0.setName("全部");
|
| | | list.addAll(DaTaoKeUtil.goodsClasses);
|
| | | list.add(0, c0);
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", 1);
|
| | | data.put("list", JsonUtil.getApiCommonGson().toJson(list));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取动态列表
|
| | | * |
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param cid 主分类
|
| | | * @param subId 子分类id
|
| | | * @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) {
|
| | | public void getList(AcceptData acceptData, Integer page, Integer cid, Integer subId, PrintWriter out) {
|
| | | try {
|
| | | // 全部
|
| | | if (subId != null && subId == 0)
|
| | | subId = null;
|
| | |
|
| | | TaoBaoGoodsBriefExtra goods = null;
|
| | | List<TaoBaoGoodsBrief> listgoods = taoBaoGoodsBriefService.queryByAuctionId(584995369742L);
|
| | | if (listgoods != null && listgoods.size() > 0) {
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | goods = TaoBaoUtil.getTaoBaoGoodsBriefExtra( listgoods.get(0), proportion.toString(), null);
|
| | | List<DaTaoKeDetail> detailList = null;
|
| | | if (cid == 1) {
|
| | | detailList = daTaoKeGoodsService.getCurrentHotSalesRankGoodsList();
|
| | | } else if (cid == 2) {
|
| | | detailList = daTaoKeGoodsService.getCurrentSalesRankGoodsList(subId);
|
| | | } else {
|
| | | detailList = daTaoKeGoodsService.getCurrentDaySalesRankGoodsList(subId);
|
| | | }
|
| | | goods.setSalesType(cid);
|
| | | // 标签
|
| | | List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>();
|
| | | ClientTextStyleVO textVO1 = new ClientTextStyleVO();
|
| | | textVO1.setColor("#FE0014");
|
| | | textVO1.setContent("公益宝贝");
|
| | | |
| | | ClientTextStyleVO textVO2 = new ClientTextStyleVO();
|
| | | textVO2.setColor("#FF9600");
|
| | | textVO2.setContent("夏季爆款");
|
| | | labels.add(textVO1);
|
| | | labels.add(textVO2);
|
| | | goods.setLabels(labels);
|
| | | |
| | | List<TaoBaoGoodsBriefExtra> list = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | list.add(goods);
|
| | |
|
| | | if (detailList == null)
|
| | | detailList = new ArrayList<>();
|
| | |
|
| | | LogHelper.test("大淘客商品数据:" + detailList.size());
|
| | |
|
| | | List<TaoBaoGoodsBriefExtra> list = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | if (detailList != null)
|
| | | for (DaTaoKeDetail detail : detailList) {
|
| | | goods = TaoBaoUtil.getTaoBaoGoodsBriefExtra(TaoBaoUtil.convert(detail), proportion.toString(),
|
| | | null);
|
| | | if (cid == 2)
|
| | | goods.setSalesType(2);
|
| | | else if (cid == 3)
|
| | | goods.setSalesType(3);
|
| | | else
|
| | | goods.setSalesType(1);
|
| | | list.add(goods);
|
| | | }
|
| | | |
| | | LogHelper.test("最终商品数据:" + list.size());
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", 1);
|
| | | data.put("count", detailList.size());
|
| | | data.put("list", JsonUtil.getApiCommonGson().toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|