Commit 6d228b2a by 墨竹

feat:恢复代码

parent 4c0f3a70
......@@ -5,9 +5,12 @@ import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.notify.qdto.NoticeMessageQDTO;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.mq.sdk.GicMQClient;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static org.slf4j.LoggerFactory.getLogger;
......@@ -52,13 +55,54 @@ public class NoticeMessageUtil {
logger.info("发送消息:{}", ret);
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
// com.gic.haoban.manage.api.service.notify.NoticeMessageApiService.run
clientInstance.sendMessage(NOTICE_MESSAGE, ret);
} catch (Exception e) {
logger.info("发送消息异常:{}", e);
}
}
/**
* 发送消息 对象里面的字段 解析
* enterpriseId 企业id
* clerkId 执行人导购
* messageType 消息类型 NoticeMessageTypeEnum
* optTargetId 操作对象
* fieldMap 解析模板的字段
* extendField 拓展字段给前端使用 没有可以为null
* @param list
*/
public static void sendNoticeMessageBatch(List<NoticeMessageQDTO> list) {
if (CollectionUtils.isEmpty(list)) {
logger.info("没有哦需要发送的消息");
return;
}
List<String> ret = new ArrayList<String>();
for (NoticeMessageQDTO noticeMessageQDTO : list) {
String retStr = JSONObject.toJSONString(noticeMessageQDTO);
if (StringUtils.isAnyBlank(noticeMessageQDTO.getEnterpriseId(), noticeMessageQDTO.getClerkId())) {
logger.info("参数不存在:{}", retStr);
throw new RuntimeException("必传参数没传:" + noticeMessageQDTO.getClerkId());
}
NoticeMessageTypeEnum messageTypeEnum = NoticeMessageTypeEnum.getByType(noticeMessageQDTO.getMessageType());
if (messageTypeEnum == null) {
logger.info("类型不存在:{}", retStr);
throw new RuntimeException("消息类型不存在");
}
ret.add(retStr);
logger.info("发送消息单条:{}", retStr);
}
logger.info("批量发送消息:{}", ret.size());
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
clientInstance.sendBatchMessages(NOTICE_MESSAGE, ret);
} catch (Exception e) {
logger.info("发送消息异常:{}", e);
}
}
/**
* 发送消息 使用staffId发送
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment