| | |
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.lable.TaoKeGoodsService;
|
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | 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.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private QualityGoodsService qualityGoodsService;
|
| | |
|
| | | @Resource
|
| | | private MonitorService monitorService;
|
| | |
|
| | | /**
|
| | | * 获取主类目
|
| | |
| | | * @param page
|
| | | * @param scid
|
| | | * @param filter
|
| | | * @param order 来源:【推荐:0 | 综合:4 、综合只看有券 1 、综合只看天猫 1 | 价格:低到高3 高到低2 | 销量:1】
|
| | | * 排序值:【销量由高到低: 1 ; 销量由低到高 5; 价格从高到低: 2 ; 价格从低到高:3 ; 推广量高到低:4 ; 其他默认: 销量由高到低】
|
| | | * @param order
|
| | | * 来源:【推荐:0 | 综合:4 、综合只看有券 1 、综合只看天猫 1 | 价格:低到高3 高到低2 | 销量:1】
|
| | | * 排序值:【销量由高到低: 1 ; 销量由低到高 5; 价格从高到低: 2 ; 价格从低到高:3 ; 推广量高到低:4 ;
|
| | | * 其他默认: 销量由高到低】
|
| | | *
|
| | | * @param startprice
|
| | | * 起始价格
|
| | |
| | | systemCid = rootClass.getId();
|
| | | }
|
| | |
|
| | | |
| | | // page从1开始
|
| | | page += 1;
|
| | | // 请求淘宝接口页码
|
| | |
| | | if (!StringUtil.isNullOrEmpty(order) && Integer.parseInt(order) == 0) {
|
| | |
|
| | | // 分类关联标签id集合
|
| | | List<Long> listLabId = |
| | | labelClassService.getRelationLabIds((page - 1) * pageSize, pageSize, goodsSubClass.getId());
|
| | | List<Long> listLabId = labelClassService.getRelationLabIds((page - 1) * pageSize, pageSize,
|
| | | goodsSubClass.getId());
|
| | |
|
| | | /* 计算精选库数据 总页数 */
|
| | | long incount = taoKeGoodsService.countByQuality(searchKey, systemCid, listLabId);
|
| | |
| | |
|
| | | pageNo = page - totalPage;
|
| | |
|
| | | |
| | | /* 查询精选库数据 */
|
| | | if (pageNo <= 0 ) {
|
| | |
|
| | | List<QualityFactory> listQuality = taoKeGoodsService.queryByQuality((page - 1) * pageSize,
|
| | | pageSize,searchKey, systemCid, listLabId);
|
| | | List<QualityFactory> listQuality = taoKeGoodsService.queryByQuality((page - 1) * pageSize, pageSize,
|
| | | searchKey, systemCid, listLabId);
|
| | |
|
| | | List<TaoBaoGoodsBrief> searchWuLiaoList = null;
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | if (pageNo > 0 && totalPage > 0) {
|
| | | List<QualityFactory> list = taoKeGoodsService.queryByQuality((totalPage - 1) * pageSize,
|
| | | pageSize, searchKey, systemCid, listLabId);
|
| | | List<QualityFactory> list = taoKeGoodsService.queryByQuality((totalPage - 1) * pageSize, pageSize,
|
| | | searchKey, systemCid, listLabId);
|
| | |
|
| | | if (list != null && list.size() != 0 && list.size() < 10) {
|
| | | // 页码+ 1 已请求一次淘宝接口
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /* 网络请求 */
|
| | | SearchFilter searchfilter = null;
|
| | |
| | | } else {
|
| | | searchfilter = new SearchFilter();
|
| | | // 设置SearchFilter
|
| | | taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter, totalSales);
|
| | | taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter,
|
| | | totalSales);
|
| | | }
|
| | |
|
| | | searchfilter.setPage(pageNo);
|
| | |
| | | }
|
| | |
|
| | | @RequestMapping("getCouponList")
|
| | | public void getCouponList(AcceptData acceptData, int page, PrintWriter out) {
|
| | | public void getCouponList(AcceptData acceptData, int page, HttpServletRequest request, PrintWriter out) {
|
| | | page = page > 0 ? page : 1;
|
| | | List<TaoBaoGoodsBrief> taoBaoGoodsBriefs = taoBaoCouponService.getTaoBaoCouponList(page);
|
| | | Map<String, String> map = manageService.convertMap();
|
| | |
| | | data.put("taoBaoCoupons", array);
|
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0, 0, null));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | @RequestMapping(value={"getcategory"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
|
| | | public void getcategory(AcceptData acceptData, PrintWriter out) {
|
| | | com.yeshi.fanli.entity.system.System system = this.systemService
|
| | | .getSystemCache(acceptData.getPlatform(),
|
| | | com.yeshi.fanli.entity.system.System system = this.systemService.getSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult("系统不存在"));
|