| | |
| | | package com.yeshi.fanli.controller.apph5;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | 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 org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | 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.bus.user.CollectionGoods;
|
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | 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.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelService;
|
| | | import com.yeshi.fanli.service.inter.lable.MergeClassService;
|
| | |
| | | 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 org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("api/apph5/v1/quality")
|
| | | public class AppH5QualityGoodsController {
|
| | | public class AppH5QualityGoodsController {
|
| | |
|
| | | @Resource
|
| | | private LabelService labelService;
|
| | |
|
| | | @Resource
|
| | | private QualityFactoryService selectionGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private TaobaoMeterialService taobaoMeterialService;
|
| | |
| | |
|
| | | @Resource
|
| | | private MergeClassService mergeClassService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoClassService taoBaoClassService;
|
| | | |
| | | @Resource
|
| | | private SystemService systemService;
|
| | |
|
| | | @Resource
|
| | | private QualityGoodsService qualityGoodsService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private QualityFlashSaleService qualityFlashSaleService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private CollectionGoodsService collectionGoodsService;
|
| | | |
| | | |
| | | |
| | | |
| | | private CollectionGoodsV2Service collectionGoodsV2Service;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsActivityService taoBaoGoodsActivityService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | /**
|
| | | * 9.9商品
|
| | | *
|
| | |
| | | */
|
| | | @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);
|
| | |
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 19.9商品
|
| | |
| | | */
|
| | | @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);
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 9k9类型的商品查询
|
| | | * @param labName 标签名称
|
| | | * 9k9类型的商品查询
|
| | | * |
| | | * @param labName
|
| | | * 标签名称
|
| | | * @param callback
|
| | | * @param page
|
| | | * @param mcid 对应类目id
|
| | | * @param 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)));
|
| | | }
|
| | |
|
| | | // 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);
|
| | |
|
| | | 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();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | /* 遍历列表数据 */
|
| | | 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(count + "");
|
| | | }
|
| | | |
| | | // 改变图片尺寸 |
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl();
|
| | | if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) {
|
| | | taoBaoGoodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
|
| | | }
|
| | |
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, 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;
|
| | | |
| | | |
| | | if (page > 3 ) {
|
| | | return null;// 20 条一页请求到3页结束今日新品
|
| | | }
|
| | | |
| | | // 根据标签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;
|
| | | // 20 条一页请求到3页结束今日新品
|
| | | if (page > 3) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | /* 遍历列表数据 */
|
| | | 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(count + "");
|
| | | 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, fcRate, 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;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 品牌购 (官方推荐【品牌券】接口)
|
| | |
| | | page = 1;
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | |
|
| | | JSONObject jsonObject = taoKeGoodsService.getBrandsGoods(materialId, page, pageSize);
|
| | |
|
| | | if (jsonObject == null) {
|
| | | JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | | JsonUtil.printMode(out, callback,JsonUtil.loadTrueResult(jsonObject));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(jsonObject));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("查询失败"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 品牌购 (官方推荐【品牌券】接口)
|
| | | *
|
| | |
| | | page = 1;
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | |
|
| | | JSONObject jsonObject = taoKeGoodsService.getBrandsShops(materialId, page, pageSize);
|
| | |
|
| | | if (jsonObject == null) {
|
| | | JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | | JsonUtil.printMode(out, callback,JsonUtil.loadTrueResult(jsonObject));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(jsonObject));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("查询失败"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | |
| | |
|
| | | try {
|
| | |
|
| | | List<TaobaoMeterial> taobaoMeterials = taobaoMeterialService.selectByClassNameAndSuperNameCache(null, "有好货");
|
| | | List<TaobaoMeterial> taobaoMeterials = taobaoMeterialService.selectByClassNameAndSuperNameCache(null,
|
| | | "有好货");
|
| | |
|
| | | if (taobaoMeterials == null || taobaoMeterials.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("暂无数据"));
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 今日新品【(官方推荐【好券直播】接口)
|
| | | *
|
| | | * @param page
|
| | | * @param subName 子类名称
|
| | | * @param subName
|
| | | * 子类名称
|
| | | */
|
| | | @RequestMapping(value = "todayNew")
|
| | | public void todayNew(String callback, Integer page, String subName, String uid, PrintWriter out) {
|
| | |
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | |
|
| | | List<TaoBaoGoodsBrief> listMaterial = taoKeGoodsService.listByMaterial(materialId, page, pageSize);
|
| | |
|
| | | if (listMaterial == null || listMaterial.size() == 0) {
|
| | | JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult(2,"没有更多了"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | | /* 遍历列表数据 */
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : listMaterial) {
|
| | | |
| | | int count = taoBaoGoodsBrief.getBiz30day();
|
| | | if (count >= 10000) {
|
| | | double sales = count;
|
| | |
|
| | | int biz30day = taoBaoGoodsBrief.getBiz30day();
|
| | | if (biz30day >= 10000) {
|
| | | double sales = biz30day;
|
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(count + "");
|
| | | taoBaoGoodsBrief.setSalesCount(biz30day + "");
|
| | | }
|
| | | |
| | | // 改变图片尺寸 大图更清晰
|
| | |
|
| | | // 改变图片尺寸 大图更清晰
|
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl();
|
| | | pictUrl = pictUrl.replaceAll("320x320", "640x640");
|
| | | taoBaoGoodsBrief.setPictUrl(pictUrl);
|
| | | |
| | |
|
| | | int collected = 0;
|
| | | // 判断收藏
|
| | | if (!StringUtil.isNullOrEmpty(uid)) {
|
| | | CollectionGoods collectionGoods = collectionGoodsService.findByUidAndAuctionId(Long.parseLong(uid),
|
| | | taoBaoGoodsBrief.getAuctionId());
|
| | | CollectionGoodsV2 collectionGoods = collectionGoodsV2Service
|
| | | .findByUidAndAuctionId(Long.parseLong(uid), taoBaoGoodsBrief.getAuctionId());
|
| | | if (collectionGoods != null) {
|
| | | collected = 1;
|
| | | }
|
| | | }
|
| | | |
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion, fcRate, null);
|
| | |
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), null);
|
| | | taoBaoGoodsBriefExtra.setCollected(collected);
|
| | | |
| | |
|
| | | array.add(gson.toJson(taoBaoGoodsBriefExtra));
|
| | | }
|
| | |
|
| | |
| | | data.put("result_list", array);
|
| | | data.put("count", 1000);
|
| | |
|
| | | |
| | | JsonUtil.printMode(out, callback,JsonUtil.loadTrueResult(data));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("查询失败"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 潮品热卖(官方推荐中的【潮流范】)
|
| | | *
|
| | |
| | |
|
| | | try {
|
| | |
|
| | | |
| | | List<TaobaoMeterial> taobaoMeterials = taobaoMeterialService.selectByClassNameAndSuperNameCache(null, "潮流范");
|
| | | List<TaobaoMeterial> taobaoMeterials = taobaoMeterialService.selectByClassNameAndSuperNameCache(null,
|
| | | "潮流范");
|
| | |
|
| | | if (taobaoMeterials == null || taobaoMeterials.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | |
| | | if (page == null) {
|
| | | page = 1;
|
| | | }
|
| | | |
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | JSONObject jsonObject = queryMaterialGoods(page, pageSize, materialId);
|
| | |
| | | public void getPregnantBaby(AcceptData acceptData, String callback, Integer page, String subName, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | |
| | | List<TaobaoMeterial> taobaoMeterials = taobaoMeterialService.selectByClassNameAndSuperNameCache(subName, "母婴主题");
|
| | |
|
| | | List<TaobaoMeterial> taobaoMeterials = taobaoMeterialService.selectByClassNameAndSuperNameCache(subName,
|
| | | "母婴主题");
|
| | |
|
| | | if (taobaoMeterials == null || taobaoMeterials.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | |
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | | /* 遍历列表数据 */
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : listBrands) {
|
| | |
|
| | | int count = taoBaoGoodsBrief.getBiz30day();
|
| | | if (count >= 10000) {
|
| | | double sales = count;
|
| | | int biz30day = taoBaoGoodsBrief.getBiz30day();
|
| | | if (biz30day >= 10000) {
|
| | | double sales = biz30day;
|
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(count + "");
|
| | | 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, fcRate, null)));
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 限时抢购
|
| | | * |
| | | * @param callback
|
| | | * @param page
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping("getFlashSale")
|
| | | public void getFlashSale(String callback, Integer page, PrintWriter out) {
|
| | | |
| | | public void getFlashSale(String callback, Integer page, Long auctionId, PrintWriter out) {
|
| | |
|
| | | if (page == null)
|
| | | page = 1;
|
| | | |
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | int type = qualityFlashSaleService.getNowType();
|
| | | |
| | |
|
| | | TaoBaoGoodsBrief goodsBrief = null;
|
| | | if (page == 1 && auctionId != null) {
|
| | | List<TaoBaoGoodsBrief> list = taoBaoGoodsBriefService.queryByAuctionId(auctionId);
|
| | | if (list != null && list.size() > 0) {
|
| | | goodsBrief = list.get(0);
|
| | | }
|
| | | }
|
| | |
|
| | | if (goodsBrief != null) {
|
| | | pageSize = pageSize - 1;
|
| | | }
|
| | |
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listQueryByFlashSale((page - 1) * pageSize, pageSize);
|
| | | |
| | | //精选库数据为空
|
| | |
|
| | | // 精选库数据为空
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | | |
| | | long count = 3000;
|
| | | |
| | | // 精选库数据处理返回 前端 |
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | |
| | | //遍历列表数据 |
| | | long count = 3000;
|
| | |
|
| | | // 精选库数据处理返回 前端
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | | if (goodsBrief != null) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | // 遍历列表数据
|
| | | for (QualityFactory quality : listQuery) {
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = quality.getTaoBaoGoodsBrief();
|
| | |
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (goodsBrief != null && auctionId.equals(taoBaoGoodsBrief.getAuctionId())) {
|
| | | continue;
|
| | | }
|
| | |
|
| | |
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(count + "");
|
| | | 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, fcRate, null)));
|
| | |
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | 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));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 大额券(券面值范围)
|
| | | * |
| | | * @param callback
|
| | | * @param amount
|
| | | * @param page
|
| | |
| | | */
|
| | | @RequestMapping("choiceCouponAmount")
|
| | | public void choiceCouponAmount(String callback, Integer amount, Integer page, PrintWriter out) {
|
| | | |
| | | |
| | |
|
| | | if (page == null)
|
| | | page = 1;
|
| | | |
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | | |
| | |
|
| | | Integer startAmount = null;
|
| | | Integer endAmount = null ;
|
| | | |
| | | Integer endAmount = null;
|
| | |
|
| | | if (amount.equals(1)) {
|
| | | startAmount = 5;
|
| | | endAmount = 10;
|
| | |
| | | } else if (amount.equals(4)) {
|
| | | startAmount = 50;
|
| | | }
|
| | | |
| | |
|
| | | Integer startPropor = 20;
|
| | | |
| | | List<QualityFactory> listQuery = qualityGoodsService.listQueryByCouponAmount((page - 1) * pageSize,
|
| | | pageSize, startAmount, endAmount, startPropor);
|
| | | |
| | |
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listQueryByCouponAmount((page - 1) * pageSize, pageSize,
|
| | | startAmount, endAmount, startPropor);
|
| | |
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | | long count = qualityGoodsService.countQueryByCouponAmount(startAmount, endAmount, startPropor);
|
| | | |
| | | // 精选库数据处理返回 前端 |
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | |
| | | //遍历列表数据 |
| | | long count = qualityGoodsService.countQueryByCouponAmount(startAmount, endAmount, startPropor);
|
| | |
|
| | | // 精选库数据处理返回 前端
|
| | | 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();
|
| | |
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(count + "");
|
| | | 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, fcRate, null)));
|
| | |
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | data.put("result", array);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 超高奖金
|
| | | * |
| | | * @param callback
|
| | | * @param page
|
| | | * @param type
|
| | |
| | | */
|
| | | @RequestMapping("choiceRebate")
|
| | | public void choiceRebate(String callback, Integer page, Integer type, PrintWriter out) {
|
| | | |
| | |
|
| | | if (page == null)
|
| | | page = 1;
|
| | | |
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | | |
| | |
|
| | | Integer startAmount = null;
|
| | | Integer endAmount = null ;
|
| | | |
| | | Integer endAmount = null;
|
| | |
|
| | | if (type.equals(1)) {
|
| | | startAmount = 1;
|
| | | endAmount = 5;
|
| | |
| | | } else if (type.equals(4)) {
|
| | | startAmount = 15;
|
| | | }
|
| | | |
| | |
|
| | | double tkRate = 20.00;
|
| | | |
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | |
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listQueryByRebateAmount((page - 1) * pageSize, pageSize,
|
| | | proportion, startAmount, endAmount, tkRate);
|
| | | |
| | | proportion.toString(), startAmount, endAmount, tkRate);
|
| | |
|
| | | if (listQuery == null || listQuery.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(2, "没有更多了"));
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | | long count = qualityGoodsService.countQueryByRebateAmount(proportion, startAmount, endAmount, tkRate);
|
| | | |
| | | // 精选库数据处理返回 前端 |
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | |
| | | //遍历列表数据 |
| | | long count = qualityGoodsService.countQueryByRebateAmount(proportion.toString(), startAmount, endAmount,
|
| | | tkRate);
|
| | |
|
| | | // 精选库数据处理返回 前端
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | // 遍历列表数据
|
| | | for (QualityFactory quality : listQuery) {
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = quality.getTaoBaoGoodsBrief();
|
| | |
| | | String salesCountMidea = String.format("%.1f", sales / 10000);
|
| | | taoBaoGoodsBrief.setSalesCount(salesCountMidea + "万");
|
| | | } else {
|
| | | taoBaoGoodsBrief.setSalesCount(count + "");
|
| | | 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, fcRate, null)));
|
| | |
|
| | | 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));
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 超高奖金
|
| | | * |
| | | * @param callback
|
| | | * @param page
|
| | | * @param type
|
| | |
| | | */
|
| | | @RequestMapping("recommendToIndex")
|
| | | public void recommendToIndex(String callback, Integer page, PrintWriter out) {
|
| | | |
| | |
|
| | | if (page == null)
|
| | | page = 1;
|
| | | |
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | |
| | | |
| | | Map<String, String> map = manageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | String fcRate = map.get("hongbao_fc_ratio");
|
| | | |
| | | |
| | | |
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | JSONArray array = qualityGoodsService.getRecommendToIndex((page - 1) * pageSize, pageSize,
|
| | | proportion, fcRate);
|
| | | |
| | | proportion.toString());
|
| | |
|
| | | if (array == null) {
|
| | | out.print(JsonUtil.loadFalseResult("没有更多了"));
|
| | | return;
|
| | | }
|
| | | |
| | | long count = qualityGoodsService.countRecommendToIndex(proportion);
|
| | |
|
| | | long count = qualityGoodsService.countRecommendToIndex(proportion.toString());
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("result_list", array);
|
| | | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 超高奖金
|
| | | * |
| | | * @param callback
|
| | | * @param page
|
| | | * @param type
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping("freeGoods")
|
| | | public void freeGoods(String callback, Integer page, PrintWriter out) {
|
| | | try {
|
| | | 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;
|
| | | }
|
| | |
|
| | | List<Long> listGid = new ArrayList<Long>();
|
| | | for (QualityFactory qualityFactory : listQuery) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = qualityFactory.getTaoBaoGoodsBrief();
|
| | |
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | listGid.add(taoBaoGoodsBrief.getAuctionId());
|
| | | }
|
| | |
|
| | | // API网络接口验证是否在售
|
| | | List<TaoBaoGoodsBrief> listTaoKeGoods = null;
|
| | | try {
|
| | | listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) {
|
| | | boolean stateSale = false; // 默认停售
|
| | | Long goodsId = taoBaoGoodsBrief.getAuctionId();
|
| | | for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) {
|
| | | Long auctionId = taoKeGoods.getAuctionId();
|
| | | if (goodsId == auctionId || goodsId.equals(auctionId)) {
|
| | | stateSale = true; // 在售
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | if (!stateSale) {
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal couplePrice = TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief);
|
| | | if (couplePrice.compareTo(new BigDecimal("9.9")) == 1) {
|
| | | continue; // 券后价大于10
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief,
|
| | | proportion.toString(), null);
|
| | | // 将返利改为券后价
|
| | | TaoBaoHongBaoInfo taoBaoHongBaoInfo = extra.getTaoBaoHongBaoInfo();
|
| | | if (taoBaoHongBaoInfo != null) {
|
| | | taoBaoHongBaoInfo.setHongbao(extra.getQuanPrice());
|
| | | taoBaoHongBaoInfo.setRate("¥" + extra.getQuanPrice());
|
| | | }
|
| | |
|
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | |
|
| | | 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("数据暂未提供"));
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|