admin
2020-04-26 f99d8098b0aee17c09be5dfee8b4f72a6f4071b1
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandInfoServiceImpl.java
@@ -202,7 +202,6 @@
    * @throws Exception
    */
   public String uploadPicture(MultipartFile file) throws Exception {
      // 文件解析
      InputStream inputStream = file.getInputStream();
      String contentType = file.getContentType();
@@ -211,11 +210,34 @@
      // 文件路径
      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() {