package com.yeshi.fanli.controller.client;
|
|
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.entity.accept.AcceptData;
|
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
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.util.taobao.TaoBaoUtil;
|
import com.yeshi.fanli.vo.dynamic.DynamicClassVO;
|
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
|
import net.sf.json.JSONObject;
|
|
/**
|
* 热销榜
|
* @author Administrator
|
*
|
*/
|
@Controller
|
@RequestMapping("api/v1/hotsell")
|
public class HotSellController {
|
|
@Resource
|
private HongBaoManageService hongBaoManageService;
|
|
@Resource
|
private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
|
@Resource
|
private JumpDetailV2Service jumpDetailV2Service;
|
|
|
/**
|
* 查询分类
|
* @param acceptData
|
* @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);
|
JSONObject data = new JSONObject();
|
data.put("count", 1);
|
data.put("list", JsonUtil.getApiCommonGson().toJson(list));
|
out.print(JsonUtil.loadTrueResult(data));
|
} catch (Exception e) {
|
out.print(JsonUtil.loadFalseResult("查询失败"));
|
e.printStackTrace();
|
}
|
}
|
|
|
/**
|
* 获取动态列表
|
* @param acceptData
|
* @param page
|
* @param cid 主分类
|
* @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 {
|
|
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);
|
}
|
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);
|
|
JSONObject data = new JSONObject();
|
data.put("count", 1);
|
data.put("list", JsonUtil.getApiCommonGson().toJson(list));
|
out.print(JsonUtil.loadTrueResult(data));
|
} catch (Exception e) {
|
out.print(JsonUtil.loadFalseResult("查询失败"));
|
e.printStackTrace();
|
}
|
}
|
|
}
|