Sfoglia il codice sorgente

操盘手业务,初版2

zhaoxian 3 anni fa
parent
commit
356f00641e
54 ha cambiato i file con 3041 aggiunte e 829 eliminazioni
  1. 31 7
      pom.xml
  2. 18 1
      ruixuan-common/pom.xml
  3. 28 0
      ruixuan-common/src/main/java/com/ruixuan/common/cos/CosFileDTO.java
  4. 106 0
      ruixuan-common/src/main/java/com/ruixuan/common/cos/CosUpload.java
  5. 308 0
      ruixuan-common/src/main/java/com/ruixuan/common/cos/CosUtils.java
  6. 119 0
      ruixuan-common/src/main/java/com/ruixuan/common/file/FileType.java
  7. 139 0
      ruixuan-common/src/main/java/com/ruixuan/common/file/FileTypeJudge.java
  8. 113 0
      ruixuan-common/src/main/java/com/ruixuan/common/file/FileUtil.java
  9. 92 0
      ruixuan-common/src/main/java/com/ruixuan/common/utils/Check.java
  10. 15 0
      ruixuan-common/src/main/java/com/ruixuan/common/utils/DateUtils.java
  11. 244 0
      ruixuan-common/src/main/java/com/ruixuan/common/utils/LoadFileUtil.java
  12. 121 0
      ruixuan-common/src/main/java/com/ruixuan/common/utils/encryption/AesEncryptUtil.java
  13. 12 0
      ruixuan-common/src/main/java/com/ruixuan/common/utils/encryption/EncryptedString.java
  14. 0 9
      ruixuan-live/pom.xml
  15. 0 98
      ruixuan-live/src/main/java/com/ruixuan/data/controller/KuaishouLiveDataAnalysisController.java
  16. 49 0
      ruixuan-live/src/main/java/com/ruixuan/data/controller/KuaishouLiveDataController.java
  17. 0 98
      ruixuan-live/src/main/java/com/ruixuan/data/controller/KuaishouLiveDataFunnelController.java
  18. 0 114
      ruixuan-live/src/main/java/com/ruixuan/data/controller/KuaishouLiveDataKanbanController.java
  19. 0 98
      ruixuan-live/src/main/java/com/ruixuan/data/controller/KuaishouLiveDataOverviewController.java
  20. 2 182
      ruixuan-live/src/main/java/com/ruixuan/data/entity/KuaishouLiveDataKanban.java
  21. 4 0
      ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataAnalysisMapper.java
  22. 4 0
      ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataFunnelMapper.java
  23. 3 0
      ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataKanbanMapper.java
  24. 3 0
      ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataOverviewMapper.java
  25. 4 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataAnalysisService.java
  26. 4 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataFunnelService.java
  27. 4 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataKanbanService.java
  28. 4 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataOverviewService.java
  29. 35 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataAnalysisServiceImpl.java
  30. 29 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataFunnelServiceImpl.java
  31. 44 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataKanbanServiceImpl.java
  32. 31 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataOverviewServiceImpl.java
  33. 389 0
      ruixuan-live/src/main/java/com/ruixuan/data/utils/ExportExcelUtils.java
  34. 136 0
      ruixuan-live/src/main/java/com/ruixuan/data/utils/LiveDataExcelUtils.java
  35. 77 12
      ruixuan-live/src/main/java/com/ruixuan/live/controller/KuaishouLiveBroadcastController.java
  36. 3 3
      ruixuan-live/src/main/java/com/ruixuan/live/controller/KuaishouLiveUserAccountController.java
  37. 28 26
      ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveBroadcast.java
  38. 108 0
      ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveBroadcastFiles.java
  39. 14 14
      ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveUserAccount.java
  40. 9 9
      ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveUserAccountPart.java
  41. 62 0
      ruixuan-live/src/main/java/com/ruixuan/live/mapper/KuaishouLiveBroadcastFilesMapper.java
  42. 2 0
      ruixuan-live/src/main/java/com/ruixuan/live/mapper/KuaishouLiveBroadcastMapper.java
  43. 11 3
      ruixuan-live/src/main/java/com/ruixuan/live/service/IKuaishouLiveBroadcastService.java
  44. 267 9
      ruixuan-live/src/main/java/com/ruixuan/live/service/impl/KuaishouLiveBroadcastServiceImpl.java
  45. 31 0
      ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataAnalysisMapper.xml
  46. 24 0
      ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataFunnelMapper.xml
  47. 49 0
      ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataKanbanMapper.xml
  48. 24 0
      ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataOverviewMapper.xml
  49. 97 0
      ruixuan-live/src/main/resources/mapper/live/KuaishouLiveBroadcastFilesMapper.xml
  50. 38 1
      ruixuan-live/src/main/resources/mapper/live/KuaishouLiveBroadcastMapper.xml
  51. 2 0
      ruixuan-system/src/main/java/com/ruixuan/system/mapper/SysUserMapper.java
  52. 2 0
      ruixuan-system/src/main/java/com/ruixuan/system/service/ISysUserService.java
  53. 91 145
      ruixuan-system/src/main/java/com/ruixuan/system/service/impl/SysUserServiceImpl.java
  54. 11 0
      ruixuan-system/src/main/resources/mapper/system/SysUserMapper.xml

+ 31 - 7
pom.xml

@@ -2,16 +2,16 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	
+    <modelVersion>4.0.0</modelVersion>
+
     <groupId>com.ruixuan</groupId>
     <groupId>com.ruixuan</groupId>
     <artifactId>ruixuan</artifactId>
     <artifactId>ruixuan</artifactId>
     <version>3.8.2</version>
     <version>3.8.2</version>
 
 
-  <!--  <name>ruixuan</name>
-    <url>http://www.ruixuan.vip</url>
-    <description>若依管理系统</description>-->
-    
+    <!--  <name>ruixuan</name>
+      <url>http://www.ruixuan.vip</url>
+      <description>若依管理系统</description>-->
+
     <properties>
     <properties>
         <ruixuan.version>3.8.2</ruixuan.version>
         <ruixuan.version>3.8.2</ruixuan.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -30,11 +30,14 @@
         <commons.io.version>2.11.0</commons.io.version>
         <commons.io.version>2.11.0</commons.io.version>
         <commons.fileupload.version>1.4</commons.fileupload.version>
         <commons.fileupload.version>1.4</commons.fileupload.version>
         <commons.collections.version>3.2.2</commons.collections.version>
         <commons.collections.version>3.2.2</commons.collections.version>
+        <hutool-all.version>5.3.8</hutool-all.version>
+        <lombok.version>1.16.20</lombok.version>
+        <cos_api.version>5.6.25</cos_api.version>
         <poi.version>4.1.2</poi.version>
         <poi.version>4.1.2</poi.version>
         <velocity.version>2.3</velocity.version>
         <velocity.version>2.3</velocity.version>
         <jwt.version>0.9.1</jwt.version>
         <jwt.version>0.9.1</jwt.version>
     </properties>
     </properties>
-	
+
     <!-- 依赖声明 -->
     <!-- 依赖声明 -->
     <dependencyManagement>
     <dependencyManagement>
         <dependencies>
         <dependencies>
@@ -143,6 +146,27 @@
                 <version>${commons.collections.version}</version>
                 <version>${commons.collections.version}</version>
             </dependency>
             </dependency>
 
 
+            <!-- hutool工具类-->
+            <dependency>
+                <groupId>cn.hutool</groupId>
+                <artifactId>hutool-all</artifactId>
+                <version>${hutool-all.version}</version>
+            </dependency>
+
+            <!-- hutool工具类-->
+            <dependency>
+                <groupId>org.projectlombok</groupId>
+                <artifactId>lombok</artifactId>
+                <version>${lombok.version}</version>
+            </dependency>
+
+            <!--cos_api-->
+            <dependency>
+                <groupId>com.qcloud</groupId>
+                <artifactId>cos_api</artifactId>
+                <version>${cos_api.version}</version>
+            </dependency>
+
             <!-- 阿里JSON解析器 -->
             <!-- 阿里JSON解析器 -->
             <dependency>
             <dependency>
                 <groupId>com.alibaba</groupId>
                 <groupId>com.alibaba</groupId>

+ 18 - 1
ruixuan-common/pom.xml

@@ -52,7 +52,7 @@
             <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>
@@ -65,6 +65,18 @@
             <artifactId>fastjson</artifactId>
             <artifactId>fastjson</artifactId>
         </dependency>
         </dependency>
 
 
+        <!-- lombok-->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+
+        <!--cos_api-->
+        <dependency>
+            <groupId>com.qcloud</groupId>
+            <artifactId>cos_api</artifactId>
+        </dependency>
+
         <!-- io常用工具类 -->
         <!-- io常用工具类 -->
         <dependency>
         <dependency>
             <groupId>commons-io</groupId>
             <groupId>commons-io</groupId>
@@ -83,6 +95,11 @@
             <artifactId>poi-ooxml</artifactId>
             <artifactId>poi-ooxml</artifactId>
         </dependency>
         </dependency>
 
 
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+        </dependency>
+
         <!-- yml解析器 -->
         <!-- yml解析器 -->
         <dependency>
         <dependency>
             <groupId>org.yaml</groupId>
             <groupId>org.yaml</groupId>

+ 28 - 0
ruixuan-common/src/main/java/com/ruixuan/common/cos/CosFileDTO.java

@@ -0,0 +1,28 @@
+package com.ruixuan.common.cos;
+
+import lombok.Data;
+
+@Data
+public class CosFileDTO {
+
+    private String fileUrl;
+    private String fileName;
+    private String cFileName;
+    private String fileType;
+    private long fileSize;
+    private String md5key;
+
+    public CosFileDTO() {
+        super();
+    }
+
+    public CosFileDTO(String fileUrl, String fileName, String cFileName, String fileType, long fileSize, String md5key) {
+        this.fileUrl = fileUrl;
+        this.fileName = fileName;
+        this.cFileName = cFileName;
+        this.fileType = fileType;
+        this.fileSize = fileSize;
+        this.md5key = md5key;
+    }
+
+}

+ 106 - 0
ruixuan-common/src/main/java/com/ruixuan/common/cos/CosUpload.java

@@ -0,0 +1,106 @@
+package com.ruixuan.common.cos;
+
+import com.ruixuan.common.utils.Check;
+import com.ruixuan.common.utils.DateUtils;
+import com.ruixuan.common.utils.LoadFileUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.UUID;
+
+/**
+ *
+ * @ClassName CosUtil
+ * @Author ZHAOXA
+ * @date 2022-06-06 09:58
+ */
+public class CosUpload {
+
+    private static final Logger log = LoggerFactory.getLogger(CosUpload.class);
+    /**
+     * 请求前缀
+     */
+    public static final String HTTPS_PREFIX = "https:";
+
+    /**
+     * 根据原始视频链接,上传到cos,mp4格式
+     */
+    public static String getMp4CosUrl(String url, String upFileName) {
+        try {
+            if (!url.contains("http")) {
+                url = HTTPS_PREFIX + url;
+            }
+            InputStream imageStream = LoadFileUtil.getFileStream(url);
+            if (!Check.isNull(imageStream)) {
+                String path = upFileName + "/" + DateUtils.formatDate(new Date(), DateUtils.YYYYMMDD) + "/";
+                String videoName = UUID.randomUUID().toString().replace("-", "") + ".mp4";
+                CosFileDTO file = CosUtils.uploadDetailInputStreamV2(imageStream, videoName, "mp4", 0L, path);
+                return file.getFileUrl();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("视频上传到cos失败");
+        }
+        return null;
+    }
+
+    /**
+     * 根据原始图片链接,上传到cos,JPG格式
+     */
+    public static String getJPGCosUrl(String url, String upFileName, String fileName) {
+        try {
+            if (!url.contains("http")) {
+                url = HTTPS_PREFIX + url;
+            }
+            InputStream imageStream = LoadFileUtil.getFileStream(url);
+            if (Check.isNotNull(imageStream)) {
+                String path = upFileName + "/" + DateUtils.formatDate(new Date(), DateUtils.YYYYMMDD) + "/";
+                String videoName = fileName + ".jpg";
+                CosFileDTO file = CosUtils.uploadDetailInputStreamV2(imageStream, videoName, "jpg", 0L, path);
+                return file.getFileUrl();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("图片上传到cos失败");
+        }
+        return null;
+    }
+
+    /**
+     * 根据文件,上传到cos,文件自己后缀格式
+     */
+    public static String getFileCosUrl(MultipartFile file, String upFileName) {
+        InputStream inputStream = null;
+        try {
+            //存储路径
+            String path = upFileName + "/" + DateUtils.formatDate(new Date(), DateUtils.YYYYMMDD) + "/";
+            //原文件名
+            String fileName = file.getOriginalFilename();
+            //文件后缀
+            String fileSuffix = "";
+            if (fileName.contains(".")) {
+                fileSuffix = fileName.substring(fileName.lastIndexOf("."), fileName.length());
+            }
+            inputStream = file.getInputStream();
+            CosFileDTO resultFile = CosUtils.uploadDetailInputStreamV2(inputStream, fileName, fileSuffix, file.getSize(), path);
+            return resultFile.getFileUrl();
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("图片上传到cos失败");
+        } finally {
+            if (inputStream != null) {
+                try {
+                    inputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return null;
+    }
+}
+

+ 308 - 0
ruixuan-common/src/main/java/com/ruixuan/common/cos/CosUtils.java

@@ -0,0 +1,308 @@
+package com.ruixuan.common.cos;
+
+import com.qcloud.cos.COSClient;
+import com.qcloud.cos.ClientConfig;
+import com.qcloud.cos.auth.BasicCOSCredentials;
+import com.qcloud.cos.auth.COSCredentials;
+import com.qcloud.cos.exception.CosClientException;
+import com.qcloud.cos.exception.CosServiceException;
+import com.qcloud.cos.model.*;
+import com.qcloud.cos.region.Region;
+import com.ruixuan.common.file.FileType;
+import com.ruixuan.common.file.FileTypeJudge;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+public class CosUtils {
+    private static final String ACCESSKEY = "AKIDE6IpMi8fJQRCg1iuWzFajjRs43kbbets";
+    private static final String SECRETKEY = "tXzuwMfplTTK3c9GFUyETilasvQfePu9";
+    private static final String APPID = "1301855440";
+    private static final String BUCKETNAME = "live-" + APPID;
+    private static final String REGIONID = "ap-chongqing";
+    private static final String URL_PREFIX = "https://" + BUCKETNAME + ".cos.ap-chongqing.myqcloud.com/";
+    /**
+     * https://media-1301855440.cos.ap-chongqing.myqcloud.com/MyFile1/1234.mp4
+     */
+    /**
+     * 初始化CosClient相关配置, appid、accessKey、secretKey、region
+     *
+     * @return
+     */
+    public static COSClient getCosClient() {
+        // 1 初始化用户身份信息(secretId, secretKey)
+        COSCredentials cred = new BasicCOSCredentials(ACCESSKEY, SECRETKEY);
+        // 2 设置bucket的区域, COS地域的简称请参照 https://cloud.tencent.com/document/product/436/6224
+        // clientConfig中包含了设置region, https(默认http), 超时, 代理等set方法, 使用可参见源码或者接口文档FAQ中说明
+        ClientConfig clientConfig = new ClientConfig(new Region(REGIONID));
+        // 3 生成cos客户端
+        COSClient cosClient = new COSClient(cred, clientConfig);
+        // bucket的命名规则为{name}-{appid} ,此处填写的存储桶名称必须为此格式
+        //String bucketName = BUCKETNAME;
+        return cosClient;
+    }
+
+    /**
+     * URL_PREFIX+fileSavePath+fileName
+     * 上传文件
+     *
+     * @return //绝对路径和相对路径都OK
+     */
+    public static String uploadFile(String filePath, String fileSavePath, String fileName) {
+        File localFile = new File(filePath);
+        PutObjectRequest putObjectRequest = new PutObjectRequest(BUCKETNAME, fileSavePath + fileName, localFile);
+        // 设置存储类型, 默认是标准(Standard), 低频(standard_ia),一般为标准的
+        putObjectRequest.setStorageClass(StorageClass.Standard);
+        COSClient cc = getCosClient();
+        try {
+            PutObjectResult putObjectResult = cc.putObject(putObjectRequest);
+            String etag = putObjectResult.getETag();
+            return etag;
+        } catch (CosServiceException e) {
+            e.printStackTrace();
+        } catch (CosClientException e) {
+            e.printStackTrace();
+        } finally {
+            // 关闭客户端
+            cc.shutdown();
+        }
+        return null;
+    }
+
+    /**
+     * 下载文件
+     *
+     * @param bucketName
+     * @param key
+     * @return
+     */
+    public static String downLoadFile(String bucketName, String key) {
+        File downFile = new File("E:\\software\\1.jpg");
+        COSClient cc = getCosClient();
+        GetObjectRequest getObjectRequest = new GetObjectRequest(bucketName, key);
+
+        ObjectMetadata downObjectMeta = cc.getObject(getObjectRequest, downFile);
+        cc.shutdown();
+        String etag = downObjectMeta.getETag();
+        return etag;
+    }
+
+    /**
+     * 删除文件
+     *
+     * @param bucketName
+     * @param key
+     */
+    public static void deleteFile(String bucketName, String key) {
+        COSClient cc = getCosClient();
+        try {
+            cc.deleteObject(bucketName, key);
+        } catch (CosClientException e) {
+            e.printStackTrace();
+        } finally {
+            cc.shutdown();
+        }
+
+    }
+
+    /**
+     * 创建桶
+     *
+     * @param bucketName
+     * @return
+     * @throws CosClientException
+     * @throws CosServiceException
+     */
+    public static Bucket createBucket(String bucketName) throws CosClientException, CosServiceException {
+        COSClient cc = getCosClient();
+        Bucket bucket = null;
+        try {
+            bucket = cc.createBucket(bucketName);
+        } catch (CosClientException e) {
+            e.printStackTrace();
+        } finally {
+        }
+        return bucket;
+    }
+
+    ;
+
+    /**
+     * 删除桶
+     *
+     * @param bucketName
+     * @throws CosClientException
+     * @throws CosServiceException
+     */
+    public void deleteBucket(String bucketName) {
+        COSClient cc = getCosClient();
+        try {
+            cc.deleteBucket(bucketName);
+        } catch (CosClientException e) {
+            e.printStackTrace();
+        } finally {
+        }
+    }
+
+    ;
+
+    /**
+     * 判断桶是否存在
+     *
+     * @param bucketName
+     * @return
+     */
+    public static boolean doesBucketExist(String bucketName) {
+        COSClient cc = getCosClient();
+        return cc.doesBucketExist(bucketName);
+    }
+
+    /**
+     * 查看桶文件
+     *
+     * @param bucketName
+     * @return
+     * @throws CosClientException
+     * @throws CosServiceException
+     */
+    public static ObjectListing listObjects(String bucketName) throws CosClientException, CosServiceException {
+        COSClient cc = getCosClient();
+
+        // 获取 bucket 下成员(设置 delimiter)
+        ListObjectsRequest listObjectsRequest = new ListObjectsRequest();
+        listObjectsRequest.setBucketName(bucketName);
+        // 设置 list 的 prefix, 表示 list 出来的文件 key 都是以这个 prefix 开始
+        listObjectsRequest.setPrefix("");
+        // 设置 delimiter 为/, 即获取的是直接成员,不包含目录下的递归子成员
+        listObjectsRequest.setDelimiter("/");
+        // 设置 marker, (marker 由上一次 list 获取到, 或者第一次 list marker 为空)
+        listObjectsRequest.setMarker("");
+        // 设置最多 list 100 个成员,(如果不设置, 默认为 1000 个,最大允许一次 list 1000 个 key)
+        listObjectsRequest.setMaxKeys(100);
+
+        ObjectListing objectListing = cc.listObjects(listObjectsRequest);
+        // 获取下次 list 的 marker
+        String nextMarker = objectListing.getNextMarker();
+        // 判断是否已经 list 完, 如果 list 结束, 则 isTruncated 为 false, 否则为 true
+        boolean isTruncated = objectListing.isTruncated();
+        List<COSObjectSummary> objectSummaries = objectListing.getObjectSummaries();
+        for (COSObjectSummary cosObjectSummary : objectSummaries) {
+            // get file path
+            String key = cosObjectSummary.getKey();
+            // get file length
+            long fileSize = cosObjectSummary.getSize();
+            // get file etag
+            String eTag = cosObjectSummary.getETag();
+            // get last modify time
+            Date lastModified = cosObjectSummary.getLastModified();
+            // get file save type
+            String StorageClassStr = cosObjectSummary.getStorageClass();
+        }
+        return objectListing;
+    }
+
+    /**
+     * 查询一个 Bucket 所在的 Region。
+     *
+     * @param bucketName
+     * @return
+     */
+    public static String getBucketLocation(String bucketName) {
+        COSClient cosClient = getCosClient();
+        // bucket 的命名规则为{name}-{appid} ,此处填写的存储桶名称必须为此格式
+        return cosClient.getBucketLocation(bucketName);
+    }
+
+    public static CosFileDTO uploadMultipartFile(MultipartFile file, String fileSavePath) {
+        String fileName = file.getOriginalFilename();
+        InputStream inputStream;
+        CosFileDTO o = new CosFileDTO();
+        String fileType;
+        long fileSize = file.getSize();
+        try {
+            inputStream = file.getInputStream();
+            FileType type = FileTypeJudge.getType(inputStream);
+
+            if (type == null || "null".equals(type.toString()) ||
+                    "XLS_DOC".equals(type.toString()) || "XLSX_DOCX".equals(type.toString()) ||
+                    "WPSUSER".equals(type.toString()) || "WPS".equals(type.toString())) {
+                fileType = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
+            } else {
+                fileType = type.toString().toLowerCase();
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            //用户上传的文件类型为空,并且通过二进制流获取不到文件类型,因为二进制流只列举了常用的
+            fileType = "";
+        }
+
+        try {
+            o = uploadDetailInputStream(file.getInputStream(), fileName, fileType, fileSize, fileSavePath);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return o;
+    }
+
+
+    public static CosFileDTO uploadDetailInputStream(InputStream in, String fileName, String fileType, long fileSize, String fileSavePath) {
+        String uuidFileName = UUID.randomUUID().toString() + fileName.substring(fileName.lastIndexOf("."));
+        String fileUrl = URL_PREFIX + fileSavePath + uuidFileName;
+        String md5key = uploadFileByInputStream(in, fileSavePath, uuidFileName);
+        CosFileDTO o = new CosFileDTO();
+        if (md5key != null) {
+            o.setFileType(fileType);
+            o.setFileName(fileName);
+            o.setCFileName(uuidFileName);
+            o.setFileUrl(fileUrl);
+            o.setFileSize(fileSize);
+            o.setMd5key(md5key);
+        }
+        return o;
+    }
+
+
+    public static CosFileDTO uploadDetailInputStreamV2(InputStream in, String fileName, String fileType, long fileSize, String fileSavePath) {
+        //      String uuidFileName = UUID.randomUUID().toString() + fileName.substring(fileName.lastIndexOf("."));
+        String fileUrl = URL_PREFIX + fileSavePath + fileName;
+        String md5key = uploadFileByInputStream(in, fileSavePath, fileName);
+        CosFileDTO o = new CosFileDTO();
+        if (md5key != null) {
+            o.setFileType(fileType);
+            o.setFileName(fileName);
+            o.setCFileName(fileName);
+            o.setFileUrl(fileUrl);
+            o.setFileSize(fileSize);
+            o.setMd5key(md5key);
+        }
+        return o;
+    }
+
+
+    public static String uploadFileByInputStream(InputStream fileStream, String fileSavePath, String fileName) {
+        ObjectMetadata metadata = new ObjectMetadata();
+        PutObjectRequest putObjectRequest = new PutObjectRequest(BUCKETNAME, fileSavePath + fileName, fileStream, metadata);
+        // 设置存储类型, 默认是标准(Standard), 低频(standard_ia),一般为标准的
+        putObjectRequest.setStorageClass(StorageClass.Standard);
+        COSClient cc = getCosClient();
+        try {
+            PutObjectResult putObjectResult = cc.putObject(putObjectRequest);
+            String etag = putObjectResult.getETag();
+            return etag;
+        } catch (CosServiceException e) {
+            e.printStackTrace();
+        } catch (CosClientException e) {
+            e.printStackTrace();
+        } finally {
+            // 关闭客户端
+            cc.shutdown();
+        }
+        return null;
+    }
+}

+ 119 - 0
ruixuan-common/src/main/java/com/ruixuan/common/file/FileType.java

@@ -0,0 +1,119 @@
+package com.ruixuan.common.file;
+
+/**
+ * 文件类型枚取
+ */
+public enum FileType {
+
+    JPEG("FFD8FF"),//JPEG (jpg)
+
+    PNG("89504E47"),//PNG (png)
+
+    GIF("47494638"),//GIF (gif)
+
+    TIFF("49492A00"),//TIFF (tif)
+
+    BMP("424D"),//Windows Bitmap (bmp)
+
+    DWG("41433130"),//CAD (dwg)
+
+    PSD("38425053"),// Adobe Photoshop.
+
+    RTF("7B5C727466"),// Rich Text Format.
+
+    XML("3C3F786D6C"),// XML.
+
+    HTML("68746D6C3E"),//HTML (html)
+
+    CSS("48544D4C207B0D0A0942"),// CSS.
+
+    JS("696B2E71623D696B2E71"),// JS.
+
+    EML("44656C69766572792D646174653A"),// Email [thorough only].
+
+    DBX("CFAD12FEC5FD746F"),// Outlook Express.
+
+    PST("2142444E"),// Outlook (pst).
+
+    XLS_DOC("D0CF11E0"), // MS Word/Excel.
+
+    XLSX_DOCX("504B030414000600080000002100"),// MS Word/Excel.
+
+    WPSUSER("504B03040A0000000000"),// WPS(个人版)文字wps、表格et、演示dps都是一样的
+
+    WPS("D0CF11E0A1B11AE10000"),// WPS(专业版)文字wps、表格et、演示dps都是一样的
+
+    VSD("d0cf11e0a1b11ae10000"),// Visio
+
+    MDB("5374616E64617264204A"),// MS Access.
+
+    TORRENT("6431303A637265617465"),// torrent
+
+    WPD("FF575043"),// WordPerfect.
+
+    EPS("252150532D41646F6265"),// Postscript.
+
+    PDF("255044462D312E"),// Adobe Acrobat.
+
+    QDF("AC9EBD8F"),// Quicken.
+
+    PWL("E3828596"),// Windows Password.
+
+    ZIP("504B03040A000008"),// ZIP Archive.
+
+    RAR("52617221"),// RAR Archive.
+
+    JSP("3C2540207061676520"),// JSP Archive.
+
+    JAVA("7061636B61676520"),// JAVA Archive.
+
+    JAR("504B03040A000000"),// JAR Archive.
+
+    MF("4D616E69666573742D56"),// MF Archive.
+
+    EXE("4D5A9000030000000400"),// EXE Archive.
+
+    CHM("49545346030000006000"),// CHM Archive.
+
+    WAV("57415645"),// Wave.
+
+    AVI("41564920"),// AVI.
+
+    RAM("2E7261FD"),// Real Audio.
+
+    RM("2E524D46"),// Real Media.
+
+    MPG("000001BA"),// MPEG (mpg).
+
+    MOV("6D6F6F76"),// Quicktime.
+
+    ASF("3026B2758E66CF11"),// Windows Media.
+
+    MID("4D546864"),// MIDI.
+
+    MP4("00000020667479706d70"),// MP4.
+
+    MP3("49443303000000002176"),// MP3.
+
+    FLV("464C5601050000000900");// FLV.
+
+    private String value = "";
+
+    /**
+     * Constructor.
+     *
+     * @param type
+     */
+    private FileType(String value) {
+        this.value = value;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+}

+ 139 - 0
ruixuan-common/src/main/java/com/ruixuan/common/file/FileTypeJudge.java

@@ -0,0 +1,139 @@
+package com.ruixuan.common.file;
+
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+* 文件类型判断类
+*/
+@Component
+public class FileTypeJudge {
+
+   /**
+    * 将文件头转换成16进制字符串
+    * @return 16进制字符串
+    */
+   private static String bytesToHexString(byte[] src) {
+
+       StringBuilder stringBuilder = new StringBuilder();
+       if (src == null || src.length <= 0) {
+           return null;
+       }
+       for (int i = 0; i < src.length; i++) {
+           int v = src[i] & 0xFF;
+           String hv = Integer.toHexString(v);
+           if (hv.length() < 2) {
+               stringBuilder.append(0);
+           }
+           stringBuilder.append(hv);
+       }
+       return stringBuilder.toString();
+   }
+
+   /**
+    * 得到文件头
+    * @return 文件头
+    * @throws IOException ex
+    */
+   private static String getFileContent(InputStream is) throws IOException {
+
+       byte[] b = new byte[28];
+
+       InputStream inputStream = null;
+
+       try {
+           is.read(b, 0, 28);
+       } catch (IOException e) {
+           e.printStackTrace();
+           throw e;
+       } finally {
+           if (inputStream != null) {
+               try {
+                   inputStream.close();
+               } catch (IOException e) {
+                   e.printStackTrace();
+                   throw e;
+               }
+           }
+       }
+       return bytesToHexString(b);
+   }
+
+   /**
+    * 判断文件类型
+    * @return 文件类型
+    */
+   public static FileType getType(InputStream is) throws IOException {
+
+       String fileHead = getFileContent(is);
+
+       if (fileHead == null || fileHead.length() == 0) {
+           return null;
+       }
+
+       fileHead = fileHead.toUpperCase();
+
+       FileType[] fileTypes = FileType.values();
+
+
+       for (FileType type : fileTypes) {
+           if (fileHead.startsWith(type.getValue())) {
+               return type;
+           }
+       }
+
+       return null;
+   }
+
+   public static Integer isFileType(FileType value) {
+       int type = 7;// 其他
+       // 图片
+       FileType[] pics = { FileType.JPEG, FileType.PNG, FileType.GIF, FileType.TIFF, FileType.BMP, FileType.DWG, FileType.PSD };
+
+       FileType[] docs = { FileType.RTF, FileType.XML, FileType.HTML, FileType.CSS, FileType.JS, FileType.EML, FileType.DBX, FileType.PST, FileType.XLS_DOC, FileType.XLSX_DOCX, FileType.VSD,
+               FileType.MDB, FileType.WPS, FileType.WPD, FileType.EPS, FileType.PDF, FileType.QDF, FileType.PWL, FileType.ZIP, FileType.RAR, FileType.JSP, FileType.JAVA,
+               FileType.JAR, FileType.MF, FileType.EXE, FileType.CHM };
+
+       FileType[] videos = { FileType.AVI, FileType.RAM, FileType.RM, FileType.MPG, FileType.MOV, FileType.ASF, FileType.MP4, FileType.FLV, FileType.MID };
+
+       FileType[] tottents = { FileType.TORRENT };
+
+       FileType[] audios = { FileType.WAV, FileType.MP3 };
+
+       FileType[] others = {};
+
+       // 图片
+       for (FileType fileType : pics) {
+           if (fileType.equals(value)) {
+               type = 1;
+           }
+       }
+       // 文档
+       for (FileType fileType : docs) {
+           if (fileType.equals(value)) {
+               type = 2;
+           }
+       }
+       // 视频
+       for (FileType fileType : videos) {
+           if (fileType.equals(value)) {
+               type = 3;
+           }
+       }
+       // 种子
+       for (FileType fileType : tottents) {
+           if (fileType.equals(value)) {
+               type = 4;
+           }
+       }
+       // 音乐
+       for (FileType fileType : audios) {
+           if (fileType.equals(value)) {
+               type = 5;
+           }
+       }
+       return type;
+   }
+}

+ 113 - 0
ruixuan-common/src/main/java/com/ruixuan/common/file/FileUtil.java

@@ -0,0 +1,113 @@
+package com.ruixuan.common.file;
+
+import java.nio.charset.StandardCharsets;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+
+public class FileUtil {
+
+    // office
+    private static String[] office = {"word", "excel", "ppt"};
+
+    // excel
+    private static String[] etExts = {"et", "xls", "xlt", "xlsx", "xlsm", "xltx", "xltm", "csv"};
+
+    // word
+    private static String[] wpsExts = {"doc", "docx", "txt", "dot", "wps", "wpt", "dotx", "docm", "dotm"};
+
+    // ppt
+    private static String[] wppExts = {"ppt", "pptx", "pptm", "pptm", "ppsm", "pps", "potx", "potm", "dpt", "dps"};
+
+    // pdf
+    private static String[] pdfExts = {"pdf"};
+
+    public static String getFileTypeCode(String fileType){
+        for (String et : etExts){
+            if (et.equalsIgnoreCase(fileType)){
+                return "s";
+            }
+        }
+        for (String et : wpsExts){
+            if (et.equalsIgnoreCase(fileType)){
+                return "w";
+            }
+        }
+        for (String et : wppExts){
+            if (et.equalsIgnoreCase(fileType)){
+                return "p";
+            }
+        }
+        for (String et : pdfExts){
+            if (et.equalsIgnoreCase(fileType)){
+                return "f";
+            }
+        }
+        return null;
+    }
+
+    public static boolean checkCode(String fileType){
+        for (String et : office){
+            if (et.equalsIgnoreCase(fileType)){
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static String getTypeCode(String fileType){
+        if ("word".equalsIgnoreCase(fileType)){
+            return "w";
+        }if ("excel".equalsIgnoreCase(fileType)){
+            return "s";
+        }if ("ppt".equalsIgnoreCase(fileType)){
+            return "p";
+        }
+        return null;
+    }
+
+    public static String getFileName(String filePath){
+        String[] pathArr = filePath.split("/");
+        String fileName ;
+        if (pathArr.length>1){
+            fileName = pathArr[pathArr.length-1];
+        }else {
+            fileName = filePath;
+        }
+        return fileName;
+    }
+
+    public static String getFileTypeByPath(String filePath){
+        String fileName = getFileName(filePath);
+        String[] arr = fileName.split("\\.");
+        return arr[arr.length-1];
+    }
+
+    public static String getFileTypeByName(String fileName){
+        String[] arr = fileName.split("\\.");
+        return arr[arr.length-1];
+    }
+
+    public static String getFileUUIDName(String fileName,String fileType){
+        String uuid = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
+        String uuidFileName = fileName.replace(".","").replace(fileType,"") + uuid + "." + fileType ;
+        return new String(uuidFileName.getBytes(), StandardCharsets.UTF_8);
+    }
+
+    public static String makeNewFileName(String oldFileName){
+        String fileType = FileUtil.getFileTypeByName(oldFileName);
+        String tempFileName = oldFileName.replace("."+fileType,"");
+        Random ne = new Random();//实例化一个random的对象ne
+        int uuid = ne.nextInt(90000)+10000;//为变量赋随机值10000-99999
+        return  tempFileName + uuid + "." + fileType;
+    }
+
+    public static String makeNewFileName(String oldFileName,String fileType){
+        String tempFileName = oldFileName.replace("."+fileType,"");
+        Random ne = new Random();//实例化一个random的对象ne
+        int uuid = ne.nextInt(90000)+10000;//为变量赋随机值10000-99999
+        return  tempFileName + uuid + "." + fileType;
+    }
+
+
+}

+ 92 - 0
ruixuan-common/src/main/java/com/ruixuan/common/utils/Check.java

@@ -0,0 +1,92 @@
+package com.ruixuan.common.utils;
+
+import com.alibaba.fastjson.JSONArray;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+public class Check {
+    private Check() {
+    }
+
+    public static boolean isNull(List<?> list) {
+        return list == null || list.isEmpty();
+    }
+
+    public static boolean isNotNull(List<?> list) {
+        return !isNull(list);
+    }
+
+    public static boolean isNull(Long l) {
+        return l == null || l == 0;
+    }
+
+    public static boolean isNotNull(Long l) {
+        return !isNull(l);
+    }
+
+    public static boolean isNull(Collection<?> collection) {
+        return collection == null || collection.isEmpty();
+    }
+
+    public static boolean isNotNull(Collection<?> collection) {
+        return !isNull(collection);
+    }
+
+    public static boolean isNull(JSONArray jsonArray) {
+        return jsonArray == null || jsonArray.isEmpty();
+    }
+
+    public static boolean isNotNull(JSONArray jsonArray) {
+        return !isNull(jsonArray);
+    }
+
+
+    public static boolean isNull(String str) {
+        return str == null || str.isEmpty();
+    }
+
+    public static boolean isNotNull(String str) {
+        return !isNull(str);
+    }
+
+    public static boolean isNull(byte[] bytes) {
+        return bytes == null || bytes.length == 0;
+    }
+
+    public static boolean isNotNull(byte[] bytes) {
+        return !isNull(bytes);
+    }
+
+    public static boolean hasNull(Object... objects) {
+        for (Object obj : objects) {
+            if (obj == null) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static boolean allEmpty(String... strs) {
+        for (String str : strs) {
+            if (StringUtils.isNotEmpty(str)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public static boolean isNull(Object object) {
+        return object == null;
+    }
+
+    public static boolean isNotNull(Object object) {
+        return object != null;
+    }
+
+    public static boolean isNullMap(Map<?, ?> map) {
+        return map == null || map.isEmpty();
+    }
+}

+ 15 - 0
ruixuan-common/src/main/java/com/ruixuan/common/utils/DateUtils.java

@@ -29,6 +29,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
 
 
     public static String YYYY_MM_DD = "yyyy-MM-dd";
     public static String YYYY_MM_DD = "yyyy-MM-dd";
 
 
+    public static String YYYYMMDD = "yyyyMMdd";
+
     public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
     public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
 
 
     public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
     public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
@@ -267,5 +269,18 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         System.out.println(parseDateToStr(YYYY_MM_DD,getEendDayOfWeek()));
         System.out.println(parseDateToStr(YYYY_MM_DD,getEendDayOfWeek()));
     }
     }
 
 
+    /**
+     * 指定模式的时间格式
+     */
+    private static SimpleDateFormat getSDFormat(String pattern) {
+        return new SimpleDateFormat(pattern);
+    }
+
+    /**
+     * 指定日期按指定格式显示
+     */
+    public static String formatDate(Date date, String pattern) {
+        return getSDFormat(pattern).format(date);
+    }
 
 
 }
 }

+ 244 - 0
ruixuan-common/src/main/java/com/ruixuan/common/utils/LoadFileUtil.java

@@ -0,0 +1,244 @@
+package com.ruixuan.common.utils;
+
+import com.ruixuan.common.utils.encryption.AesEncryptUtil;
+import org.apache.commons.codec.digest.DigestUtils;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Map;
+
+public class LoadFileUtil {
+    /**
+     * 上传文件
+     *
+     * @param urlStr
+     * @param savePath
+     * @return
+     * @throws IOException
+     */
+    public static String downLoadFromUrl(String urlStr, String savePath) {
+        try {
+            String fileName = AesEncryptUtil.getUrlDecoderString(urlStr.substring(urlStr.lastIndexOf("/") + 1));
+            URL url = new URL(urlStr);
+
+            System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2,SSLv3");
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            //设置超时间为3秒
+            conn.setConnectTimeout(60 * 1000);
+            //防止屏蔽程序抓取而返回403错误
+            conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+            //得到输入流
+            InputStream inputStream = conn.getInputStream();
+            //获取自己数组
+            byte[] getData = readInputStream(inputStream);
+
+            //文件保存位置
+            File saveDir = new File(savePath);
+            if (!saveDir.exists()) {
+                saveDir.mkdirs();
+            }
+            String localPath = saveDir + File.separator + fileName;
+            File file = new File(localPath);
+            if (!file.exists()) {
+                file.getParentFile().mkdirs();
+            }
+            FileOutputStream fos = new FileOutputStream(file);
+            fos.write(getData);
+            if (fos != null) {
+                fos.close();
+            }
+            if (inputStream != null) {
+                inputStream.close();
+            }
+            return localPath;
+        } catch (Exception e) {
+            return null;
+        }
+
+
+    }
+
+    /**
+     * 上传文件
+     *
+     * @param urlStr
+     * @param savePath
+     * @return
+     * @throws IOException
+     */
+    public static String downLoadFromUrlAndName(String urlStr, String savePath, String fileName) {
+        try {
+            URL url = new URL(urlStr);
+
+            System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2,SSLv3");
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            //设置超时间为3秒
+            conn.setConnectTimeout(60 * 1000);
+            //防止屏蔽程序抓取而返回403错误
+            conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+            //得到输入流
+            InputStream inputStream = conn.getInputStream();
+            //获取自己数组
+            byte[] getData = readInputStream(inputStream);
+
+            //文件保存位置
+            File saveDir = new File(savePath);
+            if (!saveDir.exists()) {
+                saveDir.mkdirs();
+            }
+            String localPath = saveDir + File.separator + fileName;
+            File file = new File(localPath);
+            if (!file.exists()) {
+                file.getParentFile().mkdirs();
+            }
+            FileOutputStream fos = new FileOutputStream(file);
+            fos.write(getData);
+            if (fos != null) {
+                fos.close();
+            }
+            if (inputStream != null) {
+                inputStream.close();
+            }
+            return localPath;
+        } catch (Exception e) {
+            return null;
+        }
+
+
+    }
+
+    public static byte[] readInputStream(InputStream inputStream) throws IOException {
+        byte[] buffer = new byte[1024];
+        int len = 0;
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        while ((len = inputStream.read(buffer)) != -1) {
+            bos.write(buffer, 0, len);
+        }
+        bos.close();
+        return bos.toByteArray();
+    }
+
+
+    /**
+     * 删除文件
+     *
+     * @param path
+     * @return
+     */
+    public static boolean delFile(String path) {
+        boolean flag = false;
+        File file = new File(path);
+        if (!file.exists()) {
+            return false;
+        }
+        try {
+            flag = file.delete();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return flag;
+    }
+
+    /**
+     * 获取文件md5
+     *
+     * @param path
+     * @return
+     * @throws IOException
+     */
+    public static String getMD5(String path) throws IOException {
+        return DigestUtils.md5Hex(new FileInputStream(path));
+    }
+
+    public static String getMD5ByFile(FileInputStream inputStream) throws IOException {
+        return DigestUtils.md5Hex(inputStream);
+    }
+
+    public static void checkFile(String filePackageName) {
+        File file = new File(filePackageName);
+        if (!file.exists()) {
+            file.mkdir();
+        }
+    }
+
+    public static String downloadByUrl(Map<String, Object> requestMap, String downloadPath, String urlStr, String token, String fileName) {
+
+        try {
+            StringBuilder postBody = null;
+            if (!Check.isNull(requestMap)) {
+                postBody = new StringBuilder();
+                for (Map.Entry<String, Object> entry : requestMap.entrySet()) {
+                    if (entry.getValue() == null) {
+                        continue;
+                    }
+                    postBody.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue().toString(),
+                            "utf-8")).append("&");
+                }
+                if (!requestMap.isEmpty()) {
+                    postBody.deleteCharAt(postBody.length() - 1);
+                }
+            }
+
+            URL url = new URL(urlStr + "?" + postBody);
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            //设置超时间为3秒
+            conn.setConnectTimeout(120 * 1000);
+            //防止屏蔽程序抓取而返回403错误
+            conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+            conn.setRequestProperty("Access-Token", token);
+            //得到输入流
+            InputStream inputStream = null;
+
+            inputStream = conn.getInputStream();
+
+            //获取自己数组
+            byte[] getData = readInputStream(inputStream);
+
+            //文件保存位置
+            File saveDir = new File(downloadPath);
+            if (!saveDir.exists()) {
+                saveDir.mkdirs();
+            }
+            String filePath = downloadPath + fileName;
+
+            File file = new File(saveDir + File.separator + fileName);
+            FileOutputStream fos = new FileOutputStream(file);
+            fos.write(getData);
+            fos.close();
+            inputStream.close();
+            return filePath;
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+
+        return null;
+
+    }
+
+
+    public static InputStream getFileStream(String url) {
+        try {
+            HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
+            connection.setReadTimeout(60000);
+            connection.setConnectTimeout(60000);
+            connection.setRequestMethod("GET");
+            if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
+                InputStream inputStream = connection.getInputStream();
+                return inputStream;
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+
+}

+ 121 - 0
ruixuan-common/src/main/java/com/ruixuan/common/utils/encryption/AesEncryptUtil.java

@@ -0,0 +1,121 @@
+package com.ruixuan.common.utils.encryption;
+
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * AES 加密
+ */
+public class AesEncryptUtil {
+
+    //使用AES-128-CBC加密模式,key需要为16位,key和iv可以相同!
+    private static String KEY = EncryptedString.key;
+    private static String IV = EncryptedString.iv;
+
+    /**
+     * 加密方法
+     *
+     * @param data 要加密的数据
+     * @param key  加密key
+     * @param iv   加密iv
+     * @return 加密的结果
+     * @throws Exception
+     */
+    /*public static String encrypt(String data, String key, String iv) {
+        try {
+
+            Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");//"算法/模式/补码方式"NoPadding PkcsPadding
+            int blockSize = cipher.getBlockSize();
+
+            byte[] dataBytes = data.getBytes();
+            int plaintextLength = dataBytes.length;
+            if (plaintextLength % blockSize != 0) {
+                plaintextLength = plaintextLength + (blockSize - (plaintextLength % blockSize));
+            }
+
+            byte[] plaintext = new byte[plaintextLength];
+            System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);
+
+            SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
+            IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
+
+            cipher.init(Cipher.ENCRYPT_MODE, keyspec, ivspec);
+            byte[] encrypted = cipher.doFinal(plaintext);
+
+            return Base64.encodeToString(encrypted);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }*/
+
+    /**
+     * 解密方法
+     *
+     * @param data 要解密的数据
+     * @param key  解密key
+     * @param iv   解密iv
+     * @return 解密的结果
+     * @throws Exception
+     */
+    /*public static String desEncrypt(String data, String key, String iv) {
+        try {
+            byte[] encrypted1 = Base64.decode(data);
+
+            Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
+            SecretKeySpec keyspec = new SecretKeySpec(key.getBytes(), "AES");
+            IvParameterSpec ivspec = new IvParameterSpec(iv.getBytes());
+
+            cipher.init(Cipher.DECRYPT_MODE, keyspec, ivspec);
+
+            byte[] original = cipher.doFinal(encrypted1);
+            String originalString = new String(original);
+            return originalString;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }*/
+
+    private AesEncryptUtil() {
+    }
+
+    /**
+     * 使用默认的key和iv加密
+     *
+     * @param data
+     * @return
+     * @throws Exception
+     */
+    /*public static String encrypt(String data) {
+        return encrypt(data, EncryptedString.key, EncryptedString.iv);
+    }*/
+
+    /**
+     * 使用默认的key和iv解密
+     *
+     * @param data
+     * @return
+     */
+    /*public static String desEncrypt(String data) {
+        return desEncrypt(data, EncryptedString.key, EncryptedString.iv);
+    }*/
+
+
+    public static String getUrlDecoderString(String str) {
+        String result = "";
+        if (null == str) {
+            return "";
+        }
+        try {
+            result = java.net.URLDecoder.decode(str, "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+        }
+        return result;
+
+    }
+}

+ 12 - 0
ruixuan-common/src/main/java/com/ruixuan/common/utils/encryption/EncryptedString.java

@@ -0,0 +1,12 @@
+package com.ruixuan.common.utils.encryption;
+
+
+import lombok.Data;
+
+@Data
+public class EncryptedString {
+
+    public static String key = "1234567890adbcde";//长度为16个字符
+
+    public static String iv = "1234567890hjlkew";//长度为16个字符
+}

+ 0 - 9
ruixuan-live/pom.xml

@@ -37,15 +37,6 @@
             <version>1.6.2</version>
             <version>1.6.2</version>
         </dependency>
         </dependency>
 
 
-        <!-- lombok-->
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <version>1.16.20</version>
-            <scope>provided</scope>
-        </dependency>
-
-
         <!-- excel-->
         <!-- excel-->
         <dependency>
         <dependency>
             <groupId>com.alibaba</groupId>
             <groupId>com.alibaba</groupId>

+ 0 - 98
ruixuan-live/src/main/java/com/ruixuan/data/controller/KuaishouLiveDataAnalysisController.java

@@ -1,98 +0,0 @@
-package com.ruixuan.data.controller;
-
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
-import com.ruixuan.common.annotation.Log;
-import com.ruixuan.common.core.controller.BaseController;
-import com.ruixuan.common.core.domain.AjaxResult;
-import com.ruixuan.common.core.page.TableDataInfo;
-import com.ruixuan.common.enums.BusinessType;
-import com.ruixuan.common.utils.poi.ExcelUtil;
-import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
-import com.ruixuan.data.service.IKuaishouLiveDataAnalysisService;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 商品分析数据Controller
- *
- * @author ruoyi
- * @date 2022-05-31
- */
-@RestController
-@RequestMapping("/system/analysis")
-public class KuaishouLiveDataAnalysisController extends BaseController {
-    @Autowired
-    private IKuaishouLiveDataAnalysisService kuaishouLiveDataAnalysisService;
-
-    /**
-     * 查询商品分析数据列表
-     */
-    @PreAuthorize("@ss.hasPermi('system:analysis:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis) {
-        startPage();
-        List<KuaishouLiveDataAnalysis> list = kuaishouLiveDataAnalysisService.selectKuaishouLiveDataAnalysisList(kuaishouLiveDataAnalysis);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出商品分析数据列表
-     */
-    @PreAuthorize("@ss.hasPermi('system:analysis:export')")
-    @Log(title = "商品分析数据", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis) {
-        List<KuaishouLiveDataAnalysis> list = kuaishouLiveDataAnalysisService.selectKuaishouLiveDataAnalysisList(kuaishouLiveDataAnalysis);
-        ExcelUtil<KuaishouLiveDataAnalysis> util = new ExcelUtil<KuaishouLiveDataAnalysis>(KuaishouLiveDataAnalysis.class);
-        util.exportExcel(response, list, "商品分析数据数据");
-    }
-
-    /**
-     * 获取商品分析数据详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('system:analysis:query')")
-    @GetMapping(value = "/{ksId}")
-    public AjaxResult getInfo(@PathVariable("ksId") Long ksId) {
-        return AjaxResult.success(kuaishouLiveDataAnalysisService.selectKuaishouLiveDataAnalysisByKsId(ksId));
-    }
-
-    /**
-     * 新增商品分析数据
-     */
-    @PreAuthorize("@ss.hasPermi('system:analysis:add')")
-    @Log(title = "商品分析数据", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis) {
-        return toAjax(kuaishouLiveDataAnalysisService.insertKuaishouLiveDataAnalysis(kuaishouLiveDataAnalysis));
-    }
-
-    /**
-     * 修改商品分析数据
-     */
-    @PreAuthorize("@ss.hasPermi('system:analysis:edit')")
-    @Log(title = "商品分析数据", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis) {
-        return toAjax(kuaishouLiveDataAnalysisService.updateKuaishouLiveDataAnalysis(kuaishouLiveDataAnalysis));
-    }
-
-    /**
-     * 删除商品分析数据
-     */
-    @PreAuthorize("@ss.hasPermi('system:analysis:remove')")
-    @Log(title = "商品分析数据", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ksIds}")
-    public AjaxResult remove(@PathVariable Long[] ksIds) {
-        return toAjax(kuaishouLiveDataAnalysisService.deleteKuaishouLiveDataAnalysisByKsIds(ksIds));
-    }
-}

+ 49 - 0
ruixuan-live/src/main/java/com/ruixuan/data/controller/KuaishouLiveDataController.java

@@ -0,0 +1,49 @@
+package com.ruixuan.data.controller;
+
+import com.ruixuan.common.core.controller.BaseController;
+import com.ruixuan.common.utils.poi.ExcelUtil;
+import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
+import com.ruixuan.data.service.IKuaishouLiveDataAnalysisService;
+import com.ruixuan.data.service.IKuaishouLiveDataFunnelService;
+import com.ruixuan.data.service.IKuaishouLiveDataKanbanService;
+import com.ruixuan.data.service.IKuaishouLiveDataOverviewService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 商品分析数据Controller
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@RestController
+@RequestMapping("/live/data")
+public class KuaishouLiveDataController extends BaseController {
+    @Autowired
+    private IKuaishouLiveDataAnalysisService analysisService;
+    @Autowired
+    private IKuaishouLiveDataFunnelService funnelService;
+    @Autowired
+    private IKuaishouLiveDataKanbanService kanbanService;
+    @Autowired
+    private IKuaishouLiveDataOverviewService overviewService;
+
+
+
+
+
+    /**
+     * 导出商品分析数据列表
+     */
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis) {
+        List<KuaishouLiveDataAnalysis> list = analysisService.selectKuaishouLiveDataAnalysisList(kuaishouLiveDataAnalysis);
+        ExcelUtil<KuaishouLiveDataAnalysis> util = new ExcelUtil<KuaishouLiveDataAnalysis>(KuaishouLiveDataAnalysis.class);
+        util.exportExcel(response, list, "商品分析数据数据");
+    }
+}

+ 0 - 98
ruixuan-live/src/main/java/com/ruixuan/data/controller/KuaishouLiveDataFunnelController.java

@@ -1,98 +0,0 @@
-package com.ruixuan.data.controller;
-
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
-import com.ruixuan.common.annotation.Log;
-import com.ruixuan.common.core.controller.BaseController;
-import com.ruixuan.common.core.domain.AjaxResult;
-import com.ruixuan.common.core.page.TableDataInfo;
-import com.ruixuan.common.enums.BusinessType;
-import com.ruixuan.common.utils.poi.ExcelUtil;
-import com.ruixuan.data.entity.KuaishouLiveDataFunnel;
-import com.ruixuan.data.service.IKuaishouLiveDataFunnelService;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 直播漏斗数据Controller
- *
- * @author ruoyi
- * @date 2022-05-31
- */
-@RestController
-@RequestMapping("/system/funnel")
-public class KuaishouLiveDataFunnelController extends BaseController {
-    @Autowired
-    private IKuaishouLiveDataFunnelService kuaishouLiveDataFunnelService;
-
-    /**
-     * 查询直播漏斗数据列表
-     */
-    @PreAuthorize("@ss.hasPermi('system:funnel:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(KuaishouLiveDataFunnel kuaishouLiveDataFunnel) {
-        startPage();
-        List<KuaishouLiveDataFunnel> list = kuaishouLiveDataFunnelService.selectKuaishouLiveDataFunnelList(kuaishouLiveDataFunnel);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出直播漏斗数据列表
-     */
-    @PreAuthorize("@ss.hasPermi('system:funnel:export')")
-    @Log(title = "直播漏斗数据", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, KuaishouLiveDataFunnel kuaishouLiveDataFunnel) {
-        List<KuaishouLiveDataFunnel> list = kuaishouLiveDataFunnelService.selectKuaishouLiveDataFunnelList(kuaishouLiveDataFunnel);
-        ExcelUtil<KuaishouLiveDataFunnel> util = new ExcelUtil<KuaishouLiveDataFunnel>(KuaishouLiveDataFunnel.class);
-        util.exportExcel(response, list, "直播漏斗数据数据");
-    }
-
-    /**
-     * 获取直播漏斗数据详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('system:funnel:query')")
-    @GetMapping(value = "/{ksId}")
-    public AjaxResult getInfo(@PathVariable("ksId") Long ksId) {
-        return AjaxResult.success(kuaishouLiveDataFunnelService.selectKuaishouLiveDataFunnelByKsId(ksId));
-    }
-
-    /**
-     * 新增直播漏斗数据
-     */
-    @PreAuthorize("@ss.hasPermi('system:funnel:add')")
-    @Log(title = "直播漏斗数据", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody KuaishouLiveDataFunnel kuaishouLiveDataFunnel) {
-        return toAjax(kuaishouLiveDataFunnelService.insertKuaishouLiveDataFunnel(kuaishouLiveDataFunnel));
-    }
-
-    /**
-     * 修改直播漏斗数据
-     */
-    @PreAuthorize("@ss.hasPermi('system:funnel:edit')")
-    @Log(title = "直播漏斗数据", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody KuaishouLiveDataFunnel kuaishouLiveDataFunnel) {
-        return toAjax(kuaishouLiveDataFunnelService.updateKuaishouLiveDataFunnel(kuaishouLiveDataFunnel));
-    }
-
-    /**
-     * 删除直播漏斗数据
-     */
-    @PreAuthorize("@ss.hasPermi('system:funnel:remove')")
-    @Log(title = "直播漏斗数据", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ksIds}")
-    public AjaxResult remove(@PathVariable Long[] ksIds) {
-        return toAjax(kuaishouLiveDataFunnelService.deleteKuaishouLiveDataFunnelByKsIds(ksIds));
-    }
-}

+ 0 - 114
ruixuan-live/src/main/java/com/ruixuan/data/controller/KuaishouLiveDataKanbanController.java

@@ -1,114 +0,0 @@
-package com.ruixuan.data.controller;
-
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
-import com.ruixuan.common.annotation.Log;
-import com.ruixuan.common.core.controller.BaseController;
-import com.ruixuan.common.core.domain.AjaxResult;
-import com.ruixuan.common.core.page.TableDataInfo;
-import com.ruixuan.common.enums.BusinessType;
-import com.ruixuan.common.utils.poi.ExcelUtil;
-import com.ruixuan.data.entity.KuaishouLiveDataKanban;
-import com.ruixuan.data.service.IKuaishouLiveDataKanbanService;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 直播数据看板Controller
- * 
- * @author ruoyi
- * @date 2022-05-31
- */
-@RestController
-@RequestMapping("/system/kanban")
-public class KuaishouLiveDataKanbanController extends BaseController
-{
-    @Autowired
-    private IKuaishouLiveDataKanbanService kuaishouLiveDataKanbanService;
-
-    /**
-     * 查询直播数据看板列表
-     */
-    @PreAuthorize("@ss.hasPermi('system:kanban:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(KuaishouLiveDataKanban kuaishouLiveDataKanban)
-    {
-        startPage();
-        List<KuaishouLiveDataKanban> list = kuaishouLiveDataKanbanService.selectKuaishouLiveDataKanbanList(kuaishouLiveDataKanban);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出直播数据看板列表
-     */
-    @PreAuthorize("@ss.hasPermi('system:kanban:export')")
-    @Log(title = "直播数据看板", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, KuaishouLiveDataKanban kuaishouLiveDataKanban)
-    {
-        List<KuaishouLiveDataKanban> list = kuaishouLiveDataKanbanService.selectKuaishouLiveDataKanbanList(kuaishouLiveDataKanban);
-        ExcelUtil<KuaishouLiveDataKanban> util = new ExcelUtil<KuaishouLiveDataKanban>(KuaishouLiveDataKanban.class);
-        util.exportExcel(response, list, "直播数据看板数据");
-    }
-
-    /**
-     * 获取直播数据看板详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('system:kanban:query')")
-    @GetMapping(value = "/{ksId}")
-    public AjaxResult getInfo(@PathVariable("ksId") Long ksId)
-    {
-        return AjaxResult.success(kuaishouLiveDataKanbanService.selectKuaishouLiveDataKanbanByKsId(ksId));
-    }
-
-    /**
-     * 新增直播数据看板
-     */
-    @PreAuthorize("@ss.hasPermi('system:kanban:add')")
-    @Log(title = "直播数据看板", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody KuaishouLiveDataKanban kuaishouLiveDataKanban)
-    {
-        return toAjax(kuaishouLiveDataKanbanService.insertKuaishouLiveDataKanban(kuaishouLiveDataKanban));
-    }
-
-    /**
-     * 修改直播数据看板
-     */
-    @PreAuthorize("@ss.hasPermi('system:kanban:edit')")
-    @Log(title = "直播数据看板", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody KuaishouLiveDataKanban kuaishouLiveDataKanban)
-    {
-        return toAjax(kuaishouLiveDataKanbanService.updateKuaishouLiveDataKanban(kuaishouLiveDataKanban));
-    }
-
-    /**
-     * 删除直播数据看板
-     */
-    @PreAuthorize("@ss.hasPermi('system:kanban:remove')")
-    @Log(title = "直播数据看板", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ksIds}")
-    public AjaxResult remove(@PathVariable Long[] ksIds)
-    {
-        return toAjax(kuaishouLiveDataKanbanService.deleteKuaishouLiveDataKanbanByKsIds(ksIds));
-    }
-}

+ 0 - 98
ruixuan-live/src/main/java/com/ruixuan/data/controller/KuaishouLiveDataOverviewController.java

@@ -1,98 +0,0 @@
-package com.ruixuan.data.controller;
-
-import com.ruixuan.common.annotation.Log;
-import com.ruixuan.common.core.controller.BaseController;
-import com.ruixuan.common.core.domain.AjaxResult;
-import com.ruixuan.common.core.page.TableDataInfo;
-import com.ruixuan.common.enums.BusinessType;
-import com.ruixuan.common.utils.poi.ExcelUtil;
-import com.ruixuan.data.entity.KuaishouLiveDataOverview;
-import com.ruixuan.data.service.IKuaishouLiveDataOverviewService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/**
- * 直播数据概览Controller
- *
- * @author ruoyi
- * @date 2022-05-31
- */
-@RestController
-@RequestMapping("/system/overview")
-public class KuaishouLiveDataOverviewController extends BaseController {
-    @Autowired
-    private IKuaishouLiveDataOverviewService kuaishouLiveDataOverviewService;
-
-    /**
-     * 查询直播数据概览列表
-     */
-    @PreAuthorize("@ss.hasPermi('system:overview:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(KuaishouLiveDataOverview kuaishouLiveDataOverview) {
-        startPage();
-        List<KuaishouLiveDataOverview> list = kuaishouLiveDataOverviewService.selectKuaishouLiveDataOverviewList(kuaishouLiveDataOverview);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出直播数据概览列表
-     */
-    @PreAuthorize("@ss.hasPermi('system:overview:export')")
-    @Log(title = "直播数据概览", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, KuaishouLiveDataOverview kuaishouLiveDataOverview) {
-        List<KuaishouLiveDataOverview> list = kuaishouLiveDataOverviewService.selectKuaishouLiveDataOverviewList(kuaishouLiveDataOverview);
-        ExcelUtil<KuaishouLiveDataOverview> util = new ExcelUtil<KuaishouLiveDataOverview>(KuaishouLiveDataOverview.class);
-        util.exportExcel(response, list, "直播数据概览数据");
-    }
-
-    /**
-     * 获取直播数据概览详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('system:overview:query')")
-    @GetMapping(value = "/{ksId}")
-    public AjaxResult getInfo(@PathVariable("ksId") Long ksId) {
-        return AjaxResult.success(kuaishouLiveDataOverviewService.selectKuaishouLiveDataOverviewByKsId(ksId));
-    }
-
-    /**
-     * 新增直播数据概览
-     */
-    @PreAuthorize("@ss.hasPermi('system:overview:add')")
-    @Log(title = "直播数据概览", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody KuaishouLiveDataOverview kuaishouLiveDataOverview) {
-        return toAjax(kuaishouLiveDataOverviewService.insertKuaishouLiveDataOverview(kuaishouLiveDataOverview));
-    }
-
-    /**
-     * 修改直播数据概览
-     */
-    @PreAuthorize("@ss.hasPermi('system:overview:edit')")
-    @Log(title = "直播数据概览", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody KuaishouLiveDataOverview kuaishouLiveDataOverview) {
-        return toAjax(kuaishouLiveDataOverviewService.updateKuaishouLiveDataOverview(kuaishouLiveDataOverview));
-    }
-
-    /**
-     * 删除直播数据概览
-     */
-    @PreAuthorize("@ss.hasPermi('system:overview:remove')")
-    @Log(title = "直播数据概览", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ksIds}")
-    public AjaxResult remove(@PathVariable Long[] ksIds) {
-        return toAjax(kuaishouLiveDataOverviewService.deleteKuaishouLiveDataOverviewByKsIds(ksIds));
-    }
-}

+ 2 - 182
ruixuan-live/src/main/java/com/ruixuan/data/entity/KuaishouLiveDataKanban.java

@@ -3,8 +3,6 @@ package com.ruixuan.data.entity;
 import com.ruixuan.common.annotation.Excel;
 import com.ruixuan.common.annotation.Excel;
 import com.ruixuan.common.core.domain.BaseEntity;
 import com.ruixuan.common.core.domain.BaseEntity;
 import lombok.Data;
 import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 
 
@@ -64,13 +62,13 @@ public class KuaishouLiveDataKanban extends BaseEntity {
      * 人均观看时长
      * 人均观看时长
      */
      */
     @Excel(name = "人均观看时长")
     @Excel(name = "人均观看时长")
-    private Long perViewingTime;
+    private String perViewingTime;
 
 
     /**
     /**
      * 粉丝平均观看时长
      * 粉丝平均观看时长
      */
      */
     @Excel(name = "粉丝平均观看时长")
     @Excel(name = "粉丝平均观看时长")
-    private Long fansViewingTime;
+    private String fansViewingTime;
 
 
     /**
     /**
      * 打赏数
      * 打赏数
@@ -132,182 +130,4 @@ public class KuaishouLiveDataKanban extends BaseEntity {
     @Excel(name = "成交转化率")
     @Excel(name = "成交转化率")
     private String turnoverRatio;
     private String turnoverRatio;
 
 
-    public void setKsId(Long ksId) {
-        this.ksId = ksId;
-    }
-
-    public Long getKsId() {
-        return ksId;
-    }
-
-    public void setKsName(String ksName) {
-        this.ksName = ksName;
-    }
-
-    public String getKsName() {
-        return ksName;
-    }
-
-    public void setAccountId(Long accountId) {
-        this.accountId = accountId;
-    }
-
-    public Long getAccountId() {
-        return accountId;
-    }
-
-    public void setAccountName(String accountName) {
-        this.accountName = accountName;
-    }
-
-    public String getAccountName() {
-        return accountName;
-    }
-
-    public void setOnlineViewers(Long onlineViewers) {
-        this.onlineViewers = onlineViewers;
-    }
-
-    public Long getOnlineViewers() {
-        return onlineViewers;
-    }
-
-    public void setViewers(Long viewers) {
-        this.viewers = viewers;
-    }
-
-    public Long getViewers() {
-        return viewers;
-    }
-
-    public void setViewingTimes(Long viewingTimes) {
-        this.viewingTimes = viewingTimes;
-    }
-
-    public Long getViewingTimes() {
-        return viewingTimes;
-    }
-
-    public void setPerViewingTime(Long perViewingTime) {
-        this.perViewingTime = perViewingTime;
-    }
-
-    public Long getPerViewingTime() {
-        return perViewingTime;
-    }
-
-    public void setFansViewingTime(Long fansViewingTime) {
-        this.fansViewingTime = fansViewingTime;
-    }
-
-    public Long getFansViewingTime() {
-        return fansViewingTime;
-    }
-
-    public void setRewards(Long rewards) {
-        this.rewards = rewards;
-    }
-
-    public Long getRewards() {
-        return rewards;
-    }
-
-    public void setPutWares(Long putWares) {
-        this.putWares = putWares;
-    }
-
-    public Long getPutWares() {
-        return putWares;
-    }
-
-    public void setNewFans(Long newFans) {
-        this.newFans = newFans;
-    }
-
-    public Long getNewFans() {
-        return newFans;
-    }
-
-    public void setLikes(Long likes) {
-        this.likes = likes;
-    }
-
-    public Long getLikes() {
-        return likes;
-    }
-
-    public void setWaresClicks(Long waresClicks) {
-        this.waresClicks = waresClicks;
-    }
-
-    public Long getWaresClicks() {
-        return waresClicks;
-    }
-
-    public void setCarClicks(Long carClicks) {
-        this.carClicks = carClicks;
-    }
-
-    public Long getCarClicks() {
-        return carClicks;
-    }
-
-    public void setAllAmount(BigDecimal allAmount) {
-        this.allAmount = allAmount;
-    }
-
-    public BigDecimal getAllAmount() {
-        return allAmount;
-    }
-
-    public void setAllTurnover(Long allTurnover) {
-        this.allTurnover = allTurnover;
-    }
-
-    public Long getAllTurnover() {
-        return allTurnover;
-    }
-
-    public void setAllOrders(Long allOrders) {
-        this.allOrders = allOrders;
-    }
-
-    public Long getAllOrders() {
-        return allOrders;
-    }
-
-    public void setTurnoverRatio(String turnoverRatio) {
-        this.turnoverRatio = turnoverRatio;
-    }
-
-    public String getTurnoverRatio() {
-        return turnoverRatio;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
-                .append("ksId", getKsId())
-                .append("ksName", getKsName())
-                .append("accountId", getAccountId())
-                .append("accountName", getAccountName())
-                .append("onlineViewers", getOnlineViewers())
-                .append("viewers", getViewers())
-                .append("viewingTimes", getViewingTimes())
-                .append("perViewingTime", getPerViewingTime())
-                .append("fansViewingTime", getFansViewingTime())
-                .append("rewards", getRewards())
-                .append("putWares", getPutWares())
-                .append("newFans", getNewFans())
-                .append("likes", getLikes())
-                .append("waresClicks", getWaresClicks())
-                .append("carClicks", getCarClicks())
-                .append("allAmount", getAllAmount())
-                .append("allTurnover", getAllTurnover())
-                .append("allOrders", getAllOrders())
-                .append("turnoverRatio", getTurnoverRatio())
-                .append("createTime", getCreateTime())
-                .append("updateTime", getUpdateTime())
-                .toString();
-    }
 }
 }

+ 4 - 0
ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataAnalysisMapper.java

@@ -1,6 +1,8 @@
 package com.ruixuan.data.mapper;
 package com.ruixuan.data.mapper;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
 import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
+import org.apache.ibatis.annotations.Param;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -58,4 +60,6 @@ public interface KuaishouLiveDataAnalysisMapper {
      * @return 结果
      * @return 结果
      */
      */
     public int deleteKuaishouLiveDataAnalysisByKsIds(Long[] ksIds);
     public int deleteKuaishouLiveDataAnalysisByKsIds(Long[] ksIds);
+
+    int inserExcelBatchInfo(@Param(value = "analysisList") List<KuaishouLiveDataAnalysis> analysisList);
 }
 }

+ 4 - 0
ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataFunnelMapper.java

@@ -1,6 +1,8 @@
 package com.ruixuan.data.mapper;
 package com.ruixuan.data.mapper;
 
 
+import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
 import com.ruixuan.data.entity.KuaishouLiveDataFunnel;
 import com.ruixuan.data.entity.KuaishouLiveDataFunnel;
+import org.apache.ibatis.annotations.Param;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -58,4 +60,6 @@ public interface KuaishouLiveDataFunnelMapper {
      * @return 结果
      * @return 结果
      */
      */
     public int deleteKuaishouLiveDataFunnelByKsIds(Long[] ksIds);
     public int deleteKuaishouLiveDataFunnelByKsIds(Long[] ksIds);
+
+    int inserExcelBatchInfo(@Param(value = "funnelList")  List<KuaishouLiveDataFunnel> funnelList);
 }
 }

+ 3 - 0
ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataKanbanMapper.java

@@ -1,6 +1,7 @@
 package com.ruixuan.data.mapper;
 package com.ruixuan.data.mapper;
 
 
 import com.ruixuan.data.entity.KuaishouLiveDataKanban;
 import com.ruixuan.data.entity.KuaishouLiveDataKanban;
+import org.apache.ibatis.annotations.Param;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -58,4 +59,6 @@ public interface KuaishouLiveDataKanbanMapper {
      * @return 结果
      * @return 结果
      */
      */
     public int deleteKuaishouLiveDataKanbanByKsIds(Long[] ksIds);
     public int deleteKuaishouLiveDataKanbanByKsIds(Long[] ksIds);
+
+    int inserExcelBatchInfo(@Param(value = "kanbanList") List<KuaishouLiveDataKanban> kanbanList);
 }
 }

+ 3 - 0
ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataOverviewMapper.java

@@ -1,6 +1,7 @@
 package com.ruixuan.data.mapper;
 package com.ruixuan.data.mapper;
 
 
 import com.ruixuan.data.entity.KuaishouLiveDataOverview;
 import com.ruixuan.data.entity.KuaishouLiveDataOverview;
+import org.apache.ibatis.annotations.Param;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -58,4 +59,6 @@ public interface KuaishouLiveDataOverviewMapper {
      * @return 结果
      * @return 结果
      */
      */
     public int deleteKuaishouLiveDataOverviewByKsIds(Long[] ksIds);
     public int deleteKuaishouLiveDataOverviewByKsIds(Long[] ksIds);
+
+    int inserExcelBatchInfo(@Param(value = "overviewList") List<KuaishouLiveDataOverview> overviewList);
 }
 }

+ 4 - 0
ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataAnalysisService.java

@@ -1,6 +1,8 @@
 package com.ruixuan.data.service;
 package com.ruixuan.data.service;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
 import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -58,4 +60,6 @@ public interface IKuaishouLiveDataAnalysisService {
      * @return 结果
      * @return 结果
      */
      */
     public int deleteKuaishouLiveDataAnalysisByKsId(Long ksId);
     public int deleteKuaishouLiveDataAnalysisByKsId(Long ksId);
+
+    int inserExcelInfo(KuaishouLiveBroadcast broadcast,List<JSONObject> list);
 }
 }

+ 4 - 0
ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataFunnelService.java

@@ -1,6 +1,8 @@
 package com.ruixuan.data.service;
 package com.ruixuan.data.service;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.data.entity.KuaishouLiveDataFunnel;
 import com.ruixuan.data.entity.KuaishouLiveDataFunnel;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -58,4 +60,6 @@ public interface IKuaishouLiveDataFunnelService {
      * @return 结果
      * @return 结果
      */
      */
     public int deleteKuaishouLiveDataFunnelByKsId(Long ksId);
     public int deleteKuaishouLiveDataFunnelByKsId(Long ksId);
+
+    int inserExcelInfo(KuaishouLiveBroadcast broadcast,List<JSONObject> list);
 }
 }

+ 4 - 0
ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataKanbanService.java

@@ -1,6 +1,8 @@
 package com.ruixuan.data.service;
 package com.ruixuan.data.service;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.data.entity.KuaishouLiveDataKanban;
 import com.ruixuan.data.entity.KuaishouLiveDataKanban;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -58,4 +60,6 @@ public interface IKuaishouLiveDataKanbanService {
      * @return 结果
      * @return 结果
      */
      */
     public int deleteKuaishouLiveDataKanbanByKsId(Long ksId);
     public int deleteKuaishouLiveDataKanbanByKsId(Long ksId);
+
+    int inserExcelInfo(KuaishouLiveBroadcast broadcast,List<JSONObject> list);
 }
 }

+ 4 - 0
ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataOverviewService.java

@@ -1,6 +1,8 @@
 package com.ruixuan.data.service;
 package com.ruixuan.data.service;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.data.entity.KuaishouLiveDataOverview;
 import com.ruixuan.data.entity.KuaishouLiveDataOverview;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -58,4 +60,6 @@ public interface IKuaishouLiveDataOverviewService {
      * @return 结果
      * @return 结果
      */
      */
     public int deleteKuaishouLiveDataOverviewByKsId(Long ksId);
     public int deleteKuaishouLiveDataOverviewByKsId(Long ksId);
+
+    int inserExcelInfo(KuaishouLiveBroadcast broadcast,List<JSONObject> list);
 }
 }

+ 35 - 0
ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataAnalysisServiceImpl.java

@@ -1,12 +1,15 @@
 package com.ruixuan.data.service.impl;
 package com.ruixuan.data.service.impl;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
 import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
 import com.ruixuan.data.mapper.KuaishouLiveDataAnalysisMapper;
 import com.ruixuan.data.mapper.KuaishouLiveDataAnalysisMapper;
 import com.ruixuan.data.service.IKuaishouLiveDataAnalysisService;
 import com.ruixuan.data.service.IKuaishouLiveDataAnalysisService;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -87,4 +90,36 @@ public class KuaishouLiveDataAnalysisServiceImpl implements IKuaishouLiveDataAna
     public int deleteKuaishouLiveDataAnalysisByKsId(Long ksId) {
     public int deleteKuaishouLiveDataAnalysisByKsId(Long ksId) {
         return kuaishouLiveDataAnalysisMapper.deleteKuaishouLiveDataAnalysisByKsId(ksId);
         return kuaishouLiveDataAnalysisMapper.deleteKuaishouLiveDataAnalysisByKsId(ksId);
     }
     }
+
+    @Override
+    public int inserExcelInfo(KuaishouLiveBroadcast broadcast, List<JSONObject> list) {
+        /* excel表头:商品名称	商品上架时间	商品价格	商品销售额	商品销量	待支付订单数
+           对应字段编码:0,1,2...
+         */
+        try {
+            List<KuaishouLiveDataAnalysis> analysisList = new ArrayList<>();
+            for (JSONObject cell : list) {
+                KuaishouLiveDataAnalysis analysis = new KuaishouLiveDataAnalysis();
+                analysis.setKsId(broadcast.getKsId());
+                analysis.setKsName(broadcast.getKsName());
+                analysis.setAccountId(broadcast.getAccountId());
+                analysis.setAccountName(broadcast.getAccountName());
+                analysis.setWaresName(cell.getString("0"));
+                analysis.setWaresPutDate(cell.getString("1"));
+                analysis.setWaresPrice(cell.getBigDecimal("2"));
+                analysis.setWaresSalesAmount(cell.getBigDecimal("3"));
+                analysis.setWaresSalesVolume(cell.getBigDecimal("4"));
+                analysis.setTopayOrders(cell.getLong("5"));
+                analysisList.add(analysis);
+            }
+
+            int i = kuaishouLiveDataAnalysisMapper.inserExcelBatchInfo(analysisList);
+            if (i > 0) {
+                return 1;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return 0;
+    }
 }
 }

+ 29 - 0
ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataFunnelServiceImpl.java

@@ -1,12 +1,15 @@
 package com.ruixuan.data.service.impl;
 package com.ruixuan.data.service.impl;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.data.entity.KuaishouLiveDataFunnel;
 import com.ruixuan.data.entity.KuaishouLiveDataFunnel;
 import com.ruixuan.data.mapper.KuaishouLiveDataFunnelMapper;
 import com.ruixuan.data.mapper.KuaishouLiveDataFunnelMapper;
 import com.ruixuan.data.service.IKuaishouLiveDataFunnelService;
 import com.ruixuan.data.service.IKuaishouLiveDataFunnelService;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -87,4 +90,30 @@ public class KuaishouLiveDataFunnelServiceImpl implements IKuaishouLiveDataFunne
     public int deleteKuaishouLiveDataFunnelByKsId(Long ksId) {
     public int deleteKuaishouLiveDataFunnelByKsId(Long ksId) {
         return kuaishouLiveDataFunnelMapper.deleteKuaishouLiveDataFunnelByKsId(ksId);
         return kuaishouLiveDataFunnelMapper.deleteKuaishouLiveDataFunnelByKsId(ksId);
     }
     }
+
+    @Override
+    public int inserExcelInfo(KuaishouLiveBroadcast broadcast, List<JSONObject> list) {
+         /* excel表头:日期	累计观看人数
+           对应字段编码:0,1         */
+        try {
+            List<KuaishouLiveDataFunnel> funnelList = new ArrayList<>();
+            for (JSONObject cell : list) {
+                KuaishouLiveDataFunnel funnel = new KuaishouLiveDataFunnel();
+                funnel.setKsId(broadcast.getKsId());
+                funnel.setKsName(broadcast.getKsName());
+                funnel.setAccountId(broadcast.getAccountId());
+                funnel.setAccountName(broadcast.getAccountName());
+                funnel.setStatDate(cell.getString("0"));
+                funnel.setAllViewers(cell.getLong("1"));
+                funnelList.add(funnel);
+            }
+            int i = kuaishouLiveDataFunnelMapper.inserExcelBatchInfo(funnelList);
+            if (i > 0) {
+                return 1;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return 0;
+    }
 }
 }

+ 44 - 0
ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataKanbanServiceImpl.java

@@ -1,12 +1,15 @@
 package com.ruixuan.data.service.impl;
 package com.ruixuan.data.service.impl;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.data.entity.KuaishouLiveDataKanban;
 import com.ruixuan.data.entity.KuaishouLiveDataKanban;
 import com.ruixuan.data.mapper.KuaishouLiveDataKanbanMapper;
 import com.ruixuan.data.mapper.KuaishouLiveDataKanbanMapper;
 import com.ruixuan.data.service.IKuaishouLiveDataKanbanService;
 import com.ruixuan.data.service.IKuaishouLiveDataKanbanService;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -87,4 +90,45 @@ public class KuaishouLiveDataKanbanServiceImpl implements IKuaishouLiveDataKanba
     public int deleteKuaishouLiveDataKanbanByKsId(Long ksId) {
     public int deleteKuaishouLiveDataKanbanByKsId(Long ksId) {
         return kuaishouLiveDataKanbanMapper.deleteKuaishouLiveDataKanbanByKsId(ksId);
         return kuaishouLiveDataKanbanMapper.deleteKuaishouLiveDataKanbanByKsId(ksId);
     }
     }
+
+    @Override
+    public int inserExcelInfo(KuaishouLiveBroadcast broadcast, List<JSONObject> list) {
+      /* excel表头:实时在线观看人数	观看人数	观看次数	人均观看时长	粉丝平均观看时长	打赏数	上架商品数
+      新增粉丝数	点赞数	商品点击人数	小黄车点击数	累计成交金额	累计成交人数	累计成交订单数	成交转化率
+           对应字段编码:0,1,2....         */
+        try {
+            List<KuaishouLiveDataKanban> kanbanList = new ArrayList<>();
+            for (JSONObject cell : list) {
+                KuaishouLiveDataKanban kanban = new KuaishouLiveDataKanban();
+                kanban.setKsId(broadcast.getKsId());
+                kanban.setKsName(broadcast.getKsName());
+                kanban.setAccountId(broadcast.getAccountId());
+                kanban.setAccountName(broadcast.getAccountName());
+                kanban.setOnlineViewers(cell.getLong("0"));
+                kanban.setViewers(cell.getLong("1"));
+                kanban.setViewingTimes(cell.getLong("2"));
+                kanban.setPerViewingTime(cell.getString("3"));
+                kanban.setFansViewingTime(cell.getString("4"));
+                kanban.setRewards(cell.getLong("5"));
+                kanban.setPutWares(cell.getLong("6"));
+                kanban.setNewFans(cell.getLong("7"));
+                kanban.setLikes(cell.getLong("8"));
+                kanban.setWaresClicks(cell.getLong("9"));
+                kanban.setCarClicks(cell.getLong("10"));
+                kanban.setAllAmount(cell.getBigDecimal("11"));
+                kanban.setAllTurnover(cell.getLong("12"));
+                kanban.setAllOrders(cell.getLong("13"));
+                kanban.setTurnoverRatio(cell.getString("14"));
+                kanbanList.add(kanban);
+            }
+
+            int i = kuaishouLiveDataKanbanMapper.inserExcelBatchInfo(kanbanList);
+            if (i > 0) {
+                return 1;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return 0;
+    }
 }
 }

+ 31 - 0
ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataOverviewServiceImpl.java

@@ -1,12 +1,15 @@
 package com.ruixuan.data.service.impl;
 package com.ruixuan.data.service.impl;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.data.entity.KuaishouLiveDataOverview;
 import com.ruixuan.data.entity.KuaishouLiveDataOverview;
 import com.ruixuan.data.mapper.KuaishouLiveDataOverviewMapper;
 import com.ruixuan.data.mapper.KuaishouLiveDataOverviewMapper;
 import com.ruixuan.data.service.IKuaishouLiveDataOverviewService;
 import com.ruixuan.data.service.IKuaishouLiveDataOverviewService;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -87,4 +90,32 @@ public class KuaishouLiveDataOverviewServiceImpl implements IKuaishouLiveDataOve
     public int deleteKuaishouLiveDataOverviewByKsId(Long ksId) {
     public int deleteKuaishouLiveDataOverviewByKsId(Long ksId) {
         return kuaishouLiveDataOverviewMapper.deleteKuaishouLiveDataOverviewByKsId(ksId);
         return kuaishouLiveDataOverviewMapper.deleteKuaishouLiveDataOverviewByKsId(ksId);
     }
     }
+
+    @Override
+    public int inserExcelInfo(KuaishouLiveBroadcast broadcast, List<JSONObject> list) {
+        /* excel表头:日期	成交金额
+        对应字段编码:0,1
+        */
+        try {
+            List<KuaishouLiveDataOverview> overviewList = new ArrayList<>();
+            for (JSONObject cell : list) {
+                KuaishouLiveDataOverview overview = new KuaishouLiveDataOverview();
+                overview.setKsId(broadcast.getKsId());
+                overview.setKsName(broadcast.getKsName());
+                overview.setAccountId(broadcast.getAccountId());
+                overview.setAccountName(broadcast.getAccountName());
+                overview.setStatDate(cell.getString("0"));
+                overview.setAmounts(cell.getBigDecimal("1"));
+                overviewList.add(overview);
+            }
+            int i = kuaishouLiveDataOverviewMapper.inserExcelBatchInfo(overviewList);
+            if (i > 0) {
+                return 1;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return 0;
+
+    }
 }
 }

+ 389 - 0
ruixuan-live/src/main/java/com/ruixuan/data/utils/ExportExcelUtils.java

@@ -0,0 +1,389 @@
+package com.ruixuan.data.utils;
+
+
+import com.ruixuan.common.utils.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.ss.usermodel.BorderStyle;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.FillPatternType;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.VerticalAlignment;
+import org.apache.poi.xssf.usermodel.XSSFCell;
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
+import org.apache.poi.xssf.usermodel.XSSFFont;
+import org.apache.poi.xssf.usermodel.XSSFRichTextString;
+import org.apache.poi.xssf.usermodel.XSSFRow;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+public class ExportExcelUtils {
+
+
+    /**
+     * @param workbook
+     * @param sheetNum   (sheet的位置,0表示第一个表格中的第一个sheet)
+     * @param sheetTitle (sheet的名称)
+     * @param headers    (表格的标题)
+     * @param result     (表格的数据)
+     * @return
+     * @throws Exception
+     * @Title: exportExcel
+     * @Description: 导出Excel的方法
+     */
+
+    public void exportExcel(XSSFWorkbook workbook, int sheetNum,
+                            String sheetTitle, String[] headers, List<List<Object>> result) {
+        // 生成一个表格
+        XSSFSheet sheet = workbook.createSheet();
+        workbook.setSheetName(sheetNum, sheetTitle);
+        // 设置表格默认列宽度为20个字节
+        sheet.setDefaultColumnWidth((short) 20);
+        // 生成一个样式
+        XSSFCellStyle style = workbook.createCellStyle();
+        // 设置这些样式
+        style.setFillForegroundColor(IndexedColors.PALE_BLUE.index);
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        style.setBorderBottom(BorderStyle.THIN);
+        style.setBorderLeft(BorderStyle.THIN);
+        style.setBorderRight(BorderStyle.THIN);
+        style.setBorderTop(BorderStyle.THIN);
+        // style.setAlignment(HorizontalAlignment.CENTER);
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
+        // 生成一个字体
+        XSSFFont font = workbook.createFont();
+        font.setColor(IndexedColors.BLACK.index);
+        font.setFontHeightInPoints((short) 12);
+        font.setBold(true);
+        // 把字体应用到当前的样式
+        style.setFont(font);
+
+        // 指定当单元格内容显示不下时自动换行
+        style.setWrapText(true);
+
+        // 产生表格标题行
+        XSSFRow row = sheet.createRow(0);
+        for (int i = 0; i < headers.length; i++) {
+            XSSFCell cell = row.createCell((short) i);
+            cell.setCellStyle(style);
+            XSSFRichTextString text = new XSSFRichTextString(headers[i]);
+            cell.setCellValue(text.toString());
+        }
+        // 遍历集合数据,产生数据行
+        if (result != null) {
+            int index = 1;
+            for (List<Object> m : result) {
+                row = sheet.createRow(index);
+                int cellIndex = 0;
+                for (Object obj : m) {
+                    XSSFCell cell = row.createCell((short) cellIndex);
+                    if (!StringUtils.isNull(obj)) {
+                        if (obj instanceof String) {
+                            cell.setCellValue((String) obj);
+                        } else if (obj instanceof Double) {
+                            cell.setCellValue((Double) obj);
+                        } else if (obj instanceof BigDecimal) {
+                            BigDecimal bigDecimal = (BigDecimal) obj;
+                            cell.setCellValue(bigDecimal.doubleValue());
+                        } else if (obj instanceof Long) {
+                            cell.setCellValue(String.valueOf(obj));
+                        } else {
+                            cell.setCellValue(obj.toString());
+                        }
+                    } else {
+                        cell.setCellValue(0);
+                    }
+
+                    cellIndex++;
+                }
+                index++;
+            }
+        }
+    }
+
+
+    public void exportExcelForAttendance(XSSFWorkbook workbook, int sheetNum, String sheetTitle, String[] headers, List<List<Object>> result) {
+        // 生成一个表格
+        XSSFSheet sheet = workbook.createSheet();
+        workbook.setSheetName(sheetNum, sheetTitle);
+        // 设置表格默认列宽度为20个字节
+        sheet.setDefaultColumnWidth((short) 20);
+        // 生成一个样式
+        XSSFCellStyle style = workbook.createCellStyle();
+        XSSFCellStyle style2 = workbook.createCellStyle();
+        XSSFCellStyle style3 = workbook.createCellStyle();
+        // 设置这些样式
+        style.setFillForegroundColor(IndexedColors.PALE_BLUE.index);
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        style.setBorderBottom(BorderStyle.THIN);
+        style.setBorderLeft(BorderStyle.THIN);
+        style.setBorderRight(BorderStyle.THIN);
+        style.setBorderTop(BorderStyle.THIN);
+        // style.setAlignment(HorizontalAlignment.CENTER);
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
+        // 生成一个字体
+        XSSFFont font = workbook.createFont();
+        font.setColor(IndexedColors.BLACK.index);
+        font.setFontHeightInPoints((short) 12);
+        font.setBold(true);
+        // 把字体应用到当前的样式
+        style.setFont(font);
+
+        // 指定当单元格内容显示不下时自动换行
+        style.setWrapText(true);
+        //迟到时间超过15分钟的考勤记录样式(标黄)
+        style2.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.index);
+        style2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        style2.setBorderBottom(BorderStyle.THIN);
+        style2.setBorderLeft(BorderStyle.THIN);
+        style2.setBorderRight(BorderStyle.THIN);
+        style2.setBorderTop(BorderStyle.THIN);
+        // 产生表格标题行
+        XSSFRow row = sheet.createRow(0);
+        for (int i = 0; i < headers.length; i++) {
+            XSSFCell cell = row.createCell((short) i);
+            cell.setCellStyle(style);
+            XSSFRichTextString text = new XSSFRichTextString(headers[i]);
+            cell.setCellValue(text.toString());
+        }
+        // 遍历集合数据,产生数据行
+        if (result != null) {
+            int index = 1;
+            for (List<Object> m : result) {
+                row = sheet.createRow(index);
+                int cellIndex = 0;
+                //迟到时间超过15分钟的考勤记录判断
+                boolean changeColor = false;
+                if (m.contains("迟到")) {
+                    String duration = String.valueOf(m.get(m.size() - 2));
+                    if (!StringUtils.isNull(duration) && Integer.valueOf(duration.replace(" min", "")) - 10 > 0) {
+                        changeColor = true;
+                    }
+                }
+                for (Object obj : m) {
+                    XSSFCell cell = row.createCell((short) cellIndex);
+                    if (!StringUtils.isNull(obj)) {
+                        if (changeColor) {
+                            cell.setCellStyle(style2);
+                        }
+                        if (obj instanceof String) {
+                            cell.setCellValue((String) obj);
+                        } else if (obj instanceof Double) {
+                            cell.setCellValue((Double) obj);
+                        } else if (obj instanceof BigDecimal) {
+                            BigDecimal bigDecimal = (BigDecimal) obj;
+                            cell.setCellValue(bigDecimal.doubleValue());
+                        } else if (obj instanceof Long) {
+                            cell.setCellValue(String.valueOf(obj));
+                        } else {
+                            cell.setCellValue(obj.toString());
+                        }
+                    }
+                    cellIndex++;
+                }
+                index++;
+            }
+        }
+    }
+
+    public void exportExcelForMediaReport(XSSFWorkbook workbook, int sheetNum, String sheetTitle, String[] headers, List<List<Object>> result) {
+        // 生成一个表格
+        XSSFSheet sheet = workbook.createSheet();
+        workbook.setSheetName(sheetNum, sheetTitle);
+        // 设置表格默认列宽度为20个字节
+        sheet.setDefaultColumnWidth((short) 20);
+        sheet.setColumnWidth(0, 15 * 256);
+        sheet.setColumnWidth(1, 40 * 256);
+        sheet.setColumnWidth(2, 30 * 256);
+        sheet.setColumnWidth(3, 35 * 256);
+        sheet.setColumnWidth(4, 20 * 256);
+        sheet.setColumnWidth(5, 20 * 256);
+        sheet.setColumnWidth(6, 20 * 256);
+        sheet.setColumnWidth(7, 20 * 256);
+        sheet.setColumnWidth(8, 15 * 256);
+        // 生成一个样式
+        XSSFCellStyle style = workbook.createCellStyle();
+        // 设置这些样式
+        style.setFillForegroundColor(IndexedColors.PALE_BLUE.index);
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        style.setBorderBottom(BorderStyle.THIN);
+        style.setBorderLeft(BorderStyle.THIN);
+        style.setBorderRight(BorderStyle.THIN);
+        style.setBorderTop(BorderStyle.THIN);
+        // style.setAlignment(HorizontalAlignment.CENTER);
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
+        // 生成一个字体
+        XSSFFont font = workbook.createFont();
+        font.setColor(IndexedColors.BLACK.index);
+        font.setFontHeightInPoints((short) 12);
+        font.setBold(true);
+        // 把字体应用到当前的样式
+        style.setFont(font);
+
+        // 指定当单元格内容显示不下时自动换行
+        style.setWrapText(true);
+
+        //同一行第一个cell
+        XSSFCellStyle cellStyle = workbook.createCellStyle();
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setWrapText(true);
+
+        // 产生表格标题行
+        XSSFRow row = sheet.createRow(0);
+        for (int i = 0; i < headers.length; i++) {
+            XSSFCell cell = row.createCell((short) i);
+            cell.setCellStyle(style);
+            XSSFRichTextString text = new XSSFRichTextString(headers[i]);
+            cell.setCellValue(text.toString());
+        }
+        // 遍历集合数据,产生数据行
+        if (result != null) {
+            int index = 1;
+            for (List<Object> m : result) {
+                row = sheet.createRow(index);
+                int cellIndex = 0;
+
+                for (Object obj : m) {
+                    XSSFCell cell = row.createCell((short) cellIndex);
+                    if (!StringUtils.isNull(obj)) {
+                        if (obj instanceof String) {
+                            cell.setCellValue((String) obj);
+                        } else if (obj instanceof Double) {
+                            cell.setCellValue((Double) obj);
+                        } else if (obj instanceof BigDecimal) {
+                            BigDecimal bigDecimal = (BigDecimal) obj;
+                            cell.setCellValue(bigDecimal.doubleValue());
+                        } else if (obj instanceof Long) {
+                            cell.setCellValue(String.valueOf(obj));
+                        } else {
+                            cell.setCellValue(obj.toString());
+                        }
+                    } else {
+                        cell.setCellValue(0);
+                    }
+                    cell.setCellStyle(cellStyle);
+
+                    cellIndex++;
+                }
+                index++;
+            }
+        }
+    }
+
+    //发送响应流方法
+    public void putResponseHeader(HttpServletResponse response, String fileName) {
+        try {
+            try {
+                fileName = new String(fileName.getBytes(), "ISO8859-1");
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+//            response.setContentType("multipart/form-data;charset=ISO8859-1");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.addHeader("Pargam", "no-cache");
+            response.addHeader("Cache-Control", "no-cache");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public String getCellValue(Cell cell) {
+        String value = "";
+        if (cell != null) {
+            // 以下是判断数据的类型
+            switch (cell.getCellType()) {
+                case NUMERIC: // 数字
+                    value = cell.getNumericCellValue() + "";
+                    if (HSSFDateUtil.isCellDateFormatted(cell)) {
+                        Date date = cell.getDateCellValue();
+                        if (date != null) {
+                            if (date.getHours() > 0 || date.getMinutes() > 0) {
+                                value = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
+                            } else {
+                                value = new SimpleDateFormat("yyyy-MM-dd").format(date);
+                            }
+                        } else {
+                            value = "";
+                        }
+                    } else {
+                        value = new DecimalFormat("0.00").format(cell.getNumericCellValue()).replace(".00", "");
+                    }
+                    break;
+                case STRING: // 字符串
+                    value = cell.getStringCellValue();
+                    break;
+                case BOOLEAN: // Boolean
+                    value = cell.getBooleanCellValue() + "";
+                    break;
+                case FORMULA: // 公式
+                    value = cell.getCellFormula() + "";
+                    break;
+                case BLANK: // 空值
+                    value = "";
+                    break;
+                case ERROR: // 故障
+                    value = "非法字符";
+                    break;
+                default:
+                    value = "未知类型";
+                    break;
+            }
+        }
+        return value.trim();
+    }
+
+    public void putHeaders(XSSFWorkbook workbook, int sheetNum, String sheetTitle, String[] headers) {
+        // 生成一个表格
+        XSSFSheet sheet = workbook.createSheet();
+        workbook.setSheetName(sheetNum, sheetTitle);
+        // 设置表格默认列宽度为20个字节
+        sheet.setDefaultColumnWidth((short) 30);
+        // 生成一个样式
+        XSSFCellStyle style = workbook.createCellStyle();
+        // 设置这些样式
+        style.setFillForegroundColor(IndexedColors.PALE_BLUE.index);
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        style.setBorderBottom(BorderStyle.THIN);
+        style.setBorderLeft(BorderStyle.THIN);
+        style.setBorderRight(BorderStyle.THIN);
+        style.setBorderTop(BorderStyle.THIN);
+        // style.setAlignment(HorizontalAlignment.CENTER);
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
+        // 生成一个字体
+        XSSFFont font = workbook.createFont();
+        font.setColor(IndexedColors.BLACK.index);
+        font.setFontHeightInPoints((short) 12);
+        //加粗
+        font.setBold(true);
+        // 把字体应用到当前的样式
+        style.setFont(font);
+
+        // 指定当单元格内容显示不下时自动换行
+        style.setWrapText(true);
+        //记录样式(标黄)
+//        style.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.index);
+
+        // 产生表格标题行
+        XSSFRow row = sheet.createRow(0);
+        for (int i = 0; i < headers.length; i++) {
+            XSSFCell cell = row.createCell((short) i);
+            cell.setCellStyle(style);
+            XSSFRichTextString text = new XSSFRichTextString(headers[i]);
+            cell.setCellValue(text.toString());
+        }
+    }
+
+}

+ 136 - 0
ruixuan-live/src/main/java/com/ruixuan/data/utils/LiveDataExcelUtils.java

@@ -0,0 +1,136 @@
+package com.ruixuan.data.utils;
+
+import cn.hutool.core.util.CharsetUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.utils.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class LiveDataExcelUtils {
+
+    /**
+     * 数组集转LIST 同时去除多余双引号
+     */
+    public static List<List<String>> getCsvList(List<String[]> records) {
+        List<List<String>> list = new ArrayList<>();
+        for (String[] record : records) {
+            List<String> asList = Arrays.asList(record);
+            asList.replaceAll(t -> t.replace("\"", ""));
+            list.add(asList);
+        }
+        return list;
+    }
+
+    /**
+     * 1、判断是否为数字类型(NUMBER)或数字计算公式(NUMBER_FORMULA);
+     * 2、获取解析后的值进行判断是否包含有(E、e、+等符号);
+     * 3、使用java自带数学类,将科学计算公式转换成所需类型。
+     *
+     * @return
+     */
+    public static String NUMBER_FORMULA(String E_Value) {
+        String value = null;
+
+        // 判断是否为科学计数法(包含E、e、+等符号)
+        if ((("" + E_Value).indexOf("E") != -1 || ("" + E_Value).indexOf("e") != -1 || ("" + E_Value).indexOf("+") != -1) && !E_Value.contains("https")) {
+            BigDecimal bd = new BigDecimal("" + E_Value);
+            if (("" + E_Value).indexOf("E") != -1 || ("" + E_Value).indexOf("e") != -1 || ("" + E_Value).indexOf("+") != -1) {
+                bd = new BigDecimal(Double.parseDouble(bd.toString()));
+                value = bd.toString();
+            } else {
+                value = "" + E_Value;
+            }
+        } else {
+            value = "" + E_Value;
+        }
+        return value;
+    }
+
+
+    public static List<JSONObject> analysisFile(MultipartFile file, String fileName) throws Exception {
+        JSONObject returnJson = new JSONObject();
+        Workbook workbook = null;
+        String substring = fileName.substring(fileName.lastIndexOf(".") + 1).toUpperCase();
+        if ("XLS".equals(substring)) {
+            workbook = new HSSFWorkbook(file.getInputStream());
+        } else if ("XLSX".equals(substring)) {
+            workbook = new XSSFWorkbook(file.getInputStream());
+        } else if ("CSV".equals(substring)) {
+            return analysisCsvFile(file);
+        } else {
+            throw new Exception("请上传正确格式的文件,支持扩展名.xls;.xlsx;.csv");
+        }
+        Sheet sheet = workbook.getSheetAt(0);
+        if (StringUtils.isNull(sheet)) {
+            throw new Exception("未读取到Sheet页内容!");
+        }
+        int rows = sheet.getLastRowNum();//行数,一共有多少行+
+        if (rows == 0) {
+            throw new Exception("请填写数据");
+        }
+        ExportExcelUtils eeu = new ExportExcelUtils();
+        //标题行
+        Row titleRow = sheet.getRow(0);
+        //最后一列(列数)
+        int lastCellNum = titleRow.getLastCellNum();
+
+        // list存储数据集
+        List<JSONObject> list = new ArrayList<>();
+        for (int i = 1; i <= rows + 1; i++) {
+            Row row = sheet.getRow(i);
+            if (row != null) {
+                //每行数据对象,按照顺序从0到(lastCellNum-1)记录
+                JSONObject cellEntity = new JSONObject();
+                for (int j = 0; j < lastCellNum; j++) {
+                    cellEntity.put(String.valueOf(j), eeu.getCellValue(row.getCell(j)));
+                }
+                list.add(cellEntity);
+            }
+        }
+        return list;
+    }
+
+    /**
+     * 解析 CSV 格式文件
+     */
+    private static List<JSONObject> analysisCsvFile(MultipartFile file) throws Exception {
+        List<String[]> records = new ArrayList<String[]>();
+        BufferedReader files = new BufferedReader(new InputStreamReader(file.getInputStream(), CharsetUtil.CHARSET_GBK));
+        // file.readLine(); //跳过表头所在的行
+
+        String record;
+        // 遍历数据行并存储在名为records的ArrayList中,每一行records中存储的对象为一个String数组
+        while ((record = files.readLine()) != null) {
+            String fields[] = record.split(",");
+            records.add(fields);
+        }
+        // 关闭文件
+        files.close();
+
+        List<List<String>> cellList = getCsvList(records);
+        // list存储数据集
+        List<JSONObject> list = new ArrayList<>();
+        for (int i = 1; i < cellList.size(); i++) {
+            List<String> values = cellList.get(i);
+            //每行数据对象,按照顺序从0到(lastCellNum-1)记录
+            JSONObject cellEntity = new JSONObject();
+            for (int j = 0; j < values.size(); j++) {
+                cellEntity.put(String.valueOf(j), values.get(j));
+            }
+            list.add(cellEntity);
+        }
+        return list;
+    }
+
+}

+ 77 - 12
ruixuan-live/src/main/java/com/ruixuan/live/controller/KuaishouLiveBroadcastController.java

@@ -3,22 +3,26 @@ package com.ruixuan.live.controller;
 import com.ruixuan.common.annotation.Log;
 import com.ruixuan.common.annotation.Log;
 import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.domain.AjaxResult;
 import com.ruixuan.common.core.domain.AjaxResult;
+import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.core.page.TableDataInfo;
 import com.ruixuan.common.core.page.TableDataInfo;
 import com.ruixuan.common.enums.BusinessType;
 import com.ruixuan.common.enums.BusinessType;
+import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.poi.ExcelUtil;
 import com.ruixuan.common.utils.poi.ExcelUtil;
 import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 import com.ruixuan.live.service.IKuaishouLiveBroadcastService;
 import com.ruixuan.live.service.IKuaishouLiveBroadcastService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 import java.util.List;
@@ -48,29 +52,90 @@ public class KuaishouLiveBroadcastController extends BaseController {
     }
     }
 
 
     /**
     /**
+     * 数据回显编辑
+     */
+    @GetMapping(value = "getForEdit")
+    @ApiOperation(value = "快手—直播数据回显编辑")
+    public ResultResponse getForEdit(@ApiParam("直播id") @RequestParam(value = "id", required = true) String id) {
+        try {
+            return kuaishouLiveBroadcastService.getForEdit(id);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return ResultResponse.error("查询异常");
+        }
+    }
+
+    /**
      * 获取快手—直播详细信息
      * 获取快手—直播详细信息
      */
      */
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") String id) {
-        return AjaxResult.success(kuaishouLiveBroadcastService.selectKuaishouLiveBroadcastById(id));
+    @GetMapping(value = "getById")
+    @ApiOperation(value = "获取快手—直播详细信息")
+    public ResultResponse getInfo(@ApiParam("直播id") @RequestParam(value = "id", required = true) String id) {
+        return kuaishouLiveBroadcastService.selectKuaishouLiveBroadcastById(id);
     }
     }
 
 
     /**
     /**
      * 新增快手—直播
      * 新增快手—直播
      */
      */
-    @Log(title = "快手—直播", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody KuaishouLiveBroadcast kuaishouLiveBroadcast) {
-        return toAjax(kuaishouLiveBroadcastService.insertKuaishouLiveBroadcast(kuaishouLiveBroadcast));
+    @PostMapping(value = "/add")
+    @ApiOperation(value = "新增直播")
+    public ResultResponse add(@RequestBody KuaishouLiveBroadcast kuaishouLiveBroadcast) {
+        return kuaishouLiveBroadcastService.insertKuaishouLiveBroadcast(kuaishouLiveBroadcast);
     }
     }
 
 
     /**
     /**
      * 修改快手—直播
      * 修改快手—直播
      */
      */
-    @Log(title = "快手—直播", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody KuaishouLiveBroadcast kuaishouLiveBroadcast) {
-        return toAjax(kuaishouLiveBroadcastService.updateKuaishouLiveBroadcast(kuaishouLiveBroadcast));
+    @PostMapping(value = "/edit")
+    @ApiOperation(value = "修改直播")
+    public ResultResponse edit(@RequestBody KuaishouLiveBroadcast kuaishouLiveBroadcast) {
+        return kuaishouLiveBroadcastService.updateKuaishouLiveBroadcast(kuaishouLiveBroadcast);
+    }
+
+
+    /**
+     * 数据上传
+     */
+    @PostMapping(value = "/dataUpload")
+    @ApiOperation(value = "数据上传")
+    public ResultResponse dataUpload(
+            @ApiParam("直播id") @RequestParam(value = "id", required = true) String id,
+            @ApiParam("实际GMV") @RequestParam(value = "actualGmv", required = true) Long actualGmv,
+            @ApiParam("文件集") @RequestParam(value = "files", required = false) MultipartFile[] files,
+            @ApiParam("数据大盘图片链接") @RequestParam(value = "dapanUrls", required = false) String dapanUrls,
+            @ApiParam("画像分析图片链接") @RequestParam(value = "portraitUrls", required = false) String portraitUrls) {
+
+        try {
+            if ((Check.isNull(files) || "".equals(files[0].getOriginalFilename())) && Check.isNull(dapanUrls) && Check.isNull(portraitUrls)) {
+                return ResultResponse.error("文件和图片不能同时为空,请上传后操作!");
+            }
+            return kuaishouLiveBroadcastService.dataUpload(id, actualGmv, dapanUrls, portraitUrls, files);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return ResultResponse.error("上传异常");
+        }
+    }
+
+
+    /**
+     * 数据上传
+     */
+    @PostMapping(value = "/replay")
+    @ApiOperation(value = "复盘")
+    public ResultResponse replay(
+            @ApiParam("直播id") @RequestParam(value = "id", required = true) String id,
+            @ApiParam("图片") @RequestParam(value = "replayPictureUrls", required = false) String replayPictureUrls,
+            @ApiParam("复盘数据") @RequestParam(value = "replayFile", required = false) MultipartFile replayFile) {
+
+        try {
+            if ( Check.isNull(replayPictureUrls) && Check.isNull(replayFile)) {
+                return ResultResponse.error("文件和图片不能同时为空,请上传后操作!");
+            }
+            return kuaishouLiveBroadcastService.replay(id, replayPictureUrls, replayFile);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return ResultResponse.error("上传异常");
+        }
     }
     }
 
 
     /**
     /**

+ 3 - 3
ruixuan-live/src/main/java/com/ruixuan/live/controller/KuaishouLiveUserAccountController.java

@@ -18,9 +18,9 @@ import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
@@ -66,7 +66,7 @@ public class KuaishouLiveUserAccountController extends BaseController {
      */
      */
     @GetMapping("/queryRoles")
     @GetMapping("/queryRoles")
     @ApiOperation(value = "查询(1-运营/2-销售)人员集")
     @ApiOperation(value = "查询(1-运营/2-销售)人员集")
-    public ResultResponse queryRoles(String type) {
+    public ResultResponse queryRoles(@ApiParam("类型:1-运营/2-销售") @RequestParam(value = "type", required = true) String type) {
         return kuaishouLiveUserAccountService.queryRoles(type);
         return kuaishouLiveUserAccountService.queryRoles(type);
     }
     }
 
 
@@ -93,7 +93,7 @@ public class KuaishouLiveUserAccountController extends BaseController {
      */
      */
     @GetMapping(value = "getById")
     @GetMapping(value = "getById")
     @ApiOperation(value = "获取快手直播账户详细信息")
     @ApiOperation(value = "获取快手直播账户详细信息")
-    public AjaxResult getInfo(@ApiParam("id")  String id) {
+    public AjaxResult getInfo(@ApiParam("账户id") @RequestParam(value = "id", required = true) String id) {
         return AjaxResult.success(kuaishouLiveUserAccountService.selectKuaishouLiveUserAccountById(id));
         return AjaxResult.success(kuaishouLiveUserAccountService.selectKuaishouLiveUserAccountById(id));
     }
     }
 
 

+ 28 - 26
ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveBroadcast.java

@@ -1,7 +1,8 @@
 package com.ruixuan.live.entity;
 package com.ruixuan.live.entity;
 
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruixuan.common.annotation.Excel;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
@@ -14,6 +15,7 @@ import java.util.Date;
  * @date 2022-05-31
  * @date 2022-05-31
  */
  */
 @Data
 @Data
+@ApiModel(value = "kuaishouLiveBroadcast", description = "快手—直播对象")
 public class KuaishouLiveBroadcast implements Serializable {
 public class KuaishouLiveBroadcast implements Serializable {
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
@@ -25,38 +27,38 @@ public class KuaishouLiveBroadcast implements Serializable {
     /**
     /**
      * 快手ID
      * 快手ID
      */
      */
-    @Excel(name = "快手ID")
+    @ApiModelProperty(name = "快手ID")
     private Long ksId;
     private Long ksId;
 
 
     /**
     /**
      * 快手昵称
      * 快手昵称
      */
      */
-    @Excel(name = "快手昵称")
+    @ApiModelProperty(name = "快手昵称")
     private String ksName;
     private String ksName;
 
 
     /**
     /**
      * 账户ID
      * 账户ID
      */
      */
-    @Excel(name = "账户ID")
+    @ApiModelProperty(name = "账户ID")
     private Long accountId;
     private Long accountId;
 
 
     /**
     /**
      * 账户名称
      * 账户名称
      */
      */
-    @Excel(name = "账户名称")
+    @ApiModelProperty(name = "账户名称")
     private String accountName;
     private String accountName;
 
 
     /**
     /**
      * 实际GMV
      * 实际GMV
      */
      */
-    @Excel(name = "实际GMV")
-    private String actualGmv;
+    @ApiModelProperty(name = "实际GMV")
+    private Long actualGmv;
 
 
     /**
     /**
      * 目标GMV
      * 目标GMV
      */
      */
-    @Excel(name = "目标GMV")
-    private String goalGmv;
+    @ApiModelProperty(name = "目标GMV")
+    private Long goalGmv;
 
 
     private String gmvRoi;
     private String gmvRoi;
 
 
@@ -73,103 +75,103 @@ public class KuaishouLiveBroadcast implements Serializable {
     /**
     /**
      * 直播时间
      * 直播时间
      */
      */
-    @Excel(name = "直播时间")
+    @ApiModelProperty(name = "直播时间")
     private String liveTime;
     private String liveTime;
 
 
     /**
     /**
      * 直播开始时间
      * 直播开始时间
      */
      */
-    @Excel(name = "直播开始时间")
+    @ApiModelProperty(name = "直播开始时间")
     private String startTime;
     private String startTime;
 
 
     /**
     /**
      * 直播结束时间
      * 直播结束时间
      */
      */
-    @Excel(name = "直播结束时间")
+    @ApiModelProperty(name = "直播结束时间")
     private String endTime;
     private String endTime;
 
 
     /**
     /**
      * 直播间级别:S、A、 B
      * 直播间级别:S、A、 B
      */
      */
-    @Excel(name = "直播间级别:S、A、 B")
+    @ApiModelProperty(name = "直播间级别:S、A、 B")
     private String liveLevel;
     private String liveLevel;
 
 
     /**
     /**
      * 主播id
      * 主播id
      */
      */
-    @Excel(name = "主播id")
+    @ApiModelProperty(name = "主播id")
     private String anchorId;
     private String anchorId;
 
 
     /**
     /**
      * 主播
      * 主播
      */
      */
-    @Excel(name = "主播")
+    @ApiModelProperty(name = "主播")
     private String anchor;
     private String anchor;
 
 
     /**
     /**
      * 操盘手id
      * 操盘手id
      */
      */
-    @Excel(name = "操盘手id")
+    @ApiModelProperty(name = "操盘手id")
     private String traderId;
     private String traderId;
 
 
     /**
     /**
      * 操盘手
      * 操盘手
      */
      */
-    @Excel(name = "操盘手")
+    @ApiModelProperty(name = "操盘手")
     private String trader;
     private String trader;
 
 
     /**
     /**
      * 中控id
      * 中控id
      */
      */
-    @Excel(name = "中控id")
+    @ApiModelProperty(name = "中控id")
     private String centralControlId;
     private String centralControlId;
 
 
     /**
     /**
      * 中控
      * 中控
      */
      */
-    @Excel(name = "中控")
+    @ApiModelProperty(name = "中控")
     private String centralController;
     private String centralController;
 
 
     /**
     /**
      * 场控id
      * 场控id
      */
      */
-    @Excel(name = "场控id")
+    @ApiModelProperty(name = "场控id")
     private String fieldControlId;
     private String fieldControlId;
 
 
     /**
     /**
      * 场控
      * 场控
      */
      */
-    @Excel(name = "场控")
+    @ApiModelProperty(name = "场控")
     private String fieldController;
     private String fieldController;
 
 
     /**
     /**
      * 内容id
      * 内容id
      */
      */
-    @Excel(name = "内容id")
+    @ApiModelProperty(name = "内容id")
     private String contentControlId;
     private String contentControlId;
 
 
     /**
     /**
      * 内容
      * 内容
      */
      */
-    @Excel(name = "内容")
+    @ApiModelProperty(name = "内容")
     private String contentController;
     private String contentController;
 
 
     /**
     /**
      * 投流id
      * 投流id
      */
      */
-    @Excel(name = "投流id")
+    @ApiModelProperty(name = "投流id")
     private String inputControlId;
     private String inputControlId;
 
 
     /**
     /**
      * 投流
      * 投流
      */
      */
-    @Excel(name = "投流")
+    @ApiModelProperty(name = "投流")
     private String inputController;
     private String inputController;
 
 
     /**
     /**
      * 创建人ID
      * 创建人ID
      */
      */
-    @Excel(name = "创建人ID")
+    @ApiModelProperty(name = "创建人ID")
     private String createrId;
     private String createrId;
 
 
     /**
     /**

+ 108 - 0
ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveBroadcastFiles.java

@@ -0,0 +1,108 @@
+package com.ruixuan.live.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 快手—直播-附属文件(数据大盘、画像、复盘数据) kuaishou_live_broadcast_files
+ */
+@Data
+@ApiModel(value = "kuaishouLiveBroadcastFiles", description = "快手—直播-附属文件(数据大盘、画像、复盘数据)")
+public class KuaishouLiveBroadcastFiles implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 与直播表(kuaishou_live_broadcast)id一致
+     */
+    private String id;
+
+    /**
+     * 上传操作通用前缀链接
+     */
+    @ApiModelProperty(name = "上传操作通用前缀链接")
+    private String upCommonUrl;
+
+    /**
+     * 上传数据大盘图片数量
+     */
+    @ApiModelProperty(name = "上传数据大盘图片数量")
+    private Integer dapanCount;
+
+    /**
+     * 数据大盘名称集
+     */
+    @ApiModelProperty(name = "数据大盘名称集")
+    private String dapanNames;
+
+    /**
+     * 上传COS结果说明
+     */
+    @ApiModelProperty(name = "上传COS结果说明")
+    private String dapanMsg;
+
+    /**
+     * 上传画像分析图片数量
+     */
+    @ApiModelProperty(name = "上传画像分析图片数量")
+    private Integer portraitCount;
+
+    /**
+     * 画像分析名称集
+     */
+    @ApiModelProperty(name = "画像分析名称集")
+    private String portraitNames;
+
+    /**
+     * 上传COS结果说明
+     */
+    @ApiModelProperty(name = "上传COS结果说明")
+    private String portraitMsg;
+
+    /**
+     * 复盘操作通用前缀链接
+     */
+    @ApiModelProperty(name = "复盘操作通用前缀链接")
+    private String replayCommonUrl;
+
+    /**
+     * 上传复盘图片数量
+     */
+    @ApiModelProperty(name = "上传复盘图片数量")
+    private Integer replayPictureCount;
+
+    /**
+     * 复盘图片名称集
+     */
+    @ApiModelProperty(name = "复盘图片名称集")
+    private String replayPictureNames;
+
+    /**
+     * 上传COS结果说明
+     */
+    @ApiModelProperty(name = "上传COS结果说明")
+    private String replayPictureMsg;
+
+    /**
+     * 复盘文件链接
+     */
+    @ApiModelProperty(name = "复盘文件链接")
+    private String replayFileUrl;
+
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+}

+ 14 - 14
ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveUserAccount.java

@@ -1,8 +1,8 @@
 package com.ruixuan.live.entity;
 package com.ruixuan.live.entity;
 
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.ruixuan.common.annotation.Excel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
@@ -27,79 +27,79 @@ public class KuaishouLiveUserAccount implements Serializable {
     /**
     /**
      * 快手ID
      * 快手ID
      */
      */
-    @Excel(name = "快手ID")
+    @ApiModelProperty(name = "快手ID")
     private Long ksId;
     private Long ksId;
 
 
     /**
     /**
      * 快手昵称
      * 快手昵称
      */
      */
-    @Excel(name = "快手昵称")
+    @ApiModelProperty(name = "快手昵称")
     private String ksName;
     private String ksName;
 
 
     /**
     /**
      * 账户ID
      * 账户ID
      */
      */
-    @Excel(name = "账户ID")
+    @ApiModelProperty(name = "账户ID")
     private Long accountId;
     private Long accountId;
 
 
     /**
     /**
      * 账户名称
      * 账户名称
      */
      */
-    @Excel(name = "账户名称")
+    @ApiModelProperty(name = "账户名称")
     private String accountName;
     private String accountName;
 
 
     /**
     /**
      * 账户类型
      * 账户类型
      */
      */
-    @Excel(name = "账户类型")
+    @ApiModelProperty(name = "账户类型")
     private String accountType;
     private String accountType;
 
 
     /**
     /**
      * 销售负责人Id
      * 销售负责人Id
      */
      */
-    @Excel(name = "销售负责人Id")
+    @ApiModelProperty(name = "销售负责人Id")
     private String saleLeaderId;
     private String saleLeaderId;
 
 
     /**
     /**
      * 销售负责人
      * 销售负责人
      */
      */
-    @Excel(name = "销售负责人")
+    @ApiModelProperty(name = "销售负责人")
     private String saleLeader;
     private String saleLeader;
 
 
     /**
     /**
      * 运营负责人Id
      * 运营负责人Id
      */
      */
-    @Excel(name = "运营负责人Id")
+    @ApiModelProperty(name = "运营负责人Id")
     private String operatorLeaderId;
     private String operatorLeaderId;
 
 
     /**
     /**
      * 运营负责人
      * 运营负责人
      */
      */
-    @Excel(name = "运营负责人")
+    @ApiModelProperty(name = "运营负责人")
     private String operatorLeader;
     private String operatorLeader;
 
 
     /**
     /**
      * 设计负责人Id
      * 设计负责人Id
      */
      */
-    @Excel(name = "设计负责人Id")
+    @ApiModelProperty(name = "设计负责人Id")
     private String designerLeaderId;
     private String designerLeaderId;
 
 
     /**
     /**
      * 设计负责人
      * 设计负责人
      */
      */
-    @Excel(name = "设计负责人")
+    @ApiModelProperty(name = "设计负责人")
     private String designerLeader;
     private String designerLeader;
 
 
     /**
     /**
      * 投放类型
      * 投放类型
      */
      */
-    @Excel(name = "投放类型")
+    @ApiModelProperty(name = "投放类型")
     private String putType;
     private String putType;
 
 
     /**
     /**
      * 创建人ID
      * 创建人ID
      */
      */
-    @Excel(name = "创建人ID")
+    @ApiModelProperty(name = "创建人ID")
     private String createrId;
     private String createrId;
 
 
     /**
     /**

+ 9 - 9
ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveUserAccountPart.java

@@ -1,8 +1,8 @@
 package com.ruixuan.live.entity;
 package com.ruixuan.live.entity;
 
 
-import com.ruixuan.common.annotation.Excel;
 import com.ruixuan.common.core.domain.BaseEntity;
 import com.ruixuan.common.core.domain.BaseEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 /**
 /**
@@ -12,50 +12,50 @@ import lombok.Data;
  * @date 2022-05-31
  * @date 2022-05-31
  */
  */
 @Data
 @Data
-@ApiModel(value = "KuaishouLiveUserAccountPart", description = "快手账户协作人群对象")
+@ApiModel(value = "kuaishouLiveUserAccountPart", description = "快手账户协作人群对象")
 public class KuaishouLiveUserAccountPart extends BaseEntity {
 public class KuaishouLiveUserAccountPart extends BaseEntity {
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
     /**
     /**
      * 快手ID
      * 快手ID
      */
      */
-    @Excel(name = "快手ID")
+    @ApiModelProperty(name = "快手ID")
     private Long ksId;
     private Long ksId;
 
 
     /**
     /**
      * 快手昵称
      * 快手昵称
      */
      */
-    @Excel(name = "快手昵称")
+    @ApiModelProperty(name = "快手昵称")
     private String ksName;
     private String ksName;
 
 
     /**
     /**
      * 账户ID
      * 账户ID
      */
      */
-    @Excel(name = "账户ID")
+    @ApiModelProperty(name = "账户ID")
     private Long accountId;
     private Long accountId;
 
 
     /**
     /**
      * 账户名称
      * 账户名称
      */
      */
-    @Excel(name = "账户名称")
+    @ApiModelProperty(name = "账户名称")
     private String accountName;
     private String accountName;
 
 
     /**
     /**
      * 协作人ID
      * 协作人ID
      */
      */
-    @Excel(name = "协作人ID")
+    @ApiModelProperty(name = "协作人ID")
     private String collaboratorId;
     private String collaboratorId;
 
 
     /**
     /**
      * 协作人
      * 协作人
      */
      */
-    @Excel(name = "协作人")
+    @ApiModelProperty(name = "协作人")
     private String collaborator;
     private String collaborator;
 
 
     /**
     /**
      * 创建人ID
      * 创建人ID
      */
      */
-    @Excel(name = "创建人ID")
+    @ApiModelProperty(name = "创建人ID")
     private String createrId;
     private String createrId;
 
 
 }
 }

+ 62 - 0
ruixuan-live/src/main/java/com/ruixuan/live/mapper/KuaishouLiveBroadcastFilesMapper.java

@@ -0,0 +1,62 @@
+package com.ruixuan.live.mapper;
+
+import com.ruixuan.live.entity.KuaishouLiveBroadcastFiles;
+
+import java.util.List;
+
+/**
+ * 快手—直播-附属文件(数据大盘、画像、复盘数据)Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-06-06
+ */
+public interface KuaishouLiveBroadcastFilesMapper
+{
+    /**
+     * 查询快手—直播-附属文件(数据大盘、画像、复盘数据)
+     *
+     * @param id 快手—直播-附属文件(数据大盘、画像、复盘数据)主键
+     * @return 快手—直播-附属文件(数据大盘、画像、复盘数据)
+     */
+    public KuaishouLiveBroadcastFiles selectKuaishouLiveBroadcastFilesById(String id);
+
+    /**
+     * 查询快手—直播-附属文件(数据大盘、画像、复盘数据)列表
+     *
+     * @param kuaishouLiveBroadcastFiles 快手—直播-附属文件(数据大盘、画像、复盘数据)
+     * @return 快手—直播-附属文件(数据大盘、画像、复盘数据)集合
+     */
+    public List<KuaishouLiveBroadcastFiles> selectKuaishouLiveBroadcastFilesList(KuaishouLiveBroadcastFiles kuaishouLiveBroadcastFiles);
+
+    /**
+     * 新增快手—直播-附属文件(数据大盘、画像、复盘数据)
+     *
+     * @param kuaishouLiveBroadcastFiles 快手—直播-附属文件(数据大盘、画像、复盘数据)
+     * @return 结果
+     */
+    public int insertKuaishouLiveBroadcastFiles(KuaishouLiveBroadcastFiles kuaishouLiveBroadcastFiles);
+
+    /**
+     * 修改快手—直播-附属文件(数据大盘、画像、复盘数据)
+     *
+     * @param kuaishouLiveBroadcastFiles 快手—直播-附属文件(数据大盘、画像、复盘数据)
+     * @return 结果
+     */
+    public int updateKuaishouLiveBroadcastFiles(KuaishouLiveBroadcastFiles kuaishouLiveBroadcastFiles);
+
+    /**
+     * 删除快手—直播-附属文件(数据大盘、画像、复盘数据)
+     *
+     * @param id 快手—直播-附属文件(数据大盘、画像、复盘数据)主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveBroadcastFilesById(String id);
+
+    /**
+     * 批量删除快手—直播-附属文件(数据大盘、画像、复盘数据)
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveBroadcastFilesByIds(String[] ids);
+}

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/live/mapper/KuaishouLiveBroadcastMapper.java

@@ -58,4 +58,6 @@ public interface KuaishouLiveBroadcastMapper {
      * @return 结果
      * @return 结果
      */
      */
     public int deleteKuaishouLiveBroadcastByIds(String[] ids);
     public int deleteKuaishouLiveBroadcastByIds(String[] ids);
+
+    KuaishouLiveBroadcast getOne(KuaishouLiveBroadcast kuaishouLiveBroadcast);
 }
 }

+ 11 - 3
ruixuan-live/src/main/java/com/ruixuan/live/service/IKuaishouLiveBroadcastService.java

@@ -1,6 +1,8 @@
 package com.ruixuan.live.service;
 package com.ruixuan.live.service;
 
 
+import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+import org.springframework.web.multipart.MultipartFile;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -17,7 +19,9 @@ public interface IKuaishouLiveBroadcastService {
      * @param id 快手—直播主键
      * @param id 快手—直播主键
      * @return 快手—直播
      * @return 快手—直播
      */
      */
-    public KuaishouLiveBroadcast selectKuaishouLiveBroadcastById(String id);
+    public ResultResponse selectKuaishouLiveBroadcastById(String id);
+
+    public ResultResponse getForEdit(String id);
 
 
     /**
     /**
      * 查询快手—直播列表
      * 查询快手—直播列表
@@ -33,7 +37,7 @@ public interface IKuaishouLiveBroadcastService {
      * @param kuaishouLiveBroadcast 快手—直播
      * @param kuaishouLiveBroadcast 快手—直播
      * @return 结果
      * @return 结果
      */
      */
-    public int insertKuaishouLiveBroadcast(KuaishouLiveBroadcast kuaishouLiveBroadcast);
+    public ResultResponse insertKuaishouLiveBroadcast(KuaishouLiveBroadcast kuaishouLiveBroadcast);
 
 
     /**
     /**
      * 修改快手—直播
      * 修改快手—直播
@@ -41,7 +45,7 @@ public interface IKuaishouLiveBroadcastService {
      * @param kuaishouLiveBroadcast 快手—直播
      * @param kuaishouLiveBroadcast 快手—直播
      * @return 结果
      * @return 结果
      */
      */
-    public int updateKuaishouLiveBroadcast(KuaishouLiveBroadcast kuaishouLiveBroadcast);
+    public ResultResponse updateKuaishouLiveBroadcast(KuaishouLiveBroadcast kuaishouLiveBroadcast);
 
 
     /**
     /**
      * 批量删除快手—直播
      * 批量删除快手—直播
@@ -58,4 +62,8 @@ public interface IKuaishouLiveBroadcastService {
      * @return 结果
      * @return 结果
      */
      */
     public int deleteKuaishouLiveBroadcastById(String id);
     public int deleteKuaishouLiveBroadcastById(String id);
+
+    ResultResponse dataUpload(String id, Long actualGmv, String dapanUrls, String portraitUrls, MultipartFile[] files) throws Exception;
+
+    ResultResponse replay(String id, String replayPictureUrls, MultipartFile replayFile);
 }
 }

+ 267 - 9
ruixuan-live/src/main/java/com/ruixuan/live/service/impl/KuaishouLiveBroadcastServiceImpl.java

@@ -1,13 +1,30 @@
 package com.ruixuan.live.service.impl;
 package com.ruixuan.live.service.impl;
 
 
-import com.ruixuan.common.utils.DateUtils;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.core.domain.ResultResponse;
+import com.ruixuan.common.cos.CosUpload;
+import com.ruixuan.common.utils.Check;
+import com.ruixuan.data.service.IKuaishouLiveDataAnalysisService;
+import com.ruixuan.data.service.IKuaishouLiveDataFunnelService;
+import com.ruixuan.data.service.IKuaishouLiveDataKanbanService;
+import com.ruixuan.data.service.IKuaishouLiveDataOverviewService;
+import com.ruixuan.data.utils.LiveDataExcelUtils;
 import com.ruixuan.live.entity.KuaishouLiveBroadcast;
 import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+import com.ruixuan.live.entity.KuaishouLiveBroadcastFiles;
+import com.ruixuan.live.mapper.KuaishouLiveBroadcastFilesMapper;
 import com.ruixuan.live.mapper.KuaishouLiveBroadcastMapper;
 import com.ruixuan.live.mapper.KuaishouLiveBroadcastMapper;
 import com.ruixuan.live.service.IKuaishouLiveBroadcastService;
 import com.ruixuan.live.service.IKuaishouLiveBroadcastService;
+import com.ruixuan.system.service.ISysUserService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
 
+import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
 import java.util.List;
+import java.util.UUID;
 
 
 /**
 /**
  * 快手—直播Service业务层处理
  * 快手—直播Service业务层处理
@@ -20,6 +37,21 @@ public class KuaishouLiveBroadcastServiceImpl implements IKuaishouLiveBroadcastS
     @Autowired
     @Autowired
     private KuaishouLiveBroadcastMapper kuaishouLiveBroadcastMapper;
     private KuaishouLiveBroadcastMapper kuaishouLiveBroadcastMapper;
 
 
+    @Autowired
+    private KuaishouLiveBroadcastFilesMapper filesMapper;
+
+    @Autowired
+    private ISysUserService sysUserService;
+
+    @Autowired
+    private IKuaishouLiveDataAnalysisService analysisService;
+    @Autowired
+    private IKuaishouLiveDataFunnelService funnelService;
+    @Autowired
+    private IKuaishouLiveDataKanbanService kanbanService;
+    @Autowired
+    private IKuaishouLiveDataOverviewService overviewService;
+
     /**
     /**
      * 查询快手—直播
      * 查询快手—直播
      *
      *
@@ -27,8 +59,31 @@ public class KuaishouLiveBroadcastServiceImpl implements IKuaishouLiveBroadcastS
      * @return 快手—直播
      * @return 快手—直播
      */
      */
     @Override
     @Override
-    public KuaishouLiveBroadcast selectKuaishouLiveBroadcastById(String id) {
-        return kuaishouLiveBroadcastMapper.selectKuaishouLiveBroadcastById(id);
+    public ResultResponse selectKuaishouLiveBroadcastById(String id) {
+        KuaishouLiveBroadcast liveBroadcast = kuaishouLiveBroadcastMapper.selectKuaishouLiveBroadcastById(id);
+        return ResultResponse.success(liveBroadcast);
+    }
+
+    @Override
+    public ResultResponse getForEdit(String id) {
+        KuaishouLiveBroadcast liveBroadcast = kuaishouLiveBroadcastMapper.selectKuaishouLiveBroadcastById(id);
+        JSONObject object = JSONObject.parseObject(JSON.toJSONString(liveBroadcast));
+        object.put("traderArray", getUsers(liveBroadcast.getTraderId()));
+        object.put("centralControlArray", getUsers(liveBroadcast.getCentralControlId()));
+        object.put("fieldControlArray", getUsers(liveBroadcast.getFieldControlId()));
+        object.put("contentControlArray", getUsers(liveBroadcast.getContentControlId()));
+        object.put("inputControlArray", getUsers(liveBroadcast.getInputControlId()));
+        object.put("anchorArray", getUsers(liveBroadcast.getAnchorId()));
+        return ResultResponse.success(object);
+    }
+
+    private List<JSONObject> getUsers(String ids) {
+        if (ids != null && ids != "-") {
+            ids = ids.replace(",", ",");
+            List<String> userIds = Arrays.asList(ids.split(","));
+            return sysUserService.queryUserByIds(userIds);
+        }
+        return null;
     }
     }
 
 
     /**
     /**
@@ -49,9 +104,17 @@ public class KuaishouLiveBroadcastServiceImpl implements IKuaishouLiveBroadcastS
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public int insertKuaishouLiveBroadcast(KuaishouLiveBroadcast kuaishouLiveBroadcast) {
-        kuaishouLiveBroadcast.setCreateTime(DateUtils.getNowDate());
-        return kuaishouLiveBroadcastMapper.insertKuaishouLiveBroadcast(kuaishouLiveBroadcast);
+    public ResultResponse insertKuaishouLiveBroadcast(KuaishouLiveBroadcast broadcast) {
+        KuaishouLiveBroadcast one = kuaishouLiveBroadcastMapper.getOne(broadcast);
+        if (one != null) {
+            return ResultResponse.error("当前时间段已存在直播!");
+        }
+        broadcast.setId(UUID.randomUUID().toString().replace("-", ""));
+        int num = kuaishouLiveBroadcastMapper.insertKuaishouLiveBroadcast(broadcast);
+        if (num > 0) {
+            return ResultResponse.success();
+        }
+        return ResultResponse.error("fail");
     }
     }
 
 
     /**
     /**
@@ -61,9 +124,25 @@ public class KuaishouLiveBroadcastServiceImpl implements IKuaishouLiveBroadcastS
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public int updateKuaishouLiveBroadcast(KuaishouLiveBroadcast kuaishouLiveBroadcast) {
-        kuaishouLiveBroadcast.setUpdateTime(DateUtils.getNowDate());
-        return kuaishouLiveBroadcastMapper.updateKuaishouLiveBroadcast(kuaishouLiveBroadcast);
+    public ResultResponse updateKuaishouLiveBroadcast(KuaishouLiveBroadcast broadcast) {
+        KuaishouLiveBroadcast one = kuaishouLiveBroadcastMapper.selectKuaishouLiveBroadcastById(broadcast.getId());
+        if (one == null) {
+            return ResultResponse.error("未查询到直播!");
+        }
+        KuaishouLiveBroadcast checkOne = kuaishouLiveBroadcastMapper.getOne(broadcast);
+        if (checkOne == null) {
+            KuaishouLiveBroadcast copy = new KuaishouLiveBroadcast();
+            BeanUtils.copyProperties(copy, broadcast);
+            copy.setId(null);
+            if (kuaishouLiveBroadcastMapper.getOne(copy) != null) {
+                return ResultResponse.error("当前时间段已存在直播!");
+            }
+        }
+        int i = kuaishouLiveBroadcastMapper.updateKuaishouLiveBroadcast(broadcast);
+        if (i > 0) {
+            return ResultResponse.success();
+        }
+        return ResultResponse.error("fail");
     }
     }
 
 
     /**
     /**
@@ -87,4 +166,183 @@ public class KuaishouLiveBroadcastServiceImpl implements IKuaishouLiveBroadcastS
     public int deleteKuaishouLiveBroadcastById(String id) {
     public int deleteKuaishouLiveBroadcastById(String id) {
         return kuaishouLiveBroadcastMapper.deleteKuaishouLiveBroadcastById(id);
         return kuaishouLiveBroadcastMapper.deleteKuaishouLiveBroadcastById(id);
     }
     }
+
+    @Override
+    public ResultResponse dataUpload(String id, Long actualGmv, String dapanUrls, String portraitUrls, MultipartFile[] files) throws Exception {
+        KuaishouLiveBroadcast broadcast = kuaishouLiveBroadcastMapper.selectKuaishouLiveBroadcastById(id);
+        if (broadcast == null) {
+            return ResultResponse.error("未查询到直播!");
+        }
+
+        // 目前支持 直播数据看板、直播数据概览、直播漏斗数据、商品分析数据 四种数据导入
+        String msg = "";
+        //记录上传文件
+        int count = 0;
+        for (MultipartFile file : files) {
+            String fileName = file.getOriginalFilename();
+            if (!(fileName.endsWith(".xls") || fileName.endsWith(".xlsx") || fileName.endsWith(".csv"))) {
+                msg += fileName + "、";
+                continue;
+            }
+            List<JSONObject> list = LiveDataExcelUtils.analysisFile(file, fileName);
+            if (Check.isNotNull(list)) {
+                if (fileName.contains("看板")) {
+                    count += kanbanService.inserExcelInfo(broadcast, list);
+                } else if (fileName.contains("概览")) {
+                    count += overviewService.inserExcelInfo(broadcast, list);
+                } else if (fileName.contains("漏斗")) {
+                    count += funnelService.inserExcelInfo(broadcast, list);
+                } else if (fileName.contains("分析")) {
+                    count += analysisService.inserExcelInfo(broadcast, list);
+                }
+            }
+        }
+
+        //上传到cos的文件夹名称 (操盘手)
+        String upFileName = "CaoPanShou";
+        KuaishouLiveBroadcastFiles file = new KuaishouLiveBroadcastFiles();
+        //上传数据大盘
+        if (Check.isNotNull(dapanUrls)) {
+            List<String> urls = Arrays.asList(dapanUrls.split(","));
+            HashSet<String> set = new HashSet<>(urls);
+            String urlFix = "";
+            String names = "";
+            int dapanCount = 0;
+            for (String url : set) {
+                String pictureName = "dapan_000" + (dapanCount + 1);
+                String cosUrl = CosUpload.getJPGCosUrl(url, upFileName, pictureName);
+                if (Check.isNotNull(cosUrl)) {
+                    dapanCount++;
+                    int lastNo = cosUrl.lastIndexOf("/") + 1;
+                    urlFix = cosUrl.substring(0, lastNo);
+                    String name = cosUrl.substring(lastNo);
+                    if (dapanCount > 1) {
+                        names += "," + name;
+                    } else {
+                        names = name;
+                    }
+                }
+            }
+            file.setUpCommonUrl(urlFix);
+            file.setDapanCount(dapanCount);
+            file.setDapanNames(names);
+            if (set.size() == dapanCount) {
+                file.setDapanMsg("success");
+            } else {
+                file.setDapanMsg("共上传" + set.size() + "张,成功" + dapanCount + "张");
+            }
+        }
+
+        //画像分析上传
+        if (Check.isNotNull(portraitUrls)) {
+            List<String> urls = Arrays.asList(portraitUrls.split(","));
+            HashSet<String> set = new HashSet<>(urls);
+            String urlFix = "";
+            String names = "";
+            int portraitCount = 0;
+            for (String url : set) {
+                String pictureName = "portrait_000" + (portraitCount + 1);
+                String cosUrl = CosUpload.getJPGCosUrl(url, upFileName, pictureName);
+                if (Check.isNotNull(cosUrl)) {
+                    portraitCount++;
+                    int lastNo = cosUrl.lastIndexOf("/") + 1;
+                    urlFix = cosUrl.substring(0, lastNo);
+                    String name = cosUrl.substring(lastNo);
+                    if (portraitCount > 1) {
+                        names += "," + name;
+                    } else {
+                        names = name;
+                    }
+                }
+            }
+            file.setPortraitCount(portraitCount);
+            file.setPortraitNames(names);
+            if (set.size() == portraitCount) {
+                file.setPortraitMsg("success");
+            } else {
+                file.setPortraitMsg("共上传" + set.size() + "张,成功" + portraitCount + "张");
+            }
+        }
+        KuaishouLiveBroadcastFiles one = filesMapper.selectKuaishouLiveBroadcastFilesById(id);
+        file.setId(id);
+        if (Check.isNull(one)) {
+            filesMapper.insertKuaishouLiveBroadcastFiles(file);
+        } else {
+            filesMapper.updateKuaishouLiveBroadcastFiles(file);
+        }
+
+        //更新直播表
+        KuaishouLiveBroadcast updateEntity = new KuaishouLiveBroadcast();
+        updateEntity.setId(id);
+        updateEntity.setUploadFileCount(count);
+        updateEntity.setUploadPictureCount(file.getDapanCount() + file.getPortraitCount());
+        updateEntity.setActualGmv(actualGmv);
+        kuaishouLiveBroadcastMapper.updateKuaishouLiveBroadcast(updateEntity);
+
+
+        if (msg.length() > 0) {
+            msg = msg.substring(0, msg.length() - 1) + "不支持文件格式";
+        } else {
+            msg = "上传完成";
+        }
+        return ResultResponse.successMsg(msg, null);
+
+    }
+
+    @Override
+    public ResultResponse replay(String id, String replayPictureUrls, MultipartFile replayFile) {
+        //上传到cos的文件夹名称 (操盘手)
+        String upFileName = "CaoPanShou";
+        KuaishouLiveBroadcastFiles file = new KuaishouLiveBroadcastFiles();
+        //上传复盘图片
+        if (Check.isNotNull(replayPictureUrls)) {
+            List<String> urls = Arrays.asList(replayPictureUrls.split(","));
+            HashSet<String> set = new HashSet<>(urls);
+            String urlFix = "";
+            String names = "";
+            int replayPictureCount = 0;
+            for (String url : set) {
+                String pictureName = "replayPicture_000" + (replayPictureCount + 1);
+                String cosUrl = CosUpload.getJPGCosUrl(url, upFileName, pictureName);
+                if (Check.isNotNull(cosUrl)) {
+                    replayPictureCount++;
+                    int lastNo = cosUrl.lastIndexOf("/") + 1;
+                    urlFix = cosUrl.substring(0, lastNo);
+                    String name = cosUrl.substring(lastNo);
+                    if (replayPictureCount > 1) {
+                        names += "," + name;
+                    } else {
+                        names = name;
+                    }
+                }
+            }
+            file.setReplayCommonUrl(urlFix);
+            file.setReplayPictureCount(replayPictureCount);
+            file.setReplayPictureNames(names);
+            if (set.size() == replayPictureCount) {
+                file.setReplayPictureMsg("success");
+            } else {
+                file.setReplayPictureMsg("共上传" + set.size() + "张,成功" + replayPictureCount + "张");
+            }
+        }
+        if (Check.isNotNull(replayFile)) {
+            file.setReplayFileUrl(CosUpload.getFileCosUrl(replayFile, upFileName));
+        }
+        KuaishouLiveBroadcastFiles one = filesMapper.selectKuaishouLiveBroadcastFilesById(id);
+        file.setId(id);
+        if (Check.isNull(one)) {
+            filesMapper.insertKuaishouLiveBroadcastFiles(file);
+        } else {
+            filesMapper.updateKuaishouLiveBroadcastFiles(file);
+        }
+        return ResultResponse.success();
+    }
+
+    public static void main(String[] args) {
+        String url = "https://media-1301855440.cos.ap-chongqing.myqcloud.com/006ac7f07a86404abc90e6423b47e183/0/00001.jpg";
+
+        System.out.println(url.substring(url.lastIndexOf("/") + 1));
+        System.out.println(url.substring(0, url.lastIndexOf("/") + 1));
+    }
+
 }
 }

+ 31 - 0
ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataAnalysisMapper.xml

@@ -121,4 +121,35 @@
             #{ksId}
             #{ksId}
         </foreach>
         </foreach>
     </delete>
     </delete>
+
+
+    <insert id="inserExcelBatchInfo">
+        replace into kuaishou_live_data_analysis(
+        ks_id,
+        ks_name,
+        account_id,
+        account_name,
+        wares_name,
+        wares_put_date,
+        wares_price,
+        wares_sales_amount,
+        wares_sales_volume,
+        topay_orders
+        )
+        values
+        <foreach collection="analysisList" item="cell" separator=",">
+            (
+            #{cell.ksId},
+            #{cell.ksName},
+            #{cell.accountId},
+            #{cell.accountName},
+            #{cell.waresName},
+            #{cell.waresPutDate},
+            #{cell.waresPrice},
+            #{cell.waresSalesAmount},
+            #{cell.waresSalesVolume},
+            #{cell.topayOrders}
+            )
+        </foreach>
+    </insert>
 </mapper>
 </mapper>

+ 24 - 0
ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataFunnelMapper.xml

@@ -97,4 +97,28 @@
             #{ksId}
             #{ksId}
         </foreach>
         </foreach>
     </delete>
     </delete>
+
+
+    <insert id="inserExcelBatchInfo">
+        replace into kuaishou_live_data_funnel(
+        ks_id,
+        ks_name,
+        account_id,
+        account_name,
+        all_viewers,
+        stat_date
+        )
+        values
+        <foreach collection="funnelList" item="cell" separator=",">
+            (
+            #{cell.ksId},
+            #{cell.ksName},
+            #{cell.accountId},
+            #{cell.accountName},
+            #{cell.allViewers},
+            #{cell.statDate}
+            )
+        </foreach>
+    </insert>
+
 </mapper>
 </mapper>

+ 49 - 0
ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataKanbanMapper.xml

@@ -175,4 +175,53 @@
             #{ksId}
             #{ksId}
         </foreach>
         </foreach>
     </delete>
     </delete>
+
+    <insert id="inserExcelBatchInfo">
+        replace into kuaishou_live_data_kanban(
+        ks_id,
+        ks_name,
+        account_id,
+        account_name,
+        online_viewers,
+        viewers,
+        viewing_times,
+        per_viewing_time,
+        fans_viewing_time,
+        rewards,
+        put_wares,
+        new_fans,
+        likes,
+        wares_clicks,
+        car_clicks,
+        all_amount,
+        all_turnover,
+        all_orders,
+        turnover_ratio
+        )
+        values
+        <foreach collection="kanbanList" item="cell" separator=",">
+            (
+            #{cell.ksId},
+            #{cell.ksName},
+            #{cell.accountId},
+            #{cell.accountName},
+            #{cell.onlineViewers},
+            #{cell.viewers},
+            #{cell.viewingTimes},
+            #{cell.perViewingTime},
+            #{cell.fansViewingTime},
+            #{cell.rewards},
+            #{cell.putWares},
+            #{cell.newFans},
+            #{cell.likes},
+            #{cell.waresClicks},
+            #{cell.carClicks},
+            #{cell.allAmount},
+            #{cell.allTurnover},
+            #{cell.allOrders},
+            #{cell.turnoverRatio}
+            )
+        </foreach>
+    </insert>
+
 </mapper>
 </mapper>

+ 24 - 0
ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataOverviewMapper.xml

@@ -97,4 +97,28 @@
             #{ksId}
             #{ksId}
         </foreach>
         </foreach>
     </delete>
     </delete>
+
+
+    <insert id="inserExcelBatchInfo">
+        replace into kuaishou_live_data_overview(
+        ks_id,
+        ks_name,
+        account_id,
+        account_name,
+        amounts,
+        stat_date
+        )
+        values
+        <foreach collection="overviewList" item="cell" separator=",">
+            (
+            #{cell.ksId},
+            #{cell.ksName},
+            #{cell.accountId},
+            #{cell.accountName},
+            #{cell.amounts},
+            #{cell.statDate}
+            )
+        </foreach>
+    </insert>
+
 </mapper>
 </mapper>

+ 97 - 0
ruixuan-live/src/main/resources/mapper/live/KuaishouLiveBroadcastFilesMapper.xml

@@ -0,0 +1,97 @@
+<?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.ruixuan.live.mapper.KuaishouLiveBroadcastFilesMapper">
+
+    <select id="selectKuaishouLiveBroadcastFilesById" parameterType="String"
+            resultType="com.ruixuan.live.entity.KuaishouLiveBroadcastFiles">
+        select id,
+               up_common_url,
+               dapan_count,
+               dapan_names,
+               dapan_msg,
+               portrait_count,
+               portrait_names,
+               portrait_msg,
+               replay_common_url,
+               replay_picture_count,
+               replay_picture_names,
+               replay_picture_msg,
+               replay_file_url
+        from kuaishou_live_broadcast_files
+        where id = #{id}
+    </select>
+
+    <insert id="insertKuaishouLiveBroadcastFiles" parameterType="com.ruixuan.live.entity.KuaishouLiveBroadcastFiles">
+        insert into kuaishou_live_broadcast_files
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">id,</if>
+            <if test="upCommonUrl != null">up_common_url,</if>
+            <if test="dapanCount != null">dapan_count,</if>
+            <if test="dapanNames != null">dapan_names,</if>
+            <if test="dapanMsg != null">dapan_msg,</if>
+            <if test="portraitCount != null">portrait_count,</if>
+            <if test="portraitNames != null">portrait_names,</if>
+            <if test="portraitMsg != null">portrait_msg,</if>
+            <if test="replayCommonUrl != null">replay_common_url,</if>
+            <if test="replayPictureCount != null">replay_picture_count,</if>
+            <if test="replayPictureNames != null">replay_picture_names,</if>
+            <if test="replayPictureMsg != null">replay_picture_msg,</if>
+            <if test="replayFileUrl != null">replay_file_url,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">#{id},</if>
+            <if test="upCommonUrl != null">#{upCommonUrl},</if>
+            <if test="dapanCount != null">#{dapanCount},</if>
+            <if test="dapanNames != null">#{dapanNames},</if>
+            <if test="dapanMsg != null">#{dapanMsg},</if>
+            <if test="portraitCount != null">#{portraitCount},</if>
+            <if test="portraitNames != null">#{portraitNames},</if>
+            <if test="portraitMsg != null">#{portraitMsg},</if>
+            <if test="replayCommonUrl != null">#{replayCommonUrl},</if>
+            <if test="replayPictureCount != null">#{replayPictureCount},</if>
+            <if test="replayPictureNames != null">#{replayPictureNames},</if>
+            <if test="replayPictureMsg != null">#{replayPictureMsg},</if>
+            <if test="replayFileUrl != null">#{replayFileUrl},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateKuaishouLiveBroadcastFiles" parameterType="com.ruixuan.live.entity.KuaishouLiveBroadcastFiles">
+        update kuaishou_live_broadcast_files
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="upCommonUrl != null">up_common_url = #{upCommonUrl},</if>
+            <if test="dapanCount != null">dapan_count = #{dapanCount},</if>
+            <if test="dapanNames != null">dapan_names = #{dapanNames},</if>
+            <if test="dapanMsg != null">dapan_msg = #{dapanMsg},</if>
+            <if test="portraitCount != null">portrait_count = #{portraitCount},</if>
+            <if test="portraitNames != null">portrait_names = #{portraitNames},</if>
+            <if test="portraitMsg != null">portrait_msg = #{portraitMsg},</if>
+            <if test="replayCommonUrl != null">replay_common_url = #{replayCommonUrl},</if>
+            <if test="replayPictureCount != null">replay_picture_count = #{replayPictureCount},</if>
+            <if test="replayPictureNames != null">replay_picture_names = #{replayPictureNames},</if>
+            <if test="replayPictureMsg != null">replay_picture_msg = #{replayPictureMsg},</if>
+            <if test="replayFileUrl != null">replay_file_url = #{replayFileUrl},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteKuaishouLiveBroadcastFilesById" parameterType="String">
+        delete
+        from kuaishou_live_broadcast_files
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteKuaishouLiveBroadcastFilesByIds" parameterType="String">
+        delete from kuaishou_live_broadcast_files where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 38 - 1
ruixuan-live/src/main/resources/mapper/live/KuaishouLiveBroadcastMapper.xml

@@ -108,10 +108,45 @@
     </select>
     </select>
 
 
     <select id="selectKuaishouLiveBroadcastById" parameterType="String" resultMap="KuaishouLiveBroadcastResult">
     <select id="selectKuaishouLiveBroadcastById" parameterType="String" resultMap="KuaishouLiveBroadcastResult">
-        <include refid="selectKuaishouLiveBroadcastVo"/>
+        select id,
+               ks_id,
+               ks_name,
+               account_id,
+               account_name,
+               goal_gmv,
+               actual_gmv,
+               live_time,
+               start_time,
+               end_time,
+               live_level,
+               anchor_id,
+               anchor,
+               trader_id,
+               trader,
+               central_control_id,
+               central_controller,
+               field_control_id,
+               field_controller,
+               content_control_id,
+               content_controller,
+               input_control_id,
+               input_controller,
+               upload_file_count,
+               upload_picture_count
+        from kuaishou_live_broadcast
         where id = #{id}
         where id = #{id}
     </select>
     </select>
 
 
+    <select id="getOne" parameterType="com.ruixuan.live.entity.KuaishouLiveBroadcast"
+            resultMap="KuaishouLiveBroadcastResult">
+        <include refid="selectKuaishouLiveBroadcastVo"/>
+        where ks_id = #{ksId}
+        and account_name = #{accountName}
+        and start_time = #{startTime}
+        and end_time = #{endTime}
+        <if test="id != null  and id != ''">and id = #{id}</if>
+    </select>
+
     <insert id="insertKuaishouLiveBroadcast" parameterType="com.ruixuan.live.entity.KuaishouLiveBroadcast">
     <insert id="insertKuaishouLiveBroadcast" parameterType="com.ruixuan.live.entity.KuaishouLiveBroadcast">
         insert into kuaishou_live_broadcast
         insert into kuaishou_live_broadcast
         <trim prefix="(" suffix=")" suffixOverrides=",">
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -200,6 +235,8 @@
             <if test="createrId != null">creater_id = #{createrId},</if>
             <if test="createrId != null">creater_id = #{createrId},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="uploadPictureCount != null">upload_picture_count = #{uploadPictureCount},</if>
+            <if test="uploadFileCount != null">upload_file_count = #{uploadFileCount},</if>
         </trim>
         </trim>
         where id = #{id}
         where id = #{id}
     </update>
     </update>

+ 2 - 0
ruixuan-system/src/main/java/com/ruixuan/system/mapper/SysUserMapper.java

@@ -134,4 +134,6 @@ public interface SysUserMapper
      * @return 结果
      * @return 结果
      */
      */
     List<JSONObject> queryRoles(String type);
     List<JSONObject> queryRoles(String type);
+
+    List<JSONObject> queryUserByIds(@Param("userIds") List<String> userIds);
 }
 }

+ 2 - 0
ruixuan-system/src/main/java/com/ruixuan/system/service/ISysUserService.java

@@ -213,4 +213,6 @@ public interface ISysUserService
      * @return 结果
      * @return 结果
      */
      */
     List<JSONObject> queryRoles(String type);
     List<JSONObject> queryRoles(String type);
+
+    List<JSONObject> queryUserByIds(List<String> userIds);
 }
 }

+ 91 - 145
ruixuan-system/src/main/java/com/ruixuan/system/service/impl/SysUserServiceImpl.java

@@ -34,12 +34,11 @@ import com.ruixuan.system.service.ISysUserService;
 
 
 /**
 /**
  * 用户 业务层处理
  * 用户 业务层处理
- * 
+ *
  * @author ruixuan
  * @author ruixuan
  */
  */
 @Service
 @Service
-public class SysUserServiceImpl implements ISysUserService
-{
+public class SysUserServiceImpl implements ISysUserService {
     private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
     private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
 
 
     @Autowired
     @Autowired
@@ -65,79 +64,72 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 根据条件分页查询用户列表
      * 根据条件分页查询用户列表
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 用户信息集合信息
      * @return 用户信息集合信息
      */
      */
     @Override
     @Override
     @DataScope(deptAlias = "d", userAlias = "u")
     @DataScope(deptAlias = "d", userAlias = "u")
-    public List<SysUser> selectUserList(SysUser user)
-    {
+    public List<SysUser> selectUserList(SysUser user) {
         return userMapper.selectUserList(user);
         return userMapper.selectUserList(user);
     }
     }
 
 
     /**
     /**
      * 根据条件分页查询已分配用户角色列表
      * 根据条件分页查询已分配用户角色列表
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 用户信息集合信息
      * @return 用户信息集合信息
      */
      */
     @Override
     @Override
     @DataScope(deptAlias = "d", userAlias = "u")
     @DataScope(deptAlias = "d", userAlias = "u")
-    public List<SysUser> selectAllocatedList(SysUser user)
-    {
+    public List<SysUser> selectAllocatedList(SysUser user) {
         return userMapper.selectAllocatedList(user);
         return userMapper.selectAllocatedList(user);
     }
     }
 
 
     /**
     /**
      * 根据条件分页查询未分配用户角色列表
      * 根据条件分页查询未分配用户角色列表
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 用户信息集合信息
      * @return 用户信息集合信息
      */
      */
     @Override
     @Override
     @DataScope(deptAlias = "d", userAlias = "u")
     @DataScope(deptAlias = "d", userAlias = "u")
-    public List<SysUser> selectUnallocatedList(SysUser user)
-    {
+    public List<SysUser> selectUnallocatedList(SysUser user) {
         return userMapper.selectUnallocatedList(user);
         return userMapper.selectUnallocatedList(user);
     }
     }
 
 
     /**
     /**
      * 通过用户名查询用户
      * 通过用户名查询用户
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @return 用户对象信息
      * @return 用户对象信息
      */
      */
     @Override
     @Override
-    public SysUser selectUserByUserName(String userName)
-    {
+    public SysUser selectUserByUserName(String userName) {
         return userMapper.selectUserByUserName(userName);
         return userMapper.selectUserByUserName(userName);
     }
     }
 
 
     /**
     /**
      * 通过用户ID查询用户
      * 通过用户ID查询用户
-     * 
+     *
      * @param userId 用户ID
      * @param userId 用户ID
      * @return 用户对象信息
      * @return 用户对象信息
      */
      */
     @Override
     @Override
-    public SysUser selectUserById(Long userId)
-    {
+    public SysUser selectUserById(Long userId) {
         return userMapper.selectUserById(userId);
         return userMapper.selectUserById(userId);
     }
     }
 
 
     /**
     /**
      * 查询用户所属角色组
      * 查询用户所属角色组
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public String selectUserRoleGroup(String userName)
-    {
+    public String selectUserRoleGroup(String userName) {
         List<SysRole> list = roleMapper.selectRolesByUserName(userName);
         List<SysRole> list = roleMapper.selectRolesByUserName(userName);
-        if (CollectionUtils.isEmpty(list))
-        {
+        if (CollectionUtils.isEmpty(list)) {
             return StringUtils.EMPTY;
             return StringUtils.EMPTY;
         }
         }
         return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
         return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
@@ -145,16 +137,14 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 查询用户所属岗位组
      * 查询用户所属岗位组
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public String selectUserPostGroup(String userName)
-    {
+    public String selectUserPostGroup(String userName) {
         List<SysPost> list = postMapper.selectPostsByUserName(userName);
         List<SysPost> list = postMapper.selectPostsByUserName(userName);
-        if (CollectionUtils.isEmpty(list))
-        {
+        if (CollectionUtils.isEmpty(list)) {
             return StringUtils.EMPTY;
             return StringUtils.EMPTY;
         }
         }
         return list.stream().map(SysPost::getPostName).collect(Collectors.joining(","));
         return list.stream().map(SysPost::getPostName).collect(Collectors.joining(","));
@@ -162,16 +152,14 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 校验用户名称是否唯一
      * 校验用户名称是否唯一
-     * 
+     *
      * @param userName 用户名称
      * @param userName 用户名称
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public String checkUserNameUnique(String userName)
-    {
+    public String checkUserNameUnique(String userName) {
         int count = userMapper.checkUserNameUnique(userName);
         int count = userMapper.checkUserNameUnique(userName);
-        if (count > 0)
-        {
+        if (count > 0) {
             return UserConstants.NOT_UNIQUE;
             return UserConstants.NOT_UNIQUE;
         }
         }
         return UserConstants.UNIQUE;
         return UserConstants.UNIQUE;
@@ -184,12 +172,10 @@ public class SysUserServiceImpl implements ISysUserService
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public String checkPhoneUnique(SysUser user)
-    {
+    public String checkPhoneUnique(SysUser user) {
         Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
         Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
         SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
         SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
-        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
-        {
+        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
             return UserConstants.NOT_UNIQUE;
             return UserConstants.NOT_UNIQUE;
         }
         }
         return UserConstants.UNIQUE;
         return UserConstants.UNIQUE;
@@ -202,12 +188,10 @@ public class SysUserServiceImpl implements ISysUserService
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public String checkEmailUnique(SysUser user)
-    {
+    public String checkEmailUnique(SysUser user) {
         Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
         Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
         SysUser info = userMapper.checkEmailUnique(user.getEmail());
         SysUser info = userMapper.checkEmailUnique(user.getEmail());
-        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
-        {
+        if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
             return UserConstants.NOT_UNIQUE;
             return UserConstants.NOT_UNIQUE;
         }
         }
         return UserConstants.UNIQUE;
         return UserConstants.UNIQUE;
@@ -215,33 +199,28 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 校验用户是否允许操作
      * 校验用户是否允许操作
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      */
      */
     @Override
     @Override
-    public void checkUserAllowed(SysUser user)
-    {
-        if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
-        {
+    public void checkUserAllowed(SysUser user) {
+        if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) {
             throw new ServiceException("不允许操作超级管理员用户");
             throw new ServiceException("不允许操作超级管理员用户");
         }
         }
     }
     }
 
 
     /**
     /**
      * 校验用户是否有数据权限
      * 校验用户是否有数据权限
-     * 
+     *
      * @param userId 用户id
      * @param userId 用户id
      */
      */
     @Override
     @Override
-    public void checkUserDataScope(Long userId)
-    {
-        if (!SysUser.isAdmin(SecurityUtils.getUserId()))
-        {
+    public void checkUserDataScope(Long userId) {
+        if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
             SysUser user = new SysUser();
             SysUser user = new SysUser();
             user.setUserId(userId);
             user.setUserId(userId);
             List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user);
             List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user);
-            if (StringUtils.isEmpty(users))
-            {
+            if (StringUtils.isEmpty(users)) {
                 throw new ServiceException("没有权限访问用户数据!");
                 throw new ServiceException("没有权限访问用户数据!");
             }
             }
         }
         }
@@ -249,14 +228,13 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 新增保存用户信息
      * 新增保存用户信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public int insertUser(SysUser user)
-    {
+    public int insertUser(SysUser user) {
         // 新增用户信息
         // 新增用户信息
         int rows = userMapper.insertUser(user);
         int rows = userMapper.insertUser(user);
         // 新增用户岗位关联
         // 新增用户岗位关联
@@ -268,26 +246,24 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 注册用户信息
      * 注册用户信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public boolean registerUser(SysUser user)
-    {
+    public boolean registerUser(SysUser user) {
         return userMapper.insertUser(user) > 0;
         return userMapper.insertUser(user) > 0;
     }
     }
 
 
     /**
     /**
      * 修改保存用户信息
      * 修改保存用户信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public int updateUser(SysUser user)
-    {
+    public int updateUser(SysUser user) {
         Long userId = user.getUserId();
         Long userId = user.getUserId();
         // 删除用户与角色关联
         // 删除用户与角色关联
         userRoleMapper.deleteUserRoleByUserId(userId);
         userRoleMapper.deleteUserRoleByUserId(userId);
@@ -302,101 +278,91 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 用户授权角色
      * 用户授权角色
-     * 
-     * @param userId 用户ID
+     *
+     * @param userId  用户ID
      * @param roleIds 角色组
      * @param roleIds 角色组
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public void insertUserAuth(Long userId, Long[] roleIds)
-    {
+    public void insertUserAuth(Long userId, Long[] roleIds) {
         userRoleMapper.deleteUserRoleByUserId(userId);
         userRoleMapper.deleteUserRoleByUserId(userId);
         insertUserRole(userId, roleIds);
         insertUserRole(userId, roleIds);
     }
     }
 
 
     /**
     /**
      * 修改用户状态
      * 修改用户状态
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public int updateUserStatus(SysUser user)
-    {
+    public int updateUserStatus(SysUser user) {
         return userMapper.updateUser(user);
         return userMapper.updateUser(user);
     }
     }
 
 
     /**
     /**
      * 修改用户基本信息
      * 修改用户基本信息
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public int updateUserProfile(SysUser user)
-    {
+    public int updateUserProfile(SysUser user) {
         return userMapper.updateUser(user);
         return userMapper.updateUser(user);
     }
     }
 
 
     /**
     /**
      * 修改用户头像
      * 修改用户头像
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
-     * @param avatar 头像地址
+     * @param avatar   头像地址
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public boolean updateUserAvatar(String userName, String avatar)
-    {
+    public boolean updateUserAvatar(String userName, String avatar) {
         return userMapper.updateUserAvatar(userName, avatar) > 0;
         return userMapper.updateUserAvatar(userName, avatar) > 0;
     }
     }
 
 
     /**
     /**
      * 重置用户密码
      * 重置用户密码
-     * 
+     *
      * @param user 用户信息
      * @param user 用户信息
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public int resetPwd(SysUser user)
-    {
+    public int resetPwd(SysUser user) {
         return userMapper.updateUser(user);
         return userMapper.updateUser(user);
     }
     }
 
 
     /**
     /**
      * 重置用户密码
      * 重置用户密码
-     * 
+     *
      * @param userName 用户名
      * @param userName 用户名
      * @param password 密码
      * @param password 密码
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public int resetUserPwd(String userName, String password)
-    {
+    public int resetUserPwd(String userName, String password) {
         return userMapper.resetUserPwd(userName, password);
         return userMapper.resetUserPwd(userName, password);
     }
     }
 
 
     /**
     /**
      * 新增用户角色信息
      * 新增用户角色信息
-     * 
+     *
      * @param user 用户对象
      * @param user 用户对象
      */
      */
-    public void insertUserRole(SysUser user)
-    {
+    public void insertUserRole(SysUser user) {
         Long[] roles = user.getRoleIds();
         Long[] roles = user.getRoleIds();
-        if (StringUtils.isNotNull(roles))
-        {
+        if (StringUtils.isNotNull(roles)) {
             // 新增用户与角色管理
             // 新增用户与角色管理
             List<SysUserRole> list = new ArrayList<SysUserRole>();
             List<SysUserRole> list = new ArrayList<SysUserRole>();
-            for (Long roleId : roles)
-            {
+            for (Long roleId : roles) {
                 SysUserRole ur = new SysUserRole();
                 SysUserRole ur = new SysUserRole();
                 ur.setUserId(user.getUserId());
                 ur.setUserId(user.getUserId());
                 ur.setRoleId(roleId);
                 ur.setRoleId(roleId);
                 list.add(ur);
                 list.add(ur);
             }
             }
-            if (list.size() > 0)
-            {
+            if (list.size() > 0) {
                 userRoleMapper.batchUserRole(list);
                 userRoleMapper.batchUserRole(list);
             }
             }
         }
         }
@@ -404,25 +370,21 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 新增用户岗位信息
      * 新增用户岗位信息
-     * 
+     *
      * @param user 用户对象
      * @param user 用户对象
      */
      */
-    public void insertUserPost(SysUser user)
-    {
+    public void insertUserPost(SysUser user) {
         Long[] posts = user.getPostIds();
         Long[] posts = user.getPostIds();
-        if (StringUtils.isNotNull(posts))
-        {
+        if (StringUtils.isNotNull(posts)) {
             // 新增用户与岗位管理
             // 新增用户与岗位管理
             List<SysUserPost> list = new ArrayList<SysUserPost>();
             List<SysUserPost> list = new ArrayList<SysUserPost>();
-            for (Long postId : posts)
-            {
+            for (Long postId : posts) {
                 SysUserPost up = new SysUserPost();
                 SysUserPost up = new SysUserPost();
                 up.setUserId(user.getUserId());
                 up.setUserId(user.getUserId());
                 up.setPostId(postId);
                 up.setPostId(postId);
                 list.add(up);
                 list.add(up);
             }
             }
-            if (list.size() > 0)
-            {
+            if (list.size() > 0) {
                 userPostMapper.batchUserPost(list);
                 userPostMapper.batchUserPost(list);
             }
             }
         }
         }
@@ -430,25 +392,21 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 新增用户角色信息
      * 新增用户角色信息
-     * 
-     * @param userId 用户ID
+     *
+     * @param userId  用户ID
      * @param roleIds 角色组
      * @param roleIds 角色组
      */
      */
-    public void insertUserRole(Long userId, Long[] roleIds)
-    {
-        if (StringUtils.isNotNull(roleIds))
-        {
+    public void insertUserRole(Long userId, Long[] roleIds) {
+        if (StringUtils.isNotNull(roleIds)) {
             // 新增用户与角色管理
             // 新增用户与角色管理
             List<SysUserRole> list = new ArrayList<SysUserRole>();
             List<SysUserRole> list = new ArrayList<SysUserRole>();
-            for (Long roleId : roleIds)
-            {
+            for (Long roleId : roleIds) {
                 SysUserRole ur = new SysUserRole();
                 SysUserRole ur = new SysUserRole();
                 ur.setUserId(userId);
                 ur.setUserId(userId);
                 ur.setRoleId(roleId);
                 ur.setRoleId(roleId);
                 list.add(ur);
                 list.add(ur);
             }
             }
-            if (list.size() > 0)
-            {
+            if (list.size() > 0) {
                 userRoleMapper.batchUserRole(list);
                 userRoleMapper.batchUserRole(list);
             }
             }
         }
         }
@@ -456,14 +414,13 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 通过用户ID删除用户
      * 通过用户ID删除用户
-     * 
+     *
      * @param userId 用户ID
      * @param userId 用户ID
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public int deleteUserById(Long userId)
-    {
+    public int deleteUserById(Long userId) {
         // 删除用户与角色关联
         // 删除用户与角色关联
         userRoleMapper.deleteUserRoleByUserId(userId);
         userRoleMapper.deleteUserRoleByUserId(userId);
         // 删除用户与岗位表
         // 删除用户与岗位表
@@ -473,16 +430,14 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 批量删除用户信息
      * 批量删除用户信息
-     * 
+     *
      * @param userIds 需要删除的用户ID
      * @param userIds 需要删除的用户ID
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
     @Transactional
     @Transactional
-    public int deleteUserByIds(Long[] userIds)
-    {
-        for (Long userId : userIds)
-        {
+    public int deleteUserByIds(Long[] userIds) {
+        for (Long userId : userIds) {
             checkUserAllowed(new SysUser(userId));
             checkUserAllowed(new SysUser(userId));
             checkUserDataScope(userId);
             checkUserDataScope(userId);
         }
         }
@@ -495,17 +450,15 @@ public class SysUserServiceImpl implements ISysUserService
 
 
     /**
     /**
      * 导入用户数据
      * 导入用户数据
-     * 
-     * @param userList 用户数据列表
+     *
+     * @param userList        用户数据列表
      * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
      * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
-     * @param operName 操作用户
+     * @param operName        操作用户
      * @return 结果
      * @return 结果
      */
      */
     @Override
     @Override
-    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName)
-    {
-        if (StringUtils.isNull(userList) || userList.size() == 0)
-        {
+    public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) {
+        if (StringUtils.isNull(userList) || userList.size() == 0) {
             throw new ServiceException("导入用户数据不能为空!");
             throw new ServiceException("导入用户数据不能为空!");
         }
         }
         int successNum = 0;
         int successNum = 0;
@@ -513,50 +466,38 @@ public class SysUserServiceImpl implements ISysUserService
         StringBuilder successMsg = new StringBuilder();
         StringBuilder successMsg = new StringBuilder();
         StringBuilder failureMsg = new StringBuilder();
         StringBuilder failureMsg = new StringBuilder();
         String password = configService.selectConfigByKey("sys.user.initPassword");
         String password = configService.selectConfigByKey("sys.user.initPassword");
-        for (SysUser user : userList)
-        {
-            try
-            {
+        for (SysUser user : userList) {
+            try {
                 // 验证是否存在这个用户
                 // 验证是否存在这个用户
                 SysUser u = userMapper.selectUserByUserName(user.getUserName());
                 SysUser u = userMapper.selectUserByUserName(user.getUserName());
-                if (StringUtils.isNull(u))
-                {
+                if (StringUtils.isNull(u)) {
                     BeanValidators.validateWithException(validator, user);
                     BeanValidators.validateWithException(validator, user);
                     user.setPassword(SecurityUtils.encryptPassword(password));
                     user.setPassword(SecurityUtils.encryptPassword(password));
                     user.setCreateBy(operName);
                     user.setCreateBy(operName);
                     this.insertUser(user);
                     this.insertUser(user);
                     successNum++;
                     successNum++;
                     successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
                     successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
-                }
-                else if (isUpdateSupport)
-                {
+                } else if (isUpdateSupport) {
                     BeanValidators.validateWithException(validator, user);
                     BeanValidators.validateWithException(validator, user);
                     user.setUpdateBy(operName);
                     user.setUpdateBy(operName);
                     this.updateUser(user);
                     this.updateUser(user);
                     successNum++;
                     successNum++;
                     successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
                     successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
-                }
-                else
-                {
+                } else {
                     failureNum++;
                     failureNum++;
                     failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在");
                     failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在");
                 }
                 }
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
                 failureNum++;
                 failureNum++;
                 String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
                 String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
                 failureMsg.append(msg + e.getMessage());
                 failureMsg.append(msg + e.getMessage());
                 log.error(msg, e);
                 log.error(msg, e);
             }
             }
         }
         }
-        if (failureNum > 0)
-        {
+        if (failureNum > 0) {
             failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
             failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
             throw new ServiceException(failureMsg.toString());
             throw new ServiceException(failureMsg.toString());
-        }
-        else
-        {
+        } else {
             successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
             successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
         }
         }
         return successMsg.toString();
         return successMsg.toString();
@@ -566,4 +507,9 @@ public class SysUserServiceImpl implements ISysUserService
     public List<JSONObject> queryRoles(String type) {
     public List<JSONObject> queryRoles(String type) {
         return userMapper.queryRoles(type);
         return userMapper.queryRoles(type);
     }
     }
+
+    @Override
+    public List<JSONObject> queryUserByIds(List<String> userIds) {
+        return userMapper.queryUserByIds(userIds);
+    }
 }
 }

+ 11 - 0
ruixuan-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -296,4 +296,15 @@
             )
             )
         </if>
         </if>
     </select>
     </select>
+
+    <select id="queryUserByIds" parameterType="String" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.user_id as 'userId',
+        nick_name as 'nickName'
+        FROM sys_user t1
+        WHERE user_id in
+        <foreach collection="userIds" item="userId" open="(" separator="," close=")">
+            #{userId}
+        </foreach>
+    </select>
 </mapper> 
 </mapper>