Browse Source

feat: 企微完课打标签

xdd 1 week ago
parent
commit
96a9ffe0ff

+ 10 - 2
fs-service/src/main/java/com/fs/tag/service/impl/FsVideoCourseTagServiceImpl.java

@@ -13,7 +13,9 @@ import com.fs.qw.mapper.QwTagMapper;
 import com.fs.tag.domain.FsVideoCourseTag;
 import com.fs.tag.mapper.FsVideoCourseTagMapper;
 import com.fs.tag.service.IFsVideoCourseTagService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Service;
 
 /**
@@ -22,6 +24,7 @@ import org.springframework.stereotype.Service;
  * @author fs
  * @date 2025-11-05
  */
+@Slf4j
 @Service
 public class FsVideoCourseTagServiceImpl extends ServiceImpl<FsVideoCourseTagMapper, FsVideoCourseTag> implements IFsVideoCourseTagService {
 
@@ -94,8 +97,13 @@ public class FsVideoCourseTagServiceImpl extends ServiceImpl<FsVideoCourseTagMap
     @Override
     public int insertFsVideoCourseTag(FsVideoCourseTag fsVideoCourseTag)
     {
-        fsVideoCourseTag.setCreateTime(DateUtils.getNowDate());
-        return baseMapper.insertFsVideoCourseTag(fsVideoCourseTag);
+        try{
+            fsVideoCourseTag.setCreateTime(DateUtils.getNowDate());
+            return baseMapper.insertFsVideoCourseTag(fsVideoCourseTag);
+        }catch (DuplicateKeyException e){
+            log.info("同一主体的小节添加标签不允许重复!");
+            throw new RuntimeException("同一主体的小节不允许重复!");
+        }
     }
 
     /**