| | |
| | | package com.ard.vtdu.service.impl; |
| | | |
| | | import com.ard.common.utils.DateUtils; |
| | | import com.ard.vtdu.config.MediamtxConfig; |
| | | import com.ard.vtdu.domain.ArdVtdu; |
| | | import com.ard.vtdu.domain.Conf; |
| | | import com.ard.vtdu.mapper.ArdVtduMapper; |
| | | import com.ard.vtdu.service.IArdVtduService; |
| | | import com.ard.vtdu.service.IMediaService; |
| | | import com.ard.vtdu.service.IArdMediaService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Resource |
| | | private ArdVtduMapper ardVtduMapper; |
| | | @Resource |
| | | private IMediaService mediaService; |
| | | private IArdMediaService mediaService; |
| | | |
| | | |
| | | |
| | |
| | | mediaService.clearAll(); |
| | | } |
| | | |
| | | @Scheduled(cron = "0/5 * * * * ?") |
| | | @Scheduled(fixedDelay = 5000) |
| | | public void syncMediamtx() { |
| | | log.info("定时同步MediaMTX任务"); |
| | | log.debug("定时同步MediaMTX任务"); |
| | | List<String> nameList = mediaService.getNameList(); |
| | | List<ArdVtdu> ardVtduList = selectArdVtduList(new ArdVtdu()); |
| | | asyncMediaMTX(ardVtduList, nameList); |
| | |
| | | */ |
| | | @Override |
| | | public int insertArdVtdu(ArdVtdu ardVtdu) { |
| | | ardVtdu.setCreateTime(DateUtils.getNowDate()); |
| | | ardVtdu = mediaService.addPath(ardVtdu); |
| | | return ardVtduMapper.insertArdVtdu(ardVtdu); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public int updateArdVtdu(ArdVtdu ardVtdu) { |
| | | ardVtdu.setUpdateTime(DateUtils.getNowDate()); |
| | | ardVtdu = mediaService.editPath(ardVtdu); |
| | | ardVtdu.setUpdateTime(DateUtils.getNowDate()); |
| | | return ardVtduMapper.updateArdVtdu(ardVtdu); |
| | |
| | | diffListToAdd(vtdus, names).forEach(vtdu -> { |
| | | mediaService.addPath(vtdu); |
| | | }); |
| | | } |
| | | |
| | | //匹配rtsp地址 |
| | | private String matchRtsp(String value) { |
| | | Matcher matcher = Pattern.compile("rtsp://[^\\s\"]+").matcher(value); |
| | | if (matcher.find()) { |
| | | return matcher.group(); |
| | | } else { |
| | | return ""; |
| | | } |
| | | } |
| | | } |