Przeglądaj źródła

fix 对应标签组新增

zoujiajian 2 lat temu
rodzic
commit
ed85022530

+ 20 - 9
netflix-service/src/main/java/com/cyksj/service/corp/impl/CorpEventActionServiceImpl.java

@@ -33,6 +33,7 @@ import com.cyksj.service.relation.GroupRelationFrontService;
 import com.cyksj.service.sys.SysConfigService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -487,15 +488,25 @@ public class CorpEventActionServiceImpl implements CorpEventActionService {
 		List<CorpUserExternalTagGroupInfo.Tag> tagList = tagGroup.getTag();
 		for (CorpUserExternalTagGroupInfo.Tag save_tag : tagList) {
 			if (StrUtil.equals(tagName, save_tag.getName())) {
-				CorpTag corpTag = new CorpTag();
-				corpTag.setGroupId(tagGroup.getGroupId());
-				corpTag.setGroupName(tagGroup.getGroupName());
-				corpTag.setType(1);
-
-				corpTag.setTagId(save_tag.getId());
-				corpTag.setName(save_tag.getName());
-				corpTagMapper.insert(corpTag);
-				return corpTag;
+				try {
+					CorpTagGroup corpTagGroup = new CorpTagGroup();
+					corpTagGroup.setGroupId(tagGroup.getGroupId());
+					corpTagGroup.setGroupName(tagGroup.getGroupName());
+					corpTagGroup.setOrdered(tagGroup.getOrder());
+					corpTagGroupMapper.insert(corpTagGroup);
+
+					CorpTag corpTag = new CorpTag();
+					corpTag.setGroupId(tagGroup.getGroupId());
+					corpTag.setGroupName(tagGroup.getGroupName());
+					corpTag.setType(1);
+
+					corpTag.setTagId(save_tag.getId());
+					corpTag.setName(save_tag.getName());
+					corpTag.setOrdered(save_tag.getOrder());
+					corpTagMapper.insert(corpTag);
+					return corpTag;
+				} catch (DuplicateKeyException e) {
+				}
 			}
 		}
 		return null;