| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.lable.Label;
|
| | | import com.yeshi.fanli.entity.bus.lable.MergeClass;
|
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
|
| | |
| | | */
|
| | | @RequestMapping(value = "get9k9")
|
| | | public void get9k9(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassGoods("9.9", callback, page, mcid, out);
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(209.9), new BigDecimal(0), new BigDecimal(9.9), mcid);
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RequestMapping(value = "get19k9")
|
| | | public void get19k9(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassGoods("19.9", callback, page, mcid, out);
|
| | | 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("29.9", callback, page, mcid, out);
|
| | | 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("49.9", callback, page, mcid, out);
|
| | | get9k9ClassGoods(callback, out, page, 500, new BigDecimal(549.9), new BigDecimal(29.9), new BigDecimal(49.9), mcid);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * 对应类目id
|
| | | * @param out
|
| | | */
|
| | | public void get9k9ClassGoods(String labName, String callback, Integer page, Long mcid, PrintWriter out) {
|
| | |
|
| | | public void get9k9ClassGoods(String callback, PrintWriter out, Integer page, Integer biz30day, BigDecimal zkPrice,
|
| | | BigDecimal minQuanPrice, BigDecimal maxQuanPrice, Long mcid) {
|
| | | try {
|
| | |
|
| | | List<Label> labs = labelService.selectByTitleCache("labKey", labName);
|
| | | if (labs == null || labs.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | Long labId = labs.get(0).getId();
|
| | |
|
| | | if (page == null)
|
| | | if (page == null || page <= 0) {
|
| | | page = 1;
|
| | | }
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | JSONObject jsonGoods = queryGoodsSmallAmount(page, pageSize, mcid, labId);
|
| | | if (jsonGoods == null) {
|
| | | String mergeCids = null;
|
| | | if (mcid != null && (!mcid.equals(0) || mcid != 0)) {
|
| | | MergeClass mergeClass = mergeClassService.selectByPrimaryKeyCache(mcid);
|
| | | if (mergeClass != null) {
|
| | | // 分类id,隔开
|
| | | mergeCids = mergeClass.getMergeCids();
|
| | | }
|
| | | }
|
| | |
|
| | | // 根据标签id 查询数据
|
| | | 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;
|
| | | }
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(jsonGoods));
|
| | | // 总条数
|
| | | long count = qualityGoodsService.count9k9ClassGoods(biz30day, zkPrice, minQuanPrice, maxQuanPrice, mergeCids);
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | /* 遍历列表数据 */
|
| | | for (QualityFactory selectionGoods : listQuery) {
|
| | | TaoBaoGoodsBrief goodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | if (goodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | 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("查询失败"));
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取商品
|
| | | * |
| | | * @param page
|
| | | * @param pageSize
|
| | | * @param labIds
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public JSONObject queryGoodsSmallAmount(int page, int pageSize, Long mcid, Long labId) throws Exception {
|
| | |
|
| | | String mergeCids = null;
|
| | | if (mcid != null && (!mcid.equals(0) || mcid != 0)) {
|
| | |
|
| | | MergeClass mergeClass = mergeClassService.selectByPrimaryKeyCache(mcid);
|
| | | if (mergeClass != null) {
|
| | | // 分类id,隔开
|
| | | mergeCids = mergeClass.getMergeCids();
|
| | | }
|
| | | }
|
| | |
|
| | | // 根据标签id 查询数据
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listQuerySmallAmount((page - 1) * pageSize, pageSize, null,
|
| | | labId, mergeCids);
|
| | |
|
| | | // 总条数
|
| | | long count = qualityGoodsService.countQuerySmallAmount(null, labId, mergeCids);
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | /* 遍历列表数据 */
|
| | | for (QualityFactory selectionGoods : listQuery) {
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | |
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | int biz30day = taoBaoGoodsBrief.getBiz30day();
|
| | | if (biz30day >= 10000) {
|
| | | double sales = biz30day;
|
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(biz30day + "");
|
| | | }
|
| | |
|
| | | // 改变图片尺寸
|
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl();
|
| | | if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) {
|
| | | taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
|
| | | }
|
| | |
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 9.9商品-每日必抢
|
| | |
| | | */
|
| | | @RequestMapping(value = "get9k9EverydayRob")
|
| | | public void get9k9EverydayRob(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassToDayRob("9.9", callback, page, mcid, out, 1.0, 50.0);
|
| | | queryEverydayRob(callback, out, page, new BigDecimal(209.9), new BigDecimal(0), new BigDecimal(9.9));
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RequestMapping(value = "get19k9EverydayRob")
|
| | | public void get19k9EverydayRob(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassToDayRob("19.9", callback, page, mcid, out, 1.0, 50.0);
|
| | | queryEverydayRob(callback, out, page, new BigDecimal(319.9), new BigDecimal(9.9), new BigDecimal(19.9));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RequestMapping(value = "get29k9EverydayRob")
|
| | | public void get29k9EverydayRob(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassToDayRob("29.9", callback, page, mcid, out, 1.0, 50.0);
|
| | | queryEverydayRob(callback, out, page, new BigDecimal(429.9), new BigDecimal(19.9), new BigDecimal(29.9));
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @RequestMapping(value = "get49k9EverydayRob")
|
| | | public void get49k9EverydayRob(String callback, Integer page, Long mcid, PrintWriter out) {
|
| | | get9k9ClassToDayRob("49.9", callback, page, mcid, out, 1.0, 50.0);
|
| | | queryEverydayRob(callback, out, page, new BigDecimal(549.9), new BigDecimal(29.9), new BigDecimal(49.9));
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 9k9类型商品对应的每日必抢
|
| | | * |
| | | * @param labName
|
| | | * @param callback
|
| | | * @param page
|
| | | * @param mcid
|
| | | * @param out
|
| | | * @param startCouponAmount
|
| | | * @param endCouponAmount
|
| | | */
|
| | | public void get9k9ClassToDayRob(String labName, String callback, Integer page, Long mcid, PrintWriter out,
|
| | | Double startCouponAmount, Double endCouponAmount) {
|
| | |
|
| | | try {
|
| | |
|
| | | List<Label> labs = labelService.selectByTitleCache("labKey", labName);
|
| | | if (labs == null || labs.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | Long labId = labs.get(0).getId();
|
| | | JSONObject jsonGoods = queryEverydayRob(page, labId, 2, startCouponAmount, endCouponAmount);
|
| | |
|
| | | if (jsonGoods == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(jsonGoods));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每日必抢
|
| | |
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public JSONObject queryEverydayRob(Integer page, Long labId, int sortField, Double startCouponAmount,
|
| | | Double endCouponAmount) throws Exception {
|
| | | public void queryEverydayRob(String callback, PrintWriter out, Integer page, BigDecimal zkPrice,
|
| | | BigDecimal minQuanPrice, BigDecimal maxQuanPrice) {
|
| | |
|
| | | if (page == null)
|
| | | page = 1;
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | // 20 条一页请求到3页结束今日新品
|
| | | if (page > 3) {
|
| | | return null;// 20 条一页请求到3页结束今日新品
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 根据标签id 查询数据
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listQueryEverydayRob((page - 1) * pageSize, pageSize, null,
|
| | | labId, sortField, startCouponAmount, endCouponAmount);
|
| | |
|
| | | // 只取前50条数
|
| | | long count = 50;
|
| | |
|
| | | // long count = qualityGoodsService.countQueryEverydayRob(null, labId,
|
| | | // startCouponAmount, endCouponAmount);
|
| | |
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | /* 遍历列表数据 */
|
| | | for (QualityFactory selectionGoods : listQuery) {
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | |
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | try {
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listQueryEverydayRob((page - 1) * pageSize, pageSize,
|
| | | zkPrice, minQuanPrice, maxQuanPrice);
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | |
|
| | | int biz30day = taoBaoGoodsBrief.getBiz30day();
|
| | | if (biz30day >= 10000) {
|
| | | double sales = biz30day;
|
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | for (QualityFactory selectionGoods : listQuery) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | array.add(gson
|
| | | .toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | long count = qualityGoodsService.countQueryEverydayRob(zkPrice, minQuanPrice, maxQuanPrice);
|
| | | if (count < 50) {
|
| | | count = listQuery.size();
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(biz30day + "");
|
| | | count = 50;
|
| | | }
|
| | |
|
| | | // 改变图片尺寸
|
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl();
|
| | | if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) {
|
| | | taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
|
| | | }
|
| | |
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | 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("查询失败"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | |
|
| | | return data;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | @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;
|
| | |
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | |
|
| | | long count = qualityGoodsService.countFreeGoods(tkRate, lableName);
|
| | | long count = qualityGoodsService.countFreeGoods();
|
| | |
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | |
|
| | | 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);
|
| | | }
|
| | | }
|
| | |
|