| | |
| | | import com.xinquan.common.core.utils.page.CollUtils; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.common.core.web.domain.BaseModel; |
| | | import com.xinquan.common.security.service.TokenService; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.meditation.api.feign.RemoteMeditationService; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.NoticeRecord; |
| | | import com.xinquan.meditation.api.domain.vo.NoticeDetailVO; |
| | | import com.xinquan.system.api.model.LoginUser; |
| | | import com.xinquan.user.service.AppUserService; |
| | | import com.xinquan.user.service.NoticeRecordService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | 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.RequestMapping; |
| | |
| | | @ApiImplicitParam(value = "分页参数,每页数量", name = "pageSize", required = true, dataType = "Integer") |
| | | }) |
| | | public R<PageDTO<NoticeRecord>> noticeList(Integer pageCurr, Integer pageSize) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | if (userId==0)return R.tokenError("登录失效"); |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | if(userId ==null || userId == 0)return R.tokenError("登录失效"); |
| | | Page<NoticeRecord> page = noticeRecordService.lambdaQuery() |
| | | .eq(NoticeRecord::getAppUserId, userId) |
| | | .orderByDesc(BaseModel::getCreateTime) |
| | |
| | | @PostMapping("/noticeDetail") |
| | | @ApiOperation(value = "系统消息列表-查看详情",tags = "系统消息") |
| | | public R<NoticeDetailVO> wallet(Long id) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | if (userId == 0)return R.tokenError("登录失效"); |
| | | |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | NoticeRecord noticeRecord = noticeRecordService.getById(id); |
| | | // 设置为已读 |
| | | noticeRecord.setReadStatus(2); |
| | |
| | | } |
| | | return R.ok(noticeDetailVO); |
| | | } |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @PostMapping("/queryNotice") |
| | | @ApiOperation(value = "是否有未读消息 true是 false否",tags = "系统消息") |
| | | public R<Boolean> queryNotice() { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | if (userId == 0)return R.tokenError("登录失效"); |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | int size = noticeRecordService.lambdaQuery() |
| | | .eq(NoticeRecord::getAppUserId, userId) |
| | | .eq(NoticeRecord::getReadStatus, 1).list().size(); |