From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJFreeBuyGoodsUpdateServiceImpl.java | 190 +++++++++++++++++++++++----------------------- 1 files changed, 95 insertions(+), 95 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJFreeBuyGoodsUpdateServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJFreeBuyGoodsUpdateServiceImpl.java index dfdd8d6..0bef45f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJFreeBuyGoodsUpdateServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJFreeBuyGoodsUpdateServiceImpl.java @@ -1,96 +1,96 @@ -package com.yeshi.fanli.service.impl.taobao; - -import java.math.BigDecimal; -import java.util.List; - -import javax.annotation.Resource; - -import org.springframework.cache.ehcache.EhCacheCacheManager; -import org.springframework.stereotype.Service; - -import com.yeshi.fanli.dao.taobao.TLJFreeBuyGoodsDao; -import com.yeshi.fanli.entity.taobao.TLJFreeBuyGoods; -import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; -import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; -import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsUpdateService; -import org.yeshi.utils.TimeUtil; -import com.yeshi.fanli.util.taobao.TaoBaoUtil; - -@Service -public class TLJFreeBuyGoodsUpdateServiceImpl implements TLJFreeBuyGoodsUpdateService { - @Resource - private TLJFreeBuyGoodsDao tljFreeBuyGoodsDao; - - @Resource - private EhCacheCacheManager ehCacheCacheManager; - - @Resource - private HongBaoManageService hongBaoManageService; - - - @Override - public void updateGoods(TaoBaoGoodsBrief goods) { - if (goods == null) - return; - - List<TLJFreeBuyGoods> list = tljFreeBuyGoodsDao.listByGoodsId(goods.getAuctionId()); - if (list != null) { - - // 楠岃瘉鏄惁鏈夊埜 - if (goods.getCouponAmount() == null || goods.getCouponAmount().compareTo(new BigDecimal(0)) <= 0) { - for (TLJFreeBuyGoods tljGoods : list) { - tljFreeBuyGoodsDao.delete(tljGoods.getId()); - } - return; - } - - // 璁$畻鍒稿悗浠� 1<= n <= 2 - BigDecimal couplePrice = TaoBaoUtil.getAfterUseCouplePrice(goods); - if (couplePrice.compareTo(new BigDecimal(1.0)) < 0 || couplePrice.compareTo(new BigDecimal(2.0)) > 0) { - for (TLJFreeBuyGoods tljGoods : list) { - tljFreeBuyGoodsDao.delete(tljGoods.getId()); - } - return; - } - - for (TLJFreeBuyGoods TLJBuyGoods : list) { - if (goods.getCouponInfo() == null) - goods.setCouponInfo(""); - if (goods.getCouponAmount() == null) - goods.setCouponAmount(new BigDecimal(0)); - - // 鍒ゆ柇 鍒镐俊鎭� 浠锋牸淇℃伅 杩斿埄姣斾緥淇℃伅鏄惁鏀瑰彉 - boolean change = false; - if (goods.getZkPrice().compareTo(TLJBuyGoods.getGoods().getZkPrice()) != 0) - change = true; - if (goods.getCouponAmount().compareTo(TLJBuyGoods.getGoods().getCouponAmount()) != 0) - change = true; - if (!goods.getCouponInfo().equalsIgnoreCase(TLJBuyGoods.getGoods().getCouponInfo())) - change = true; - if (goods.getTkRate().compareTo(TLJBuyGoods.getGoods().getTkRate()) != 0) - change = true; - - if (change) { - // 娓呴櫎鍒楄〃缂撳瓨 - ehCacheCacheManager.getCache("commonContentCache").evict( - "TLJFreeBuy-listByDay" + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd")); - } - - // 鏇存柊鍒镐俊鎭� 锛屼环鏍间俊鎭紝閿�閲忎俊鎭� - TLJBuyGoods.getGoods().setZkPrice(goods.getZkPrice()); - TLJBuyGoods.getGoods().setCouponAmount(goods.getCouponAmount()); - TLJBuyGoods.getGoods().setCouponInfo(goods.getCouponInfo()); - TLJBuyGoods.getGoods().setCouponEffectiveEndTime(goods.getCouponEffectiveEndTime()); - TLJBuyGoods.getGoods().setCouponEffectiveStartTime(goods.getCouponEffectiveStartTime()); - TLJBuyGoods.getGoods().setCouponLeftCount(goods.getCouponLeftCount()); - TLJBuyGoods.getGoods().setCouponStartFee(goods.getCouponStartFee()); - TLJBuyGoods.getGoods().setCouponTotalCount(goods.getCouponTotalCount()); - TLJBuyGoods.getGoods().setBiz30day(goods.getBiz30day()); - TLJBuyGoods.getGoods().setTkRate(goods.getTkRate()); - TLJBuyGoods.getGoods().setId(goods.getId()); - TLJBuyGoods.getGoods().setAuctionId(goods.getAuctionId()); - tljFreeBuyGoodsDao.save(TLJBuyGoods); - } - } - } +package com.yeshi.fanli.service.impl.taobao; + +import java.math.BigDecimal; +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.cache.ehcache.EhCacheCacheManager; +import org.springframework.stereotype.Service; + +import com.yeshi.fanli.dao.taobao.TLJFreeBuyGoodsDao; +import com.yeshi.fanli.entity.taobao.TLJFreeBuyGoods; +import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; +import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; +import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsUpdateService; +import org.yeshi.utils.TimeUtil; +import com.yeshi.fanli.util.taobao.TaoBaoUtil; + +@Service +public class TLJFreeBuyGoodsUpdateServiceImpl implements TLJFreeBuyGoodsUpdateService { + @Resource + private TLJFreeBuyGoodsDao tljFreeBuyGoodsDao; + + @Resource + private EhCacheCacheManager ehCacheCacheManager; + + @Resource + private HongBaoManageService hongBaoManageService; + + + @Override + public void updateGoods(TaoBaoGoodsBrief goods) { + if (goods == null) + return; + + List<TLJFreeBuyGoods> list = tljFreeBuyGoodsDao.listByGoodsId(goods.getAuctionId()); + if (list != null) { + + // 楠岃瘉鏄惁鏈夊埜 + if (goods.getCouponAmount() == null || goods.getCouponAmount().compareTo(new BigDecimal(0)) <= 0) { + for (TLJFreeBuyGoods tljGoods : list) { + tljFreeBuyGoodsDao.delete(tljGoods.getId()); + } + return; + } + + // 璁$畻鍒稿悗浠� 1<= n <= 2 + BigDecimal couplePrice = TaoBaoUtil.getCouponPrice(goods); + if (couplePrice.compareTo(new BigDecimal(1.0)) < 0 || couplePrice.compareTo(new BigDecimal(2.0)) > 0) { + for (TLJFreeBuyGoods tljGoods : list) { + tljFreeBuyGoodsDao.delete(tljGoods.getId()); + } + return; + } + + for (TLJFreeBuyGoods TLJBuyGoods : list) { + if (goods.getCouponInfo() == null) + goods.setCouponInfo(""); + if (goods.getCouponAmount() == null) + goods.setCouponAmount(new BigDecimal(0)); + + // 鍒ゆ柇 鍒镐俊鎭� 浠锋牸淇℃伅 杩斿埄姣斾緥淇℃伅鏄惁鏀瑰彉 + boolean change = false; + if (goods.getZkPrice().compareTo(TLJBuyGoods.getGoods().getZkPrice()) != 0) + change = true; + if (goods.getCouponAmount().compareTo(TLJBuyGoods.getGoods().getCouponAmount()) != 0) + change = true; + if (!goods.getCouponInfo().equalsIgnoreCase(TLJBuyGoods.getGoods().getCouponInfo())) + change = true; + if (goods.getTkRate().compareTo(TLJBuyGoods.getGoods().getTkRate()) != 0) + change = true; + + if (change) { + // 娓呴櫎鍒楄〃缂撳瓨 + ehCacheCacheManager.getCache("commonContentCache").evict( + "TLJFreeBuy-listByDay" + TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd")); + } + + // 鏇存柊鍒镐俊鎭� 锛屼环鏍间俊鎭紝閿�閲忎俊鎭� + TLJBuyGoods.getGoods().setZkPrice(goods.getZkPrice()); + TLJBuyGoods.getGoods().setCouponAmount(goods.getCouponAmount()); + TLJBuyGoods.getGoods().setCouponInfo(goods.getCouponInfo()); + TLJBuyGoods.getGoods().setCouponEffectiveEndTime(goods.getCouponEffectiveEndTime()); + TLJBuyGoods.getGoods().setCouponEffectiveStartTime(goods.getCouponEffectiveStartTime()); + TLJBuyGoods.getGoods().setCouponLeftCount(goods.getCouponLeftCount()); + TLJBuyGoods.getGoods().setCouponStartFee(goods.getCouponStartFee()); + TLJBuyGoods.getGoods().setCouponTotalCount(goods.getCouponTotalCount()); + TLJBuyGoods.getGoods().setBiz30day(goods.getBiz30day()); + TLJBuyGoods.getGoods().setTkRate(goods.getTkRate()); + TLJBuyGoods.getGoods().setId(goods.getId()); + TLJBuyGoods.getGoods().setAuctionId(goods.getAuctionId()); + tljFreeBuyGoodsDao.save(TLJBuyGoods); + } + } + } } \ No newline at end of file -- Gitblit v1.8.0