| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.EsModel; |
| | | import com.ruoyi.common.utils.MapUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.domain.LiveStreaming; |
| | | import com.ruoyi.domain.Meeting; |
| | | import com.ruoyi.mapper.LiveStreamingBackMapper; |
| | | import com.ruoyi.service.EsService; |
| | | import com.ruoyi.service.LiveStreamingBackService; |
| | | import org.elasticsearch.action.delete.DeleteRequest; |
| | | import org.elasticsearch.client.RequestOptions; |
| | | import org.elasticsearch.client.RestHighLevelClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | |
| | | @Service |
| | | public class LiveStreamingBackServiceImpl extends ServiceImpl<LiveStreamingBackMapper, LiveStreaming> implements LiveStreamingBackService { |
| | | |
| | | @Resource |
| | | private EsService esSer; |
| | | |
| | | @Resource |
| | | private RestHighLevelClient restHighLevelClient; |
| | | |
| | | private LambdaQueryWrapper<LiveStreaming> buildCondition(LiveStreaming liveStreaming) { |
| | | LambdaQueryWrapper<LiveStreaming> lqw = new LambdaQueryWrapper<>(); |
| | | // lqw.in(LiveStreaming::getFamilyId,familyIdList); |
| | | lqw.orderByDesc(LiveStreaming::getId); |
| | | lqw.like(StringUtils.isNotEmpty(liveStreaming.getTitle()), LiveStreaming::getTitle, liveStreaming.getTitle()) |
| | | .like(StringUtils.isNotEmpty(liveStreaming.getApplyPerson()),LiveStreaming::getApplyPerson,liveStreaming.getApplyPerson()) |
| | | .eq(LiveStreaming::getStatus,1) |
| | | .like(StringUtils.isNotEmpty(liveStreaming.getContactPerson()),LiveStreaming::getContactPerson,liveStreaming.getContactPerson()); |
| | | lqw.between(liveStreaming.getHappenStartTime() != null && liveStreaming.getHappenEndTime() != null,LiveStreaming::getCreateTime,liveStreaming.getHappenStartTime(),liveStreaming.getHappenEndTime()); |
| | | |
| | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult deleteData(Long[] ids) { |
| | | |
| | | // List<Meeting> dataList = meetingService.listByIds(Arrays.asList(ids)); |
| | | // |
| | | // ZInfoUser myself = zInfoUserService.getMyself(); |
| | | // Long familyId = myself.getFamilyId(); |
| | | // |
| | | // List<ZAuthority> authority = zAuthorityService.getAuthority(); |
| | | // List<Long> familyIdList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EVENT_LIST_REMOVE)).map(ZAuthority::getFid).collect(Collectors.toList()); |
| | | // familyIdList.add(familyId); |
| | | // |
| | | // for (Meeting data : dataList) { |
| | | // if (!familyIdList.contains(data.getFamilyId())){ |
| | | // throw new RuntimeException("你没有权限操作此家庭的数据"); |
| | | // } |
| | | // } |
| | | |
| | | List<LiveStreaming> liveStreamings = listByIds(Arrays.asList(ids)); |
| | | |
| | | if (removeByIds(Arrays.asList(ids))) { |
| | | |
| | | //删除es中的数据 |
| | | liveStreamings.stream().forEach(meeting -> { |
| | | EsModel esModel = esSer.findByCtId((meeting.getId().intValue()), "直播回放"); |
| | | if (esModel != null){ |
| | | DeleteRequest deleteRequest = new DeleteRequest("allsearchdata", esModel.getId()); |
| | | try { |
| | | restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return AjaxResult.success(); |
| | | }else { |
| | | return AjaxResult.error(); |
| | | } |
| | | |
| | | } |
| | | } |