update modules/team: mod 5 files

This commit is contained in:
jack ning
2025-03-04 00:24:47 +08:00
parent 6a0e9ed24d
commit 0503bf48b3
5 changed files with 133 additions and 36 deletions

View File

@@ -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

View File

@@ -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 ? "" : "";
}
}

View File

@@ -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<GroupRequest> {
@Override
public Object export(GroupRequest request, HttpServletResponse response) {
// query data to export
Page<GroupResponse> groupPage = groupService.queryByOrg(request);
Page<GroupEntity> groupPage = groupService.queryForExport(request);
//
try {
//
@@ -155,7 +155,7 @@ public class GroupRestController extends BaseRestController<GroupRequest> {
// write to excel
EasyExcel.write(response.getOutputStream(), GroupExcel.class)
.autoCloseStream(Boolean.FALSE)
.sheet("member")
.sheet("group")
.doWrite(excelList);
} catch (Exception e) {

View File

@@ -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<GroupEntity, GroupRequest,
return queryByOrg(request);
}
public Page<GroupEntity> queryForExport(GroupRequest request) {
Pageable pageable = request.getPageable();
Specification<GroupEntity> specification = GroupSpecification.search(request);
return groupRepository.findAll(specification, pageable);
}
public GroupResponse queryByUid(GroupRequest request) {
Optional<GroupEntity> optional = findByUid(request.getUid());
if (optional.isPresent()) {
@@ -83,12 +89,14 @@ public class GroupRestService extends BaseRestService<GroupEntity, GroupRequest,
@Override
public GroupResponse create(GroupRequest request) {
UserEntity creator = authService.getUser();
if (creator == null) {
throw new RuntimeException("group creator is null");
}
//
GroupEntity group = GroupEntity.builder().build();
group.setName(request.getName());
group.setUid(uidUtils.getCacheSerialUid());
group.setUid(uidUtils.getUid());
group.setType(GroupTypeEnum.fromValue(request.getType()).name());
//
group.getAdmins().add(creator);
@@ -174,9 +182,36 @@ public class GroupRestService extends BaseRestService<GroupEntity, GroupRequest,
return modelMapper.map(entity, GroupResponse.class);
}
public GroupExcel convertToExcel(GroupResponse group) {
return modelMapper.map(group, GroupExcel.class);
}
// public GroupExcel convertToExcel(GroupResponse group) {
// return modelMapper.map(group, GroupExcel.class);
// }
/**
* 将群组实体转换为Excel导出对象
*/
public GroupExcel convertToExcel(GroupEntity group) {
GroupExcel excel = new GroupExcel();
excel.setUid(group.getUid());
excel.setName(group.getName());
excel.setAvatar(group.getAvatar());
excel.setDescription(group.getDescription());
excel.setType(group.getType());
excel.setStatus(group.getStatus());
excel.setIsExternal(group.isExternal());
excel.setCreator(group.getCreator() != null ? group.getCreator().getNickname() : "");
excel.setMemberCount(group.getMembers().size());
excel.setAdminCount(group.getAdmins().size());
excel.setMaxMembers(group.getMaxMembers());
excel.setNeedApproval(group.getNeedApproval());
excel.setAllowInvite(group.getAllowInvite());
excel.setMuteAll(group.getMuteAll());
excel.setShowTopTip(group.isShowTopTip());
excel.setTopTip(group.getTopTip());
excel.setCreatedAt(group.getCreatedAt().toString());
excel.setUpdatedAt(group.getUpdatedAt().toString());
return excel;
}
}

View File

@@ -2,7 +2,7 @@
* @Author: jackning 270580156@qq.com
* @Date: 2024-06-28 10:46:47
* @LastEditors: jackning 270580156@qq.com
* @LastEditTime: 2024-06-28 12:58:00
* @LastEditTime: 2025-03-03 23:50: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.
@@ -17,6 +17,8 @@ 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 jakarta.persistence.criteria.Predicate;
import lombok.extern.slf4j.Slf4j;
@@ -30,7 +32,7 @@ public class GroupSpecification extends BaseSpecification {
List<Predicate> 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() + "%"));
}
//