| | |
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.goods.CommonGoodsException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefMapper taoBaoGoodsBriefMapper;
|
| | |
|
| | | @Resource
|
| | | private CommonGoodsService commonGoodsService;
|
| | |
|
| | | @Override
|
| | | public void startUpdate() {
|
| | |
| | | if (goods.getAuctionId() == null || goods.getAuctionId() == 0)
|
| | | throw new TaobaoGoodsUpdateException(2, "商品ID为空");
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = taoBaoGoodsBriefMapper.queryByAuctionId(goods.getAuctionId());
|
| | | if (goodsList == null || goodsList.size() == 0)
|
| | | throw new TaobaoGoodsUpdateException(3, "商品不在商品库中");
|
| | |
|
| | | for (TaoBaoGoodsBrief tb : goodsList) {
|
| | | goods.setId(tb.getId());
|
| | | TaoBaoGoodsBrief updateGoods = getUpdateTaoBaoGoodsBrief(goods);
|
| | | System.out.println("更细信息:" + new Gson().toJson(updateGoods));
|
| | | taoBaoGoodsBriefMapper.updateByPrimaryKeySelective(updateGoods);
|
| | | // 更新收藏信息
|
| | | try {
|
| | | commonGoodsService.updateCommonGoods(CommonGoodsFactory.create(goods));
|
| | | } catch (CommonGoodsException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = taoBaoGoodsBriefMapper.queryByAuctionId(goods.getAuctionId());
|
| | | if (goodsList != null)
|
| | | for (TaoBaoGoodsBrief tb : goodsList) {
|
| | | goods.setId(tb.getId());
|
| | | TaoBaoGoodsBrief updateGoods = getUpdateTaoBaoGoodsBrief(goods);
|
| | | System.out.println("更细信息:" + new Gson().toJson(updateGoods));
|
| | | taoBaoGoodsBriefMapper.updateByPrimaryKeySelective(updateGoods);
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | | @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);
|
| | | }
|
| | |
|