admin
2019-11-01 56bcbcf230f4ce53376c7ccc99b91990d3375f9d
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -17,6 +17,7 @@
import com.yeshi.fanli.dao.brand.BrandShopCaheDao;
import com.yeshi.fanli.dao.mybatis.brand.BrandInfoMapper;
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.entity.brand.BrandGoodsCahe;
import com.yeshi.fanli.entity.brand.BrandInfo;
@@ -122,6 +123,17 @@
         record.setCreateTime(resultObj.getCreateTime());
         record.setUpdateTime(new Date());
         brandInfoMapper.updateByPrimaryKey(record);
         if (state == 0){
            executor.execute(new Runnable() {
               @Override
               public void run() {
                  brandGoodsCaheService.removeByBrandId(id);
                  brandShopCaheService.removeByBrandId(id);
               }
            });
         }
      }
      if (state == 1) {
@@ -160,6 +172,16 @@
   
   @Override
   public int deleteBatchByPrimaryKey(List<Long> list) {
      executor.execute(new Runnable() {
         @Override
         public void run() {
            for (Long id: list) {
               brandGoodsCaheService.removeByBrandId(id);
               brandShopCaheService.removeByBrandId(id);
            }
         }
      });
      return brandInfoMapper.deleteBatchByPrimaryKey(list);
   }
@@ -225,6 +247,18 @@
      return brandClassShopService.countBrandShopinfo(cid);
   }
   @Override
   public void removeAgoByDate(Date date) {
      // 删除商品
      brandGoodsCaheService.removeAgoByDate(date);
      // 删除店铺
      brandShopCaheService.removeAgoByDate(date);
   }
   @Override
   public void addShopAndGoods(long start, int count) {
      List<BrandInfo> list = brandInfoMapper.listValidAll(start, count);
@@ -273,7 +307,7 @@
      BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      ConfigParamsDTO configParamsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
      List<BrandInfoVO> listInfo = new ArrayList<BrandInfoVO>();
      for (int i = 0; i < list.size(); i++) {
         BrandInfoVO brand = list.get(i);
@@ -288,19 +322,19 @@
         for (BrandGoodsCahe brandGoods : listGoods) {
            JDGoods goodsJD = brandGoods.getGoodsJD();
            if (goodsJD != null) {
               listGoodsVO.add(GoodsDetailVOFactory.convertJDGoods(goodsJD, fanLiRate, shareRate));
               listGoodsVO.add(GoodsDetailVOFactory.convertJDGoods(goodsJD, configParamsDTO));
               continue;
            }
            TaoBaoGoodsBrief goodsTB = brandGoods.getGoodsTB();
            if (goodsTB != null) {
               listGoodsVO.add(GoodsDetailVOFactory.convertTaoBao(goodsTB, null, fanLiRate, shareRate));
               listGoodsVO.add(GoodsDetailVOFactory.convertTaoBao(goodsTB, configParamsDTO));
               continue;
            }
            PDDGoodsDetail goodsPDD = brandGoods.getGoodsPDD();
            if (goodsPDD != null) {
               listGoodsVO.add(GoodsDetailVOFactory.convertPDDGoods(goodsPDD, fanLiRate, shareRate));
               listGoodsVO.add(GoodsDetailVOFactory.convertPDDGoods(goodsPDD, configParamsDTO));
               continue;
            }
         }