Administrator
2020-02-23 388be9f734f5b80c348bcc956726c206002e832a
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsSubClassServiceImpl.java
@@ -20,12 +20,13 @@
import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel;
import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap;
import com.yeshi.fanli.exception.GoodsSubClassException;
import com.yeshi.fanli.exception.goods.GoodsSubClassException;
import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService;
import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
import com.yeshi.fanli.service.inter.lable.LabelClassService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.FilePathEnum;
import com.yeshi.fanli.util.StringUtil;
@Service
@@ -70,10 +71,10 @@
   }
   @Override
   @Transactional
   @Transactional(rollbackFor=Exception.class)
   public void deleteByRootId(Long id) throws Exception {
      List<GoodsSubClass> subClassList = goodsSubClassMapper.queryByRootId(id, null);
      List<GoodsSubClass> subClassList = goodsSubClassMapper.queryByRootId(id, null, null);
      if (subClassList != null && subClassList.size() > 0) {
         for (GoodsSubClass goodsSubClass : subClassList) {
            deleteSub(goodsSubClass.getId());
@@ -82,7 +83,7 @@
   }
   @Override
   @Transactional
   @Transactional(rollbackFor=Exception.class)
   public void deleteByPrimaryKeyBatch(List<String> recordIds) throws Exception {
      if (recordIds != null && recordIds.size() > 0) {
         for (String recordId : recordIds) {
@@ -92,7 +93,7 @@
   }
   @Override
   @Transactional
   @Transactional(rollbackFor=Exception.class)
   public void deleteSub(Long recordId) throws Exception {
      GoodsSubClass goodsSubClass = goodsSubClassMapper.selectByPrimaryKey(recordId);
@@ -136,6 +137,9 @@
      if (name == null || name.trim().length() == 0) {
         throw new GoodsSubClassException(1, "分类名称不能为空");
      }
      if (StringUtil.isNullOrEmpty(record.getMonth()))
         record.setMonth(null);
      // 图片上传
      String picture = null;
@@ -288,7 +292,7 @@
      String type = contentType.substring(contentType.indexOf("/") + 1);
      // 文件路径
      String filePath = "/img/GoodsSubClass/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
      String filePath =FilePathEnum.goodsSubClass.getPath() + UUID.randomUUID().toString().replace("-", "") + "." + type;
      // 执行上传
      String fileLink = COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
@@ -335,7 +339,7 @@
   @Override
   public List<GoodsSubClass> queryByRootId(Long rootId, Integer state) throws Exception {
      return goodsSubClassMapper.queryByRootId(rootId, state);
      return goodsSubClassMapper.queryByRootId(rootId, state, null);
   }
   @Override
@@ -354,14 +358,14 @@
   }
   @Override
   public List<GoodsSubClass> getGoodsSecondClass(Long rootId, Integer state) throws Exception {
      return goodsSubClassMapper.queryByRootId(rootId, state);
   public List<GoodsSubClass> getGoodsSecondClass(Long rootId, Integer state, Integer month) throws Exception {
      return goodsSubClassMapper.queryByRootId(rootId, state, month);
   }
   @Override
   @Cacheable(value = "classCache", key = "'getSubClassCache-'+#rootId +'-'+#state")
   public List<GoodsSubClass> getSubClassCache(Long rootId, Integer state) throws Exception {
      return getGoodsSecondClass(rootId, state);
   public List<GoodsSubClass> getSubClassCache(Long rootId, Integer state, Integer month) throws Exception {
      return getGoodsSecondClass(rootId, state, month);
   }
   @Override