diff --git a/modules/team/src/main/java/com/bytedesk/team/group/GroupEntity.java b/modules/team/src/main/java/com/bytedesk/team/group/GroupEntity.java index 9ba742c1df..0ed6d8bcab 100644 --- a/modules/team/src/main/java/com/bytedesk/team/group/GroupEntity.java +++ b/modules/team/src/main/java/com/bytedesk/team/group/GroupEntity.java @@ -2,7 +2,7 @@ * @Author: jackning 270580156@qq.com * @Date: 2024-01-29 16:20:17 * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-03-01 10:11:28 + * @LastEditTime: 2025-03-03 23:58:03 * @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,7 +22,6 @@ import com.bytedesk.core.constant.BytedeskConsts; import com.bytedesk.core.constant.I18Consts; import com.bytedesk.core.rbac.user.UserEntity; import com.bytedesk.team.member.MemberEntity; -// import com.bytedesk.ai.robot.RobotEntity; import jakarta.persistence.*; @@ -33,9 +32,6 @@ import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; -/** - * - */ @Entity @Data @Builder diff --git a/modules/team/src/main/java/com/bytedesk/team/group/GroupExcel.java b/modules/team/src/main/java/com/bytedesk/team/group/GroupExcel.java index 419e375d20..c4fec33117 100644 --- a/modules/team/src/main/java/com/bytedesk/team/group/GroupExcel.java +++ b/modules/team/src/main/java/com/bytedesk/team/group/GroupExcel.java @@ -2,7 +2,7 @@ * @Author: jackning 270580156@qq.com * @Date: 2024-08-01 06:18:10 * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-03-03 18:35:49 + * @LastEditTime: 2025-03-03 23:58: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. @@ -23,32 +23,96 @@ import lombok.Data; @Data public class GroupExcel { - @ExcelProperty(index = 0, value = "Nickname") + @ExcelProperty(value = "群组ID") @ColumnWidth(20) - private String nickname; + private String uid; - @ExcelProperty(index = 1, value = "Email") + @ExcelProperty(value = "群组名称") @ColumnWidth(20) - private String email; + private String name; - @ExcelProperty(index = 2, value = "Mobile") - @ColumnWidth(20) - private String mobile; + @ExcelProperty(value = "群组头像") + @ColumnWidth(50) + private String avatar; - @ExcelProperty(index = 3, value = "Job No") - @ColumnWidth(20) - private String jobNo; + @ExcelProperty(value = "群组描述") + @ColumnWidth(50) + private String description; - @ExcelProperty(index = 4, value = "Job Title") - @ColumnWidth(20) - private String jobTitle; + @ExcelProperty(value = "群组类型") + @ColumnWidth(15) + private String type; - @ExcelProperty(index = 5, value = "Seat No") - @ColumnWidth(20) - private String seatNo; + @ExcelProperty(value = "群组状态") + @ColumnWidth(15) + private String status; - @ExcelProperty(index = 6, value = "Telephone") + @ExcelProperty(value = "是否外部群") + @ColumnWidth(15) + private String isExternal; + + @ExcelProperty(value = "创建者") @ColumnWidth(20) - private String telephone; - + private String creator; + + @ExcelProperty(value = "成员数量") + @ColumnWidth(15) + private Integer memberCount; + + @ExcelProperty(value = "管理员数量") + @ColumnWidth(15) + private Integer adminCount; + + @ExcelProperty(value = "最大成员数") + @ColumnWidth(15) + private Integer maxMembers; + + @ExcelProperty(value = "是否需要审批") + @ColumnWidth(15) + private String needApproval; + + @ExcelProperty(value = "是否允许邀请") + @ColumnWidth(15) + private String allowInvite; + + @ExcelProperty(value = "是否全员禁言") + @ColumnWidth(15) + private String muteAll; + + @ExcelProperty(value = "是否显示顶部通知") + @ColumnWidth(15) + private String showTopTip; + + @ExcelProperty(value = "顶部通知内容") + @ColumnWidth(50) + private String topTip; + + @ExcelProperty(value = "创建时间") + @ColumnWidth(20) + private String createdAt; + + @ExcelProperty(value = "更新时间") + @ColumnWidth(20) + private String updatedAt; + + // 转换布尔值为是/否 + public void setIsExternal(boolean value) { + this.isExternal = value ? "是" : "否"; + } + + public void setNeedApproval(boolean value) { + this.needApproval = value ? "是" : "否"; + } + + public void setAllowInvite(boolean value) { + this.allowInvite = value ? "是" : "否"; + } + + public void setMuteAll(boolean value) { + this.muteAll = value ? "是" : "否"; + } + + public void setShowTopTip(boolean value) { + this.showTopTip = value ? "是" : "否"; + } } diff --git a/modules/team/src/main/java/com/bytedesk/team/group/GroupRestController.java b/modules/team/src/main/java/com/bytedesk/team/group/GroupRestController.java index 36bfaed714..76a2defc95 100644 --- a/modules/team/src/main/java/com/bytedesk/team/group/GroupRestController.java +++ b/modules/team/src/main/java/com/bytedesk/team/group/GroupRestController.java @@ -2,7 +2,7 @@ * @Author: jackning 270580156@qq.com * @Date: 2024-01-29 16:20:17 * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-03-03 23:07:48 + * @LastEditTime: 2025-03-04 00:02: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. @@ -140,7 +140,7 @@ public class GroupRestController extends BaseRestController { @Override public Object export(GroupRequest request, HttpServletResponse response) { // query data to export - Page groupPage = groupService.queryByOrg(request); + Page groupPage = groupService.queryForExport(request); // try { // @@ -155,7 +155,7 @@ public class GroupRestController extends BaseRestController { // write to excel EasyExcel.write(response.getOutputStream(), GroupExcel.class) .autoCloseStream(Boolean.FALSE) - .sheet("member") + .sheet("group") .doWrite(excelList); } catch (Exception e) { diff --git a/modules/team/src/main/java/com/bytedesk/team/group/GroupRestService.java b/modules/team/src/main/java/com/bytedesk/team/group/GroupRestService.java index 73a69b5014..f6a743e1ee 100644 --- a/modules/team/src/main/java/com/bytedesk/team/group/GroupRestService.java +++ b/modules/team/src/main/java/com/bytedesk/team/group/GroupRestService.java @@ -2,7 +2,7 @@ * @Author: jackning 270580156@qq.com * @Date: 2024-01-29 16:20:17 * @LastEditors: jackning 270580156@qq.com - * @LastEditTime: 2025-03-03 23:27:49 + * @LastEditTime: 2025-03-04 00:00: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. @@ -67,6 +67,12 @@ public class GroupRestService extends BaseRestService queryForExport(GroupRequest request) { + Pageable pageable = request.getPageable(); + Specification specification = GroupSpecification.search(request); + return groupRepository.findAll(specification, pageable); + } + public GroupResponse queryByUid(GroupRequest request) { Optional optional = findByUid(request.getUid()); if (optional.isPresent()) { @@ -83,12 +89,14 @@ public class GroupRestService extends BaseRestService predicates = new ArrayList<>(); predicates.addAll(getBasicPredicates(root, criteriaBuilder, request.getOrgUid())); // - if (request.getName()!= null) { + if (StringUtils.hasText(request.getName())) { predicates.add(criteriaBuilder.like(root.get("name"), "%" + request.getName() + "%")); } //