Skip to content

Commit

Permalink
Merge pull request #346 from Jzow/master
Browse files Browse the repository at this point in the history
Add message notification function
  • Loading branch information
Jzow authored Jul 17, 2024
2 parents 1c12ba9 + 3f9fe51 commit 0bdddfb
Show file tree
Hide file tree
Showing 30 changed files with 1,865 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
*/
package com.wansenai.api.system;

import org.springframework.web.bind.annotation.RequestMapping;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wansenai.dto.system.UpdateSystemMessageDTO;
import com.wansenai.service.system.ISysMsgService;
import com.wansenai.utils.response.Response;
import com.wansenai.vo.SystemMessageVO;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
* <p>
Expand All @@ -25,7 +30,22 @@
* @since 2023-09-05
*/
@RestController
@RequestMapping("/sys-msg")
@RequestMapping("/sys/message")
public class SysMsgController {

private final ISysMsgService sysMsgService;

public SysMsgController(ISysMsgService sysMsgService) {
this.sysMsgService = sysMsgService;
}

@GetMapping("list")
public Response<List<SystemMessageVO>> messagePageList() {
return sysMsgService.getMessagePageList();
}

@PostMapping("read")
public Response<String> readMessage(@RequestBody UpdateSystemMessageDTO updateSystemMessageDTO) {
return sysMsgService.updateMessageStatus(updateSystemMessageDTO);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansenai.dto.system;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SystemMessageDTO {

private Long id;

private Long userId;

private String msgTitle;

private String msgContent;

private String description;

private String type;

private Integer status;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansenai.dto.system;

import lombok.Data;

@Data
public class UpdateSystemMessageDTO {

private Long id;

private Long userId;

private Integer status;
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public class SysMsg implements Serializable {
*/
private String msgContent;

/**
* 描述(简约内容)
*/
private String description;

/**
* 创建时间
*/
Expand Down
40 changes: 40 additions & 0 deletions core/domain/src/main/java/com/wansenai/vo/SystemMessageItemVO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansenai.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class SystemMessageItemVO {

@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;

private String title;

private String avatar;

private String description;

private String msgContent;

private String type;

private Integer status;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime datetime;
}
27 changes: 27 additions & 0 deletions core/domain/src/main/java/com/wansenai/vo/SystemMessageVO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2024-2033 WanSen AI Team, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://opensource.wansenai.com/apache2.0/
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
* OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.wansenai.vo;

import lombok.Data;

import java.util.List;

@Data
public class SystemMessageVO {

private String key;

private String name;

private List<SystemMessageItemVO> list;
}
Loading

0 comments on commit 0bdddfb

Please sign in to comment.