| | |
| | | } |
| | | if (currentUserRoles.isEmpty()) { |
| | | checkResult = false; |
| | | } |
| | | boolean result = sysAllowedRoles.stream().anyMatch(role -> currentUserRoles.contains(role)); |
| | | if (!result) { |
| | | checkResult = false; |
| | | } else { |
| | | if (!sysAllowedRoles.contains("1")) { |
| | | boolean result = sysAllowedRoles.stream().anyMatch(role -> currentUserRoles.contains(role)); |
| | | if (!result) { |
| | | checkResult = false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } else { |
| | | comActDiscussDO.setStatus(ComActDiscussDO.status.yfb); |
| | | } |
| | | comActDiscussDO.setUpdateAt(new Date()); |
| | | comActDiscussDO.setUpdateAt(nowDate); |
| | | int insert = comActDiscussDAO.updateById(comActDiscussDO); |
| | | if (insert > 0) { |
| | | //如果是投票,需要把投票的选项存储 |
| | |
| | | IPage<ComActDiscussVO> iPage = comActDiscussDAO.pageDiscussApplets(page, pageComActDiscussDTO); |
| | | List<ComActDiscussVO> records = iPage.getRecords(); |
| | | if (!ObjectUtils.isEmpty(records)) { |
| | | List<String> viewNumKeys = new ArrayList<>(); |
| | | records.forEach(comActDiscussVO -> { |
| | | Integer type = comActDiscussVO.getType(); |
| | | Long id = comActDiscussVO.getId(); |
| | | String viewNumKey = String.join("_", DISCUSS_VIEW_NUM_PREFIX, id.toString()); |
| | | viewNumKeys.add(viewNumKey); |
| | | if (stringRedisTemplate.hasKey(viewNumKey)) { |
| | | ValueOperations<String, String> opsForValue = stringRedisTemplate.opsForValue(); |
| | | comActDiscussVO.setViewsNum(Integer.parseInt(opsForValue.get(viewNumKey))); |
| | | } |
| | | if (type.equals(2)) { |
| | | List<ComActDiscussOptionDO> comActDiscussOptionDOS = comActDiscussOptionDAO.selectList( |
| | | new QueryWrapper<ComActDiscussOptionDO>().lambda().eq(ComActDiscussOptionDO::getDiscussId, id)); |
| | |
| | | comActDiscussVO.setHaveVote(haveVote > 0 ? 1 : 0); |
| | | } |
| | | }); |
| | | ValueOperations opsForValue = stringRedisTemplate.opsForValue(); |
| | | List<String> viewNumList = opsForValue.multiGet(viewNumKeys); |
| | | for (ComActDiscussVO discussVO : records) { |
| | | try { |
| | | discussVO.setViewsNum(Integer.parseInt(viewNumList.get(0))); |
| | | viewNumList.remove(0); |
| | | } catch (IndexOutOfBoundsException e) { |
| | | //数据存在异常了,跳过,继续执行正确的 |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | return R.ok(iPage); |
| | | } |
| | |
| | | */ |
| | | private void checkDiscussStatusIsCorrect(ComActDiscussVO comActDiscussVO) { |
| | | //判断discuss状态是否正确 |
| | | boolean isIncorrectStatus = comActDiscussVO.getEndTime().before(new Date()) && |
| | | (comActDiscussVO.getStatus().intValue() == 1 || comActDiscussVO.getStatus().intValue() == 2); |
| | | if (isIncorrectStatus) { |
| | | comActDiscussVO.setStatus(3); |
| | | comActDiscussDAO.updateStatusById(comActDiscussVO.getId(), 3); |
| | | if(comActDiscussVO.getEndTime() != null){ |
| | | boolean isIncorrectStatus = comActDiscussVO.getEndTime().before(new Date()) && |
| | | (comActDiscussVO.getStatus().intValue() == 1 || comActDiscussVO.getStatus().intValue() == 2); |
| | | if (isIncorrectStatus) { |
| | | comActDiscussVO.setStatus(3); |
| | | comActDiscussDAO.updateStatusById(comActDiscussVO.getId(), 3); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | comActDiscussVO.setHaveVote(comActDiscussVO1.getHaveVote()); |
| | | } |
| | | String viewNumKey = String.join("_", DISCUSS_VIEW_NUM_PREFIX, id.toString()); |
| | | ValueOperations opsForValue = stringRedisTemplate.opsForValue(); |
| | | int viewNum = Integer.parseInt((String) opsForValue.get(viewNumKey)); |
| | | comActDiscussVO.setViewsNum(viewNum); |
| | | if (stringRedisTemplate.hasKey(viewNumKey)) { |
| | | ValueOperations opsForValue = stringRedisTemplate.opsForValue(); |
| | | int viewNum = Integer.parseInt((String) opsForValue.get(viewNumKey)); |
| | | comActDiscussVO.setViewsNum(viewNum); |
| | | } |
| | | return R.ok(comActDiscussVO); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public R discussJurisdictionGet(Long communityId, Long userId) { |
| | | List<SysConfDO> confDOList = sysConfDao.selectList(new LambdaQueryWrapper<SysConfDO>() |
| | | .eq(SysConfDO::getCommunityId, communityId).orderByDesc(SysConfDO::getCreateAt)); |
| | | .eq(SysConfDO::getCommunityId, communityId) |
| | | .eq(SysConfDO::getCode,Constants.DISCUSS_IDENTITY_KEY + communityId) |
| | | .orderByDesc(SysConfDO::getCreateAt)); |
| | | if (confDOList == null || confDOList.size() == 0) { |
| | | SysConfDO sysConfDO = new SysConfDO(); |
| | | sysConfDO.setCode(Constants.DISCUSS_IDENTITY_KEY + communityId); |