From de33bf467ab12876951485f472bb6e8bd0857720 Mon Sep 17 00:00:00 2001 From: jack ning Date: Sat, 15 Nov 2025 09:15:38 +0800 Subject: [PATCH] update --- .../com/bytedesk/kanban/task/TaskEntity.java | 118 ------------- .../kanban/task/TaskEntityListener.java | 37 ---- .../kanban/task/TaskEventListener.java | 27 --- .../com/bytedesk/kanban/task/TaskExcel.java | 40 ----- .../bytedesk/kanban/task/TaskPermissions.java | 29 ---- .../bytedesk/kanban/task/TaskRepository.java | 26 --- .../com/bytedesk/kanban/task/TaskRequest.java | 72 -------- .../bytedesk/kanban/task/TaskResponse.java | 61 ------- .../kanban/task/TaskRestController.java | 41 ----- .../bytedesk/kanban/task/TaskRestService.java | 158 ------------------ .../kanban/task/TaskSpecification.java | 44 ----- .../bytedesk/kanban/task/TaskTypeEnum.java | 19 --- .../kanban/task/event/TaskCreateEvent.java | 36 ---- .../kanban/task/event/TaskDeleteEvent.java | 35 ---- .../kanban/task/event/TaskUpdateEvent.java | 36 ---- .../bytedesk/kanban/task/package-info.java | 5 - .../kanban/todo_list/TodoListEntity.java | 2 +- .../kanban/todo_list/TodoListResponse.java | 2 +- 18 files changed, 2 insertions(+), 786 deletions(-) delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEntity.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEntityListener.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEventListener.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskExcel.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskPermissions.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRepository.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRequest.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskResponse.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRestController.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRestService.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskSpecification.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskTypeEnum.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskCreateEvent.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskDeleteEvent.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskUpdateEvent.java delete mode 100644 plugins/kanban/src/main/java/com/bytedesk/kanban/task/package-info.java diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEntity.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEntity.java deleted file mode 100644 index f2f7ab4b5a..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEntity.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2024-05-11 18:14:28 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-07-12 10:17:46 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * 联系:270580156@qq.com - * Copyright (c) 2024 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -import java.util.ArrayList; -import java.util.List; - -import com.bytedesk.core.base.BaseEntity; -import com.bytedesk.core.constant.I18Consts; -import com.bytedesk.core.constant.TypeConsts; -import com.bytedesk.core.converter.StringListConverter; -import jakarta.persistence.Column; -import jakarta.persistence.Convert; -import jakarta.persistence.Entity; -import jakarta.persistence.EntityListeners; -import jakarta.persistence.Table; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; -import lombok.experimental.SuperBuilder; - -/** - * Task entity for Kanban board task management - * Represents individual tasks within a Kanban board system - * - * Database Table: bytedesk_plugin_kanban_task - * Purpose: Stores task information, status, and organization within Kanban boards - */ -@Entity -@Data -@SuperBuilder -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = true) -@AllArgsConstructor -@NoArgsConstructor -@EntityListeners({TaskEntityListener.class}) -@Table(name = "bytedesk_plugin_kanban_task") -public class TaskEntity extends BaseEntity { - private static final long serialVersionUID = 1L; - - - /** - * Name or title of the task - */ - private String name; - - /** - * Description of the task - */ - @Builder.Default - private String description = I18Consts.I18N_DESCRIPTION; - - /** - * Type of task (CUSTOMER, PROJECT, etc.) - */ - @Builder.Default - @Column(name = "task_type") - private String type = TaskTypeEnum.CUSTOMER.name(); - - /** - * Color theme for the task display - */ - @Builder.Default - @Column(name = "task_color") - private String color = "red"; - - /** - * Display order of the task within its todo list - */ - @Builder.Default - @Column(name = "task_order") - private int order = 0; - - /** - * Tags for task categorization and search - */ - @Builder.Default - @Convert(converter = StringListConverter.class) - @Column(columnDefinition = TypeConsts.COLUMN_TYPE_TEXT) - private List tagList = new ArrayList<>(); - - /** - * Whether the task has been completed - */ - @Builder.Default - @Column(name = "task_complete") - private boolean complete = false; - - /** - * Associated project UID for project-specific tasks - */ - private String projectUid; - - /** - * Associated module UID for module-specific tasks - */ - private String moduleUid; - - /** - * Associated todo list UID where this task belongs - */ - private String todoListUid; - -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEntityListener.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEntityListener.java deleted file mode 100644 index 83f431cbd7..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEntityListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2025-02-25 09:52:34 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-03-08 10:48:29 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * - * Copyright (c) 2025 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -import org.springframework.stereotype.Component; - -import jakarta.persistence.PostPersist; -import jakarta.persistence.PostUpdate; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Component -public class TaskEntityListener { - - @PostPersist - public void onPostPersist(TaskEntity task) { - log.info("onPostPersist: {}", task); - } - - @PostUpdate - public void onPostUpdate(TaskEntity task) { - log.info("onPostUpdate: {}", task); - } - -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEventListener.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEventListener.java deleted file mode 100644 index e9557ad40a..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskEventListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2025-02-25 09:44:18 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-02-25 09:54: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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * - * Copyright (c) 2025 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -import org.springframework.stereotype.Component; - -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Component -@AllArgsConstructor -public class TaskEventListener { - -} - diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskExcel.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskExcel.java deleted file mode 100644 index 9c5ad50f25..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskExcel.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2024-08-01 06:18:10 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-03-03 23:09:02 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * 联系:270580156@qq.com - * Copyright (c) 2024 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -import com.alibaba.excel.annotation.ExcelProperty; -import com.alibaba.excel.annotation.write.style.ColumnWidth; - -import lombok.Data; - -/** - * https://github.com/alibaba/easyexcel - */ -@Data -public class TaskExcel { - - @ExcelProperty(index = 0, value = "Name") - @ColumnWidth(20) - private String name; - - @ExcelProperty(index = 1, value = "Type") - @ColumnWidth(20) - private String type; - - @ExcelProperty(index = 2, value = "Color") - @ColumnWidth(20) - private String color; - - -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskPermissions.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskPermissions.java deleted file mode 100644 index 5ca3d19dff..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskPermissions.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2024-11-05 16:58:18 - * @LastEditors: jack ning github@bytedesk.com - * @LastEditTime: 2025-03-08 10:32:22 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * 联系:270580156@qq.com - * Copyright (c) 2024 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -public class TaskPermissions { - - public static final String TAG_PREFIX = "TAG_"; - // Task permissions - public static final String TAG_CREATE = "hasAuthority('TAG_CREATE')"; - public static final String TAG_READ = "hasAuthority('TAG_READ')"; - public static final String TAG_UPDATE = "hasAuthority('TAG_UPDATE')"; - public static final String TAG_DELETE = "hasAuthority('TAG_DELETE')"; - public static final String TAG_EXPORT = "hasAuthority('TAG_EXPORT')"; - - // - public static final String TAG_ANY = "hasAnyAuthority('TAG_CREATE', 'TAG_READ', 'TAG_UPDATE', 'TAG_EXPORT', 'TAG_DELETE')"; - -} \ No newline at end of file diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRepository.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRepository.java deleted file mode 100644 index 6506da767c..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRepository.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2024-05-11 18:25:55 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2024-10-24 18:20:39 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * 联系:270580156@qq.com - * Copyright (c) 2024 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -import java.util.Optional; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -public interface TaskRepository extends JpaRepository, JpaSpecificationExecutor { - - Optional findByUid(String uid); - - // Boolean existsByPlatform(String platform); -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRequest.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRequest.java deleted file mode 100644 index e0dc55f4e2..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRequest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2024-05-11 18:26:04 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-07-12 10:18:22 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * 联系:270580156@qq.com - * Copyright (c) 2024 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -import java.util.List; -import java.util.ArrayList; - -import com.bytedesk.core.base.BaseRequest; -import com.bytedesk.core.constant.I18Consts; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; -import lombok.experimental.SuperBuilder; - -@Data -@SuperBuilder -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = false) -@AllArgsConstructor -@NoArgsConstructor -public class TaskRequest extends BaseRequest { - - private static final long serialVersionUID = 1L; - - - private String name; - - @Builder.Default - private String description = I18Consts.I18N_DESCRIPTION; - - // @Builder.Default - // private String type = TaskTypeEnum.CUSTOMER.name(); - - @Builder.Default - private String color = "red"; - - @Builder.Default - private Integer order = 0; - - @Builder.Default - private List tagList = new ArrayList<>(); - - // @Builder.Default - // private String level = LevelEnum.ORGANIZATION.name(); - - // @Builder.Default - // private String platform = PlatformEnum.BYTEDESK.name(); - - @Builder.Default - private Boolean complete = false; - - private String projectUid; - - private String moduleUid; - - private String todoListUid; - -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskResponse.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskResponse.java deleted file mode 100644 index 3152b15dd3..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskResponse.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2024-05-11 18:26:12 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-03-10 17:55:50 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * 联系:270580156@qq.com - * Copyright (c) 2024 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -import java.util.List; - -import com.bytedesk.core.base.BaseResponse; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -@Data -@Builder -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = true) -@AllArgsConstructor -@NoArgsConstructor -public class TaskResponse extends BaseResponse { - - private static final long serialVersionUID = 1L; - - - private String name; - - private String description; - - private String type; - - private String color; - - private Integer order; - - private List tagList; - - private Boolean complete; - - private String projectUid; - - private String moduleUid; - - private String todoListUid; - - // private ZonedDateTime createdAt; - - // private ZonedDateTime updatedAt; -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRestController.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRestController.java deleted file mode 100644 index c5a15db091..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRestController.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2024-05-11 18:25:36 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-08-20 16:58:37 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * 联系:270580156@qq.com - * Copyright (c) 2024 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import com.bytedesk.core.base.BaseRestController; -import jakarta.servlet.http.HttpServletResponse; -import lombok.AllArgsConstructor; - -@RestController -@RequestMapping("/api/v1/task") -@AllArgsConstructor -public class TaskRestController extends BaseRestController { - - private final TaskRestService taskService; - - @Override - protected TaskRestService getService() { - return taskService; - } - - @Override - public Object export(TaskRequest request, HttpServletResponse response) { - // TASK Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'export'"); - } - -} \ No newline at end of file diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRestService.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRestService.java deleted file mode 100644 index 6ac4915fe5..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskRestService.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2024-05-11 18:25:45 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-08-20 12:15:58 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * 联系:270580156@qq.com - * Copyright (c) 2024 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -import java.util.Optional; - -import org.modelmapper.ModelMapper; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import org.springframework.data.jpa.domain.Specification; -import org.springframework.orm.ObjectOptimisticLockingFailureException; -import org.springframework.stereotype.Service; - -import com.bytedesk.core.base.BaseRestService; -import com.bytedesk.core.rbac.user.UserEntity; -import com.bytedesk.core.uid.UidUtils; -import com.bytedesk.kanban.todo_list.TodoListEntity; -import com.bytedesk.kanban.todo_list.TodoListRepository; -import lombok.AllArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -@AllArgsConstructor -public class TaskRestService extends BaseRestService { - - private final TaskRepository taskRepository; - private final TodoListRepository todoListRepository; - private final ModelMapper modelMapper; - private final UidUtils uidUtils; - - // === 实现必需的抽象方法 === - - @Override - protected Specification createSpecification(TaskRequest request) { - return TaskSpecification.search(request, authService); - } - - @Override - protected Page executePageQuery(Specification spec, Pageable pageable) { - return taskRepository.findAll(spec, pageable); - } - - @Cacheable(value = "task", key = "#uid", unless = "#result == null") - @Override - public Optional findByUid(String uid) { - return taskRepository.findByUid(uid); - } - - @Override - public TaskResponse convertToResponse(TaskEntity entity) { - return modelMapper.map(entity, TaskResponse.class); - } - - @Override - protected TaskEntity doSave(TaskEntity entity) { - return taskRepository.save(entity); - } - - @Override - public TaskEntity handleOptimisticLockingFailureException(ObjectOptimisticLockingFailureException e, TaskEntity entity) { - try { - Optional latest = taskRepository.findByUid(entity.getUid()); - if (latest.isPresent()) { - TaskEntity latestEntity = latest.get(); - // 合并需要保留的数据 - modelMapper.map(entity, latestEntity); - return taskRepository.save(latestEntity); - } - } catch (Exception ex) { - throw new RuntimeException("无法处理乐观锁冲突: " + ex.getMessage(), ex); - } - return null; - } - - // === 业务逻辑方法 === - - @Override - public TaskResponse create(TaskRequest request) { - UserEntity user = authService.getUser(); - - request.setUserUid(user.getUid()); - - TaskEntity entity = modelMapper.map(request, TaskEntity.class); - entity.setUid(uidUtils.getUid()); - entity.setOrgUid(user.getOrgUid()); - - TaskEntity savedEntity = save(entity); - if (savedEntity == null) { - throw new RuntimeException("Create task failed"); - } - - // 处理与TodoList的关联 - handleTodoListAssociation(request, savedEntity); - - return convertToResponse(savedEntity); - } - - @Override - public TaskResponse update(TaskRequest request) { - Optional optional = taskRepository.findByUid(request.getUid()); - if (optional.isPresent()) { - TaskEntity entity = optional.get(); - modelMapper.map(request, entity); - // - TaskEntity savedEntity = save(entity); - if (savedEntity == null) { - throw new RuntimeException("Update task failed"); - } - return convertToResponse(savedEntity); - } else { - throw new RuntimeException("Task not found"); - } - } - - @Override - public void deleteByUid(String uid) { - Optional optional = taskRepository.findByUid(uid); - if (optional.isPresent()) { - optional.get().setDeleted(true); - save(optional.get()); - } else { - throw new RuntimeException("Task not found"); - } - } - - @Override - public void delete(TaskRequest request) { - deleteByUid(request.getUid()); - } - - // === 私有辅助方法 === - - /** - * 处理与TodoList的关联关系 - */ - private void handleTodoListAssociation(TaskRequest request, TaskEntity savedEntity) { - if (request.getTodoListUid() != null) { - Optional todoListOptional = todoListRepository.findByUid(request.getTodoListUid()); - if (todoListOptional.isPresent()) { - todoListOptional.get().getTasks().add(savedEntity); - todoListRepository.save(todoListOptional.get()); - } - } - } -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskSpecification.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskSpecification.java deleted file mode 100644 index 054cdc5acd..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskSpecification.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2024-07-09 22:19:21 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-03-03 14:25:07 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * 联系:270580156@qq.com - * Copyright (c) 2024 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.data.jpa.domain.Specification; -import org.springframework.util.StringUtils; - -import com.bytedesk.core.base.BaseSpecification; -import com.bytedesk.core.rbac.auth.AuthService; - -import jakarta.persistence.criteria.Predicate; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public class TaskSpecification extends BaseSpecification { - - public static Specification search(TaskRequest request, AuthService authService) { - log.info("request: {}", request); - return (root, query, criteriaBuilder) -> { - List predicates = new ArrayList<>(); - predicates.addAll(getBasicPredicates(root, criteriaBuilder, request, authService)); - // - if (StringUtils.hasText(request.getUserUid())) { - predicates.add(criteriaBuilder.equal(root.get("userUid"), request.getUserUid())); - } - // - return criteriaBuilder.and(predicates.toArray(new Predicate[0])); - }; - } -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskTypeEnum.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskTypeEnum.java deleted file mode 100644 index f4d1669a29..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/TaskTypeEnum.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2024-07-23 17:02:46 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2024-07-23 17:02:48 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * 联系:270580156@qq.com - * Copyright (c) 2024 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task; - -public enum TaskTypeEnum { - THREAD, - CUSTOMER -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskCreateEvent.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskCreateEvent.java deleted file mode 100644 index 9acf15ef64..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskCreateEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2025-02-25 09:59:29 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-02-25 10:00:34 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * - * Copyright (c) 2025 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task.event; - -import org.springframework.context.ApplicationEvent; - -import com.bytedesk.kanban.task.TaskEntity; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = false) -public class TaskCreateEvent extends ApplicationEvent { - - private static final long serialVersionUID = 1L; - - private TaskEntity task; - - public TaskCreateEvent(TaskEntity task) { - super(task); - this.task = task; - } - -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskDeleteEvent.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskDeleteEvent.java deleted file mode 100644 index 7f43682b70..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskDeleteEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2025-02-25 12:31:16 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-02-25 12:31:19 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * - * Copyright (c) 2025 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task.event; - -import org.springframework.context.ApplicationEvent; - -import com.bytedesk.kanban.task.TaskEntity; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = false) -public class TaskDeleteEvent extends ApplicationEvent { - - private static final long serialVersionUID = 1L; - - private TaskEntity task; - - public TaskDeleteEvent(TaskEntity task) { - super(task); - this.task = task; - } -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskUpdateEvent.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskUpdateEvent.java deleted file mode 100644 index 6cd7382ae2..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/event/TaskUpdateEvent.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * @Author: jackning 270580156@qq.com - * @Date: 2025-02-25 09:59:29 - * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-02-25 10:01:00 - * @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. - * Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE - * contact: 270580156@qq.com - * - * Copyright (c) 2025 by bytedesk.com, All Rights Reserved. - */ -package com.bytedesk.kanban.task.event; - -import org.springframework.context.ApplicationEvent; - -import com.bytedesk.kanban.task.TaskEntity; - -import lombok.Data; -import lombok.EqualsAndHashCode; - -@Data -@EqualsAndHashCode(callSuper = false) -public class TaskUpdateEvent extends ApplicationEvent { - - private static final long serialVersionUID = 1L; - - private TaskEntity task; - - public TaskUpdateEvent(TaskEntity task) { - super(task); - this.task = task; - } - -} diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/package-info.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/task/package-info.java deleted file mode 100644 index 78486ef237..0000000000 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/task/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ - -@NonNullApi -package com.bytedesk.kanban.task; - -import org.springframework.lang.NonNullApi; diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/todo_list/TodoListEntity.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/todo_list/TodoListEntity.java index 70c2e2e30f..53b0636316 100644 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/todo_list/TodoListEntity.java +++ b/plugins/kanban/src/main/java/com/bytedesk/kanban/todo_list/TodoListEntity.java @@ -18,7 +18,7 @@ import java.util.ArrayList; import com.bytedesk.core.base.BaseEntity; import com.bytedesk.core.constant.I18Consts; -import com.bytedesk.kanban.task.TaskEntity; +import com.bytedesk.core.task.TaskEntity; import jakarta.persistence.CascadeType; import jakarta.persistence.Column; diff --git a/plugins/kanban/src/main/java/com/bytedesk/kanban/todo_list/TodoListResponse.java b/plugins/kanban/src/main/java/com/bytedesk/kanban/todo_list/TodoListResponse.java index a38f3324e3..862c0f2d86 100644 --- a/plugins/kanban/src/main/java/com/bytedesk/kanban/todo_list/TodoListResponse.java +++ b/plugins/kanban/src/main/java/com/bytedesk/kanban/todo_list/TodoListResponse.java @@ -16,7 +16,7 @@ package com.bytedesk.kanban.todo_list; import java.util.List; import com.bytedesk.core.base.BaseResponse; -import com.bytedesk.kanban.task.TaskResponse; +import com.bytedesk.core.task.TaskResponse; import lombok.AllArgsConstructor; import lombok.Builder;