From 69bee82b81626b82b7f39f0e459e4f56b1699b51 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 13 三月 2019 12:02:16 +0800 Subject: [PATCH] 正式数据库修改 --- fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoGoodsUpdateServiceImpl.java | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoGoodsUpdateServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoGoodsUpdateServiceImpl.java index be302a1..599c960 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoGoodsUpdateServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoGoodsUpdateServiceImpl.java @@ -12,6 +12,7 @@ import com.google.gson.Gson; import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper; +import com.yeshi.fanli.entity.goods.CommonGoods; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.exception.goods.CommonGoodsException; import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; @@ -60,7 +61,7 @@ } } catch (TaobaoGoodsDownException e) { - downTaoBaoGoods(goods.getAuctionId()); + offlineTaoBaoGoods(goods.getAuctionId()); } catch (Exception e) { } @@ -82,7 +83,7 @@ @Transactional @Override - public void downTaoBaoGoods(Long auctionId) { + public void offlineTaoBaoGoods(Long auctionId) { // 鍒犻櫎棣栭〉鎺ㄨ崘鏁版嵁 recommendSectionGoodsService.deleteRecommendSectionGoodsByTbAuctionId(auctionId); // 鏇存柊鍔ㄦ�佹暟鎹� @@ -93,6 +94,9 @@ // 鍒犻櫎鍟嗗搧鏈韩鏁版嵁 taoBaoGoodsBriefMapper.deleteByAuctionId(auctionId); + + // 鏇存柊绠�鐗堝晢鍝佺姸鎬佷负涓嬫灦 + commonGoodsService.offlineCommonGoods(auctionId, CommonGoods.GOODS_TYPE_TB); } @Transactional @@ -120,6 +124,9 @@ taoBaoGoodsBriefMapper.updateByPrimaryKeySelective(updateGoods); } + + // 鏇存柊鍔ㄦ�佸晢鍝� + activityService.updateRecommendActivityGoods(goods); } @Override @@ -145,6 +152,7 @@ // 鏇存柊鏍囬锛屽晢鍝佸浘鐗囷紝閿�閲忥紝浠锋牸锛屽埜淇℃伅锛岃繑鍒╀俊鎭紝搴楅摵淇℃伅锛屽垎绫讳俊鎭� updateGoods.setTitle(goods.getTitle()); updateGoods.setPictUrl(goods.getPictUrl()); + updateGoods.setPictUrlWhite(goods.getPictUrlWhite()); updateGoods.setImgList(goods.getImgList()); updateGoods.setBiz30day(goods.getBiz30day()); updateGoods.setZkPrice(goods.getZkPrice()); @@ -188,14 +196,23 @@ @Override public void updateTaoBaoGoods(List<TaoBaoGoodsBrief> goodsList) throws TaobaoGoodsUpdateException { - if (goodsList == null) - return; + if (goodsList == null || goodsList.size() == 0) + throw new TaobaoGoodsUpdateException(1, "鍟嗗搧鍒楄〃涓虹┖"); + List<TaoBaoGoodsBrief> updateList = new ArrayList<>(); + for (TaoBaoGoodsBrief goods : goodsList) { - if (goods.getId() == null || goods.getId() == 0L) + + if (goods.getId() == null || goods.getId() == 0L) { throw new TaobaoGoodsUpdateException(1, "鍟嗗搧涓婚敭ID涓虹┖"); - updateList.add(goods); + } + + TaoBaoGoodsBrief updateGoods = getUpdateTaoBaoGoodsBrief(goods); + updateGoods.setCreatetime(goods.getCreatetime()); + + updateList.add(updateGoods); } + taoBaoGoodsBriefMapper.updateBatchSelective(updateList); } -- Gitblit v1.8.0