| | |
| | | package com.yeshi.fanli.service.impl.goods;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.exception.ShareGoodsException;
|
| | | import com.yeshi.fanli.exception.share.ShareGoodsException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
|
| | | |
| | |
|
| | | @Override
|
| | | public String getGoodsUserHongBao(TaoBaoGoodsBrief goods) {
|
| | | BigDecimal rate = hongBaoManageService.getFanLiRate();
|
| | | return TaoBaoUtil.getGoodsHongBaoInfo(goods, rate);
|
| | | return TaoBaoUtil.getGoodsHongBaoInfo(goods, rate,false);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteByPrimaryKey(Long id) {
|
| | | taoBaoGoodsBriefMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteBatchByGoodsId(List<Long> list) {
|
| | | taoBaoGoodsBriefMapper.deleteBatchByGoodsId(list);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> queryByAuctionId(Long auctionId) {
|
| | | return taoBaoGoodsBriefMapper.queryByAuctionId(auctionId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listQueryByAuctionId(List<Long> list) {
|
| | | return taoBaoGoodsBriefMapper.queryGoodsByAuctionId(list);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int insertSelective(TaoBaoGoodsBrief taoBaoGoodsBrief) {
|
| | | return taoBaoGoodsBriefMapper.insertSelective(taoBaoGoodsBrief);
|
| | | public List<Long> listExistById(List<Long> list) {
|
| | | if (list != null && list.size() > 0)
|
| | | return taoBaoGoodsBriefMapper.listExistById(list);
|
| | | else
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | public TaoBaoGoodsBrief selectByPrimaryKey(Long id) {
|
| | | return taoBaoGoodsBriefMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | @Override
|
| | | public void setGoodsBriefDefault(TaoBaoGoodsBrief goodsBrief) {
|
| | |
| | | return taoBaoGoodsBrief;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listByShopId(long start, int count, Long shopId) {
|
| | | return taoBaoGoodsBriefMapper.listByShopId(start, count, shopId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByShopId(Long shopId) {
|
| | | return taoBaoGoodsBriefMapper.countByShopId(shopId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> filterOffLineGoods(List<TaoBaoGoodsBrief> goodsList) {
|
| | | int page = goodsList.size() % 40 == 0 ? goodsList.size() / 40 -1 : goodsList.size() / 40;
|
| | | List<TaoBaoGoodsBrief> flist = new ArrayList<>();
|
| | | for (int i = 0; i <= page; i++) {
|
| | | List<TaoBaoGoodsBrief> list = goodsList.subList(i * 40,
|
| | | i * 40 + 40 > goodsList.size() ?goodsList.size(): i * 40 + 40 );
|
| | | String ids = "";
|
| | | for (TaoBaoGoodsBrief goods : list) {
|
| | | ids += goods.getAuctionId() + ",";
|
| | | }
|
| | | ids = ids.endsWith(",") ? ids.substring(0, ids.length() - 1) : ids;
|
| | | Map<Long, TaoBaoGoodsBrief> goodsMap = new HashMap<>();
|
| | | try {
|
| | | List<TaoBaoGoodsBrief> finalList = TaoKeApiUtil.getBatchGoodsInfos(ids);
|
| | | if (finalList != null)
|
| | | for (TaoBaoGoodsBrief ggods : finalList)
|
| | | goodsMap.put(ggods.getAuctionId(), ggods);
|
| | |
|
| | | for (int j = 0; j < list.size(); j++) {
|
| | | if (goodsMap.get(list.get(j).getAuctionId()) == null) {
|
| | | list.remove(j);
|
| | | j--;
|
| | | }
|
| | | }
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | flist.addAll(list);
|
| | | }
|
| | | return flist;
|
| | | }
|
| | |
|
| | | }
|