From bfce748e37a753c729e15dd233600379f504d019 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期四, 28 四月 2022 13:59:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java
index c3bc6ce..33e6d89 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LedSFileService.java
+++ b/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;
         }
 

--
Gitblit v1.9.3