|
|
@@ -0,0 +1,127 @@
|
|
|
+package com.zhongshu.card.server.core.controller.visitor;
|
|
|
+
|
|
|
+import com.github.microservice.auth.security.annotations.ResourceAuth;
|
|
|
+import com.github.microservice.auth.security.helper.AuthHelper;
|
|
|
+import com.github.microservice.auth.security.type.AuthType;
|
|
|
+import com.github.microservice.net.ResultContent;
|
|
|
+import com.zhongshu.card.client.model.base.IDParam;
|
|
|
+import com.zhongshu.card.client.model.base.ProjectOidParam;
|
|
|
+import com.zhongshu.card.client.model.tip.TipInfoModel;
|
|
|
+import com.zhongshu.card.client.model.tip.TipInfoSearch;
|
|
|
+import com.zhongshu.card.server.core.service.tip.TipInfoService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.data.web.PageableDefault;
|
|
|
+import org.springframework.util.Assert;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 提醒消息管理
|
|
|
+ *
|
|
|
+ * @author TRX
|
|
|
+ * @date 2024/6/5
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/tipInfo")
|
|
|
+@Tag(name = "提醒消息管理")
|
|
|
+public class TipInfoController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TipInfoService tipInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AuthHelper authHelper;
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "删除数据", description = "删除数据")
|
|
|
+ @RequestMapping(value = "deleteInfo", method = {RequestMethod.POST})
|
|
|
+ public ResultContent deleteInfo(@RequestBody IDParam param) {
|
|
|
+ return this.tipInfoService.deleteInfo(param.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "所有数据列表-分页查询", description = "数据列表-分页查询")
|
|
|
+ @RequestMapping(value = {"page"}, method = {RequestMethod.POST})
|
|
|
+ public ResultContent<Page<TipInfoModel>> page(
|
|
|
+ @Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
|
|
|
+ @Parameter(required = false) TipInfoSearch param) {
|
|
|
+ Assert.hasText(param.getProjectOid(), "projectOid不能为空");
|
|
|
+ return tipInfoService.page(param, pageable);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "我的消息列表-分页查询", description = "我的消息列表-分页查询")
|
|
|
+ @RequestMapping(value = {"myPage"}, method = {RequestMethod.POST})
|
|
|
+ public ResultContent<Page<TipInfoModel>> myPage(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
|
|
|
+ @Parameter(required = false) TipInfoSearch param) {
|
|
|
+ Assert.hasText(param.getProjectOid(), "projectOid不能为空");
|
|
|
+ String toUserId = "";
|
|
|
+ if (authHelper.getCurrentUser() != null) {
|
|
|
+ toUserId = authHelper.getCurrentUser().getUserId();
|
|
|
+ }
|
|
|
+ param.setToUserId(toUserId);
|
|
|
+ return tipInfoService.page(param, pageable);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "我的列表-分页查询(已登录的)", description = "数据列表-分页查询")
|
|
|
+ @RequestMapping(value = {"mySendPage"}, method = {RequestMethod.POST})
|
|
|
+ public ResultContent<Page<TipInfoModel>> mySendPage(
|
|
|
+ @Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
|
|
|
+ @Parameter(required = false) TipInfoSearch param) {
|
|
|
+ Assert.hasText(param.getProjectOid(), "projectOid不能为空");
|
|
|
+ String fromUserId = "";
|
|
|
+ if (authHelper.getCurrentUser() != null) {
|
|
|
+ fromUserId = authHelper.getCurrentUser().getUserId();
|
|
|
+ }
|
|
|
+ param.setFromUserId(fromUserId);
|
|
|
+ return tipInfoService.page(param, pageable);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "我的发送列表-分页查询(未登录的)", description = "我的发送列表-分页查询")
|
|
|
+ @RequestMapping(value = {"mySendPageUnLogin"}, method = {RequestMethod.POST})
|
|
|
+ public ResultContent<Page<TipInfoModel>> mySendPageUnLogin(
|
|
|
+ @Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable,
|
|
|
+ @Parameter(required = false) TipInfoSearch param) {
|
|
|
+ Assert.hasText(param.getProjectOid(), "projectOid不能为空");
|
|
|
+ Assert.hasText(param.getOpenId(), "openId不能为空");
|
|
|
+ param.setIsDesen(Boolean.TRUE);
|
|
|
+ return tipInfoService.page(param, pageable);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "提醒消息详情", description = "提醒消息详情")
|
|
|
+ @RequestMapping(value = "getInfo", method = {RequestMethod.POST})
|
|
|
+ public ResultContent getInfo(@RequestBody IDParam param) {
|
|
|
+ return this.tipInfoService.getInfo(param.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "当前用户未读的信息统计", description = "当前用户未读的信息统计")
|
|
|
+ @RequestMapping(value = "myUnReadCount", method = {RequestMethod.POST})
|
|
|
+ public ResultContent myUnReadCount(@RequestBody ProjectOidParam param) {
|
|
|
+ return this.tipInfoService.staticCurrentUnRead(param.getProjectOid());
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "标记信息已读", description = "标记信息已读")
|
|
|
+ @RequestMapping(value = "markRead", method = {RequestMethod.POST})
|
|
|
+ public ResultContent markRead(@RequestBody IDParam param) {
|
|
|
+ return this.tipInfoService.markRead(param.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @Operation(summary = "标识当前用户所有的数据已读", description = "标识当前用户所有的数据已读")
|
|
|
+ @RequestMapping(value = "markCurrentAllRead", method = {RequestMethod.GET})
|
|
|
+ public ResultContent markCurrentAllRead() {
|
|
|
+ return this.tipInfoService.markCurrentAllRead();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|