| | |
| | | if (eventDO == null) { |
| | | return R.fail("事件不存在"); |
| | | } |
| | | boolean canRepulish = eventDO.getEventDealStatus() == 7; //已失效状态 |
| | | boolean canRepulish = eventDO.getEventDealStatus() == 7|eventDO.getEventDealStatus() == 5; //已失效状态 |
| | | if (!canRepulish) { |
| | | return R.fail("当前事件不是已失效状态,不能重新发布"); |
| | | return R.fail("当前事件不是已失效状态/草稿状态,不能重新发布"); |
| | | } |
| | | eventDO.setInvalid(true); |
| | | int updated = this.getBaseMapper().updateById(eventDO); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R deleteEventBatch(EventDeleteDTO eventDeleteDTO) { |
| | | List<Long> eventIds = eventDeleteDTO.getId(); |
| | | List<String> eventIds = eventDeleteDTO.getId(); |
| | | if (eventIds != null && eventIds.size() > 0) { |
| | | R rt = null; |
| | | Long userId = eventDeleteDTO.getUserId(); |
| | | for (Long id : eventIds) { |
| | | EventDO eventDO = eventMapper.selectById(id); |
| | | for (String id : eventIds) { |
| | | try { |
| | | Long eventId = Long.parseLong(id); |
| | | EventDO eventDO = eventMapper.selectById(eventId); |
| | | if (eventDO == null) { |
| | | throw new ServiceException("id为" + id + "的事件不存在"); |
| | | } |
| | |
| | | throw new ServiceException("删除事件失败"); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | throw new ServiceException("事件ID错误,删除失败"); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } else { |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R batchRepublishEvent(CommonEventBatchRepublishDTO commonEventBatchRepublishDTO) { |
| | | List<Long> ids = commonEventBatchRepublishDTO.getId(); |
| | | List<String> ids = commonEventBatchRepublishDTO.getId(); |
| | | if (ids != null && ids.size() > 0) { |
| | | Long userId = commonEventBatchRepublishDTO.getUserId(); |
| | | String userName = commonEventBatchRepublishDTO.getUserName(); |
| | | for (Long id : ids) { |
| | | EventDO eventDO = this.getBaseMapper().selectById(id); |
| | | for (String id : ids) { |
| | | Long eventId = -1L; |
| | | try { |
| | | eventId = Long.parseLong(id); |
| | | }catch (Exception e){ |
| | | throw new ServiceException("事件ID错误,发布失败"); |
| | | } |
| | | EventDO eventDO = this.getBaseMapper().selectById(eventId); |
| | | if (eventDO == null) { |
| | | throw new ServiceException("id为" + id + "的事件不存在"); |
| | | } |
| | | boolean canRepublishByUser = eventDO.getEventStatus() != null && |
| | | eventDO.getEventStatus() == 4 || eventDO.getEventStatus() == 1; |
| | | boolean canRepublishByUser = eventDO.getEventDealStatus() != null && |
| | | (eventDO.getEventDealStatus() == 5 || eventDO.getEventDealStatus() == 6); |
| | | if (!canRepublishByUser) { |
| | | throw new ServiceException("当前不是撤销/草稿状态"); |
| | | } |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R batchMarkEventInvalid(EventBatchRevokeDTO eventBatchRevokeDTO) { |
| | | List<Long> ids = eventBatchRevokeDTO.getId(); |
| | | List<String> ids = eventBatchRevokeDTO.getId(); |
| | | if (ids != null && ids.size() > 0) { |
| | | Long userId = eventBatchRevokeDTO.getUserId(); |
| | | String userName = eventBatchRevokeDTO.getUserName(); |
| | | Long communityId = eventBatchRevokeDTO.getCommunityId(); |
| | | String communityName = eventBatchRevokeDTO.getCommunityName(); |
| | | for (Long id : ids) { |
| | | EventDO eventDO = this.getBaseMapper().selectById(id); |
| | | for (String id : ids) { |
| | | Long eventId = -1L; |
| | | try { |
| | | eventId = Long.parseLong(id); |
| | | }catch (Exception e){ |
| | | throw new ServiceException("事件ID错误,不能标记失效"); |
| | | } |
| | | EventDO eventDO = this.getBaseMapper().selectById(eventId); |
| | | if (eventDO == null) { |
| | | throw new ServiceException("id为" + id + "的事件不存在"); |
| | | } |