admin
2020-05-06 24a8d17e007545f7426c48352109aa1a9c6587ee
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -33,9 +33,11 @@
import com.yeshi.fanli.service.inter.brand.BrandShopCaheService;
import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.FilePathEnum;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
import com.yeshi.fanli.vo.brand.BrandInfoVO;
@@ -50,6 +52,9 @@
   @Resource
   private HongBaoManageService hongBaoManageService;
   @Resource
   private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
   @Resource
   private QualityGoodsService qualityGoodsService;
@@ -201,20 +206,42 @@
    * @throws Exception
    */
   public String uploadPicture(MultipartFile file) throws Exception {
      // 文件解析
      InputStream inputStream = file.getInputStream();
      String contentType = file.getContentType();
      String type = contentType.substring(contentType.indexOf("/") + 1);
      // 文件路径
      String filePath = "/img/brand/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
      String filePath = FilePathEnum.brand.getPath() + UUID.randomUUID().toString().replace("-", "") + "." + type;
      // 执行上传
      String fileLink = COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
      return fileLink;
      return COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
   }
   @Override
   public void switchState(Long id) throws BrandInfoException {
      if (id == null) {
         throw new BrandInfoException(1, "请传递正确参数");
      }
      BrandInfo resultObj = brandInfoMapper.selectByPrimaryKey(id);
      if (resultObj == null) {
         throw new BrandInfoException(1, "此内容已不存在");
      }
      Integer state = resultObj.getState();
      if (state == null || state == 0) {
         state = 1;
      } else {
         state = 0;
      }
      BrandInfo updateObj = new BrandInfo();
      updateObj.setId(id);
      updateObj.setState(state);
      brandInfoMapper.updateByPrimaryKeySelective(updateObj);
   }
   @Override
   public int deleteBatchByPrimaryKey(List<Long> list) {
      executor.execute(new Runnable() {
@@ -427,7 +454,7 @@
      if (list == null || list.size() == 0)
         return null;
      ConfigParamsDTO configParamsDTO = hongBaoManageService.getShowComputeRate(platform, version);
      ConfigParamsDTO configParamsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version);
      List<BrandInfoVO> listInfo = new ArrayList<BrandInfoVO>();
      for (int i = 0; i < list.size(); i++) {
@@ -478,7 +505,7 @@
      if (list == null || list.size() == 0)
         return null;
      ConfigParamsDTO configParamsDTO = hongBaoManageService.getShowComputeRate(platform, version);
      ConfigParamsDTO configParamsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version);
      BrandInfoVO brand = list.get(0);
      List<BrandGoodsCahe> listGoods = brandGoodsCaheService.getByBrandId(1, 3, brand.getId());