| | |
| | | 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.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 ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsActivityService taoBaoGoodsActivityService;
|
| | |
|
| | | /**
|
| | | * 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);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | |
|
| | | // 根据标签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);
|
| | | List<TaoBaoGoodsBrief> goodsList = taoBaoGoodsActivityService.listByPrice(minQuanPrice,
|
| | | maxQuanPrice.add(new BigDecimal("0.1")), page, pageSize);
|
| | | if (goodsList != null)
|
| | | 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));
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 每日必抢
|
| | |
| | | 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("没有更多了"));
|
| | |
| | | }
|
| | |
|
| | | long count = qualityGoodsService.countFreeGoods();
|
| | |
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (page == 1) {
|
| | |
| | |
|
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) {
|
| | | // 筛选
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | List<TaoBaoGoodsBriefExtra> goodsList = new ArrayList<>();
|
| | |
|
| | | // 设备推荐
|
| | | for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) {
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null
|
| | | && goods.getCouponAmount().compareTo(new BigDecimal("5")) >= 0
|
| | | && goods.getBiz30day() > 1000 && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite()))
|
| | | goodsList.add(goods);
|
| | | && goods.getBiz30day() > 1000 && !StringUtil.isNullOrEmpty(goods.getPictUrlWhite())) {
|
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods,
|
| | | proportion.toString(), "");
|
| | | extra.setRecommend(true);
|
| | | goodsList.add(extra);
|
| | | }
|
| | | }
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0,
|
| | |
| | |
|
| | | Collections.shuffle(goodsList);
|
| | | goodsList = goodsList.size() > 20 ? goodsList.subList(0, 20) : goodsList;
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, proportion.toString(), "")));
|
| | | for (TaoBaoGoodsBriefExtra goods : goodsList) {
|
| | | array.add(gson.toJson(goods));
|
| | | }
|
| | | } else {
|
| | | try {
|
| | |
| | | } catch (UserCustomSettingsException e) {
|
| | | }
|
| | |
|
| | | if (VersionUtil.greaterThan_1_5_50(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | int totalCount = msgDeviceReadStateService.getUnReadCount(acceptData.getDevice(),
|
| | | "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2, MsgDeviceReadState.TYPE_KEFU);
|
| | | data.put("totalCount", totalCount);
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
| | | package com.yeshi.fanli.dao.mybatis.goods.recommend; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory; |
| | | |
| | | public interface RecommendGoodsDeleteHistoryMapper extends BaseMapper<RecommendGoodsDeleteHistory> { |
| | | |
| | | /** |
| | | * 批量查询商品是否在删除队列中 |
| | | * |
| | | * @param goodsList |
| | | * @return |
| | | */ |
| | | List<RecommendGoodsDeleteHistory> listByGoodsInfo(@Param("device") String device, |
| | | @Param("goodsList") List<RecommendGoodsDeleteHistory> goodsList); |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.taobao.s618.SuperTaoBaoGoods;
|
| | |
|
| | | @Repository
|
| | | public class SuperTaoBaoGoodsDao extends MongodbBaseDao<SuperTaoBaoGoods> {
|
| | |
|
| | | public List<SuperTaoBaoGoods> listByMaxAndMinFinalPrice(BigDecimal minPrice, BigDecimal maxPrice, int start,
|
| | | int count) {
|
| | | Query query = new Query();
|
| | | Criteria ca = new Criteria();
|
| | | ca.andOperator(Criteria.where("finalPrice").lt(maxPrice.multiply(new BigDecimal(100)).intValue()),
|
| | | Criteria.where("finalPrice").gte(minPrice.multiply(new BigDecimal(100)).intValue()));
|
| | | query.addCriteria(ca);
|
| | | query.limit(count);
|
| | | query.skip(start);
|
| | | return mongoTemplate.find(query, SuperTaoBaoGoods.class);
|
| | | }
|
| | |
|
| | | public long countByMaxAndMinFinalPrice(BigDecimal minPrice, BigDecimal maxPrice) {
|
| | | Query query = new Query();
|
| | | Criteria ca = new Criteria();
|
| | | ca.andOperator(Criteria.where("finalPrice").lt(maxPrice.multiply(new BigDecimal(100)).intValue()),
|
| | | Criteria.where("finalPrice").gte(minPrice.multiply(new BigDecimal(100)).intValue()));
|
| | | query.addCriteria(ca);
|
| | | return mongoTemplate.count(query, SuperTaoBaoGoods.class);
|
| | | }
|
| | |
|
| | | public void deleteByMaxTime(long timeStamp) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("updateTime").lt(timeStamp));
|
| | | mongoTemplate.remove(query, SuperTaoBaoGoods.class);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Column(name = "ud_beizhu")
|
| | | private String beiZhu;
|
| | |
|
| | | public RecommendGoodsDeleteHistory(Long goodsId, Integer goodsSource) {
|
| | | this.goodsId = goodsId;
|
| | | this.goodsSource = goodsSource;
|
| | | }
|
| | | public RecommendGoodsDeleteHistory() {
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
| | | private boolean coupon; // 是否有券
|
| | |
|
| | | @Expose
|
| | | private boolean recommend = true; // 是否推荐
|
| | | private boolean recommend; // 是否推荐
|
| | |
|
| | |
|
| | | public int getMoneyType() {
|
New file |
| | |
| | | package com.yeshi.fanli.entity.taobao.s618;
|
| | |
|
| | | import org.springframework.data.annotation.Id;
|
| | | import org.springframework.data.mongodb.core.index.Indexed;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | @Document(collection = "super_taobao_goods")
|
| | | public class SuperTaoBaoGoods {
|
| | | @Id
|
| | | @Field
|
| | | private Long auctionId;
|
| | | @Indexed
|
| | | @Field
|
| | | private int finalPrice;// 分为单位
|
| | | @Field
|
| | | private TaoBaoGoodsBrief goods;
|
| | | @Field
|
| | | @Indexed
|
| | | private long updateTime;
|
| | |
|
| | | public long getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(long updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public SuperTaoBaoGoods(Long auctionId, int finalPrice, TaoBaoGoodsBrief goods) {
|
| | | this.auctionId = auctionId;
|
| | | this.finalPrice = finalPrice;
|
| | | this.goods = goods;
|
| | | }
|
| | |
|
| | | public SuperTaoBaoGoods() {
|
| | |
|
| | | }
|
| | |
|
| | | public int getFinalPrice() {
|
| | | return finalPrice;
|
| | | }
|
| | |
|
| | | public void setFinalPrice(int finalPrice) {
|
| | | this.finalPrice = finalPrice;
|
| | | }
|
| | |
|
| | | public Long getAuctionId() {
|
| | | return auctionId;
|
| | | }
|
| | |
|
| | | public void setAuctionId(Long auctionId) {
|
| | | this.auctionId = auctionId;
|
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getGoods() {
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public void setGoods(TaoBaoGoodsBrief goods) {
|
| | | this.goods = goods;
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.lable.LabelService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFlashSaleService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsActivityService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private BrandClassShopService brandClassShopService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsActivityService taoBaoGoodsActivityService;
|
| | |
|
| | | // 动态商品更新 ,1个小时更新
|
| | | @Scheduled(cron = "0 0 */1 * * ?")
|
| | |
| | | brandClassShopService.updateShopGoods();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 每小时更新一次
|
| | | */
|
| | | @Scheduled(cron = "0 0 0/1 * * ?")
|
| | | public void update618() {
|
| | | LogHelper.test("更新618商品");
|
| | | taoBaoGoodsActivityService.sysncS618Goods();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | from yeshi_ec_recommend_goods_user_delete where ud_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByGoodsInfo" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_recommend_goods_user_delete where ud_device = |
| | | #{device} |
| | | <foreach collection="goodsList" item="item" open=" and (" |
| | | close=")" separator=" or "> |
| | | ( |
| | | ud_goods_id= #{item.goodsId} and ud_goods_source=#{item.goodsSource} |
| | | ) |
| | | </foreach> |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_recommend_goods_user_delete where ud_id = |
| | | #{id,jdbcType=BIGINT} |
| | |
| | | package com.yeshi.fanli.service.impl.goods.recommend;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.concurrent.ConcurrentHashMap;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.qcloud.cos.model.ListMultipartUploadsRequest;
|
| | | import com.yeshi.fanli.dao.mybatis.goods.recommend.RecommendGoodsDeleteHistoryMapper;
|
| | | import com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | |
| | | recommendGoodsDeleteHistoryMapper.insertSelective(history);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> filterGoods(String device, List<TaoBaoGoodsBrief> goodsList) {
|
| | | List<TaoBaoGoodsBrief> resultList = new ArrayList<>();
|
| | | if (goodsList == null || goodsList.size() == 0)
|
| | | return goodsList;
|
| | |
|
| | | Map<Long, TaoBaoGoodsBrief> resultMap = new ConcurrentHashMap<>();
|
| | | List<RecommendGoodsDeleteHistory> hlist = new ArrayList<>();
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | hlist.add(new RecommendGoodsDeleteHistory(goods.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO));
|
| | | resultMap.put(goods.getAuctionId(), goods);
|
| | | }
|
| | | List<RecommendGoodsDeleteHistory> existList = recommendGoodsDeleteHistoryMapper.listByGoodsInfo(device, hlist);
|
| | | if (existList != null)
|
| | | for (RecommendGoodsDeleteHistory dh : existList)
|
| | | resultMap.remove(dh.getGoodsId());
|
| | |
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | if (resultMap.get(goods.getAuctionId()) != null)
|
| | | resultList.add(resultMap.get(goods.getAuctionId()));
|
| | | }
|
| | | return resultList;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialCardService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialPlaceService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | |
|
| | |
| | | }
|
| | |
|
| | | // 处理9.9包邮
|
| | | if (listArc != null && VersionUtil.greaterThan_1_5_50(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | if (listArc != null && VersionUtil.greaterThan_1_5_50(acceptData.getPlatform(), acceptData.getVersion())&&!Constant.IS_TEST)
|
| | | for (Special s : listArc) {
|
| | | if (s.getName().contains("9.9")) {// 9块9
|
| | | s.setJumpDetail(jumpDetailV2Service.getByTypeCache("common_template"));
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | if (payMoney != null && payMoney.compareTo(new BigDecimal(0)) > 0)
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getFanliOrderStatisticedTitle(),
|
| | | Constant.znxConfig.getFanliOrderStatisticedMsg().replace("[订单号]", orderId), null, null);
|
| | | } catch (PushException e) {
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.taobao.SuperTaoBaoGoodsDao;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.taobao.s618.SuperTaoBaoGoods;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsActivityService;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | @Service
|
| | | public class TaoBaoGoodsActivityServiceImpl implements TaoBaoGoodsActivityService {
|
| | |
|
| | | @Resource
|
| | | private SuperTaoBaoGoodsDao superTaoBaoGoodsDao;
|
| | |
|
| | | @Override
|
| | | public void sysncS618Goods() {
|
| | | long startTime = System.currentTimeMillis();
|
| | | for (int i = 0; i < 20; i++) {
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(18528, i + 1, 100);
|
| | | for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) {
|
| | | SuperTaoBaoGoods sg = new SuperTaoBaoGoods();
|
| | | sg.setAuctionId(goods.getAuctionId());
|
| | | sg.setGoods(goods);
|
| | | sg.setFinalPrice(TaoBaoUtil.getAfterUseCouplePrice(goods).multiply(new BigDecimal(100)).intValue());
|
| | | sg.setUpdateTime(System.currentTimeMillis());
|
| | | superTaoBaoGoodsDao.save(sg);
|
| | | }
|
| | | }
|
| | | // 删除更新时间比开始时间小的
|
| | | superTaoBaoGoodsDao.deleteByMaxTime(startTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listByPrice(BigDecimal minPrice, BigDecimal maxPrice, int page, int pageSize) {
|
| | | List<SuperTaoBaoGoods> list = superTaoBaoGoodsDao.listByMaxAndMinFinalPrice(minPrice, maxPrice,
|
| | | (page - 1) * pageSize, pageSize);
|
| | | List<TaoBaoGoodsBrief> newList = new ArrayList<>();
|
| | | if (list != null)
|
| | | for (SuperTaoBaoGoods goods : list)
|
| | | newList.add(goods.getGoods());
|
| | | return newList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByPrice(BigDecimal minPrice, BigDecimal maxPrice) {
|
| | | return superTaoBaoGoodsDao.countByMaxAndMinFinalPrice(minPrice, maxPrice);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | addGoodsList(result.getDetailList());
|
| | | totalCount += result.getDetailList().size();
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | LogHelper.test("大淘客总共更新数据数量:" + totalCount);
|
| | |
| | | package com.yeshi.fanli.service.inter.goods.recommend;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | public interface RecommendGoodsDeleteHistoryService {
|
| | |
|
| | |
| | | */
|
| | | public void addRecommendGoodsDeleteHistory(RecommendGoodsDeleteHistory history);
|
| | |
|
| | | /**
|
| | | * 过滤已经删除的商品
|
| | | * |
| | | * @param device
|
| | | * @param goodsList
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoGoodsBrief> filterGoods(String device, List<TaoBaoGoodsBrief> goodsList);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | /**
|
| | | * 淘宝活动服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface TaoBaoGoodsActivityService {
|
| | |
|
| | | /**
|
| | | * 同步618商品到数据库
|
| | | */
|
| | | public void sysncS618Goods();
|
| | |
|
| | | public List<TaoBaoGoodsBrief> listByPrice(BigDecimal minPrice,BigDecimal maxPrice, int page, int pageSize);
|
| | | |
| | | public long countByPrice(BigDecimal minPrice,BigDecimal maxPrice);
|
| | |
|
| | | }
|
| | |
| | |
|
| | | static Gson gson = new Gson();
|
| | |
|
| | | private static String request(String url) {
|
| | | String result = null;
|
| | |
|
| | | while (result == null) {
|
| | | try {
|
| | | result = HttpUtil.get(url);
|
| | | if (result != null && result.startsWith("<html>"))
|
| | | result = null;
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | Thread.sleep(400);
|
| | | } catch (InterruptedException e1) {
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | return result;
|
| | | }
|
| | |
|
| | | public static DaTaoKeApiResult goodsList(int page) {
|
| | | List<DaTaoKeDetail> list = new ArrayList<>();
|
| | | String url = String.format("http://api.dataoke.com/index.php?r=Port/index&type=total&appkey=%s&v=2&page=%s",
|
| | | Math.random() > 0.5 ? API_KEY : API_KEY_2, page + "");
|
| | | String result = HttpUtil.get(url);
|
| | | String result = request(url);
|
| | |
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | System.out.println(resultJson);
|
| | | JSONArray array = resultJson.optJSONArray("result");
|
| | |
| | | tg.setSalesType(1);
|
| | | // 测试使用
|
| | | // tg.setSalesType(Math.random() > 0.5 ? tg.getSalesType() : 3);
|
| | | if(Constant.IS_TEST)
|
| | | {
|
| | | if (Constant.IS_TEST) {
|
| | | List<ClientTextStyleVO> labels = new ArrayList<>();
|
| | | labels.add(new ClientTextStyleVO("标签内容", "#F14242"));
|
| | | labels.add(new ClientTextStyleVO("标签内容", "#00FF00"));
|
| | |
| | | taoBaoGoods.setCouponTotalCount(detail.getCouponTotalNum());
|
| | | taoBaoGoods.setPictUrl(detail.getMainPic());
|
| | | taoBaoGoods.setPictUrlWhite(detail.getMainPic());
|
| | | if (taoBaoGoods.getPictUrl() != null && !taoBaoGoods.getPictUrl().startsWith("http"))
|
| | | taoBaoGoods.setPictUrl("https:" + taoBaoGoods.getPictUrl());
|
| | |
|
| | | if (taoBaoGoods.getPictUrlWhite() != null && !taoBaoGoods.getPictUrlWhite().startsWith("http"))
|
| | | taoBaoGoods.setPictUrlWhite("https:" + taoBaoGoods.getPictUrlWhite());
|
| | |
|
| | | taoBaoGoods.setSellerId(detail.getSellerId());
|
| | | taoBaoGoods.setShopTitle(detail.getShopName());
|
| | | taoBaoGoods.setTitle(detail.getDtitle());
|
| | |
| | |
|
| | | public class TbImgUtil {
|
| | |
|
| | |
|
| | | public static String getTBSize320Img(String url) {
|
| | | return getTBSizeImg(url, 320);
|
| | | }
|
| | |
| | | return getTBSizeImgWebp(url, 320);
|
| | | }
|
| | |
|
| | | |
| | | |
| | |
|
| | | public static String getTBSize220ImgWebp(String url) {
|
| | | return getTBSizeImgWebp(url, 220);
|
| | | }
|
| | |
| | | public static String getTBSizeImg(String url, int size) {
|
| | | if (StringUtil.isNullOrEmpty(url))
|
| | | return url;
|
| | | if (url.contains("img.alicdn.com")||url.contains("gw.alicdn.com")) {
|
| | | if (url.contains("img.alicdn.com") || url.contains("gw.alicdn.com") || url.contains("gd1.alicdn.com")
|
| | | || url.contains("gd2.alicdn.com") || url.contains("gd3.alicdn.com") || url.contains("gd4.alicdn.com")) {
|
| | | boolean isMatch = Pattern.matches(".*[0-9]x[0-9].*", url);
|
| | | if (isMatch)
|
| | | return url;
|
| | |
| | | public static String getTBSizeImgWebp(String url, int size) {
|
| | | if (StringUtil.isNullOrEmpty(url))
|
| | | return url;
|
| | | if (url.contains("img.alicdn.com")||url.contains("gw.alicdn.com")) {
|
| | | if (url.contains("img.alicdn.com") || url.contains("gw.alicdn.com") || url.contains("gd1.alicdn.com")
|
| | | || url.contains("gd2.alicdn.com") || url.contains("gd3.alicdn.com") || url.contains("gd4.alicdn.com")) {
|
| | | boolean isMatch = Pattern.matches(".*[0-9]x[0-9].*", url);
|
| | | if (isMatch)
|
| | | return url;
|