Эх сурвалжийг харах

feat: file 2 image ;viewProgress

lihao16 6 сар өмнө
parent
commit
f85923f002
23 өөрчлөгдсөн 742 нэмэгдсэн , 75 устгасан
  1. 9 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/iit/IitFileInfoController.java
  2. 8 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  3. 15 3
      ruoyi-common/pom.xml
  4. 6 1
      ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
  5. 55 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/CommonAsyncManager.java
  6. 96 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/LibreOfficeConvertUtil.java
  7. 107 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/OfficeManagerBean.java
  8. 1 1
      ruoyi-system/pom.xml
  9. 68 0
      ruoyi-system/src/main/java/com/ruoyi/iit/domain/IitFileImage.java
  10. 10 0
      ruoyi-system/src/main/java/com/ruoyi/iit/domain/IitFilePush.java
  11. 61 0
      ruoyi-system/src/main/java/com/ruoyi/iit/mapper/IitFileImageMapper.java
  12. 7 0
      ruoyi-system/src/main/java/com/ruoyi/iit/service/IIitFileInfoService.java
  13. 77 10
      ruoyi-system/src/main/java/com/ruoyi/iit/service/impl/IitFileInfoServiceImpl.java
  14. 30 23
      ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java
  15. 31 26
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  16. 66 0
      ruoyi-system/src/main/resources/mapper/iit/IitFileImageMapper.xml
  17. 5 3
      ruoyi-system/src/main/resources/mapper/iit/IitFilePushMapper.xml
  18. 7 0
      ruoyi-ui/src/api/iit/file.js
  19. 8 0
      ruoyi-ui/src/api/system/user.js
  20. 4 1
      ruoyi-ui/src/components/FileUpload/index.vue
  21. 33 6
      ruoyi-ui/src/views/iit/file/index.vue
  22. 28 0
      ruoyi-ui/src/views/iit/message/index.vue
  23. 10 1
      ruoyi-ui/src/views/iit/push/index.vue

+ 9 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/iit/IitFileInfoController.java

@@ -70,6 +70,15 @@ public class IitFileInfoController extends BaseController {
         return success(iitFileInfoService.selectIitFileInfoById(id));
         return success(iitFileInfoService.selectIitFileInfoById(id));
     }
     }
 
 
+    /**
+     * 文件预览
+     */
+    @PreAuthorize("@ss.hasPermi('iit:file:query')")
+    @GetMapping(value = "/image/{id}")
+    public AjaxResult getFileImage(@PathVariable("id") Long id) {
+        return success(iitFileInfoService.getFileImage(id));
+    }
+
     /**
     /**
      * 新增文件管理
      * 新增文件管理
      */
      */

+ 8 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -65,6 +65,14 @@ public class SysUserController extends BaseController
         return getDataTable(list);
         return getDataTable(list);
     }
     }
 
 
+    @GetMapping("/all/list")
+    public TableDataInfo allList(SysUser user)
+    {
+        startPage();
+        List<SysUser> list = userService.selectAllUserList(user);
+        return getDataTable(list);
+    }
+
     @Log(title = "用户管理", businessType = BusinessType.EXPORT)
     @Log(title = "用户管理", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('system:user:export')")
     @PreAuthorize("@ss.hasPermi('system:user:export')")
     @PostMapping("/export")
     @PostMapping("/export")

+ 15 - 3
ruoyi-common/pom.xml

@@ -52,13 +52,13 @@
             <groupId>org.apache.commons</groupId>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
             <artifactId>commons-lang3</artifactId>
         </dependency>
         </dependency>
-  
+
         <!-- JSON工具类 -->
         <!-- JSON工具类 -->
         <dependency>
         <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
             <artifactId>jackson-databind</artifactId>
         </dependency>
         </dependency>
-        
+
         <!-- 阿里JSON解析器 -->
         <!-- 阿里JSON解析器 -->
         <dependency>
         <dependency>
             <groupId>com.alibaba.fastjson2</groupId>
             <groupId>com.alibaba.fastjson2</groupId>
@@ -119,6 +119,18 @@
             <artifactId>javax.servlet-api</artifactId>
             <artifactId>javax.servlet-api</artifactId>
         </dependency>
         </dependency>
 
 
+        <dependency>
+            <groupId>org.apache.pdfbox</groupId>
+            <artifactId>pdfbox</artifactId>
+            <version>2.0.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.jodconverter</groupId>
+            <artifactId>jodconverter-core</artifactId>
+            <version>4.0.0-RELEASE</version>
+        </dependency>
+
     </dependencies>
     </dependencies>
 
 
-</project>
+</project>

+ 6 - 1
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java

@@ -5,7 +5,7 @@ import io.jsonwebtoken.Claims;
 
 
 /**
 /**
  * 通用常量信息
  * 通用常量信息
- * 
+ *
  * @author ruoyi
  * @author ruoyi
  */
  */
 public class Constants
 public class Constants
@@ -170,4 +170,9 @@ public class Constants
      */
      */
     public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
     public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
             "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" };
             "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" };
+
+    /**
+     * .pdf
+     */
+    public static final String PDF = ".pdf";
 }
 }

+ 55 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/CommonAsyncManager.java

@@ -0,0 +1,55 @@
+package com.ruoyi.common.utils;
+
+import com.ruoyi.common.utils.spring.SpringUtils;
+
+import java.util.TimerTask;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 异步任务管理器
+ *
+ * @author ruoyi
+ */
+public class CommonAsyncManager
+{
+    /**
+     * 操作延迟10毫秒
+     */
+    private final int OPERATE_DELAY_TIME = 10;
+
+    /**
+     * 异步操作任务调度线程池
+     */
+    private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService");
+
+    /**
+     * 单例模式
+     */
+    private CommonAsyncManager(){}
+
+    private static CommonAsyncManager me = new CommonAsyncManager();
+
+    public static CommonAsyncManager me()
+    {
+        return me;
+    }
+
+    /**
+     * 执行任务
+     *
+     * @param task 任务
+     */
+    public void execute(TimerTask task)
+    {
+        executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS);
+    }
+
+    /**
+     * 停止任务线程池
+     */
+    public void shutdown()
+    {
+        Threads.shutdownAndAwaitTermination(executor);
+    }
+}

+ 96 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/LibreOfficeConvertUtil.java

@@ -0,0 +1,96 @@
+package com.ruoyi.common.utils;
+
+import com.ruoyi.common.constant.Constants;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.rendering.ImageType;
+import org.apache.pdfbox.rendering.PDFRenderer;
+import org.jodconverter.OfficeDocumentConverter;
+import org.jodconverter.office.OfficeManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.File;
+
+
+/**
+ * 转换PPT为PDF工具类
+ * @author lihao16
+ */
+public class LibreOfficeConvertUtil {
+
+    private static final Logger log = LoggerFactory.getLogger(LibreOfficeConvertUtil.class);
+
+    // 经过测试,dpi 为 96,100,105,120,150,200 中,105 显示效果较为清晰,体积稳定,dpi 越高图片体积越大,一般电脑显示分辨率为 96
+    public static final float DEFAULT_DPI = 105;
+    public static final String DEFAULT_IMAGE_FORMAT = ".png";
+
+    /**
+     *
+     *@name    文档转换为pdf工具类
+     *@description 相关说明 支持:xls,xlsx,ppt,pptx,txt,其中doc,docx转换与原文件有较大差异,libreOffice 默认安装路径
+     *Linux:/opt/libreoffice6.0
+     *Windows:C:/Program Files (x86)/LibreOffice
+     *Mac:/Application/openOfficeSoft
+     *@param sourceFile 需要转换的原文件
+     *@param tarPdfFile 转换后的目标pdf文件
+     *@return
+     *@throws Exception
+     *@history 修订历史(历次修订内容、修订人、修订时间等)
+     */
+    public static String convertToPdf(String sourceFile, String tarPdfFile,OfficeManager officeManager) throws Exception {
+        log.info("convertToPdf begin sourceFile:{}",sourceFile);
+        File inputFile = new File(sourceFile);
+        // 判断当前文件是否为pdf
+        if (inputFile.isFile() && inputFile.getName().toLowerCase().endsWith(Constants.PDF)) {
+            return sourceFile;
+        }
+        OfficeDocumentConverter converter = new OfficeDocumentConverter(officeManager);
+        File outputFile = new File(tarPdfFile);
+        converter.convert(inputFile, outputFile);
+        // String pdfPath = outputFile.getPath();
+        log.info("convertToPdf end pdfPath:{}",tarPdfFile);
+        return tarPdfFile;
+    }
+
+    /**
+     * pdf 转图片,每页生成一张图片
+     * @param pdfPath PDF路径
+     * @return pdf 页数
+     */
+    public static int convertToImage(String pdfPath,long timeMillis) throws Exception {
+        BufferedImage imageResult;
+        File pdfFile = new File(pdfPath);
+        PDDocument pdDocument = PDDocument.load(pdfFile);
+        // String fileName = pdfFile.getName();
+        // String filePath = pdfFile.getPath();
+        PDFRenderer pdfRenderer = new PDFRenderer(pdDocument);
+
+        int pages = pdDocument.getNumberOfPages();
+
+        int width;
+
+        int shiftHeight = 0;
+        int[] singleImgRGB;
+        String pdfFileName = pdfPath.substring(pdfPath.lastIndexOf("/") + 1);
+        for (int i = 0; i < pages; i++) {
+            BufferedImage image = pdfRenderer.renderImageWithDPI(i, DEFAULT_DPI, ImageType.RGB);
+            width = image.getWidth();
+            int imageHeight = image.getHeight();
+            imageResult = new BufferedImage(width, imageHeight, BufferedImage.TYPE_INT_RGB);
+            singleImgRGB = image.getRGB(0, 0, width, imageHeight, null, 0, width);
+            // 写入流中
+            imageResult.setRGB(0, shiftHeight, width, imageHeight, singleImgRGB, 0, width);
+            // 写图片
+            String imgPath = pdfPath.replace(pdfFileName, String.valueOf(timeMillis));
+            ImageIO.write(imageResult, DEFAULT_IMAGE_FORMAT.replace(".", ""), new File(imgPath + "." + i + DEFAULT_IMAGE_FORMAT));
+        }
+
+        pdDocument.close();
+        return pages;
+    }
+
+
+
+}

+ 107 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/OfficeManagerBean.java

@@ -0,0 +1,107 @@
+package com.ruoyi.common.utils.bean;
+
+import org.jodconverter.office.DefaultOfficeManagerBuilder;
+import org.jodconverter.office.OfficeException;
+import org.jodconverter.office.OfficeManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PreDestroy;
+import java.io.File;
+import java.util.regex.Pattern;
+
+/**
+ * 项目启动 启动LibreOffice 服务
+ *
+ * @author lihao16
+ */
+@Component
+public class OfficeManagerBean {
+
+    private static String officeHomeDir = null;
+
+    private static OfficeManager officeManager;
+
+    private static final Logger log = LoggerFactory.getLogger(OfficeManagerBean.class);
+
+    @Bean
+    public OfficeManager officeManager() {
+        String libreOfficePath = getOfficeHome();
+
+        DefaultOfficeManagerBuilder builder = new DefaultOfficeManagerBuilder();
+        builder.setOfficeHome(new File(libreOfficePath));
+        // 端口号
+        builder.setPortNumber(9900);
+        // 设置任务执行超时为5分钟
+        builder.setTaskExecutionTimeout(1000 * 60 * 5L);
+        // 设置任务队列超时为24小时
+        builder.setTaskQueueTimeout(1000 * 60 * 60 * 24L);
+
+        officeManager = builder.build();
+        startService(officeManager);
+        return officeManager;
+    }
+
+    @PreDestroy
+    public void destroyOfficeManager() throws OfficeException {
+        this.stopService(officeManager);
+    }
+
+    private void stopService(OfficeManager officeManager) throws OfficeException {
+        if (null != officeManager) {
+            officeManager.stop();
+        }
+        log.info("关闭office转换成功!");
+    }
+
+    private static void startService(OfficeManager officeManager) {
+
+        try {
+            if (!officeManager.isRunning()) {
+                System.out.println(officeManager.isRunning());
+                log.info("LibreOffice is not running,starting now...");
+                // 准备启动服务
+                officeManager.start(); // 启动服务
+            }
+            log.info("office转换服务启动成功");
+        } catch (Exception ce) {
+            log.error("office转换服务启动失败!详细信息:{}", ce);
+        }
+    }
+
+    private static String getOfficeHome() {
+
+        if (null != officeHomeDir) {
+            return officeHomeDir;
+        } else {
+            String osName = System.getProperty("os.name");
+            if (Pattern.matches("Windows.*", osName)) {
+                officeHomeDir = "C:/Program Files/LibreOffice";
+                return officeHomeDir;
+            } else if (Pattern.matches("Linux.*", osName)) {
+                officeHomeDir = "/opt/libreoffice7.5";
+                return officeHomeDir;
+            } else if (Pattern.matches("Mac.*", osName)) {
+                officeHomeDir = "/Application/openOfficeSoft";
+                return officeHomeDir;
+            }
+            return null;
+        }
+    }
+
+    /**
+     *
+     *@name    设置libreOffice安装目录
+     *@description 相关说明:如果libreOffice安装目录为默认目录,则不需要设置,否则需要设置
+     *@time    创建时间:2018年9月17日下午1:52:36
+     *@param officeHome
+     *@author   作者
+     *@history 修订历史(历次修订内容、修订人、修订时间等)
+     */
+    public static void setOfficeHome(String officeHome) {
+        officeHomeDir = officeHome;
+    }
+
+}

+ 1 - 1
ruoyi-system/pom.xml

@@ -25,4 +25,4 @@
 
 
     </dependencies>
     </dependencies>
 
 
-</project>
+</project>

+ 68 - 0
ruoyi-system/src/main/java/com/ruoyi/iit/domain/IitFileImage.java

@@ -0,0 +1,68 @@
+package com.ruoyi.iit.domain;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 文件转图片对象 iit_file_image
+ *
+ * @author Hao Li
+ * @date 2025-04-12
+ */
+public class IitFileImage extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @Excel(name = "主键ID")
+    private Long id;
+
+    /**
+     * 文件ID
+     */
+    @Excel(name = "文件ID")
+    private Long fileId;
+
+    /**
+     * 图片路径
+     */
+    @Excel(name = "图片路径")
+    private String imageUrl;
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setFileId(Long fileId) {
+        this.fileId = fileId;
+    }
+
+    public Long getFileId() {
+        return fileId;
+    }
+
+    public void setImageUrl(String imageUrl) {
+        this.imageUrl = imageUrl;
+    }
+
+    public String getImageUrl() {
+        return imageUrl;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("fileId", getFileId())
+                .append("imageUrl", getImageUrl())
+                .append("createTime", getCreateTime())
+                .toString();
+    }
+}

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/iit/domain/IitFilePush.java

@@ -35,6 +35,8 @@ public class IitFilePush extends BaseEntity
     @Excel(name = "推送人数")
     @Excel(name = "推送人数")
     private Integer userNumber;
     private Integer userNumber;
 
 
+    private Integer viewNumber;
+
     /** 推送人ID */
     /** 推送人ID */
     @Excel(name = "推送人ID")
     @Excel(name = "推送人ID")
     private Long userId;
     private Long userId;
@@ -50,6 +52,14 @@ public class IitFilePush extends BaseEntity
     @Excel(name = "部门ID")
     @Excel(name = "部门ID")
     private Long deptId;
     private Long deptId;
 
 
+    public Integer getViewNumber() {
+        return viewNumber;
+    }
+
+    public void setViewNumber(Integer viewNumber) {
+        this.viewNumber = viewNumber;
+    }
+
     public String getFileName() {
     public String getFileName() {
         return fileName;
         return fileName;
     }
     }

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/iit/mapper/IitFileImageMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.iit.mapper;
+
+import com.ruoyi.iit.domain.IitFileImage;
+
+import java.util.List;
+
+/**
+ * 文件转图片Mapper接口
+ *
+ * @author Hao Li
+ * @date 2025-04-12
+ */
+public interface IitFileImageMapper {
+    /**
+     * 查询文件转图片
+     *
+     * @param id 文件转图片主键
+     * @return 文件转图片
+     */
+    public IitFileImage selectIitFileImageById(Long id);
+
+    /**
+     * 查询文件转图片列表
+     *
+     * @param iitFileImage 文件转图片
+     * @return 文件转图片集合
+     */
+    public List<IitFileImage> selectIitFileImageList(IitFileImage iitFileImage);
+
+    /**
+     * 新增文件转图片
+     *
+     * @param iitFileImage 文件转图片
+     * @return 结果
+     */
+    public int insertIitFileImage(IitFileImage iitFileImage);
+
+    /**
+     * 修改文件转图片
+     *
+     * @param iitFileImage 文件转图片
+     * @return 结果
+     */
+    public int updateIitFileImage(IitFileImage iitFileImage);
+
+    /**
+     * 删除文件转图片
+     *
+     * @param id 文件转图片主键
+     * @return 结果
+     */
+    public int deleteIitFileImageById(Long id);
+
+    /**
+     * 批量删除文件转图片
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteIitFileImageByIds(Long[] ids);
+}

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/iit/service/IIitFileInfoService.java

@@ -65,4 +65,11 @@ public interface IIitFileInfoService
      * @return
      * @return
      */
      */
     public List<IitFileInfo> selectMyselfList(IitFileInfo iitFileInfo);
     public List<IitFileInfo> selectMyselfList(IitFileInfo iitFileInfo);
+
+    /**
+     * 文件预览 - 图片列表
+     * @param id
+     * @return
+     */
+    public List<String> getFileImage(Long id);
 }
 }

+ 77 - 10
ruoyi-system/src/main/java/com/ruoyi/iit/service/impl/IitFileInfoServiceImpl.java

@@ -1,20 +1,30 @@
 package com.ruoyi.iit.service.impl;
 package com.ruoyi.iit.service.impl;
 
 
-import java.io.File;
-import java.util.List;
-
 import com.ruoyi.common.annotation.DataScope;
 import com.ruoyi.common.annotation.DataScope;
+import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.utils.CommonAsyncManager;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.LibreOfficeConvertUtil;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.iit.domain.IitFileImage;
+import com.ruoyi.iit.domain.IitFileInfo;
 import com.ruoyi.iit.domain.IitMyselfFile;
 import com.ruoyi.iit.domain.IitMyselfFile;
+import com.ruoyi.iit.mapper.IitFileImageMapper;
+import com.ruoyi.iit.mapper.IitFileInfoMapper;
 import com.ruoyi.iit.mapper.IitMyselfFileMapper;
 import com.ruoyi.iit.mapper.IitMyselfFileMapper;
+import com.ruoyi.iit.service.IIitFileInfoService;
+import org.jodconverter.office.OfficeManager;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.security.core.token.TokenService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
-import com.ruoyi.iit.mapper.IitFileInfoMapper;
-import com.ruoyi.iit.domain.IitFileInfo;
-import com.ruoyi.iit.service.IIitFileInfoService;
+import org.springframework.util.CollectionUtils;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.TimerTask;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * 文件管理Service业务层处理
  * 文件管理Service业务层处理
@@ -23,17 +33,22 @@ import com.ruoyi.iit.service.IIitFileInfoService;
  * @date 2025-04-11
  * @date 2025-04-11
  */
  */
 @Service
 @Service
-public class IitFileInfoServiceImpl implements IIitFileInfoService
-{
+public class IitFileInfoServiceImpl implements IIitFileInfoService {
     @Autowired
     @Autowired
     private IitFileInfoMapper iitFileInfoMapper;
     private IitFileInfoMapper iitFileInfoMapper;
 
 
     @Autowired
     @Autowired
     private IitMyselfFileMapper iitMyselfFileMapper;
     private IitMyselfFileMapper iitMyselfFileMapper;
 
 
+    @Autowired
+    private IitFileImageMapper iitFileImageMapper;
+
     @Value("${ruoyi.profile}")
     @Value("${ruoyi.profile}")
     private String profile;
     private String profile;
 
 
+    @Autowired
+    private OfficeManager officeManager;
+
 
 
     /**
     /**
      * 查询文件管理
      * 查询文件管理
@@ -68,6 +83,17 @@ public class IitFileInfoServiceImpl implements IIitFileInfoService
         return iitFileInfoMapper.selectMyselfList(iitFileInfo);
         return iitFileInfoMapper.selectMyselfList(iitFileInfo);
     }
     }
 
 
+    @Override
+    public List<String> getFileImage(Long id) {
+        IitFileImage queryParam = new IitFileImage();
+        queryParam.setFileId(id);
+        List<IitFileImage> fileImageList = iitFileImageMapper.selectIitFileImageList(queryParam);
+        if (CollectionUtils.isEmpty(fileImageList)) {
+            return new ArrayList<>();
+        }
+        return fileImageList.stream().map(IitFileImage::getImageUrl).collect(Collectors.toList());
+    }
+
     /**
     /**
      * 新增文件管理
      * 新增文件管理
      *
      *
@@ -104,10 +130,51 @@ public class IitFileInfoServiceImpl implements IIitFileInfoService
         iitMyselfFile.setUserId(SecurityUtils.getUserId());
         iitMyselfFile.setUserId(SecurityUtils.getUserId());
         iitMyselfFile.setCreateTime(DateUtils.getNowDate());
         iitMyselfFile.setCreateTime(DateUtils.getNowDate());
         iitMyselfFileMapper.insertIitMyselfFile(iitMyselfFile);
         iitMyselfFileMapper.insertIitMyselfFile(iitMyselfFile);
-        
+
+        // 文件转换成图片 并保存数据库
+        CommonAsyncManager.me().execute(fileToImage(filePath, filePath + Constants.PDF, officeManager,
+                iitFileInfo, iitFileImageMapper));
+
         return insertResult;
         return insertResult;
     }
     }
 
 
+    /**
+     * 操作日志记录
+     *
+     * @param sourceFile 源文件
+     * @param tarPdfFile 目标文件
+     * @return 任务task
+     */
+    public static TimerTask fileToImage(final String sourceFile, final String tarPdfFile, OfficeManager officeManage,
+                                        IitFileInfo iitFileInfo, IitFileImageMapper iitFileImageMapper) {
+        return new TimerTask() {
+            @Override
+            public void run() {
+                try {
+                    String pdfFile = LibreOfficeConvertUtil.convertToPdf(sourceFile, tarPdfFile, officeManage);
+                    long timeMillis = System.currentTimeMillis();
+                    int pageSize = LibreOfficeConvertUtil.convertToImage(pdfFile, timeMillis);
+                    String pdfFileName = pdfFile.substring(pdfFile.lastIndexOf("/") + 1);
+                    Long fileId = iitFileInfo.getId();
+                    Date nowDate = DateUtils.getNowDate();
+                    for (int i = 0; i < pageSize; i++) {
+                        IitFileImage iitFileImage = new IitFileImage();
+                        // String filePath = pdfFile + "." + i + ".png";
+                        String imgPath = pdfFile.replace(pdfFileName, String.valueOf(timeMillis)) + "." + i + ".png";
+                        String fileUrl = imgPath.replace("/home/inspur/iit/uploadPath", "/profile");
+                        iitFileImage.setFileId(fileId);
+                        iitFileImage.setImageUrl(fileUrl);
+                        iitFileImage.setCreateTime(nowDate);
+                        iitFileImageMapper.insertIitFileImage(iitFileImage);
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    throw new RuntimeException(e);
+                }
+            }
+        };
+    }
+
     private Long getFileSize(String filePath) {
     private Long getFileSize(String filePath) {
         File file = new File(filePath);
         File file = new File(filePath);
         // 转换成KB
         // 转换成KB

+ 30 - 23
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysUserService.java

@@ -5,14 +5,14 @@ import com.ruoyi.common.core.domain.entity.SysUser;
 
 
 /**
 /**
  * 用户 业务层
  * 用户 业务层
- * 
+ *
  * @author ruoyi
  * @author ruoyi
  */
  */
 public interface ISysUserService
 public interface ISysUserService
 {
 {
     /**
     /**
      * 根据条件分页查询用户列表
      * 根据条件分页查询用户列表
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 用户信息集合信息
      * @return 用户信息集合信息
      */
      */
@@ -20,7 +20,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 根据条件分页查询已分配用户角色列表
      * 根据条件分页查询已分配用户角色列表
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 用户信息集合信息
      * @return 用户信息集合信息
      */
      */
@@ -28,7 +28,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 根据条件分页查询未分配用户角色列表
      * 根据条件分页查询未分配用户角色列表
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 用户信息集合信息
      * @return 用户信息集合信息
      */
      */
@@ -36,7 +36,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 通过用户名查询用户
      * 通过用户名查询用户
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @return 用户对象信息
      * @return 用户对象信息
      */
      */
@@ -44,7 +44,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 通过用户ID查询用户
      * 通过用户ID查询用户
-     * 
+     *
      * @param userId 用户ID
      * @param userId 用户ID
      * @return 用户对象信息
      * @return 用户对象信息
      */
      */
@@ -52,7 +52,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 根据用户ID查询用户所属角色组
      * 根据用户ID查询用户所属角色组
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @return 结果
      * @return 结果
      */
      */
@@ -60,7 +60,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 根据用户ID查询用户所属岗位组
      * 根据用户ID查询用户所属岗位组
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @return 结果
      * @return 结果
      */
      */
@@ -68,7 +68,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 校验用户名称是否唯一
      * 校验用户名称是否唯一
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -92,21 +92,21 @@ public interface ISysUserService
 
 
     /**
     /**
      * 校验用户是否允许操作
      * 校验用户是否允许操作
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      */
      */
     public void checkUserAllowed(SysUser user);
     public void checkUserAllowed(SysUser user);
 
 
     /**
     /**
      * 校验用户是否有数据权限
      * 校验用户是否有数据权限
-     * 
+     *
      * @param userId 用户id
      * @param userId 用户id
      */
      */
     public void checkUserDataScope(Long userId);
     public void checkUserDataScope(Long userId);
 
 
     /**
     /**
      * 新增用户信息
      * 新增用户信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -114,7 +114,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 注册用户信息
      * 注册用户信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -122,7 +122,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 修改用户信息
      * 修改用户信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -130,7 +130,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 用户授权角色
      * 用户授权角色
-     * 
+     *
      * @param userId 用户ID
      * @param userId 用户ID
      * @param roleIds 角色组
      * @param roleIds 角色组
      */
      */
@@ -138,7 +138,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 修改用户状态
      * 修改用户状态
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -146,7 +146,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 修改用户基本信息
      * 修改用户基本信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -154,7 +154,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 修改用户头像
      * 修改用户头像
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @param avatar 头像地址
      * @param avatar 头像地址
      * @return 结果
      * @return 结果
@@ -163,7 +163,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 重置用户密码
      * 重置用户密码
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -171,7 +171,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 重置用户密码
      * 重置用户密码
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @param password 密码
      * @param password 密码
      * @return 结果
      * @return 结果
@@ -180,7 +180,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 通过用户ID删除用户
      * 通过用户ID删除用户
-     * 
+     *
      * @param userId 用户ID
      * @param userId 用户ID
      * @return 结果
      * @return 结果
      */
      */
@@ -188,7 +188,7 @@ public interface ISysUserService
 
 
     /**
     /**
      * 批量删除用户信息
      * 批量删除用户信息
-     * 
+     *
      * @param userIds 需要删除的用户ID
      * @param userIds 需要删除的用户ID
      * @return 结果
      * @return 结果
      */
      */
@@ -196,11 +196,18 @@ public interface ISysUserService
 
 
     /**
     /**
      * 导入用户数据
      * 导入用户数据
-     * 
+     *
      * @param userList 用户数据列表
      * @param userList 用户数据列表
      * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
      * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
      * @param operName 操作用户
      * @param operName 操作用户
      * @return 结果
      * @return 结果
      */
      */
     public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
     public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
+
+    /**
+     * 查询所有用户
+     * @param user
+     * @return
+     */
+    public List<SysUser> selectAllUserList(SysUser user);
 }
 }

+ 31 - 26
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -33,7 +33,7 @@ import com.ruoyi.system.service.ISysUserService;
 
 
 /**
 /**
  * 用户 业务层处理
  * 用户 业务层处理
- * 
+ *
  * @author ruoyi
  * @author ruoyi
  */
  */
 @Service
 @Service
@@ -67,7 +67,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 根据条件分页查询用户列表
      * 根据条件分页查询用户列表
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 用户信息集合信息
      * @return 用户信息集合信息
      */
      */
@@ -78,9 +78,14 @@ public class SysUserServiceImpl implements ISysUserService
         return userMapper.selectUserList(user);
         return userMapper.selectUserList(user);
     }
     }
 
 
+    @Override
+    public List<SysUser> selectAllUserList(SysUser user) {
+        return userMapper.selectUserList(user);
+    }
+
     /**
     /**
      * 根据条件分页查询已分配用户角色列表
      * 根据条件分页查询已分配用户角色列表
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 用户信息集合信息
      * @return 用户信息集合信息
      */
      */
@@ -93,7 +98,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 根据条件分页查询未分配用户角色列表
      * 根据条件分页查询未分配用户角色列表
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 用户信息集合信息
      * @return 用户信息集合信息
      */
      */
@@ -106,7 +111,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 通过用户名查询用户
      * 通过用户名查询用户
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @return 用户对象信息
      * @return 用户对象信息
      */
      */
@@ -118,7 +123,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 通过用户ID查询用户
      * 通过用户ID查询用户
-     * 
+     *
      * @param userId 用户ID
      * @param userId 用户ID
      * @return 用户对象信息
      * @return 用户对象信息
      */
      */
@@ -130,7 +135,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 查询用户所属角色组
      * 查询用户所属角色组
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @return 结果
      * @return 结果
      */
      */
@@ -147,7 +152,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 查询用户所属岗位组
      * 查询用户所属岗位组
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @return 结果
      * @return 结果
      */
      */
@@ -164,7 +169,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 校验用户名称是否唯一
      * 校验用户名称是否唯一
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -218,7 +223,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 校验用户是否允许操作
      * 校验用户是否允许操作
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      */
      */
     @Override
     @Override
@@ -232,7 +237,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 校验用户是否有数据权限
      * 校验用户是否有数据权限
-     * 
+     *
      * @param userId 用户id
      * @param userId 用户id
      */
      */
     @Override
     @Override
@@ -252,7 +257,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 新增保存用户信息
      * 新增保存用户信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -271,7 +276,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 注册用户信息
      * 注册用户信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -283,7 +288,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 修改保存用户信息
      * 修改保存用户信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -305,7 +310,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 用户授权角色
      * 用户授权角色
-     * 
+     *
      * @param userId 用户ID
      * @param userId 用户ID
      * @param roleIds 角色组
      * @param roleIds 角色组
      */
      */
@@ -319,7 +324,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 修改用户状态
      * 修改用户状态
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -331,7 +336,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 修改用户基本信息
      * 修改用户基本信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -343,7 +348,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 修改用户头像
      * 修改用户头像
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @param avatar 头像地址
      * @param avatar 头像地址
      * @return 结果
      * @return 结果
@@ -356,7 +361,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 重置用户密码
      * 重置用户密码
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
@@ -368,7 +373,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 重置用户密码
      * 重置用户密码
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @param password 密码
      * @param password 密码
      * @return 结果
      * @return 结果
@@ -381,7 +386,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 新增用户角色信息
      * 新增用户角色信息
-     * 
+     *
      * @param user 用户对象
      * @param user 用户对象
      */
      */
     public void insertUserRole(SysUser user)
     public void insertUserRole(SysUser user)
@@ -391,7 +396,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 新增用户岗位信息
      * 新增用户岗位信息
-     * 
+     *
      * @param user 用户对象
      * @param user 用户对象
      */
      */
     public void insertUserPost(SysUser user)
     public void insertUserPost(SysUser user)
@@ -414,7 +419,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 新增用户角色信息
      * 新增用户角色信息
-     * 
+     *
      * @param userId 用户ID
      * @param userId 用户ID
      * @param roleIds 角色组
      * @param roleIds 角色组
      */
      */
@@ -437,7 +442,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 通过用户ID删除用户
      * 通过用户ID删除用户
-     * 
+     *
      * @param userId 用户ID
      * @param userId 用户ID
      * @return 结果
      * @return 结果
      */
      */
@@ -454,7 +459,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 批量删除用户信息
      * 批量删除用户信息
-     * 
+     *
      * @param userIds 需要删除的用户ID
      * @param userIds 需要删除的用户ID
      * @return 结果
      * @return 结果
      */
      */
@@ -476,7 +481,7 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 导入用户数据
      * 导入用户数据
-     * 
+     *
      * @param userList 用户数据列表
      * @param userList 用户数据列表
      * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
      * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
      * @param operName 操作用户
      * @param operName 操作用户

+ 66 - 0
ruoyi-system/src/main/resources/mapper/iit/IitFileImageMapper.xml

@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.iit.mapper.IitFileImageMapper">
+
+    <resultMap type="IitFileImage" id="IitFileImageResult">
+        <result property="id"    column="id"    />
+        <result property="fileId"    column="file_id"    />
+        <result property="imageUrl"    column="image_url"    />
+        <result property="createTime"    column="create_time"    />
+    </resultMap>
+
+    <sql id="selectIitFileImageVo">
+        select id, file_id, image_url, create_time from iit_file_image
+    </sql>
+
+    <select id="selectIitFileImageList" parameterType="IitFileImage" resultMap="IitFileImageResult">
+        <include refid="selectIitFileImageVo"/>
+        <where>
+            <if test="fileId != null "> and file_id = #{fileId}</if>
+        </where>
+    </select>
+
+    <select id="selectIitFileImageById" parameterType="Long" resultMap="IitFileImageResult">
+        <include refid="selectIitFileImageVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertIitFileImage" parameterType="IitFileImage">
+        insert into iit_file_image
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="fileId != null">file_id,</if>
+            <if test="imageUrl != null">image_url,</if>
+            <if test="createTime != null">create_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="fileId != null">#{fileId},</if>
+            <if test="imageUrl != null">#{imageUrl},</if>
+            <if test="createTime != null">#{createTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateIitFileImage" parameterType="IitFileImage">
+        update iit_file_image
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="fileId != null">file_id = #{fileId},</if>
+            <if test="imageUrl != null">image_url = #{imageUrl},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteIitFileImageById" parameterType="Long">
+        delete from iit_file_image where id = #{id}
+    </delete>
+
+    <delete id="deleteIitFileImageByIds" parameterType="String">
+        delete from iit_file_image where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 5 - 3
ruoyi-system/src/main/resources/mapper/iit/IitFilePushMapper.xml

@@ -8,6 +8,7 @@
         <result property="id"    column="id"    />
         <result property="id"    column="id"    />
         <result property="fileId"    column="file_id"    />
         <result property="fileId"    column="file_id"    />
         <result property="userNumber"    column="user_number"    />
         <result property="userNumber"    column="user_number"    />
+        <result property="viewNumber"    column="view_num"    />
         <result property="createTime"    column="create_time"    />
         <result property="createTime"    column="create_time"    />
         <result property="userId"    column="user_id"    />
         <result property="userId"    column="user_id"    />
         <result property="userName"    column="user_name"    />
         <result property="userName"    column="user_name"    />
@@ -32,11 +33,12 @@
             u.dept_id,
             u.dept_id,
             i.file_name,
             i.file_name,
             i.file_type,
             i.file_type,
-            i.remark
+            i.remark,
+            c.view_num
         FROM
         FROM
             iit_file_push u
             iit_file_push u
-        LEFT JOIN
-            iit_file_info i on u.file_id = i.id
+        LEFT JOIN iit_file_info i ON u.file_id = i.id
+        LEFT JOIN (SELECT IFNULL(sum(IF(is_view = 1,1,0)),0) as view_num,push_id from iit_push_user_rel GROUP BY push_id) c on u.id = c.push_id
         WHERE 1 = 1
         WHERE 1 = 1
         <if test="fileName != null  and fileName != ''"> and i.file_name like concat('%', #{fileName}, '%')</if>
         <if test="fileName != null  and fileName != ''"> and i.file_name like concat('%', #{fileName}, '%')</if>
         <if test="fileType != null "> and i.file_type = #{fileType}</if>
         <if test="fileType != null "> and i.file_type = #{fileType}</if>

+ 7 - 0
ruoyi-ui/src/api/iit/file.js

@@ -25,6 +25,13 @@ export function getInfo(id) {
   })
   })
 }
 }
 
 
+export function getFileImage(id) {
+  return request({
+    url: '/iit/file/image/' + id,
+    method: 'get'
+  })
+}
+
 // 新增文件管理
 // 新增文件管理
 export function addInfo(data) {
 export function addInfo(data) {
   return request({
   return request({

+ 8 - 0
ruoyi-ui/src/api/system/user.js

@@ -10,6 +10,14 @@ export function listUser(query) {
   })
   })
 }
 }
 
 
+export function listAllUser(query) {
+  return request({
+    url: '/system/user/all/list',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询用户详细
 // 查询用户详细
 export function getUser(userId) {
 export function getUser(userId) {
   return request({
   return request({

+ 4 - 1
ruoyi-ui/src/components/FileUpload/index.vue

@@ -119,6 +119,7 @@ export default {
   methods: {
   methods: {
     // 上传前校检格式和大小
     // 上传前校检格式和大小
     handleBeforeUpload(file) {
     handleBeforeUpload(file) {
+      this.$modal.loading("正在上传文件,请稍候...");
       // 校检文件类型
       // 校检文件类型
       if (this.fileType) {
       if (this.fileType) {
         const fileName = file.name.split('.');
         const fileName = file.name.split('.');
@@ -126,12 +127,14 @@ export default {
         const isTypeOk = this.fileType.indexOf(fileExt) >= 0;
         const isTypeOk = this.fileType.indexOf(fileExt) >= 0;
         if (!isTypeOk) {
         if (!isTypeOk) {
           this.$modal.msgError(`文件格式不正确,请上传${this.fileType.join("/")}格式文件!`);
           this.$modal.msgError(`文件格式不正确,请上传${this.fileType.join("/")}格式文件!`);
+          this.$modal.closeLoading();
           return false;
           return false;
         }
         }
       }
       }
       // 校检文件名是否包含特殊字符
       // 校检文件名是否包含特殊字符
       if (file.name.includes(',')) {
       if (file.name.includes(',')) {
         this.$modal.msgError('文件名不正确,不能包含英文逗号!');
         this.$modal.msgError('文件名不正确,不能包含英文逗号!');
+        this.$modal.closeLoading();
         return false;
         return false;
       }
       }
       // 校检文件大小
       // 校检文件大小
@@ -139,10 +142,10 @@ export default {
         const isLt = file.size / 1024 / 1024 < this.fileSize;
         const isLt = file.size / 1024 / 1024 < this.fileSize;
         if (!isLt) {
         if (!isLt) {
           this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`);
           this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`);
+          this.$modal.closeLoading();
           return false;
           return false;
         }
         }
       }
       }
-      this.$modal.loading("正在上传文件,请稍候...");
       this.number++;
       this.number++;
       return true;
       return true;
     },
     },

+ 33 - 6
ruoyi-ui/src/views/iit/file/index.vue

@@ -62,12 +62,15 @@
         <template slot-scope="scope">
         <template slot-scope="scope">
           <!--          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iit:info:edit']">修改
           <!--          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['iit:info:edit']">修改
                     </el-button>-->
                     </el-button>-->
-<!--          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
-                     v-hasPermi="['iit:file:remove']">删除
-          </el-button>-->
+          <!--          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+                               v-hasPermi="['iit:file:remove']">删除
+                    </el-button>-->
           <el-button size="mini" type="text" icon="el-icon-s-promotion" @click="handlePush(scope.row)"
           <el-button size="mini" type="text" icon="el-icon-s-promotion" @click="handlePush(scope.row)"
                      v-hasPermi="['iit:file:edit']">文件推送
                      v-hasPermi="['iit:file:edit']">文件推送
           </el-button>
           </el-button>
+          <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)"
+                     v-hasPermi="['iit:file:query']">文件预览
+          </el-button>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
     </el-table>
     </el-table>
@@ -138,12 +141,22 @@
         <el-button @click="cancel">取 消</el-button>
         <el-button @click="cancel">取 消</el-button>
       </div>
       </div>
     </el-dialog>
     </el-dialog>
+    <el-dialog :title="title" :visible.sync="viewOpen" width="900px" append-to-body>
+      <div style="display: flex; flex-direction: column; align-items: center;">
+        <div v-for="(image, index) in fileImageList" :key="index">
+          <el-image :src="image" style="max-width: 100%; margin-bottom: 10px;"/>
+        </div>
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancel">关 闭</el-button>
+      </div>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-import {addInfo, delInfo, getInfo, listInfo, updateInfo} from "@/api/iit/file";
-import {listUser} from "@/api/system/user";
+import {addInfo, delInfo, getFileImage, getInfo, listInfo, updateInfo} from "@/api/iit/file";
+import {listAllUser, listUser} from "@/api/system/user";
 import {addPush} from "@/api/iit/push";
 import {addPush} from "@/api/iit/push";
 
 
 export default {
 export default {
@@ -180,6 +193,8 @@ export default {
         fileName: null,
         fileName: null,
         fileType: null,
         fileType: null,
       },
       },
+      viewOpen: false,
+      fileImageList: [],
       userList: [],
       userList: [],
       selectedUser: [],
       selectedUser: [],
       // 过滤后的用户列表
       // 过滤后的用户列表
@@ -225,7 +240,7 @@ export default {
       });
       });
     },
     },
     loadUserList(query) {
     loadUserList(query) {
-      return listUser({
+      return listAllUser({
         pageNum: 1,
         pageNum: 1,
         pageSize: 100,  // 适当增大初始加载量
         pageSize: 100,  // 适当增大初始加载量
         nickName: query
         nickName: query
@@ -247,8 +262,10 @@ export default {
     cancel() {
     cancel() {
       this.open = false;
       this.open = false;
       this.pushOpen = false;
       this.pushOpen = false;
+      this.viewOpen = false;
       this.pushId = null;
       this.pushId = null;
       this.selectedUser = [];
       this.selectedUser = [];
+      this.fileImageList = [];
       this.reset();
       this.reset();
     },
     },
     // 表单重置
     // 表单重置
@@ -297,6 +314,16 @@ export default {
       this.pushOpen = true;
       this.pushOpen = true;
       this.title = "文件推送";
       this.title = "文件推送";
     },
     },
+    handleView(row) {
+      let fileId = row.id;
+      this.viewOpen = true;
+      this.title = "文件预览";
+      getFileImage(fileId).then(response => {
+        this.fileImageList = response.data.map(image => {
+          return process.env.VUE_APP_BASE_API + image;
+        });
+      });
+    },
     /** 修改按钮操作 */
     /** 修改按钮操作 */
     handleUpdate(row) {
     handleUpdate(row) {
       this.reset();
       this.reset();

+ 28 - 0
ruoyi-ui/src/views/iit/message/index.vue

@@ -56,6 +56,9 @@
           <el-button size="mini" type="text" icon="el-icon-view" @click="handleMessageInfo(scope.row)"
           <el-button size="mini" type="text" icon="el-icon-view" @click="handleMessageInfo(scope.row)"
                      v-hasPermi="['iit:message:edit']">消息详情
                      v-hasPermi="['iit:message:edit']">消息详情
           </el-button>
           </el-button>
+          <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)"
+                     v-hasPermi="['iit:file:query']">文件预览
+          </el-button>
         </template>
         </template>
       </el-table-column>
       </el-table-column>
     </el-table>
     </el-table>
@@ -128,11 +131,22 @@
         <el-button @click="cancel">关 闭</el-button>
         <el-button @click="cancel">关 闭</el-button>
       </div>
       </div>
     </el-dialog>
     </el-dialog>
+    <el-dialog :title="title" :visible.sync="viewOpen" width="900px" append-to-body>
+      <div style="display: flex; flex-direction: column; align-items: center;">
+        <div v-for="(image, index) in fileImageList" :key="index">
+          <el-image :src="image" style="max-width: 100%; margin-bottom: 10px;"/>
+        </div>
+      </div>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancel">关 闭</el-button>
+      </div>
+    </el-dialog>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import {addMessage, delMessage, getMessage, getMessageInfo, listMessagePage, updateMessage} from "@/api/iit/message";
 import {addMessage, delMessage, getMessage, getMessageInfo, listMessagePage, updateMessage} from "@/api/iit/message";
+import {getFileImage} from "@/api/iit/file";
 
 
 export default {
 export default {
   name: "Message",
   name: "Message",
@@ -153,10 +167,12 @@ export default {
       total: 0,
       total: 0,
       // 消息管理表格数据
       // 消息管理表格数据
       messageList: [],
       messageList: [],
+      fileImageList: [],
       // 弹出层标题
       // 弹出层标题
       title: "",
       title: "",
       // 是否显示弹出层
       // 是否显示弹出层
       open: false,
       open: false,
+      viewOpen: false,
       // 查询参数
       // 查询参数
       queryParams: {
       queryParams: {
         pageNum: 1,
         pageNum: 1,
@@ -176,6 +192,16 @@ export default {
     this.getList();
     this.getList();
   },
   },
   methods: {
   methods: {
+    handleView(row) {
+      let fileId = row.fileId;
+      this.viewOpen = true;
+      this.title = "文件预览";
+      getFileImage(fileId).then(response => {
+        this.fileImageList = response.data.map(image => {
+          return process.env.VUE_APP_BASE_API + image;
+        });
+      });
+    },
     formatViewTime(row, column) {
     formatViewTime(row, column) {
       if (row.viewTime === null) {
       if (row.viewTime === null) {
         return '- - - - - - -';
         return '- - - - - - -';
@@ -195,6 +221,8 @@ export default {
     // 取消按钮
     // 取消按钮
     cancel() {
     cancel() {
       this.open = false;
       this.open = false;
+      this.viewOpen = false;
+      this.fileImageList = [];
       this.reset();
       this.reset();
     },
     },
     // 表单重置
     // 表单重置

+ 10 - 1
ruoyi-ui/src/views/iit/push/index.vue

@@ -36,6 +36,11 @@
       <el-table-column label="文件备注" align="left" prop="fileRemark" :show-overflow-tooltip="true"/>
       <el-table-column label="文件备注" align="left" prop="fileRemark" :show-overflow-tooltip="true"/>
       <el-table-column label="推送用户" align="left" prop="userName" width="100" :show-overflow-tooltip="true"/>
       <el-table-column label="推送用户" align="left" prop="userName" width="100" :show-overflow-tooltip="true"/>
       <el-table-column label="推送人数" align="center" prop="userNumber" width="80"/>
       <el-table-column label="推送人数" align="center" prop="userNumber" width="80"/>
+      <el-table-column label="接收进度" align="left" prop="viewProgress>" width="200">
+        <template slot-scope="scope">
+          <el-progress :text-inside="true" :stroke-width="18" :percentage="scope.row.viewProgress"></el-progress>
+        </template>
+      </el-table-column>
       <el-table-column label="推送时间" align="left" prop="createTime" width="160" />
       <el-table-column label="推送时间" align="left" prop="createTime" width="160" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
         <template slot-scope="scope">
         <template slot-scope="scope">
@@ -130,7 +135,11 @@ export default {
     getList() {
     getList() {
       this.loading = true;
       this.loading = true;
       listPush(this.queryParams).then(response => {
       listPush(this.queryParams).then(response => {
-        this.pushList = response.rows;
+        // this.pushList = response.rows;
+        this.pushList = response.rows.map(item => {
+          item.viewProgress = (item.viewNumber * 100 / item.userNumber).toFixed(0)
+          return item;
+        });
         this.total = response.total;
         this.total = response.total;
         this.loading = false;
         this.loading = false;
       });
       });