| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.constants.SecurityConstants; |
| | | import com.panzhihua.common.constants.UserConstants; |
| | | import com.panzhihua.common.model.dtos.PageDTO; |
| | | import com.panzhihua.common.model.dtos.community.NoticeReadDTO; |
| | | import com.panzhihua.common.model.dtos.user.PageUserAppletsBackstageDTO; |
| | | import com.panzhihua.common.model.dtos.user.SysUserFeedbackDTO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | |
| | | private SysUserAgreementDAO sysUserAgreementDAO; |
| | | @Resource |
| | | private SysUserFeedbackDAO sysUserFeedbackDAO; |
| | | @Resource |
| | | private SysUserNoticeDAO sysUserNoticeDAO; |
| | | |
| | | |
| | | /** |
| | |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 分页通知列表 |
| | | * |
| | | * @param pageDTO 分页参数 |
| | | * @return 分页结果 |
| | | */ |
| | | @Override |
| | | public R pageNotice(PageDTO pageDTO) { |
| | | Long userId=pageDTO.getUserId(); |
| | | Integer integer = sysUserNoticeDAO.selectCount(new QueryWrapper<SysUserNoticeDO>().lambda().eq(SysUserNoticeDO::getUserId, userId).eq(SysUserNoticeDO::getStatus, 0)); |
| | | Page page = new Page<>(); |
| | | Long pageNum = pageDTO.getPageNum(); |
| | | Long pageSize = pageDTO.getPageSize(); |
| | | page.setSize(pageSize); |
| | | page.setCurrent(pageNum); |
| | | IPage<SysUserNoticeVO> iPage = userDao.pageNotice(page, pageDTO); |
| | | Map<String,Object> map=new HashMap<>(2); |
| | | map.put("page",iPage); |
| | | map.put("unreadNum",null==integer?0:integer); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 通知已读 |
| | | * |
| | | * @param noticeReadDTO 通知已读 |
| | | * @return 修改状态 |
| | | */ |
| | | @Override |
| | | public R putNotice(NoticeReadDTO noticeReadDTO) { |
| | | Integer all = noticeReadDTO.getAll(); |
| | | Long userId = noticeReadDTO.getUserId(); |
| | | int num=0; |
| | | SysUserNoticeDO sysUserNoticeDO=new SysUserNoticeDO(); |
| | | if (null!=all&&1==all.intValue()) { |
| | | sysUserNoticeDO.setStatus(1); |
| | | num=sysUserNoticeDAO.update(sysUserNoticeDO,new UpdateWrapper<SysUserNoticeDO>().lambda().eq(SysUserNoticeDO::getUserId,userId).eq(SysUserNoticeDO::getStatus,0)); |
| | | }else{ |
| | | sysUserNoticeDO.setId(noticeReadDTO.getId()); |
| | | sysUserNoticeDO.setStatus(1); |
| | | num=sysUserNoticeDAO.updateById(sysUserNoticeDO); |
| | | } |
| | | if (num>0) { |
| | | return R.ok(); |
| | | } |
| | | return R.fail("通知不存在"); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String encode = new BCryptPasswordEncoder().encode("123456"); |
| | | System.out.println(encode); |