|
|
|
@ -4,6 +4,9 @@ import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import org.dromara.common.core.constant.DeviceQrtzConstants; |
|
|
|
import org.dromara.common.redis.config.RedisConst; |
|
|
|
import org.dromara.common.redis.utils.RedisOpsUtils; |
|
|
|
import org.dromara.common.redis.utils.RedisUtils; |
|
|
|
import org.dromara.common.sdk.cloudapi.device.OsdDock; |
|
|
|
import org.dromara.common.sdk.cloudapi.media.*; |
|
|
|
import org.dromara.common.sdk.cloudapi.media.api.AbstractMediaService; |
|
|
|
@ -35,10 +38,9 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
@ -76,11 +78,37 @@ public class MediaServiceImpl extends AbstractMediaService implements IMediaServ |
|
|
|
@Autowired |
|
|
|
private IDeviceQrtzFileMapper deviceQrtzFileMapper; |
|
|
|
|
|
|
|
|
|
|
|
ExecutorService executorService = Executors.newVirtualThreadPerTaskExecutor(); |
|
|
|
|
|
|
|
@Override |
|
|
|
public Boolean fastUpload(String workspaceId, String fingerprint) { |
|
|
|
return fileService.checkExist(workspaceId, fingerprint); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void delMediaCount(String sn) { |
|
|
|
Set<Object> objects = RedisOpsUtils.hashKeys(RedisConst.MEDIA_FILE_PREFIX + sn); |
|
|
|
if(!CollectionUtils.isEmpty(objects)){ |
|
|
|
executorService.submit(() -> { |
|
|
|
try { |
|
|
|
objects.forEach(jobKey->{ |
|
|
|
MediaFileCountDTO mediaFileCountDTO = (MediaFileCountDTO) RedisOpsUtils.hashGet(RedisConst.MEDIA_FILE_PREFIX+sn, jobKey.toString()); |
|
|
|
Integer filesByJobIdCount = fileService.getFilesByJobIdCount(mediaFileCountDTO.getJobId()); |
|
|
|
if(filesByJobIdCount >= mediaFileCountDTO.getMediaCount()){ |
|
|
|
aiCompareQueueService.addWaylineJobToQueue(mediaFileCountDTO.getJobId()); |
|
|
|
} |
|
|
|
RedisOpsUtils.hashDel(RedisConst.MEDIA_FILE_PREFIX+sn, new String[]{jobKey.toString()});; |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Integer saveMediaFile(String workspaceId, MediaUploadCallbackRequest file,Integer proId) { |
|
|
|
return fileService.saveFile(workspaceId, file,null,proId); |
|
|
|
|