合并
This commit is contained in:
@ -77,6 +77,7 @@ public class RedisUtils {
|
|||||||
public static <T> void publish(String channelKey, T msg, Consumer<T> consumer) {
|
public static <T> void publish(String channelKey, T msg, Consumer<T> consumer) {
|
||||||
RTopic topic = CLIENT.getTopic(channelKey);
|
RTopic topic = CLIENT.getTopic(channelKey);
|
||||||
topic.publish(msg);
|
topic.publish(msg);
|
||||||
|
System.out.println("发布通道消息---------"+msg.toString());
|
||||||
consumer.accept(msg);
|
consumer.accept(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,6 +134,8 @@ public class SseEmitterManager {
|
|||||||
SseMessageDto broadcastMessage = new SseMessageDto();
|
SseMessageDto broadcastMessage = new SseMessageDto();
|
||||||
broadcastMessage.setMessage(sseMessageDto.getMessage());
|
broadcastMessage.setMessage(sseMessageDto.getMessage());
|
||||||
broadcastMessage.setUserIds(sseMessageDto.getUserIds());
|
broadcastMessage.setUserIds(sseMessageDto.getUserIds());
|
||||||
|
broadcastMessage.setRoute(sseMessageDto.getRoute());
|
||||||
|
broadcastMessage.setDetailId(sseMessageDto.getDetailId());
|
||||||
RedisUtils.publish(SSE_TOPIC, broadcastMessage, consumer -> {
|
RedisUtils.publish(SSE_TOPIC, broadcastMessage, consumer -> {
|
||||||
log.info("SSE发送主题订阅消息topic:{} session keys:{} message:{}",
|
log.info("SSE发送主题订阅消息topic:{} session keys:{} message:{}",
|
||||||
SSE_TOPIC, sseMessageDto.getUserIds(), sseMessageDto.getMessage());
|
SSE_TOPIC, sseMessageDto.getUserIds(), sseMessageDto.getMessage());
|
||||||
|
@ -7,6 +7,9 @@ import org.dromara.common.core.utils.SpringUtils;
|
|||||||
import org.dromara.common.sse.core.SseEmitterManager;
|
import org.dromara.common.sse.core.SseEmitterManager;
|
||||||
import org.dromara.common.sse.dto.SseMessageDto;
|
import org.dromara.common.sse.dto.SseMessageDto;
|
||||||
|
|
||||||
|
import java.lang.reflect.Array;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SSE工具类
|
* SSE工具类
|
||||||
*
|
*
|
||||||
|
@ -31,7 +31,6 @@ public class BusPhysicalsupplyBo extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 采购1 或 材料2 或 查询所有3
|
* 采购1 或 材料2 或 查询所有3
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "采购或材料填写不能为空", groups = { EditGroup.class })
|
|
||||||
private String findType;
|
private String findType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,6 +8,7 @@ import org.dromara.cailiaoshebei.domain.BusTotalsupplyplanAudit;
|
|||||||
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
|
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
|
||||||
import org.dromara.common.core.domain.event.ProcessEvent;
|
import org.dromara.common.core.domain.event.ProcessEvent;
|
||||||
import org.dromara.common.core.domain.event.ProcessTaskEvent;
|
import org.dromara.common.core.domain.event.ProcessTaskEvent;
|
||||||
|
import org.dromara.common.core.enums.BusinessStatusEnum;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
@ -448,7 +449,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
|
|||||||
busBillofquantitiesVersions.setStatus(processEvent.getStatus());
|
busBillofquantitiesVersions.setStatus(processEvent.getStatus());
|
||||||
boolean update = this.update(busBillofquantitiesVersions, eq);
|
boolean update = this.update(busBillofquantitiesVersions, eq);
|
||||||
//变更成功,增加数据
|
//变更成功,增加数据
|
||||||
if (update) {
|
if (update && BusinessStatusEnum.FINISH.getStatus().equals(processEvent.getStatus())) {
|
||||||
//2、根据版本号查询数据
|
//2、根据版本号查询数据
|
||||||
BusBillofquantitiesVersions versions = this.getOne(eq);
|
BusBillofquantitiesVersions versions = this.getOne(eq);
|
||||||
//2、新增批次号
|
//2、新增批次号
|
||||||
|
@ -16,6 +16,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.design.domain.DesScheme;
|
import org.dromara.design.domain.DesScheme;
|
||||||
|
import org.dromara.message.domain.MsgConfig;
|
||||||
|
import org.dromara.message.domain.bo.MsgNoticeBo;
|
||||||
|
import org.dromara.message.domain.dto.SendMsgDto;
|
||||||
|
import org.dromara.message.service.IMsgConfigService;
|
||||||
|
import org.dromara.message.service.IMsgNoticeService;
|
||||||
import org.dromara.system.domain.vo.SysOssUploadVo;
|
import org.dromara.system.domain.vo.SysOssUploadVo;
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
import org.dromara.system.service.ISysOssService;
|
import org.dromara.system.service.ISysOssService;
|
||||||
@ -28,9 +33,8 @@ import org.dromara.design.mapper.DesPrelimSchemeMapper;
|
|||||||
import org.dromara.design.service.IDesPrelimSchemeService;
|
import org.dromara.design.service.IDesPrelimSchemeService;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
import java.util.stream.Collectors;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import static org.dromara.common.constant.MinioPathConstant.ContactNoticeTemplate;
|
import static org.dromara.common.constant.MinioPathConstant.ContactNoticeTemplate;
|
||||||
|
|
||||||
@ -49,6 +53,11 @@ public class DesPrelimSchemeServiceImpl extends ServiceImpl<DesPrelimSchemeMappe
|
|||||||
|
|
||||||
private final ISysOssService ossService;
|
private final ISysOssService ossService;
|
||||||
|
|
||||||
|
private final IMsgConfigService msgConfigService;
|
||||||
|
|
||||||
|
private final IMsgNoticeService msgNoticeService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设计初步方案
|
* 查询设计初步方案
|
||||||
*
|
*
|
||||||
@ -197,7 +206,44 @@ public class DesPrelimSchemeServiceImpl extends ServiceImpl<DesPrelimSchemeMappe
|
|||||||
prelimScheme.setStatus(BusinessStatusEnum.WAITING.getStatus());
|
prelimScheme.setStatus(BusinessStatusEnum.WAITING.getStatus());
|
||||||
}
|
}
|
||||||
this.updateById(prelimScheme);
|
this.updateById(prelimScheme);
|
||||||
|
//状态为已完成发送消息
|
||||||
|
// if (BusinessStatusEnum.FINISH.getStatus().equals(processEvent.getStatus())) {
|
||||||
|
System.out.println("1!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
//发送消息
|
||||||
|
MsgConfig msgConfig = msgConfigService.getOne(
|
||||||
|
new LambdaQueryWrapper<MsgConfig>().
|
||||||
|
eq(MsgConfig::getProjectId, prelimScheme.getProjectId()).
|
||||||
|
eq(MsgConfig::getMsgKey, "prelimScheme")
|
||||||
|
);
|
||||||
|
System.out.println("2!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
if (msgConfig != null) {
|
||||||
|
System.out.println("3!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
String userId = msgConfig.getUserId();
|
||||||
|
List<Long> userIdList = Arrays.stream(userId.split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.map(s -> {
|
||||||
|
try {
|
||||||
|
return Long.valueOf(s);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// 处理转换失败的情况
|
||||||
|
return null; // 或者根据需求处理
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter(Objects::nonNull) // 过滤掉转换失败的null值
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
System.out.println("4!!!!!!!!!3123213!!!!!!!!!!!!!!");
|
||||||
|
//发送消息
|
||||||
|
SendMsgDto sendMsgDto = new SendMsgDto();
|
||||||
|
sendMsgDto.setProjectId(prelimScheme.getProjectId());
|
||||||
|
sendMsgDto.setRecipientIds(userIdList);
|
||||||
|
sendMsgDto.setSenderId(0L);
|
||||||
|
sendMsgDto.setConfigId(msgConfig.getId());
|
||||||
|
sendMsgDto.setDetailId(prelimScheme.getId().toString());
|
||||||
|
sendMsgDto.setContent(msgConfig.getMsgContent());
|
||||||
|
System.out.println("5!!!!!!!!!!!!!!!!!!!!!!!");
|
||||||
|
msgNoticeService.sendMsg(sendMsgDto);
|
||||||
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,7 @@ public class MsgConfig extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 消息名称
|
* 消息名称
|
||||||
*/
|
*/
|
||||||
private Long msgName;
|
private String msgName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息模板
|
* 消息模板
|
||||||
|
@ -28,7 +28,7 @@ public class MsgConfigAddReq implements Serializable {
|
|||||||
* 消息名称
|
* 消息名称
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "消息名称不能为空")
|
@NotNull(message = "消息名称不能为空")
|
||||||
private Long msgName;
|
private String msgName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息模板
|
* 消息模板
|
||||||
|
@ -36,7 +36,7 @@ public class MsgConfigBo extends BaseEntity {
|
|||||||
* 消息名称
|
* 消息名称
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "消息名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotNull(message = "消息名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
private Long msgName;
|
private String msgName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息模板
|
* 消息模板
|
||||||
|
@ -28,7 +28,7 @@ public class MsgConfigEditReq implements Serializable {
|
|||||||
* 消息名称
|
* 消息名称
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "消息名称不能为空")
|
@NotNull(message = "消息名称不能为空")
|
||||||
private Long msgName;
|
private String msgName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息模板
|
* 消息模板
|
||||||
|
@ -44,7 +44,7 @@ public class MsgConfigVo implements Serializable {
|
|||||||
* 消息名称
|
* 消息名称
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "消息名称")
|
@ExcelProperty(value = "消息名称")
|
||||||
private Long msgName;
|
private String msgName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息模板
|
* 消息模板
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.dromara.message.service.impl;
|
package org.dromara.message.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
@ -12,8 +13,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.sse.dto.SseMessageDto;
|
import org.dromara.common.sse.dto.SseMessageDto;
|
||||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||||
|
import org.dromara.message.domain.MsgConfig;
|
||||||
import org.dromara.message.domain.bo.TheCurrentUserMessageListReq;
|
import org.dromara.message.domain.bo.TheCurrentUserMessageListReq;
|
||||||
import org.dromara.message.domain.dto.SendMsgDto;
|
import org.dromara.message.domain.dto.SendMsgDto;
|
||||||
|
import org.dromara.message.service.IMsgConfigService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.dromara.message.domain.bo.MsgNoticeBo;
|
import org.dromara.message.domain.bo.MsgNoticeBo;
|
||||||
import org.dromara.message.domain.vo.MsgNoticeVo;
|
import org.dromara.message.domain.vo.MsgNoticeVo;
|
||||||
@ -35,6 +38,8 @@ public class MsgNoticeServiceImpl extends ServiceImpl<MsgNoticeMapper, MsgNotice
|
|||||||
|
|
||||||
private final MsgNoticeMapper baseMapper;
|
private final MsgNoticeMapper baseMapper;
|
||||||
|
|
||||||
|
private final IMsgConfigService msgConfigService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询消息
|
* 查询消息
|
||||||
*
|
*
|
||||||
@ -183,11 +188,21 @@ public class MsgNoticeServiceImpl extends ServiceImpl<MsgNoticeMapper, MsgNotice
|
|||||||
//批量保存数据
|
//批量保存数据
|
||||||
boolean b = this.saveBatch(msgNotices);
|
boolean b = this.saveBatch(msgNotices);
|
||||||
if(b){
|
if(b){
|
||||||
|
//获取到配置信息,准备发送消息
|
||||||
|
MsgConfig byId = msgConfigService.getById(bo.getConfigId());
|
||||||
SseMessageDto messageDto = new SseMessageDto();
|
SseMessageDto messageDto = new SseMessageDto();
|
||||||
messageDto.setUserIds(recipientIds);
|
messageDto.setUserIds(recipientIds);
|
||||||
messageDto.setMessage(bo.getContent());
|
|
||||||
// messageDto.setRoute(bo.get());
|
SseMessageDto messageDto2 = new SseMessageDto();
|
||||||
messageDto.setDetailId(bo.getContent());
|
messageDto2.setUserIds(recipientIds);
|
||||||
|
messageDto2.setMessage(bo.getContent());
|
||||||
|
messageDto2.setRoute(byId.getRoute());
|
||||||
|
messageDto2.setDetailId(bo.getDetailId());
|
||||||
|
Gson gson = new Gson();
|
||||||
|
String messageDtoJson = gson.toJson(messageDto2);
|
||||||
|
|
||||||
|
messageDto.setMessage(messageDtoJson);
|
||||||
|
|
||||||
SseMessageUtils.publishMessage(messageDto);
|
SseMessageUtils.publishMessage(messageDto);
|
||||||
}else{
|
}else{
|
||||||
throw new RuntimeException("消息发送失败");
|
throw new RuntimeException("消息发送失败");
|
||||||
|
Reference in New Issue
Block a user