diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java new file mode 100644 index 0000000000..bbe4f551db --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/OrgOrStaffMQMsg.java @@ -0,0 +1,28 @@ +package com.epmet.commons.rocketmq.messages; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 组织、网格、人员中间库数据上报MQ + * @author sun + */ +@Data +@AllArgsConstructor +public class OrgOrStaffMQMsg implements Serializable { + + //客户Id + private String customerId; + //组织、网格、人员Id + private String orgId; + //数据类型【组织:agency 网格:grid 人员:staff】 + private String orgType; + //操作类型【新增:add 修改删除:edit】 + private String type; + + +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java index 32674d49f6..b7ce5cdd19 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/send/SendMqMsgUtil.java @@ -1,10 +1,7 @@ package com.epmet.send; import com.alibaba.fastjson.JSON; -import com.epmet.commons.rocketmq.messages.GroupAchievementMQMsg; -import com.epmet.commons.rocketmq.messages.PointRuleChangedMQMsg; -import com.epmet.commons.rocketmq.messages.ProjectChangedMQMsg; -import com.epmet.commons.rocketmq.messages.StaffPatrolMQMsg; +import com.epmet.commons.rocketmq.messages.*; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.SystemMessageType; @@ -158,4 +155,31 @@ public class SendMqMsgUtil { } + /** + * @Description 组织、网格、人员中间库信息同步Mq + * @author sun + */ + public boolean sendOrgStaffMqMsg(OrgOrStaffMQMsg msg) { + try { + SystemMsgFormDTO msgForm = new SystemMsgFormDTO(); + msgForm.setMessageType(msg.getType()); + msgForm.setContent(msg); + Result sendMsgResult; + log.info("sendOrgStaffMqMsg param:{}",msgForm); + int retryTime = 0; + do { + sendMsgResult = epmetMessageOpenFeignClient.sendSystemMsgByMQ(msgForm); + } while ((sendMsgResult == null || !sendMsgResult.success()) && retryTime++ < NumConstant.TWO); + + if (sendMsgResult != null && sendMsgResult.success()) { + return true; + } + log.error("发送(组织、网格、人员同步中间库)系统消息到message服务失败:{},msg:{}", JSON.toJSONString(sendMsgResult), JSON.toJSONString(msgForm)); + } catch (Exception e) { + log.error("sendOrgStaffMqMsg exception", e); + } + return false; + + } + }