This commit is contained in:
jack ning
2025-03-11 09:28:59 +08:00
parent d6bed8436c
commit 76e4ee525d
4 changed files with 22 additions and 8 deletions

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-05-11 18:22:04
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-03-08 22:32:33
* @LastEditTime: 2025-03-11 09:27:26
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -132,9 +132,8 @@ public class CategoryRestService extends BaseRestService<CategoryEntity, Categor
public CategoryResponse create(CategoryRequest request) {
if (StringUtils.hasText(request.getUid()) && existsByUid(request.getUid())) {
return null;
return convertToResponse(findByUid(request.getUid()).get());
}
//
CategoryEntity category = modelMapper.map(request, CategoryEntity.class);

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-05-11 18:25:55
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2024-10-24 18:20:39
* @LastEditTime: 2025-03-11 09:23:20
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -22,5 +22,7 @@ public interface TagRepository extends JpaRepository<TagEntity, Long>, JpaSpecif
Optional<TagEntity> findByUid(String uid);
Boolean existsByUid(String uid);
// Boolean existsByPlatform(String platform);
}

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-05-11 18:25:45
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-03-11 08:59:58
* @LastEditTime: 2025-03-11 09:26:17
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -22,6 +22,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Recover;
import org.springframework.retry.annotation.Retryable;
@@ -72,15 +73,26 @@ public class TagRestService extends BaseRestService<TagEntity, TagRequest, TagRe
return tagRepository.findByUid(uid);
}
public Boolean existsByUid(String uid) {
return tagRepository.existsByUid(uid);
}
@Override
public TagResponse create(TagRequest request) {
// 判断是否已经存在
if (StringUtils.hasText(request.getUid()) && existsByUid(request.getUid())) {
return convertToResponse(findByUid(request.getUid()).get());
}
//
UserEntity user = authService.getUser();
if (user != null) {
request.setUserUid(user.getUid());
}
//
TagEntity entity = modelMapper.map(request, TagEntity.class);
entity.setUid(uidUtils.getUid());
if (!StringUtils.hasText(request.getUid())) {
entity.setUid(uidUtils.getUid());
}
//
TagEntity savedEntity = save(entity);
if (savedEntity == null) {

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2025-03-11 08:40:10
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2025-03-11 09:00:41
* @LastEditTime: 2025-03-11 09:24:17
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
* Please be aware of the BSL license restrictions before installing Bytedesk IM
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -86,7 +86,6 @@ public class ThreadInitializer implements SmartInitializingSingleton {
}
}
private void initThreadTag() {
log.info("initThreadTag");
String orgUid = BytedeskConsts.DEFAULT_ORGANIZATION_UID;
@@ -104,4 +103,6 @@ public class ThreadInitializer implements SmartInitializingSingleton {
tagRestService.create(tagRequest);
}
}
}