#21 GIS 引擎集成: - GeoServer init 脚本(自动创建工作区/数据源) - Leaflet 地图组件 (Vue3 MapView: 点位/弹窗/OSM底图) - GisService: PostGIS 空间查询(附近设备/片区统计/GeoJSON) - GisController: /nearby /device-stats /geojson API #22 IoT 设备接入层: - Kafka Consumer: iot.telemetry + iot.event 消费 - DeviceController: 设备列表/详情/注册/指令下发 REST API #26 消息通知: - NotifyService: 短信/WebSocket/APP Push/多渠道分发 - NotifyController: SMS/Push API #25 DevOps: - 10个微服务 Dockerfile (Eclipse Temurin JRE17) - CI build.sh: Maven构建 + Docker镜像打包 - Frontend Nginx 反向代理配置
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.water.notify.controller;
|
||||
|
||||
import com.water.common.core.result.R;
|
||||
import com.water.notify.service.NotifyService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Tag(name = "消息通知")
|
||||
@RestController
|
||||
@RequestMapping("/notify")
|
||||
@RequiredArgsConstructor
|
||||
public class NotifyController {
|
||||
|
||||
private final NotifyService notifyService;
|
||||
|
||||
@PostMapping("/sms")
|
||||
public R<String> sendSms(@RequestBody Map<String, String> req) {
|
||||
notifyService.sendSms(req.get("phone"), req.get("content"));
|
||||
return R.ok("短信发送成功");
|
||||
}
|
||||
|
||||
@PostMapping("/push")
|
||||
public R<String> push(@RequestBody Map<String, Object> req) {
|
||||
notifyService.dispatch(
|
||||
Long.parseLong(String.valueOf(req.get("schemeId"))),
|
||||
Long.parseLong(String.valueOf(req.get("userId"))),
|
||||
(String) req.get("title"),
|
||||
(String) req.get("content"));
|
||||
return R.ok("通知已分发");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.water.notify.service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class NotifyService {
|
||||
|
||||
/** 发送短信 */
|
||||
public void sendSms(String phone, String content) {
|
||||
log.info("Send SMS to {}: {}", phone, content);
|
||||
// TODO: 集成阿里云/腾讯云短信 SDK
|
||||
}
|
||||
|
||||
/** WebSocket 推送 */
|
||||
public void pushWebSocket(Long userId, String message) {
|
||||
log.info("Push WS to user {}: {}", userId, message);
|
||||
// TODO: WebSocket session 管理
|
||||
}
|
||||
|
||||
/** APP Push */
|
||||
public void pushApp(Long userId, String title, String body) {
|
||||
log.info("Push APP to user {}: {} - {}", userId, title, body);
|
||||
// TODO: 极光推送
|
||||
}
|
||||
|
||||
/** 按通知方案多渠道分发 */
|
||||
public void dispatch(Long schemeId, Long userId, String title, String content) {
|
||||
// TODO: 查询通知方案,按配置渠道分发
|
||||
log.info("Notify dispatch: scheme={}, user={}, title={}", schemeId, userId, title);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user