admin
2019-12-04 da4c766d07a83e62992a0e287b678e13aeb6afda
Merge remote-tracking branch 'origin/div' into div
8个文件已修改
531 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandInfoMapper.xml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java 441 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJFreeBuyGoodsServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJFreeBuyGoodsUpdateServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinNewbiesServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/BrandInfoJob.java
@@ -5,6 +5,7 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.brand.BrandInfoService;
import com.yeshi.fanli.util.Constant;
@@ -31,9 +32,14 @@
        long count = brandInfoService.countValidByCid(null);
        if (count == 0)
            return;
        for (int page = 0; page < (count / 80) + 1; page++) {
            brandInfoService.addShopAndGoods(page * 80, 80);
        long totalPage = (count / 100) + 1;
        for (long page = 0; page < totalPage; page++) {
            try {
                brandInfoService.addShopAndGoods(page * 100, 100);
            } catch (Exception e) {
               LogHelper.errorDetailInfo(e);
            }
        }
    }
    
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandInfoMapper.xml
@@ -155,7 +155,10 @@
  
  <select id="listValidAll" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_brand_info d
    WHERE d.`bf_state` = 1
    WHERE d.`bf_state` = 1
        AND (TO_DAYS(d.`bf_update_time`)<![CDATA[<]]> TO_DAYS(NOW())
             OR HOUR(NOW()) - HOUR(d.`bf_update_time`) <![CDATA[>=]]> 2)
    ORDER BY d.`bf_update_time`
    LIMIT ${start},${count}
  </select>
  
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandGoodsCaheServiceImpl.java
@@ -21,6 +21,7 @@
import com.yeshi.fanli.entity.taobao.SearchFilter;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.brand.BrandGoodsCaheService;
import com.yeshi.fanli.service.inter.brand.BrandShopCaheService;
import com.yeshi.fanli.service.inter.config.ConfigService;
@@ -40,14 +41,13 @@
    @Resource
    private ConfigService configService;
    @Resource
    private BrandGoodsCaheDao brandGoodsCaheDao;
    @Resource
    private BrandShopCaheService brandShopCaheService;
    @Override
    public BrandInfo addBrandGoods(BrandInfo brandInfo) {
        // 淘宝
@@ -56,264 +56,273 @@
        BrandInfo goodsJD = addBrandGoodsJD(brandInfo);
        // 拼多多
        BrandInfo goodsPDD = addBrandGoodsPDD(brandInfo);
        int goodsTotal = goodsTB.getGoodsTotal() + goodsJD.getGoodsTotal() +  goodsPDD.getGoodsTotal();
        int shopTotal = goodsTB.getShopTotal() + goodsJD.getShopTotal() +  goodsPDD.getShopTotal();
        int goodsTotal = goodsTB.getGoodsTotal() + goodsJD.getGoodsTotal() + goodsPDD.getGoodsTotal();
        int shopTotal = goodsTB.getShopTotal() + goodsJD.getShopTotal() + goodsPDD.getShopTotal();
        goodsTB.setGoodsTotal(goodsTotal);
        goodsTB.setShopTotal(shopTotal);
        return goodsTB;
    }
    /**
     * 淘宝商品
     *
     * @param brandInfo
     * @return
     */
    private BrandInfo addBrandGoodsTB(BrandInfo brandInfo) {
        BrandInfo numInfo = new BrandInfo();
        Date date = new Date();
        String shopKey = brandInfo.getShopKey();
        if (StringUtil.isNullOrEmpty(shopKey)) {
            // 删除之前的
            brandGoodsCaheDao.removeByDate(brandInfo.getId(), 1 , date);
            // 删除店铺
            brandShopCaheService.removeByDateAndType(brandInfo.getId(), 11, date);
            numInfo.setShopTotal(0);
            numInfo.setGoodsTotal(0);
            return numInfo;
        }
        String searchKey = brandInfo.getSearchKey();
        if (StringUtil.isNullOrEmpty(searchKey))
            searchKey = brandInfo.getName();
        SearchFilter filter = new SearchFilter();
        filter.setKey(searchKey);
        filter.setPage(1);
        filter.setPageSize(100);
        filter.setTmall(true);
        filter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
        TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiao(filter);
        // 删除店铺
        brandShopCaheService.removeByDateAndType(brandInfo.getId(), 11, date);
        // 组织商品 + 添加店铺
        int count = 0;
        int countShop = 0;
        if (searchResult != null && searchResult.getTaoBaoGoodsBriefs() != null
                && searchResult.getTaoBaoGoodsBriefs().size() > 0) {
            boolean addShop = true;
            List<TaoBaoGoodsBrief> listGoods = searchResult.getTaoBaoGoodsBriefs();
            for (TaoBaoGoodsBrief goods: listGoods) {
                // 添加店铺
                String shopTitle = goods.getShopTitle();
                if (addShop && !StringUtil.isNullOrEmpty(shopTitle) && shopTitle.contains("旗舰店")
                        && shopTitle.toLowerCase().contains(shopKey.toLowerCase())) {
                    addShop = brandShopCaheService.addBrandShopTB(brandInfo, goods.getAuctionId(),
                            goods.getSellerId());
                    if (!addShop)
                        countShop = 1;
                }
                // 添加商品
                if (count < 50) {
                    BrandGoodsCahe brandGoods = new BrandGoodsCahe();
                    brandGoods.setBrandId(brandInfo.getId());
                    brandGoods.setWeight((int) (Math.random() * 1000));
                    brandGoods.setGoodsType(1);
                    brandGoods.setGoodsTB(goods);
                    brandGoods.setCreateTime(new Date());
                    brandGoodsCaheDao.insert(brandGoods);
                    count ++;
                } else if (!addShop) {
                    break;
                }
            }
        }
        // 删除之前的
        brandGoodsCaheDao.removeByDate(brandInfo.getId(), 1 , date);
        numInfo.setShopTotal(countShop);
        numInfo.setGoodsTotal(count);
        return numInfo;
    }
    /**
     *  京东商品
     *
     * @param brandInfo
     * @return
     */
    private BrandInfo addBrandGoodsJD(BrandInfo brandInfo) {
        BrandInfo numInfo = new BrandInfo();
        Date date = new Date();
        String shopKey = brandInfo.getShopKeyJD();
        if (StringUtil.isNullOrEmpty(shopKey)) {
            // 删除店铺
            brandShopCaheService.removeByDateAndType(brandInfo.getId(), 20, date);
            // 删除之前
            brandGoodsCaheDao.removeByDate(brandInfo.getId(), 2 , date);
            numInfo.setShopTotal(0);
            numInfo.setGoodsTotal(0);
            return numInfo;
        }
        String searchKey = brandInfo.getSearchKeyJD();
        if (StringUtil.isNullOrEmpty(searchKey))
            searchKey = brandInfo.getName();
        int count = 0;
        int countShop = 0;
        JDSearchResult result = null;
        String way = configService.get("jd_api_search_key");
        // 删除店铺
        brandShopCaheService.removeByDateAndType(brandInfo.getId(), 20, date);
        boolean addShop = true;
        for (int i=0; i < 2;i ++) {
            if ("1".equals(way)) {
                JDFilter filterAPI = new JDFilter();
                filterAPI.setKeyword(SearchFilterUtil.filterSearchContent(searchKey));
                filterAPI.setPageIndex(1);
                filterAPI.setPageSize(30);
                filterAPI.setSort(JDFilter.SORT_DESC);
                filterAPI.setSortName(JDFilter.SORTNAME_ORDER_COUNT_30DAYS);
                result = JDApiUtil.queryByKey(filterAPI);
            } else {
                // 网页爬取
                JDSearchFilter jdfilter = new JDSearchFilter();
                jdfilter.setKey(SearchFilterUtil.filterSearchContent(searchKey));
                jdfilter.setPageNo(1);
                jdfilter.setPageSize(30);
                jdfilter.setSort(JDSearchFilter.SORT_DESC);
                jdfilter.setSortName(JDSearchFilter.SORTNAME_ORDER_COUNT_30DAYS);
                result = JDUtil.searchByKey(jdfilter);
        numInfo.setShopTotal(0);
        numInfo.setGoodsTotal(0);
        try {
            String shopKey = brandInfo.getShopKey();
            if (StringUtil.isNullOrEmpty(shopKey)) {
                // 删除之前的
                brandGoodsCaheDao.removeByDate(brandInfo.getId(), 1, date);
                // 删除店铺
                brandShopCaheService.removeByDateAndType(brandInfo.getId(), 11, date);
                return numInfo;
            }
            if (result != null && result.getGoodsList() != null && result.getGoodsList().size() > 0) {
                List<JDGoods> goodsList = result.getGoodsList();
                for (JDGoods goods : goodsList) {
                    BrandGoodsCahe brandGoods = new BrandGoodsCahe();
                    brandGoods.setBrandId(brandInfo.getId());
                    brandGoods.setWeight((int) (Math.random() * 1000));
                    brandGoods.setGoodsJD(goods);
                    brandGoods.setGoodsType(2);
                    brandGoods.setCreateTime(new Date());
                    brandGoodsCaheDao.insert(brandGoods);
                    JDShopInfo shopInfo = goods.getShopInfo();
                    if (addShop && shopInfo != null) {
                        // 包含该品牌名称
                        String shopName = shopInfo.getShopName();
                        if (!StringUtil.isNullOrEmpty(shopName) && shopName.toLowerCase().contains(shopKey.toLowerCase())) {
                            addShop = false;
                            brandShopCaheService.addBrandShopJD(brandInfo, shopInfo);
            String searchKey = brandInfo.getSearchKey();
            if (StringUtil.isNullOrEmpty(searchKey))
                searchKey = brandInfo.getName();
            SearchFilter filter = new SearchFilter();
            filter.setKey(searchKey);
            filter.setPage(1);
            filter.setPageSize(100);
            filter.setTmall(true);
            filter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
            TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiao(filter);
            // 删除店铺
            brandShopCaheService.removeByDateAndType(brandInfo.getId(), 11, date);
            // 组织商品 + 添加店铺
            int count = 0;
            int countShop = 0;
            if (searchResult != null && searchResult.getTaoBaoGoodsBriefs() != null
                    && searchResult.getTaoBaoGoodsBriefs().size() > 0) {
                boolean addShop = true;
                List<TaoBaoGoodsBrief> listGoods = searchResult.getTaoBaoGoodsBriefs();
                for (TaoBaoGoodsBrief goods : listGoods) {
                    // 添加店铺
                    String shopTitle = goods.getShopTitle();
                    if (addShop && !StringUtil.isNullOrEmpty(shopTitle) && shopTitle.contains("旗舰店")
                            && shopTitle.toLowerCase().contains(shopKey.toLowerCase())) {
                        addShop = brandShopCaheService.addBrandShopTB(brandInfo, goods.getAuctionId(),
                                goods.getSellerId());
                        if (!addShop)
                            countShop = 1;
                        }
                    }
                    count ++;
                    if (count >= 50) {
                    // 添加商品
                    if (count < 50) {
                        BrandGoodsCahe brandGoods = new BrandGoodsCahe();
                        brandGoods.setBrandId(brandInfo.getId());
                        brandGoods.setWeight((int) (Math.random() * 1000));
                        brandGoods.setGoodsType(1);
                        brandGoods.setGoodsTB(goods);
                        brandGoods.setCreateTime(new Date());
                        brandGoodsCaheDao.insert(brandGoods);
                        count++;
                    } else if (!addShop) {
                        break;
                    }
                }
            }
            // 删除之前的
            brandGoodsCaheDao.removeByDate(brandInfo.getId(), 1, date);
            numInfo.setShopTotal(countShop);
            numInfo.setGoodsTotal(count);
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
        }
        // 删除之前
        brandGoodsCaheDao.removeByDate(brandInfo.getId(), 2 , date);
        numInfo.setShopTotal(countShop);
        numInfo.setGoodsTotal(count);
        return numInfo;
        return numInfo;
    }
    /**
     * 京东商品
     *
     * @param brandInfo
     * @return
     */
    private BrandInfo addBrandGoodsJD(BrandInfo brandInfo) {
        Date date = new Date();
        BrandInfo numInfo = new BrandInfo();
        numInfo.setShopTotal(0);
        numInfo.setGoodsTotal(0);
        try {
            String shopKey = brandInfo.getShopKeyJD();
            if (StringUtil.isNullOrEmpty(shopKey)) {
                // 删除店铺
                brandShopCaheService.removeByDateAndType(brandInfo.getId(), 20, date);
                // 删除之前
                brandGoodsCaheDao.removeByDate(brandInfo.getId(), 2, date);
                return numInfo;
            }
            String searchKey = brandInfo.getSearchKeyJD();
            if (StringUtil.isNullOrEmpty(searchKey))
                searchKey = brandInfo.getName();
            int count = 0;
            int countShop = 0;
            JDSearchResult result = null;
            String way = configService.get("jd_api_search_key");
            // 删除店铺
            brandShopCaheService.removeByDateAndType(brandInfo.getId(), 20, date);
            boolean addShop = true;
            for (int i = 0; i < 2; i++) {
                if ("1".equals(way)) {
                    JDFilter filterAPI = new JDFilter();
                    filterAPI.setKeyword(SearchFilterUtil.filterSearchContent(searchKey));
                    filterAPI.setPageIndex(1);
                    filterAPI.setPageSize(30);
                    filterAPI.setSort(JDFilter.SORT_DESC);
                    filterAPI.setSortName(JDFilter.SORTNAME_ORDER_COUNT_30DAYS);
                    result = JDApiUtil.queryByKey(filterAPI);
                } else {
                    // 网页爬取
                    JDSearchFilter jdfilter = new JDSearchFilter();
                    jdfilter.setKey(SearchFilterUtil.filterSearchContent(searchKey));
                    jdfilter.setPageNo(1);
                    jdfilter.setPageSize(30);
                    jdfilter.setSort(JDSearchFilter.SORT_DESC);
                    jdfilter.setSortName(JDSearchFilter.SORTNAME_ORDER_COUNT_30DAYS);
                    result = JDUtil.searchByKey(jdfilter);
                }
                if (result != null && result.getGoodsList() != null && result.getGoodsList().size() > 0) {
                    List<JDGoods> goodsList = result.getGoodsList();
                    for (JDGoods goods : goodsList) {
                        BrandGoodsCahe brandGoods = new BrandGoodsCahe();
                        brandGoods.setBrandId(brandInfo.getId());
                        brandGoods.setWeight((int) (Math.random() * 1000));
                        brandGoods.setGoodsJD(goods);
                        brandGoods.setGoodsType(2);
                        brandGoods.setCreateTime(new Date());
                        brandGoodsCaheDao.insert(brandGoods);
                        JDShopInfo shopInfo = goods.getShopInfo();
                        if (addShop && shopInfo != null) {
                            // 包含该品牌名称
                            String shopName = shopInfo.getShopName();
                            if (!StringUtil.isNullOrEmpty(shopName)
                                    && shopName.toLowerCase().contains(shopKey.toLowerCase())) {
                                addShop = false;
                                brandShopCaheService.addBrandShopJD(brandInfo, shopInfo);
                                countShop = 1;
                            }
                        }
                        count++;
                        if (count >= 50) {
                            break;
                        }
                    }
                }
            }
            // 删除之前
            brandGoodsCaheDao.removeByDate(brandInfo.getId(), 2, date);
            numInfo.setShopTotal(countShop);
            numInfo.setGoodsTotal(count);
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
        }
        return numInfo;
    }
    /**
     * 拼多多商品
     *
     * @param brandInfo
     * @return
     */
    private BrandInfo addBrandGoodsPDD(BrandInfo brandInfo) {
        Date date = new Date();
        BrandInfo numInfo = new BrandInfo();
        String shopKey = brandInfo.getShopKeyPDD();
        if (StringUtil.isNullOrEmpty(shopKey)) {
        numInfo.setShopTotal(0);
        numInfo.setGoodsTotal(0);
        try {
            String shopKey = brandInfo.getShopKeyPDD();
            if (StringUtil.isNullOrEmpty(shopKey)) {
                // 删除之前
                brandGoodsCaheDao.removeByDate(brandInfo.getId(), 3, date);
                // 删除之前店铺
                brandShopCaheService.removeByDateAndType(brandInfo.getId(), 30, date);
                return numInfo;
            }
            String searchKey = brandInfo.getSearchKeyPDD();
            if (StringUtil.isNullOrEmpty(searchKey))
                searchKey = brandInfo.getName();
            PDDSearchFilter pddfilter = new PDDSearchFilter();
            pddfilter.setKw(searchKey);
            pddfilter.setPage(1);
            pddfilter.setPageSize(100);
            pddfilter.setSortType(6);
            PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
            int count = 0;
            if (result != null) {
                List<PDDGoodsDetail> goodsList = result.getGoodsList();
                if (goodsList != null && goodsList.size() > 0) {
                    for (PDDGoodsDetail goods : goodsList) {
                        BrandGoodsCahe brandGoods = new BrandGoodsCahe();
                        brandGoods.setBrandId(brandInfo.getId());
                        brandGoods.setWeight((int) (Math.random() * 1000));
                        brandGoods.setGoodsType(3);
                        brandGoods.setGoodsPDD(goods);
                        brandGoods.setCreateTime(new Date());
                        brandGoodsCaheDao.insert(brandGoods);
                        count++;
                        if (count >= 50) {
                            break;
                        }
                    }
                }
            }
            // 删除之前
            brandGoodsCaheDao.removeByDate(brandInfo.getId(), 3, date);
            // 删除之前店铺
            brandShopCaheService.removeByDateAndType(brandInfo.getId(), 30, date);
            numInfo.setShopTotal(0);
            numInfo.setGoodsTotal(0);
            return numInfo;
            // 添加店铺
            int countShop = brandShopCaheService.addBrandShopPDD(brandInfo);
            numInfo.setShopTotal(countShop);
            numInfo.setGoodsTotal(count);
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
        }
        String searchKey = brandInfo.getSearchKeyPDD();
        if (StringUtil.isNullOrEmpty(searchKey))
            searchKey = brandInfo.getName();
        PDDSearchFilter pddfilter = new PDDSearchFilter();
        pddfilter.setKw(searchKey);
        pddfilter.setPage(1);
        pddfilter.setPageSize(100);
        pddfilter.setSortType(6);
        PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
        int count = 0;
        if (result != null) {
            List<PDDGoodsDetail> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                for (PDDGoodsDetail goods : goodsList) {
                    BrandGoodsCahe brandGoods = new BrandGoodsCahe();
                    brandGoods.setBrandId(brandInfo.getId());
                    brandGoods.setWeight((int) (Math.random() * 1000));
                    brandGoods.setGoodsType(3);
                    brandGoods.setGoodsPDD(goods);
                    brandGoods.setCreateTime(new Date());
                    brandGoodsCaheDao.insert(brandGoods);
                    count ++;
                    if (count >= 50) {
                        break;
                    }
                }
            }
        }
        // 删除之前
        brandGoodsCaheDao.removeByDate(brandInfo.getId(), 3, date);
        // 删除之前店铺
        brandShopCaheService.removeByDateAndType(brandInfo.getId(), 30, date);
        // 添加店铺
        int countShop = brandShopCaheService.addBrandShopPDD(brandInfo);
        numInfo.setShopTotal(countShop);
        numInfo.setGoodsTotal(count);
        return numInfo;
    }
    @Override
    public List<BrandGoodsCahe> getByBrandId(int start, int count, Long brandId){
    public List<BrandGoodsCahe> getByBrandId(int start, int count, Long brandId) {
        return brandGoodsCaheDao.getByBrandId(start, count, brandId);
    }
    @Override
    public long countByBrandId(Long brandId){
    public long countByBrandId(Long brandId) {
        return brandGoodsCaheDao.countByBrandId(brandId);
    }
    @Override
    public void removeAgoByDate(Date createTime) {
        brandGoodsCaheDao.removeAgoByDate(createTime);
    }
    @Override
    public void removeByBrandId(Long brandId) {
        brandGoodsCaheDao.removeByBrandId(brandId);
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -27,6 +27,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.exception.brand.BrandInfoException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
import com.yeshi.fanli.service.inter.brand.BrandGoodsCaheService;
import com.yeshi.fanli.service.inter.brand.BrandInfoService;
@@ -363,7 +364,7 @@
            } else {
                updateInfo.setShopTotal(listshop.size());
            }
            updateInfo.setWeight(Math.random() * 1000);
            brandInfoMapper.updateByPrimaryKeySelective(updateInfo);
        }
    }
@@ -376,19 +377,25 @@
            return;
        for (BrandInfo brandInfo : list) {
            String name = brandInfo.getName();
            String searchKey = brandInfo.getSearchKey();
            if (StringUtil.isNullOrEmpty(name) && StringUtil.isNullOrEmpty(searchKey))
                continue;
            // 添加商品
            BrandInfo numInfo = brandGoodsCaheService.addBrandGoods(brandInfo);
            brandInfo.setGoodsTotal(numInfo.getGoodsTotal());
            brandInfo.setShopTotal(numInfo.getShopTotal());
            brandInfo.setUpdateTime(new Date());
            brandInfo.setWeight(Math.random() * 1000);
            brandInfoMapper.updateByPrimaryKeySelective(brandInfo);
            try {
                String name = brandInfo.getName();
                String searchKey = brandInfo.getSearchKey();
                if (StringUtil.isNullOrEmpty(name) && StringUtil.isNullOrEmpty(searchKey))
                    continue;
                // 添加商品
                BrandInfo numInfo = brandGoodsCaheService.addBrandGoods(brandInfo);
                BrandInfo updateInfo = new BrandInfo();
                updateInfo.setId(brandInfo.getId());
                updateInfo.setWeight(Math.random() * 1000);
                updateInfo.setGoodsTotal(numInfo.getGoodsTotal());
                updateInfo.setShopTotal(numInfo.getShopTotal());
                updateInfo.setUpdateTime(new Date());
                brandInfoMapper.updateByPrimaryKeySelective(updateInfo);
            } catch (Exception e) {
                LogHelper.errorDetailInfo(e);
            }
        }
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java
@@ -685,18 +685,15 @@
        if (auctionId == null || auctionId <= 0) 
            throw new ShareGoodsException(1, "商品ID不能为空");
        
        TaoKeAppInfo app = new TaoKeAppInfo();
        app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
        app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
        if (pid == null) {
            app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT);
        } else {
            app.setPid(pid);
        TaoBaoGoodsBrief goods = null;
        try {
            goods = TaoKeApiUtil.searchGoodsDetail(auctionId);
        } catch (TaobaoGoodsDownException e) {
            throw new ShareGoodsException(1, "该商品已下架");
        }
        
        TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, app);
        if (goods == null) 
            throw new ShareGoodsException(1, "转链接失败");
            throw new ShareGoodsException(1, "该商品已下架");
        
        String taoLiJinLink = null;
        try {
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJFreeBuyGoodsServiceImpl.java
@@ -71,7 +71,7 @@
    }
    
    @Cacheable(value = "commonContentCache", key = "'tljFreeBuy-listByDay'+#day")
    //@Cacheable(value = "commonContentCache", key = "'tljFreeBuy-listByDay'+#day")
    @Override
    public List<TLJFreeBuyGoods> listByDay(String day) {
        List<TLJFreeBuyGoods> list = listByDay(day, 10);
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJFreeBuyGoodsUpdateServiceImpl.java
@@ -35,9 +35,18 @@
        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) {
            if (couplePrice.compareTo(new BigDecimal(1.0)) < 0 || couplePrice.compareTo(new BigDecimal(2.0)) > 0) {
                for (TLJFreeBuyGoods tljGoods : list) {
                    tljFreeBuyGoodsDao.delete(tljGoods.getId());
                }
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinNewbiesServiceImpl.java
@@ -217,6 +217,7 @@
        detail.setTitle(TaoLiJinDetailTypeEnum.add.getDesc());
        detail.setType(TaoLiJinDetailTypeEnum.add);
        detail.setCreateTime(new Date());
        detail.setRemark("新人红包");
        userTaoLiJinDetailService.insertSelective(detail);
        
        
@@ -252,11 +253,11 @@
        
        // 验证是否有券
        if (goods == null || goods.getCouponAmount() == null || 
                goods.getCouponAmount().compareTo(new BigDecimal(0)) == 0) {
                goods.getCouponAmount().compareTo(new BigDecimal(0)) <= 0) {
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    tljFreeBuyGoodsService.deleteByGoodsId(goods.getId());
                    tljFreeBuyGoodsService.deleteByGoodsId(goods.getAuctionId());
                }
            });
            throw new UserTaoLiJinNewbiesException(1, "该商品非免单商品");
@@ -264,11 +265,11 @@
        
        // 验证券后价 是否在 1-2元
        BigDecimal money = TaoBaoUtil.getAfterUseCouplePrice(goods);
        if (money.compareTo(new BigDecimal(1.0)) < 0 && money.compareTo(new BigDecimal(2.0)) > 0) {
        if (money.compareTo(new BigDecimal(1.0)) < 0 || money.compareTo(new BigDecimal(2.0)) > 0) {
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    tljFreeBuyGoodsService.deleteByGoodsId(goods.getId());
                    tljFreeBuyGoodsService.deleteByGoodsId(goods.getAuctionId());
                }
            });
            throw new UserTaoLiJinNewbiesException(1, "该商品非免单商品");
@@ -309,6 +310,7 @@
        detail.setTitle(TaoLiJinDetailTypeEnum.reduce.getDesc());
        detail.setType(TaoLiJinDetailTypeEnum.reduce);
        detail.setCreateTime(new Date());
        detail.setRemark("新人免单使用红包");
        userTaoLiJinDetailService.insertSelective(detail);
        
        // 创建淘礼金链接