| | |
| | | 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.TLJBuyGoodsDao;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
|
| | | @Service
|
| | | public class TLJBuyGoodsUpdateServiceImpl implements TLJBuyGoodsUpdateService {
|
| | | @Resource
|
| | | private TLJBuyGoodsDao tljBuyGoodsDao;
|
| | | @Resource
|
| | | private EhCacheCacheManager ehCacheCacheManager;
|
| | |
|
| | | @Override
|
| | | public void updateGoods(TaoBaoGoodsBrief goods) {
|
| | | if (goods == null)
|
| | | return;
|
| | | List<TLJBuyGoods> list = tljBuyGoodsDao.listByAuctionId(goods.getAuctionId());
|
| | | // 查询自购立减是否小于1元
|
| | | BigDecimal money = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
|
| | | // if (money.compareTo(new BigDecimal(1)) < 0) {// 删除商品
|
| | | // if (list != null)
|
| | | // for (TLJBuyGoods tljGoods : list) {
|
| | | // tljBuyGoodsDao.delete(tljGoods.getId());
|
| | | // }
|
| | | // }
|
| | |
|
| | | if (list != null)
|
| | | for (TLJBuyGoods 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(
|
| | | "tljBuy-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());
|
| | | tljBuyGoodsDao.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.TLJBuyGoodsDao; |
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsUpdateService; |
| | | import com.yeshi.fanli.util.TaoBaoConstant; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | |
| | | @Service |
| | | public class TLJBuyGoodsUpdateServiceImpl implements TLJBuyGoodsUpdateService { |
| | | @Resource |
| | | private TLJBuyGoodsDao tljBuyGoodsDao; |
| | | @Resource |
| | | private EhCacheCacheManager ehCacheCacheManager; |
| | | |
| | | @Override |
| | | public void updateGoods(TaoBaoGoodsBrief goods) { |
| | | if (goods == null) |
| | | return; |
| | | List<TLJBuyGoods> list = tljBuyGoodsDao.listByAuctionId(goods.getAuctionId()); |
| | | // 查询自购立减是否小于1元 |
| | | BigDecimal money = TaoBaoUtil.getGoodsHongBaoMoney(goods, TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE,false); |
| | | // if (money.compareTo(new BigDecimal(1)) < 0) {// 删除商品 |
| | | // if (list != null) |
| | | // for (TLJBuyGoods tljGoods : list) { |
| | | // tljBuyGoodsDao.delete(tljGoods.getId()); |
| | | // } |
| | | // } |
| | | |
| | | if (list != null) |
| | | for (TLJBuyGoods 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( |
| | | "tljBuy-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()); |
| | | tljBuyGoodsDao.save(TLJBuyGoods); |
| | | } |
| | | } |
| | | } |