refactor(harmonic): 重构事件通知服务并迁移至系统模块

- 移除 AppNotificationService 和 SmsNotificationService 服务类
- 新增消息发送服务相关接口和实现类到系统模块
- 迁移 AsyncConfig 配置类到 cs-system 模块
- 新增事件用户关系表的 Mapper、Service 接口及实现类
- 更新 CsEventPO 添加 landPoint 字段用于存储事件落点信息
- 修改事件处理逻辑使用新的消息发送 Feign 客户端
- 集成事件原因分析功能并更新数据库字段映射
- 更新设备详情 DTO 添加 nDid 属性支持
- 优化事件通知和短信发送的消息内容格式
- 移除旧的设备消息客户端依赖并使用新服务接口
This commit is contained in:
xy
2026-05-27 11:12:32 +08:00
parent 202888ca14
commit f81be47e5f
19 changed files with 581 additions and 193 deletions

View File

@@ -0,0 +1,26 @@
package com.njcn.cssystem.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.cssystem.api.fallback.MsgSendFeignClientFallbackFactory;
import com.njcn.cssystem.pojo.param.MsgSendParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* @author xy
*/
@FeignClient(value = ServerInfo.CS_SYSTEM_BOOT, path = "/send", fallbackFactory = MsgSendFeignClientFallbackFactory.class,contextId = "send")
public interface MsgSendFeignClient {
@PostMapping("/appMsgSend")
@ApiOperation("app消息推送")
HttpResult<Boolean> appMsgSend(@RequestBody MsgSendParam param);
@PostMapping("/smsMsgSend")
@ApiOperation("短信消息推送")
HttpResult<Boolean> smsMsgSend(@RequestBody MsgSendParam param);
}

View File

@@ -0,0 +1,41 @@
package com.njcn.cssystem.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.cssystem.api.MsgSendFeignClient;
import com.njcn.cssystem.pojo.param.MsgSendParam;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author xy
*/
@Slf4j
@Component
public class MsgSendFeignClientFallbackFactory implements FallbackFactory<MsgSendFeignClient> {
@Override
public MsgSendFeignClient create(Throwable cause) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (cause.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) cause.getCause();
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new MsgSendFeignClient() {
@Override
public HttpResult<Boolean> appMsgSend(MsgSendParam param) {
log.error("{}异常,降级处理,异常为:{}","app消息推送异常",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<Boolean> smsMsgSend(MsgSendParam param) {
log.error("{}异常,降级处理,异常为:{}","短信消息推送异常",cause.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -0,0 +1,45 @@
package com.njcn.cssystem.pojo.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author xy
*/
@Data
public class MsgSendParam implements Serializable {
@ApiModelProperty("事件类型")
private Integer eventType;
@ApiModelProperty("类型")
private String type;
@ApiModelProperty("设备id")
private String devId;
@ApiModelProperty("事件名称")
private String eventName;
@ApiModelProperty("事件时间")
private LocalDateTime eventTime;
@ApiModelProperty("事件id")
private String id;
@ApiModelProperty("nDid")
private String nDid;
@ApiModelProperty("暂态幅值")
private Double amplitude;
@ApiModelProperty("持续时间")
private Double persistTime;
@ApiModelProperty("落点位置")
private String dropZone;
}