2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-04-19 42ccfe035ad34b2166cf457d37294ebe614ba241
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java
@@ -26,24 +26,30 @@
    private final LedSFileMapper ledSFileMapper;
    private final AliOssFileServiceImpl aliOssFileService;
    private final FileOperationRecordService fileOperationRecordService;
    private final ClientService clientService;
    public boolean addProgramFile(MultipartFile file) {
        FileUploadDto fileUploadDto = aliOssFileService.uploadFile(file);
        if("mp4".equals(fileUploadDto.getFileType())){
            fileUploadDto.setScreenShot(fileUploadDto.getFileUrl()+"?x-oss-process=video/snapshot,t_10000,m_fast");
        if ("mp4".equals(fileUploadDto.getFileType())) {
            fileUploadDto.setScreenShot(fileUploadDto.getFileUrl() + "?x-oss-process=video/snapshot,t_10000,m_fast");
        }
        FileOperationRecord fileOperationRecord=new FileOperationRecord();
        FileOperationRecord fileOperationRecord = new FileOperationRecord();
        if ("mp4".equals(fileUploadDto.getFileType())) {
            fileOperationRecord.setScreenShot(fileUploadDto.getFileUrl() + "?x-oss-process=video/snapshot,t_10000,m_fast");
        }
        BeanUtils.copyProperties(fileUploadDto, fileOperationRecord);
        fileOperationRecordService.save(fileOperationRecord);
        LedSFile sFile = new LedSFile();
        BeanUtils.copyProperties(fileUploadDto, sFile);
        sFile.setCilentId(SecurityUtils.getClientId());
        if (SecurityUtils.getClientId() != null) {
            sFile.setUserId(SecurityUtils.getUserId());
            sFile.setUserName(SecurityUtils.getUsername());
            if (clientService.findClientId()) {
                sFile.setCilentId(clientService.getClientId());
            }
        }
//        save(sFile);
        return save(sFile);
//        return fileUploadDto;
    }
    public boolean deleteFile(Long id) {
@@ -54,11 +60,13 @@
        return removeById(id);
    }
    public LambdaQueryWrapper<LedSFile> listFile(){
    public LambdaQueryWrapper<LedSFile> listFile() {
        LambdaQueryWrapper<LedSFile> ledProgramFileLambdaQueryWrapper = Wrappers.lambdaQuery(LedSFile.class);
        if(SecurityUtils.getClientId()!=null){
            return ledProgramFileLambdaQueryWrapper.eq(LedSFile::getCilentId,SecurityUtils.getUserId());
        }else {
        if (SecurityUtils.getClientId() != null) {
            return ledProgramFileLambdaQueryWrapper.eq(LedSFile::getCilentId, SecurityUtils.getUserId()).or(w -> {
                w.eq(LedSFile::getUserId, SecurityUtils.getUserId());
            });
        } else {
            return ledProgramFileLambdaQueryWrapper;
        }