新增 公告推送用户组功能
修改 公告推送用户, 从全员变更为选择用户推送 修改 公告推送信息模板, 通知类型以及跳转地址
This commit is contained in:
parent
311de21aff
commit
3e5a0117a1
@ -74,6 +74,9 @@ public interface ErrorCodeConstants {
|
|||||||
// ========== 通知公告 1-002-008-000 ==========
|
// ========== 通知公告 1-002-008-000 ==========
|
||||||
ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1_002_008_001, "当前通知公告不存在");
|
ErrorCode NOTICE_NOT_FOUND = new ErrorCode(1_002_008_001, "当前通知公告不存在");
|
||||||
|
|
||||||
|
ErrorCode USER_GROUP_NOT_EXISTS = new ErrorCode(1_002_008_002, "用户组不存在");
|
||||||
|
ErrorCode USER_GROUP_IS_DISABLE = new ErrorCode(1_002_008_003, "名字为【{}】的用户组已被禁用");
|
||||||
|
|
||||||
// ========== 短信渠道 1-002-011-000 ==========
|
// ========== 短信渠道 1-002-011-000 ==========
|
||||||
ErrorCode SMS_CHANNEL_NOT_EXISTS = new ErrorCode(1_002_011_000, "短信渠道不存在");
|
ErrorCode SMS_CHANNEL_NOT_EXISTS = new ErrorCode(1_002_011_000, "短信渠道不存在");
|
||||||
ErrorCode SMS_CHANNEL_DISABLE = new ErrorCode(1_002_011_001, "短信渠道不处于开启状态,不允许选择");
|
ErrorCode SMS_CHANNEL_DISABLE = new ErrorCode(1_002_011_001, "短信渠道不处于开启状态,不允许选择");
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package cn.iocoder.yudao.module.system.controller.admin.notice;
|
package cn.iocoder.yudao.module.system.controller.admin.notice;
|
||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePushReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.notice.NoticeGroupService;
|
||||||
import cn.iocoder.yudao.module.system.service.notice.NoticeService;
|
import cn.iocoder.yudao.module.system.service.notice.NoticeService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
@ -32,7 +32,7 @@ public class NoticeController {
|
|||||||
private NoticeService noticeService;
|
private NoticeService noticeService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private WebSocketSenderApi webSocketSenderApi;
|
private NoticeGroupService groupService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建通知公告")
|
@Operation(summary = "创建通知公告")
|
||||||
@ -77,18 +77,16 @@ public class NoticeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/push")
|
@PostMapping("/push")
|
||||||
@Operation(summary = "推送通知公告", description = "只发送给 websocket 连接在线的用户")
|
@Operation(summary = "推送通知公告")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
||||||
@PreAuthorize("@ss.hasPermission('system:notice:update')")
|
@PreAuthorize("@ss.hasPermission('system:notice:update')")
|
||||||
public CommonResult<Boolean> push(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> push(@Valid @RequestBody NoticePushReqVO pushReqVO) {
|
||||||
NoticeDO notice = noticeService.getNotice(id);
|
|
||||||
Assert.notNull(notice, "公告不能为空");
|
|
||||||
// 通过 websocket 推送给在线的用户
|
// 通过 websocket 推送给在线的用户
|
||||||
//webSocketSenderApi.sendObject(UserTypeEnum.ADMIN.getValue(), "notice-push", notice);
|
//webSocketSenderApi.sendObject(UserTypeEnum.ADMIN.getValue(), "notice-push", notice);
|
||||||
|
|
||||||
//小程序发送公告订阅消息
|
//小程序发送公告订阅消息
|
||||||
//获取改造方式, push 方法传入需要推送的用户ID集合【 将ID集合查询出用户集合, 只获取openId的用户,进行推送 】
|
//获取改造方式, push 方法传入需要推送的用户ID集合【 将ID集合查询出用户集合, 只获取openId的用户,进行推送 】
|
||||||
noticeService.sendNotice(notice);
|
noticeService.sendNotice(pushReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,110 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.notice;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.notice.NoticeGroupConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.user.UserConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeGroupDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.notice.NoticeGroupService;
|
||||||
|
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 用户组")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/notice/user-group")
|
||||||
|
@Validated
|
||||||
|
public class NoticeGroupController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NoticeGroupService userGroupService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AdminUserService userService;
|
||||||
|
@Resource
|
||||||
|
private DeptService deptService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建用户组")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:notice-gropu:create')")
|
||||||
|
public CommonResult<Long> createUserGroup(@Valid @RequestBody NoticeGroupCreateReqVO createReqVO) {
|
||||||
|
return success(userGroupService.createUserGroup(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新用户组")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:notice-gropu:update')")
|
||||||
|
public CommonResult<Boolean> updateUserGroup(@Valid @RequestBody NoticeGroupUpdateReqVO updateReqVO) {
|
||||||
|
userGroupService.updateUserGroup(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除用户组")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:notice-gropu:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUserGroup(@RequestParam("id") Long id) {
|
||||||
|
userGroupService.deleteUserGroup(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得用户组")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:notice-gropu:query')")
|
||||||
|
public CommonResult<NoticeGroupRespVO> getUserGroup(@RequestParam("id") Long id) {
|
||||||
|
|
||||||
|
NoticeGroupDO userGroup = userGroupService.getUserGroup(id);
|
||||||
|
|
||||||
|
//获得用户信息
|
||||||
|
List<AdminUserDO> userDOS = userService.getUserList(userGroup.getMemberUserIds());
|
||||||
|
//获得部门信息 map
|
||||||
|
Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertList(userDOS, AdminUserDO::getDeptId));
|
||||||
|
|
||||||
|
List<UserRespVO> userRespVOS = convertList(userDOS, user -> UserConvert.INSTANCE.convert(user, deptMap.get(user.getDeptId())));
|
||||||
|
|
||||||
|
NoticeGroupRespVO noticeGroupRespVO = NoticeGroupConvert.INSTANCE.convert(userGroup);
|
||||||
|
noticeGroupRespVO.setUserInfo(userRespVOS);
|
||||||
|
noticeGroupRespVO.setMemberDeptIds(deptMap.keySet());
|
||||||
|
|
||||||
|
return success(noticeGroupRespVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得用户组分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:notice-gropu:query')")
|
||||||
|
public CommonResult<PageResult<NoticeGroupRespVO>> getUserGroupPage(@Valid NoticeGroupPageReqVO pageVO) {
|
||||||
|
PageResult<NoticeGroupDO> pageResult = userGroupService.getUserGroupPage(pageVO);
|
||||||
|
return success(NoticeGroupConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-all-simple")
|
||||||
|
@Operation(summary = "获取用户组精简信息列表", description = "只包含被开启的用户组,主要用于前端的下拉选项")
|
||||||
|
public CommonResult<List<NoticeGroupRespVO>> getSimpleUserGroups() {
|
||||||
|
// 获用户门列表,只要开启状态的
|
||||||
|
List<NoticeGroupDO> list = userGroupService.getUserGroupListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
// 排序后,返回给前端
|
||||||
|
return success(NoticeGroupConvert.INSTANCE.convertList2(list));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.notice.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Schema(description = "公告推送信息 Response VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class NoticePushReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "公告编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "推送类型 | 0:全员 1:部门 2:用户组", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@Schema(description = "推送部门编号")
|
||||||
|
private List<Long> deptIds;
|
||||||
|
|
||||||
|
@Schema(description = "推送用户组编号")
|
||||||
|
private Set<Long> groupId;
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.notice.vo.group;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户组 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class NoticeGroupBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "组名", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道")
|
||||||
|
@NotNull(message = "组名不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道源码")
|
||||||
|
@NotNull(message = "描述不能为空")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "成员编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,2,3")
|
||||||
|
@NotNull(message = "成员编号数组不能为空")
|
||||||
|
private Set<Long> memberUserIds;
|
||||||
|
|
||||||
|
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotNull(message = "状态不能为空")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.notice.vo.group;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户组创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class NoticeGroupCreateReqVO extends NoticeGroupBaseVO {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.notice.vo.group;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户组分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class NoticeGroupPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "组名", example = "芋道")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "状态", example = "1")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.notice.vo.group;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserRespVO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户组 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class NoticeGroupRespVO extends NoticeGroupBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "成员部门编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "[126][128]")
|
||||||
|
@NotNull(message = "成员部门编号数组不能为空")
|
||||||
|
private Set<Long> memberDeptIds;
|
||||||
|
|
||||||
|
@Schema(description = "成员信息")
|
||||||
|
private List<UserRespVO> userInfo;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.notice.vo.group;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户组更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class NoticeGroupUpdateReqVO extends NoticeGroupBaseVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
@ -12,8 +12,8 @@ import java.util.Date;
|
|||||||
/**
|
/**
|
||||||
* 功能描述
|
* 功能描述
|
||||||
*
|
*
|
||||||
* @author: yj
|
* @author yj
|
||||||
* @date: 2024年04月07日 19:44
|
* date 2024年04月07日 19:44
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface NoticeConvert {
|
public interface NoticeConvert {
|
||||||
@ -27,14 +27,14 @@ public interface NoticeConvert {
|
|||||||
* @param miniProgramState 小程序的状态
|
* @param miniProgramState 小程序的状态
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
default SubscribeMessageReqDTO convertCompanyNotice(String openId, NoticeDO notice, String nickname, String miniProgramState) {
|
default SubscribeMessageReqDTO convertCompanyNotice(String openId, NoticeDO notice, String noticeLabel, String nickname, String miniProgramState) {
|
||||||
SubscribeMessageReqDTO message = new SubscribeMessageReqDTO();
|
SubscribeMessageReqDTO message = new SubscribeMessageReqDTO();
|
||||||
message.setToUser(openId);
|
message.setToUser(openId);
|
||||||
message.setTemplateId("OF4-948Vz9rtE_VA55rmDxo4azOwmrjjk33jDpOiPiY");
|
message.setTemplateId("OF4-948Vz9rtE_VA55rmDxo4azOwmrjjk33jDpOiPiY");
|
||||||
//通知类型
|
//通知类型
|
||||||
MsgData noticeType = new MsgData();
|
MsgData noticeType = new MsgData();
|
||||||
noticeType.setName("thing1");
|
noticeType.setName("thing1");
|
||||||
noticeType.setValue(notice.getType()+""); //这里根据业务需求填写具体的公告类型 如全员公告, xxx公告
|
noticeType.setValue(noticeLabel); //这里根据业务需求填写具体的公告类型 如全员公告, xxx公告
|
||||||
message.addData(noticeType);
|
message.addData(noticeType);
|
||||||
|
|
||||||
//公告标题
|
//公告标题
|
||||||
@ -67,7 +67,7 @@ public interface NoticeConvert {
|
|||||||
message.addData(createTime);
|
message.addData(createTime);
|
||||||
|
|
||||||
message.setMiniprogramState(miniProgramState);
|
message.setMiniprogramState(miniProgramState);
|
||||||
message.setPage("pages/index");
|
message.setPage("/subPages/notice/detail?id=" + notice.getId());
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.convert.notice;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeGroupDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Named;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户组 Convert
|
||||||
|
*
|
||||||
|
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NoticeGroupConvert {
|
||||||
|
|
||||||
|
NoticeGroupConvert INSTANCE = Mappers.getMapper(NoticeGroupConvert.class);
|
||||||
|
|
||||||
|
NoticeGroupDO convert(NoticeGroupCreateReqVO bean);
|
||||||
|
|
||||||
|
NoticeGroupDO convert(NoticeGroupUpdateReqVO bean);
|
||||||
|
|
||||||
|
NoticeGroupRespVO convert(NoticeGroupDO bean);
|
||||||
|
|
||||||
|
List<NoticeGroupRespVO> convertList(List<NoticeGroupDO> list);
|
||||||
|
|
||||||
|
PageResult<NoticeGroupRespVO> convertPage(PageResult<NoticeGroupDO> page);
|
||||||
|
|
||||||
|
@Named("convertList2")
|
||||||
|
List<NoticeGroupRespVO> convertList2(List<NoticeGroupDO> list);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.dataobject.notice;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告推送 用户组
|
||||||
|
*/
|
||||||
|
@TableName(value = "system_notice_group", autoResultMap = true)
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class NoticeGroupDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号,自增
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 组名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link CommonStatusEnum}
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 成员用户编号数组
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||||
|
private Set<Long> memberUserIds;
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.mysql.notice;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeGroupDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告推送用户组 Mapper
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NoticeGroupMapper extends BaseMapperX<NoticeGroupDO> {
|
||||||
|
|
||||||
|
default PageResult<NoticeGroupDO> selectPage(NoticeGroupPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<NoticeGroupDO>()
|
||||||
|
.likeIfPresent(NoticeGroupDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(NoticeGroupDO::getStatus, reqVO.getStatus())
|
||||||
|
.betweenIfPresent(NoticeGroupDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(NoticeGroupDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<NoticeGroupDO> selectListByStatus(Integer status) {
|
||||||
|
return selectList(NoticeGroupDO::getStatus, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.notice;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeGroupDO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户组 Service 接口
|
||||||
|
*
|
||||||
|
|
||||||
|
*/
|
||||||
|
public interface NoticeGroupService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户组
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createUserGroup(@Valid NoticeGroupCreateReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户组
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateUserGroup(@Valid NoticeGroupUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户组
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteUserGroup(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户组
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 用户组
|
||||||
|
*/
|
||||||
|
NoticeGroupDO getUserGroup(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户组列表
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
* @return 用户组列表
|
||||||
|
*/
|
||||||
|
List<NoticeGroupDO> getUserGroupList(Collection<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得指定状态的用户组列表
|
||||||
|
*
|
||||||
|
* @param status 状态
|
||||||
|
* @return 用户组列表
|
||||||
|
*/
|
||||||
|
List<NoticeGroupDO> getUserGroupListByStatus(Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户组分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 用户组分页
|
||||||
|
*/
|
||||||
|
PageResult<NoticeGroupDO> getUserGroupPage(NoticeGroupPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验用户组们是否有效。如下情况,视为无效:
|
||||||
|
* 1. 用户组编号不存在
|
||||||
|
* 2. 用户组被禁用
|
||||||
|
*
|
||||||
|
* @param ids 用户组编号数组
|
||||||
|
*/
|
||||||
|
void validUserGroups(Set<Long> ids);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,112 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.service.notice;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupCreateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.group.NoticeGroupUpdateReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.notice.NoticeGroupConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeGroupDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.notice.NoticeGroupMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_GROUP_IS_DISABLE;
|
||||||
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_GROUP_NOT_EXISTS;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户组 Service 实现类
|
||||||
|
*
|
||||||
|
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class NoticeGroupServiceImpl implements NoticeGroupService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NoticeGroupMapper userGroupMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createUserGroup(NoticeGroupCreateReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
NoticeGroupDO userGroup = NoticeGroupConvert.INSTANCE.convert(createReqVO);
|
||||||
|
userGroupMapper.insert(userGroup);
|
||||||
|
// 返回
|
||||||
|
return userGroup.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUserGroup(NoticeGroupUpdateReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
this.validateUserGroupExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
NoticeGroupDO updateObj = NoticeGroupConvert.INSTANCE.convert(updateReqVO);
|
||||||
|
userGroupMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUserGroup(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
this.validateUserGroupExists(id);
|
||||||
|
// 删除
|
||||||
|
userGroupMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateUserGroupExists(Long id) {
|
||||||
|
if (userGroupMapper.selectById(id) == null) {
|
||||||
|
throw exception(USER_GROUP_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NoticeGroupDO getUserGroup(Long id) {
|
||||||
|
return userGroupMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NoticeGroupDO> getUserGroupList(Collection<Long> ids) {
|
||||||
|
return userGroupMapper.selectBatchIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NoticeGroupDO> getUserGroupListByStatus(Integer status) {
|
||||||
|
return userGroupMapper.selectListByStatus(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<NoticeGroupDO> getUserGroupPage(NoticeGroupPageReqVO pageReqVO) {
|
||||||
|
return userGroupMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validUserGroups(Set<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 获得用户组信息
|
||||||
|
List<NoticeGroupDO> userGroups = userGroupMapper.selectBatchIds(ids);
|
||||||
|
Map<Long, NoticeGroupDO> userGroupMap = CollectionUtils.convertMap(userGroups, NoticeGroupDO::getId);
|
||||||
|
// 校验
|
||||||
|
ids.forEach(id -> {
|
||||||
|
NoticeGroupDO userGroup = userGroupMap.get(id);
|
||||||
|
if (userGroup == null) {
|
||||||
|
throw exception(USER_GROUP_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
if (!CommonStatusEnum.ENABLE.getStatus().equals(userGroup.getStatus())) {
|
||||||
|
throw exception(USER_GROUP_IS_DISABLE, userGroup.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.service.notice;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePushReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeDO;
|
||||||
|
|
||||||
@ -50,7 +51,7 @@ public interface NoticeService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序发送公告订阅消息
|
* 小程序发送公告订阅消息
|
||||||
* @param notice
|
* @param pushReqVO 推送信息
|
||||||
*/
|
*/
|
||||||
void sendNotice(NoticeDO notice) ;
|
void sendNotice(NoticePushReqVO pushReqVO) ;
|
||||||
}
|
}
|
||||||
|
@ -7,18 +7,24 @@ import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import cn.iocoder.yudao.module.system.api.subscribe.SubscribeMessageSendApi;
|
import cn.iocoder.yudao.module.system.api.subscribe.SubscribeMessageSendApi;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePushReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.convert.notice.NoticeConvert;
|
import cn.iocoder.yudao.module.system.convert.notice.NoticeConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeGroupDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.notice.NoticeMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.notice.NoticeMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
||||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTICE_NOT_FOUND;
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTICE_NOT_FOUND;
|
||||||
@ -35,9 +41,15 @@ public class NoticeServiceImpl implements NoticeService {
|
|||||||
@Resource
|
@Resource
|
||||||
private NoticeMapper noticeMapper;
|
private NoticeMapper noticeMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NoticeGroupService noticeGroupService;
|
||||||
|
|
||||||
@Resource(name = NOTIFY_THREAD_POOL_TASK_EXECUTOR)
|
@Resource(name = NOTIFY_THREAD_POOL_TASK_EXECUTOR)
|
||||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DictDataService dictDataService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createNotice(NoticeSaveReqVO createReqVO) {
|
public Long createNotice(NoticeSaveReqVO createReqVO) {
|
||||||
NoticeDO notice = BeanUtils.toBean(createReqVO, NoticeDO.class);
|
NoticeDO notice = BeanUtils.toBean(createReqVO, NoticeDO.class);
|
||||||
@ -90,25 +102,55 @@ public class NoticeServiceImpl implements NoticeService {
|
|||||||
private SubscribeMessageSendApi subscribeMessageSendApi;
|
private SubscribeMessageSendApi subscribeMessageSendApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendNotice(NoticeDO notice) {
|
public void sendNotice(NoticePushReqVO pushReqVO) {
|
||||||
|
|
||||||
|
//获得公告信息
|
||||||
|
NoticeDO notice = getNotice(pushReqVO.getId());
|
||||||
|
if (notice == null) {
|
||||||
|
throw exception(NOTICE_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得公告类型 字典label
|
||||||
|
DictDataDO dictDataDO = dictDataService.getDictData("system_notice_type", String.valueOf(notice.getType()));
|
||||||
|
|
||||||
//获取当前登陆用户的名称
|
//获取当前登陆用户的名称
|
||||||
LoginUser user = SecurityFrameworkUtils.getLoginUser() ;
|
LoginUser user = SecurityFrameworkUtils.getLoginUser() ;
|
||||||
AdminUserDO currentUser = userService.getUser(user.getId()) ;
|
AdminUserDO currentUser = userService.getUser(user.getId()) ;
|
||||||
|
|
||||||
//查询所有状态是开启的用户
|
List<AdminUserDO> userDOs = new ArrayList<>();
|
||||||
List<AdminUserDO> list = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
switch (pushReqVO.getType()) {
|
||||||
for(AdminUserDO adminUserDO : list) {
|
|
||||||
|
//全员推送
|
||||||
|
case 0:
|
||||||
|
//获得用户信息
|
||||||
|
userDOs = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
break;
|
||||||
|
//部门推送
|
||||||
|
case 1:
|
||||||
|
//获得用户信息
|
||||||
|
userDOs = userService.getUserListByDeptIds(pushReqVO.getDeptIds());
|
||||||
|
break;
|
||||||
|
//用户组推送
|
||||||
|
case 2:
|
||||||
|
//获得用户组信息
|
||||||
|
List<NoticeGroupDO> groupDOs = noticeGroupService.getUserGroupList(pushReqVO.getGroupId());
|
||||||
|
|
||||||
|
//获得用户组中 用户信息
|
||||||
|
userDOs = userService.getUserList(groupDOs.stream().flatMap(group -> group.getMemberUserIds().stream()).collect(Collectors.toSet()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(AdminUserDO adminUserDO : userDOs) {
|
||||||
if( adminUserDO.getOpenId() != null && !adminUserDO.getOpenId().isEmpty()) {
|
if( adminUserDO.getOpenId() != null && !adminUserDO.getOpenId().isEmpty()) {
|
||||||
// System.out.println("====" + adminUserDO.getNickname());
|
|
||||||
|
|
||||||
threadPoolTaskExecutor.execute(() -> {
|
threadPoolTaskExecutor.execute(() -> {
|
||||||
|
|
||||||
//获取openId有值的用户
|
//获取openId有值的用户
|
||||||
subscribeMessageSendApi.sendCompanyNotice(NoticeConvert.INSTANCE.convertCompanyNotice(
|
subscribeMessageSendApi.sendCompanyNotice(NoticeConvert.INSTANCE.convertCompanyNotice(
|
||||||
adminUserDO.getOpenId(), notice , currentUser.getNickname(),
|
adminUserDO.getOpenId(), notice, dictDataDO.getLabel(), currentUser.getNickname(),
|
||||||
"formal"));
|
"formal"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user