“mitao”
2026-02-27 fcde19b528de74a3ba8b1394970bba6911e85f88
feat(app):增加通知已读状态及操作接口
2个文件已修改
26 ■■■■■ 已修改文件
xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/XpOperationsUserNotificationController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/java/com/xiaopeng/api/model/account/XpOperationsUserNotification.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/XpOperationsUserNotificationController.java
@@ -9,9 +9,7 @@
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
 * <p>
@@ -55,4 +53,21 @@
        return R.ok(pageInfo);
    }
    @GetMapping("/api/v1/notification/unreadCount")
    @ApiOperation(value = "获取未读通知数量", tags = {"运维APP-消息通知"})
    public R<Long> getUnreadNotificationCount() {
        // 从Token中获取当前登录用户ID
        Long currentUserId = tokenService.getLoginOperationUser().getId();
        Long count = notificationService.lambdaQuery().eq(XpOperationsUserNotification::getOperationsUserId, currentUserId)
                .eq(XpOperationsUserNotification::getReadStatus, 0).count();
        return R.ok(count);
    }
    @PostMapping("/api/v1/notification/read")
    @ApiOperation(value = "操作已读", tags = "运维APP-消息通知")
    public R<?> readNotification(@RequestParam Long notificationId){
        notificationService.lambdaUpdate().set(XpOperationsUserNotification::getReadStatus, 1).eq(XpOperationsUserNotification::getId, notificationId).update();
        return R.ok();
    }
}
xp-robotaxi-api/src/main/java/com/xiaopeng/api/model/account/XpOperationsUserNotification.java
@@ -6,6 +6,7 @@
import java.time.LocalDateTime;
import java.io.Serializable;
import com.sun.org.apache.bcel.internal.generic.INEG;
import com.xiaopeng.common.core.web.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -34,7 +35,7 @@
    @TableId(value = "id", type = IdType.NONE)
    private Long id;
    @ApiModelProperty(value = "通知类型1新任务通知 2任务状态通知 3排班变动通知 4公告通知 5新事故通知 6事故状态通知")
    @ApiModelProperty(value = "通知类型通知类型 1=新增事故,2=事故即将超时提示,3=事故超时提示,4=排班信息变动,5=事故状态变更,6=新增任务,7=任务过期提示,8=版本更新提示,9=变更协议政策内容,10=变更协议内容并需用户授权,11=打卡成功通知")
    private Integer notificationType;
    @ApiModelProperty(value = "通知内容")
@@ -46,5 +47,7 @@
    @ApiModelProperty(value = "数据id 根据通知类型区分")
    private Long dataId;
    @ApiModelProperty(value = "是否已读 0-未读 1-已读")
    private Integer readStatus;
}