Browse Source

Merge branch 'test'

yangzian 3 years ago
parent
commit
5445cb9ebc
92 changed files with 8680 additions and 697 deletions
  1. 31 7
      pom.xml
  2. 67 0
      ruixuan-admin/src/main/java/com/ruixuan/web/controller/system/SysIndustryController.java
  3. 26 8
      ruixuan-admin/src/main/java/com/ruixuan/web/controller/system/SysUserController.java
  4. 2 2
      ruixuan-admin/src/main/resources/application-dev.yml
  5. 1 1
      ruixuan-admin/src/main/resources/logback.xml
  6. 18 1
      ruixuan-common/pom.xml
  7. 28 0
      ruixuan-common/src/main/java/com/ruixuan/common/cos/CosFileDTO.java
  8. 106 0
      ruixuan-common/src/main/java/com/ruixuan/common/cos/CosUpload.java
  9. 308 0
      ruixuan-common/src/main/java/com/ruixuan/common/cos/CosUtils.java
  10. 119 0
      ruixuan-common/src/main/java/com/ruixuan/common/file/FileType.java
  11. 139 0
      ruixuan-common/src/main/java/com/ruixuan/common/file/FileTypeJudge.java
  12. 113 0
      ruixuan-common/src/main/java/com/ruixuan/common/file/FileUtil.java
  13. 92 0
      ruixuan-common/src/main/java/com/ruixuan/common/utils/Check.java
  14. 90 1
      ruixuan-common/src/main/java/com/ruixuan/common/utils/DateUtils.java
  15. 244 0
      ruixuan-common/src/main/java/com/ruixuan/common/utils/LoadFileUtil.java
  16. 121 0
      ruixuan-common/src/main/java/com/ruixuan/common/utils/encryption/AesEncryptUtil.java
  17. 12 0
      ruixuan-common/src/main/java/com/ruixuan/common/utils/encryption/EncryptedString.java
  18. 93 7
      ruixuan-common/src/main/java/com/ruixuan/common/utils/file/FileUtils.java
  19. 4 0
      ruixuan-framework/src/main/java/com/ruixuan/framework/config/SecurityConfig.java
  20. 0 9
      ruixuan-live/pom.xml
  21. 49 0
      ruixuan-live/src/main/java/com/ruixuan/data/controller/KuaishouLiveDataController.java
  22. 178 0
      ruixuan-live/src/main/java/com/ruixuan/data/entity/KuaishouLiveDataAnalysis.java
  23. 116 0
      ruixuan-live/src/main/java/com/ruixuan/data/entity/KuaishouLiveDataFunnel.java
  24. 133 0
      ruixuan-live/src/main/java/com/ruixuan/data/entity/KuaishouLiveDataKanban.java
  25. 118 0
      ruixuan-live/src/main/java/com/ruixuan/data/entity/KuaishouLiveDataOverview.java
  26. 65 0
      ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataAnalysisMapper.java
  27. 65 0
      ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataFunnelMapper.java
  28. 64 0
      ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataKanbanMapper.java
  29. 64 0
      ruixuan-live/src/main/java/com/ruixuan/data/mapper/KuaishouLiveDataOverviewMapper.java
  30. 65 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataAnalysisService.java
  31. 65 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataFunnelService.java
  32. 65 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataKanbanService.java
  33. 65 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/IKuaishouLiveDataOverviewService.java
  34. 125 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataAnalysisServiceImpl.java
  35. 119 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataFunnelServiceImpl.java
  36. 134 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataKanbanServiceImpl.java
  37. 121 0
      ruixuan-live/src/main/java/com/ruixuan/data/service/impl/KuaishouLiveDataOverviewServiceImpl.java
  38. 389 0
      ruixuan-live/src/main/java/com/ruixuan/data/utils/ExportExcelUtils.java
  39. 136 0
      ruixuan-live/src/main/java/com/ruixuan/data/utils/LiveDataExcelUtils.java
  40. 162 0
      ruixuan-live/src/main/java/com/ruixuan/live/controller/KuaishouLiveBroadcastController.java
  41. 119 0
      ruixuan-live/src/main/java/com/ruixuan/live/controller/KuaishouLiveUserAccountController.java
  42. 189 0
      ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveBroadcast.java
  43. 108 0
      ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveBroadcastFiles.java
  44. 122 0
      ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveUserAccount.java
  45. 61 0
      ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveUserAccountPart.java
  46. 62 0
      ruixuan-live/src/main/java/com/ruixuan/live/mapper/KuaishouLiveBroadcastFilesMapper.java
  47. 63 0
      ruixuan-live/src/main/java/com/ruixuan/live/mapper/KuaishouLiveBroadcastMapper.java
  48. 67 0
      ruixuan-live/src/main/java/com/ruixuan/live/mapper/KuaishouLiveUserAccountMapper.java
  49. 36 0
      ruixuan-live/src/main/java/com/ruixuan/live/mapper/KuaishouLiveUserAccountPartMapper.java
  50. 69 0
      ruixuan-live/src/main/java/com/ruixuan/live/service/IKuaishouLiveBroadcastService.java
  51. 29 0
      ruixuan-live/src/main/java/com/ruixuan/live/service/IKuaishouLiveUserAccountPartService.java
  52. 68 0
      ruixuan-live/src/main/java/com/ruixuan/live/service/IKuaishouLiveUserAccountService.java
  53. 341 0
      ruixuan-live/src/main/java/com/ruixuan/live/service/impl/KuaishouLiveBroadcastServiceImpl.java
  54. 45 0
      ruixuan-live/src/main/java/com/ruixuan/live/service/impl/KuaishouLiveUserAccountPartServiceImpl.java
  55. 161 0
      ruixuan-live/src/main/java/com/ruixuan/live/service/impl/KuaishouLiveUserAccountServiceImpl.java
  56. 155 0
      ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataAnalysisMapper.xml
  57. 124 0
      ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataFunnelMapper.xml
  58. 227 0
      ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataKanbanMapper.xml
  59. 124 0
      ruixuan-live/src/main/resources/mapper/data/KuaishouLiveDataOverviewMapper.xml
  60. 97 0
      ruixuan-live/src/main/resources/mapper/live/KuaishouLiveBroadcastFilesMapper.xml
  61. 256 0
      ruixuan-live/src/main/resources/mapper/live/KuaishouLiveBroadcastMapper.xml
  62. 196 0
      ruixuan-live/src/main/resources/mapper/live/KuaishouLiveUserAccountMapper.xml
  63. 75 0
      ruixuan-live/src/main/resources/mapper/live/KuaishouLiveUserAccountPartMapper.xml
  64. 149 17
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/controller/SaleClueInfoController.java
  65. 125 0
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/listener/ImportExcelListener.java
  66. 25 0
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/mapper/SaleClueDistributionInfoMapper.java
  67. 69 2
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/mapper/SaleClueInfoMapper.java
  68. 23 0
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/mapper/SaleClueRecordInfoMapper.java
  69. 7 0
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/mapper/SaleQuotaInfoMapper.java
  70. 42 0
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/SaleClueDistributionInfoPojo.java
  71. 26 5
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/SaleClueInfoPojo.java
  72. 5 2
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/SaleClueRecordInfoPojo.java
  73. 1 1
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/TestPojo.java
  74. 109 0
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/vo/SaleRecordVo.java
  75. 39 0
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/vo/SaleTaskInfoVo.java
  76. 19 2
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/service/ISaleClueInfoService.java
  77. 315 42
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/service/impl/SaleClueInfoServiceImpl.java
  78. 65 61
      ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/utils/CsvImportUtil.java
  79. 0 142
      ruixuan-salesLeads/src/main/java/com/ruixuan/salesLeads/listener/ImportExcelListener.java
  80. 28 0
      ruixuan-salesLeads/src/main/resources/mapper/salesLeads/SaleClueDistributionInfoMapper.xml
  81. 178 1
      ruixuan-salesLeads/src/main/resources/mapper/salesLeads/SaleClueInfoMapper.xml
  82. 93 0
      ruixuan-salesLeads/src/main/resources/mapper/salesLeads/SaleClueRecordInfoMapper.xml
  83. 20 0
      ruixuan-salesLeads/src/main/resources/mapper/salesLeads/SaleQuotaInfoMapper.xml
  84. 0 7
      ruixuan-system/src/main/java/com/ruixuan/system/domain/SysIndustryInfo.java
  85. 6 0
      ruixuan-system/src/main/java/com/ruixuan/system/mapper/SysIndustryInfoMapper.java
  86. 34 0
      ruixuan-system/src/main/java/com/ruixuan/system/mapper/SysUserMapper.java
  87. 20 0
      ruixuan-system/src/main/java/com/ruixuan/system/service/ISysIndustryService.java
  88. 41 23
      ruixuan-system/src/main/java/com/ruixuan/system/service/ISysUserService.java
  89. 61 0
      ruixuan-system/src/main/java/com/ruixuan/system/service/impl/SysIndustryServiceImpl.java
  90. 121 145
      ruixuan-system/src/main/java/com/ruixuan/system/service/impl/SysUserServiceImpl.java
  91. 6 0
      ruixuan-system/src/main/resources/mapper/system/SysIndustryMapper.xml
  92. 347 211
      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"
          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">
-	<modelVersion>4.0.0</modelVersion>
-	
+    <modelVersion>4.0.0</modelVersion>
+
     <groupId>com.ruixuan</groupId>
     <artifactId>ruixuan</artifactId>
     <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>
         <ruixuan.version>3.8.2</ruixuan.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -30,11 +30,14 @@
         <commons.io.version>2.11.0</commons.io.version>
         <commons.fileupload.version>1.4</commons.fileupload.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>
         <velocity.version>2.3</velocity.version>
         <jwt.version>0.9.1</jwt.version>
     </properties>
-	
+
     <!-- 依赖声明 -->
     <dependencyManagement>
         <dependencies>
@@ -143,6 +146,27 @@
                 <version>${commons.collections.version}</version>
             </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解析器 -->
             <dependency>
                 <groupId>com.alibaba</groupId>

+ 67 - 0
ruixuan-admin/src/main/java/com/ruixuan/web/controller/system/SysIndustryController.java

@@ -0,0 +1,67 @@
+package com.ruixuan.web.controller.system;
+
+import com.ruixuan.common.annotation.Log;
+import com.ruixuan.common.constant.UserConstants;
+import com.ruixuan.common.core.controller.BaseController;
+import com.ruixuan.common.core.domain.AjaxResult;
+import com.ruixuan.common.core.domain.ResultResponse;
+import com.ruixuan.common.core.domain.entity.SysRole;
+import com.ruixuan.common.core.domain.entity.SysUser;
+import com.ruixuan.common.core.page.TableDataInfo;
+import com.ruixuan.common.enums.BusinessType;
+import com.ruixuan.common.utils.SecurityUtils;
+import com.ruixuan.common.utils.StringUtils;
+import com.ruixuan.common.utils.poi.ExcelUtil;
+import com.ruixuan.system.domain.SysIndustryInfo;
+import com.ruixuan.system.service.ISysIndustryService;
+import com.ruixuan.system.service.ISysPostService;
+import com.ruixuan.system.service.ISysRoleService;
+import com.ruixuan.system.service.ISysUserService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.apache.commons.lang3.ArrayUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 用户信息
+ * 
+ * @author ruixuan
+ */
+@Api(tags = "系统设置-行业",description = "system-industry")
+@RestController
+@RequestMapping("/system/industry")
+public class SysIndustryController extends BaseController
+{
+    @Autowired
+    private ISysUserService userService;
+
+    @Autowired
+    private ISysRoleService roleService;
+
+    @Autowired
+    private ISysPostService postService;
+
+
+    @Autowired
+    private ISysIndustryService industryService;
+
+    @ApiOperation(value = "根据用户id查询用户以及角色信息",notes = "根据用户id查询用户以及角色信息")
+    @GetMapping("/getIndustryInfoList")
+    public ResultResponse<List<SysIndustryInfo>> getIndustryInfoList(){
+
+        return industryService.getIndustryInfoList();
+    }
+
+
+
+
+}

+ 26 - 8
ruixuan-admin/src/main/java/com/ruixuan/web/controller/system/SysUserController.java

@@ -1,20 +1,18 @@
 package com.ruixuan.web.controller.system;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
 import javax.servlet.http.HttpServletResponse;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
-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 org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import com.ruixuan.common.annotation.Log;
 import com.ruixuan.common.constant.UserConstants;
@@ -36,6 +34,7 @@ import com.ruixuan.system.service.ISysUserService;
  * 
  * @author ruixuan
  */
+@Api(tags = "系统设置-用户",description = "system-user")
 @RestController
 @RequestMapping("/system/user")
 public class SysUserController extends BaseController
@@ -234,4 +233,23 @@ public class SysUserController extends BaseController
         userService.insertUserAuth(userId, roleIds);
         return success();
     }
+
+
+    @ApiOperation(value = "根据用户id查询用户以及角色信息",notes = "根据用户id查询用户以及角色信息")
+    @GetMapping("/getUserRoleByUserId")
+    public AjaxResult getUserRoleByUserId( @ApiParam("用户id") @RequestParam(value = "userId")  Long userId) {
+        return AjaxResult.success("查询成功",userService.getUserRoleByUserId(userId));
+    }
+
+
+    @ApiOperation(value = "根据角色名称code查询用户信息",notes = "根据角色名称code查询用户信息-可以传入多个角色code")
+    @GetMapping("/getUserByRoleName")
+    public AjaxResult getUserByRoleName( @ApiParam("角色名称的code") @RequestParam(value = "roleName") String roleName) {
+        List<String> roleCodeList = Arrays.asList(StringUtils.split(roleName,","));
+        return AjaxResult.success("查询成功",userService.getUserByRoleName(roleCodeList));
+    }
+
+
+
+
 }

+ 2 - 2
ruixuan-admin/src/main/resources/application-dev.yml

@@ -18,7 +18,7 @@ ruoyi:
 # 开发环境配置
 server:
   # 服务器的HTTP端口,默认为8080
-  port: 8080
+  port: 9003
   servlet:
     # 应用的访问路径
     context-path: /
@@ -142,7 +142,7 @@ token:
     # 令牌密钥
     secret: abcdefghijklmnopqrstuvwxyz
     # 令牌有效期(默认30分钟)
-    expireTime: 30
+    expireTime: 1440
   
 # MyBatis配置
 mybatis:

+ 1 - 1
ruixuan-admin/src/main/resources/logback.xml

@@ -73,7 +73,7 @@
     </appender>
 	
 	<!-- 系统模块日志级别控制  -->
-	<logger name="com.ruixuan" level="debug" />
+	<logger name="com.ruixuan" level="info" />
 	<!-- Spring日志级别控制  -->
 	<logger name="org.springframework" level="warn" />
 

+ 18 - 1
ruixuan-common/pom.xml

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

+ 90 - 1
ruixuan-common/src/main/java/com/ruixuan/common/utils/DateUtils.java

@@ -8,8 +8,13 @@ import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
+import java.util.Calendar;
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.commons.lang3.time.DateFormatUtils;
+import org.springframework.security.config.web.servlet.headers.HttpPublicKeyPinningDsl;
 
 /**
  * 时间工具类
@@ -24,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 YYYYMMDD = "yyyyMMdd";
+
     public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
 
     public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
@@ -194,6 +201,88 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
      */
     public static Long strDateToInt(String date){
 
-        return Long.getLong(date.replaceAll("-",""));
+        return Long.valueOf(date.replaceAll("-",""));
+    }
+
+
+
+
+    /**
+     *
+     * @description: 获取当前周的开始和截至时间
+     * @param
+     * @return: java.util.Map
+     * @author: zianY
+     * @time: 2022/6/1
+     */
+    public static Map getWeekBeginAndEnd(){
+        Map<String,String> timeMap = new HashMap<>();
+        String begin = parseDateToStr(YYYY_MM_DD,getBeginDayOfWeek());
+        String end = parseDateToStr(YYYY_MM_DD,getEendDayOfWeek());
+        timeMap.put("begin",begin+" 00:00:00");
+        timeMap.put("end",end+" 23:59:59");
+        return timeMap;
     }
+
+
+
+    /**
+     *
+     * @description: 获取本周开始时间
+     *
+     * @param
+     * @return: java.util.Date
+     * @author: zianY
+     * @time: 2022/6/1
+     */
+    public static Date getBeginDayOfWeek(){
+        Date date = new Date();
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(date);
+        int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
+        if (dayOfWeek ==  1){
+            dayOfWeek +=7;
+        }
+        cal.add(Calendar.DATE,2-dayOfWeek);
+        return cal.getTime();
+    }
+
+    /**
+     *
+     * @description: 获取本周结束时间
+     *
+     * @param
+     * @return: java.util.Date
+     * @author: zianY
+     * @time: 2022/6/1
+     */
+    public static Date getEendDayOfWeek(){
+
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(getBeginDayOfWeek());
+        cal.add(Calendar.DAY_OF_WEEK,6);
+        return cal.getTime();
+    }
+
+    public static void main(String[] args) {
+        //System.out.println(parseDateToStr(YYYY_MM_DD,getBeginDayOfWeek()));
+       // System.out.println(parseDateToStr(YYYY_MM_DD,getEendDayOfWeek()));
+
+        System.out.println(strDateToInt("2022-05"));
+    }
+
+    /**
+     * 指定模式的时间格式
+     */
+    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个字符
+}

+ 93 - 7
ruixuan-common/src/main/java/com/ruixuan/common/utils/file/FileUtils.java

@@ -1,17 +1,12 @@
 package com.ruixuan.common.utils.file;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
+import java.io.*;
 import java.net.URLEncoder;
 import java.nio.charset.StandardCharsets;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.hutool.core.text.csv.CsvWriter;
 import com.ruixuan.common.config.RuoYiConfig;
 import com.ruixuan.common.utils.uuid.IdUtils;
 import org.apache.commons.io.IOUtils;
@@ -19,6 +14,7 @@ import org.apache.commons.lang3.ArrayUtils;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.StringUtils;
 import org.apache.commons.io.FilenameUtils;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * 文件处理工具类
@@ -291,4 +287,94 @@ public class FileUtils
         return baseName;
     }
 
+
+    /**
+     * 获得文件编码
+     * @param file
+     * @return
+     * @throws Exception
+     */
+    public static String getFileEncoding(File file) throws Exception {
+
+            String charset = "GBK";
+            byte[] first3Bytes = new byte[3];
+            try {
+                boolean checked = false;
+                BufferedInputStream bis = new BufferedInputStream(
+                        new FileInputStream(file));
+                bis.mark(0);
+                int read = bis.read(first3Bytes, 0, 3);
+                if (read == -1)
+                    return charset;
+                if (first3Bytes[0] == (byte) 0xFF && first3Bytes[1] == (byte) 0xFE) {
+                    charset = "UTF-16LE";
+                    checked = true;
+                } else if (first3Bytes[0] == (byte) 0xFE
+                        && first3Bytes[1] == (byte) 0xFF) {
+                    charset = "UTF-16BE";
+                    checked = true;
+                } else if (first3Bytes[0] == (byte) 0xEF
+                        && first3Bytes[1] == (byte) 0xBB
+                        && first3Bytes[2] == (byte) 0xBF) {
+                    charset = "UTF-8";
+                    checked = true;
+                }
+                bis.reset();
+
+                if (!checked) {
+                    int loc = 0;
+                    while ((read = bis.read()) != -1) {
+                        loc++;
+                        if (read >= 0xF0)
+                            break;
+                        // 单独出现BF以下的,也算是GBK
+                        if (0x80 <= read && read <= 0xBF)
+                            break;
+                        if (0xC0 <= read && read <= 0xDF) {
+                            read = bis.read();
+                            if (0x80 <= read && read <= 0xBF)// 双字节 (0xC0 - 0xDF)
+                                // (0x80 -
+                                // 0xBF),也可能在GB编码内
+                                continue;
+                            else
+                                break;
+                            // 也有可能出错,但是几率较小
+                        } else if (0xE0 <= read && read <= 0xEF) {
+                            read = bis.read();
+                            if (0x80 <= read && read <= 0xBF) {
+                                read = bis.read();
+                                if (0x80 <= read && read <= 0xBF) {
+                                    charset = "UTF-8";
+                                    break;
+                                } else
+                                    break;
+                            } else
+                                break;
+                        }
+                    }
+
+                }
+                bis.close();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            return charset;
+    }
+
+
+
+    public static void addBom(File file) throws Exception{
+        FileOutputStream fileOutputStream = new FileOutputStream(file,true);
+        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream,"UTF-8");
+        BufferedWriter bw = new BufferedWriter(outputStreamWriter);
+        byte[] bytes = new byte[]{(byte) 0xEF, (byte) 0xBB, (byte) 0xBF};
+        bw.newLine();
+        bw.write(new String(bytes));
+
+    }
+
+
+
+
+
 }

+ 4 - 0
ruixuan-framework/src/main/java/com/ruixuan/framework/config/SecurityConfig.java

@@ -116,6 +116,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                     .antMatchers("/test/**").permitAll()
                     .antMatchers("/demoController/**").permitAll()
                     .antMatchers("/sale/**").permitAll()
+                    .antMatchers("/live/**").permitAll()
+                    .antMatchers("/system/user/getUserRoleByUserId").permitAll()
+                    .antMatchers("/system/user/getUserByRoleName").permitAll()
+                    .antMatchers("/system/industry/**").permitAll()
 
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()

+ 0 - 9
ruixuan-live/pom.xml

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

+ 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, "商品分析数据数据");
+    }
+}

+ 178 - 0
ruixuan-live/src/main/java/com/ruixuan/data/entity/KuaishouLiveDataAnalysis.java

@@ -0,0 +1,178 @@
+package com.ruixuan.data.entity;
+
+import com.ruixuan.common.annotation.Excel;
+import com.ruixuan.common.core.domain.BaseEntity;
+import lombok.Data;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.math.BigDecimal;
+
+/**
+ * 商品分析数据对象 kuaishou_live_data_analysis
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Data
+public class KuaishouLiveDataAnalysis extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 快手ID
+     */
+    @Excel(name = "快手ID")
+    private Long ksId;
+
+    /**
+     * 快手昵称
+     */
+    @Excel(name = "快手昵称")
+    private String ksName;
+
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID")
+    private Long accountId;
+
+    /**
+     * 账户名称
+     */
+    @Excel(name = "账户名称")
+    private String accountName;
+
+    /**
+     * 商品名称
+     */
+    @Excel(name = "商品名称")
+    private String waresName;
+
+    /**
+     * 商品上架时间
+     */
+    @Excel(name = "商品上架时间")
+    private String waresPutDate;
+
+    /**
+     * 商品价格
+     */
+    @Excel(name = "商品价格")
+    private BigDecimal waresPrice;
+
+    /**
+     * 商品销售额
+     */
+    @Excel(name = "商品销售额")
+    private BigDecimal waresSalesAmount;
+
+    /**
+     * 商品销量
+     */
+    @Excel(name = "商品销量")
+    private BigDecimal waresSalesVolume;
+
+    /**
+     * 待支付订单数
+     */
+    @Excel(name = "待支付订单数")
+    private Long topayOrders;
+
+    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 setWaresName(String waresName) {
+        this.waresName = waresName;
+    }
+
+    public String getWaresName() {
+        return waresName;
+    }
+
+    public void setWaresPutDate(String waresPutDate) {
+        this.waresPutDate = waresPutDate;
+    }
+
+    public String getWaresPutDate() {
+        return waresPutDate;
+    }
+
+    public void setWaresPrice(BigDecimal waresPrice) {
+        this.waresPrice = waresPrice;
+    }
+
+    public BigDecimal getWaresPrice() {
+        return waresPrice;
+    }
+
+    public void setWaresSalesAmount(BigDecimal waresSalesAmount) {
+        this.waresSalesAmount = waresSalesAmount;
+    }
+
+    public BigDecimal getWaresSalesAmount() {
+        return waresSalesAmount;
+    }
+
+    public void setWaresSalesVolume(BigDecimal waresSalesVolume) {
+        this.waresSalesVolume = waresSalesVolume;
+    }
+
+    public BigDecimal getWaresSalesVolume() {
+        return waresSalesVolume;
+    }
+
+    public void setTopayOrders(Long topayOrders) {
+        this.topayOrders = topayOrders;
+    }
+
+    public Long getTopayOrders() {
+        return topayOrders;
+    }
+
+    @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("waresName", getWaresName())
+                .append("waresPutDate", getWaresPutDate())
+                .append("waresPrice", getWaresPrice())
+                .append("waresSalesAmount", getWaresSalesAmount())
+                .append("waresSalesVolume", getWaresSalesVolume())
+                .append("topayOrders", getTopayOrders())
+                .append("createTime", getCreateTime())
+                .append("updateTime", getUpdateTime())
+                .toString();
+    }
+}

+ 116 - 0
ruixuan-live/src/main/java/com/ruixuan/data/entity/KuaishouLiveDataFunnel.java

@@ -0,0 +1,116 @@
+package com.ruixuan.data.entity;
+
+import com.ruixuan.common.annotation.Excel;
+import com.ruixuan.common.core.domain.BaseEntity;
+import lombok.Data;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 直播漏斗数据对象 kuaishou_live_data_funnel
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Data
+public class KuaishouLiveDataFunnel extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 快手ID
+     */
+    @Excel(name = "快手ID")
+    private Long ksId;
+
+    /**
+     * 快手昵称
+     */
+    @Excel(name = "快手昵称")
+    private String ksName;
+
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID")
+    private Long accountId;
+
+    /**
+     * 账户名称
+     */
+    @Excel(name = "账户名称")
+    private String accountName;
+
+    /**
+     * 累计观看人数
+     */
+    @Excel(name = "累计观看人数")
+    private Long allViewers;
+
+    /**
+     * 日期
+     */
+    @Excel(name = "日期")
+    private String statDate;
+
+    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 setAllViewers(Long allViewers) {
+        this.allViewers = allViewers;
+    }
+
+    public Long getAllViewers() {
+        return allViewers;
+    }
+
+    public void setStatDate(String statDate) {
+        this.statDate = statDate;
+    }
+
+    public String getStatDate() {
+        return statDate;
+    }
+
+    @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("allViewers", getAllViewers())
+                .append("statDate", getStatDate())
+                .append("createTime", getCreateTime())
+                .append("updateTime", getUpdateTime())
+                .toString();
+    }
+}

+ 133 - 0
ruixuan-live/src/main/java/com/ruixuan/data/entity/KuaishouLiveDataKanban.java

@@ -0,0 +1,133 @@
+package com.ruixuan.data.entity;
+
+import com.ruixuan.common.annotation.Excel;
+import com.ruixuan.common.core.domain.BaseEntity;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 直播数据看板对象 kuaishou_live_data_kanban
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Data
+public class KuaishouLiveDataKanban extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 快手ID
+     */
+    @Excel(name = "快手ID")
+    private Long ksId;
+
+    /**
+     * 快手昵称
+     */
+    @Excel(name = "快手昵称")
+    private String ksName;
+
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID")
+    private Long accountId;
+
+    /**
+     * 账户名称
+     */
+    @Excel(name = "账户名称")
+    private String accountName;
+
+    /**
+     * 实时在线观看人数
+     */
+    @Excel(name = "实时在线观看人数")
+    private Long onlineViewers;
+
+    /**
+     * 观看人数
+     */
+    @Excel(name = "观看人数")
+    private Long viewers;
+
+    /**
+     * 观看次数
+     */
+    @Excel(name = "观看次数")
+    private Long viewingTimes;
+
+    /**
+     * 人均观看时长
+     */
+    @Excel(name = "人均观看时长")
+    private String perViewingTime;
+
+    /**
+     * 粉丝平均观看时长
+     */
+    @Excel(name = "粉丝平均观看时长")
+    private String fansViewingTime;
+
+    /**
+     * 打赏数
+     */
+    @Excel(name = "打赏数")
+    private Long rewards;
+
+    /**
+     * 上架商品数
+     */
+    @Excel(name = "上架商品数")
+    private Long putWares;
+
+    /**
+     * 新增粉丝数
+     */
+    @Excel(name = "新增粉丝数")
+    private Long newFans;
+
+    /**
+     * 点赞数
+     */
+    @Excel(name = "点赞数")
+    private Long likes;
+
+    /**
+     * 商品点击人数
+     */
+    @Excel(name = "商品点击人数")
+    private Long waresClicks;
+
+    /**
+     * 小黄车点击数
+     */
+    @Excel(name = "小黄车点击数")
+    private Long carClicks;
+
+    /**
+     * 累计成交金额
+     */
+    @Excel(name = "累计成交金额")
+    private BigDecimal allAmount;
+
+    /**
+     * 累计成交人数
+     */
+    @Excel(name = "累计成交人数")
+    private Long allTurnover;
+
+    /**
+     * 累计成交订单数
+     */
+    @Excel(name = "累计成交订单数")
+    private Long allOrders;
+
+    /**
+     * 成交转化率
+     */
+    @Excel(name = "成交转化率")
+    private String turnoverRatio;
+
+}

+ 118 - 0
ruixuan-live/src/main/java/com/ruixuan/data/entity/KuaishouLiveDataOverview.java

@@ -0,0 +1,118 @@
+package com.ruixuan.data.entity;
+
+import com.ruixuan.common.annotation.Excel;
+import com.ruixuan.common.core.domain.BaseEntity;
+import lombok.Data;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.math.BigDecimal;
+
+/**
+ * 直播数据概览对象 kuaishou_live_data_overview
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Data
+public class KuaishouLiveDataOverview extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 快手ID
+     */
+    @Excel(name = "快手ID")
+    private Long ksId;
+
+    /**
+     * 快手昵称
+     */
+    @Excel(name = "快手昵称")
+    private String ksName;
+
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID")
+    private Long accountId;
+
+    /**
+     * 账户名称
+     */
+    @Excel(name = "账户名称")
+    private String accountName;
+
+    /**
+     * 成交金额
+     */
+    @Excel(name = "成交金额")
+    private BigDecimal amounts;
+
+    /**
+     * 日期
+     */
+    @Excel(name = "日期")
+    private String statDate;
+
+    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 setAmounts(BigDecimal amounts) {
+        this.amounts = amounts;
+    }
+
+    public BigDecimal getAmounts() {
+        return amounts;
+    }
+
+    public void setStatDate(String statDate) {
+        this.statDate = statDate;
+    }
+
+    public String getStatDate() {
+        return statDate;
+    }
+
+    @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("amounts", getAmounts())
+                .append("statDate", getStatDate())
+                .append("createTime", getCreateTime())
+                .append("updateTime", getUpdateTime())
+                .toString();
+    }
+}

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

@@ -0,0 +1,65 @@
+package com.ruixuan.data.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 商品分析数据Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface KuaishouLiveDataAnalysisMapper {
+    /**
+     * 查询商品分析数据
+     *
+     * @param ksId 商品分析数据主键
+     * @return 商品分析数据
+     */
+    public KuaishouLiveDataAnalysis selectKuaishouLiveDataAnalysisByKsId(Long ksId);
+
+    /**
+     * 查询商品分析数据列表
+     *
+     * @param kuaishouLiveDataAnalysis 商品分析数据
+     * @return 商品分析数据集合
+     */
+    public List<KuaishouLiveDataAnalysis> selectKuaishouLiveDataAnalysisList(KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis);
+
+    /**
+     * 新增商品分析数据
+     *
+     * @param kuaishouLiveDataAnalysis 商品分析数据
+     * @return 结果
+     */
+    public int insertKuaishouLiveDataAnalysis(KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis);
+
+    /**
+     * 修改商品分析数据
+     *
+     * @param kuaishouLiveDataAnalysis 商品分析数据
+     * @return 结果
+     */
+    public int updateKuaishouLiveDataAnalysis(KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis);
+
+    /**
+     * 删除商品分析数据
+     *
+     * @param ksId 商品分析数据主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataAnalysisByKsId(Long ksId);
+
+    /**
+     * 批量删除商品分析数据
+     *
+     * @param ksIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataAnalysisByKsIds(Long[] ksIds);
+
+    int inserExcelBatchInfo(@Param(value = "analysisList") List<KuaishouLiveDataAnalysis> analysisList);
+}

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

@@ -0,0 +1,65 @@
+package com.ruixuan.data.mapper;
+
+import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
+import com.ruixuan.data.entity.KuaishouLiveDataFunnel;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 直播漏斗数据Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface KuaishouLiveDataFunnelMapper {
+    /**
+     * 查询直播漏斗数据
+     *
+     * @param ksId 直播漏斗数据主键
+     * @return 直播漏斗数据
+     */
+    public KuaishouLiveDataFunnel selectKuaishouLiveDataFunnelByKsId(Long ksId);
+
+    /**
+     * 查询直播漏斗数据列表
+     *
+     * @param kuaishouLiveDataFunnel 直播漏斗数据
+     * @return 直播漏斗数据集合
+     */
+    public List<KuaishouLiveDataFunnel> selectKuaishouLiveDataFunnelList(KuaishouLiveDataFunnel kuaishouLiveDataFunnel);
+
+    /**
+     * 新增直播漏斗数据
+     *
+     * @param kuaishouLiveDataFunnel 直播漏斗数据
+     * @return 结果
+     */
+    public int insertKuaishouLiveDataFunnel(KuaishouLiveDataFunnel kuaishouLiveDataFunnel);
+
+    /**
+     * 修改直播漏斗数据
+     *
+     * @param kuaishouLiveDataFunnel 直播漏斗数据
+     * @return 结果
+     */
+    public int updateKuaishouLiveDataFunnel(KuaishouLiveDataFunnel kuaishouLiveDataFunnel);
+
+    /**
+     * 删除直播漏斗数据
+     *
+     * @param ksId 直播漏斗数据主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataFunnelByKsId(Long ksId);
+
+    /**
+     * 批量删除直播漏斗数据
+     *
+     * @param ksIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataFunnelByKsIds(Long[] ksIds);
+
+    int inserExcelBatchInfo(@Param(value = "funnelList")  List<KuaishouLiveDataFunnel> funnelList);
+}

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

@@ -0,0 +1,64 @@
+package com.ruixuan.data.mapper;
+
+import com.ruixuan.data.entity.KuaishouLiveDataKanban;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 直播数据看板Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface KuaishouLiveDataKanbanMapper {
+    /**
+     * 查询直播数据看板
+     *
+     * @param ksId 直播数据看板主键
+     * @return 直播数据看板
+     */
+    public KuaishouLiveDataKanban selectKuaishouLiveDataKanbanByKsId(Long ksId);
+
+    /**
+     * 查询直播数据看板列表
+     *
+     * @param kuaishouLiveDataKanban 直播数据看板
+     * @return 直播数据看板集合
+     */
+    public List<KuaishouLiveDataKanban> selectKuaishouLiveDataKanbanList(KuaishouLiveDataKanban kuaishouLiveDataKanban);
+
+    /**
+     * 新增直播数据看板
+     *
+     * @param kuaishouLiveDataKanban 直播数据看板
+     * @return 结果
+     */
+    public int insertKuaishouLiveDataKanban(KuaishouLiveDataKanban kuaishouLiveDataKanban);
+
+    /**
+     * 修改直播数据看板
+     *
+     * @param kuaishouLiveDataKanban 直播数据看板
+     * @return 结果
+     */
+    public int updateKuaishouLiveDataKanban(KuaishouLiveDataKanban kuaishouLiveDataKanban);
+
+    /**
+     * 删除直播数据看板
+     *
+     * @param ksId 直播数据看板主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataKanbanByKsId(Long ksId);
+
+    /**
+     * 批量删除直播数据看板
+     *
+     * @param ksIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataKanbanByKsIds(Long[] ksIds);
+
+    int inserExcelBatchInfo(@Param(value = "kanbanList") List<KuaishouLiveDataKanban> kanbanList);
+}

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

@@ -0,0 +1,64 @@
+package com.ruixuan.data.mapper;
+
+import com.ruixuan.data.entity.KuaishouLiveDataOverview;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 直播数据概览Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface KuaishouLiveDataOverviewMapper {
+    /**
+     * 查询直播数据概览
+     *
+     * @param ksId 直播数据概览主键
+     * @return 直播数据概览
+     */
+    public KuaishouLiveDataOverview selectKuaishouLiveDataOverviewByKsId(Long ksId);
+
+    /**
+     * 查询直播数据概览列表
+     *
+     * @param kuaishouLiveDataOverview 直播数据概览
+     * @return 直播数据概览集合
+     */
+    public List<KuaishouLiveDataOverview> selectKuaishouLiveDataOverviewList(KuaishouLiveDataOverview kuaishouLiveDataOverview);
+
+    /**
+     * 新增直播数据概览
+     *
+     * @param kuaishouLiveDataOverview 直播数据概览
+     * @return 结果
+     */
+    public int insertKuaishouLiveDataOverview(KuaishouLiveDataOverview kuaishouLiveDataOverview);
+
+    /**
+     * 修改直播数据概览
+     *
+     * @param kuaishouLiveDataOverview 直播数据概览
+     * @return 结果
+     */
+    public int updateKuaishouLiveDataOverview(KuaishouLiveDataOverview kuaishouLiveDataOverview);
+
+    /**
+     * 删除直播数据概览
+     *
+     * @param ksId 直播数据概览主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataOverviewByKsId(Long ksId);
+
+    /**
+     * 批量删除直播数据概览
+     *
+     * @param ksIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataOverviewByKsIds(Long[] ksIds);
+
+    int inserExcelBatchInfo(@Param(value = "overviewList") List<KuaishouLiveDataOverview> overviewList);
+}

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

@@ -0,0 +1,65 @@
+package com.ruixuan.data.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+
+import java.util.List;
+
+/**
+ * 商品分析数据Service接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface IKuaishouLiveDataAnalysisService {
+    /**
+     * 查询商品分析数据
+     *
+     * @param ksId 商品分析数据主键
+     * @return 商品分析数据
+     */
+    public KuaishouLiveDataAnalysis selectKuaishouLiveDataAnalysisByKsId(Long ksId);
+
+    /**
+     * 查询商品分析数据列表
+     *
+     * @param kuaishouLiveDataAnalysis 商品分析数据
+     * @return 商品分析数据集合
+     */
+    public List<KuaishouLiveDataAnalysis> selectKuaishouLiveDataAnalysisList(KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis);
+
+    /**
+     * 新增商品分析数据
+     *
+     * @param kuaishouLiveDataAnalysis 商品分析数据
+     * @return 结果
+     */
+    public int insertKuaishouLiveDataAnalysis(KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis);
+
+    /**
+     * 修改商品分析数据
+     *
+     * @param kuaishouLiveDataAnalysis 商品分析数据
+     * @return 结果
+     */
+    public int updateKuaishouLiveDataAnalysis(KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis);
+
+    /**
+     * 批量删除商品分析数据
+     *
+     * @param ksIds 需要删除的商品分析数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataAnalysisByKsIds(Long[] ksIds);
+
+    /**
+     * 删除商品分析数据信息
+     *
+     * @param ksId 商品分析数据主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataAnalysisByKsId(Long ksId);
+
+    int inserExcelInfo(KuaishouLiveBroadcast broadcast,List<JSONObject> list);
+}

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

@@ -0,0 +1,65 @@
+package com.ruixuan.data.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.data.entity.KuaishouLiveDataFunnel;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+
+import java.util.List;
+
+/**
+ * 直播漏斗数据Service接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface IKuaishouLiveDataFunnelService {
+    /**
+     * 查询直播漏斗数据
+     *
+     * @param ksId 直播漏斗数据主键
+     * @return 直播漏斗数据
+     */
+    public KuaishouLiveDataFunnel selectKuaishouLiveDataFunnelByKsId(Long ksId);
+
+    /**
+     * 查询直播漏斗数据列表
+     *
+     * @param kuaishouLiveDataFunnel 直播漏斗数据
+     * @return 直播漏斗数据集合
+     */
+    public List<KuaishouLiveDataFunnel> selectKuaishouLiveDataFunnelList(KuaishouLiveDataFunnel kuaishouLiveDataFunnel);
+
+    /**
+     * 新增直播漏斗数据
+     *
+     * @param kuaishouLiveDataFunnel 直播漏斗数据
+     * @return 结果
+     */
+    public int insertKuaishouLiveDataFunnel(KuaishouLiveDataFunnel kuaishouLiveDataFunnel);
+
+    /**
+     * 修改直播漏斗数据
+     *
+     * @param kuaishouLiveDataFunnel 直播漏斗数据
+     * @return 结果
+     */
+    public int updateKuaishouLiveDataFunnel(KuaishouLiveDataFunnel kuaishouLiveDataFunnel);
+
+    /**
+     * 批量删除直播漏斗数据
+     *
+     * @param ksIds 需要删除的直播漏斗数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataFunnelByKsIds(Long[] ksIds);
+
+    /**
+     * 删除直播漏斗数据信息
+     *
+     * @param ksId 直播漏斗数据主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataFunnelByKsId(Long ksId);
+
+    int inserExcelInfo(KuaishouLiveBroadcast broadcast,List<JSONObject> list);
+}

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

@@ -0,0 +1,65 @@
+package com.ruixuan.data.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.data.entity.KuaishouLiveDataKanban;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+
+import java.util.List;
+
+/**
+ * 直播数据看板Service接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface IKuaishouLiveDataKanbanService {
+    /**
+     * 查询直播数据看板
+     *
+     * @param ksId 直播数据看板主键
+     * @return 直播数据看板
+     */
+    public KuaishouLiveDataKanban selectKuaishouLiveDataKanbanByKsId(Long ksId);
+
+    /**
+     * 查询直播数据看板列表
+     *
+     * @param kuaishouLiveDataKanban 直播数据看板
+     * @return 直播数据看板集合
+     */
+    public List<KuaishouLiveDataKanban> selectKuaishouLiveDataKanbanList(KuaishouLiveDataKanban kuaishouLiveDataKanban);
+
+    /**
+     * 新增直播数据看板
+     *
+     * @param kuaishouLiveDataKanban 直播数据看板
+     * @return 结果
+     */
+    public int insertKuaishouLiveDataKanban(KuaishouLiveDataKanban kuaishouLiveDataKanban);
+
+    /**
+     * 修改直播数据看板
+     *
+     * @param kuaishouLiveDataKanban 直播数据看板
+     * @return 结果
+     */
+    public int updateKuaishouLiveDataKanban(KuaishouLiveDataKanban kuaishouLiveDataKanban);
+
+    /**
+     * 批量删除直播数据看板
+     *
+     * @param ksIds 需要删除的直播数据看板主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataKanbanByKsIds(Long[] ksIds);
+
+    /**
+     * 删除直播数据看板信息
+     *
+     * @param ksId 直播数据看板主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataKanbanByKsId(Long ksId);
+
+    int inserExcelInfo(KuaishouLiveBroadcast broadcast,List<JSONObject> list);
+}

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

@@ -0,0 +1,65 @@
+package com.ruixuan.data.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.data.entity.KuaishouLiveDataOverview;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+
+import java.util.List;
+
+/**
+ * 直播数据概览Service接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface IKuaishouLiveDataOverviewService {
+    /**
+     * 查询直播数据概览
+     *
+     * @param ksId 直播数据概览主键
+     * @return 直播数据概览
+     */
+    public KuaishouLiveDataOverview selectKuaishouLiveDataOverviewByKsId(Long ksId);
+
+    /**
+     * 查询直播数据概览列表
+     *
+     * @param kuaishouLiveDataOverview 直播数据概览
+     * @return 直播数据概览集合
+     */
+    public List<KuaishouLiveDataOverview> selectKuaishouLiveDataOverviewList(KuaishouLiveDataOverview kuaishouLiveDataOverview);
+
+    /**
+     * 新增直播数据概览
+     *
+     * @param kuaishouLiveDataOverview 直播数据概览
+     * @return 结果
+     */
+    public int insertKuaishouLiveDataOverview(KuaishouLiveDataOverview kuaishouLiveDataOverview);
+
+    /**
+     * 修改直播数据概览
+     *
+     * @param kuaishouLiveDataOverview 直播数据概览
+     * @return 结果
+     */
+    public int updateKuaishouLiveDataOverview(KuaishouLiveDataOverview kuaishouLiveDataOverview);
+
+    /**
+     * 批量删除直播数据概览
+     *
+     * @param ksIds 需要删除的直播数据概览主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataOverviewByKsIds(Long[] ksIds);
+
+    /**
+     * 删除直播数据概览信息
+     *
+     * @param ksId 直播数据概览主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveDataOverviewByKsId(Long ksId);
+
+    int inserExcelInfo(KuaishouLiveBroadcast broadcast,List<JSONObject> list);
+}

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

@@ -0,0 +1,125 @@
+package com.ruixuan.data.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.utils.DateUtils;
+import com.ruixuan.data.entity.KuaishouLiveDataAnalysis;
+import com.ruixuan.data.mapper.KuaishouLiveDataAnalysisMapper;
+import com.ruixuan.data.service.IKuaishouLiveDataAnalysisService;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 商品分析数据Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Service
+public class KuaishouLiveDataAnalysisServiceImpl implements IKuaishouLiveDataAnalysisService {
+    @Autowired
+    private KuaishouLiveDataAnalysisMapper kuaishouLiveDataAnalysisMapper;
+
+    /**
+     * 查询商品分析数据
+     *
+     * @param ksId 商品分析数据主键
+     * @return 商品分析数据
+     */
+    @Override
+    public KuaishouLiveDataAnalysis selectKuaishouLiveDataAnalysisByKsId(Long ksId) {
+        return kuaishouLiveDataAnalysisMapper.selectKuaishouLiveDataAnalysisByKsId(ksId);
+    }
+
+    /**
+     * 查询商品分析数据列表
+     *
+     * @param kuaishouLiveDataAnalysis 商品分析数据
+     * @return 商品分析数据
+     */
+    @Override
+    public List<KuaishouLiveDataAnalysis> selectKuaishouLiveDataAnalysisList(KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis) {
+        return kuaishouLiveDataAnalysisMapper.selectKuaishouLiveDataAnalysisList(kuaishouLiveDataAnalysis);
+    }
+
+    /**
+     * 新增商品分析数据
+     *
+     * @param kuaishouLiveDataAnalysis 商品分析数据
+     * @return 结果
+     */
+    @Override
+    public int insertKuaishouLiveDataAnalysis(KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis) {
+        kuaishouLiveDataAnalysis.setCreateTime(DateUtils.getNowDate());
+        return kuaishouLiveDataAnalysisMapper.insertKuaishouLiveDataAnalysis(kuaishouLiveDataAnalysis);
+    }
+
+    /**
+     * 修改商品分析数据
+     *
+     * @param kuaishouLiveDataAnalysis 商品分析数据
+     * @return 结果
+     */
+    @Override
+    public int updateKuaishouLiveDataAnalysis(KuaishouLiveDataAnalysis kuaishouLiveDataAnalysis) {
+        kuaishouLiveDataAnalysis.setUpdateTime(DateUtils.getNowDate());
+        return kuaishouLiveDataAnalysisMapper.updateKuaishouLiveDataAnalysis(kuaishouLiveDataAnalysis);
+    }
+
+    /**
+     * 批量删除商品分析数据
+     *
+     * @param ksIds 需要删除的商品分析数据主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveDataAnalysisByKsIds(Long[] ksIds) {
+        return kuaishouLiveDataAnalysisMapper.deleteKuaishouLiveDataAnalysisByKsIds(ksIds);
+    }
+
+    /**
+     * 删除商品分析数据信息
+     *
+     * @param ksId 商品分析数据主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveDataAnalysisByKsId(Long 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;
+    }
+}

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

@@ -0,0 +1,119 @@
+package com.ruixuan.data.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.utils.DateUtils;
+import com.ruixuan.data.entity.KuaishouLiveDataFunnel;
+import com.ruixuan.data.mapper.KuaishouLiveDataFunnelMapper;
+import com.ruixuan.data.service.IKuaishouLiveDataFunnelService;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 直播漏斗数据Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Service
+public class KuaishouLiveDataFunnelServiceImpl implements IKuaishouLiveDataFunnelService {
+    @Autowired
+    private KuaishouLiveDataFunnelMapper kuaishouLiveDataFunnelMapper;
+
+    /**
+     * 查询直播漏斗数据
+     *
+     * @param ksId 直播漏斗数据主键
+     * @return 直播漏斗数据
+     */
+    @Override
+    public KuaishouLiveDataFunnel selectKuaishouLiveDataFunnelByKsId(Long ksId) {
+        return kuaishouLiveDataFunnelMapper.selectKuaishouLiveDataFunnelByKsId(ksId);
+    }
+
+    /**
+     * 查询直播漏斗数据列表
+     *
+     * @param kuaishouLiveDataFunnel 直播漏斗数据
+     * @return 直播漏斗数据
+     */
+    @Override
+    public List<KuaishouLiveDataFunnel> selectKuaishouLiveDataFunnelList(KuaishouLiveDataFunnel kuaishouLiveDataFunnel) {
+        return kuaishouLiveDataFunnelMapper.selectKuaishouLiveDataFunnelList(kuaishouLiveDataFunnel);
+    }
+
+    /**
+     * 新增直播漏斗数据
+     *
+     * @param kuaishouLiveDataFunnel 直播漏斗数据
+     * @return 结果
+     */
+    @Override
+    public int insertKuaishouLiveDataFunnel(KuaishouLiveDataFunnel kuaishouLiveDataFunnel) {
+        kuaishouLiveDataFunnel.setCreateTime(DateUtils.getNowDate());
+        return kuaishouLiveDataFunnelMapper.insertKuaishouLiveDataFunnel(kuaishouLiveDataFunnel);
+    }
+
+    /**
+     * 修改直播漏斗数据
+     *
+     * @param kuaishouLiveDataFunnel 直播漏斗数据
+     * @return 结果
+     */
+    @Override
+    public int updateKuaishouLiveDataFunnel(KuaishouLiveDataFunnel kuaishouLiveDataFunnel) {
+        kuaishouLiveDataFunnel.setUpdateTime(DateUtils.getNowDate());
+        return kuaishouLiveDataFunnelMapper.updateKuaishouLiveDataFunnel(kuaishouLiveDataFunnel);
+    }
+
+    /**
+     * 批量删除直播漏斗数据
+     *
+     * @param ksIds 需要删除的直播漏斗数据主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveDataFunnelByKsIds(Long[] ksIds) {
+        return kuaishouLiveDataFunnelMapper.deleteKuaishouLiveDataFunnelByKsIds(ksIds);
+    }
+
+    /**
+     * 删除直播漏斗数据信息
+     *
+     * @param ksId 直播漏斗数据主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveDataFunnelByKsId(Long 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;
+    }
+}

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

@@ -0,0 +1,134 @@
+package com.ruixuan.data.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.utils.DateUtils;
+import com.ruixuan.data.entity.KuaishouLiveDataKanban;
+import com.ruixuan.data.mapper.KuaishouLiveDataKanbanMapper;
+import com.ruixuan.data.service.IKuaishouLiveDataKanbanService;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 直播数据看板Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Service
+public class KuaishouLiveDataKanbanServiceImpl implements IKuaishouLiveDataKanbanService {
+    @Autowired
+    private KuaishouLiveDataKanbanMapper kuaishouLiveDataKanbanMapper;
+
+    /**
+     * 查询直播数据看板
+     *
+     * @param ksId 直播数据看板主键
+     * @return 直播数据看板
+     */
+    @Override
+    public KuaishouLiveDataKanban selectKuaishouLiveDataKanbanByKsId(Long ksId) {
+        return kuaishouLiveDataKanbanMapper.selectKuaishouLiveDataKanbanByKsId(ksId);
+    }
+
+    /**
+     * 查询直播数据看板列表
+     *
+     * @param kuaishouLiveDataKanban 直播数据看板
+     * @return 直播数据看板
+     */
+    @Override
+    public List<KuaishouLiveDataKanban> selectKuaishouLiveDataKanbanList(KuaishouLiveDataKanban kuaishouLiveDataKanban) {
+        return kuaishouLiveDataKanbanMapper.selectKuaishouLiveDataKanbanList(kuaishouLiveDataKanban);
+    }
+
+    /**
+     * 新增直播数据看板
+     *
+     * @param kuaishouLiveDataKanban 直播数据看板
+     * @return 结果
+     */
+    @Override
+    public int insertKuaishouLiveDataKanban(KuaishouLiveDataKanban kuaishouLiveDataKanban) {
+        kuaishouLiveDataKanban.setCreateTime(DateUtils.getNowDate());
+        return kuaishouLiveDataKanbanMapper.insertKuaishouLiveDataKanban(kuaishouLiveDataKanban);
+    }
+
+    /**
+     * 修改直播数据看板
+     *
+     * @param kuaishouLiveDataKanban 直播数据看板
+     * @return 结果
+     */
+    @Override
+    public int updateKuaishouLiveDataKanban(KuaishouLiveDataKanban kuaishouLiveDataKanban) {
+        kuaishouLiveDataKanban.setUpdateTime(DateUtils.getNowDate());
+        return kuaishouLiveDataKanbanMapper.updateKuaishouLiveDataKanban(kuaishouLiveDataKanban);
+    }
+
+    /**
+     * 批量删除直播数据看板
+     *
+     * @param ksIds 需要删除的直播数据看板主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveDataKanbanByKsIds(Long[] ksIds) {
+        return kuaishouLiveDataKanbanMapper.deleteKuaishouLiveDataKanbanByKsIds(ksIds);
+    }
+
+    /**
+     * 删除直播数据看板信息
+     *
+     * @param ksId 直播数据看板主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveDataKanbanByKsId(Long 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;
+    }
+}

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

@@ -0,0 +1,121 @@
+package com.ruixuan.data.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.utils.DateUtils;
+import com.ruixuan.data.entity.KuaishouLiveDataOverview;
+import com.ruixuan.data.mapper.KuaishouLiveDataOverviewMapper;
+import com.ruixuan.data.service.IKuaishouLiveDataOverviewService;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 直播数据概览Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Service
+public class KuaishouLiveDataOverviewServiceImpl implements IKuaishouLiveDataOverviewService {
+    @Autowired
+    private KuaishouLiveDataOverviewMapper kuaishouLiveDataOverviewMapper;
+
+    /**
+     * 查询直播数据概览
+     *
+     * @param ksId 直播数据概览主键
+     * @return 直播数据概览
+     */
+    @Override
+    public KuaishouLiveDataOverview selectKuaishouLiveDataOverviewByKsId(Long ksId) {
+        return kuaishouLiveDataOverviewMapper.selectKuaishouLiveDataOverviewByKsId(ksId);
+    }
+
+    /**
+     * 查询直播数据概览列表
+     *
+     * @param kuaishouLiveDataOverview 直播数据概览
+     * @return 直播数据概览
+     */
+    @Override
+    public List<KuaishouLiveDataOverview> selectKuaishouLiveDataOverviewList(KuaishouLiveDataOverview kuaishouLiveDataOverview) {
+        return kuaishouLiveDataOverviewMapper.selectKuaishouLiveDataOverviewList(kuaishouLiveDataOverview);
+    }
+
+    /**
+     * 新增直播数据概览
+     *
+     * @param kuaishouLiveDataOverview 直播数据概览
+     * @return 结果
+     */
+    @Override
+    public int insertKuaishouLiveDataOverview(KuaishouLiveDataOverview kuaishouLiveDataOverview) {
+        kuaishouLiveDataOverview.setCreateTime(DateUtils.getNowDate());
+        return kuaishouLiveDataOverviewMapper.insertKuaishouLiveDataOverview(kuaishouLiveDataOverview);
+    }
+
+    /**
+     * 修改直播数据概览
+     *
+     * @param kuaishouLiveDataOverview 直播数据概览
+     * @return 结果
+     */
+    @Override
+    public int updateKuaishouLiveDataOverview(KuaishouLiveDataOverview kuaishouLiveDataOverview) {
+        kuaishouLiveDataOverview.setUpdateTime(DateUtils.getNowDate());
+        return kuaishouLiveDataOverviewMapper.updateKuaishouLiveDataOverview(kuaishouLiveDataOverview);
+    }
+
+    /**
+     * 批量删除直播数据概览
+     *
+     * @param ksIds 需要删除的直播数据概览主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveDataOverviewByKsIds(Long[] ksIds) {
+        return kuaishouLiveDataOverviewMapper.deleteKuaishouLiveDataOverviewByKsIds(ksIds);
+    }
+
+    /**
+     * 删除直播数据概览信息
+     *
+     * @param ksId 直播数据概览主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveDataOverviewByKsId(Long 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;
+    }
+
+}

+ 162 - 0
ruixuan-live/src/main/java/com/ruixuan/live/controller/KuaishouLiveBroadcastController.java

@@ -0,0 +1,162 @@
+package com.ruixuan.live.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.domain.ResultResponse;
+import com.ruixuan.common.core.page.TableDataInfo;
+import com.ruixuan.common.enums.BusinessType;
+import com.ruixuan.common.utils.Check;
+import com.ruixuan.common.utils.poi.ExcelUtil;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+import com.ruixuan.live.service.IKuaishouLiveBroadcastService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+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.RequestBody;
+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.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 快手—直播Controller
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Api(tags = "操盘手——直播业务")
+@RestController
+@RequestMapping("/live/broadcast")
+public class KuaishouLiveBroadcastController extends BaseController {
+    @Autowired
+    private IKuaishouLiveBroadcastService kuaishouLiveBroadcastService;
+
+    /**
+     * 查询快手—直播列表
+     */
+    @GetMapping("/list")
+    @ApiOperation(value = "查询快手直播账户列表")
+    public TableDataInfo list(KuaishouLiveBroadcast kuaishouLiveBroadcast) {
+        startPage();
+        List<KuaishouLiveBroadcast> list = kuaishouLiveBroadcastService.selectKuaishouLiveBroadcastList(kuaishouLiveBroadcast);
+        return getDataTable(list);
+    }
+
+    /**
+     * 数据回显编辑
+     */
+    @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 = "getById")
+    @ApiOperation(value = "获取快手—直播详细信息")
+    public ResultResponse getInfo(@ApiParam("直播id") @RequestParam(value = "id", required = true) String id) {
+        return kuaishouLiveBroadcastService.selectKuaishouLiveBroadcastById(id);
+    }
+
+    /**
+     * 新增快手—直播
+     */
+    @PostMapping(value = "/add")
+    @ApiOperation(value = "新增直播")
+    public ResultResponse add(@RequestBody KuaishouLiveBroadcast kuaishouLiveBroadcast) {
+        return kuaishouLiveBroadcastService.insertKuaishouLiveBroadcast(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("上传异常");
+        }
+    }
+
+    /**
+     * 删除快手—直播
+     */
+    @Log(title = "快手—直播", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids) {
+        return toAjax(kuaishouLiveBroadcastService.deleteKuaishouLiveBroadcastByIds(ids));
+    }
+
+
+    /**
+     * 导出快手—直播列表
+     */
+    @Log(title = "快手—直播", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, KuaishouLiveBroadcast kuaishouLiveBroadcast) {
+        List<KuaishouLiveBroadcast> list = kuaishouLiveBroadcastService.selectKuaishouLiveBroadcastList(kuaishouLiveBroadcast);
+        ExcelUtil<KuaishouLiveBroadcast> util = new ExcelUtil<KuaishouLiveBroadcast>(KuaishouLiveBroadcast.class);
+        util.exportExcel(response, list, "快手—直播数据");
+    }
+
+}

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

@@ -0,0 +1,119 @@
+package com.ruixuan.live.controller;
+
+import com.alibaba.fastjson.JSONObject;
+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.domain.ResultResponse;
+import com.ruixuan.common.core.page.TableDataInfo;
+import com.ruixuan.common.enums.BusinessType;
+import com.ruixuan.common.utils.poi.ExcelUtil;
+import com.ruixuan.live.entity.KuaishouLiveUserAccount;
+import com.ruixuan.live.service.IKuaishouLiveUserAccountService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+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.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 快手直播账户Controller
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Api(tags = "操盘手——直播账户")
+@RestController
+@RequestMapping("/live/account")
+public class KuaishouLiveUserAccountController extends BaseController {
+    @Autowired
+    private IKuaishouLiveUserAccountService kuaishouLiveUserAccountService;
+
+    /**
+     * 查询快手直播账户列表
+     */
+    @GetMapping("/list")
+    @ApiOperation(value = "查询快手直播账户列表")
+    public TableDataInfo list(KuaishouLiveUserAccount kuaishouLiveUserAccount) {
+        startPage();
+        List<KuaishouLiveUserAccount> list = kuaishouLiveUserAccountService.selectKuaishouLiveUserAccountList(kuaishouLiveUserAccount);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询快手昵称/账户集合
+     */
+    @GetMapping("/queryNicknameList")
+    @ApiOperation(value = "查询快手昵称/账户集合")
+    public TableDataInfo queryNicknameList(KuaishouLiveUserAccount kuaishouLiveUserAccount) {
+        startPage();
+        List<JSONObject> list = kuaishouLiveUserAccountService.queryNicknameList(kuaishouLiveUserAccount);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询运营/销售
+     */
+    @GetMapping("/queryRoles")
+    @ApiOperation(value = "查询(1-运营/2-销售)人员集")
+    public ResultResponse queryRoles(@ApiParam("类型:1-运营/2-销售") @RequestParam(value = "type", required = true) String type) {
+        return kuaishouLiveUserAccountService.queryRoles(type);
+    }
+
+    /**
+     * 新增快手直播账户
+     */
+    @PostMapping(value = "/add")
+    @ApiOperation(value = "新增快手直播账户")
+    public ResultResponse add(@RequestBody KuaishouLiveUserAccount kuaishouLiveUserAccount) {
+        return kuaishouLiveUserAccountService.insertKuaishouLiveUserAccount(kuaishouLiveUserAccount);
+    }
+
+    /**
+     * 修改快手直播账户
+     */
+    @PostMapping(value = "/edit")
+    @ApiOperation(value = "修改快手直播账户")
+    public ResultResponse edit(@RequestBody KuaishouLiveUserAccount kuaishouLiveUserAccount) {
+        return kuaishouLiveUserAccountService.updateKuaishouLiveUserAccount(kuaishouLiveUserAccount);
+    }
+
+    /**
+     * 获取快手直播账户详细信息
+     */
+    @GetMapping(value = "getById")
+    @ApiOperation(value = "获取快手直播账户详细信息")
+    public AjaxResult getInfo(@ApiParam("账户id") @RequestParam(value = "id", required = true) String id) {
+        return AjaxResult.success(kuaishouLiveUserAccountService.selectKuaishouLiveUserAccountById(id));
+    }
+
+    /**
+     * 导出快手直播账户列表
+     */
+    @Log(title = "快手直播账户", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, KuaishouLiveUserAccount kuaishouLiveUserAccount) {
+        List<KuaishouLiveUserAccount> list = kuaishouLiveUserAccountService.selectKuaishouLiveUserAccountList(kuaishouLiveUserAccount);
+        ExcelUtil<KuaishouLiveUserAccount> util = new ExcelUtil<KuaishouLiveUserAccount>(KuaishouLiveUserAccount.class);
+        util.exportExcel(response, list, "快手直播账户数据");
+    }
+
+    /**
+     * 删除快手直播账户
+     */
+    @Log(title = "快手直播账户", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids) {
+        return toAjax(kuaishouLiveUserAccountService.deleteKuaishouLiveUserAccountByIds(ids));
+    }
+}

+ 189 - 0
ruixuan-live/src/main/java/com/ruixuan/live/entity/KuaishouLiveBroadcast.java

@@ -0,0 +1,189 @@
+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
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Data
+@ApiModel(value = "kuaishouLiveBroadcast", description = "快手—直播对象")
+public class KuaishouLiveBroadcast implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    private String id;
+
+    /**
+     * 快手ID
+     */
+    @ApiModelProperty(name = "快手ID")
+    private Long ksId;
+
+    /**
+     * 快手昵称
+     */
+    @ApiModelProperty(name = "快手昵称")
+    private String ksName;
+
+    /**
+     * 账户ID
+     */
+    @ApiModelProperty(name = "账户ID")
+    private Long accountId;
+
+    /**
+     * 账户名称
+     */
+    @ApiModelProperty(name = "账户名称")
+    private String accountName;
+
+    /**
+     * 实际GMV
+     */
+    @ApiModelProperty(name = "实际GMV")
+    private Long actualGmv;
+
+    /**
+     * 目标GMV
+     */
+    @ApiModelProperty(name = "目标GMV")
+    private Long goalGmv;
+
+    private String gmvRoi;
+
+    /**
+     * 上传文件数 (默认为0,后续上传数据时更新)
+     */
+    private int uploadFileCount;
+
+    /**
+     * 上传图片数 (默认为0,后续上传数据时更新)
+     */
+    private int uploadPictureCount;
+
+    /**
+     * 直播时间
+     */
+    @ApiModelProperty(name = "直播时间")
+    private String liveTime;
+
+    /**
+     * 直播开始时间
+     */
+    @ApiModelProperty(name = "直播开始时间")
+    private String startTime;
+
+    /**
+     * 直播结束时间
+     */
+    @ApiModelProperty(name = "直播结束时间")
+    private String endTime;
+
+    /**
+     * 直播间级别:S、A、 B
+     */
+    @ApiModelProperty(name = "直播间级别:S、A、 B")
+    private String liveLevel;
+
+    /**
+     * 主播id
+     */
+    @ApiModelProperty(name = "主播id")
+    private String anchorId;
+
+    /**
+     * 主播
+     */
+    @ApiModelProperty(name = "主播")
+    private String anchor;
+
+    /**
+     * 操盘手id
+     */
+    @ApiModelProperty(name = "操盘手id")
+    private String traderId;
+
+    /**
+     * 操盘手
+     */
+    @ApiModelProperty(name = "操盘手")
+    private String trader;
+
+    /**
+     * 中控id
+     */
+    @ApiModelProperty(name = "中控id")
+    private String centralControlId;
+
+    /**
+     * 中控
+     */
+    @ApiModelProperty(name = "中控")
+    private String centralController;
+
+    /**
+     * 场控id
+     */
+    @ApiModelProperty(name = "场控id")
+    private String fieldControlId;
+
+    /**
+     * 场控
+     */
+    @ApiModelProperty(name = "场控")
+    private String fieldController;
+
+    /**
+     * 内容id
+     */
+    @ApiModelProperty(name = "内容id")
+    private String contentControlId;
+
+    /**
+     * 内容
+     */
+    @ApiModelProperty(name = "内容")
+    private String contentController;
+
+    /**
+     * 投流id
+     */
+    @ApiModelProperty(name = "投流id")
+    private String inputControlId;
+
+    /**
+     * 投流
+     */
+    @ApiModelProperty(name = "投流")
+    private String inputController;
+
+    /**
+     * 创建人ID
+     */
+    @ApiModelProperty(name = "创建人ID")
+    private String createrId;
+
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+}

+ 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;
+
+}

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

@@ -0,0 +1,122 @@
+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_user_account
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Data
+@ApiModel(value = "kuaishouLiveUserAccount", description = "快手直播账户对象")
+public class KuaishouLiveUserAccount implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    private String id;
+
+    /**
+     * 快手ID
+     */
+    @ApiModelProperty(name = "快手ID")
+    private Long ksId;
+
+    /**
+     * 快手昵称
+     */
+    @ApiModelProperty(name = "快手昵称")
+    private String ksName;
+
+    /**
+     * 账户ID
+     */
+    @ApiModelProperty(name = "账户ID")
+    private Long accountId;
+
+    /**
+     * 账户名称
+     */
+    @ApiModelProperty(name = "账户名称")
+    private String accountName;
+
+    /**
+     * 账户类型
+     */
+    @ApiModelProperty(name = "账户类型")
+    private String accountType;
+
+    /**
+     * 销售负责人Id
+     */
+    @ApiModelProperty(name = "销售负责人Id")
+    private String saleLeaderId;
+
+    /**
+     * 销售负责人
+     */
+    @ApiModelProperty(name = "销售负责人")
+    private String saleLeader;
+
+    /**
+     * 运营负责人Id
+     */
+    @ApiModelProperty(name = "运营负责人Id")
+    private String operatorLeaderId;
+
+    /**
+     * 运营负责人
+     */
+    @ApiModelProperty(name = "运营负责人")
+    private String operatorLeader;
+
+    /**
+     * 设计负责人Id
+     */
+    @ApiModelProperty(name = "设计负责人Id")
+    private String designerLeaderId;
+
+    /**
+     * 设计负责人
+     */
+    @ApiModelProperty(name = "设计负责人")
+    private String designerLeader;
+
+    /**
+     * 投放类型
+     */
+    @ApiModelProperty(name = "投放类型")
+    private String putType;
+
+    /**
+     * 创建人ID
+     */
+    @ApiModelProperty(name = "创建人ID")
+    private String createrId;
+
+    /**
+     * 协作人集
+     */
+    private String collaboratorList;
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    private Integer count;
+}

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

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

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

@@ -0,0 +1,63 @@
+package com.ruixuan.live.mapper;
+
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+
+import java.util.List;
+
+/**
+ * 快手—直播Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface KuaishouLiveBroadcastMapper {
+    /**
+     * 查询快手—直播
+     *
+     * @param id 快手—直播主键
+     * @return 快手—直播
+     */
+    public KuaishouLiveBroadcast selectKuaishouLiveBroadcastById(String id);
+
+    /**
+     * 查询快手—直播列表
+     *
+     * @param kuaishouLiveBroadcast 快手—直播
+     * @return 快手—直播集合
+     */
+    public List<KuaishouLiveBroadcast> selectKuaishouLiveBroadcastList(KuaishouLiveBroadcast kuaishouLiveBroadcast);
+
+    /**
+     * 新增快手—直播
+     *
+     * @param kuaishouLiveBroadcast 快手—直播
+     * @return 结果
+     */
+    public int insertKuaishouLiveBroadcast(KuaishouLiveBroadcast kuaishouLiveBroadcast);
+
+    /**
+     * 修改快手—直播
+     *
+     * @param kuaishouLiveBroadcast 快手—直播
+     * @return 结果
+     */
+    public int updateKuaishouLiveBroadcast(KuaishouLiveBroadcast kuaishouLiveBroadcast);
+
+    /**
+     * 删除快手—直播
+     *
+     * @param id 快手—直播主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveBroadcastById(String id);
+
+    /**
+     * 批量删除快手—直播
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveBroadcastByIds(String[] ids);
+
+    KuaishouLiveBroadcast getOne(KuaishouLiveBroadcast kuaishouLiveBroadcast);
+}

+ 67 - 0
ruixuan-live/src/main/java/com/ruixuan/live/mapper/KuaishouLiveUserAccountMapper.java

@@ -0,0 +1,67 @@
+package com.ruixuan.live.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.live.entity.KuaishouLiveUserAccount;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手直播账户Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface KuaishouLiveUserAccountMapper {
+    /**
+     * 查询快手直播账户
+     *
+     * @param id 快手直播账户主键
+     * @return 快手直播账户
+     */
+    KuaishouLiveUserAccount selectKuaishouLiveUserAccountById(String id);
+
+    /**
+     * 查询快手直播账户列表
+     *
+     * @param kuaishouLiveUserAccount 快手直播账户
+     * @return 快手直播账户集合
+     */
+    List<KuaishouLiveUserAccount> selectKuaishouLiveUserAccountList(KuaishouLiveUserAccount kuaishouLiveUserAccount);
+
+    /**
+     * 新增快手直播账户
+     *
+     * @param kuaishouLiveUserAccount 快手直播账户
+     * @return 结果
+     */
+    int insertKuaishouLiveUserAccount(KuaishouLiveUserAccount kuaishouLiveUserAccount);
+
+    /**
+     * 修改快手直播账户
+     *
+     * @param kuaishouLiveUserAccount 快手直播账户
+     * @return 结果
+     */
+    int updateKuaishouLiveUserAccount(KuaishouLiveUserAccount kuaishouLiveUserAccount);
+
+    /**
+     * 删除快手直播账户
+     *
+     * @param id 快手直播账户主键
+     * @return 结果
+     */
+    int deleteKuaishouLiveUserAccountById(String id);
+
+    /**
+     * 批量删除快手直播账户
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteKuaishouLiveUserAccountByIds(String[] ids);
+
+    List<JSONObject> queryNicknameList(KuaishouLiveUserAccount kuaishouLiveUserAccount);
+
+    KuaishouLiveUserAccount getOne(@Param("ksId") Long ksId,@Param("accountName") String accountName);
+}

+ 36 - 0
ruixuan-live/src/main/java/com/ruixuan/live/mapper/KuaishouLiveUserAccountPartMapper.java

@@ -0,0 +1,36 @@
+package com.ruixuan.live.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.live.entity.KuaishouLiveUserAccountPart;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手账户协作人群Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface KuaishouLiveUserAccountPartMapper {
+    /**
+     * 查询快手账户协作人群
+     *
+     * @param id 快手账户协作人群主键
+     * @return 快手账户协作人群
+     */
+    List<KuaishouLiveUserAccountPart> selectKuaishouLiveUserAccountPartById(Long ksId);
+
+    /**
+     * 删除快手账户协作人群
+     *
+     * @param id 快手账户协作人群主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveUserAccountPartById(Long ksId);
+
+
+    void replaceBatch(@Param(value = "collaborators") List<JSONObject> collaborators);
+
+    List<JSONObject> queryCollaboratorsById(Long ksId);
+}

+ 69 - 0
ruixuan-live/src/main/java/com/ruixuan/live/service/IKuaishouLiveBroadcastService.java

@@ -0,0 +1,69 @@
+package com.ruixuan.live.service;
+
+import com.ruixuan.common.core.domain.ResultResponse;
+import com.ruixuan.live.entity.KuaishouLiveBroadcast;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * 快手—直播Service接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface IKuaishouLiveBroadcastService {
+    /**
+     * 查询快手—直播
+     *
+     * @param id 快手—直播主键
+     * @return 快手—直播
+     */
+    public ResultResponse selectKuaishouLiveBroadcastById(String id);
+
+    public ResultResponse getForEdit(String id);
+
+    /**
+     * 查询快手—直播列表
+     *
+     * @param kuaishouLiveBroadcast 快手—直播
+     * @return 快手—直播集合
+     */
+    public List<KuaishouLiveBroadcast> selectKuaishouLiveBroadcastList(KuaishouLiveBroadcast kuaishouLiveBroadcast);
+
+    /**
+     * 新增快手—直播
+     *
+     * @param kuaishouLiveBroadcast 快手—直播
+     * @return 结果
+     */
+    public ResultResponse insertKuaishouLiveBroadcast(KuaishouLiveBroadcast kuaishouLiveBroadcast);
+
+    /**
+     * 修改快手—直播
+     *
+     * @param kuaishouLiveBroadcast 快手—直播
+     * @return 结果
+     */
+    public ResultResponse updateKuaishouLiveBroadcast(KuaishouLiveBroadcast kuaishouLiveBroadcast);
+
+    /**
+     * 批量删除快手—直播
+     *
+     * @param ids 需要删除的快手—直播主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveBroadcastByIds(String[] ids);
+
+    /**
+     * 删除快手—直播信息
+     *
+     * @param id 快手—直播主键
+     * @return 结果
+     */
+    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);
+}

+ 29 - 0
ruixuan-live/src/main/java/com/ruixuan/live/service/IKuaishouLiveUserAccountPartService.java

@@ -0,0 +1,29 @@
+package com.ruixuan.live.service;
+
+import com.ruixuan.live.entity.KuaishouLiveUserAccountPart;
+
+import java.util.List;
+
+/**
+ * 快手账户协作人群Service接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface IKuaishouLiveUserAccountPartService {
+    /**
+     * 查询快手账户协作人群
+     *
+     * @param id 快手账户协作人群主键
+     * @return 快手账户协作人群
+     */
+    public List<KuaishouLiveUserAccountPart> selectKuaishouLiveUserAccountPartById(Long ksId);
+
+    /**
+     * 删除快手账户协作人群信息
+     *
+     * @param id 快手账户协作人群主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveUserAccountPartById(Long ksId);
+}

+ 68 - 0
ruixuan-live/src/main/java/com/ruixuan/live/service/IKuaishouLiveUserAccountService.java

@@ -0,0 +1,68 @@
+package com.ruixuan.live.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.core.domain.ResultResponse;
+import com.ruixuan.common.core.page.TableDataInfo;
+import com.ruixuan.live.entity.KuaishouLiveUserAccount;
+
+import java.util.List;
+
+/**
+ * 快手直播账户Service接口
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+public interface IKuaishouLiveUserAccountService {
+    /**
+     * 查询快手直播账户
+     *
+     * @param id 快手直播账户主键
+     * @return 快手直播账户
+     */
+     JSONObject selectKuaishouLiveUserAccountById(String id);
+
+    /**
+     * 查询快手直播账户列表
+     *
+     * @param kuaishouLiveUserAccount 快手直播账户
+     * @return 快手直播账户集合
+     */
+    public List<KuaishouLiveUserAccount> selectKuaishouLiveUserAccountList(KuaishouLiveUserAccount kuaishouLiveUserAccount);
+
+    /**
+     * 新增快手直播账户
+     *
+     * @param kuaishouLiveUserAccount 快手直播账户
+     * @return 结果
+     */
+    public ResultResponse insertKuaishouLiveUserAccount(KuaishouLiveUserAccount kuaishouLiveUserAccount);
+
+    /**
+     * 修改快手直播账户
+     *
+     * @param kuaishouLiveUserAccount 快手直播账户
+     * @return 结果
+     */
+    public ResultResponse updateKuaishouLiveUserAccount(KuaishouLiveUserAccount kuaishouLiveUserAccount);
+
+    /**
+     * 批量删除快手直播账户
+     *
+     * @param ids 需要删除的快手直播账户主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLiveUserAccountByIds(String[] ids);
+
+    /**
+     * 删除快手直播账户信息
+     *
+     * @param id 快手直播账户主键
+     * @return 结果
+     */
+    public int deleteKuaishouLiveUserAccountById(String id);
+
+    List<JSONObject> queryNicknameList(KuaishouLiveUserAccount kuaishouLiveUserAccount);
+
+    ResultResponse queryRoles(String type);
+}

+ 341 - 0
ruixuan-live/src/main/java/com/ruixuan/live/service/impl/KuaishouLiveBroadcastServiceImpl.java

@@ -0,0 +1,341 @@
+package com.ruixuan.live.service.impl;
+
+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.KuaishouLiveBroadcastFiles;
+import com.ruixuan.live.mapper.KuaishouLiveBroadcastFilesMapper;
+import com.ruixuan.live.mapper.KuaishouLiveBroadcastMapper;
+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.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * 快手—直播Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Service
+public class KuaishouLiveBroadcastServiceImpl implements IKuaishouLiveBroadcastService {
+    @Autowired
+    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;
+
+    /**
+     * 查询快手—直播
+     *
+     * @param id 快手—直播主键
+     * @return 快手—直播
+     */
+    @Override
+    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;
+    }
+
+    /**
+     * 查询快手—直播列表
+     *
+     * @param kuaishouLiveBroadcast 快手—直播
+     * @return 快手—直播
+     */
+    @Override
+    public List<KuaishouLiveBroadcast> selectKuaishouLiveBroadcastList(KuaishouLiveBroadcast kuaishouLiveBroadcast) {
+        return kuaishouLiveBroadcastMapper.selectKuaishouLiveBroadcastList(kuaishouLiveBroadcast);
+    }
+
+    /**
+     * 新增快手—直播
+     *
+     * @param kuaishouLiveBroadcast 快手—直播
+     * @return 结果
+     */
+    @Override
+    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");
+    }
+
+    /**
+     * 修改快手—直播
+     *
+     * @param kuaishouLiveBroadcast 快手—直播
+     * @return 结果
+     */
+    @Override
+    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");
+    }
+
+    /**
+     * 批量删除快手—直播
+     *
+     * @param ids 需要删除的快手—直播主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveBroadcastByIds(String[] ids) {
+        return kuaishouLiveBroadcastMapper.deleteKuaishouLiveBroadcastByIds(ids);
+    }
+
+    /**
+     * 删除快手—直播信息
+     *
+     * @param id 快手—直播主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveBroadcastById(String 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();
+    }
+
+}

+ 45 - 0
ruixuan-live/src/main/java/com/ruixuan/live/service/impl/KuaishouLiveUserAccountPartServiceImpl.java

@@ -0,0 +1,45 @@
+package com.ruixuan.live.service.impl;
+
+import com.ruixuan.common.utils.DateUtils;
+import com.ruixuan.live.entity.KuaishouLiveUserAccountPart;
+import com.ruixuan.live.mapper.KuaishouLiveUserAccountPartMapper;
+import com.ruixuan.live.service.IKuaishouLiveUserAccountPartService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 快手账户协作人群Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Service
+public class KuaishouLiveUserAccountPartServiceImpl implements IKuaishouLiveUserAccountPartService {
+    @Autowired
+    private KuaishouLiveUserAccountPartMapper kuaishouLiveUserAccountPartMapper;
+
+    /**
+     * 查询快手账户协作人群
+     *
+     * @param id 快手账户协作人群主键
+     * @return 快手账户协作人群
+     */
+    @Override
+    public List<KuaishouLiveUserAccountPart> selectKuaishouLiveUserAccountPartById(Long ksId) {
+        return kuaishouLiveUserAccountPartMapper.selectKuaishouLiveUserAccountPartById(ksId);
+    }
+
+
+    /**
+     * 删除快手账户协作人群信息
+     *
+     * @param id 快手账户协作人群主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveUserAccountPartById(Long ksId) {
+        return kuaishouLiveUserAccountPartMapper.deleteKuaishouLiveUserAccountPartById(ksId);
+    }
+}

+ 161 - 0
ruixuan-live/src/main/java/com/ruixuan/live/service/impl/KuaishouLiveUserAccountServiceImpl.java

@@ -0,0 +1,161 @@
+package com.ruixuan.live.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.core.domain.ResultResponse;
+import com.ruixuan.live.entity.KuaishouLiveUserAccount;
+import com.ruixuan.live.entity.KuaishouLiveUserAccountPart;
+import com.ruixuan.live.mapper.KuaishouLiveUserAccountMapper;
+import com.ruixuan.live.mapper.KuaishouLiveUserAccountPartMapper;
+import com.ruixuan.live.service.IKuaishouLiveUserAccountService;
+import com.ruixuan.system.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.UUID;
+
+/**
+ * 快手直播账户Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-05-31
+ */
+@Service
+public class KuaishouLiveUserAccountServiceImpl implements IKuaishouLiveUserAccountService {
+    @Autowired
+    private KuaishouLiveUserAccountMapper kuaishouLiveUserAccountMapper;
+    @Autowired
+    private KuaishouLiveUserAccountPartMapper accountPartMapper;
+
+    @Autowired
+    private ISysUserService sysUserService;
+
+    /**
+     * 查询快手直播账户
+     *
+     * @param id 快手直播账户主键
+     * @return 快手直播账户
+     */
+    @Override
+    public JSONObject selectKuaishouLiveUserAccountById(String id) {
+        KuaishouLiveUserAccount account = kuaishouLiveUserAccountMapper.selectKuaishouLiveUserAccountById(id);
+        JSONObject object = JSONObject.parseObject(JSON.toJSONString(account));
+        if (object != null) {
+            List<JSONObject> parts = accountPartMapper.queryCollaboratorsById(account.getKsId());
+            object.put("collaborators", parts);
+        }
+        return object;
+    }
+
+    /**
+     * 查询快手直播账户列表
+     *
+     * @param kuaishouLiveUserAccount 快手直播账户
+     * @return 快手直播账户
+     */
+    @Override
+    public List<KuaishouLiveUserAccount> selectKuaishouLiveUserAccountList(KuaishouLiveUserAccount kuaishouLiveUserAccount) {
+        return kuaishouLiveUserAccountMapper.selectKuaishouLiveUserAccountList(kuaishouLiveUserAccount);
+    }
+
+    /**
+     * 新增快手直播账户
+     *
+     * @param kuaishouLiveUserAccount 快手直播账户
+     * @return 结果
+     */
+    @Override
+    public ResultResponse insertKuaishouLiveUserAccount(KuaishouLiveUserAccount account) {
+        KuaishouLiveUserAccount one = kuaishouLiveUserAccountMapper.getOne(account.getKsId(), account.getAccountName());
+        if (one != null) {
+            return ResultResponse.error("快手ID:" + account.getKsId() + "下已存在该账户名,请重新命名!");
+        }
+        String collaboratorList = account.getCollaboratorList();
+        if (collaboratorList != null) {
+            List<JSONObject> collaborators = JSONArray.parseArray(collaboratorList, JSONObject.class);
+            for (JSONObject obj : collaborators) {
+                obj.put("ksId", account.getKsId());
+                obj.put("ksName", account.getKsName());
+                obj.put("accountId", account.getAccountId());
+                obj.put("accountName", account.getAccountName());
+                obj.put("createrId", account.getCreaterId());
+            }
+            if (collaborators != null) {
+                accountPartMapper.replaceBatch(collaborators);
+            }
+        }
+        account.setId(UUID.randomUUID().toString().replace("-", ""));
+        int num = kuaishouLiveUserAccountMapper.insertKuaishouLiveUserAccount(account);
+        if (num > 0) {
+            return ResultResponse.success();
+        }
+        return ResultResponse.error("fail");
+    }
+
+    /**
+     * 修改快手直播账户
+     */
+    @Override
+    public ResultResponse updateKuaishouLiveUserAccount(KuaishouLiveUserAccount account) {
+        KuaishouLiveUserAccount one = kuaishouLiveUserAccountMapper.getOne(account.getKsId(), account.getAccountName());
+        if (one == null) {
+            return ResultResponse.error("未查询到账户");
+        }
+        int i = kuaishouLiveUserAccountMapper.updateKuaishouLiveUserAccount(account);
+        if (i > 0) {
+            String collaboratorList = account.getCollaboratorList();
+            if (collaboratorList != null) {
+                List<JSONObject> collaborators = JSONArray.parseArray(collaboratorList, JSONObject.class);
+                for (JSONObject obj : collaborators) {
+                    obj.put("ksId", account.getKsId());
+                    obj.put("ksName", account.getKsName());
+                    obj.put("accountId", account.getAccountId());
+                    obj.put("accountName", account.getAccountName());
+                    obj.put("createrId", account.getCreaterId());
+                }
+                if (collaborators != null) {
+                    accountPartMapper.deleteKuaishouLiveUserAccountPartById(account.getKsId());
+                    accountPartMapper.replaceBatch(collaborators);
+                }
+            }
+            return ResultResponse.success();
+        }
+        return ResultResponse.error("fail");
+    }
+
+    /**
+     * 批量删除快手直播账户
+     *
+     * @param ids 需要删除的快手直播账户主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveUserAccountByIds(String[] ids) {
+        return kuaishouLiveUserAccountMapper.deleteKuaishouLiveUserAccountByIds(ids);
+    }
+
+    /**
+     * 删除快手直播账户信息
+     *
+     * @param id 快手直播账户主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLiveUserAccountById(String id) {
+        return kuaishouLiveUserAccountMapper.deleteKuaishouLiveUserAccountById(id);
+    }
+
+    @Override
+    public List<JSONObject> queryNicknameList(KuaishouLiveUserAccount kuaishouLiveUserAccount) {
+        return kuaishouLiveUserAccountMapper.queryNicknameList(kuaishouLiveUserAccount);
+    }
+
+    @Override
+    public ResultResponse queryRoles(String type) {
+        List<JSONObject> list = sysUserService.queryRoles(type);
+        return ResultResponse.success(list);
+    }
+
+}

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

@@ -0,0 +1,155 @@
+<?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.data.mapper.KuaishouLiveDataAnalysisMapper">
+
+    <resultMap type="com.ruixuan.data.entity.KuaishouLiveDataAnalysis" id="KuaishouLiveDataAnalysisResult">
+        <result property="ksId" column="ks_id"/>
+        <result property="ksName" column="ks_name"/>
+        <result property="accountId" column="account_id"/>
+        <result property="accountName" column="account_name"/>
+        <result property="waresName" column="wares_name"/>
+        <result property="waresPutDate" column="wares_put_date"/>
+        <result property="waresPrice" column="wares_price"/>
+        <result property="waresSalesAmount" column="wares_sales_amount"/>
+        <result property="waresSalesVolume" column="wares_sales_volume"/>
+        <result property="topayOrders" column="topay_orders"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectKuaishouLiveDataAnalysisVo">
+        select ks_id,
+               ks_name,
+               account_id,
+               account_name,
+               wares_name,
+               wares_put_date,
+               wares_price,
+               wares_sales_amount,
+               wares_sales_volume,
+               topay_orders,
+               create_time,
+               update_time
+        from kuaishou_live_data_analysis
+    </sql>
+
+    <select id="selectKuaishouLiveDataAnalysisList" parameterType="com.ruixuan.data.entity.KuaishouLiveDataAnalysis"
+            resultMap="KuaishouLiveDataAnalysisResult">
+        <include refid="selectKuaishouLiveDataAnalysisVo"/>
+        <where>
+            <if test="ksId != null ">and ks_id = #{ksId}</if>
+            <if test="ksName != null  and ksName != ''">and ks_name like concat('%', #{ksName}, '%')</if>
+            <if test="accountId != null ">and account_id = #{accountId}</if>
+            <if test="accountName != null  and accountName != ''">and account_name like concat('%', #{accountName},
+                '%')
+            </if>
+            <if test="waresName != null  and waresName != ''">and wares_name like concat('%', #{waresName}, '%')</if>
+            <if test="waresPutDate != null  and waresPutDate != ''">and wares_put_date = #{waresPutDate}</if>
+            <if test="waresPrice != null ">and wares_price = #{waresPrice}</if>
+            <if test="waresSalesAmount != null ">and wares_sales_amount = #{waresSalesAmount}</if>
+            <if test="waresSalesVolume != null ">and wares_sales_volume = #{waresSalesVolume}</if>
+            <if test="topayOrders != null ">and topay_orders = #{topayOrders}</if>
+        </where>
+    </select>
+
+    <select id="selectKuaishouLiveDataAnalysisByKsId" parameterType="Long" resultMap="KuaishouLiveDataAnalysisResult">
+        <include refid="selectKuaishouLiveDataAnalysisVo"/>
+        where ks_id = #{ksId}
+    </select>
+
+    <insert id="insertKuaishouLiveDataAnalysis" parameterType="com.ruixuan.data.entity.KuaishouLiveDataAnalysis">
+        insert into kuaishou_live_data_analysis
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="ksId != null">ks_id,</if>
+            <if test="ksName != null">ks_name,</if>
+            <if test="accountId != null">account_id,</if>
+            <if test="accountName != null">account_name,</if>
+            <if test="waresName != null">wares_name,</if>
+            <if test="waresPutDate != null">wares_put_date,</if>
+            <if test="waresPrice != null">wares_price,</if>
+            <if test="waresSalesAmount != null">wares_sales_amount,</if>
+            <if test="waresSalesVolume != null">wares_sales_volume,</if>
+            <if test="topayOrders != null">topay_orders,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="ksId != null">#{ksId},</if>
+            <if test="ksName != null">#{ksName},</if>
+            <if test="accountId != null">#{accountId},</if>
+            <if test="accountName != null">#{accountName},</if>
+            <if test="waresName != null">#{waresName},</if>
+            <if test="waresPutDate != null">#{waresPutDate},</if>
+            <if test="waresPrice != null">#{waresPrice},</if>
+            <if test="waresSalesAmount != null">#{waresSalesAmount},</if>
+            <if test="waresSalesVolume != null">#{waresSalesVolume},</if>
+            <if test="topayOrders != null">#{topayOrders},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateKuaishouLiveDataAnalysis" parameterType="com.ruixuan.data.entity.KuaishouLiveDataAnalysis">
+        update kuaishou_live_data_analysis
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="ksName != null">ks_name = #{ksName},</if>
+            <if test="accountId != null">account_id = #{accountId},</if>
+            <if test="accountName != null">account_name = #{accountName},</if>
+            <if test="waresName != null">wares_name = #{waresName},</if>
+            <if test="waresPutDate != null">wares_put_date = #{waresPutDate},</if>
+            <if test="waresPrice != null">wares_price = #{waresPrice},</if>
+            <if test="waresSalesAmount != null">wares_sales_amount = #{waresSalesAmount},</if>
+            <if test="waresSalesVolume != null">wares_sales_volume = #{waresSalesVolume},</if>
+            <if test="topayOrders != null">topay_orders = #{topayOrders},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where ks_id = #{ksId}
+    </update>
+
+    <delete id="deleteKuaishouLiveDataAnalysisByKsId" parameterType="Long">
+        delete
+        from kuaishou_live_data_analysis
+        where ks_id = #{ksId}
+    </delete>
+
+    <delete id="deleteKuaishouLiveDataAnalysisByKsIds" parameterType="String">
+        delete from kuaishou_live_data_analysis where ks_id in
+        <foreach item="ksId" collection="array" open="(" separator="," close=")">
+            #{ksId}
+        </foreach>
+    </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>

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

@@ -0,0 +1,124 @@
+<?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.data.mapper.KuaishouLiveDataFunnelMapper">
+
+    <resultMap type="com.ruixuan.data.entity.KuaishouLiveDataFunnel" id="KuaishouLiveDataFunnelResult">
+        <result property="ksId" column="ks_id"/>
+        <result property="ksName" column="ks_name"/>
+        <result property="accountId" column="account_id"/>
+        <result property="accountName" column="account_name"/>
+        <result property="allViewers" column="all_viewers"/>
+        <result property="statDate" column="stat_date"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectKuaishouLiveDataFunnelVo">
+        select ks_id,
+               ks_name,
+               account_id,
+               account_name,
+               all_viewers,
+               stat_date,
+               create_time,
+               update_time
+        from kuaishou_live_data_funnel
+    </sql>
+
+    <select id="selectKuaishouLiveDataFunnelList" parameterType="com.ruixuan.data.entity.KuaishouLiveDataFunnel"
+            resultMap="KuaishouLiveDataFunnelResult">
+        <include refid="selectKuaishouLiveDataFunnelVo"/>
+        <where>
+            <if test="ksId != null ">and ks_id = #{ksId}</if>
+            <if test="ksName != null  and ksName != ''">and ks_name like concat('%', #{ksName}, '%')</if>
+            <if test="accountId != null ">and account_id = #{accountId}</if>
+            <if test="accountName != null  and accountName != ''">and account_name like concat('%', #{accountName},
+                '%')
+            </if>
+            <if test="allViewers != null ">and all_viewers = #{allViewers}</if>
+            <if test="statDate != null  and statDate != ''">and stat_date = #{statDate}</if>
+        </where>
+    </select>
+
+    <select id="selectKuaishouLiveDataFunnelByKsId" parameterType="Long" resultMap="KuaishouLiveDataFunnelResult">
+        <include refid="selectKuaishouLiveDataFunnelVo"/>
+        where ks_id = #{ksId}
+    </select>
+
+    <insert id="insertKuaishouLiveDataFunnel" parameterType="com.ruixuan.data.entity.KuaishouLiveDataFunnel">
+        insert into kuaishou_live_data_funnel
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="ksId != null">ks_id,</if>
+            <if test="ksName != null">ks_name,</if>
+            <if test="accountId != null">account_id,</if>
+            <if test="accountName != null">account_name,</if>
+            <if test="allViewers != null">all_viewers,</if>
+            <if test="statDate != null">stat_date,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="ksId != null">#{ksId},</if>
+            <if test="ksName != null">#{ksName},</if>
+            <if test="accountId != null">#{accountId},</if>
+            <if test="accountName != null">#{accountName},</if>
+            <if test="allViewers != null">#{allViewers},</if>
+            <if test="statDate != null">#{statDate},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateKuaishouLiveDataFunnel" parameterType="com.ruixuan.data.entity.KuaishouLiveDataFunnel">
+        update kuaishou_live_data_funnel
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="ksName != null">ks_name = #{ksName},</if>
+            <if test="accountId != null">account_id = #{accountId},</if>
+            <if test="accountName != null">account_name = #{accountName},</if>
+            <if test="allViewers != null">all_viewers = #{allViewers},</if>
+            <if test="statDate != null">stat_date = #{statDate},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where ks_id = #{ksId}
+    </update>
+
+    <delete id="deleteKuaishouLiveDataFunnelByKsId" parameterType="Long">
+        delete
+        from kuaishou_live_data_funnel
+        where ks_id = #{ksId}
+    </delete>
+
+    <delete id="deleteKuaishouLiveDataFunnelByKsIds" parameterType="String">
+        delete from kuaishou_live_data_funnel where ks_id in
+        <foreach item="ksId" collection="array" open="(" separator="," close=")">
+            #{ksId}
+        </foreach>
+    </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>

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

@@ -0,0 +1,227 @@
+<?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.data.mapper.KuaishouLiveDataKanbanMapper">
+
+    <resultMap type="com.ruixuan.data.entity.KuaishouLiveDataKanban" id="KuaishouLiveDataKanbanResult">
+        <result property="ksId" column="ks_id"/>
+        <result property="ksName" column="ks_name"/>
+        <result property="accountId" column="account_id"/>
+        <result property="accountName" column="account_name"/>
+        <result property="onlineViewers" column="online_viewers"/>
+        <result property="viewers" column="viewers"/>
+        <result property="viewingTimes" column="viewing_times"/>
+        <result property="perViewingTime" column="per_viewing_time"/>
+        <result property="fansViewingTime" column="fans_viewing_time"/>
+        <result property="rewards" column="rewards"/>
+        <result property="putWares" column="put_wares"/>
+        <result property="newFans" column="new_fans"/>
+        <result property="likes" column="likes"/>
+        <result property="waresClicks" column="wares_clicks"/>
+        <result property="carClicks" column="car_clicks"/>
+        <result property="allAmount" column="all_amount"/>
+        <result property="allTurnover" column="all_turnover"/>
+        <result property="allOrders" column="all_orders"/>
+        <result property="turnoverRatio" column="turnover_ratio"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectKuaishouLiveDataKanbanVo">
+        select 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,
+               create_time,
+               update_time
+        from kuaishou_live_data_kanban
+    </sql>
+
+    <select id="selectKuaishouLiveDataKanbanList" parameterType="com.ruixuan.data.entity.KuaishouLiveDataKanban"
+            resultMap="KuaishouLiveDataKanbanResult">
+        <include refid="selectKuaishouLiveDataKanbanVo"/>
+        <where>
+            <if test="ksId != null ">and ks_id = #{ksId}</if>
+            <if test="ksName != null  and ksName != ''">and ks_name like concat('%', #{ksName}, '%')</if>
+            <if test="accountId != null ">and account_id = #{accountId}</if>
+            <if test="accountName != null  and accountName != ''">and account_name like concat('%', #{accountName},
+                '%')
+            </if>
+            <if test="onlineViewers != null ">and online_viewers = #{onlineViewers}</if>
+            <if test="viewers != null ">and viewers = #{viewers}</if>
+            <if test="viewingTimes != null ">and viewing_times = #{viewingTimes}</if>
+            <if test="perViewingTime != null ">and per_viewing_time = #{perViewingTime}</if>
+            <if test="fansViewingTime != null ">and fans_viewing_time = #{fansViewingTime}</if>
+            <if test="rewards != null ">and rewards = #{rewards}</if>
+            <if test="putWares != null ">and put_wares = #{putWares}</if>
+            <if test="newFans != null ">and new_fans = #{newFans}</if>
+            <if test="likes != null ">and likes = #{likes}</if>
+            <if test="waresClicks != null ">and wares_clicks = #{waresClicks}</if>
+            <if test="carClicks != null ">and car_clicks = #{carClicks}</if>
+            <if test="allAmount != null ">and all_amount = #{allAmount}</if>
+            <if test="allTurnover != null ">and all_turnover = #{allTurnover}</if>
+            <if test="allOrders != null ">and all_orders = #{allOrders}</if>
+            <if test="turnoverRatio != null  and turnoverRatio != ''">and turnover_ratio = #{turnoverRatio}</if>
+        </where>
+    </select>
+
+    <select id="selectKuaishouLiveDataKanbanByKsId" parameterType="Long" resultMap="KuaishouLiveDataKanbanResult">
+        <include refid="selectKuaishouLiveDataKanbanVo"/>
+        where ks_id = #{ksId}
+    </select>
+
+    <insert id="insertKuaishouLiveDataKanban" parameterType="com.ruixuan.data.entity.KuaishouLiveDataKanban">
+        insert into kuaishou_live_data_kanban
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="ksId != null">ks_id,</if>
+            <if test="ksName != null">ks_name,</if>
+            <if test="accountId != null">account_id,</if>
+            <if test="accountName != null">account_name,</if>
+            <if test="onlineViewers != null">online_viewers,</if>
+            <if test="viewers != null">viewers,</if>
+            <if test="viewingTimes != null">viewing_times,</if>
+            <if test="perViewingTime != null">per_viewing_time,</if>
+            <if test="fansViewingTime != null">fans_viewing_time,</if>
+            <if test="rewards != null">rewards,</if>
+            <if test="putWares != null">put_wares,</if>
+            <if test="newFans != null">new_fans,</if>
+            <if test="likes != null">likes,</if>
+            <if test="waresClicks != null">wares_clicks,</if>
+            <if test="carClicks != null">car_clicks,</if>
+            <if test="allAmount != null">all_amount,</if>
+            <if test="allTurnover != null">all_turnover,</if>
+            <if test="allOrders != null">all_orders,</if>
+            <if test="turnoverRatio != null">turnover_ratio,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="ksId != null">#{ksId},</if>
+            <if test="ksName != null">#{ksName},</if>
+            <if test="accountId != null">#{accountId},</if>
+            <if test="accountName != null">#{accountName},</if>
+            <if test="onlineViewers != null">#{onlineViewers},</if>
+            <if test="viewers != null">#{viewers},</if>
+            <if test="viewingTimes != null">#{viewingTimes},</if>
+            <if test="perViewingTime != null">#{perViewingTime},</if>
+            <if test="fansViewingTime != null">#{fansViewingTime},</if>
+            <if test="rewards != null">#{rewards},</if>
+            <if test="putWares != null">#{putWares},</if>
+            <if test="newFans != null">#{newFans},</if>
+            <if test="likes != null">#{likes},</if>
+            <if test="waresClicks != null">#{waresClicks},</if>
+            <if test="carClicks != null">#{carClicks},</if>
+            <if test="allAmount != null">#{allAmount},</if>
+            <if test="allTurnover != null">#{allTurnover},</if>
+            <if test="allOrders != null">#{allOrders},</if>
+            <if test="turnoverRatio != null">#{turnoverRatio},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateKuaishouLiveDataKanban" parameterType="com.ruixuan.data.entity.KuaishouLiveDataKanban">
+        update kuaishou_live_data_kanban
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="ksName != null">ks_name = #{ksName},</if>
+            <if test="accountId != null">account_id = #{accountId},</if>
+            <if test="accountName != null">account_name = #{accountName},</if>
+            <if test="onlineViewers != null">online_viewers = #{onlineViewers},</if>
+            <if test="viewers != null">viewers = #{viewers},</if>
+            <if test="viewingTimes != null">viewing_times = #{viewingTimes},</if>
+            <if test="perViewingTime != null">per_viewing_time = #{perViewingTime},</if>
+            <if test="fansViewingTime != null">fans_viewing_time = #{fansViewingTime},</if>
+            <if test="rewards != null">rewards = #{rewards},</if>
+            <if test="putWares != null">put_wares = #{putWares},</if>
+            <if test="newFans != null">new_fans = #{newFans},</if>
+            <if test="likes != null">likes = #{likes},</if>
+            <if test="waresClicks != null">wares_clicks = #{waresClicks},</if>
+            <if test="carClicks != null">car_clicks = #{carClicks},</if>
+            <if test="allAmount != null">all_amount = #{allAmount},</if>
+            <if test="allTurnover != null">all_turnover = #{allTurnover},</if>
+            <if test="allOrders != null">all_orders = #{allOrders},</if>
+            <if test="turnoverRatio != null">turnover_ratio = #{turnoverRatio},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where ks_id = #{ksId}
+    </update>
+
+    <delete id="deleteKuaishouLiveDataKanbanByKsId" parameterType="Long">
+        delete
+        from kuaishou_live_data_kanban
+        where ks_id = #{ksId}
+    </delete>
+
+    <delete id="deleteKuaishouLiveDataKanbanByKsIds" parameterType="String">
+        delete from kuaishou_live_data_kanban where ks_id in
+        <foreach item="ksId" collection="array" open="(" separator="," close=")">
+            #{ksId}
+        </foreach>
+    </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>

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

@@ -0,0 +1,124 @@
+<?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.data.mapper.KuaishouLiveDataOverviewMapper">
+
+    <resultMap type="com.ruixuan.data.entity.KuaishouLiveDataOverview" id="KuaishouLiveDataOverviewResult">
+        <result property="ksId" column="ks_id"/>
+        <result property="ksName" column="ks_name"/>
+        <result property="accountId" column="account_id"/>
+        <result property="accountName" column="account_name"/>
+        <result property="amounts" column="amounts"/>
+        <result property="statDate" column="stat_date"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectKuaishouLiveDataOverviewVo">
+        select ks_id,
+               ks_name,
+               account_id,
+               account_name,
+               amounts,
+               stat_date,
+               create_time,
+               update_time
+        from kuaishou_live_data_overview
+    </sql>
+
+    <select id="selectKuaishouLiveDataOverviewList" parameterType="com.ruixuan.data.entity.KuaishouLiveDataOverview"
+            resultMap="KuaishouLiveDataOverviewResult">
+        <include refid="selectKuaishouLiveDataOverviewVo"/>
+        <where>
+            <if test="ksId != null ">and ks_id = #{ksId}</if>
+            <if test="ksName != null  and ksName != ''">and ks_name like concat('%', #{ksName}, '%')</if>
+            <if test="accountId != null ">and account_id = #{accountId}</if>
+            <if test="accountName != null  and accountName != ''">and account_name like concat('%', #{accountName},
+                '%')
+            </if>
+            <if test="amounts != null ">and amounts = #{amounts}</if>
+            <if test="statDate != null  and statDate != ''">and stat_date = #{statDate}</if>
+        </where>
+    </select>
+
+    <select id="selectKuaishouLiveDataOverviewByKsId" parameterType="Long" resultMap="KuaishouLiveDataOverviewResult">
+        <include refid="selectKuaishouLiveDataOverviewVo"/>
+        where ks_id = #{ksId}
+    </select>
+
+    <insert id="insertKuaishouLiveDataOverview" parameterType="com.ruixuan.data.entity.KuaishouLiveDataOverview">
+        insert into kuaishou_live_data_overview
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="ksId != null">ks_id,</if>
+            <if test="ksName != null">ks_name,</if>
+            <if test="accountId != null">account_id,</if>
+            <if test="accountName != null">account_name,</if>
+            <if test="amounts != null">amounts,</if>
+            <if test="statDate != null">stat_date,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="ksId != null">#{ksId},</if>
+            <if test="ksName != null">#{ksName},</if>
+            <if test="accountId != null">#{accountId},</if>
+            <if test="accountName != null">#{accountName},</if>
+            <if test="amounts != null">#{amounts},</if>
+            <if test="statDate != null">#{statDate},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateKuaishouLiveDataOverview" parameterType="com.ruixuan.data.entity.KuaishouLiveDataOverview">
+        update kuaishou_live_data_overview
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="ksName != null">ks_name = #{ksName},</if>
+            <if test="accountId != null">account_id = #{accountId},</if>
+            <if test="accountName != null">account_name = #{accountName},</if>
+            <if test="amounts != null">amounts = #{amounts},</if>
+            <if test="statDate != null">stat_date = #{statDate},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where ks_id = #{ksId}
+    </update>
+
+    <delete id="deleteKuaishouLiveDataOverviewByKsId" parameterType="Long">
+        delete
+        from kuaishou_live_data_overview
+        where ks_id = #{ksId}
+    </delete>
+
+    <delete id="deleteKuaishouLiveDataOverviewByKsIds" parameterType="String">
+        delete from kuaishou_live_data_overview where ks_id in
+        <foreach item="ksId" collection="array" open="(" separator="," close=")">
+            #{ksId}
+        </foreach>
+    </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>

+ 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>

+ 256 - 0
ruixuan-live/src/main/resources/mapper/live/KuaishouLiveBroadcastMapper.xml

@@ -0,0 +1,256 @@
+<?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.KuaishouLiveBroadcastMapper">
+
+    <resultMap type="com.ruixuan.live.entity.KuaishouLiveBroadcast" id="KuaishouLiveBroadcastResult">
+        <result property="id" column="id"/>
+        <result property="ksId" column="ks_id"/>
+        <result property="ksName" column="ks_name"/>
+        <result property="accountId" column="account_id"/>
+        <result property="accountName" column="account_name"/>
+        <result property="goalGmv" column="goal_gmv"/>
+        <result property="actualGmv" column="actual_gmv"/>
+        <result property="gmvRoi" column="gmvRoi"/>
+        <result property="liveTime" column="live_time"/>
+        <result property="startTime" column="start_time"/>
+        <result property="endTime" column="end_time"/>
+        <result property="liveLevel" column="live_level"/>
+        <result property="anchorId" column="anchor_id"/>
+        <result property="anchor" column="anchor"/>
+        <result property="traderId" column="trader_id"/>
+        <result property="trader" column="trader"/>
+        <result property="centralControlId" column="central_control_id"/>
+        <result property="centralController" column="central_controller"/>
+        <result property="fieldControlId" column="field_control_id"/>
+        <result property="fieldController" column="field_controller"/>
+        <result property="contentControlId" column="content_control_id"/>
+        <result property="contentController" column="content_controller"/>
+        <result property="inputControlId" column="input_control_id"/>
+        <result property="inputController" column="input_controller"/>
+        <result property="createrId" column="creater_id"/>
+        <result property="uploadFileCount" column="upload_file_count"/>
+        <result property="uploadFileCount" column="upload_file_count"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectKuaishouLiveBroadcastVo">
+        select id,
+               ks_id,
+               ks_name,
+               account_id,
+               account_name,
+               if(goal_gmv > 10000, CONCAT(ROUND(goal_gmv / 10000, 2), 'W'), goal_gmv) as 'goal_gmv',
+               actual_gmv,
+               if(actual_gmv is null, '-', CONCAT(ROUND(actual_gmv / goal_gmv * 100, 2), '%')) as 'gmvRoi',
+               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
+    </sql>
+
+    <select id="selectKuaishouLiveBroadcastList" parameterType="com.ruixuan.live.entity.KuaishouLiveBroadcast"
+            resultMap="KuaishouLiveBroadcastResult">
+        <include refid="selectKuaishouLiveBroadcastVo"/>
+        <where>
+            <if test="ksId != null ">and ks_id = #{ksId}</if>
+            <if test="ksName != null  and ksName != ''">and ks_name like concat('%', #{ksName}, '%')</if>
+            <if test="accountId != null ">and account_id = #{accountId}</if>
+            <if test="accountName != null  and accountName != ''">and account_name like concat('%', #{accountName},
+                '%')
+            </if>
+            <if test="goalGmv != null  and goalGmv != ''">and goal_gmv = #{goalGmv}</if>
+            <if test="startTime != null  and startTime != ''">and start_time >= #{startTime}</if>
+            <if test="endTime != null  and endTime != ''">and end_time &lt;= #{endTime}</if>
+            <if test="liveLevel != null  and liveLevel != ''">and live_level = #{liveLevel}</if>
+            <if test="anchorId != null  and anchorId != ''">and anchor_id = #{anchorId}</if>
+            <if test="anchor != null  and anchor != ''">and anchor = #{anchor}</if>
+            <if test="traderId != null  and traderId != ''">and trader_id = #{traderId}</if>
+            <if test="trader != null  and trader != ''">and trader = #{trader}</if>
+            <if test="centralControlId != null  and centralControlId != ''">and central_control_id =
+                #{centralControlId}
+            </if>
+            <if test="centralController != null  and centralController != ''">and central_controller
+                like concat('%', #{centralController}, '%')
+            </if>
+            <if test="fieldControlId != null  and fieldControlId != ''">and field_control_id = #{fieldControlId}</if>
+            <if test="fieldController != null  and fieldController != ''">and field_controller
+                like concat('%', #{fieldController}, '%')
+            </if>
+            <if test="contentControlId != null  and contentControlId != ''">and content_control_id =
+                #{contentControlId}
+            </if>
+            <if test="contentController != null  and contentController != ''">and content_controller
+                like concat('%', #{contentController}, '%')
+            </if>
+            <if test="inputControlId != null  and inputControlId != ''">and input_control_id = #{inputControlId}</if>
+            <if test="inputController != null  and inputController != ''">and input_controller
+                like concat('%', #{inputController}, '%')
+            </if>
+        </where>
+    </select>
+
+    <select id="selectKuaishouLiveBroadcastById" parameterType="String" resultMap="KuaishouLiveBroadcastResult">
+        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}
+    </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 into kuaishou_live_broadcast
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="ksId != null">ks_id,</if>
+            <if test="ksName != null">ks_name,</if>
+            <if test="accountId != null">account_id,</if>
+            <if test="accountName != null">account_name,</if>
+            <if test="actualGmv != null">actual_gmv,</if>
+            <if test="goalGmv != null">goal_gmv,</if>
+            <if test="liveTime != null">live_time,</if>
+            <if test="startTime != null">start_time,</if>
+            <if test="endTime != null">end_time,</if>
+            <if test="liveLevel != null">live_level,</if>
+            <if test="anchorId != null">anchor_id,</if>
+            <if test="anchor != null">anchor,</if>
+            <if test="traderId != null">trader_id,</if>
+            <if test="trader != null">trader,</if>
+            <if test="centralControlId != null">central_control_id,</if>
+            <if test="centralController != null">central_controller,</if>
+            <if test="fieldControlId != null">field_control_id,</if>
+            <if test="fieldController != null">field_controller,</if>
+            <if test="contentControlId != null">content_control_id,</if>
+            <if test="contentController != null">content_controller,</if>
+            <if test="inputControlId != null">input_control_id,</if>
+            <if test="inputController != null">input_controller,</if>
+            <if test="createrId != null">creater_id,</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">#{id},</if>
+            <if test="ksId != null">#{ksId},</if>
+            <if test="ksName != null">#{ksName},</if>
+            <if test="accountId != null">#{accountId},</if>
+            <if test="accountName != null">#{accountName},</if>
+            <if test="actualGmv != null">#{actualGmv},</if>
+            <if test="goalGmv != null">#{goalGmv},</if>
+            <if test="liveTime != null">#{liveTime},</if>
+            <if test="startTime != null">#{startTime},</if>
+            <if test="endTime != null">#{endTime},</if>
+            <if test="liveLevel != null">#{liveLevel},</if>
+            <if test="anchorId != null">#{anchorId},</if>
+            <if test="anchor != null">#{anchor},</if>
+            <if test="traderId != null">#{traderId},</if>
+            <if test="trader != null">#{trader},</if>
+            <if test="centralControlId != null">#{centralControlId},</if>
+            <if test="centralController != null">#{centralController},</if>
+            <if test="fieldControlId != null">#{fieldControlId},</if>
+            <if test="fieldController != null">#{fieldController},</if>
+            <if test="contentControlId != null">#{contentControlId},</if>
+            <if test="contentController != null">#{contentController},</if>
+            <if test="inputControlId != null">#{inputControlId},</if>
+            <if test="inputController != null">#{inputController},</if>
+            <if test="createrId != null">#{createrId},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateKuaishouLiveBroadcast" parameterType="com.ruixuan.live.entity.KuaishouLiveBroadcast">
+        update kuaishou_live_broadcast
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="ksId != null">ks_id = #{ksId},</if>
+            <if test="ksName != null">ks_name = #{ksName},</if>
+            <if test="accountId != null">account_id = #{accountId},</if>
+            <if test="accountName != null">account_name = #{accountName},</if>
+            <if test="actualGmv != null">actual_gmv = #{actualGmv},</if>
+            <if test="goalGmv != null">goal_gmv = #{goalGmv},</if>
+            <if test="liveTime != null">live_time = #{liveTime},</if>
+            <if test="startTime != null">start_time = #{startTime},</if>
+            <if test="endTime != null">end_time = #{endTime},</if>
+            <if test="liveLevel != null">live_level = #{liveLevel},</if>
+            <if test="anchorId != null">anchor_id = #{anchorId},</if>
+            <if test="anchor != null">anchor = #{anchor},</if>
+            <if test="traderId != null">trader_id = #{traderId},</if>
+            <if test="trader != null">trader = #{trader},</if>
+            <if test="centralControlId != null">central_control_id = #{centralControlId},</if>
+            <if test="centralController != null">central_controller = #{centralController},</if>
+            <if test="fieldControlId != null">field_control_id = #{fieldControlId},</if>
+            <if test="fieldController != null">field_controller = #{fieldController},</if>
+            <if test="contentControlId != null">content_control_id = #{contentControlId},</if>
+            <if test="contentController != null">content_controller = #{contentController},</if>
+            <if test="inputControlId != null">input_control_id = #{inputControlId},</if>
+            <if test="inputController != null">input_controller = #{inputController},</if>
+            <if test="createrId != null">creater_id = #{createrId},</if>
+            <if test="createTime != null">create_time = #{createTime},</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>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteKuaishouLiveBroadcastById" parameterType="String">
+        delete
+        from kuaishou_live_broadcast
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteKuaishouLiveBroadcastByIds" parameterType="String">
+        delete from kuaishou_live_broadcast where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 196 - 0
ruixuan-live/src/main/resources/mapper/live/KuaishouLiveUserAccountMapper.xml

@@ -0,0 +1,196 @@
+<?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.KuaishouLiveUserAccountMapper">
+
+    <resultMap type="com.ruixuan.live.entity.KuaishouLiveUserAccount" id="KuaishouLiveUserAccountResult">
+        <result property="id" column="id"/>
+        <result property="ksId" column="ks_id"/>
+        <result property="ksName" column="ks_name"/>
+        <result property="accountId" column="account_id"/>
+        <result property="accountName" column="account_name"/>
+        <result property="accountType" column="account_type"/>
+        <result property="saleLeaderId" column="sale_leader_id"/>
+        <result property="saleLeader" column="sale_leader"/>
+        <result property="operatorLeaderId" column="operator_leader_id"/>
+        <result property="operatorLeader" column="operator_leader"/>
+        <result property="designerLeaderId" column="designer_leader_id"/>
+        <result property="designerLeader" column="designer_leader"/>
+        <result property="putType" column="put_type"/>
+        <result property="createrId" column="creater_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="count" column="count"/>
+    </resultMap>
+
+    <sql id="selectKuaishouLiveUserAccountVo">
+        select id,
+               ks_id,
+               ks_name,
+               account_id,
+               account_name,
+               account_type,
+               sale_leader_id,
+               sale_leader,
+               operator_leader_id,
+               operator_leader,
+               designer_leader_id,
+               designer_leader,
+               put_type
+        from kuaishou_live_user_account
+    </sql>
+
+    <select id="selectKuaishouLiveUserAccountList" parameterType="com.ruixuan.live.entity.KuaishouLiveUserAccount"
+            resultMap="KuaishouLiveUserAccountResult">
+        select id,
+        ks_id,
+        ks_name,
+        account_id,
+        account_name,
+        account_type,
+        sale_leader_id,
+        sale_leader,
+        operator_leader_id,
+        operator_leader,
+        designer_leader_id,
+        designer_leader,
+        put_type,
+        IFNULL(t2.count,0) as 'count'
+        from kuaishou_live_user_account t1
+        left join  (
+        SELECT ks_id as ksId,account_name as accountName, sum(1) as 'count' FROM kuaishou_live_user_account_part
+        GROUP BY ks_id,account_name
+        ) t2 ON t2.accountName = t1.account_name AND t2.ksId = t1.ks_id
+        <where>
+            <if test="ksId != null ">and ks_id = #{ksId}</if>
+            <if test="ksName != null  and ksName != ''">and ks_name like concat('%', #{ksName}, '%')</if>
+            <if test="accountId != null ">and account_id = #{accountId}</if>
+            <if test="accountName != null  and accountName != ''">and account_name like concat('%', #{accountName},
+                '%')
+            </if>
+            <if test="accountType != null  and accountType != ''">and account_type = #{accountType}</if>
+            <if test="saleLeaderId != null  and saleLeaderId != ''">and sale_leader_id = #{saleLeaderId}</if>
+            <if test="saleLeader != null  and saleLeader != ''">and sale_leader = #{saleLeader}</if>
+            <if test="operatorLeaderId != null  and operatorLeaderId != ''">and operator_leader_id =
+                #{operatorLeaderId}
+            </if>
+            <if test="operatorLeader != null  and operatorLeader != ''">and operator_leader = #{operatorLeader}</if>
+            <if test="designerLeaderId != null  and designerLeaderId != ''">and designer_leader_id =
+                #{designerLeaderId}
+            </if>
+            <if test="designerLeader != null  and designerLeader != ''">and designer_leader = #{designerLeader}</if>
+            <if test="putType != null  and putType != ''">and put_type = #{putType}</if>
+            <if test="createrId != null  and createrId != ''">and creater_id = #{createrId}</if>
+        </where>
+    </select>
+
+    <select id="getOne" parameterType="String" resultType="com.ruixuan.live.entity.KuaishouLiveUserAccount">
+        <include refid="selectKuaishouLiveUserAccountVo"/>
+        <where>
+            <if test="ksId != null ">and ks_id = #{ksId}</if>
+            <if test="accountName != null  and accountName != ''">and account_name=#{accountName}</if>
+        </where>
+        LIMIT 1
+    </select>
+
+    <select id="selectKuaishouLiveUserAccountById" parameterType="String" resultMap="KuaishouLiveUserAccountResult">
+        <include refid="selectKuaishouLiveUserAccountVo"/>
+        where id = #{id}
+    </select>
+
+    <select id="queryNicknameList" parameterType="com.ruixuan.live.entity.KuaishouLiveUserAccount"
+            resultType="com.alibaba.fastjson.JSONObject">
+        select
+        ks_id as 'ksId',
+        ks_name as 'ksName',
+        account_id as 'accountId',
+        account_name as 'accountName'
+        from kuaishou_live_user_account
+        <where>
+            <if test="ksId != null ">and ks_id = #{ksId}</if>
+            <if test="ksName != null  and ksName != ''">and ks_name like concat('%', #{ksName}, '%')</if>
+            <if test="accountId != null ">and account_id = #{accountId}</if>
+            <if test="accountName != null  and accountName != ''">and account_name like concat('%', #{accountName},
+                '%')
+            </if>
+        </where>
+    </select>
+
+
+    <insert id="insertKuaishouLiveUserAccount" parameterType="com.ruixuan.live.entity.KuaishouLiveUserAccount">
+        insert into kuaishou_live_user_account
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="ksId != null">ks_id,</if>
+            <if test="ksName != null">ks_name,</if>
+            <if test="accountId != null">account_id,</if>
+            <if test="accountName != null">account_name,</if>
+            <if test="accountType != null">account_type,</if>
+            <if test="saleLeaderId != null">sale_leader_id,</if>
+            <if test="saleLeader != null">sale_leader,</if>
+            <if test="operatorLeaderId != null">operator_leader_id,</if>
+            <if test="operatorLeader != null">operator_leader,</if>
+            <if test="designerLeaderId != null">designer_leader_id,</if>
+            <if test="designerLeader != null">designer_leader,</if>
+            <if test="putType != null">put_type,</if>
+            <if test="createrId != null">creater_id,</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">#{id},</if>
+            <if test="ksId != null">#{ksId},</if>
+            <if test="ksName != null">#{ksName},</if>
+            <if test="accountId != null">#{accountId},</if>
+            <if test="accountName != null">#{accountName},</if>
+            <if test="accountType != null">#{accountType},</if>
+            <if test="saleLeaderId != null">#{saleLeaderId},</if>
+            <if test="saleLeader != null">#{saleLeader},</if>
+            <if test="operatorLeaderId != null">#{operatorLeaderId},</if>
+            <if test="operatorLeader != null">#{operatorLeader},</if>
+            <if test="designerLeaderId != null">#{designerLeaderId},</if>
+            <if test="designerLeader != null">#{designerLeader},</if>
+            <if test="putType != null">#{putType},</if>
+            <if test="createrId != null">#{createrId},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateKuaishouLiveUserAccount" parameterType="com.ruixuan.live.entity.KuaishouLiveUserAccount">
+        update kuaishou_live_user_account
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="ksId != null">ks_id = #{ksId},</if>
+            <if test="ksName != null">ks_name = #{ksName},</if>
+            <if test="accountId != null">account_id = #{accountId},</if>
+            <if test="accountName != null">account_name = #{accountName},</if>
+            <if test="accountType != null">account_type = #{accountType},</if>
+            <if test="saleLeaderId != null">sale_leader_id = #{saleLeaderId},</if>
+            <if test="saleLeader != null">sale_leader = #{saleLeader},</if>
+            <if test="operatorLeaderId != null">operator_leader_id = #{operatorLeaderId},</if>
+            <if test="operatorLeader != null">operator_leader = #{operatorLeader},</if>
+            <if test="designerLeaderId != null">designer_leader_id = #{designerLeaderId},</if>
+            <if test="designerLeader != null">designer_leader = #{designerLeader},</if>
+            <if test="putType != null">put_type = #{putType},</if>
+            <if test="createrId != null">creater_id = #{createrId},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteKuaishouLiveUserAccountById" parameterType="String">
+        delete
+        from kuaishou_live_user_account
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteKuaishouLiveUserAccountByIds" parameterType="String">
+        delete from kuaishou_live_user_account where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>

+ 75 - 0
ruixuan-live/src/main/resources/mapper/live/KuaishouLiveUserAccountPartMapper.xml

@@ -0,0 +1,75 @@
+<?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.KuaishouLiveUserAccountPartMapper">
+
+    <resultMap type="com.ruixuan.live.entity.KuaishouLiveUserAccountPart" id="KuaishouLiveUserAccountPartResult">
+        <result property="ksId" column="ks_id"/>
+        <result property="ksName" column="ks_name"/>
+        <result property="accountId" column="account_id"/>
+        <result property="accountName" column="account_name"/>
+        <result property="collaboratorId" column="collaborator_id"/>
+        <result property="collaborator" column="collaborator"/>
+        <result property="createrId" column="creater_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectKuaishouLiveUserAccountPartVo">
+        select ks_id,
+               ks_name,
+               account_id,
+               account_name,
+               collaborator_id,
+               collaborator,
+               creater_id,
+               create_time,
+               update_time
+        from kuaishou_live_user_account_part
+    </sql>
+
+
+    <select id="queryCollaboratorsById" parameterType="Long" resultType="com.alibaba.fastjson.JSONObject">
+        select collaborator_id as 'userId', collaborator as 'name'
+        from kuaishou_live_user_account_part
+        where ks_id = #{ksId}
+    </select>
+
+    <select id="selectKuaishouLiveUserAccountPartById" parameterType="Long"
+            resultMap="KuaishouLiveUserAccountPartResult">
+        <include refid="selectKuaishouLiveUserAccountPartVo"/>
+        where ks_id = #{ksId}
+    </select>
+
+
+    <delete id="deleteKuaishouLiveUserAccountPartById" parameterType="Long">
+        delete
+        from kuaishou_live_user_account_part
+        where ks_id = #{ksId}
+    </delete>
+
+
+    <insert id="replaceBatch">
+        replace into kuaishou_live_user_account_part(
+        ks_id,
+        ks_name,
+        account_id,
+        account_name,
+        collaborator_id,
+        collaborator,
+        creater_id)
+        values
+        <foreach collection="collaborators" item="coll" separator=",">
+            (
+            #{coll.ksId},
+            #{coll.ksName},
+            #{coll.accountId},
+            #{coll.accountName},
+            #{coll.userId},
+            #{coll.nickName},
+            #{coll.createrId}
+            )
+        </foreach>
+    </insert>
+</mapper>

+ 149 - 17
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/controller/SaleClueInfoController.java

@@ -1,6 +1,7 @@
 package com.ruixuan.salesLeads.controller;
 
-import com.alibaba.excel.EasyExcel;
+
+import com.alibaba.excel.util.ConverterUtils;
 import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.utils.DateUtils;
@@ -8,19 +9,20 @@ import com.ruixuan.common.utils.StringUtils;
 import com.ruixuan.common.utils.file.FileTypeUtils;
 import com.ruixuan.salesLeads.listener.ImportExcelListener;
 import com.ruixuan.salesLeads.pojo.SaleClueInfoPojo;
+import com.ruixuan.salesLeads.pojo.SaleClueRecordInfoPojo;
 import com.ruixuan.salesLeads.pojo.TestPojo;
+import com.ruixuan.salesLeads.pojo.vo.SaleRecordVo;
+import com.ruixuan.salesLeads.pojo.vo.SaleTaskInfoVo;
 import com.ruixuan.salesLeads.service.ISaleClueInfoService;
 import com.ruixuan.salesLeads.service.ITestService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * ***************************************************
@@ -47,24 +49,24 @@ public class SaleClueInfoController extends BaseController {
 
 
 
-    @ApiOperation(value = "销售线索上传",notes = "swagger不支持上传,请使用postman上传,支持form-data。文件绑定参数为files,支持文件数组")
+    @ApiOperation(value = "销售线索上传",notes = "swagger不支持上传,请使用postman上传,支持form-data。文件绑定参数为file")
     @PostMapping(value = "/importSaleExcelOrCsv")
     public ResultResponse importSaleExcelOrCsv(
-                                      @ApiParam("文件数组") @RequestParam("files") List<MultipartFile> files,
+                                      @ApiParam("文件数组") @RequestParam("file") MultipartFile file,
                                       @ApiParam("销售线索类型1:50W低潜;2:50W中高潜;3:200W高潜;4:200W-500w;5:500W") @RequestParam("salesLeadsType") int salesLeadsType,
                                       @ApiParam("年-月") @RequestParam("uploadDate") String uploadDate,
                                       @ApiParam("创建人") @RequestParam("createUserId") Long createUserId
                                       ) throws Exception{
-        if (files.isEmpty()){
+        if (file.isEmpty()){
             return ResultResponse.error("文件不能为空,请选择文件!");
         }
-        for (MultipartFile file : files) {
-           if (!FileTypeUtils.fileNameSuffix(file)){
-               return ResultResponse.error("请上传正确格式的文件,支持扩展名.xls;.xlsx;.csv");
-           }
-        }
+
+       if (!FileTypeUtils.fileNameSuffix(file)){
+           return ResultResponse.error("请上传正确格式的文件,支持扩展名.xls;.xlsx;.csv");
+       }
+
         Long year = DateUtils.strDateToInt(uploadDate);
-        return saleClueInfoServiceImpl.importSaleExcelOrCsv(files,salesLeadsType,year,createUserId);
+        return saleClueInfoServiceImpl.importSaleExcelOrCsv(file,salesLeadsType,year,createUserId);
     }
 
 
@@ -79,15 +81,145 @@ public class SaleClueInfoController extends BaseController {
             @ApiParam("是否分配销售 0-否 1-是") @RequestParam(value = "distributionSaleFlag",required = false)String distributionSaleFlag,
             @ApiParam("行业id") @RequestParam(value = "industryId",required = false)String industryId,
             @ApiParam("粉丝量级 1:0~50w 2:50W~200W 3:200W~500W 4:500W以上") @RequestParam(value = "fansType",required = false)String fansType,
-            @ApiParam("创建人") @RequestParam(value = "createUserId",required = false) Long createUserId) throws Exception{
+            @ApiParam("状态 1-未开始 2-进行中 3-已结束") @RequestParam(value = "state",required = false)String state,
+            @ApiParam("状态 1-未开始 2-进行中 3-已结束") @RequestParam(value = "salesLeadsType",required = false)String salesLeadsType,
+            @ApiParam("当前用户id") @RequestParam(value = "userId",required = false) Long userId) throws Exception{
 
         return saleClueInfoServiceImpl.selectSaleClueInfoList(sellerName,
                 StringUtils.isEmpty(uploadDate) ? null : DateUtils.strDateToInt(uploadDate),
-                distributionSaleFlag,industryId,fansType, createUserId);
+                distributionSaleFlag,industryId,fansType,state,salesLeadsType, userId);
+
+    }
+
+
+
+    @ApiOperation(value = "销售线索-分配-显示数据信息",notes = "销售线索-分配-显示数据信息(可以传多个卖家id)")
+    @GetMapping(value = "/selectSaleClueInfoBySellers")
+    public ResultResponse<List<SaleClueInfoPojo>> selectSaleClueInfoBySellers(
+            @ApiParam(value = "卖家ids") @RequestParam(value = "sellerIds") List<String> sellerIds){
+        List<Long> longList = sellerIds.stream().map(sellerId -> Long.parseLong(sellerId.trim())).collect(Collectors.toList());
+        return saleClueInfoServiceImpl.selectSaleClueInfoBySellers(longList);
+    }
+
+
+
+
+    @ApiOperation(value = "销售线索-分配",notes = "销售线索-分配-(可以传多个卖家id)")
+    @PostMapping(value = "/saleClueDistribution")
+    public ResultResponse saleClueDistribution(
+            @ApiParam(value = "卖家ids") @RequestParam(value = "sellerIds") String sellerIds,
+            @ApiParam(value = "销售id") @RequestParam(value = "saleId") Long saleId,
+            @ApiParam(value = "创建人id") @RequestParam(value = "createUserId") Long createUserId){
+        List<String> sellerList = Arrays.asList(StringUtils.split(sellerIds,","));
+        return saleClueInfoServiceImpl.saleClueDistribution(sellerList,saleId,createUserId);
+    }
+
+
+
+    @ApiOperation(value = "销售线索-转面销",notes = "销售线索-转面销")
+    @PostMapping(value = "/saleClueToOffline")
+    public ResultResponse saleClueToOffline(@ApiParam(value = "卖家id") @RequestParam(value = "sellerId") Long sellerId,
+                                            //@ApiParam(value = "类型1-电销 2-面销") @RequestParam(value = "offlineSaleFlag") String offlineSaleFlag,
+                                            @ApiParam(value = "销售id") @RequestParam(value = "saleId") Long saleId,
+                                            @ApiParam(value = "创建人id") @RequestParam(value = "createUserId") Long createUserId){
+
+        return saleClueInfoServiceImpl.saleClueToOffline(sellerId, 2,saleId,createUserId);
+
+    }
+
+
+
+
+
+
+
+    @ApiOperation(value = "销售线索任务列表查询",notes = "销售线索任务列表查询")
+    @GetMapping(value = "/selectSaleClueTaskList")
+    public ResultResponse<List<SaleClueInfoPojo>> selectSaleClueTaskList(
+            @ApiParam("模糊查询") @RequestParam(value = "sellerName",required = false) String sellerName,
+            @ApiParam("状态 1-未开始 2-进行中 3-已结束") @RequestParam(value = "state",required = false)Integer state,
+            @ApiParam("当前用户id") @RequestParam(value = "userId") Long userId){
+
+        return saleClueInfoServiceImpl.selectSaleClueTaskList(sellerName,state, userId);
+
+    }
+
+
+
+
+    @ApiOperation(value = "销售线索任务-查询用户代办以及本周完成的数量汇总",notes = "complete-本周完成数量;noStarted-我的待办")
+    @GetMapping(value = "/getTaskNumber")
+    public ResultResponse getTaskNumber(@ApiParam("当前用户id") @RequestParam(value = "userId") Long userId){
+        return saleClueInfoServiceImpl.getTaskNumber(userId);
+    }
+
+
+
+    @ApiOperation(value = "销售线索任务-回显线索详情",notes = "回显线索详情")
+    @GetMapping(value = "/getSaleTaskInfoBySellerId")
+    public ResultResponse<SaleTaskInfoVo> getSaleTaskInfoBySellerId(@ApiParam("卖家id") @RequestParam(value = "sellerId") Long sellerId){
+        return saleClueInfoServiceImpl.getSaleTaskInfoBySellerId(sellerId);
+    }
+
+
+
+    @ApiOperation(value = "销售线索任务-新增跟进记录",notes = "销售线索任务-新增跟进记录")
+    @PostMapping(value = "/insertSaleTaskRecord")
+    public ResultResponse insertSaleTaskRecord(SaleClueRecordInfoPojo recordInfoPojo){
+
+        return saleClueInfoServiceImpl.insertSaleTaskRecord(recordInfoPojo);
+
+    }
+
+
+    @ApiOperation(value = "销售线索-基础-根据角色显示销售线索分类",notes = "销售线索-基础-根据角色显示销售线索分类(销售线索类型1:50W低潜;2:50W中高潜3:200W高潜4:200W-500w5:500W)")
+    @GetMapping(value = "/getSaleTypeByRoleCode")
+    public ResultResponse getSaleTypeByRoleCode(@ApiParam("角色code") @RequestParam(value = "roleCode") String roleCode){
+
+        List<Map<String,String>> resultList = new ArrayList<>();
+        Map<String,String> map1 = new HashMap<>();
+        map1.put("salesLeadsType","1");
+        map1.put("salesLeadsName","50W低潜");
+
+        Map<String,String> map2 = new HashMap<>();
+        map2.put("salesLeadsType","2");
+        map2.put("salesLeadsName","50W中高潜");
+
+        Map<String,String> map3 = new HashMap<>();
+        map3.put("salesLeadsType","3");
+        map3.put("salesLeadsName","200W高潜");
+
+        Map<String,String> map4 = new HashMap<>();
+        map4.put("salesLeadsType","4");
+        map4.put("salesLeadsName","200W-500w");
+
+        Map<String,String> map5 = new HashMap<>();
+        map5.put("salesLeadsType","5");
+        map5.put("salesLeadsName","500W");
+
+        resultList.add(map1);
+        resultList.add(map2);
+        resultList.add(map3);
+        resultList.add(map4);
+        resultList.add(map5);
+
+        //电销
+        //50w 排第一个
+
+        //面销
+        if (roleCode.contains("facePin")){
+            resultList.remove(map3);
+            //200W 排第一个
+            resultList.add(0,map3);
+        }
+
+        return ResultResponse.successMsg("查询成功",resultList);
 
     }
 
 
 
 
+
+
 }

+ 125 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/listener/ImportExcelListener.java

@@ -0,0 +1,125 @@
+package com.ruixuan.salesLeads.listener;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.alibaba.fastjson.JSON;
+import com.ruixuan.common.utils.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * ***************************************************
+ *
+ * @Auther: zianY
+ * @Descipion: 销售线索excel 监听解析
+ * @CreateDate: 2022-05-24
+ * ****************************************************
+ */
+
+public class ImportExcelListener extends AnalysisEventListener<Map<Integer, String>> {
+
+
+    private static final Logger log = LoggerFactory.getLogger(ImportExcelListener.class);
+
+    public static List<Map<String,String>> importDataList = new ArrayList<>();
+
+    public static Map<Integer, String> importHeadList = new HashMap<>();
+
+
+
+    @Override
+    public void invoke(Map<Integer, String> data, AnalysisContext analysisContext) {
+
+        Map<String, String> ObjectMap = new HashMap<>();
+
+        String dataStr = JSON.toJSONString(data);
+
+        log.info("解析到的一条数据=====excelRow = {}", JSON.toJSONString(data));
+
+        if (!dataStr.isEmpty() && !StringUtils.equals(dataStr,"{}")){
+            data.forEach((key,vlue) ->{
+                Object mapKey = importHeadList.get(key);
+                if (StringUtils.isNotNull(mapKey)){
+
+                    String keyStr = (String)mapKey;
+                    keyStr.replace(" ","");
+
+                    if (StringUtils.isNotNull(vlue)){
+                        vlue = vlue.replace(" ","");
+                    }
+
+                    if (keyStr.contains("家ID")){
+                        ObjectMap.put("sellerId",vlue);
+                    }
+                    if (keyStr.contains("昵称")){
+                        ObjectMap.put("sellerName",vlue);
+                    }
+                    if (keyStr.contains("粉丝")){
+                        ObjectMap.put("fans",vlue);
+                    }
+                    if (keyStr.contains("行业")){
+                        ObjectMap.put("industryId",vlue);
+                    }
+                    if (keyStr.contains("省份")){
+                        ObjectMap.put("provinceId",vlue);
+                    }
+                    if (keyStr.contains("城市")){
+                        ObjectMap.put("cityId",vlue);
+                    }
+                    if (keyStr.contains("联系")){
+                        ObjectMap.put("telephone",vlue);
+                    }
+                    if (keyStr.contains("服务商")){
+                        //ObjectMap.put("providerFlag",StringUtils.isEmpty(vlue) ? "否" : vlue);
+                        ObjectMap.put("providerFlag",vlue);
+                    }
+                    if (keyStr.contains("跃迁")){
+                        //ObjectMap.put("transitionFlag",StringUtils.isEmpty(vlue) ? "否" : vlue);
+                        ObjectMap.put("transitionFlag",vlue);
+                    }
+                    if ((keyStr).contains("30天")){
+                        ObjectMap.put("NearlyThirtyDays",vlue);
+                    }
+
+                    if ((keyStr).contains("gmv") || (keyStr).contains("GMV")){
+                        ObjectMap.put("gmvMonth",keyStr.substring(0,keyStr.length()-3));
+                        ObjectMap.put("gmv",vlue);
+                    }
+
+                    if (keyStr.contains("mtd") || keyStr.contains("MTD")){
+                        ObjectMap.put("mtdDate",keyStr.substring(0,keyStr.length()-3));
+                        ObjectMap.put("mtd",vlue);
+                    }
+
+                }
+            });
+
+        }
+
+
+
+        importDataList.add(ObjectMap);
+
+
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+        log.info("解析完所有数据===={}",importDataList);
+
+    }
+
+    @Override
+    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
+        log.info("表头数据===excelHead-->>>{}", headMap);
+        importHeadList.putAll(headMap);
+    }
+
+
+}

+ 25 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/mapper/SaleClueDistributionInfoMapper.java

@@ -0,0 +1,25 @@
+package com.ruixuan.salesLeads.mapper;
+
+import com.ruixuan.salesLeads.pojo.SaleClueDistributionInfoPojo;
+import com.ruixuan.salesLeads.pojo.SaleQuotaInfoPojo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ***************************************************
+ *
+ * @Auther: zianY
+ * @Descipion: 销售线索-分配记录信息表
+ * @CreateDate: 2022-05-31
+ * ****************************************************
+ */
+public interface SaleClueDistributionInfoMapper {
+
+
+    /**
+     * 新增销售线索 分配信息
+     * @param saleClueDistributionInfoPojo
+     */
+    void insertSaleClueDistribution(SaleClueDistributionInfoPojo saleClueDistributionInfoPojo);
+}

+ 69 - 2
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/mapper/SaleClueInfoMapper.java

@@ -2,6 +2,7 @@ package com.ruixuan.salesLeads.mapper;
 
 import com.ruixuan.salesLeads.pojo.SaleClueInfoPojo;
 import com.ruixuan.salesLeads.pojo.TestPojo;
+import com.ruixuan.salesLeads.pojo.vo.SaleRecordVo;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -30,7 +31,8 @@ public interface SaleClueInfoMapper {
      * @param distributionSaleFlag 是否分配销售 0-否 1-是
      * @param industryId 行业id
      * @param fansType 粉丝类别
-     * @param createUserId
+     * @param state 状态 1-未开始 2-进行中 3-已结束
+     * @param userId
      * @return
      */
     List<SaleClueInfoPojo> selectSaleClueInfoList(@Param(value = "sellerName") String sellerName,
@@ -38,5 +40,70 @@ public interface SaleClueInfoMapper {
                                                   @Param(value = "distributionSaleFlag") String distributionSaleFlag,
                                                   @Param(value = "industryId") String industryId,
                                                   @Param(value = "fansType") String fansType,
-                                                  @Param(value = "createUserId") Long createUserId);
+                                                  @Param(value = "state") String state,
+                                                  @Param(value = "salesLeadsType") String salesLeadsType,
+                                                  @Param(value = "userId") Long userId);
+
+    /**
+     *  销售线索 任务 列表信息
+     * @param sellerName
+     * @param state
+     * @param saleId
+     * @return
+     */
+    List<SaleClueInfoPojo> selectSaleClueTaskList(@Param(value = "sellerName") String sellerName,
+                                                  @Param(value = "state") Integer state,
+                                                  @Param(value = "saleId") Long saleId);
+
+
+    /**
+     * 根据卖家ids 查询销售线索
+     * @param sellerIds 卖家id
+     * @return
+     */
+     List<SaleClueInfoPojo> selectSaleClueInfoBySellers(@Param(value = "sellerIds") List<Long> sellerIds);
+
+    /**
+     * 修改销售线索 销售人员
+     * @param sellerId  卖家id
+     * @param saleId 销售id
+     * @param distributionSaleFlag 是否分配销售 0-否 1-是
+     * @return
+     */
+     void updateSaleClueSale(@Param(value = "sellerId") Long sellerId, @Param(value = "saleId") Long saleId, @Param(value = "distributionSaleFlag") int distributionSaleFlag);
+
+    /**
+     * 修改销售线索 状态
+     * @param sellerId 卖家id
+     * @param state 进行状态 1-未开始 2-进行中 3-已结束
+     */
+     void updateSaleClueState(@Param(value = "sellerId") Long sellerId, @Param(value = "state") int state);
+
+    /**
+     *  根据销售 查询未完成数量数量
+     * @param saleId 销售人员id
+     * @return
+     */
+     int selectSaleClueComplete(@Param(value = "saleId") Long saleId);
+
+
+    /**
+     * 卖家id 查询线索信息
+     * @param sellerId 卖家id
+     * @return
+     */
+     SaleRecordVo selectSaleClueInfoBySellerId(@Param(value = "sellerId") Long sellerId);
+
+    /**
+     * 修改销售线索 销售类别 电销或面销
+     * @param sellerId 卖家id
+     * @param offlineSaleFlag 类型 1-电销 2-面销
+     * @param saleId 销售
+     */
+     void updateSaleClueOfflineFlag(@Param(value = "sellerId") Long sellerId,@Param(value = "offlineSaleFlag") int offlineSaleFlag,@Param(value = "saleId") Long saleId);
+
+
+
+
+
 }

+ 23 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/mapper/SaleClueRecordInfoMapper.java

@@ -22,4 +22,27 @@ public interface SaleClueRecordInfoMapper {
      * @param
      */
     SaleClueRecordInfoPojo getSaleClueRecordNumber(@Param(value = "sellerId") Long sellerId, @Param(value = "number")int number);
+
+    /**
+     * 根据销售 查询 本周有意向的数量
+     * @param saleId 销售人员id
+     * @param startTime 开始时间
+     * @param endTime 结束时间
+     * @return
+     */
+    int selectSaleClueIntention(@Param(value = "saleId") Long saleId, @Param(value = "startTime")String startTime,@Param(value = "endTime")String endTime);
+
+
+    /**
+     *  卖家id 查询销售记录
+     * @param sellerId 卖家id
+     * @return
+     */
+    List<SaleClueRecordInfoPojo> selectDistributionList(@Param(value = "sellerId") Long sellerId);
+
+    /**
+     * 添加销售记录
+     * @param recordInfoPojo
+     */
+    void insertSaleRedord(SaleClueRecordInfoPojo recordInfoPojo);
 }

+ 7 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/mapper/SaleQuotaInfoMapper.java

@@ -22,4 +22,11 @@ public interface SaleQuotaInfoMapper {
      * @param saleQuotaList
      */
     void replaceSaleQuotaInfoBatch(@Param(value = "saleQuotaList") List<SaleQuotaInfoPojo> saleQuotaList);
+
+    /**
+     * 根据卖家id查看最新额度
+     * @param sellerId
+     * @return
+     */
+    SaleQuotaInfoPojo getSaleQuotaInfoBySellerId(@Param(value = "sellerId")Long sellerId);
 }

+ 42 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/SaleClueDistributionInfoPojo.java

@@ -0,0 +1,42 @@
+package com.ruixuan.salesLeads.pojo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * ***************************************************
+ *
+ * @Auther: zianY
+ * @Descipion: 销售线索-分配记录信息表
+ * @CreateDate: 2022-05-31
+ * ****************************************************
+ */
+@Data
+@ApiModel(value = "saleClueDistributionInfoPojo", description = "销售线索-分配记录信息表")
+public class SaleClueDistributionInfoPojo {
+
+    private int id;
+
+    @ApiModelProperty("卖家id")
+    private Long sellerId;
+
+    @ApiModelProperty("'销售id'")
+    private Long saleId;
+
+
+    @ApiModelProperty("创建人")
+    private Long createUserId;
+
+    @ApiModelProperty("创建时间")
+    private String createTime;
+
+    public SaleClueDistributionInfoPojo() {
+    }
+
+    public SaleClueDistributionInfoPojo(Long sellerId, Long saleId, Long createUserId) {
+        this.sellerId = sellerId;
+        this.saleId = saleId;
+        this.createUserId = createUserId;
+    }
+}

+ 26 - 5
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/SaleClueInfoPojo.java

@@ -54,27 +54,29 @@ public class SaleClueInfoPojo {
     private String cityName;
 
     @ApiModelProperty("联系方式")
-    private Long telephone;
+    private String telephone;
 
     @ApiModelProperty("卖家是否绑定服务商 0-否 1-是'")
-    private int providerFlag;
+    private String providerFlag;
 
     @ApiModelProperty("是否跃迁 0-否 1-是'")
-    private int transitionFlag;
+    private String transitionFlag;
 
     @ApiModelProperty("月份")
-    private int uploadDate;
+    private Long uploadDate;
 
     @ApiModelProperty("是否分配销售 0-否 1-是'")
     private int distributionSaleFlag;
 
     @ApiModelProperty("销售人员id")
     private Long saleId;
+    @ApiModelProperty("销售人员")
+    private String saleName;
 
     @ApiModelProperty("进行状态 1-未开始 2-进行中 3-已结束")
     private int state;
 
-    @ApiModelProperty("是否转面销 0-否 1-是")
+    @ApiModelProperty("是否转面销 1-电销 2-面销")
     private int offlineSaleFlag;
 
     @ApiModelProperty("创建人")
@@ -95,6 +97,25 @@ public class SaleClueInfoPojo {
     @ApiModelProperty("第二次跟进情况")
     private SaleClueRecordInfoPojo secondRecord;
 
+    @ApiModelProperty("任务跟进情况")
+    private SaleClueRecordInfoPojo recordTask;
+
+
+    @ApiModelProperty("'近30天'")
+    private String nearlyThirtyDays;
+
+    @ApiModelProperty("gmv月份")
+    private Long gmvMonth;
+
+    @ApiModelProperty("gmv")
+    private String gmv;
+
+    @ApiModelProperty("mtd日期")
+    private Long mtdDate;
+
+    @ApiModelProperty("mtd")
+    private String mtd;
+
 
 
 

+ 5 - 2
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/SaleClueRecordInfoPojo.java

@@ -28,13 +28,13 @@ public class SaleClueRecordInfoPojo {
     private int recordTimes;
 
     @ApiModelProperty("跟进话术1-扶持 2-活动")
-    private int recordScript;
+    private String recordScript;
 
     @ApiModelProperty("是否继续跟进 1-继续跟进 2-意向合作 3-跟进完成无合作")
     private int continueFlag;
 
     @ApiModelProperty("意向合作 1-不合作可跟进 2-添加微信 3-操盘合作 4-服务商合作 5-金牛合作 6-无法添加微信")
-    private int intendedCooperation;
+    private String intendedCooperation;
 
     @ApiModelProperty("跟进详情")
     private String recordInfo;
@@ -49,6 +49,9 @@ public class SaleClueRecordInfoPojo {
     @ApiModelProperty("创建时间")
     private String createTime;
 
+    @ApiModelProperty("任务开始时间")
+    private String taskTime;
+
 
 
 }

+ 1 - 1
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/TestPojo.java

@@ -12,7 +12,7 @@ import java.util.List;
  * ***************************************************
  *
  * @Auther: zianY
- * @Descipion: demo测试
+ * @Descipion: demo-测试
  * @CreateDate: 2022-05-19
  * ****************************************************
  */

+ 109 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/vo/SaleRecordVo.java

@@ -0,0 +1,109 @@
+package com.ruixuan.salesLeads.pojo.vo;
+
+import com.ruixuan.salesLeads.pojo.SaleClueRecordInfoPojo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * ***************************************************
+ *
+ * @Auther: zianY
+ * @Descipion: 销售线索信息表
+ * @CreateDate: 2022-05-24
+ * ****************************************************
+ */
+
+
+@Data
+@ApiModel(value = "saleRecordVo", description = "销售线索详情")
+public class SaleRecordVo {
+
+
+    private int id;
+
+    @ApiModelProperty("销售线索类型1:50W低潜;2:50W中高潜;3:200W高潜;4:200W-500w;5:500W")
+    private int salesLeadsType;
+
+    @ApiModelProperty("卖家id")
+    private Long sellerId;
+
+    @ApiModelProperty("'卖家昵称'")
+    private String sellerName;
+
+    @ApiModelProperty("粉丝数")
+    private Long fans;
+
+    @ApiModelProperty("所属行业")
+    private int industryId;
+    @ApiModelProperty("所属行业")
+    private String industryName;
+
+    @ApiModelProperty("常驻省份")
+    private int provinceId;
+    @ApiModelProperty("常驻省份")
+    private String provinceName;
+
+    @ApiModelProperty("常驻城市")
+    private int cityId;
+    @ApiModelProperty("常驻城市")
+    private String cityName;
+
+    @ApiModelProperty("联系方式")
+    private Long telephone;
+
+    @ApiModelProperty("卖家是否绑定服务商")
+    private String providerFlag;
+
+    @ApiModelProperty("是否跃迁")
+    private String transitionFlag;
+
+    @ApiModelProperty("月份")
+    private int uploadDate;
+
+    @ApiModelProperty("是否分配销售 0-否 1-是'")
+    private int distributionSaleFlag;
+
+    @ApiModelProperty("销售人员id")
+    private Long saleId;
+    @ApiModelProperty("销售人员")
+    private String saleName;
+
+    @ApiModelProperty("进行状态 1-未开始 2-进行中 3-已结束")
+    private int state;
+
+    @ApiModelProperty("是否转面销 0-否 1-是")
+    private int offlineSaleFlag;
+
+    @ApiModelProperty("创建人")
+    private Long createUserId;
+
+    @ApiModelProperty("创建时间")
+    private String createTime;
+
+    @ApiModelProperty("更新人")
+    private Long updateUserId;
+
+    @ApiModelProperty("更新时间")
+    private String updateTime;
+
+    @ApiModelProperty("'近30天'")
+    private String nearlyThirtyDays;
+
+    @ApiModelProperty("gmv月份")
+    private Long gmvMonth;
+
+    @ApiModelProperty("gmv")
+    private String gmv;
+
+    @ApiModelProperty("mtd日期")
+    private Long mtdDate;
+
+    @ApiModelProperty("mtd")
+    private String mtd;
+
+
+
+
+
+}

+ 39 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/vo/SaleTaskInfoVo.java

@@ -0,0 +1,39 @@
+package com.ruixuan.salesLeads.pojo.vo;
+
+import com.ruixuan.salesLeads.pojo.SaleClueRecordInfoPojo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * ***************************************************
+ *
+ * @Auther: zianY
+ * @Descipion: 销售线索信息表
+ * @CreateDate: 2022-05-24
+ * ****************************************************
+ */
+
+
+@Data
+@ApiModel(value = "saleTaskInfoVo", description = "销售线索详情")
+public class SaleTaskInfoVo {
+
+
+    private int id;
+
+    @ApiModelProperty("销售线索详情")
+    private SaleRecordVo saleRecordVo;
+
+    @ApiModelProperty("跟进记录信息")
+    private List<SaleClueRecordInfoPojo> recordList;
+
+    @ApiModelProperty("下次跟进次数")
+    private int nextNum;
+
+
+
+
+}

+ 19 - 2
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/service/ISaleClueInfoService.java

@@ -2,6 +2,7 @@ package com.ruixuan.salesLeads.service;
 
 import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.salesLeads.pojo.SaleClueInfoPojo;
+import com.ruixuan.salesLeads.pojo.SaleClueRecordInfoPojo;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -18,8 +19,24 @@ import java.util.List;
 public interface ISaleClueInfoService {
 
 
-    ResultResponse importSaleExcelOrCsv(List<MultipartFile> files,int salesLeadsType,Long uploadDate,Long createUserId)throws Exception;
+    ResultResponse importSaleExcelOrCsv(MultipartFile file,int salesLeadsType,Long uploadDate,Long createUserId);
 
 
-    ResultResponse<List<SaleClueInfoPojo>> selectSaleClueInfoList(String sellerName, Long uploadDate, String distributionSaleFlag, String industryId, String fansType, Long createUserId)throws Exception;
+    ResultResponse selectSaleClueInfoList(String sellerName, Long uploadDate, String distributionSaleFlag, String industryId, String fansType,String state,String salesLeadsType, Long userId)throws Exception;
+
+    ResultResponse selectSaleClueTaskList(String sellerName,Integer state, Long userId);
+
+    ResultResponse<List<SaleClueInfoPojo>> selectSaleClueInfoBySellers(List<Long> sellerIds);
+
+    ResultResponse saleClueDistribution(List<String> sellerIds, Long saleId,Long createUserId);
+
+
+    ResultResponse getTaskNumber(Long userId);
+
+    ResultResponse getSaleTaskInfoBySellerId(Long sellerId);
+
+    ResultResponse insertSaleTaskRecord(SaleClueRecordInfoPojo recordInfoPojo);
+
+    ResultResponse saleClueToOffline(Long sellerId,int offlineSaleFlag,Long saleId,Long createUserId);
+
 }

+ 315 - 42
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/service/impl/SaleClueInfoServiceImpl.java

@@ -1,16 +1,24 @@
 package com.ruixuan.salesLeads.service.impl;
 
 import com.alibaba.excel.EasyExcel;
+import com.github.pagehelper.PageInfo;
 import com.ruixuan.common.core.domain.ResultResponse;
+import com.ruixuan.common.core.page.TableDataInfo;
+import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.PageUtils;
 import com.ruixuan.common.utils.StringUtils;
 import com.ruixuan.common.utils.file.FileTypeUtils;
 import com.ruixuan.salesLeads.listener.ImportExcelListener;
+import com.ruixuan.salesLeads.mapper.SaleClueDistributionInfoMapper;
 import com.ruixuan.salesLeads.mapper.SaleClueInfoMapper;
 import com.ruixuan.salesLeads.mapper.SaleClueRecordInfoMapper;
 import com.ruixuan.salesLeads.mapper.SaleQuotaInfoMapper;
+import com.ruixuan.salesLeads.pojo.SaleClueDistributionInfoPojo;
 import com.ruixuan.salesLeads.pojo.SaleClueInfoPojo;
+import com.ruixuan.salesLeads.pojo.SaleClueRecordInfoPojo;
 import com.ruixuan.salesLeads.pojo.SaleQuotaInfoPojo;
+import com.ruixuan.salesLeads.pojo.vo.SaleRecordVo;
+import com.ruixuan.salesLeads.pojo.vo.SaleTaskInfoVo;
 import com.ruixuan.salesLeads.service.ISaleClueInfoService;
 import com.ruixuan.salesLeads.utils.CsvImportUtil;
 import com.ruixuan.system.domain.SysAreaInfo;
@@ -23,6 +31,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -52,6 +61,15 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
     @Autowired
     private SysAreaInfoMapper sysAreaInfoMapper;
 
+    @Autowired
+    private SaleClueRecordInfoMapper saleClueRecordInfoMapper;
+
+
+    @Autowired
+    private SaleClueDistributionInfoMapper saleClueDistributionInfoMapper;
+
+
+
 
 
 
@@ -60,7 +78,7 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
      * Description: 销售线索添加
      * 支持excel 和 csv 文件上传
      *------------
-     * @param files
+     * @param file
      * @param salesLeadsType 销售线索类型1:50W低潜;2:50W中高潜;3:200W高潜;4:200W-500w;5:500W
      * @param uploadDate 时间 格式为202205
      * @param createUserId
@@ -68,32 +86,46 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
      * Return com.ruixuan.common.core.domain.ResultResponse
      */
     @Override
-    public ResultResponse importSaleExcelOrCsv(List<MultipartFile> files, int salesLeadsType, Long uploadDate, Long createUserId) throws Exception{
+    public ResultResponse importSaleExcelOrCsv(MultipartFile file, int salesLeadsType, Long uploadDate, Long createUserId){
 
         List<Map<String,String>> dataList = new ArrayList<>();
-        for (MultipartFile file : files) {
-            //文件类型
-            String fileType = FileTypeUtils.gerFileTypeXlsOrCsv(file);
-            if (StringUtils.equals("excel",fileType)){
-                //读取Excel
-                EasyExcel.read(file.getInputStream(),null,
-                            new ImportExcelListener()).sheet().headRowNumber(1).doRead();
-                //头 信息
-                //Map<Integer, String> headList = ImportExcelListener.importHeadList;
-                //结果集
-                dataList = ImportExcelListener.importDataList;
 
-            }
+        //文件类型
+        String fileType = FileTypeUtils.gerFileTypeXlsOrCsv(file);
 
-            if (StringUtils.equals("csv",fileType)){
-                dataList = CsvImportUtil.readCSV(file);
-            }
-            //处理数据结果
-            resultData(dataList,salesLeadsType,createUserId);
+        try {
+
+
+
+
+        if (StringUtils.equals("excel",fileType)){
+            //读取Excel
+            EasyExcel.read(file.getInputStream(),null,
+                        new ImportExcelListener()).sheet().headRowNumber(1).doRead();
+            //头 信息
+            //Map<Integer, String> headList = ImportExcelListener.importHeadList;
+            //结果集
+            dataList = ImportExcelListener.importDataList;
+
+        }
 
+        if (StringUtils.equals("csv",fileType)){
+            dataList = CsvImportUtil.readCSV(file);
+        }
+        //处理数据结果
+        resultData(dataList,salesLeadsType,uploadDate,createUserId);
+
+        //excel 清除监听数据
+        ImportExcelListener.importDataList.clear();
+        ImportExcelListener.importHeadList.clear();
+
+        }catch (Exception e){
             //excel 清除监听数据
             ImportExcelListener.importDataList.clear();
             ImportExcelListener.importHeadList.clear();
+            log.error("上传文件出现了问题。{}",e.toString());
+            e.printStackTrace();
+            return ResultResponse.error("上传文件失败。");
         }
 
         return ResultResponse.successMsg("保存成功",null);
@@ -104,74 +136,315 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
      * 处理销售线索 数据结果
      * @param dataList
      * @param salesLeadsType
+     * @param uploadDate
      * @param createUserId
      */
-    public void resultData(List<Map<String,String>> dataList,int salesLeadsType,Long createUserId){
+    public void resultData(List<Map<String,String>> dataList,int salesLeadsType,Long uploadDate,Long createUserId){
         List<SaleClueInfoPojo> clueList = new ArrayList<>();
         List<SaleQuotaInfoPojo> quotaList = new ArrayList<>();
         for (Map<String, String> dataMap : dataList) {
+
+            if(StringUtils.isEmpty(dataMap)){
+                continue;
+            }
+            //log.info("datamap----{}",dataMap);
+
+            if (!dataMap.containsKey("sellerId")){
+                continue;
+            }
+
+            if (dataMap.get("sellerId").isEmpty()){
+                //log.info("sellerId----{}",dataMap.get("sellerId"));
+                continue;
+            }
+
+
             SaleClueInfoPojo clue = new SaleClueInfoPojo();
             SaleQuotaInfoPojo quota = new SaleQuotaInfoPojo();
 
             clue.setSalesLeadsType(salesLeadsType);
+
             clue.setSellerId(Long.valueOf(dataMap.get("sellerId")));
             clue.setSellerName(dataMap.get("sellerName"));
             clue.setFans(Long.valueOf(dataMap.get("fans")));
-            clue.setTelephone(Long.valueOf(dataMap.get("telephone")));
-            clue.setProviderFlag(dataMap.get("providerFlag").equals("否") ? 0 : 1);
-            clue.setTransitionFlag(Integer.valueOf(dataMap.get("transitionFlag")));
+            clue.setTelephone(StringUtils.isEmpty(dataMap.get("telephone")) ? "" : dataMap.get("telephone"));
+            clue.setProviderFlag(dataMap.get("providerFlag"));
+            clue.setTransitionFlag(dataMap.get("transitionFlag"));
             clue.setCreateUserId(createUserId);
+            clue.setUploadDate(uploadDate);
             //查询行业
             SysIndustryInfo industryInfo = sysIndustryInfoMapper.getIndustryInfoByName(dataMap.get("industryId"));
             clue.setIndustryId(StringUtils.isNull(industryInfo) ? 0 : industryInfo.getId());
             //根据城市查询 省市id
             SysAreaInfo areaInfo = sysAreaInfoMapper.getAreaInfoByName(dataMap.get("cityId"));
-            clue.setProvinceId(areaInfo.getParentCode());
-            clue.setCityId(areaInfo.getCode());
+            clue.setProvinceId(areaInfo == null ? 0 : areaInfo.getParentCode());
+            clue.setCityId(areaInfo == null ? 0 : areaInfo.getCode());
 
-            quota.setNearlyThirtyDays(dataMap.get("NearlyThirtyDays"));
-            quota.setGmvMonth(Long.valueOf(dataMap.get("gmvMonth")));
-            quota.setGmv(dataMap.get("gmv"));
+            if (StringUtils.isNotEmpty(dataMap.get("NearlyThirtyDays"))){
+                quota.setNearlyThirtyDays(dataMap.get("NearlyThirtyDays"));
 
-            quota.setMtdDate(Long.valueOf(dataMap.get("mtdDate")));
-            quota.setMtd(dataMap.get("mtd"));
-            quota.setCreateUserId(createUserId);
-            quota.setSellerId(Long.valueOf(dataMap.get("sellerId")));
+            }
+
+            if (StringUtils.isNotEmpty(dataMap.get("gmv"))){
+                quota.setGmvMonth(Long.valueOf(dataMap.get("gmvMonth")));
+                quota.setGmv(dataMap.get("gmv"));
+            }
 
-            clueList.add(clue);
-            quotaList.add(quota);
+            if (StringUtils.isNotEmpty(dataMap.get("mtd"))){
+                quota.setMtdDate(Long.valueOf(dataMap.get("mtdDate")));
+                quota.setMtd(dataMap.get("mtd"));
+            }
+
+            if (StringUtils.isNotEmpty(dataMap.get("NearlyThirtyDays")) ||
+                    StringUtils.isNotEmpty(dataMap.get("gmv")) ||
+                    StringUtils.isNotEmpty(dataMap.get("mtd"))){
+                quota.setCreateUserId(createUserId);
+                quota.setSellerId(Long.valueOf(dataMap.get("sellerId")));
+            }
+
+
+
+            if (StringUtils.isNotNull(clue)){
+                clueList.add(clue);
+            }
+            if (StringUtils.isNotNull(quota.getSellerId())){
+                quotaList.add(quota);
+            }
+
+
+
+
+        }
+
+
+        if (clueList.size() > 0){
+            //销售线索
+            saleClueInfoMapper.replaceSaleClueInfoBatch(clueList);
         }
+        if (quotaList.size() > 0){
+            //线索-额度
+            saleQuotaInfoMapper.replaceSaleQuotaInfoBatch(quotaList);
+        }
+
+
 
-        //销售线索
-        saleClueInfoMapper.replaceSaleClueInfoBatch(clueList);
-        //线索-额度
-        saleQuotaInfoMapper.replaceSaleQuotaInfoBatch(quotaList);
 
     }
 
 
 
-    @Autowired
-    private SaleClueRecordInfoMapper saleClueRecordInfoMapper;
 
+    /**
+     *
+     * @description: 销售线索列表查询
+     *
+     * @param sellerName 卖家昵称
+     * @param uploadDate 年月
+     * @param distributionSaleFlag 是否分配销售 0-否 1-是
+     * @param industryId 行业id
+     * @param fansType 粉丝量级 1:0~50w 2:50W~200W 3:200W~500W 4:500W以上
+     * @param userId
+     * @return: com.ruixuan.common.core.domain.ResultResponse<java.util.List<com.ruixuan.salesLeads.pojo.SaleClueInfoPojo>>
+     * @author: zianY
+     */
     @Override
-    public ResultResponse<List<SaleClueInfoPojo>> selectSaleClueInfoList(String sellerName, Long uploadDate, String distributionSaleFlag, String industryId, String fansType, Long createUserId) throws Exception {
+    public ResultResponse selectSaleClueInfoList(String sellerName, Long uploadDate, String distributionSaleFlag, String industryId, String fansType, String state,String salesLeadsType,Long userId) throws Exception {
 
         PageUtils.startPage();
-        List<SaleClueInfoPojo> saleList =  saleClueInfoMapper.selectSaleClueInfoList(sellerName,uploadDate,distributionSaleFlag,industryId,fansType, createUserId);
+        List<SaleClueInfoPojo> saleList =  saleClueInfoMapper.selectSaleClueInfoList(sellerName,uploadDate,distributionSaleFlag,industryId,fansType,state,salesLeadsType, userId);
         saleList.forEach(clue ->{
             clue.setFirstRecord(saleClueRecordInfoMapper.getSaleClueRecordNumber(clue.getSellerId(),1));
             clue.setSecondRecord(saleClueRecordInfoMapper.getSaleClueRecordNumber(clue.getSellerId(),2));
+
+            //近30天 gmv mtd
+            SaleQuotaInfoPojo quotaInfoPojo = saleQuotaInfoMapper.getSaleQuotaInfoBySellerId(clue.getSellerId());
+            if (StringUtils.isNotNull(quotaInfoPojo)){
+                clue.setNearlyThirtyDays(quotaInfoPojo.getNearlyThirtyDays());
+                clue.setGmvMonth(quotaInfoPojo.getGmvMonth());
+                clue.setGmv(quotaInfoPojo.getGmv());
+                clue.setMtdDate(quotaInfoPojo.getMtdDate());
+                clue.setMtd(quotaInfoPojo.getMtd());
+            }
+
+
         });
+        return ResultResponse.successMsg("查询成功。",new TableDataInfo(saleList,new Long(new PageInfo(saleList).getTotal()).intValue()));
+    }
 
 
+    /**
+     *
+     * @description: 销售线索任务列表查询
+     *
+     * @param sellerName 模糊查询
+     * @param state 状态 1-未开始 2-进行中 3-已结束
+     * @param userId  当前用户id
+     * @return: com.ruixuan.common.core.domain.ResultResponse<java.util.List<com.ruixuan.salesLeads.pojo.SaleClueInfoPojo>>
+     * @author: zianY
+     */
+    @Override
+    public ResultResponse selectSaleClueTaskList(String sellerName,Integer state, Long userId) {
+        PageUtils.startPage();
+        List<SaleClueInfoPojo> saleList =  saleClueInfoMapper.selectSaleClueTaskList(sellerName,state, userId);
+
+        saleList.forEach(cluePojo -> {
+            //获取最新一条记录信息
+            List<SaleClueRecordInfoPojo> list = saleClueRecordInfoMapper.selectDistributionList(cluePojo.getSellerId());
+            cluePojo.setRecordTask(StringUtils.isEmpty(list) ? null : list.get(list.size()-1));
+        });
+
+
+        return ResultResponse.successMsg("查询成功。",new TableDataInfo(saleList,new Long(new PageInfo(saleList).getTotal()).intValue()));
+    }
 
 
 
+    /**
+     *
+     * @description: 销售线索-分配-显示数据信息
+     *
+     * @param sellerIds 卖家id
+     * @return: com.ruixuan.common.core.domain.ResultResponse<java.util.List<com.ruixuan.salesLeads.pojo.SaleClueInfoPojo>>
+     * @author: zianY
+     */
+    @Override
+    public ResultResponse<List<SaleClueInfoPojo>> selectSaleClueInfoBySellers(List<Long> sellerIds){
+        List<SaleClueInfoPojo> saleList =  saleClueInfoMapper.selectSaleClueInfoBySellers(sellerIds);
         return ResultResponse.successMsg("查询成功。",saleList);
     }
 
 
+    /**
+     *
+     * @description: 销售线索-分配
+     *
+     * @param sellerIds 卖家ids
+     * @param saleId 销售id
+     * @param createUserId
+     * @return: com.ruixuan.common.core.domain.ResultResponse
+     * @author: zianY
+     */
+    @Override
+    public ResultResponse saleClueDistribution(List<String> sellerIds, Long saleId,Long createUserId){
+
+         sellerIds.forEach(sellerId -> {
+             //修改销售线索 销售
+             saleClueInfoMapper.updateSaleClueSale(Long.valueOf(sellerId),saleId,1);
+             // 修改线索 状态
+             saleClueInfoMapper.updateSaleClueState(Long.valueOf(sellerId),2);
+             //添加 分配记录
+             saleClueDistributionInfoMapper.insertSaleClueDistribution(new SaleClueDistributionInfoPojo(Long.valueOf(sellerId),saleId,createUserId));
+         });
+
+        return ResultResponse.successMsg("分配销售成功。",null);
+    }
+
+
+
+    /**
+     *
+     * @description:销售线索任务-查询用户代办以及本周完成的数量汇总
+     *
+     * @param userId
+     * @return: com.ruixuan.common.core.domain.ResultResponse
+     * @author: zianY
+     */
+    @Override
+    public ResultResponse getTaskNumber(Long userId){
+         Map<String,Integer> resultMap = new HashMap<>();
+         //获取当前周的开始和截至时间
+         Map<String,String> map = DateUtils.getWeekBeginAndEnd();
+
+         //本周有意向合作
+         int complete = saleClueRecordInfoMapper.selectSaleClueIntention(userId,map.get("begin"),map.get("end"));
+         //用户代办-包括未开始与进行中
+         int noStarted = saleClueInfoMapper.selectSaleClueComplete(userId);
+
+         resultMap.put("complete",complete);
+         resultMap.put("noStarted",noStarted);
+
+        return ResultResponse.successMsg("销售汇总查询成功。",resultMap);
+    }
+
+
+    /**
+     * 销售线索任务-回显线索详情
+     * @param sellerId
+     * @return
+     */
+    @Override
+    public ResultResponse getSaleTaskInfoBySellerId(Long sellerId){
+
+        SaleTaskInfoVo saleTaskInfoVo = new SaleTaskInfoVo();
+          //线索详情
+        SaleRecordVo saleInfo = saleClueInfoMapper.selectSaleClueInfoBySellerId(sellerId);
+         //记录信息
+        List<SaleClueRecordInfoPojo> recordList = saleClueRecordInfoMapper.selectDistributionList(sellerId);
+
+        saleTaskInfoVo.setSaleRecordVo(saleInfo);
+        saleTaskInfoVo.setRecordList(recordList);
+        saleTaskInfoVo.setNextNum(StringUtils.isEmpty(recordList) ? 1 : recordList.size()+1);
+
+        return ResultResponse.successMsg("查询成功。",saleTaskInfoVo);
+    }
+
+
+    /**
+     * 销售线索任务-新增跟进记录
+     * @param recordInfoPojo
+     * @return
+     */
+    @Override
+    public ResultResponse insertSaleTaskRecord(SaleClueRecordInfoPojo recordInfoPojo){
+
+        //新增跟进记录
+        saleClueRecordInfoMapper.insertSaleRedord(recordInfoPojo);
+
+        //修改线索状态
+        //是否继续跟进 1-继续跟进 2-意向合作 3-跟进完成无合作
+        if (recordInfoPojo.getContinueFlag() == 1){
+            //线索状态 1-未开始 2-进行中 3-已结束
+            saleClueInfoMapper.updateSaleClueState(recordInfoPojo.getSellerId(),2);
+        }
+
+        if (recordInfoPojo.getContinueFlag() == 2){
+            //意向合作 1-不合作可跟进 2-添加微信 3-操盘合作 4-服务商合作 5-金牛合作 6-无法添加微信
+            if (StringUtils.equals(recordInfoPojo.getIntendedCooperation(),"1")
+                    || StringUtils.isEmpty(recordInfoPojo.getIntendedCooperation())){
+                saleClueInfoMapper.updateSaleClueState(recordInfoPojo.getSellerId(),2);
+            }else{
+                saleClueInfoMapper.updateSaleClueState(recordInfoPojo.getSellerId(),3);
+            }
+        }
+
+        if (recordInfoPojo.getContinueFlag() == 3){
+            saleClueInfoMapper.updateSaleClueState(recordInfoPojo.getSellerId(),3);
+        }
+        return ResultResponse.successMsg("新增跟进记录成功。",null);
+    }
+
+
+
+
+
+    /**
+     *
+     * @description: 销售线索-转面销/电销
+     *
+     * @param sellerId 卖家id
+     * @param offlineSaleFlag 类型1-电销 2-面销
+     * @param saleId 销售人员
+     * @param createUserId
+     * @return: com.ruixuan.common.core.domain.ResultResponse
+     */
+    @Override
+    public ResultResponse saleClueToOffline(Long sellerId,int offlineSaleFlag,Long saleId,Long createUserId){
+        saleClueInfoMapper.updateSaleClueOfflineFlag(sellerId,offlineSaleFlag,saleId);
+        return ResultResponse.successMsg("成功。",null);
+    }
+
+
+
 
 
 

+ 65 - 61
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/utils/CsvImportUtil.java

@@ -1,14 +1,19 @@
 package com.ruixuan.salesLeads.utils;
 
 
+import cn.hutool.core.text.csv.CsvWriter;
 import com.ruixuan.common.utils.StringUtils;
+import com.ruixuan.common.utils.file.FileUtils;
 import de.siegmar.fastcsv.reader.CsvContainer;
 import de.siegmar.fastcsv.reader.CsvReader;
 import de.siegmar.fastcsv.reader.CsvRow;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.util.IOUtils;
+import org.bouncycastle.util.test.Test;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.io.File;
+import java.io.*;
+import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -34,15 +39,29 @@ public class CsvImportUtil {
      * @throws Exception
      */
     public static List<Map<String,String>> readCSV(MultipartFile multipartFile)throws Exception {
-
         //multipartFile 转 file
         File file = CsvImportUtil.multipartFile2File(multipartFile);
 
         CsvReader csvReader = new CsvReader();
         csvReader.setContainsHeader(true);
+/*
+
+//        CsvContainer csv = csvReader.read(file, StandardCharsets.UTF_8);
+        CsvContainer csv = csvReader.read(file, Charset.forName("gbk"));
+*/
+
+//        String encoding = System.getProperty("file.encoding");
+//        System.out.println("系统编码===="+encoding);
+//        String os = System.getProperty("os.name");
+//        System.out.println("system----------"+os);
+
+        String charset = FileUtils.getFileEncoding(file);
+        System.out.println("文件编码===="+charset);
+
+        //FileUtils.addBom(file);
 
-        CsvContainer csv = csvReader.read(file, StandardCharsets.UTF_8);
-        //log.info("csv====>>>{}",csv.getRows());
+        InputStreamReader isr = new InputStreamReader(new FileInputStream(file),charset);
+        CsvContainer csv = csvReader.read(isr);
 
         //行数据
         List<CsvRow> rows = csv.getRows();
@@ -58,74 +77,59 @@ public class CsvImportUtil {
             Map<String,String> rowMap = rows.get(i).getFieldMap();
 
             rowMap.forEach((key,vlue)->{
+                System.out.println(key);
 
-                switch (key){
-                    case "卖家ID":
+                if (StringUtils.isNotNull(key)){
+                    String keyStr = key.replace(" ","");
 
-                        objectMap.put("sellerId",vlue);
-                        break;
+                    if (StringUtils.isNotNull(vlue)){
+                        vlue = vlue.replace(" ","");
+                    }
 
 
-                    case "卖家昵称":
 
+                    if (keyStr.contains("家ID")){
+                        objectMap.put("sellerId",vlue);
+                    }
+                    if (keyStr.contains("昵称")){
                         objectMap.put("sellerName",vlue);
-                        break;
-
-
-                    case "粉丝数":
-
+                    }
+                    if (keyStr.contains("粉丝")){
                         objectMap.put("fans",vlue);
-                        break;
-
-                    case "所属行业":
-
+                    }
+                    if (keyStr.contains("行业")){
                         objectMap.put("industryId",vlue);
-                        break;
-
-
-                    case "常驻省份":
-
+                    }
+                    if (keyStr.contains("省份")){
                         objectMap.put("provinceId",vlue);
-                        break;
-
-
-                    case "常驻城市":
-
+                    }
+                    if (keyStr.contains("城市")){
                         objectMap.put("cityId",vlue);
-                        break;
-
-
-                    case "联系方式":
-
+                    }
+                    if (keyStr.contains("联系")){
                         objectMap.put("telephone",vlue);
-                        break;
-
-
-                    case "卖家是否绑定服务商":
-
-                        objectMap.put("providerFlag", StringUtils.isEmpty(vlue) ? "否" : vlue);
-                        break;
-
-                    case "是否跃迁":
-
-                        objectMap.put("transitionFlag",StringUtils.isEmpty(vlue) ? "0" : vlue);
-                        break;
-
-                }
-
-
-                if ((key).contains("30天")){
-                    objectMap.put("NearlyThirtyDays",vlue);
-                }
-
-                if ((key).contains("gmv")){
-                    objectMap.put("gmvMonth",key.substring(0,key.indexOf("gmv")));
-                    objectMap.put("gmv",vlue);
-                }
-
-                if (key.contains("mtd")){
-                    objectMap.put("mtdDate",key.substring(0,key.indexOf("mtd")));
-                    objectMap.put("mtd",vlue);
+                    }
+                    if (keyStr.contains("服务商")){
+                        //objectMap.put("providerFlag",StringUtils.isEmpty(vlue) ? "否" : vlue);
+                        objectMap.put("providerFlag",vlue);
+                    }
+                    if (keyStr.contains("跃迁")){
+                        //objectMap.put("transitionFlag",StringUtils.isEmpty(vlue) ? "否" : vlue);
+                        objectMap.put("transitionFlag",vlue);
+                    }
+                    if ((keyStr).contains("30天")){
+                        objectMap.put("NearlyThirtyDays",vlue);
+                    }
+
+                    if ((keyStr).contains("gmv") || keyStr.contains("GMV")){
+                        objectMap.put("gmvMonth",keyStr.substring(0,keyStr.length()-3));
+                        objectMap.put("gmv",vlue);
+                    }
+
+                    if (keyStr.contains("mtd") || keyStr.contains("MTD")){
+                        objectMap.put("mtdDate",keyStr.substring(0,keyStr.length()-3));
+                        objectMap.put("mtd",vlue);
+                    }
                 }
 
 

+ 0 - 142
ruixuan-salesLeads/src/main/java/com/ruixuan/salesLeads/listener/ImportExcelListener.java

@@ -1,142 +0,0 @@
-package com.ruixuan.salesLeads.listener;
-
-import com.alibaba.excel.context.AnalysisContext;
-import com.alibaba.excel.event.AnalysisEventListener;
-import com.alibaba.fastjson.JSON;
-import com.ruixuan.common.utils.StringUtils;
-import org.apache.poi.ss.formula.functions.T;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * ***************************************************
- *
- * @Auther: zianY
- * @Descipion: TODO
- * @CreateDate: 2022-05-24
- * ****************************************************
- */
-
-public class ImportExcelListener extends AnalysisEventListener<Map<Integer, String>> {
-
-
-    private static final Logger log = LoggerFactory.getLogger(ImportExcelListener.class);
-
-    public static List<Map<String,String>> importDataList = new ArrayList<>();
-
-    public static Map<Integer, String> importHeadList = new HashMap<>();
-
-
-
-    @Override
-    public void invoke(Map<Integer, String> data, AnalysisContext analysisContext) {
-
-        Map<String, String> ObjectMap = new HashMap<>();
-
-
-
-        log.info("解析到的一条数据=====excelRow = {}", JSON.toJSONString(data));
-
-        data.forEach((key,vlue) ->{
-            Object mapKey = importHeadList.get(key);
-            if (StringUtils.isNotNull(mapKey)){
-
-
-                String keyStr = (String)mapKey;
-
-                switch (keyStr){
-                    case "卖家ID":
-
-                        ObjectMap.put("sellerId",vlue);
-                        break;
-
-
-                    case "卖家昵称":
-
-                        ObjectMap.put("sellerName",vlue);
-                        break;
-
-
-                    case "粉丝数":
-
-                        ObjectMap.put("fans",vlue);
-                        break;
-
-                    case "所属行业":
-
-                        ObjectMap.put("industryId",vlue);
-                        break;
-
-
-                    case "常驻省份":
-
-                        ObjectMap.put("provinceId",vlue);
-                        break;
-
-
-                    case "常驻城市":
-
-                        ObjectMap.put("cityId",vlue);
-                        break;
-
-
-                    case "联系方式":
-
-                        ObjectMap.put("telephone",vlue);
-                        break;
-
-
-                    case "卖家是否绑定服务商":
-
-                        ObjectMap.put("providerFlag",StringUtils.isEmpty(vlue) ? "否" : vlue);
-                        break;
-
-                    case "是否跃迁":
-
-                        ObjectMap.put("transitionFlag",StringUtils.isEmpty(vlue) ? "0" : vlue);
-                        break;
-
-                }
-
-
-                if ((keyStr).contains("30天")){
-                    ObjectMap.put("NearlyThirtyDays",vlue);
-                }
-
-                if ((keyStr).contains("gmv")){
-                    ObjectMap.put("gmvMonth",keyStr.substring(0,keyStr.indexOf("gmv")));
-                    ObjectMap.put("gmv",vlue);
-                }
-
-                if (keyStr.contains("mtd")){
-                    ObjectMap.put("mtdDate",keyStr.substring(0,keyStr.indexOf("mtd")));
-                    ObjectMap.put("mtd",vlue);
-                }
-
-            }
-        });
-
-        importDataList.add(ObjectMap);
-
-
-    }
-
-    @Override
-    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
-        log.info("解析完所有数据===={}",importDataList);
-
-    }
-
-    @Override
-    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
-        log.info("表头数据===excelHead-->>>{}", headMap);
-        importHeadList.putAll(headMap);
-    }
-
-
-}

+ 28 - 0
ruixuan-salesLeads/src/main/resources/mapper/salesLeads/SaleClueDistributionInfoMapper.xml

@@ -0,0 +1,28 @@
+<?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.salesLeads.mapper.SaleClueDistributionInfoMapper">
+
+<!-- 新增销售线索 分配信息-->
+	<insert id="insertSaleClueDistribution">
+		insert into sale_clue_distribution_info(
+		seller_id,
+		sale_id,
+		create_user_id,
+		create_time)
+		values
+			(
+			#{sellerId},
+			#{saleId},
+			#{createUserId},
+			NOW()
+			)
+	</insert>
+
+
+
+
+
+
+</mapper> 

+ 178 - 1
ruixuan-salesLeads/src/main/resources/mapper/salesLeads/SaleClueInfoMapper.xml

@@ -48,6 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		</foreach>
 	</insert>
 
+
+	<!-- 销售线索列表信息 -->
 	<select id="selectSaleClueInfoList" resultType="com.ruixuan.salesLeads.pojo.SaleClueInfoPojo">
 		SELECT
 			s.id,
@@ -76,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			sale_clue_info s
 		<where>
 			<if test="sellerName !=null and sellerName != ''">
-				and s.seller_name like CONCAT('%', CONCAT(#{sellerName}, '%')) or s.seller_id like CONCAT('%', CONCAT(#{sellerName}, '%'))
+				and (s.seller_name like CONCAT('%', CONCAT(#{sellerName}, '%')) or s.seller_id like CONCAT('%', CONCAT(#{sellerName}, '%')))
 			</if>
 			<if test="uploadDate !=null and uploadDate != ''">
 				and s.upload_date = #{uploadDate}
@@ -87,6 +89,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="industryId !=null and industryId != ''">
 				and s.industry_id = #{industryId}
 			</if>
+			<if test="state !=null and state != ''">
+				and s.state = #{state}
+			</if>
+			<if test="salesLeadsType !=null and salesLeadsType != ''">
+				and s.sales_leads_type = #{salesLeadsType}
+			</if>
+			<if test="userId !=null and userId != ''">
+				and s.update_user_id = #{userId}
+			</if>
 			<if test="fansType == '1'.toString()">
 				and s.fans BETWEEN 0 AND 500000
 			</if>
@@ -99,18 +110,184 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="fansType == '4'.toString()">
 				and s.fans &gt;=5000000
 			</if>
+		</where>
+
+	</select>
+
+
+	<!-- 销售线索 任务 列表信息 -->
+	<select id="selectSaleClueTaskList" resultType="com.ruixuan.salesLeads.pojo.SaleClueInfoPojo">
+		SELECT
+			s.id,
+			s.sales_leads_type,
+			s.seller_id,
+			s.seller_name,
+			s.fans,
+			s.industry_id,
+			(SELECT name from sys_industry_info i where i.id = s.industry_id) industryName,
+			s.province_id,
+			(SELECT name from sys_area_info a WHERE a.`code` = s.province_id) provinceName,
+			s.city_id,
+			(SELECT name from sys_area_info a WHERE a.`code` = s.city_id) cityName,
+			s.telephone,
+			s.provider_flag,
+			s.transition_flag,
+			s.upload_date,
+			s.distribution_sale_flag,
+			s.sale_id,
+			(SELECT u.nick_name FROM sys_user u WHERE u.user_id = s.sale_id ) saleName,
+			s.state,
+			s.offline_sale_flag,
+			s.create_user_id,
+			s.create_time
+		FROM
+			sale_clue_info s
+		<where>
+			<if test="sellerName !=null and sellerName != ''">
+				and (s.seller_name like CONCAT('%', CONCAT(#{sellerName}, '%')) or s.seller_id like CONCAT('%', CONCAT(#{sellerName}, '%')))
+			</if>
+			<if test="state !=null and state != ''">
+				and s.state = #{state}
+			</if>
+			<if test="saleId !=null and saleId != ''">
+				and s.sale_id = #{saleId}
+			</if>
+		</where>
+
+	</select>
 
+	<!-- 根据卖家ids 查询销售线索 -->
+	<select id="selectSaleClueInfoBySellers" resultType="com.ruixuan.salesLeads.pojo.SaleClueInfoPojo">
+		SELECT
+			s.id,
+			s.sales_leads_type,
+			s.seller_id,
+			s.seller_name,
+			s.fans,
+			s.industry_id,
+			s.province_id,
+			s.city_id,
+			s.telephone,
+			s.provider_flag,
+			s.transition_flag,
+			s.upload_date,
+			s.distribution_sale_flag,
+			s.sale_id,
+			s.state,
+			s.offline_sale_flag,
+			s.create_user_id,
+			s.create_time
+		FROM
+			sale_clue_info s
+		<where>
+			<if test="sellerIds != null and sellerIds.size() != 0 ">
+				and s.seller_id in
+				<foreach collection="sellerIds" item="item" separator=","
+						 open="(" close=")">
+					#{item}
+				</foreach>
+			</if>
 		</where>
+	</select>
 
 
 
+	<!--  修改销售线索 销售人员 -->
+	<update id="updateSaleClueSale">
+		UPDATE sale_clue_info
+		SET
+		    distribution_sale_flag = #{distributionSaleFlag},
+			sale_id = #{saleId}
+			WHERE
+				seller_id = #{sellerId}
+	</update>
 
 
 
+	<!--  修改销售线索 状态 -->
+	<update id="updateSaleClueState">
+		UPDATE sale_clue_info
+		SET
+			state = #{state}
+			WHERE
+				seller_id = #{sellerId}
+	</update>
+
+
+
+	<!-- 根据销售 查询未完成数量 -->
+	<select id="selectSaleClueComplete" resultType="java.lang.Integer">
+		SELECT
+			COUNT( s.id )
+		FROM
+			sale_clue_info s
+		WHERE
+			s.sale_id = #{saleId}
+		  AND s.state != 3
+	</select>
+
+
+
+
+	<!-- 卖家id 查询销售记录信息  -->
+	<select id="selectSaleClueInfoBySellerId" resultType="com.ruixuan.salesLeads.pojo.vo.SaleRecordVo">
+		SELECT
+		s.id,
+		s.sales_leads_type,
+		s.seller_id,
+		s.seller_name,
+		s.fans,
+		s.industry_id,
+		(SELECT name from sys_industry_info i where i.id = s.industry_id) industryName,
+		s.province_id,
+		(SELECT name from sys_area_info a WHERE a.`code` = s.province_id) provinceName,
+		s.city_id,
+		(SELECT name from sys_area_info a WHERE a.`code` = s.city_id) cityName,
+		s.telephone,
+		s.provider_flag,
+		s.transition_flag,
+		s.upload_date,
+		s.distribution_sale_flag,
+		s.sale_id,
+		(SELECT u.nick_name FROM sys_user u WHERE u.user_id = s.sale_id ) saleName,
+		s.state,
+		s.offline_sale_flag,
+		s.create_user_id,
+		s.create_time,
+		q.nearly_thirty_days,
+		q.gmv_month,
+		q.gmv,
+		q.mtd_date,
+		q.mtd
+		FROM
+		sale_clue_info s
+		LEFT JOIN sale_quota_info q on s.seller_id = q.seller_id
+		<where>
+			<if test="sellerId !=null and sellerId != ''">
+				and s.seller_id = #{sellerId}
+			</if>
+		</where>
+		ORDER BY q.create_time DESC
+		limit 1
 
 	</select>
 
 
 
+	<!--  修改销售线索 销售类别 电销或面销 -->
+	<update id="updateSaleClueOfflineFlag">
+		UPDATE sale_clue_info
+		SET
+			offline_sale_flag = #{offlineSaleFlag},
+			sale_id = #{saleId}
+		WHERE
+			seller_id = #{sellerId}
+	</update>
+
+
+
+
+
+
 
 </mapper> 

+ 93 - 0
ruixuan-salesLeads/src/main/resources/mapper/salesLeads/SaleClueRecordInfoMapper.xml

@@ -33,6 +33,99 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
 
+	<!-- 根据销售 查询 本周有意向的数量 -->
+	<select id="selectSaleClueIntention" resultType="java.lang.Integer">
+		SELECT
+			COUNT( a.id ) num
+		FROM
+		(
+		SELECT
+			r.id,
+			r.seller_id,
+			r.record_times,
+			r.continue_flag,
+			r.intended_cooperation,
+			r.create_user_id,
+			r.create_time
+		FROM
+			sale_clue_record_info r
+		) a,
+		(
+			SELECT MAX(r1.record_times) record_times,r1.seller_id FROM sale_clue_record_info r1
+			GROUP BY r1.seller_id
+		)b
+		WHERE a.seller_id = b.seller_id and a.record_times = b.record_times
+		and a.create_user_id = #{saleId}
+		AND a.create_time &gt;= #{startTime}
+		AND a.create_time &lt;= #{endTime}
+		AND (a.continue_flag = 3 or a.intended_cooperation IN ( 2, 3, 4, 5, 6))
+
+	</select>
+
+
+
+
+	<!-- 卖家id 查询销售记录  -->
+	<select id="selectDistributionList" resultType="com.ruixuan.salesLeads.pojo.SaleClueRecordInfoPojo">
+		SELECT
+		r.id,
+		r.seller_id,
+		r.record_times,
+		r.record_script,
+		r.continue_flag,
+		r.intended_cooperation,
+		r.record_info,
+		r.remarks,
+		r.create_user_id,
+		r.create_time,
+		(SELECT MIN(create_time) FROM sale_clue_record_info WHERE seller_id = #{sellerId}) as taskTime
+		FROM
+		sale_clue_record_info r
+		<where>
+			<if test="sellerId !=null and sellerId != ''">
+				and r.seller_id = #{sellerId}
+			</if>
+		</where>
+		ORDER BY r.record_times
+
+	</select>
+
+
+
+
+
+	<!-- 添加销售记录  -->
+	<insert id="insertSaleRedord">
+		insert into sale_clue_record_info (
+		seller_id,
+		record_times,
+		record_script,
+		continue_flag,
+		intended_cooperation,
+		record_info,
+		remarks,
+		create_user_id,
+		create_time)
+		values
+		(
+		 #{sellerId},
+		 #{recordTimes},
+		 #{recordScript},
+		 #{continueFlag},
+		 #{intendedCooperation},
+		 #{recordInfo},
+		 #{remarks},
+		 #{createUserId},
+		 NOW()
+		)
+
+
+	</insert>
+
+
+
+
+
 
 
 </mapper> 

+ 20 - 0
ruixuan-salesLeads/src/main/resources/mapper/salesLeads/SaleQuotaInfoMapper.xml

@@ -36,5 +36,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</insert>
 
 
+	<!-- 根据卖家id查看最新额度 -->
+	<select id="getSaleQuotaInfoBySellerId" resultType="com.ruixuan.salesLeads.pojo.SaleQuotaInfoPojo">
+		SELECT
+			q.id,
+			q.nearly_thirty_days,
+			q.gmv_month,
+			q.gmv,
+			q.mtd_date,
+			q.mtd,
+			q.create_time
+		FROM
+			sale_quota_info q
+		WHERE
+			q.seller_id = #{sellerId}
+		ORDER BY
+			q.create_time DESC
+			LIMIT 1
+	</select>
+
+
 
 </mapper> 

+ 0 - 7
ruixuan-system/src/main/java/com/ruixuan/system/domain/SysIndustryInfo.java

@@ -9,22 +9,15 @@ package com.ruixuan.system.domain;
  * @CreateDate: 2022-05-24
  * ****************************************************
  */
-
-
-
 public class SysIndustryInfo {
 
-
     private int id;
 
-
     //父id
     private int parentId;
 
-
     //行业名称
     private String name;
-
     //排序
     private int sort;
 

+ 6 - 0
ruixuan-system/src/main/java/com/ruixuan/system/mapper/SysIndustryInfoMapper.java

@@ -21,5 +21,11 @@ public interface SysIndustryInfoMapper{
      */
     public SysIndustryInfo getIndustryInfoByName(String name);
 
+    /**
+     * 查询全部行业
+     * @return
+     */
+    public List<SysIndustryInfo> getIndustryInfoList();
+
 
 }

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

@@ -1,6 +1,8 @@
 package com.ruixuan.system.mapper;
 
 import java.util.List;
+
+import com.alibaba.fastjson.JSONObject;
 import org.apache.ibatis.annotations.Param;
 import com.ruixuan.common.core.domain.entity.SysUser;
 
@@ -124,4 +126,36 @@ public interface SysUserMapper
      * @return 结果
      */
     public SysUser checkEmailUnique(String email);
+
+    /**
+     * 查询角色集
+     *
+     * @param type 1-运营/2-销售
+     * @return 结果
+     */
+    List<JSONObject> queryRoles(String type);
+
+    List<JSONObject> queryUserByIds(@Param("userIds") List<String> userIds);
+
+
+    /**
+     * 根据用户id 查询用户和角色信息
+     * @param userId
+     * @return
+     */
+    List<JSONObject> getUserRoleByUserId(Long userId);
+
+    /**
+     * 根据角色名称 查询用户信息
+     * @param roleCodeList
+     * @return
+     */
+    List<JSONObject> getUserByRoleName(@Param("roleCodeList") List<String> roleCodeList);
+
+
+
+
+
+
+
 }

+ 20 - 0
ruixuan-system/src/main/java/com/ruixuan/system/service/ISysIndustryService.java

@@ -0,0 +1,20 @@
+package com.ruixuan.system.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.core.domain.ResultResponse;
+import com.ruixuan.common.core.domain.entity.SysUser;
+
+import java.util.List;
+
+/**
+ * 行业分类
+ *
+ * @author zian Y
+ */
+public interface ISysIndustryService {
+
+
+
+    ResultResponse getIndustryInfoList();
+
+}

+ 41 - 23
ruixuan-system/src/main/java/com/ruixuan/system/service/ISysUserService.java

@@ -1,18 +1,20 @@
 package com.ruixuan.system.service;
 
 import java.util.List;
+
+import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.core.domain.entity.SysUser;
 
 /**
  * 用户 业务层
- * 
+ *
  * @author ruixuan
  */
 public interface ISysUserService
 {
     /**
      * 根据条件分页查询用户列表
-     * 
+     *
      * @param user 用户信息
      * @return 用户信息集合信息
      */
@@ -20,7 +22,7 @@ public interface ISysUserService
 
     /**
      * 根据条件分页查询已分配用户角色列表
-     * 
+     *
      * @param user 用户信息
      * @return 用户信息集合信息
      */
@@ -28,7 +30,7 @@ public interface ISysUserService
 
     /**
      * 根据条件分页查询未分配用户角色列表
-     * 
+     *
      * @param user 用户信息
      * @return 用户信息集合信息
      */
@@ -36,7 +38,7 @@ public interface ISysUserService
 
     /**
      * 通过用户名查询用户
-     * 
+     *
      * @param userName 用户名
      * @return 用户对象信息
      */
@@ -44,7 +46,7 @@ public interface ISysUserService
 
     /**
      * 通过用户ID查询用户
-     * 
+     *
      * @param userId 用户ID
      * @return 用户对象信息
      */
@@ -52,7 +54,7 @@ public interface ISysUserService
 
     /**
      * 根据用户ID查询用户所属角色组
-     * 
+     *
      * @param userName 用户名
      * @return 结果
      */
@@ -60,7 +62,7 @@ public interface ISysUserService
 
     /**
      * 根据用户ID查询用户所属岗位组
-     * 
+     *
      * @param userName 用户名
      * @return 结果
      */
@@ -68,7 +70,7 @@ public interface ISysUserService
 
     /**
      * 校验用户名称是否唯一
-     * 
+     *
      * @param userName 用户名称
      * @return 结果
      */
@@ -92,21 +94,21 @@ public interface ISysUserService
 
     /**
      * 校验用户是否允许操作
-     * 
+     *
      * @param user 用户信息
      */
     public void checkUserAllowed(SysUser user);
 
     /**
      * 校验用户是否有数据权限
-     * 
+     *
      * @param userId 用户id
      */
     public void checkUserDataScope(Long userId);
 
     /**
      * 新增用户信息
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
@@ -114,7 +116,7 @@ public interface ISysUserService
 
     /**
      * 注册用户信息
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
@@ -122,7 +124,7 @@ public interface ISysUserService
 
     /**
      * 修改用户信息
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
@@ -130,7 +132,7 @@ public interface ISysUserService
 
     /**
      * 用户授权角色
-     * 
+     *
      * @param userId 用户ID
      * @param roleIds 角色组
      */
@@ -138,7 +140,7 @@ public interface ISysUserService
 
     /**
      * 修改用户状态
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
@@ -146,7 +148,7 @@ public interface ISysUserService
 
     /**
      * 修改用户基本信息
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
@@ -154,7 +156,7 @@ public interface ISysUserService
 
     /**
      * 修改用户头像
-     * 
+     *
      * @param userName 用户名
      * @param avatar 头像地址
      * @return 结果
@@ -163,7 +165,7 @@ public interface ISysUserService
 
     /**
      * 重置用户密码
-     * 
+     *
      * @param user 用户信息
      * @return 结果
      */
@@ -171,7 +173,7 @@ public interface ISysUserService
 
     /**
      * 重置用户密码
-     * 
+     *
      * @param userName 用户名
      * @param password 密码
      * @return 结果
@@ -180,7 +182,7 @@ public interface ISysUserService
 
     /**
      * 通过用户ID删除用户
-     * 
+     *
      * @param userId 用户ID
      * @return 结果
      */
@@ -188,7 +190,7 @@ public interface ISysUserService
 
     /**
      * 批量删除用户信息
-     * 
+     *
      * @param userIds 需要删除的用户ID
      * @return 结果
      */
@@ -196,11 +198,27 @@ public interface ISysUserService
 
     /**
      * 导入用户数据
-     * 
+     *
      * @param userList 用户数据列表
      * @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
      * @param operName 操作用户
      * @return 结果
      */
     public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
+
+    /**
+     * 查询角色集
+     *
+     * @param type 1-运营/2-销售
+     * @return 结果
+     */
+    List<JSONObject> queryRoles(String type);
+
+    List<JSONObject> queryUserByIds(List<String> userIds);
+
+
+    List<JSONObject> getUserRoleByUserId(Long userId);
+
+    List<JSONObject> getUserByRoleName(List<String> roleCodeList);
+
 }

+ 61 - 0
ruixuan-system/src/main/java/com/ruixuan/system/service/impl/SysIndustryServiceImpl.java

@@ -0,0 +1,61 @@
+package com.ruixuan.system.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.common.annotation.DataScope;
+import com.ruixuan.common.constant.UserConstants;
+import com.ruixuan.common.core.domain.ResultResponse;
+import com.ruixuan.common.core.domain.entity.SysRole;
+import com.ruixuan.common.core.domain.entity.SysUser;
+import com.ruixuan.common.exception.ServiceException;
+import com.ruixuan.common.utils.SecurityUtils;
+import com.ruixuan.common.utils.StringUtils;
+import com.ruixuan.common.utils.bean.BeanValidators;
+import com.ruixuan.common.utils.spring.SpringUtils;
+import com.ruixuan.system.domain.SysIndustryInfo;
+import com.ruixuan.system.domain.SysPost;
+import com.ruixuan.system.domain.SysUserPost;
+import com.ruixuan.system.domain.SysUserRole;
+import com.ruixuan.system.mapper.*;
+import com.ruixuan.system.service.ISysConfigService;
+import com.ruixuan.system.service.ISysIndustryService;
+import com.ruixuan.system.service.ISysUserService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import javax.annotation.Resource;
+import javax.validation.Validator;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 行业分类
+ * 
+ * @author zian Y
+ */
+@Service
+public class SysIndustryServiceImpl implements ISysIndustryService
+{
+    private static final Logger log = LoggerFactory.getLogger(SysIndustryServiceImpl.class);
+
+
+    @Resource
+    private SysIndustryInfoMapper sysIndustryInfoMapper;
+
+
+    @Override
+    public ResultResponse getIndustryInfoList() {
+        List<SysIndustryInfo> list = sysIndustryInfoMapper.getIndustryInfoList();
+        return ResultResponse.successMsg("查询全部行业成功。",list);
+
+
+    }
+
+
+
+}

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

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

+ 6 - 0
ruixuan-system/src/main/resources/mapper/system/SysIndustryMapper.xml

@@ -13,5 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 
+	<!-- 查询全部信息-->
+	<select id="getIndustryInfoList" resultType="com.ruixuan.system.domain.SysIndustryInfo">
+		select * from sys_industry_info
+	</select>
+
+
 
 </mapper> 

+ 347 - 211
ruixuan-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -1,221 +1,357 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruixuan.system.mapper.SysUserMapper">
 
-    <resultMap type="SysUser" id="SysUserResult">
-        <id     property="userId"       column="user_id"      />
-        <result property="deptId"       column="dept_id"      />
-        <result property="userName"     column="user_name"    />
-        <result property="nickName"     column="nick_name"    />
-        <result property="email"        column="email"        />
-        <result property="phonenumber"  column="phonenumber"  />
-        <result property="sex"          column="sex"          />
-        <result property="avatar"       column="avatar"       />
-        <result property="password"     column="password"     />
-        <result property="status"       column="status"       />
-        <result property="delFlag"      column="del_flag"     />
-        <result property="loginIp"      column="login_ip"     />
-        <result property="loginDate"    column="login_date"   />
-        <result property="createBy"     column="create_by"    />
-        <result property="createTime"   column="create_time"  />
-        <result property="updateBy"     column="update_by"    />
-        <result property="updateTime"   column="update_time"  />
-        <result property="remark"       column="remark"       />
-        <association property="dept"    column="dept_id" javaType="SysDept" resultMap="deptResult" />
-        <collection  property="roles"   javaType="java.util.List"           resultMap="RoleResult" />
+    <resultMap type="com.ruixuan.common.core.domain.entity.SysUser" id="SysUserResult">
+        <id property="userId" column="user_id"/>
+        <result property="deptId" column="dept_id"/>
+        <result property="userName" column="user_name"/>
+        <result property="nickName" column="nick_name"/>
+        <result property="email" column="email"/>
+        <result property="phonenumber" column="phonenumber"/>
+        <result property="sex" column="sex"/>
+        <result property="avatar" column="avatar"/>
+        <result property="password" column="password"/>
+        <result property="status" column="status"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="loginIp" column="login_ip"/>
+        <result property="loginDate" column="login_date"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="remark" column="remark"/>
+        <association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult"/>
+        <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
     </resultMap>
-	
-    <resultMap id="deptResult" type="SysDept">
-        <id     property="deptId"    column="dept_id"     />
-        <result property="parentId"  column="parent_id"   />
-        <result property="deptName"  column="dept_name"   />
-        <result property="ancestors" column="ancestors"   />
-        <result property="orderNum"  column="order_num"   />
-        <result property="leader"    column="leader"      />
-        <result property="status"    column="dept_status" />
+
+    <resultMap id="deptResult" type="com.ruixuan.common.core.domain.entity.SysDept">
+        <id property="deptId" column="dept_id"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="ancestors" column="ancestors"/>
+        <result property="orderNum" column="order_num"/>
+        <result property="leader" column="leader"/>
+        <result property="status" column="dept_status"/>
     </resultMap>
-	
-    <resultMap id="RoleResult" type="SysRole">
-        <id     property="roleId"       column="role_id"        />
-        <result property="roleName"     column="role_name"      />
-        <result property="roleKey"      column="role_key"       />
-        <result property="roleSort"     column="role_sort"      />
-        <result property="dataScope"     column="data_scope"    />
-        <result property="status"       column="role_status"    />
+
+    <resultMap id="RoleResult" type="com.ruixuan.common.core.domain.entity.SysRole">
+        <id property="roleId" column="role_id"/>
+        <result property="roleName" column="role_name"/>
+        <result property="roleKey" column="role_key"/>
+        <result property="roleSort" column="role_sort"/>
+        <result property="dataScope" column="data_scope"/>
+        <result property="status" column="role_status"/>
     </resultMap>
-	
-	<sql id="selectUserVo">
-        select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, 
-        d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
-        r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
+
+    <sql id="selectUserVo">
+        select u.user_id,
+               u.dept_id,
+               u.user_name,
+               u.nick_name,
+               u.email,
+               u.avatar,
+               u.phonenumber,
+               u.password,
+               u.sex,
+               u.status,
+               u.del_flag,
+               u.login_ip,
+               u.login_date,
+               u.create_by,
+               u.create_time,
+               u.remark,
+               d.dept_id,
+               d.parent_id,
+               d.ancestors,
+               d.dept_name,
+               d.order_num,
+               d.leader,
+               d.status as dept_status,
+               r.role_id,
+               r.role_name,
+               r.role_key,
+               r.role_sort,
+               r.data_scope,
+               r.status as role_status
         from sys_user u
-		    left join sys_dept d on u.dept_id = d.dept_id
-		    left join sys_user_role ur on u.user_id = ur.user_id
-		    left join sys_role r on r.role_id = ur.role_id
+                 left join sys_dept d on u.dept_id = d.dept_id
+                 left join sys_user_role ur on u.user_id = ur.user_id
+                 left join sys_role r on r.role_id = ur.role_id
     </sql>
-    
+
     <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
-		select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
-		left join sys_dept d on u.dept_id = d.dept_id
-		where u.del_flag = '0'
-		<if test="userId != null and userId != 0">
-			AND u.user_id = #{userId}
-		</if>
-		<if test="userName != null and userName != ''">
-			AND u.user_name like concat('%', #{userName}, '%')
-		</if>
-		<if test="status != null and status != ''">
-			AND u.status = #{status}
-		</if>
-		<if test="phonenumber != null and phonenumber != ''">
-			AND u.phonenumber like concat('%', #{phonenumber}, '%')
-		</if>
-		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-			AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
-		</if>
-		<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-			AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
-		</if>
-		<if test="deptId != null and deptId != 0">
-			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
-		</if>
-		<!-- 数据范围过滤 -->
-		${params.dataScope}
-	</select>
-	
-	<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
-	    select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
-	    from sys_user u
-			 left join sys_dept d on u.dept_id = d.dept_id
-			 left join sys_user_role ur on u.user_id = ur.user_id
-			 left join sys_role r on r.role_id = ur.role_id
-	    where u.del_flag = '0' and r.role_id = #{roleId}
-	    <if test="userName != null and userName != ''">
-			AND u.user_name like concat('%', #{userName}, '%')
-		</if>
-		<if test="phonenumber != null and phonenumber != ''">
-			AND u.phonenumber like concat('%', #{phonenumber}, '%')
-		</if>
-		<!-- 数据范围过滤 -->
-		${params.dataScope}
-	</select>
-	
-	<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
-	    select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
-	    from sys_user u
-			 left join sys_dept d on u.dept_id = d.dept_id
-			 left join sys_user_role ur on u.user_id = ur.user_id
-			 left join sys_role r on r.role_id = ur.role_id
-	    where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL)
-	    and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and ur.role_id = #{roleId})
-	    <if test="userName != null and userName != ''">
-			AND u.user_name like concat('%', #{userName}, '%')
-		</if>
-		<if test="phonenumber != null and phonenumber != ''">
-			AND u.phonenumber like concat('%', #{phonenumber}, '%')
-		</if>
-		<!-- 数据范围过滤 -->
-		${params.dataScope}
-	</select>
-	
-	<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
-	    <include refid="selectUserVo"/>
-		where u.user_name = #{userName}
-	</select>
-	
-	<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
-		<include refid="selectUserVo"/>
-		where u.user_id = #{userId}
-	</select>
-	
-	<select id="checkUserNameUnique" parameterType="String" resultType="int">
-		select count(1) from sys_user where user_name = #{userName} limit 1
-	</select>
-	
-	<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
-		select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
-	</select>
-	
-	<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
-		select user_id, email from sys_user where email = #{email} limit 1
-	</select>
-	
-	<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
- 		insert into sys_user(
- 			<if test="userId != null and userId != 0">user_id,</if>
- 			<if test="deptId != null and deptId != 0">dept_id,</if>
- 			<if test="userName != null and userName != ''">user_name,</if>
- 			<if test="nickName != null and nickName != ''">nick_name,</if>
- 			<if test="email != null and email != ''">email,</if>
- 			<if test="avatar != null and avatar != ''">avatar,</if>
- 			<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
- 			<if test="sex != null and sex != ''">sex,</if>
- 			<if test="password != null and password != ''">password,</if>
- 			<if test="status != null and status != ''">status,</if>
- 			<if test="createBy != null and createBy != ''">create_by,</if>
- 			<if test="remark != null and remark != ''">remark,</if>
- 			create_time
- 		)values(
- 			<if test="userId != null and userId != ''">#{userId},</if>
- 			<if test="deptId != null and deptId != ''">#{deptId},</if>
- 			<if test="userName != null and userName != ''">#{userName},</if>
- 			<if test="nickName != null and nickName != ''">#{nickName},</if>
- 			<if test="email != null and email != ''">#{email},</if>
- 			<if test="avatar != null and avatar != ''">#{avatar},</if>
- 			<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
- 			<if test="sex != null and sex != ''">#{sex},</if>
- 			<if test="password != null and password != ''">#{password},</if>
- 			<if test="status != null and status != ''">#{status},</if>
- 			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			<if test="remark != null and remark != ''">#{remark},</if>
- 			sysdate()
- 		)
-	</insert>
-	
-	<update id="updateUser" parameterType="SysUser">
- 		update sys_user
- 		<set>
- 			<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
- 			<if test="userName != null and userName != ''">user_name = #{userName},</if>
- 			<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
- 			<if test="email != null ">email = #{email},</if>
- 			<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
- 			<if test="sex != null and sex != ''">sex = #{sex},</if>
- 			<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
- 			<if test="password != null and password != ''">password = #{password},</if>
- 			<if test="status != null and status != ''">status = #{status},</if>
- 			<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
- 			<if test="loginDate != null">login_date = #{loginDate},</if>
- 			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			<if test="remark != null">remark = #{remark},</if>
- 			update_time = sysdate()
- 		</set>
- 		where user_id = #{userId}
-	</update>
-	
-	<update id="updateUserStatus" parameterType="SysUser">
- 		update sys_user set status = #{status} where user_id = #{userId}
-	</update>
-	
-	<update id="updateUserAvatar" parameterType="SysUser">
- 		update sys_user set avatar = #{avatar} where user_name = #{userName}
-	</update>
-	
-	<update id="resetUserPwd" parameterType="SysUser">
- 		update sys_user set password = #{password} where user_name = #{userName}
-	</update>
-	
-	<delete id="deleteUserById" parameterType="Long">
-		update sys_user set del_flag = '2' where user_id = #{userId}
- 	</delete>
- 	
- 	<delete id="deleteUserByIds" parameterType="Long">
- 		update sys_user set del_flag = '2' where user_id in
- 		<foreach collection="array" item="userId" open="(" separator="," close=")">
- 			#{userId}
-        </foreach> 
- 	</delete>
-	
-</mapper> 
+        select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex,
+        u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from
+        sys_user u
+        left join sys_dept d on u.dept_id = d.dept_id
+        where u.del_flag = '0'
+        <if test="userId != null and userId != 0">
+            AND u.user_id = #{userId}
+        </if>
+        <if test="userName != null and userName != ''">
+            AND u.user_name like concat('%', #{userName}, '%')
+        </if>
+        <if test="status != null and status != ''">
+            AND u.status = #{status}
+        </if>
+        <if test="phonenumber != null and phonenumber != ''">
+            AND u.phonenumber like concat('%', #{phonenumber}, '%')
+        </if>
+        <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
+            AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+        </if>
+        <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
+            AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+        </if>
+        <if test="deptId != null and deptId != 0">
+            AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
+            ancestors) ))
+        </if>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+
+    <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
+        select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
+        from sys_user u
+        left join sys_dept d on u.dept_id = d.dept_id
+        left join sys_user_role ur on u.user_id = ur.user_id
+        left join sys_role r on r.role_id = ur.role_id
+        where u.del_flag = '0' and r.role_id = #{roleId}
+        <if test="userName != null and userName != ''">
+            AND u.user_name like concat('%', #{userName}, '%')
+        </if>
+        <if test="phonenumber != null and phonenumber != ''">
+            AND u.phonenumber like concat('%', #{phonenumber}, '%')
+        </if>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+
+    <select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
+        select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
+        from sys_user u
+        left join sys_dept d on u.dept_id = d.dept_id
+        left join sys_user_role ur on u.user_id = ur.user_id
+        left join sys_role r on r.role_id = ur.role_id
+        where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL)
+        and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and
+        ur.role_id = #{roleId})
+        <if test="userName != null and userName != ''">
+            AND u.user_name like concat('%', #{userName}, '%')
+        </if>
+        <if test="phonenumber != null and phonenumber != ''">
+            AND u.phonenumber like concat('%', #{phonenumber}, '%')
+        </if>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+
+    <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
+        <include refid="selectUserVo"/>
+        where u.user_name = #{userName}
+    </select>
+
+    <select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
+        <include refid="selectUserVo"/>
+        where u.user_id = #{userId}
+    </select>
+
+    <select id="checkUserNameUnique" parameterType="String" resultType="int">
+        select count(1)
+        from sys_user
+        where user_name = #{userName} limit 1
+    </select>
+
+    <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
+        select user_id, phonenumber
+        from sys_user
+        where phonenumber = #{phonenumber} limit 1
+    </select>
+
+    <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
+        select user_id, email
+        from sys_user
+        where email = #{email} limit 1
+    </select>
+
+    <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
+        insert into sys_user(
+        <if test="userId != null and userId != 0">user_id,</if>
+        <if test="deptId != null and deptId != 0">dept_id,</if>
+        <if test="userName != null and userName != ''">user_name,</if>
+        <if test="nickName != null and nickName != ''">nick_name,</if>
+        <if test="email != null and email != ''">email,</if>
+        <if test="avatar != null and avatar != ''">avatar,</if>
+        <if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
+        <if test="sex != null and sex != ''">sex,</if>
+        <if test="password != null and password != ''">password,</if>
+        <if test="status != null and status != ''">status,</if>
+        <if test="createBy != null and createBy != ''">create_by,</if>
+        <if test="remark != null and remark != ''">remark,</if>
+        create_time
+        )values(
+        <if test="userId != null and userId != ''">#{userId},</if>
+        <if test="deptId != null and deptId != ''">#{deptId},</if>
+        <if test="userName != null and userName != ''">#{userName},</if>
+        <if test="nickName != null and nickName != ''">#{nickName},</if>
+        <if test="email != null and email != ''">#{email},</if>
+        <if test="avatar != null and avatar != ''">#{avatar},</if>
+        <if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
+        <if test="sex != null and sex != ''">#{sex},</if>
+        <if test="password != null and password != ''">#{password},</if>
+        <if test="status != null and status != ''">#{status},</if>
+        <if test="createBy != null and createBy != ''">#{createBy},</if>
+        <if test="remark != null and remark != ''">#{remark},</if>
+        sysdate()
+        )
+    </insert>
+
+    <update id="updateUser" parameterType="SysUser">
+        update sys_user
+        <set>
+            <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
+            <if test="userName != null and userName != ''">user_name = #{userName},</if>
+            <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
+            <if test="email != null ">email = #{email},</if>
+            <if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
+            <if test="sex != null and sex != ''">sex = #{sex},</if>
+            <if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
+            <if test="password != null and password != ''">password = #{password},</if>
+            <if test="status != null and status != ''">status = #{status},</if>
+            <if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
+            <if test="loginDate != null">login_date = #{loginDate},</if>
+            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            update_time = sysdate()
+        </set>
+        where user_id = #{userId}
+    </update>
+
+    <update id="updateUserStatus" parameterType="SysUser">
+        update sys_user
+        set status = #{status}
+        where user_id = #{userId}
+    </update>
+
+    <update id="updateUserAvatar" parameterType="SysUser">
+        update sys_user
+        set avatar = #{avatar}
+        where user_name = #{userName}
+    </update>
+
+    <update id="resetUserPwd" parameterType="SysUser">
+        update sys_user
+        set password = #{password}
+        where user_name = #{userName}
+    </update>
+
+    <delete id="deleteUserById" parameterType="Long">
+        update sys_user
+        set del_flag = '2'
+        where user_id = #{userId}
+    </delete>
+
+    <delete id="deleteUserByIds" parameterType="Long">
+        update sys_user set del_flag = '2' where user_id in
+        <foreach collection="array" item="userId" open="(" separator="," close=")">
+            #{userId}
+        </foreach>
+    </delete>
+
+
+    <select id="queryRoles" parameterType="String" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.user_id as 'userId',
+        nick_name as 'nickName'
+        FROM sys_user t1
+        INNER JOIN sys_user_role t2 ON t1.user_id = t2.user_id
+        WHERE t1.status = 0
+        <if test="type == 1 ">
+            AND t2.role_id in (SELECT role_id FROM sys_role WHERE role_key in (
+            'liveBroadcastOperation',
+            'centralControl',
+            'fieldControl',
+            'component',
+            'operations',
+            'operationsManager',
+            'directorOperations'
+            )
+            )
+        </if>
+        <if test="type == 2 ">
+            AND t2.role_id in (
+            SELECT role_id FROM sys_role WHERE role_key in (
+            'electricPin',
+            'facePin',
+            'eBayAmazon',
+            'salesDirector',
+            'merchantOperation',
+            'trader',
+            'traderTwo'
+            )
+            )
+        </if>
+    </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>
+
+
+
+    <!-- 根据用户id 查询用户和角色信息-->
+    <select id="getUserRoleByUserId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            u.*,
+            r.role_name,
+            r.role_key
+        FROM
+            sys_user u
+                LEFT JOIN sys_user_role ur ON ur.user_id = u.user_id
+                LEFT JOIN sys_role r ON r.role_id = ur.role_id
+        WHERE
+            r.del_flag = 0
+          AND u.del_flag = 0
+          AND u.STATUS = 0
+          AND u.user_id = #{userId}
+    </select>
+
+
+    <!-- 根据角色名称 查询用户信息-->
+    <select id="getUserByRoleName" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            u.*,
+            r.role_name,
+            r.role_key
+        FROM
+            sys_user u
+                LEFT JOIN sys_user_role ur ON ur.user_id = u.user_id
+                LEFT JOIN sys_role r ON r.role_id = ur.role_id
+        WHERE
+            r.del_flag = 0
+          AND u.del_flag = 0
+          AND u.STATUS = 0
+        <if test="roleCodeList != null and roleCodeList.size() != 0 ">
+            and r.role_key in
+            <foreach collection="roleCodeList" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+
+    </select>
+
+
+
+</mapper>