| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoHongBaoInfo;
|
| | | import com.yeshi.fanli.entity.taobao.TaobaoMeterial;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.QualityFlashSaleService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.lable.TaoKeGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsActivityService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaobaoMeterialService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private QualityFactoryService selectionGoodsService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsActivityService taoBaoGoodsActivityService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | /**
|
| | | * 9.9商品
|
| | |
| | | */
|
| | | @RequestMapping(value = "get19k9")
|
| | | public void get19k9(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(319.9), new BigDecimal(9.9), new BigDecimal(19.9), mcid);
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(319.9), new BigDecimal(9.9), new BigDecimal(19.9),
|
| | | mcid);
|
| | |
|
| | | }
|
| | |
|
| | |
| | | */
|
| | | @RequestMapping(value = "get29k9")
|
| | | public void get29k9(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(429.9), new BigDecimal(19.9), new BigDecimal(29.9), mcid);
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(429.9), new BigDecimal(19.9), new BigDecimal(29.9),
|
| | | mcid);
|
| | |
|
| | | }
|
| | |
|
| | |
| | | */
|
| | | @RequestMapping(value = "get49k9")
|
| | | public void get49k9(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(549.9), new BigDecimal(29.9), new BigDecimal(49.9), mcid);
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(549.9), new BigDecimal(29.9), new BigDecimal(49.9),
|
| | | mcid);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param out
|
| | | */
|
| | | public void get9k9ClassGoods(String callback, PrintWriter out, Integer page, Integer biz30day, BigDecimal zkPrice,
|
| | | BigDecimal minQuanPrice, BigDecimal maxQuanPrice, Long mcid) {
|
| | | BigDecimal minQuanPrice, BigDecimal maxQuanPrice, Long mcid) {
|
| | | try {
|
| | | if (page == null || page <= 0) {
|
| | | page = 1;
|
| | |
| | | }
|
| | |
|
| | | // 根据标签id 查询数据
|
| | | List<QualityFactory> listQuery = qualityGoodsService.get9k9ClassGoods((page-1)*pageSize, pageSize, biz30day, zkPrice,
|
| | | minQuanPrice, maxQuanPrice, mergeCids);
|
| | | List<QualityFactory> listQuery = qualityGoodsService.get9k9ClassGoods((page - 1) * pageSize, pageSize,
|
| | | biz30day, zkPrice, minQuanPrice, maxQuanPrice, mergeCids);
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 总条数
|
| | | long count = qualityGoodsService.count9k9ClassGoods(biz30day, zkPrice, minQuanPrice, maxQuanPrice, mergeCids);
|
| | | long count = qualityGoodsService.count9k9ClassGoods(biz30day, zkPrice, minQuanPrice, maxQuanPrice,
|
| | | mergeCids);
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | |
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | // 618活动
|
| | | if (System.currentTimeMillis() < TimeUtil.convertToTimeTemp("2019-06-19", "yyyy-MM-dd")) {
|
| | | if (mcid == null || mcid == 0) {
|
| | | count = taoBaoGoodsActivityService.countByPrice(minQuanPrice,
|
| | | maxQuanPrice.add(new BigDecimal("0.1")));
|
| | | List<TaoBaoGoodsBrief> goodsList = taoBaoGoodsActivityService.listByPrice(minQuanPrice,
|
| | | maxQuanPrice.add(new BigDecimal("0.1")), page, pageSize);
|
| | | if (goodsList != null) {
|
| | | array.clear();
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | array.add(gson
|
| | | .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, proportion.toString(), null)));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | |
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 9.9商品-每日必抢
|
| | |
| | | queryEverydayRob(callback, out, page, new BigDecimal(549.9), new BigDecimal(29.9), new BigDecimal(49.9));
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 每日必抢
|
| | |
| | | } else {
|
| | | count = 50;
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion =manageService.getFanLiRate();
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | | /* 遍历列表数据 */
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : listMaterial) {
|
| | |
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | int type = qualityFlashSaleService.getNowType();
|
| | | |
| | |
|
| | | TaoBaoGoodsBrief goodsBrief = null;
|
| | | if (page == 1 && auctionId != null) {
|
| | | List<TaoBaoGoodsBrief> list = taoBaoGoodsBriefService.queryByAuctionId(auctionId);
|
| | |
| | | }
|
| | |
|
| | | if (goodsBrief != null) {
|
| | | pageSize = pageSize -1;
|
| | | pageSize = pageSize - 1;
|
| | | }
|
| | | |
| | |
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listQueryByFlashSale((page - 1) * pageSize, pageSize);
|
| | |
|
| | | // 精选库数据为空
|
| | |
| | | if (goodsBrief != null) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null)));
|
| | | }
|
| | | |
| | |
|
| | | // 遍历列表数据
|
| | | for (QualityFactory quality : listQuery) {
|
| | |
|
| | |
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | if (goodsBrief != null && auctionId.equals(taoBaoGoodsBrief.getAuctionId())) {
|
| | | continue;
|
| | | }
|
| | |
| | | data.put("type", type);
|
| | | data.put("result_list", array);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping("getFlashSaleNew")
|
| | | public void getFlashSaleNew(String callback, Integer page, Long auctionId, String time, PrintWriter out) {
|
| | | List<DaTaoKeDetail> detailList0 = daTaoKeGoodsDetailService.getDingDongQiangData(time);
|
| | | if (detailList0 == null)
|
| | | detailList0 = new ArrayList<>();
|
| | | List<DaTaoKeDetail> detailList = new ArrayList<>();
|
| | | detailList.addAll(detailList0);
|
| | | JSONArray array = new JSONArray();
|
| | | if (page == 1) {
|
| | | if (auctionId != null && detailList != null)
|
| | | for (int i = 0; i < detailList.size(); i++) {
|
| | | if (detailList.get(i).getGoodsId().longValue() == auctionId) {
|
| | | DaTaoKeDetail goods = detailList.get(i);
|
| | | detailList.remove(i);
|
| | | detailList.add(0, goods);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | if (detailList != null)
|
| | | for (DaTaoKeDetail detail : detailList) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(TaoBaoUtil.convert(detail),
|
| | | hongBaoManageService.getFanLiRate() + "", null)));
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", detailList.size());
|
| | | data.put("result_list", array);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | long count = qualityGoodsService.countQueryByRebateAmount(proportion.toString(), startAmount, endAmount, tkRate);
|
| | | long count = qualityGoodsService.countQueryByRebateAmount(proportion.toString(), startAmount, endAmount,
|
| | | tkRate);
|
| | |
|
| | | // 精选库数据处理返回 前端
|
| | | JSONArray array = new JSONArray();
|
| | |
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | JSONArray array = qualityGoodsService.getRecommendToIndex((page - 1) * pageSize, pageSize, proportion.toString());
|
| | | JSONArray array = qualityGoodsService.getRecommendToIndex((page - 1) * pageSize, pageSize,
|
| | | proportion.toString());
|
| | |
|
| | | if (array == null) {
|
| | | out.print(JsonUtil.loadFalseResult("没有更多了"));
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 超高奖金
|
| | | *
|
| | |
| | | */
|
| | | @RequestMapping("freeGoods")
|
| | | public void freeGoods(String callback, Integer page, PrintWriter out) {
|
| | |
|
| | | if (page == null || page < 1)
|
| | | page = 1;
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | double tkRate = 20;
|
| | | String lableName = "9.9";
|
| | |
|
| | | try {
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize, tkRate,
|
| | | lableName);
|
| | | if (page == null || page < 1)
|
| | | page = 1;
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize);
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | |
| | | continue; // 券后价大于10
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, |
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), null);
|
| | | // 将返利改为券后价
|
| | | TaoBaoHongBaoInfo taoBaoHongBaoInfo = extra.getTaoBaoHongBaoInfo();
|
| | |
| | | taoBaoHongBaoInfo.setHongbao(extra.getQuanPrice());
|
| | | taoBaoHongBaoInfo.setRate("¥" + extra.getQuanPrice());
|
| | | }
|
| | | |
| | |
|
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | |
|
| | | long count = qualityGoodsService.countFreeGoods(tkRate, lableName);
|
| | | long count = qualityGoodsService.countFreeGoods();
|
| | |
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | if (page == 1) {
|
| | | // 抽奖规则
|
| | | String rules = configService.get("free_goods_rule");
|
| | | data.put("ruleLink", rules);
|
| | | }
|
| | | |
| | |
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | | |
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("数据暂未提供"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|